#!/usr/bin/env bash # Shared helper: enumerates the local (string-source) plugin entries declared in # .claude-plugin/marketplace.json. Sourced by scripts/sync-plugin-content.sh # (--all) and scripts/check-manifests.sh so a future marketplace.json schema # change (e.g. a new source type) only has to be handled in one place instead # of drifting between two hand-maintained copies of the same walk. # # Requires jq. Not meant to be executed directly -- source it. # list_marketplace_local_plugins # # Prints one "\t" line per local (string `source:`) # marketplace entry. Remote sources (github/git/npm objects) have no local # directory to walk and are skipped, matching both callers' prior behavior. list_marketplace_local_plugins() { local repo_root="$1" marketplace="$2" local plugin_count i name source_type source plugin_count="$(jq '.plugins | length' "$marketplace")" for ((i = 0; i < plugin_count; i++)); do source_type="$(jq -r ".plugins[$i].source | type" "$marketplace")" [[ "$source_type" == "string" ]] || continue name="$(jq -r ".plugins[$i].name" "$marketplace")" source="$(jq -r ".plugins[$i].source" "$marketplace")" source="${source#./}" printf '%s\t%s\n' "$name" "$repo_root/$source" done }