#!/bin/bash # Generate marketplace.json from converted plugins TARGET_DIR="/Users/junhuang/coolbuy/claude-marketplace/plugins" MARKETPLACE_FILE="/Users/junhuang/coolbuy/claude-marketplace/.claude-plugin/marketplace.json" echo "Generating marketplace.json..." # Start JSON cat > "$MARKETPLACE_FILE" << 'EOF' { "name": "coolbuy-claude-plugins", "owner": { "name": "Donglin Lai (qiudl)", "email": "qiudl@zhiyuncai.com" }, "metadata": { "description": "Custom Claude Code plugins for development workflows, DevOps, and business operations", "version": "1.0.0", "pluginRoot": "./plugins" }, "plugins": [ EOF # Loop through each plugin and extract info first=true for plugin_dir in "$TARGET_DIR"/*-plugin; do if [ ! -d "$plugin_dir" ]; then continue fi plugin_name=$(basename "$plugin_dir") manifest="$plugin_dir/.claude-plugin/plugin.json" if [ ! -f "$manifest" ]; then continue fi # Extract info from plugin.json using grep and sed description=$(grep '"description"' "$manifest" | head -1 | sed 's/.*"description": *"\([^"]*\)".*/\1/') version=$(grep '"version"' "$manifest" | head -1 | sed 's/.*"version": *"\([^"]*\)".*/\1/') # Determine category based on plugin name category="utility" keywords="" case "$plugin_name" in *dev-*|*coding*|*frontend*) category="development" keywords='["development", "coding", "workflow"]' ;; *ops-*|*deploy*|*server*) category="devops" keywords='["devops", "deployment", "operations"]' ;; *ai-proj*|*req*) category="productivity" keywords='["project-management", "tasks", "requirements"]' ;; *feishu*|*wecom*|*siyuan*) category="integration" keywords='["integration", "automation", "productivity"]' ;; *biz-*) category="business" keywords='["business", "planning", "contracts"]' ;; *session*) category="workflow" keywords='["session", "workflow", "productivity"]' ;; esac # Add comma if not first entry if [ "$first" = true ]; then first=false else echo "," >> "$MARKETPLACE_FILE" fi # Write plugin entry cat >> "$MARKETPLACE_FILE" << ENTRY { "name": "$plugin_name", "source": "$plugin_name", "description": "$description", "version": "$version", "category": "$category", "keywords": $keywords, "strict": false }ENTRY done # Close JSON cat >> "$MARKETPLACE_FILE" << 'EOF' ] } EOF echo "✓ Generated marketplace.json with $(grep -c '"name"' "$MARKETPLACE_FILE" | awk '{print $1-1}') plugins"