development: new version launched (v2.2.0) #32

Merged
lmiranda merged 12 commits from development into main 2026-01-20 15:23:12 +00:00
Showing only changes of commit 34c8f0bdb6 - Show all commits

139
scripts/validate-marketplace.sh Executable file
View File

@@ -0,0 +1,139 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
echo "=== Validating Marketplace ==="
# Check marketplace.json exists and is valid JSON
MARKETPLACE_JSON="$ROOT_DIR/.claude-plugin/marketplace.json"
if [[ ! -f "$MARKETPLACE_JSON" ]]; then
echo "ERROR: Missing $MARKETPLACE_JSON"
exit 1
fi
if ! jq empty "$MARKETPLACE_JSON" 2>/dev/null; then
echo "ERROR: Invalid JSON in marketplace.json"
exit 1
fi
echo "✓ marketplace.json is valid JSON"
# Check required fields
if ! jq -e '.name' "$MARKETPLACE_JSON" >/dev/null; then
echo "ERROR: Missing 'name' field in marketplace.json"
exit 1
fi
if ! jq -e '.owner.name' "$MARKETPLACE_JSON" >/dev/null; then
echo "ERROR: Missing 'owner.name' field in marketplace.json"
exit 1
fi
if ! jq -e '.owner.email' "$MARKETPLACE_JSON" >/dev/null; then
echo "ERROR: Missing 'owner.email' field in marketplace.json"
exit 1
fi
echo "✓ Required marketplace fields present"
# Check plugins array exists
if ! jq -e '.plugins | type == "array"' "$MARKETPLACE_JSON" >/dev/null; then
echo "ERROR: Missing or invalid 'plugins' array in marketplace.json"
exit 1
fi
# Check each plugin entry in marketplace.json
PLUGIN_COUNT=$(jq '.plugins | length' "$MARKETPLACE_JSON")
echo "Found $PLUGIN_COUNT plugins in marketplace.json"
for i in $(seq 0 $((PLUGIN_COUNT - 1))); do
PLUGIN_NAME=$(jq -r ".plugins[$i].name" "$MARKETPLACE_JSON")
echo "--- Checking marketplace entry: $PLUGIN_NAME ---"
# Check required fields in marketplace entry
for field in name source description version; do
if ! jq -e ".plugins[$i].$field" "$MARKETPLACE_JSON" >/dev/null; then
echo "ERROR: Missing '$field' in marketplace entry for $PLUGIN_NAME"
exit 1
fi
done
# Check author field
if ! jq -e ".plugins[$i].author.name" "$MARKETPLACE_JSON" >/dev/null; then
echo "ERROR: Missing 'author.name' in marketplace entry for $PLUGIN_NAME"
exit 1
fi
# Check homepage and repository
if ! jq -e ".plugins[$i].homepage" "$MARKETPLACE_JSON" >/dev/null; then
echo "WARNING: Missing 'homepage' in marketplace entry for $PLUGIN_NAME"
fi
if ! jq -e ".plugins[$i].repository" "$MARKETPLACE_JSON" >/dev/null; then
echo "WARNING: Missing 'repository' in marketplace entry for $PLUGIN_NAME"
fi
echo "✓ Marketplace entry $PLUGIN_NAME valid"
done
# Validate each plugin directory
PLUGINS_DIR="$ROOT_DIR/plugins"
echo ""
echo "=== Validating Plugin Directories ==="
for plugin_dir in "$PLUGINS_DIR"/*/; do
plugin_name=$(basename "$plugin_dir")
echo "--- Checking plugin directory: $plugin_name ---"
# Check plugin.json exists
plugin_json="$plugin_dir.claude-plugin/plugin.json"
if [[ ! -f "$plugin_json" ]]; then
echo "WARNING: Missing plugin.json in $plugin_name/.claude-plugin/"
continue
fi
# Validate JSON syntax
if ! jq empty "$plugin_json" 2>/dev/null; then
echo "ERROR: Invalid JSON in $plugin_name/plugin.json"
exit 1
fi
# Check required plugin fields
for field in name description version; do
if ! jq -e ".$field" "$plugin_json" >/dev/null; then
echo "ERROR: Missing '$field' in $plugin_name/plugin.json"
exit 1
fi
done
# Check recommended fields
if ! jq -e '.author.name' "$plugin_json" >/dev/null; then
echo "WARNING: Missing 'author.name' in $plugin_name/plugin.json"
fi
if ! jq -e '.homepage' "$plugin_json" >/dev/null; then
echo "WARNING: Missing 'homepage' in $plugin_name/plugin.json"
fi
if ! jq -e '.repository' "$plugin_json" >/dev/null; then
echo "WARNING: Missing 'repository' in $plugin_name/plugin.json"
fi
if ! jq -e '.license' "$plugin_json" >/dev/null; then
echo "WARNING: Missing 'license' in $plugin_name/plugin.json"
fi
if ! jq -e '.keywords | type == "array"' "$plugin_json" >/dev/null; then
echo "WARNING: Missing 'keywords' array in $plugin_name/plugin.json"
fi
# Check README exists
if [[ ! -f "$plugin_dir/README.md" ]]; then
echo "WARNING: Missing README.md in $plugin_name/"
fi
echo "$plugin_name valid"
done
echo ""
echo "=== All validations passed ==="