Why: eight comments and one status note cited CONTEXT.md or AGENTS.md text thatb9c7762and1929ffdmoved or deleted. All are inert at runtime, but they are the rationale comments that tell the next maintainer why an assertion exists, and they now name a file that no longer explains it. Implementation notes: re-anchored by what the citation is for, not uniformly. - Four sites quoted facts ADR-0013 owns — every rule is `level: error` with no ignorable tier (ADR-0013:59-70), and KyberforgeCopilot's `.agent.md`-only scope (ADR-0013:43-46). These now cite ADR-0013. ADRs are append-only here; the spec docs are refactored, which is what caused this rot. - Two sites quoted the glob location-independence property, which no ADR owns. The quote was already inline and carried the full rationale, so the citation added a rot surface and no information — dropped, statement kept. - sync-marketplace-mirror.sh's header attributed the mirror-not-a-profile fact to CONTEXT.md; the parenthetical beside it already carries the evidence, so the attribution is dropped rather than re-pointed. - .pre-commit-config.yaml cited an AGENTS.md instruction that no longer exists; generalised to "the documented instruction". - LESSONS.md:29 misquoted AGENTS.md's current session-start line. Also corrects a pre-existing misattribution at tests/test-vale-wrap.sh:454: AGENTS.md has never named bash 3.2 as a repo target (`git log -S'3.2'` on it is empty). LESSONS.md and the script headers do. Impact: no behaviour change. test-check-vale-style-sync.sh and test-vale-wrap.sh both pass (42 passed, 0 failed).
71 lines
3.3 KiB
Bash
Executable File
71 lines
3.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# .claude-plugin/marketplace.json is apm's compiled Claude marketplace output (see
|
|
# apm.yml's marketplace.outputs.claude). GitHub Copilot CLI's manifest lookup accepts
|
|
# that same file at .claude-plugin/marketplace.json directly, but also has a legacy
|
|
# convention path at .github/plugin/marketplace.json (see
|
|
# plugins/kyberforge/docs/research/docs/github-copilot-plugins/marketplace.md) -- and
|
|
# that path is a mirror of the Claude output, not a separate apm
|
|
# output profile (apm only ships "claude" and "codex" mappers; codex writes a
|
|
# differently-shaped file to .agents/plugins/marketplace.json, not this path). This
|
|
# script keeps that legacy mirror byte-identical to .claude-plugin/marketplace.json
|
|
# instead of letting it silently drift (see issue #90 comment thread).
|
|
|
|
# Hard error, not a `|| pwd` fallback. Every path this script touches hangs off
|
|
# REPO_ROOT, and both of its exits-0 paths are "the files agree" or "neither file
|
|
# exists" -- so a REPO_ROOT pointing somewhere that is not this repo reports "no
|
|
# drift" over a tree it never looked at. Run `--check` from an empty directory
|
|
# outside any worktree and the fallback made that the literal outcome: rev-parse
|
|
# failed, REPO_ROOT became $PWD, neither file was there, exit 0. Refusing to guess
|
|
# is the only answer that cannot be silently wrong; the `-f "$DST"` branch below
|
|
# covers a genuinely stale mirror, which is a different condition.
|
|
if ! REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || [[ -z "$REPO_ROOT" ]]; then
|
|
echo "Error: not inside a git worktree -- cannot locate the repository root, and guessing \$PWD would let --check report \"no drift\" over a tree it never inspected. Run this from within the repository." >&2
|
|
exit 1
|
|
fi
|
|
SRC="$REPO_ROOT/.claude-plugin/marketplace.json"
|
|
DST="$REPO_ROOT/.github/plugin/marketplace.json"
|
|
|
|
usage() {
|
|
echo "Usage: $0 [--check]" >&2
|
|
exit 1
|
|
}
|
|
|
|
CHECK=0
|
|
if [[ "${1:-}" == "--check" ]]; then
|
|
CHECK=1
|
|
shift
|
|
fi
|
|
[[ $# -eq 0 ]] || usage
|
|
|
|
if [[ ! -f "$SRC" ]]; then
|
|
# A missing source with a surviving mirror is drift, not absence: the mirror
|
|
# can only be stale (nothing is left for it to be byte-identical to), which is
|
|
# precisely the silent divergence this script exists to prevent. Exiting 0
|
|
# here would report "no drift" over a mirror of a file that no longer exists.
|
|
# (An unresolvable REPO_ROOT is handled above and is a hard error; this branch
|
|
# is only about a source file that is genuinely gone from a real worktree.)
|
|
# scripts/sync-plugin-content.sh --check --all already errors on the same
|
|
# condition ("requires .../marketplace.json"); this matches it.
|
|
# Neither file present stays a genuine no-op: nothing to mirror, nothing stale.
|
|
if [[ "$CHECK" -eq 1 && -f "$DST" ]]; then
|
|
echo "DRIFT $DST: mirror exists but .claude-plugin/marketplace.json does not" >&2
|
|
echo "Fix: restore .claude-plugin/marketplace.json (apm's compiled Claude marketplace output), or delete $DST" >&2
|
|
exit 1
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "$CHECK" -eq 1 ]]; then
|
|
if [[ ! -f "$DST" ]] || ! diff -q "$SRC" "$DST" >/dev/null 2>&1; then
|
|
echo "DRIFT $DST: out of sync with .claude-plugin/marketplace.json" >&2
|
|
echo "Fix: bash scripts/sync-marketplace-mirror.sh" >&2
|
|
exit 1
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
mkdir -p "$(dirname "$DST")"
|
|
cp "$SRC" "$DST"
|