forked from bchanot/claude
chore(hooks): retire the design-toolchain reminder hook
59 fires, 0 Reads of web-building.md (2026-10-31); the path rule and the CLAUDE.global.md pointer carry design routing. Hook, its test and its UserPromptSubmit entry removed; doctrine-citers T7c becomes T8i on a synthetic one-line fixture (quoted label kept whole).
This commit is contained in:
1 parent
97780b5f46
commit
9c038fd22b
5 files changed
+6
-152
No files matched your search
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib/tests/design-toolchain-reminder.test.sh
|
||||
set -u
|
||||
H="$(cd "$(dirname "$0")/../.." && pwd)/hooks/design-toolchain-reminder.sh"
|
||||
# Every hook call runs under a throwaway HOME (the fire log is
|
||||
# $HOME/.claude/logs/design-toolchain-fires.log): the suite never writes the
|
||||
# real one (1,770 of 2,779 logged fires were this suite's prompts, 2026-10-28).
|
||||
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
||||
export HOME="$T"
|
||||
LINE='Design work detected → Read ~/.claude/rules/web-building.md § "Design work — full toolchain" first. Trivial (≤2 files, cosmetic) → /hotfix.'
|
||||
pass=0; fail=0
|
||||
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
||||
# fire() -> "fire" if the hook emits the reminder, else "quiet".
|
||||
fire() { if printf '{"prompt":"%s"}' "$1" | bash "$H" | grep -q 'full toolchain'; then
|
||||
echo fire; else echo quiet; fi; }
|
||||
|
||||
# --- Dropped/neutralized tokens must be QUIET (non-UI senses) ---
|
||||
check D1-design "$(fire 'a design decision for the API')" quiet
|
||||
check D2-component "$(fire 'this system component')" quiet
|
||||
check D3-composant "$(fire 'le composant backend')" quiet
|
||||
check D4-theme "$(fire 'the theme of the audit')" quiet
|
||||
check D5-transition "$(fire 'state transition to develop')" quiet
|
||||
check D6-frontend "$(fire 'frontend architecture')" quiet
|
||||
check D7-palette "$(fire 'a palette of options')" quiet
|
||||
check D8-dash-file "$(fire 'ecc_dashboard.py')" quiet
|
||||
|
||||
# --- Harness-generated inputs must be QUIET even with UI tokens ---
|
||||
check D9-tasknotif "$(fire '<task-notification> <task-id>x</task-id> add css header fonts')" quiet
|
||||
check D10-notif-file "$(fire '<task-notification> design-motion-principles keyframe done')" quiet
|
||||
check D11-bare-ux "$(fire 'changement ux vu de tes trouvailles')" quiet
|
||||
check D12-agent-msg "$(fire '<agent-message from=a1> [Subagent hand-back] add css header fonts')" quiet
|
||||
|
||||
# --- Real UI signals must still FIRE ---
|
||||
check F1-button "$(fire 'add a button')" fire
|
||||
check F2-navbar "$(fire 'the navbar layout')" fire
|
||||
check F3-landing "$(fire 'build a landing page')" fire
|
||||
check F4-glass "$(fire 'a glassmorphism card')" fire
|
||||
check F5-redesign "$(fire 'redesign the app')" fire
|
||||
check F6-frontdesign "$(fire 'frontend design work')" fire
|
||||
check F7-admin-dash "$(fire 'admin dashboard screen')" fire
|
||||
check F8-animation "$(fire 'add an animation')" fire
|
||||
check F9-designsys "$(fire 'our design system')" fire
|
||||
check F10-bare-ui "$(fire 'revois l'\''ui du panneau admin')" fire
|
||||
check F11-pasted "$(fire '<pasted_content> add a button')" fire
|
||||
|
||||
# --- The one-liner is a contract (LRN-104): exact text ---
|
||||
check O1-exact-line "$(printf '{"prompt":"add a button"}' | bash "$H")" "$LINE"
|
||||
# the fires above landed in the throwaway HOME, positively (not a global count)
|
||||
check G1-fires-in-temp-home "$([ -s "$T/.claude/logs/design-toolchain-fires.log" ] && echo yes)" yes
|
||||
|
||||
# --- Fire is logged (time + token + excerpt) ---
|
||||
tmp="$(mktemp -d)"
|
||||
printf '{"prompt":"a glassmorphism card"}' | HOME="$tmp" bash "$H" >/dev/null 2>&1
|
||||
check L1-logged "$(grep -c 'glassmorph' "$tmp/.claude/logs/design-toolchain-fires.log" 2>/dev/null)" 1
|
||||
rm -rf "$tmp"
|
||||
|
||||
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
|
||||
@@ -140,8 +140,8 @@ check T5d-quoted-label-whole "$(printf '%s\n' "$out" | grep -c 'full kit')" 1
|
||||
check T5b-missing-file-named "$(printf '%s\n' "$out" | grep -c 'rules/none.md')" 1
|
||||
check T5c-prefix-not-a-heading "$(printf '%s\n' "$out" | grep -c '"Version"')" 1
|
||||
|
||||
# T8a-T8h: blind spots of the file-citation census (nested dirs, project
|
||||
# rules, home prefixes, left boundary, templates)
|
||||
# T8a-T8i: blind spots of the file-citation census (nested dirs, project
|
||||
# rules, home prefixes, left boundary, templates, quoted label kept whole)
|
||||
mkdir -p "$FIX/lib/sub" "$FIX/.claude/rules" "$FIX/templates/project-rules"
|
||||
printf '## Alpha\n' > "$FIX/lib/sub/x.md"
|
||||
printf 'nested: lib/sub/x.md § Alpha\n' > "$FIX/n1.md"
|
||||
@@ -184,6 +184,9 @@ printf 'tpl: templates/project-rules/t.md § Zeta.\n' > "$FIX/t2.md"
|
||||
citers_check_files "$FIX" "$FIX/t1.md" >/dev/null; rc1=$?
|
||||
citers_check_files "$FIX" "$FIX/t2.md" >/dev/null
|
||||
check T8h-template-rules-path "$rc1|$?" "0|1"
|
||||
# the retired design hook's pointer shape: ~ prefix + quoted label
|
||||
printf '%s\n' ' ~/.claude/rules/web-building.md § "Design work — full toolchain"' > "$FIX/pointer.sh"
|
||||
check T8i-tilde-quoted-label-whole "$(_citers_extract_files "$FIX/pointer.sh" | cut -d: -f3-)" 'rules/web-building.md:Design work — full toolchain'
|
||||
|
||||
# ── 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.)
|
||||
@@ -222,9 +225,6 @@ sed 's/^## Versioning$/## Version policy/' "$ROOT/rules/rest-api.md" > "$FIX/cop
|
||||
(cd "$ROOT" && citers_check_files "$FIX/copy" lib/architecture-defaults.md \
|
||||
lib/project-archetypes/rest-api-node.md) >/dev/null
|
||||
check T7b-real-rename-bites "$?" 2
|
||||
# the hook's pointer is checked whole, not as its "Design work" prefix
|
||||
check T7c-hook-label-whole "$(cd "$ROOT" && _citers_extract_files hooks/design-toolchain-reminder.sh \
|
||||
| grep -c ':rules/web-building.md:Design work — full toolchain$')" 2
|
||||
|
||||
echo "PASS=$pass FAIL=$fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
Reference in new issue
Block a user