fix(census,install): moved dirs scanned, real-dir remedy, impeccable adoption, retired list carries its rationale

Census scans the four moved dirs and bare skills/<n>/ citers, warns on
a pack id with no manifest, refuses equal fragments. Installers adopt a
real skills/impeccable with mv, never rm.
This commit is contained in:
bchanot committed 2026-11-02 11:48:46 +01:00
1 parent 9baba8a88a
commit 9327b4fcd0
12 files changed
+91 -28

No files matched your search

+16
View File
@@ -1,3 +1,19 @@
# The gstack skills this config never exposes: one name per line, read by
# lib/pack-census.sh (grep -qx), so these comment lines never match.
# A name listed is in no pack and no profile, `max` included. Pruned
# 2026-09-28 (BDR-105); the helpers once housed in lib/gstack-removed.sh
# are gone with the symlink toggling (BDR-117).
# Why each name went:
# ship base = origin/HEAD = main on Gitea, skips develop
# land-and-deploy `gh pr merge --squash --delete-branch` then deploys
# setup-deploy companion of land-and-deploy (Claude never deploys)
# autoplan reads ~/.claude/skills/gstack/plan-*/ paths that do
# not exist in this install
# context-save its pair context-restore is not linked; never used
# learn parallel JSONL store outside .claude/memory, unused
# careful, guard hooks exit 127 (missing bin path), vacuous; the house
# permissions.deny is stricter (BDR-095)
# design-shotgun mockups need OPENAI_API_KEY, absent
ship
land-and-deploy
setup-deploy
+14 -3
View File
@@ -1,6 +1,7 @@
# lib/pack-census-fragments.jq — fragment invariants (lib/pack-census.sh).
# $m = manifests [{id,on}], $deny = space-separated profiles that deny the
# two higgsfield connectors; inputs = lib/profiles/*.json. Prints RED lines.
# two higgsfield connectors; inputs = lib/profiles/*.json. Prints RED lines,
# and WARN lines for a pack id with no manifest.
def name_of: input_filename | sub(".*/"; "");
def dn: [(.deniedMcpServers // [])[] | .serverName] | sort;
[inputs | {f: name_of, frag: .}] as $all
@@ -8,7 +9,12 @@ def dn: [(.deniedMcpServers // [])[] | .serverName] | sort;
| ($full.enabledPlugins | keys) as $keys
| ($deny | split(" ") | map(. + ".json")) as $deny_files
| ($m | map({key: .id, value: .on}) | from_entries) as $mdef
| $all[]
| ($m | map(.id)) as $mids
| ( [$all[] | {f, ep: .frag.enabledPlugins, d: (.frag | dn)}] as $s
| ($s | to_entries[]) as $e
| $s[$e.key + 1:][] | select(.ep == $e.value.ep and .d == $e.value.d)
| "RED lib/profiles/\($e.value.f) and \(.f) are identical fragments" ),
( $all[]
| .f as $f | .frag as $g
| ( if ($g.enabledPlugins | keys) != $keys
then "RED lib/profiles/\($f): key set differs from full.json"
@@ -29,4 +35,9 @@ def dn: [(.deniedMcpServers // [])[] | .serverName] | sort;
($mdef | to_entries[] | select($g.enabledPlugins[.key] != .value)
| "RED lib/profiles/full.json: \(.key) is \($g.enabledPlugins[.key])"
+ " but the manifest default is \(.value)")
else empty end )
else empty end ),
( $g.enabledPlugins | keys[]
| select(startswith("pack-") and endswith("@skills-dir")
and (. as $k | $mids | index($k) == null))
| sub("@skills-dir$"; "") as $n
| "WARN lib/profiles/\($f): names \($n) with no skills/\($n)/" ) )
+16 -7
View File
@@ -35,7 +35,7 @@ PROFILES="$REPO/lib/profiles"
REMOVED="$REPO/lib/gstack-removed.list"
HERE="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FRAG_JQ="$HERE/pack-census-fragments.jq"
DENY_PROFILES="audit backend dev minimal qa seo" # spec § 2
DENY_PROFILES="audit dev minimal qa seo" # spec § 2
red=0; packs=0; skills=0
declare -A seen
red() { echo "RED $*"; red=1; }
@@ -52,6 +52,11 @@ check_manifest() { # $1 pack dir
[ "$name" = "$n" ] || red "$n: manifest name is $name"
}
dup_remedy() { # $1 skill listed flat and in a pack
if [ -L "$SKILLS/$1" ]; then echo "rm skills/$1 (a flat link)"
else echo "mv skills/$1 skills-external/$1 (a real dir)"; fi
}
check_entry() { # $1 pack dir, $2 entry path
local n s; n="$(basename "$1")"; s="$(basename "$2")"
if [ ! -e "$2/SKILL.md" ]; then
@@ -62,7 +67,7 @@ check_entry() { # $1 pack dir, $2 entry path
[ -f "$REMOVED" ] && grep -qx -- "$s" "$REMOVED" \
&& red "$n: $s is a retired gstack skill"
if [ -n "${seen[$s]:-}" ]; then
red "$s listed twice: ${seen[$s]} and $n — rm ${seen[$s]} (a flat link)"
red "$s listed twice: ${seen[$s]} and $n; run: $(dup_remedy "$s")"
else seen[$s]="$n"; fi
skills=$((skills+1))
}
@@ -73,7 +78,8 @@ check_fragments() {
out="$(jq -rn --arg deny "$DENY_PROFILES" --argjson m "$(manifests_json)" \
-f "$FRAG_JQ" "${files[@]}")" \
|| { red "lib/profiles: a fragment is not JSON"; return; }
[ -z "$out" ] || { echo "$out"; red=1; }
[ -z "$out" ] || echo "$out"
! grep -q '^RED' <<<"$out" || red=1
}
manifests_json() { # [{id, on}] for every pack manifest
@@ -82,6 +88,8 @@ manifests_json() { # [{id, on}] for every pack manifest
"$SKILLS"/pack-*/.claude-plugin/plugin.json 2>/dev/null || echo '[]'
}
# A bare `skills/<pack skill>/` is stale; the layout is
# `skills/pack-<n>/skills/<s>/`, and a path with any prefix passes.
# The old-layout terms are written with a bracketed last letter so this
# file never matches itself; the test's fixture strings live in
# lib/tests/fixtures/ (excluded) for the same reason.
@@ -89,7 +97,8 @@ check_citers() { # $@ pack skill names → one grep over the contract scope
local args=(-e 'skills-disable[d]/' -e 'toggle-externa[l]'
-e '\.active-profil[e]' -e 'lib/profiles/[a-z-]*\.profil[e]') n hit
for n in "$@"; do
args+=(-e "~/.claude/skills/$n\b" -e "\$HOME/.claude/skills/$n\b")
args+=(-e "~/.claude/skills/$n\b" -e "\$HOME/.claude/skills/$n\b"
-e "\(^\|[^A-Za-z0-9_./}~-]\)skills/$n/")
done
hit="$( { grep -rno --include='*.sh' --include='*.md' --include='*.py' \
--include='*.json' --include='Makefile' "${args[@]}" "$REPO"/hooks \
@@ -98,9 +107,9 @@ check_citers() { # $@ pack skill names → one grep over the contract scope
"$REPO"/README.md "$REPO"/USAGE.md "$REPO"/ARCHITECTURE.md \
"$REPO"/Makefile "$REPO"/plugins.lock.json 2>/dev/null
grep -nHo "${args[@]}" "$REPO"/.gitignore 2>/dev/null; } \
| grep -v -e '/lib/tests/fixtures/' -e '/skills/pack-' \
-e '/skills-external/' \
| sed 's#:[0-9]*:#\t#' | sort -u || true)"
| grep -v -e '/lib/tests/fixtures/' -e '/skills-external/' \
| sed -E 's#:[0-9]*:#\t#; s#\t[^\t](skills/[^/\t]+/)$#\t\1#' \
| sort -u || true)"
[ -n "$hit" ] || return 0
while IFS=$'\t' read -r f m; do
red "${f#"$REPO"/} cites $m"
+3 -2
View File
@@ -186,14 +186,15 @@ citers_check_files "$FIX" "$FIX/t2.md" >/dev/null
check T8h-template-rules-path "$rc1|$?" "0|1"
# ── real census: the repo's own citers against CLAUDE.global.md ──────────────
# (`impeccabl[e]` is a glob: the pack census must not read it as a citer.)
mapfile -t FILES < <(cd "$ROOT" && find skills agents lib rules hooks -type f \( -name '*.md' -o -name '*.sh' \) \
-not -path 'skills/graphify/*' -not -path 'skills-external/impeccable/*' -not -path 'skills/synced/*' \
-not -path 'skills/graphify/*' -not -path 'skills/impeccabl[e]/*' -not -path 'skills-external/impeccable/*' -not -path 'skills/synced/*' \
-not -path 'agents/impeccable-*' -not -path 'lib/tests/*' | sort)
# T6 also scans the templates and this repo's own project rules; T3 must not
# (there `CLAUDE.md` means a project CLAUDE.md, not the doctrine).
mapfile -t FILES_ALL < <(cd "$ROOT" && find skills agents lib rules hooks \
templates .claude/rules -type f \( -name '*.md' -o -name '*.sh' \) \
-not -path 'skills/graphify/*' -not -path 'skills-external/impeccable/*' \
-not -path 'skills/graphify/*' -not -path 'skills/impeccabl[e]/*' -not -path 'skills-external/impeccable/*' \
-not -path 'skills/synced/*' -not -path 'agents/impeccable-*' \
-not -path 'lib/tests/*' | sort)
# T8f: the T6 list reaches the two blind trees, the T3 list does not
+16 -1
View File
@@ -53,8 +53,12 @@ mv "$FX/skills/pack-alpha/.claude-plugin/plugin.json.bak" "$FX/skills/pack-alpha
ln -s ../skills-external/a1 "$FX/skills/a1"
out="$(census)"; rc=$?
check T5-dup-rc "$rc" 1; check_has T5-dup "$out" "RED a1 listed twice: skills/a1 and pack-alpha — rm skills/a1 (a flat link)"
check T5-dup-rc "$rc" 1; check_has T5-dup "$out" "RED a1 listed twice: skills/a1 and pack-alpha; run: rm skills/a1 (a flat link)"
rm "$FX/skills/a1"
mkdir "$FX/skills/a1"; touch "$FX/skills/a1/SKILL.md"
out="$(census)"
check_has T5-dup-real "$out" "run: mv skills/a1 skills-external/a1 (a real dir)"
rm -r "$FX/skills/a1"
ln -s "../../../skills-external/a1" "$FX/skills/pack-alpha/skills/gs-dead"
out="$(census)"; rc=$?
@@ -91,6 +95,17 @@ out="$(census)"; rc=$?
check T10-fixed-rc "$rc" 1; check_has T10-fixed "$out" "RED lib/profiles/dev.json: security-guidance@claude-code-plugins must be true"
mv "$FX/lib/profiles/dev.json.bak" "$FX/lib/profiles/dev.json"
# identical fragments; a pack id with no manifest (WARN, not RED)
cp "$FX/lib/profiles/dev.json" "$FX/lib/profiles/zdev.json"
out="$(census)"; rc=$?
check T13-same-rc "$rc" 1
check_has T13-same "$out" "RED lib/profiles/dev.json and zdev.json are identical fragments"
rm "$FX/lib/profiles/zdev.json"
sed 's/pack-beta@skills-dir": false/pack-beta@skills-dir": false, "pack-ghost@skills-dir": false/' "$FX/lib/profiles/dev.json" > "$FX/lib/profiles/ghost.json"
out="$(census)"; rc=$?
check_has T14-ghost "$out" "WARN lib/profiles/ghost.json: names pack-ghost with no skills/pack-ghost/"
rm "$FX/lib/profiles/ghost.json"
# real repo, hermetic part
out="$(bash "$ROOT/lib/pack-census.sh" 2>&1)"; rc=$?
check T11-real-rc "$rc" 0; check_has T11-real "$out" "PACKS OK 9 packs 55 skills"
+2 -2
View File
@@ -15,8 +15,8 @@ has() { if grep -qF "$2" "$R/$1"; then ok; else ko "$1 missing: $2"; fi; }
SEO=agents/seo-analyzer.md
GEO=agents/geo-analyzer.md
# 1) judge verdict grammar — DISPATCHER ERROR CONTRACT (skills/seo STEP 1,
# skills/geo STEP 1B) fail-closes on this exact shape
# 1) judge verdict grammar — DISPATCHER ERROR CONTRACT (skills/pack-seo/skills/seo STEP 1,
# skills/pack-seo/skills/geo STEP 1B) fail-closes on this exact shape
has "$SEO" 'SEO JUDGE — VERDICT: ERROR('
has "$GEO" 'GEO JUDGE — VERDICT: ERROR('
has "skills/pack-seo/skills/seo/SKILL.md" 'SEO JUDGE — VERDICT: ERROR('