fix(kyberforge): force plugin.json regeneration on every real sync
apm pack silently skips regenerating plugin.json when it already exists
("already exists; skipping plugin.json generation. Re-run with --force to
overwrite it."). sync-plugin-content.sh never passed --force, so
.claude-plugin/plugin.json and .github/plugin/plugin.json were written
once on first sync and never refreshed again -- a name/version/description
edit in a plugin's apm.yml would silently stop propagating, with no gate
catching it (check-manifests.sh only checks presence; check-plugin-content-
sync explicitly excludes plugin.json; apm-pack-check-clean is scoped to
marketplace.json only).
Pass --force on real-mode syncs only (--check must not mutate the plugin
root, so plugin.json staleness there stays a known, undetected gap until
the next real sync -- documented in the script's header comment).
Regenerating surfaced a second, unrelated bug: apm's writer and
pretty-format-json's --autofix disagree on JSON key order (semantic vs.
alphabetical), so every real sync would otherwise flip plugin.json's key
order right back after a commit re-alphabetized it. Excluded the four
apm-generated manifests (plugin.json x2, marketplace.json x2) from
pretty-format-json -- their exact formatting is dictated by apm's own
writer as compiled output, not this repo's generic JSON prettifier.
Verified idempotent: a second real sync after this fix produces zero
further diff.
Refs: #90
This commit is contained in:
@@ -15,9 +15,15 @@ set -euo pipefail
|
||||
#
|
||||
# plugin.json, apm.lock.yaml, and .mcp.json from the bundle are deliberately NOT
|
||||
# copied: .claude-plugin/plugin.json + .github/plugin/plugin.json are already
|
||||
# generated correctly by a separate apm code path (core/plugin_manifest.py, run as
|
||||
# part of the same `apm pack` invocation), and .mcp.json is hand-authored at the
|
||||
# plugin root per ADR-0015 (it is not an .apm/ primitive).
|
||||
# generated in-place at the plugin root by a separate apm code path
|
||||
# (core/plugin_manifest.py, run as part of the same `apm pack` invocation, keyed off
|
||||
# cwd rather than -o), and .mcp.json is hand-authored at the plugin root per ADR-0015
|
||||
# (it is not an .apm/ primitive). Real-mode syncs pass --force so that path actually
|
||||
# refreshes both files from current apm.yml/.apm/ content -- apm pack silently skips
|
||||
# regenerating an existing plugin.json otherwise ("already exists; skipping plugin.json
|
||||
# generation"), which would let them go stale after a name/version/description edit.
|
||||
# --check does NOT pass --force (it must not mutate the plugin root), so plugin.json
|
||||
# staleness is not currently detected by --check -- only fixed by the next real sync.
|
||||
#
|
||||
# hooks.json is only synced when .apm/hooks/ actually produces one -- a plugin with
|
||||
# no .apm/hooks/ content is left alone even if a root-level hooks.json already exists
|
||||
@@ -126,7 +132,10 @@ sync_one() {
|
||||
mkdir -p "$scratch"
|
||||
pack_log="$(mktemp)"
|
||||
|
||||
if ! (cd "$plugin_dir" && apm pack --format plugin -o "$scratch") >"$pack_log" 2>&1; then
|
||||
local force_flag=()
|
||||
[[ "$CHECK" -eq 0 ]] && force_flag=(--force)
|
||||
|
||||
if ! (cd "$plugin_dir" && apm pack --format plugin "${force_flag[@]}" -o "$scratch") >"$pack_log" 2>&1; then
|
||||
echo "FAIL $plugin_dir: apm pack failed:" >&2
|
||||
sed 's/^/ /' "$pack_log" >&2
|
||||
rm -f "$pack_log"
|
||||
|
||||
Reference in New Issue
Block a user