Merge feature/phase5-profiles-packs into develop

This commit is contained in:
bchanot committed 2026-11-02 13:25:40 +01:00
commit 3cc4e0d541
160 files changed
+2293 -3745

No files matched your search

+13
View File
@@ -232,6 +232,7 @@ rules:
- **Recurred same day**: this session's shell died the same way mid-G8 (BDR-095 amendment) while the 5.9 GB still sat there; recovered the moment the user deleted the dir. Mechanism now established, not inferred: stock `/usr/lib/systemd/system/tmp.mount` mounts /tmp with `x-systemd.graceful-option=usrquota` (no override, no fstab line on this machine) and systemd caps each user at 80% of the tmpfs → 0.8 × 7.4 GB = 5.9 GB, the exact volume observed. One quota for every session AND every sub-agent of the uid: multi-session is not the cause, the shared cap is.
- **Durable fix**: (1) launch claude with `TMPDIR=$HOME/.cache/claude-tmp` (in `~/.bashrc` `dtach_claude()`, before `exec claude`; `mkdir -p` it) → Claude Code's scratchpad, tool outputs, `mktemp` and npm staging all leave the tmpfs; children inherit. (2) `~/.config/user-tmpfiles.d/claude-tmp.conf` with `e %h/.cache/claude-tmp - - - 3d` + the user `systemd-tmpfiles-clean.timer` so dead-session dirs age out. (3) `make doctor` "Scratchpad" section warns while TMPDIR sits on a quota'd tmpfs. Probe rule unchanged: HOMEs with npm payloads under `~/.cache/<probe>/`.
- **Status**: cause established; open until the launcher exports TMPDIR (user's .bashrc, hand-managed). Links [[BDR-094]], [[BDR-095]], [[LRN-159]].
- **Status (2026-11-02)**: resolved 2026-11-02: lib/cc.sh exports TMPDIR=$HOME/.cache/claude-tmp for every cc session (phase 5)
## BLK-022 — `hooks/guard-bash.sh` withheld by the safety classifier; executable spec shipped instead — 2026-09-22
- **Friction**: layer C item G2 (PreToolUse Bash guard: whole-command scan incl. nested `bash -c`, `docker compose run … lftp`, scripts the command runs; exit 2 + reason + `logger` trace; fail-closed without jq). The response carrying the hook body was stopped by a safety classifier mid-write; content withheld, instruction not to regenerate it.
@@ -344,3 +345,15 @@ rules:
- **Measured**: 13 repos, 4 v1 closures without a labelled leading closed word: orbistep BLK-021 (really open), BLK-026 (prose addendum, really resolved), BLK-030 (mixed), bchanot-cv BLK-001 (strict already resolved, no effect). No lexical rule decides prose: BLK-021 and BLK-026 same shape, opposite truth.
- **Solution**: /bugfix bugfix/memory-upgrade-prose-closure: repair only from a `Status`/`Statut` label whose leading word closes; else refuse file (rc 2), name ID + v1 line + remedy `memory.sh status`. Dedupe IDs. Committed repos audited clean; orbistep + zenquality redone after fix.
- **Status (2026-10-31)**: resolved 2dae528: repair writes only a single closed Status word, prose/mixed refused and named, diff captured before inserts, one upgrade line per entry; orbistep + zenquality redone (144505f, b7edb9c)
## BLK-039 — Nested heredoc executed plan text: settings.json committed, user's stash popped [resolved] (2026-11-02)
- **Friction**: a Bash call holding a python heredoc that itself contained `<<'EOF'` blocks: the inner `EOF` closed the outer heredoc; the rest of the plan text ran as shell commands → `git stash push settings.json` (silently failed), `git commit` of settings.json WITH the UI writes (theme, switchModelsOnFlag), auto-pushed; `git stash pop` popped the USER's own stash `wip: settings+routing dirty (user)` (conflict, entry kept).
- **Real cause**: heredoc nesting with the same delimiter; `rm -r`-class rules did not matter, the damage was git state.
- **Solution**: tree restored (`git reset -q`, checkout of the three stash-touched files to HEAD, stash-brought spec removed), commit dropped with `git reset --soft HEAD~1` + `git push --force-with-lease=<branch>:<sha>` (user approved), user's stash untouched. Rule: plan/doc text via Write/Edit, never heredoc-in-heredoc; never `git stash pop` on a machine with the user's own stashes; settings.json only through the index recipe (LRN-253).
- **Status**: resolved 2026-11-01.
## BLK-040 — Permission rules and auto-mode classifier refuse destructive-shaped compound calls and dispatches [resolved] (2026-11-02)
- **Friction**: phase 5 execution: the permission rules refused a compound Bash call holding a `trap` with `rm -f`/`rmdir` (Task 1 canary), a 53-name `rm … && rmdir && rm .active-profile` chain, and `rmdir` alone; the auto-mode classifier refused the whole Task 2 dispatch because its brief described removing ~70 symlinks, moving impeccable and rewriting settings.json.
- **Real cause**: destructive-shaped text in one call or one brief; the classifier judges the dispatch prompt, the rules judge each command.
- **Solution**: split build steps (implementer) from state steps (main loop, after the user's explicit approval); one `rm` of literal names per call; `mv` to the scratch dir instead of `rmdir`/`rm -r`; never retry a refused command through a wrapper. Cost: three extra user gates, no data loss.
- **Status**: resolved 2026-11-02.
+11
View File
@@ -474,6 +474,7 @@ rules:
- **Caveats**: the symlink form (`skills/<name> -> skills-external/gstack/<name>`) differs from what gstack `./setup` would create (real dir + symlinked SKILL.md) — fine here because `./setup` never populates `skills/` in this layout, so no mixed-form collision. Browse RUNTIME still needs the built binary + sandbox env ([[BDR-029]]) — on-demand makes the skill DISCOVERABLE, not the browser functional on an unsupported OS. The old "try: bash link.sh" message was wrong (link.sh never creates gstack skills) → replaced with submodule-aware messages.
- **Alternatives rejected**: full gstack integration (make `./setup` install into `skills/`) — user picked option 1, too invasive/version-fragile; leave `full` broken with honest 1-line warning — worse UX; pre-symlink all gstack at install — violates OFF-by-default context policy.
- **Reference**: `lib/profile.sh` `GSTACK_SRC` + `enable_skill` gstack branch. Verified: `set full` → 0 missing, 35 on-demand; `minimal`↔`full` cycle re-parks/restores; git clean (gstack symlinks gitignored, [[LRN-025]]). Linked to [[LRN-042]], [[LRN-022]], [[BDR-018]] (gstack on/off verb).
- **Status (2026-11-02)**: superseded by BDR-134
---
@@ -1459,3 +1460,13 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
**Alternatives**: ignore negation (keeps false closures); line-scope negation (`resolved, not open` would read none: wrong); NLP (no).
**Consequences**: real-data replay 14 repos → 1 move (robin_petier EVAL-005 accepted → keep). mawk run in T17 guards BWK-class awk.
## BDR-134 — Phase 5: packs are skills-dir plugins, profiles are settings fragments, nothing global (2026-11-02)
- **Context**: one `~/.claude` serves every project and conversation. Old mechanism global: `skills/` ↔ `skills-disabled/` symlink moves + user-scope `claude plugin enable|disable` + `.active-profile`. One project's switch changed every open session.
- **Decision**: heavy skill groups = skills-dir plugins `skills/pack-<n>/` (manifest + tracked relative symlinks into `skills-external/`, 4 real dirs moved). 9 packs: design, scroll3d, seo, web-validate, gstack-dev, gstack-browser, gstack-design, higgsfield (OFF), extras (OFF). Profiles = literal settings fragments `lib/profiles/<n>.json` (`enabledPlugins` explicit for every pack + managed plugin, `deniedMcpServers` both higgsfield connectors on minimal/dev/seo/qa/audit, optional `model`); 9 profiles (backend, web-full dropped: byte-identical to dev, full). Per project `profile.sh set` merges into `.claude/settings.local.json`; per conversation `cc <name> <profile>` = `claude --settings`. `profile.sh current --plain` single truth for gate, hooks, statusline, advisor. No profile = manifest defaults = full. Listing budget `SLASH_COMMAND_TOOL_CHAR_BUDGET=50000` (0 name-only on full, +4.5k tokens est.).
- **Rationale**: measured 2026-11-01 (CLI 2.1.316): pack skills listed once as `pack:skill`, both names invoke; `--settings` false beats local true; `/reload-plugins` reloads a pack mid-session from a local edit but never re-reads a `--settings` file (frozen conversation → relaunch); connectors load under `-p`, denied per project by `serverName`, union across files.
- **Alternatives rejected**: keep symlink toggling (global, races between sessions); pack `.mcp.json` for higgsfield (duplicates the claude.ai connector, needs interactive OAuth); per-request confirmation of the gate (gate reads settings state, not files).
- **Supersedes**: BDR-030 (gstack via symlinks), BDR-079 (`set` symmetric on externals/MCPs), BDR-101 mechanism (full stays the policy). **Amends**: BDR-024/025 (`show --plain` → `current --plain`), BDR-109 (`higgsfield-websites` lives in pack-higgsfield, ON in `max` only; `profile.sh enable higgsfield` replaces both toggles; npm CLI unchanged).
- **Accepted risks**: `cc.sh` keeps `set -a; . ~/.claude/.env` (all secrets in the claude env, as `dtach_claude` did); `deniedMcpServers` union = `cc x web` on a `dev` project keeps the connectors denied (`set web` in the project fixes it).
- **Branch**: feature/phase5-profiles-packs; spec docs/superpowers/specs/2026-11-01-phase5-profiles-packs-design.md; contract .claude/tasks/contracts/2026-11-01-phase5-profiles-packs-1300.md.
Supersedes [[BDR-030]].
+7
View File
@@ -419,3 +419,10 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
- **Method**: 3-lens plan challenge + confirmation pass, per-task reviews, final opus/xhigh whole-branch review, GATE 0 oracles (10 runnable, c1-*.sh positive-controlled before work), fresh verifier, security gate.
- **Anomalies**: challenge found 4 MAJOR (c1-readers red mid-Task 3, worktree vs in place, finish blocked by user settings hunks, contract out of sync with r2); final review found the new-file Write gap (I1) everybody missed; verifier 1st run died on Fable credits (429), retry pinned opus; 2nd run ECARTS(5) all human micro-gate items (approved text not on disk, transient docs out of scope, 2 SC2016 waivers); every per-task review clean first pass.
- **Action**: keep oracles + positive control before dispatch; brief reviewers on new-file Write semantics for path rules; record gate texts on disk (contract) so the verifier can match them.
## EVAL-054 — Three-lens plan challenge + confirmation caught 5 BLOCKERs before execution (phase 5) (2026-11-02)
- **Check**: plan r1 (2060 lines) attacked by three blind opus challengers + one confirmation pass before execution.
- **Method**: challenge-plan.md; lenses correctness / robustness / simplicity; r2 rewritten; confirmation on r2.
- **Result**: r1 FATAL(11)/FATAL(10)/CONCERNS(5): BLOCKER = plan written on a stale tree (profile backend live); 30 jq per statusline refresh; settings.json procedure that would have discarded user writes; test precedence inverted; doctor abort under pipefail; worktree incompatibility. Confirmation on r2: 2 more BLOCKERs (keep list dropped the tracked `skills/model-router` link; census matched itself). All fixed before Task 1. Execution then needed 4 fix rounds (gates/reviews), none on those aspects.
- **Anomalies**: the simplicity lens duplicated two robustness findings; the confirmation pass still found BLOCKERs, so one pass is the floor, not the ceiling.
- **Action**: keep the 3+1 shape for plans over ~1000 lines; add "live state verified at Task 0" to the plan template.
+3
View File
@@ -681,3 +681,6 @@ rules:
## 2026-11-01
- memory-v2-minors /feat shipped (e4fb8f7 + 48ade8f): negated status words, dead empty steal, body `## ` refused, blob rc 1/2, rc 6 names dropped partial stages, reflow. Verifier CONFORME, security PASS, replay 14 repos = 1 expected move. Docs synced. Next: doc half, then phase 5 spikes.
- memory-v2-minors-docs /feat shipped (dfbc8a7): § WRITE says every verb takes -C and --body-file absolute; tour/deploy/audit-delta point at § WRITE; evals template Later status line. Verifier CONFORME, security PASS. Phase 4a minors fully closed; MIGRATION.md:209 parked. Next: phase 5 spikes.
## 2026-11-02
- phase 5 profiles+packs shipped on feature/phase5-profiles-packs (13 tasks SDD, 3-lens challenge, gates MET/CONFORME/PASS after 3 passes): 9 packs, 9 profile fragments, profile.sh one-jq current --plain, cc <name> [profile], census; BDR-134, LRN-248..253, BLK-039/040, EVAL-054; TODO: router ask-before-Fable queued
+30
View File
@@ -1881,3 +1881,33 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
**Pattern**: awk `match()` sets globals `RSTART`/`RLENGTH`; shared helper calling it clobbers caller's values. Take `substr(line, RSTART)` BEFORE calling any parser helper; audit every `RSTART` reader in programs embedding the shared awk block.
**Application**: any `_MEM_AWK` change touching match(); same for `$0`, `NF` side effects of `sub()`/`split()` in helpers.
## LRN-248 — skills-dir packs and claude.ai connectors: measured facts CLI 2.1.316 (2026-11-02)
- **Pattern**: skills-dir pack = `~/.claude/skills/<pack>/.claude-plugin/plugin.json` + `skills/<s>/SKILL.md`. Loads as `<name>@skills-dir` (manifest name, not folder). Nested skills listed ONCE as `pack:skill`; `Skill(skill)`, `Skill(pack:skill)`, typed `/skill`, `/pack:skill` all resolve. `defaultEnabled:false` → OFF with nothing written; local or `--settings` true turns it on. `--settings` false beats local true. `/reload-plugins` re-reads `enabledPlugins` from the settings files (skills + hooks mid-session; pack `.mcp.json` needs a new session) but NOT a `--settings` file: a pack OFF by flag comes back only through a relaunch. claude.ai connectors load under `-p` (2.1.316; not on 2026-10-25); `deniedMcpServers:[{serverName:"claude.ai X"}]` per project drops them (199 → 192 tools), `disableClaudeAiConnectors:true` drops all (any-source-true); lists UNION across files; `serverUrl` wildcard matches nothing (no URL exposed). Tool budget bare project 199 = 28 builtin + 1 model-router + 158 higgsfield + 8 Claude Docs + 4 Indeed.
- **Context**: phase 5 spikes, scratch projects, `claude -p … --output-format stream-json --verbose`, init message `plugins[] skills[] tools[] mcp_servers[]`.
- **Apply**: any per-project/per-conversation tool switching; design gates read the effective state, not files.
## LRN-249 — Claude Code settings root = git common dir; mirror it, stop below HOME (2026-11-02)
- **Pattern**: Claude Code reads/writes `.claude/settings.local.json` at the git repo root (worktree → main checkout root, `git rev-parse --path-format=absolute --git-common-dir` parent); shared `.claude/settings.json` from the session dir. A tool mirroring the effective state must resolve the root the same way, stop below `$HOME` (`~/.claude/` is not a project), and fall back to the nearest `.claude/`/`CLAUDE.md`/`.git` outside git.
- **Context**: `lib/profile.sh find_root`; code review caught the nearest-marker walk diverging in worktrees and monorepo packages.
- **Apply**: statusline, hooks, gates run from `.cwd`/`project_dir`; never trust `$PWD` as the project.
## LRN-250 — One jq pass over many files beats 30 jq spawns (13 ms vs 120 ms) (2026-11-02)
- **Pattern**: one jq program beats many: 30 jq spawns ≈ 120 ms (34 × `jq -n 1` = 118-137 ms measured); `jq -rn --rawfile a f1 --rawfile b f2 … -f prog.jq inputs…` with `def parse: try fromjson catch {}` and `input_filename` reads every file (absent → /dev/null → `{}`) in one pass. `current --plain` = 2 jq processes, 13-30 ms (target 50).
- **Context**: `lib/profile-state.jq`; statusline runs it on every refresh.
- **Apply**: any hook or statusline computing state from several JSON files.
## LRN-251 — Plan against a stale tree: re-survey at Task 0, derive removal lists at run time (2026-11-02)
- **Pattern**: a plan written against a tree surveyed hours earlier is wrong by execution time: the live machine had switched to profile `backend` (impeccable parked as a real dir, 54 parked links, 20 flat links) between survey and plan; hardcoded `rm`/`mv` lists failed, and the only fix path a blind executor sees destroys the only install. Cure: Task 0 = snapshot (`find … -printf '%y %p %l'`) + verify assumptions; derive every removal list at run time (`find -type l`, remove by name); never delete a real dir, move it; keep the snapshot as the rollback recipe.
- **Context**: phase 5 plan r1 → r2, caught by the robustness and correctness challengers before execution.
- **Apply**: every plan touching machine-owned layout (symlinks, installs, caches).
## LRN-252 — stream-json first line is hook_started; multi-turn canary on a FIFO; OFF pack via --settings (2026-11-02)
- **Pattern**: `claude -p --output-format stream-json --verbose`: the FIRST line is a `type=system subtype=hook_started` event (session-start hook), not init; select `type == "system" && subtype == "init"` over all lines. Multi-turn headless = `--input-format stream-json` on a FIFO/coproc: send a turn, wait for its `result`, edit files, send the next (one session id throughout). A canary pack with `defaultEnabled:false` turned on only via `--settings` is invisible to every other conversation; clean up with `mv` (rm/trap calls get refused by the permission rules).
- **Context**: phase 5 Task 1 and Task 12 canaries; the first reload canary mistakenly spanned two sessions.
- **Apply**: every headless measurement of plugins/skills/tools.
## LRN-253 — Commit a tracked file with uncommitted UI writes through the git index (2026-11-02)
- **Pattern**: commit a change to a tracked file whose working copy carries uncommitted writes you must keep (settings.json UI writes): `git show HEAD:f | jq '<edit>' > tmp && git update-index --cacheinfo 100644,"$(git hash-object -w tmp)",f && git commit`, then patch the working copy with jq into a temp file and `cp` it back. Never `git checkout -- f`, never `git stash` (pop can take someone else's stash), never `git add -p` (interactive, unavailable), never `jq … > f` (truncates on failure).
- **Context**: phase 5 Task 13 listing budget; BLK-039.
- **Apply**: any commit to settings.json or another file the harness writes to.
+2 -1
View File
@@ -70,7 +70,8 @@ Shared rules for every phase:
- Proof: static glob check per moved rule + logged session; hook tests (design-toolchain-reminder one-liner, session-start graph branch); the four skills Read the lib (grep census); `/context` delta.
- Cleanup: CLAUDE.global.md loses the moved sections (one pointer line each where needed), citers patched (doctrine-citers census); BDR-031 citers.
- [ ] **Phase 5, per-project and per-conversation profiles, native packs** (redesigned 2026-10-25, shrunk the same day)
- [ ] **model-router: ask before routing to Fable** (user ask 2026-11-02, after the phase 5 merge: both touch `mods/model-router/routing.json`). `/feat` on the mod: a `routing.json` key `askTier` (default `best`; `/route ask-tier on|off`) makes the router ask, once per span, BEFORE applying a route whose resolved model sits in that tier, with the reason (phase + its `about`, origin: skill row / `/route` / prompt rule / agent row) and the options `Fable` · `Opus instead (big tier)` · `stop asking this session`; no memory in `confirmed` (the existing first-use confirmation stays as is); never asks in `-p` (`askOr` already falls back to LATER). Files: mods/model-router/hooks/register.ts (+ register.test.ts), routing.json, USAGE.md (`/route` section).
- [x] **Phase 5, per-project and per-conversation profiles, native packs** (redesigned 2026-10-25, shrunk the same day; shipped 2026-11-02 on feature/phase5-profiles-packs: BDR-134, spec docs/superpowers/specs/2026-11-01-phase5-profiles-packs-design.md, contract .claude/tasks/contracts/2026-11-01-phase5-profiles-packs-1300.md; user steps left: MIGRATION "Profiles and packs (2026-11)" step 4 `.bashrc`, `/context` on full/dev/web; follow-ups: census `grep -qxF`, fragment top-level key allowlist, MIGRATION step 2 `$root` re-derivation + autostash-conflict note)
- Facts 2026-10-24/25 (scratch projects, fresh headless sessions, canaries, run concurrently, one shared ~/.claude): `.claude/settings.local.json` `enabledPlugins` per project works both ways and concurrently; `claude --settings '<json>'` gives two SIMULTANEOUS conversations in the SAME project different plugin sets; a skills-dir plugin obeys both; plugin skills keep their short name (`ui-styling` resolves) but verify `<plugin>:<name>` too (router rows must match both); plugin agents need the `plugin:` prefix; `permissions.deny Skill(x)` does not hide a skill; `skillOverrides` does not reach plugin skills (packs hide by disabling, guide); a user-scope MCP cannot be switched off per project by settings: project MCP belongs in a pack `.mcp.json`; claude.ai connectors do not load under `-p`.
- User answers 2026-10-25: profile per project and per conversation, never one for all; tracked `.claude/settings.json` keeps deny/allow only, profiles go local; a project without a profile gets a proposal once, written on accept; the global mode (skills/ ↔ skills-disabled/ symlinks + user-scope plugin toggling) is DELETED; core = everything except the heavy packs (design, seo/geo, web-validate, scroll/3d, higgsfield, gstack); agents stay global; a skill needing an off pack proposes to enable it then `/reload-plugins` (spike first); all 11 profiles kept as pack compositions.
- Packs: each heavy group becomes a skills-dir plugin `skills/pack-<name>/` (`.claude-plugin/plugin.json` + `skills/<skill>/SKILL.md`, + `.mcp.json` for higgsfield, + hooks if any). Spike first: nested skills load once as plugin skills; gstack (external installer, symlinks) as a pack.
@@ -0,0 +1,62 @@
# CONTRACT — phase5-profiles-packs
## REQUEST (verbatim — IMMUTABLE)
Phase 5 of the context mod queue (BDR-125): per-project and per-conversation profiles, native packs. Full definition in .claude/tasks/TODO.md lines 73-84 (facts measured 2026-10-24/25, user answers 2026-10-25, packs as skills-dir plugins `skills/pack-<name>/`, profiles `lib/profiles/<name>.json` with `enabledPlugins` + `model`, `profile.sh set` writes `.claude/settings.local.json`, per-conversation `claude --settings`, detection via /plugin-check, mid-skill pack gates, listing budget after the packs, proof with concurrent conversations and canaries, cleanup list). User instruction for this run: run the FOUR SPIKES first, before any plan or design: (1) nested skills in a pack (a skills-dir plugin with `skills/<skill>/SKILL.md` loads each skill once, short name and `<plugin>:<name>`); (2) `/reload-plugins` after a settings change loads a pack mid-session; (3) claude.ai connectors per project (interactive only; they do not load under `-p`); (4) higgsfield MCP in a pack `.mcp.json`. Each spike = a measured fact in a scratch project, headless where possible, interactive where the user must run the probe. Only then brainstorm and plan. CLI 2.1.316. Default model opus; Fable credits exhausted: pin verifier, security-auditor and challengers on opus.
## CLARIFICATIONS
- Spike facts 2026-11-01 (headless, CLI 2.1.316; scratchpad p5/FACTS.md, copied into the plan): skills-dir packs load ON by default; nested skills listed once as `<pack>:<skill>`, both names invoke; `--settings` false beats local true; `/reload-plugins` works in `-p` and reloads skills + hooks mid-session after a settings edit, pack `.mcp.json` servers need a new session; claude.ai connectors DO load under `-p` now (changed since 2026-10-25), `--strict-mcp-config` drops them per conversation; a pack `.mcp.json` HTTP server is registered as `plugin:<pack>:<server>` and needs an interactive OAuth login.
- Spike 3 closed 2026-11-01 (measured F0-F5 + docs settings-reference): per project, `.claude/settings.local.json` `deniedMcpServers:[{serverName:"claude.ai <Name>"}]` drops the named connectors (199 → 192 tools for Gmail + Higgsfield AI) and `disableClaudeAiConnectors:true` drops all nine (26 tools, model-router kept); the same two keys via `--settings` work per conversation; a `serverUrl` wildcard matches no connector (no URL exposed); `disableClaudeAiConnectors` is any-source-true; the native `/mcp` toggle writes `disabledMcpServers` per project into `~/.claude.json` (untested, interactive only). Docs, not measured: `/reload-plugins` re-reads `enabledPlugins` from every settings file; `--plugin-dir` loads a pack as `<name>@inline` for one session; the skills-dir id is the manifest `name`.
- Spikes 1b/1c/2b 2026-11-01 (headless): a pack manifest `defaultEnabled:false` is OFF with nothing written (local or `--settings` true turns it on); the typed short slash `/<skill>` on a pack skill expands like `/<pack>:<skill>`; in a `--settings` conversation `/reload-plugins` re-reads neither the flag file nor a local true over a flag false, so a pack OFF by flag only comes back through a relaunch.
- Brainstorm answers 2026-11-01 (user): no profile = `full` (packs ON, connectors present, as today); gstack split in three packs (dev / browser / design); both higgsfield connectors denied by `deniedMcpServers` in every profile except design, web, web-full, full, max; launcher `cc <name> [profile]` as a function in `lib/cc.sh` sourced from `~/.bashrc` (user step), exporting `CLAUDE_PROFILE`, `CLAUDE_PROFILE_SETTINGS`, `TMPDIR` and running `claude --settings`; approach A = tracked packs `skills/pack-<n>/` (relative symlinks into `skills-external/`, five real dirs moved), profiles as literal settings fragments `lib/profiles/<n>.json`; `profile.sh current --plain` is the single truth for gates, hooks and statusline (supersedes BDR-024); a backend/dev profile still gets the design proposal mid-skill (`set web` / `enable design` + `/reload-plugins`, or relaunch when the source is the flag); listing budget measured last. Spec: `docs/superpowers/specs/2026-11-01-phase5-profiles-packs-design.md` (sections 1-9 approved in chat).
- Pass B 2026-11-01 `[gated]` (plan `docs/superpowers/plans/2026-11-01-phase5-profiles-packs.md`, user answers): `lib/tests/higgsfield.test.sh` is kept, trimmed to the skills-external sync and CLI probes (spec said delete); the "no citer left" census covers hooks lib agents skills rules templates mods, root `*.sh`, CLAUDE.global.md, README, USAGE, ARCHITECTURE, Makefile, plugins.lock.json, .gitignore and excludes `lib/tests/fixtures/`, `docs/`, `.claude/`, CHANGELOG, MIGRATION; gstack `./setup` is skipped with a warn ("run make link first") when `skills/gstack` is not the helper tree, never run-then-clean. Defaults accepted by silence: `profile.sh -C <dir>`; `--plain` keys `flag=`, `model-source=`, `mcp-off=`, `connector:*=denied`, `plugin:<id>=`; new files `lib/pack-census.sh`, `lib/gstack-removed.list`, suites profile/cc/pack-census/statusline; impeccable = pack symlink to `skills-external/impeccable` moved there by the installer (not tracked, no `git mv`); `~/.bashrc` user step removes `dtach_claude` + `alias cc` and sources `lib/cc.sh`; `deniedMcpServers` union documented (`cc x web` over a `dev` project keeps the connectors denied).
- Floor-guard `[gated 2026-11-02]` (user): the four shellcheck suppressions are authorized with their reasons: `lib/profile.sh:2` SC2016 (file-wide; the jq programs quote `$var` on purpose), `lib/cc.sh` SC2016,SC1003 (the inner `bash -c` expands `$HOME` itself; `'^\'` is dtach's detach key), `lib/pack-census.sh:2` SC2088 (`~/.claude/skills` is a grep pattern, not a path), `lib/tests/cc.test.sh` SC1091 (sources a fixture); the plan file's code samples mirror them. The five deleted suites `lib/tests/{profile-default,profile-set-managed,profile-census,gstack-removed,toggle-external-repo-resolution}.test.sh` tested the retired symlink mechanism; their live checks moved to `lib/tests/profile.test.sh` (set/current/unset semantics, default profile) and `lib/tests/pack-census.test.sh` (fragment invariants, retired gstack names, old-layout citers).
- STEP 6 code review `[gated 2026-11-02]` (user): `backend.json` and `web-full.json` are dropped (they were byte-identical to `dev.json` and `full.json`, so `current` named the wrong profile and the advisor looped); nine profiles remain (full, max, minimal, dev, design, web, seo, qa, audit), the advisor maps backend → dev and web-full → full, and the census forbids two fragments with equal `enabledPlugins` + deny set. `higgsfield-websites` stays in pack-higgsfield (OFF by default, ON in `max` only; amends BDR-109, recorded in the phase 5 BDR). `lib/cc.sh` keeps `set -a; . ~/.claude/.env` as `dtach_claude` did (accepted risk, recorded in the BDR). Also ruled by the controller: the project root for the local file follows Claude Code's rule (git common dir root when inside a repo, else the dir; shared `.claude/settings.json` read from the session dir); the profile-name match considers only the connector names a fragment manages; profile and session names are allowlisted `^[a-z0-9][a-z0-9-]*$`.
- Floor-guard 2 `[gated 2026-11-02]` (user): the two `# shellcheck disable=SC2086` at lib/tests/cc.test.sh:62 and lib/tests/profile.test.sh:147 are authorized (test loops that word-split an argument string on purpose). Wording fix of the STEP 6 ruling: outside a git repo the root is the nearest ancestor holding `.claude/`, `CLAUDE.md` or `.git` below `$HOME` (the walk the suite tests), not the bare dir. Criterion 3's deny set reads minimal, dev, seo, qa, audit (backend dropped).
- Scope note `[gated 2026-11-02]` (user ask in this run): commit 08ae797 adds one TODO item to `.claude/tasks/TODO.md` (model-router: ask before routing to Fable, queued after the phase 5 merge). `.claude/tasks/` is a durable registry, outside the implementation scope; it is authorized and not part of the phase 5 diff under review.
- Design-derived criteria are appended at STEP 3 `[gated]`.
## ACCEPTANCE CRITERIA
1. The four spikes are recorded as measured facts (method, command, result) in the plan file, and the ones that changed since 2026-10-25 are named (connectors under `-p`).
2. `[gated 2026-11-02]` Pack layout: nine packs `skills/pack-{design,scroll3d,seo,web-validate,gstack-dev,gstack-browser,gstack-design,higgsfield,extras}/` with a manifest whose `name` is the folder, 55 skill entries (relative symlinks into `skills-external/` or the four moved dirs seo, geo, web-validate, site-motion), no skill listed twice, none of the nine retired gstack names; `skills-disabled/`, `.active-profile`, `lib/toggle-external.sh` and `lib/profiles/*.profile` gone; the census (`lib/pack-census.sh`) finds no reader of the old layout in the contract scope (hooks lib agents skills rules templates mods, root `*.sh`, CLAUDE.global.md, README, USAGE, ARCHITECTURE, Makefile, plugins.lock.json, .gitignore; excluded: lib/tests/fixtures/, docs/, .claude/, CHANGELOG, MIGRATION).
CHECK: cd /home/bchanot/Documents/claude && out=$(bash lib/pack-census.sh 2>&1) && printf '%s\n' "$out" | grep -q '^PACKS OK 9 packs 55 skills' && [ ! -e skills-disabled ] && [ ! -e .active-profile ] && [ ! -e lib/toggle-external.sh ] && [ -z "$(ls lib/profiles/*.profile 2>/dev/null)" ] && [ -L skills/model-router ] && echo PACKS-OK
EXPECT: PACKS-OK
EVIDENCE: MET exit=0 marker-found :: PACKS-OK
3. `[gated 2026-11-02]` Profiles: nine fragments `lib/profiles/{full,max,minimal,dev,design,web,seo,qa,audit}.json` (amended `[gated 2026-11-02]`: backend and web-full dropped as duplicates) with the invariants of lib/profiles/README.md (same key set; model-router and security-guidance true; example-skills and brightdata false; both higgsfield connectors denied on exactly minimal, dev, backend, seo, qa, audit; full = manifest defaults); `lib/profile.sh` verbs list/show/current [--plain]/set/unset/enable/disable/diff with the merge, refusal (rc 2, nothing written), union, walk-up and timing semantics of the suite; `current --plain` keys as the plan § Task 3 states.
CHECK: cd /home/bchanot/Documents/claude && [ "$(ls lib/profiles/*.json | wc -l)" = 9 ] && a=$(make test suite=lib/tests/profile.test.sh 2>&1) && printf '%s\n' "$a" | grep -q 'FAIL=0' && echo PROFILE-OK
EXPECT: PROFILE-OK
EVIDENCE: MET exit=0 marker-found :: PROFILE-OK
4. `[gated 2026-11-02]` Launcher: `lib/cc.sh` defines `cc <name> [profile]`; unknown profile → list + rc 2 and no session; with a profile `claude --settings lib/profiles/<profile>.json` runs with `CLAUDE_PROFILE`, `CLAUDE_PROFILE_SETTINGS` and `TMPDIR=$HOME/.cache/claude-tmp` exported through systemd-run + dtach; without a profile plain `claude`, TMPDIR still set, `.env` sourced.
CHECK: cd /home/bchanot/Documents/claude && a=$(make test suite=lib/tests/cc.test.sh 2>&1) && printf '%s\n' "$a" | grep -q 'FAIL=0' && echo CC-OK
EXPECT: CC-OK
EVIDENCE: MET exit=0 marker-found :: CC-OK
5. `[gated 2026-11-02]` Gates and hooks read `profile.sh current --plain`: design-tool-gate.sh needs pack-design, pack-gstack-design and ui-ux-pro-max on plus the 21st CLI signed in, remedy `profile.sh set web` (or `enable design`) + `/reload-plugins`, or `cc <name> web` when source=flag; statusline shows `profile: <n>` / `<n> (conv)` / `?`; the banner row shows the profile or `none (full), try /plugin-check`; no `/profile design`, `GATE-BLOCK`, `show --plain` or `skill_status` left in lib/design-gate.md, skills/feat, skills/bugfix, agents/plugin-advisor.md.
CHECK: cd /home/bchanot/Documents/claude && a=$(make test suite="lib/tests/design-tool-gate.test.sh lib/tests/statusline.test.sh" 2>&1) && printf '%s\n' "$a" | grep -q 'all suites green' && ! grep -rqn '/profile design\|GATE-BLOCK\|show design --plain\|skill_status' lib/design-gate.md skills/feat skills/bugfix agents/plugin-advisor.md && echo GATES-OK
EXPECT: GATES-OK
EVIDENCE: MET exit=0 marker-found :: GATES-OK
6. `[gated 2026-11-02]` No user-scope write anywhere outside the installers' install-time enable: no `claude plugin enable|disable` and no `toggle-external` under lib/, hooks/, skills/, agents/; `profile.sh` and `cc.sh` never touch `~/.claude/settings.json`.
CHECK: cd /home/bchanot/Documents/claude && ! grep -rqn --exclude-dir=fixtures 'claude plugin enable\|claude plugin disable\|plugin enable\|plugin disable' lib hooks skills agents --include='*.sh' --include='*.md' && ! grep -q 'settings.json' lib/cc.sh && echo NO-USER-SCOPE
(amended `[gated 2026-11-02]`, user: `--exclude-dir=fixtures` — lib/tests/fixtures/*.md are append-only registry snapshots that predate the branch; the /profile prohibition sentence is reworded without the literal.)
EXPECT: NO-USER-SCOPE
EVIDENCE: MET exit=0 marker-found :: NO-USER-SCOPE
7. `[gated 2026-11-02]` The branch is green and clean: `make test` all suites green; shellcheck clean and ≤ 80 columns on lib/profile.sh, lib/cc.sh, lib/pack-census.sh, lib/design-tool-gate.sh; `settings.json` changes on the branch limited to `env.SLASH_COMMAND_TOOL_CHAR_BUDGET` (no UI write, no `model`, no `enabledPlugins` drift committed); `doctor.sh` exits 0 (warns allowed).
CHECK: cd /home/bchanot/Documents/claude && t=$(make test 2>&1) && printf '%s\n' "$t" | grep -q 'all suites green' && shellcheck lib/profile.sh lib/cc.sh lib/pack-census.sh lib/design-tool-gate.sh && [ "$(LC_ALL=C awk 'length($0) > 80' lib/profile.sh lib/cc.sh lib/pack-census.sh lib/design-tool-gate.sh lib/profile-state.jq | wc -l)" = 0 ] && [ "$(git diff develop...HEAD -- settings.json | grep '^[-+] ' | grep -v 'SLASH_COMMAND_TOOL_CHAR_BUDGET\|ENABLE_STOP_REVIEW' | wc -l)" = 0 ] && bash doctor.sh >/dev/null 2>&1 && echo BRANCH-OK
EXPECT: BRANCH-OK
EVIDENCE: MET exit=0 marker-found :: BRANCH-OK
8. `[gated 2026-11-02]` Proof recorded (plan Task 12, judged by the verifier from the executor's report and CHANGELOG): two concurrent conversations in one project under `--settings dev.json` / `web.json` list different packs and tool counts (higgsfield tools 0 vs 158); two projects with different local profiles differ; `enable seo` + `/reload-plugins` makes `/seo` and `/pack-seo:seo` resolve in a flagless conversation; `current --plain` timing recorded against the 50 ms target; listing budget value and per-profile name-only counts in CHANGELOG.
9. `[gated 2026-11-02]` Docs: MIGRATION.md holds the "Profiles and packs (2026-11)" section (amended `[gated 2026-11-02]`, user: no version number pre-empted; the CHANGELOG bullets live under `[Unreleased]`, the number is set at release-candidate) (user-scope restore, old-layout cleanup by enumeration, `.bashrc` guarded source line and alias removal, per-project `set`); README/USAGE/ARCHITECTURE/CLAUDE.global.md name no `toggle-external.sh`, `skills-disabled` or `profile-reset`; the deniedMcpServers union is documented in `/profile` and USAGE.
CHECK: cd /home/bchanot/Documents/claude && grep -q 'Profiles and packs' MIGRATION.md && grep -q 'lib/cc.sh' MIGRATION.md && ! grep -rqn 'toggle-external\|skills-disabled\|profile-reset' README.md USAGE.md ARCHITECTURE.md CLAUDE.global.md && grep -qi 'union' skills/profile/SKILL.md && echo DOCS-OK
EXPECT: DOCS-OK
EVIDENCE: MET exit=0 marker-found :: DOCS-OK
## FILE SCOPE (final, STEP 3)
- skills/pack-*/ (new: manifests + symlinks; moved: seo, geo, web-validate, site-motion)
- lib/profile.sh, lib/profile-state.jq (new), lib/profiles/*.json (new) + README.md, lib/profiles/*.profile (deleted)
- lib/cc.sh (new), lib/pack-census.sh (new), lib/pack-census-fragments.jq (new), lib/gstack-removed.list (new), lib/gstack-removed.sh, lib/toggle-external.sh (deleted), lib/higgsfield-skills.sh
- lib/design-tool-gate.sh, lib/design-gate.md, lib/plugin-gate.md, agents/plugin-probe.md, agents/plugin-advisor.md, agents/client-handover-writer.md
- skills/profile/SKILL.md + test-prompts.json, skills/onboard/SKILL.md, skills/plugin-check/SKILL.md, skills/feat/SKILL.md + test-prompts.json, skills/bugfix/SKILL.md
- hooks/session-start.sh, hooks/statusline.sh, lib/detect-plugins.sh, doctor.sh, lib/doctor-vendored.sh, lib/doctor-skills.sh, link.sh, Makefile, .gitignore
- install-plugins.sh, update-all.sh, plugins.lock.json, settings.json (`env` only, Task 13)
- lib/skill-routing-census.py, mods/model-router/routing.json
- lib/tests/: profile.test.sh, cc.test.sh, pack-census.test.sh, statusline.test.sh (new), fixtures/pack-census-old-citers.sh (new), design-tool-gate.test.sh, doctor-vendored.test.sh, higgsfield.test.sh, effort-routing.test.sh, model-routing.test.sh, seo-geo-contract.test.sh, plan-challenger.test.sh, doctrine-citers.test.sh, lib/seo-data/seo-data.test.sh; deleted: profile-default, profile-set-managed, profile-census, gstack-removed, toggle-external-repo-resolution
- CLAUDE.global.md, README.md, USAGE.md, MIGRATION.md, ARCHITECTURE.md, CHANGELOG.md, rules/web-building.md
- Working tree only (never committed): flat symlinks and skills-disabled/ removed, impeccable moved to skills-external/impeccable, settings.json user-scope enabledPlugins restored
+5 -90
View File
@@ -1,80 +1,10 @@
# ── claude-config repo ignores ──
# GStack skill symlinks — auto-created by gstack setup
# Only the gstack/ dir itself + all symlinked skills inside skills/
# Core skills linked flat by link.sh (symlinks, machine-owned); the heavy groups live in skills/pack-*/ as tracked symlinks.
skills/gstack
skills/autoplan
skills/benchmark
skills/browse
skills/canary
skills/careful
skills/codex
skills/connect-chrome
skills/cso
skills/design-consultation
skills/design-html
skills/design-review
skills/design-shotgun
skills/devex-review
skills/diagram
skills/document-release
skills/freeze
skills/gstack-upgrade
skills/guard
skills/health
skills/investigate
skills/land-and-deploy
skills/learn
skills/office-hours
skills/open-gstack-browser
skills/pair-agent
skills/plan-ceo-review
skills/plan-design-review
skills/plan-devex-review
skills/plan-eng-review
skills/qa
skills/qa-only
skills/retro
skills/review
skills/setup-browser-cookies
skills/setup-deploy
skills/ship
skills/unfreeze
skills/benchmark-models
skills/context-restore
skills/context-save
skills/make-pdf
skills/plan-tune
skills/spec
skills/document-generate
skills/landing-report
skills/scrape
skills/setup-gbrain
skills/skillify
skills/sync-gbrain
# iOS device-farm skills (need a Mac daemon + Tailscale + iOS devices) —
# not linked on this Linux host; ignored so they stay out of git if a
# future gstack setup on a Mac host materializes the symlinks.
skills/ios-clean
skills/ios-design-review
skills/ios-fix
skills/ios-qa
skills/ios-sync
# External skill symlinks — auto-created by link.sh
skills/design-motion-principles
skills/emil-design-eng
skills/frontend-design
skills/ci-cd-and-automation
skills/deprecation-and-migration
skills/observability-and-instrumentation
skills/scroll-world-storytelling
skills/build-threejs-scroll-worlds
skills/scroll-scrubbed-visual-sequence
skills/scroll-scrubbed-word-reveal
skills/scroll-progress-timeline
# superpowers, vendored (plugins.lock.json 'superpowers')
skills/brainstorming
skills/writing-plans
skills/subagent-driven-development
@@ -83,10 +13,11 @@ skills/requesting-code-review
skills/using-git-worktrees
skills/writing-skills
# Impeccable — NOT a symlink: `impeccable skills install --scope=global`
# writes the skill dir (and its ~15 MB engine binary) straight in through the
# ~/.claude/skills symlink. Machine-owned, regenerated by make plugin/update.
# Impeccable — `impeccable skills install --scope=global` writes
# impeccable/ into the skills dir through the ~/.claude/skills symlink; install-plugins.sh
# moves it to skills-external/impeccable (pack-design links it). Machine-owned.
skills/impeccable
skills-external/impeccable/
# …and the 4 subagents the same installer drops through ~/.claude/agents.
# agents/ is a tracked directory, so these need naming explicitly.
@@ -95,17 +26,6 @@ agents/impeccable-*.md
# External skills installed via `npx skills add` — auto-created by link.sh
skills/darwin-skill
# 21st.dev skill pack symlinks — created on demand by toggle-external.sh /
# profile.sh (the pack is DISABLED by default, so these usually don't exist).
# A glob, not one line per skill: the `21st skills install` manifest owns the
# membership, so the pack can gain a skill with no edit here.
skills/21st-*
# Higgsfield skill pack symlinks — created on demand by toggle-external.sh
# (`enable higgsfield` / `enable higgsfield-websites`). The pack is OFF by
# default and in no profile, so these usually don't exist.
skills/higgsfield-*
# Context7 docs-lookup skill — installed by `ctx7 setup --claude --cli`
# (install-plugins.sh Step 6, when absent) into ~/.claude/skills (a symlink to
# this repo's skills/). ctx7-managed and re-created on demand — not vendored here.
@@ -115,9 +35,6 @@ skills/find-docs/
# symlink to this repo's rules/). ctx7-managed — not vendored here.
rules/context7.md
# Staging area used by lib/toggle-external.sh when disabling a tool
skills-disabled/
# Local project config (per-machine, not shared)
.claude/*
!.claude/tasks/
@@ -184,8 +101,6 @@ desktop.ini
.idea/
.vscode/
# Profile cache — written by lib/profile.sh, read by hooks/statusline.sh
.active-profile
.gstack/
# Frontend Design (Anthropic) — installed/refreshed from the example-skills
+3 -2
View File
@@ -14,7 +14,7 @@ claude-config/
├── .env.example # Placeholder template for ~/.claude/.env (secrets never committed)
├── settings.json # Global permissions (deny / ask / allow) + autoMode classifier tiers
├── install.sh # Bootstrap: Claude Code CLI + auth + submodules + link + plugins
├── install-plugins.sh # One-shot installer: prerequisites + all plugins + default profile
├── install-plugins.sh # One-shot installer: prerequisites + all plugins
├── link.sh # Symlinks this repo into ~/.claude/, sets git's global core.hooksPath
├── doctor.sh # Setup diagnostic
├── update-all.sh # One-command update for all components
@@ -27,10 +27,11 @@ claude-config/
├── rules/ # Rule files deployed to ~/.claude/rules (path-scoped or always-on)
├── agents/ # Execution units called by skills (never invoked directly)
├── skills/ # Entry points invoked via /skill-name
│ └── pack-<n>/ # Skills-dir packs: manifest + tracked symlinks into skills-external/ (seo, geo, web-validate, site-motion: real dirs)
├── mods/ # Claude Code mods (function-hooks plugins), loaded through the skills/<name> symlink
├── skills-external/ # Vendored skill packs: gstack submodule, design skills, superpowers, agent-skills, MengTo scroll skills, 21st and Higgsfield packs (machine-owned copies gitignored)
├── templates/ # Per-project templates (CLAUDE.md, settings, memory registries, path-rule skeletons, deploy runbook, gitignore)
└── lib/ # Shared libs: gitflow, memory registry writer, profiles, vendoring, route doctrine, gates, archetypes, architecture defaults, project-rule oracle, tests
└── lib/ # Shared libs: gitflow, memory registry writer, profiles (lib/profiles/*.json fragments, profile.sh, cc.sh), vendoring, route doctrine, gates, archetypes, architecture defaults, project-rule oracle, tests
```
## Architecture principles
+11 -1
View File
@@ -8,7 +8,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
### Added
- **Secure-by-default guardrails**: `rules/secure-by-default.md` (always on) makes six domains baseline on every project (the Supabase and cloud-function detail lives in the path rules `rules/supabase.md` and `rules/cloud-functions.md`), plus systematic API and access hygiene (auth on every route, CORS, secrets, passwords hashed with argon2id or bcrypt, never compared in clear, logged or hardcoded): hosting (rate limit, CDN and firewall, hard spend cap), Supabase (RLS on every table, owner-scoped policies, no service role key client-side), SMS and email (recorded consent, unsubscribe, STOP), cloud functions (no self-trigger, instance cap, budget stop), injection (bound values in raw escapes, `format()` for dynamic SQL, allowlisted filters, no shell into a DB tool), exposure (no data in the console, no production source map, no debug flag, no secret in hydrated state, data attributes, hidden fields or shipped comments). `/guardrails` audits them: a stdlib Python scanner (`skills/guardrails/scripts/scan.py`, FAIL / WARN / MANUAL, exit 1 on FAIL) then judgment, report in `.claude/audits/GUARDRAILS.md`. The security-auditor gate runs the scanner's `api` and `supabase` domains and blocks on FAIL. Items only a provider dashboard can set stay MANUAL, never claimed done. An optional read-only live probe (`skills/guardrails/scripts/probe.py`, `--live`) confirms a finding from outside on a target the user owns and names: anon-read, cross-user, no-auth route, CORS reflection and a capped rate-limit burst, verdicts OPEN / CLOSED / SKIPPED / ERROR. An `exposure` block in the plan adds three read-only probes, meant for a production build or a staging URL: a served or inline source map for the page's scripts, a stack trace in a 404 or a user-named error route, sensitive keys in a JSON response (identifier-shaped names printed, never values); a target the probe could not observe is SKIPPED or ERROR, never CLOSED, and every plan path must start with `/`. It sends GET, HEAD and OPTIONS only (one opt-in POST burst, capped at 25), requires `--authorized`, takes secrets from the environment never the command line, never follows a redirect to another host, and stops at a request budget. After the report, `/guardrails` proposes fixes (plan phase, so Fable when the router can switch), applies only the ones the user accepts through the `bugfixer` executor and the `lib/verify-secure-loop.md` gates, then re-scans: each accepted fix is a contract criterion whose oracle is the scanner (`--assert-absent RULE:path`, marker `GUARDRAILS-CLEAR`), and a full pass against the pre-fix baseline (`--baseline`, marker `GUARDRAILS-NO-NEW`) catches regressions; a live probe replays on the user's go; two rounds at most, residuals reported open; `--report-only` keeps the audit alone. Suites: `lib/tests/guardrails-scan.test.sh` (clean fixture plus one mutant per rule, check modes, `gates.sh` integration) and `lib/tests/guardrails-probe.test.sh` (probe logic against a localhost fixture server).
- **/a11y skill**: accessibility leaves `/guardrails` and becomes its own skill. Same A11Y-* rules (img alt, field label, click without keyboard, focus outline removed, positive tabindex) on the shared scan engine (`skills/guardrails/scripts/scanner.py`, a `Catalogue` per CLI; `skills/a11y/scripts/scan.py`, markers `A11Y-CLEAR` / `A11Y-NO-NEW`), a Tab-only walk of the main flow on `--live` through `/browse` (marked not done otherwise), report `.claude/audits/A11Y.md`, fixes proposed with the alt and label wording as the user's choice, applied through the bugfix circuit (`bugfixer`, verify-secure gates, `bugfix/a11y-<date>`), re-pass against a baseline. The keyboard, alt and label doctrine moves from `rules/secure-by-default.md` to the lazy `rules/a11y.md` (loads on UI files only; `rules/web-building.md` points at it). `/guardrails` scans `injection` (INJ-*) and `exposure` (EXP-*) instead, with per-language SQL patterns, shared `code_files` / `hits` / `dedupe_lines` / `client_reachable` helpers and a walker that lists files over 1 MB by path; `--domain a11y` is a usage error there. `/web-validate` keeps full WCAG conformance. Suite `lib/tests/a11y-scan.test.sh`; routing row `reflect`; profiles audit, dev, web, web-full, full, max.
- **/a11y skill**: accessibility leaves `/guardrails` and becomes its own skill. Same A11Y-* rules (img alt, field label, click without keyboard, focus outline removed, positive tabindex) on the shared scan engine (`skills/guardrails/scripts/scanner.py`, a `Catalogue` per CLI; `skills/a11y/scripts/scan.py`, markers `A11Y-CLEAR` / `A11Y-NO-NEW`), a Tab-only walk of the main flow on `--live` through `/browse` (marked not done otherwise), report `.claude/audits/A11Y.md`, fixes proposed with the alt and label wording as the user's choice, applied through the bugfix circuit (`bugfixer`, verify-secure gates, `bugfix/a11y-<date>`), re-pass against a baseline. The keyboard, alt and label doctrine moves from `rules/secure-by-default.md` to the lazy `rules/a11y.md` (loads on UI files only; `rules/web-building.md` points at it). `/guardrails` scans `injection` (INJ-*) and `exposure` (EXP-*) instead, with per-language SQL patterns, shared `code_files` / `hits` / `dedupe_lines` / `client_reachable` helpers and a walker that lists files over 1 MB by path; `--domain a11y` is a usage error there. `/web-validate` keeps full WCAG conformance. Suite `lib/tests/a11y-scan.test.sh`; routing row `reflect`; a top-level skill in no pack, so on under every profile.
- **model-router mod**: `mods/model-router/`, a Claude Code mod (function-hooks plugin), routes every repo skill and agent from phase rows (`plan`, `reflect`, `orchestrate`, `escalate`, `judge`, `audit`, `implement`, `write`, `verify`, `explore`, `apply`, `mechanical`; built-ins Explore on sonnet/medium, Plan on opus/xhigh). A typed skill routes the main loop to its row, and a best-tier row holds across turns in a run slot until `/route clear`, `/route off`, a user `/model` or a typed skill on a non-best row. Agents get their row's model at spawn (within the tier, upward only) and its effort on every step; explicit Agent params win. Orchestrators declare their phases through the `mcp__model-router__route` tool. `ultrathink` in a prompt sets the turn's minimum effort and `/route effort=max` holds until `/route clear`; the built-in `/effort` is not a lever inside a run. `/route show` names the run slot (`main: run <phase>`), and a `null` row in the override drops a default row. The model gets a `route` tool and the user a `/route` command (`show|clear|off|on|reload|pending|ask on|off|forget <name|all|projects>|<phase>|model=<alias|id> effort=<level>|switch on|off|verbose on|off`). Optional per-machine config `~/.claude/model-router.json`, where `"enabled": false` turns it off on that machine. The spinner suffix and the status line show the route in force. It loads in every session through the tracked symlink `skills/model-router` (`model-router@skills-dir`). `make doctor` gains a Mods section; suite `make test suite=lib/tests/mods.test.sh`. Known limits: a main-loop switch (a `/model` hand pick excepted) runs only while the cold read it costs (the context minus what the target model's prompt cache holds) fits `upgradeMaxTokens` (200000) or `downgradeMaxTokens` (120000), and a downgrade also needs `mainModelSwitch` (on by default, off on any non-boolean value); the hooks send full model ids, so the `models` table has to follow new versions.
- **model-router first-use confirmation**: `mods/model-router/routing.json` (tracked) is the single source of the phase table and of every skill and agent row, and keeps the decisions: `confirmed`, `changed` (`from`/`to`), `projects` exceptions keyed by the origin remote reduced to `host/path` (credentials and local paths never stored), and `ask`. The first use of a rowed typed skill, a rowed agent spawn or a main-loop phase declared through the `route` tool opens a dialog with context: the skill's description (first sentence of its `SKILL.md` frontmatter) or the agent's, the phase with its `about` line (a new field on each of the 12 phases) and the model id and effort the next step really runs on. A row offers Later, Keep or Change; a main-loop phase Later or Keep. Change asks the model (fable, opus, sonnet, haiku with their tier), then the effort among those the phases of that model use (skipped when there is only one), then Everywhere or This project only; the pair maps to an existing phase (rows stay phase names, the same phase counts as Keep, a pair no phase offers is added by hand as a new phase). A skill-row change toasts the model and effort it now runs on, with the `/route switch on` hint when the main loop holds back a downgrade; a free-text answer counts as Later. One dialog at a time, never in headless (`-p`) runs or inside a sub-agent. Only a dialog answer, `/route ask on|off` or `/route forget` (which takes decisions back; a changed row returns to its shipped phase, the frontmatter floors stay yours to realign) writes the file (serialized, 64 KiB cap, never created when absent); each write asks you to commit it from the config repo. `/route pending` lists unconfirmed rows and phases. Layers: routing.json < `~/.claude/model-router.json` (its `ask` wins); a project's `.claude/model-router.json` is never read. Tests: `mods/model-router/hooks/register.test.ts`.
- **model-router `/model` scope**: a `/model <name>` typed in the composer, or a pick in the `/model` picker, with a model the table knows asks where it applies. The picker's switch is held first (PreModelSwitch deny; the engine prints that a hook blocked it); a pick while another dialog is open is refused with `answer the open dialog first`. This project writes the full id as `model` into the project's `.claude/settings.local.json` (created if absent, refused through a link) and sets a sticky model route. This conversation sets the sticky route only. Everywhere runs the native `/model` (user `settings.json`). Both non-native answers drop the run slot and keep a sticky effort. With the picker's Default, an unknown name, a headless run or another origin, the native command runs with no question. A model chosen in that dialog always switches: it bypasses the cold-read caps and the `mainUpgrade` / `mainModelSwitch` flags, and while it is marked down or outside a known window it waits and the automatic chain decides. A native switch or `/clear` drops it; `/route model=` keeps the caps. Known limits: the `/config` Model row still writes user `settings.json`; a dialog never answered has no timeout. Tests: `mods/model-router/hooks/register.test.ts`.
@@ -21,6 +21,11 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
- **InstructionsLoaded logger**: `hooks/instructions-loaded.sh`, wired in `settings.json`, appends one JSON line per instruction file loaded to `~/.claude/logs/instructions-loaded.jsonl` (rotated above 5 MB), the proof that a path rule loaded.
- **Memory registries v2, single writer**: `lib/memory.sh` is the one writer and reader of the `.claude/memory/` registries (every verb takes an optional leading `-C <dir>`): `add <kind> --title … --body-file … [--status …] [--supersedes <ID>]` appends an entry with the next ID from the headings and prints only the new ID (a body line starting `## ` outside a code fence would split the entry and is refused, rc 2); `status <ID> <text>` appends a dated `**Status (<date>)**:` line; `journal <line>` appends under today's `## YYYY-MM-DD`; `index [<kind>]` prints ID, date, title and status from headings and bodies; `check [--staged]` verifies heading shape, unique IDs, no Index and no open fence (a v1 file is named, never failed); `upgrade` migrates v1 to v2 (Index-only dates and statuses become body lines, `format: 2` added, `## Index` removed, every v1 heading dialect becomes `## ID — title (date)`), after an oracle on IDs, check and blocker verdicts, else rc 2 with the file untouched (a duplicate ID, a non-table Index, or a blocker the v1 reader closed only through prose, a mixed or a negated Status line is refused and named with the `memory.sh status` remedy; a v1 closure is carried over only from a `Status`/`Statut` label holding one closed, non-negated word, at most one upgrade status line per entry). Writes run under a lock in the git common dir (a stale lock is stolen by one waiter at a time; a steal marker left empty over 60 s counts as a dead stealer and is cleared), on a verified backup restored on failure or signal. `templates/memory/` ships v2 templates; the session banner adds `registry v1: N file(s) (memory.sh check)` while a project registry is v1. Suite `lib/tests/memory.test.sh`.
- **Architecture defaults carrier**: `lib/architecture-defaults.md`, read before proposing a stack (new project, scaffolding, stack brainstorm, whole-project rewrite): public sites never SPA, Rust by default, web APIs versioned. Path rules `rules/supabase.md` and `rules/cloud-functions.md` hold the full Supabase and cloud-function domains. Suites `lib/tests/user-rules.test.sh` and `lib/tests/doctor-automem.test.sh`.
- **Packs**: nine skills-dir packs under `skills/pack-<n>/` (design, scroll3d, seo, web-validate, gstack-dev, gstack-browser, gstack-design, higgsfield, extras), each a manifest plus tracked symlinks into `skills-external/` (seo, geo, web-validate and site-motion are real directories inside their pack). The installers only fill `skills-external/`; a pack is on or off as a unit. `lib/pack-census.sh` checks the packs (every skill linked once, targets resolve, doc citers) and runs in `make test`.
- **Profiles as settings fragments**: `lib/profiles/<n>.json` replaces the flat-link profiles. `lib/profile.sh` verbs: `list`, `show`, `current` (`--plain` for hooks), `set`, `unset`, `enable`, `disable`, `diff`; `-C <dir>` targets a project, `make profile cmd="set X" dir=/path` and `make profile-current dir=/path`. A project with no local profile runs the manifest defaults (= `full`).
- Nine profiles: `full`, `max`, `minimal`, `dev`, `design`, `web`, `seo`, `qa`, `audit`. `backend` (= `dev`) and `web-full` (= `full`) were identical fragments and are gone; the census refuses two equal fragments.
- **`cc <name> [profile]`**: `lib/cc.sh`, sourced from `~/.bashrc`, starts a conversation under a profile fragment through `--settings`.
- The design gate, the plugin gate and advisor, the statusline, the session banner and `doctor.sh` read `profile.sh current --plain`. `doctor.sh` gains Packs and Profiles sections and checks that `cc.sh` is sourced.
### Changed
- **model-router bare `/model` dialog**: a bare `/model` opens the router's dialog (model, variant, scope), so the scope question also comes when the pick is the current model (fable, opus, sonnet; a current haiku goes through `/model haiku`). Step 1 asks fable, opus, sonnet or `Other model (native picker)` (the native picker, run with the slot free so a pick inside it asks its scope); step 2 asks Standard or `[1m]`; step 3 is the existing scope question. Esc or free text changes nothing. Tests: `mods/model-router/hooks/register.test.ts`.
@@ -46,10 +51,15 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
- Context diet (BDR-125 phase 1): `CLAUDE.global.md` keeps one always-on line for the architecture defaults and points to `lib/architecture-defaults.md`. Design work moves to `rules/web-building.md` § "Design work — full toolchain", and `hooks/design-toolchain-reminder.sh` now tells the model to Read it and no longer fires on `<agent-message` hand-backs. API versioning moves to `rules/rest-api.md`. Graphify usage prints from `hooks/session-start.sh` only where `graphify-out/graph.json` exists. `rules/secure-by-default.md` keeps one line each for Supabase and cloud functions, telling to Read the path rule before writing a new file. Agent descriptions are 200 characters or fewer. Own gain about 2.8k tokens of always-on context (measured `/context` 30.5k to 26.2k).
- `settings.json` sets `"autoMemoryEnabled": false`. `make doctor` gains an Auto memory section (the setting, plus leftover files under `~/.claude/projects/*/memory/`) and checks the `~/.claude/rules` symlink (8 links). The session-start health check includes `rules`.
- `lib/tests/doctrine-citers.test.sh`: the file-citation census also reads nested `lib/<dir>/` paths, `~/.claude/` and `$HOME/.claude/` prefixes (mapped to this repo) and `templates/project-rules/`; a bare `.claude/rules/` citation resolves by citer (this repo's own rules from `.claude/rules/` or `rules/`, else `templates/project-rules/`); T6 also scans `templates/` and `.claude/rules/`, T3 keeps its roots.
- `link.sh` no longer links the design and scroll skills flat; impeccable moves to `skills-external/impeccable`. Docs and routing (`CLAUDE.global.md`, `/profile`, README, USAGE, ARCHITECTURE) speak packs.
- Known limit: `cc x web` on a project in `dev` keeps the higgsfield connectors denied (`deniedMcpServers` is a union); `profile.sh set web` in the project lifts them from the next session.
- Measured headless on 2026-11-02: dev = `pack-gstack-dev`, 41 tools, 0 higgsfield; web = the six web packs, 199 tools, both connectors `connected` and 158 higgsfield tools listed in init (the stderr line "blocked by enterprise policy: claude.ai higgsfield, claude.ai Higgsfield AI" appeared on the deny profiles dev, qa, seo and minimal: that is `deniedMcpServers` working); qa = `pack-gstack-browser pack-web-validate`; seo = qa + `pack-gstack-dev pack-seo`; qa and seo 41 tools, 0 higgsfield; reload canary in one flagless session (id `ee65507c-a958-411b-9580-8aca8105e326`): `/seo` unavailable on minimal, `profile.sh enable seo`, `/reload-plugins` -> "Reloaded: 3 plugins · 2 skills · 32 agents · 7 hooks", then `/seo` and `/pack-seo:seo` both load the SEO skill. `profile.sh current --plain` median 30 ms (target 50).
- Listing budget with the packs: measured headless on 2026-11-02 with `--model haiku` (name-only skills, entries 124 on full, 90 on dev): full default 58, 40000 11, 50000 0, 60000 0; dev default 9, 40000 and above 0. Set `SLASH_COMMAND_TOOL_CHAR_BUDGET=50000` in `settings.json` `env`, the smallest tested value with 0 name-only on full. Cost, estimated: full (48.5k - 30.3k bytes) / 4, about 4.5k tokens; dev 30.0k to 36.8k bytes, about 1.7k tokens. `env` is global, so every profile pays. Descriptions are no longer truncated at 50000 (natural size 48.5k). The default budget's absolute value was not read; it may depend on the model's context window.
### Removed
- `rules/default-language.md`: its content is `lib/architecture-defaults.md` § Default language.
- The five `effort-low` … `effort-max` skills, `lib/effort-pins.txt`, `lib/effort-pins.sh` and `lib/model-check.sh`, with their tests and the effort-pin re-apply steps of `install-plugins.sh` and `update-all.sh`. The model-router rows replace them. A typed `/effort-<level>` no longer exists: use `ultrathink` or `/route effort=max`. Breaking: the next release is 3.0.0.
- `skills-disabled/`, `lib/toggle-external.sh`, `.profile`, `.active-profile` and `make profile-reset`. `profile.sh enable higgsfield` replaces `toggle-external.sh`. Machine steps: MIGRATION.md, "Profiles and packs".
### Fixed
- `/guardrails` and the interviewer cite the secure-by-default, Supabase, cloud-function and a11y rules by their absolute `~/.claude/rules/<name>.md` path; run from a project repo, the bare `rules/<name>.md` path resolved against that project and missed the rule files.
+9 -8
View File
@@ -270,14 +270,15 @@ cryptic names.
- SEO+GEO → seo (GEO only → geo); W3C + WCAG conformance → web-validate;
security audit (secrets, CVE, OWASP) → cso
- Media generation (image, video, audio, brand kit), explicit ask →
Higgsfield pack, off by default: `bash ~/.claude/lib/toggle-external.sh
enable higgsfield`, then Read the skill under `~/.claude/skills/`;
`higgsfield generate cost` before a paid run. Landing page "with
Higgsfield", named ask → `enable higgsfield-websites`: an aid inside
the Design work rules (`rules/web-building.md`), never
`website create|deploy|publish`.
gstack OFF → its skills (investigate, qa, review, health, retro,
office-hours…) are gone: use the fallback above, else say so.
pack-higgsfield, off by default: `bash ~/.claude/lib/profile.sh enable
higgsfield` then `/reload-plugins`, then Read the skill under
`~/.claude/skills/pack-higgsfield/skills/`; `higgsfield generate cost`
before a paid run. Landing page "with Higgsfield", named ask → the same
pack's `higgsfield-websites`: an aid inside the Design work rules
(`rules/web-building.md`), never `website create|deploy|publish`.
gstack packs OFF (`profile.sh current`) → their skills (investigate, qa,
review, health, retro, office-hours…) are gone: use the fallback above,
else say so.
## graphify
+97 -2
View File
@@ -187,7 +187,7 @@ All four checks should be clean before committing the migration.
```bash
git pull --recurse-submodules
make plugin # vendors the 7 superpowers skills (Step 8e), installs the Higgsfield and 21st CLIs (8.6, 8.7), re-runs link.sh (10), applies the default profile (11)
make plugin # vendors the 7 superpowers skills (Step 8e), installs the Higgsfield and 21st CLIs (8.6, 8.7), re-runs link.sh (10)
claude plugin uninstall superpowers@superpowers-marketplace # once, if the plugin is still cached
make doctor
```
@@ -195,9 +195,104 @@ make doctor
- **Superpowers**: the plugin is gone. Its 7 wired skills are vendored at v6.4.1 and always on. The 8 other skills and the session-start injection are not replaced.
- **Magic MCP**: replaced by the `21st` CLI (`21st login`, no API key). If 1.x registered the `magic` server, remove it from `~/.claude.json` and drop `MAGIC_API_KEY` from `~/.claude/.env`. Nothing reads them any more.
- **Git hooks in every repo**: `link.sh` sets git's global `core.hooksPath` to `~/.claude/githooks`. Every repo on the machine now gets the gitflow pre-commit guard and pushes each commit as it lands. For a foreign clone: `git config gitflow.protect false` and `git config gitflow.autopush false`.
- **Default profile**: a machine with no profile selected now runs `full`. Check with `make profile-current`. Nine gstack skills (`ship`, `land-and-deploy`, `setup-deploy`, `autoplan`, `context-save`, `learn`, `careful`, `guard`, `design-shotgun`) left every profile and are denylisted.
- **Default profile**: a project with no local profile runs the manifest defaults (= `full`). Check with `bash ~/.claude/lib/profile.sh current` from the project. Nine gstack skills (`ship`, `land-and-deploy`, `setup-deploy`, `autoplan`, `context-save`, `learn`, `careful`, `guard`, `design-shotgun`) left every profile and are denylisted.
- **Higgsfield**: installed, off by default. Nothing to do until you enable it.
### Profiles and packs (2026-11)
Run on every machine that pulls this version (the live tree may still be in
an old profile). Run steps 1 and 2 before any commit on that machine: the
removed `.gitignore` lines expose the old links as untracked files. Step 3
is the only one that removes a real directory (`make plugin` replaces
`skills-external/impeccable` on a refresh); steps 1 and 2 use `mv`, never
`rm -r`.
1. From the clone root. `~/.claude` is a real directory of symlinks into
the clone, not the clone itself, so resolve the root first. `git pull
--autostash` (a plain `git pull` aborts when `settings.json` is modified
locally and the incoming commits touch it; autostash keeps your UI
writes), then restore the user-scope plugins the old `profile.sh` had
toggled. Never `git checkout -- settings.json`: it would drop your UI
writes.
```bash
ep= next=
root="$(dirname "$(readlink -f ~/.claude/settings.json)")"
[ -n "$root" ] && [ -f "$root/lib/profile.sh" ] && cd "$root" \
|| { echo "no clone root"; false; } \
&& git pull --autostash \
&& ep="$(mktemp)" \
&& git show HEAD:settings.json | jq -e '.enabledPlugins | objects' \
> "$ep" \
&& next="$(mktemp)" \
&& jq --slurpfile ep "$ep" '.enabledPlugins = $ep[0]' settings.json \
> "$next" \
&& jq -e . "$next" >/dev/null && [ -s "$next" ] \
&& cp "$next" settings.json
rm -f "$ep" "$next"
```
Every command is chained with `&&` so that a failed step never reaches
`cp`, which writes through the symlink into the live tracked
`settings.json`; a failure prints `no clone root` or stops the chain
without closing your shell. `ep= next=` comes first so the final `rm -f`
never removes a file an earlier run named. `jq -e '.enabledPlugins |
objects'` fails when HEAD holds no object (a null would wipe every
plugin). `jq -e .` and `[ -s ]` refuse an invalid or empty result (an
empty file would drop the plugins, the deny rules and the hooks).
If the autostash pop conflicts, `settings.json` holds conflict markers:
the second `jq` then fails closed and nothing is copied. Resolve the
markers (`git stash list` shows the kept stash) before re-running step 1.
2. Old layout. List the flat links first, then remove the links of
`skills-disabled/` and the links of `skills/` that are not kept
(model-router, darwin-skill, the seven superpowers, the agent-skills
trio). If `skills/impeccable` or `skills-disabled/impeccable` is a real
directory, `mv` it to `skills-external/impeccable` (never `rm`). It
re-derives `$root`, so it also runs in a new shell; `mkdir -p
skills-disabled` lets a machine that never had that dir pass the same
chain, and `rmdir` removes it at the end. The trailing slash and
`-mindepth 1` keep `find` from matching the start point, which is itself
a symlink in `~/.claude`.
```bash
root="$(dirname "$(readlink -f ~/.claude/settings.json)")"
[ -f "$root/lib/profile.sh" ] && cd "$root" \
|| { echo "no clone root"; false; } \
&& mkdir -p skills-disabled skills-external \
&& find skills/ skills-disabled/ -mindepth 1 -maxdepth 1 -type l \
&& for d in skills skills-disabled; do
if [ -d "$d/impeccable" ] && [ ! -L "$d/impeccable" ] \
&& [ ! -e skills-external/impeccable ]; then
mv "$d/impeccable" skills-external/impeccable
fi
done \
&& find skills-disabled/ -mindepth 1 -maxdepth 1 -type l -delete \
&& find skills/ -mindepth 1 -maxdepth 1 -type l \
! -name model-router ! -name darwin-skill \
! -name observability-and-instrumentation \
! -name deprecation-and-migration ! -name ci-cd-and-automation \
! -name brainstorming ! -name writing-plans \
! -name subagent-driven-development ! -name test-driven-development \
! -name requesting-code-review ! -name using-git-worktrees \
! -name writing-skills -delete \
&& rmdir skills-disabled && rm -f .active-profile
```
3. From `$root`: `make link` (link.sh no longer links the design and scroll skills flat),
`make plugin` (fills `skills-external/`; impeccable ends in
`skills-external/impeccable`).
4. `~/.bashrc`: delete `dtach_claude()` and `alias cc='dtach_claude'` (the
alias would shadow the function and drop the profile argument); add
`[ -f "$HOME/.claude/lib/cc.sh" ] && . "$HOME/.claude/lib/cc.sh"`. New
shell. `cc <name>` behaves as before; `cc <name> web` starts a conversation
under `lib/profiles/web.json`.
5. Per project: `bash ~/.claude/lib/profile.sh set <profile>` then
`/reload-plugins`. `lib/toggle-external.sh` is gone (`profile.sh enable
higgsfield` replaces it).
6. `make doctor` until no warn; `make test`.
## Memory registries v2 (2026-10-28)
A v2 registry is the same `.claude/memory/<name>.md` file, versioned and pushed with the code, with `format: 2` in its frontmatter and no `## Index`. The session banner line `registry v1: N file(s) (memory.sh check)` flags a project still on v1. v1 stays readable and writable (lenient), and the `check --staged` chokepoint skips it.
+7 -10
View File
@@ -1,4 +1,4 @@
.PHONY: help install plugin link doctor update new-skill profile profile-list profile-current profile-reset onboard test scan-secrets seo-connect
.PHONY: help install plugin link doctor update new-skill profile profile-list profile-current onboard test scan-secrets seo-connect
help: ## Show available commands
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " make %-16s %s\n", $$1, $$2}'
@@ -33,7 +33,7 @@ test: ## Run deterministic tests hermetically (one: make test suite=lib/tests/x.
@# Hermetic git: the machine's global core.hooksPath (BDR-095) must not
@# fire inside the throwaway repos the suites build. The export lives
@# HERE so nobody has to type the (denied) env-prefix form by hand.
@export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null; \
@export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null; unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS; \
fail=0; red=""; for t in $(or $(suite),$(SUITES)); do \
echo "== $$t"; \
case "$$(basename "$$t")" in \
@@ -59,17 +59,14 @@ scan-secrets: ## Gitleaks sweep: this repo's history + ~/.claude. Extra repos: m
echo "Reports: .audit/scan-secrets-*.json (redacted; gitignored — keep local, do NOT commit)"; \
exit $$fail
profile: ## Run profile.sh (usage: make profile cmd="set design")
@bash lib/profile.sh $(cmd)
profile: ## profile.sh on a project (usage: make profile cmd="set design" dir=/path/to/project; default: this repo)
@bash lib/profile.sh -C "$(or $(dir),$(CURDIR))" $(cmd)
profile-list: ## List skill profiles (audit, backend, design, dev, full, max, minimal, qa, seo, web, web-full)
profile-list: ## List pack profiles (lib/profiles/*.json)
@bash lib/profile.sh list
profile-current: ## Show the active profile (label + match)
@bash lib/profile.sh current
profile-reset: ## Go to the default profile (full)
@bash lib/profile.sh reset
profile-current: ## Effective profile of a project (dir=…; default: this repo)
@bash lib/profile.sh -C "$(or $(dir),$(CURDIR))" current
new-skill: ## Create a new skill scaffold (usage: make new-skill name=myskill)
@test -n "$(name)" || (echo "Usage: make new-skill name=myskill" && exit 1)
+29 -34
View File
@@ -156,7 +156,7 @@ Limits: a main-loop switch re-reads cold the part of the context the target mode
All scripts use their own location to find the repo — run them from anywhere.
The plugins step logs to `install-YYYYMMDD-HHMMSS.log`.
The last step applies the default profile, `full`, when none is selected, and re-applies an existing selection.
The installers fill `skills-external/`; the packs under `skills/pack-*/` link it, on or off per project (`bash ~/.claude/lib/profile.sh set <profile>` from the project, then `/reload-plugins`) or per conversation (`cc <name> <profile>`). `cc` is a shell function from `lib/cc.sh`: add `[ -f "$HOME/.claude/lib/cc.sh" ] && . "$HOME/.claude/lib/cc.sh"` to `~/.bashrc` (`make doctor` warns until it is there).
**Optional — Context7** (fast doc lookup for React / Next.js / Prisma…): the plugins
step installs the `ctx7` CLI and wires it into Claude Code. The doc-fetch surface is
@@ -177,7 +177,7 @@ ctx7 login # optional: OAuth / API key for higher rate limits
| Component | Type | Description | Docs |
|---|---|---|---|
| **Superpowers skills** | Vendored (7, always on) | brainstorming, writing-plans, subagent-driven development, TDD, code review request, git worktrees, writing-skills — pinned v6.4.1 in plugins.lock.json, no plugin, no session injection | [obra/superpowers](https://github.com/obra/superpowers) |
| **GStack** | Git submodule (per profile) | Product workflow skills: plan reviews, design, browser QA, security (`cso`), `health`. Linked per profile; 9 broken or doctrine-breaking skills are denylisted in `lib/gstack-removed.sh`. | [garrytan/gstack](https://github.com/garrytan/gstack) |
| **GStack** | Git submodule (per profile) | Product workflow skills: plan reviews, design, browser QA, security (`cso`), `health`. Linked by pack-gstack-dev, pack-gstack-browser and pack-gstack-design; 9 broken or doctrine-breaking skills are denylisted in `lib/gstack-removed.list`. | [garrytan/gstack](https://github.com/garrytan/gstack) |
| **GSD v2** | External CLI | Multi-session orchestration: crash recovery, cost tracking, parallel workers, context-fresh execution. | [gsd-build/gsd-2](https://github.com/gsd-build/gsd-2) |
| **RTK** | CLI + hook (always on) | Rust Token Killer: the `hooks/rtk-rewrite.sh` PreToolUse hook rewrites Bash commands through `rtk` to cut output tokens. Zero passive cost. | [rtk-ai/rtk](https://github.com/rtk-ai/rtk) |
| **security-guidance** | Plugin (always on) | Security hook. Regex layer and commit/push review on; the Stop-time diff review is off (`ENABLE_STOP_REVIEW=0`). | [anthropics/claude-code](https://github.com/anthropics/claude-code) |
@@ -185,7 +185,7 @@ ctx7 login # optional: OAuth / API key for higher rate limits
| **Context7** | CLI (`ctx7`) | Doc lookup for fast-evolving libs (Next.js, React, Prisma...), used through the `find-docs` skill. Works anonymously; optional `ctx7 login` raises rate limits. | [context7.com](https://context7.com/) |
| **pr-review-toolkit** | Plugin (toggle) | Multi-agent PR review. | [anthropics/claude-code](https://github.com/anthropics/claude-code) |
| **Graphify** | Python CLI | Codebase → knowledge graph → navigable wiki. Helps Claude map and search projects efficiently. | [pypi: graphifyy](https://pypi.org/project/graphifyy/) |
| **21st.dev** | External CLI + skill pack | Component catalog and UI generation (`21st`), browser login, no API key. 7 skills in `skills-external/21st-*`, linked per profile (see the 21st.dev CLI section). | [npm: @21st-dev/cli](https://www.npmjs.com/package/@21st-dev/cli) |
| **21st.dev** | External CLI + skill pack | Component catalog and UI generation (`21st`), browser login, no API key. 8 skills in `skills-external/21st-*`, linked by pack-design and pack-extras (see the 21st.dev CLI section). | [npm: @21st-dev/cli](https://www.npmjs.com/package/@21st-dev/cli) |
| **Higgsfield** | External CLI + skill pack (off by default) | Image, video, audio and brand media generation, metered credits (see the Higgsfield CLI section). | [higgsfield-ai/skills](https://github.com/higgsfield-ai/skills) |
| **Semgrep** | Python CLI (pinned) | SAST engine behind the security gate (`security-auditor`). | [pypi: semgrep](https://pypi.org/project/semgrep/) |
| **Impeccable** | npm CLI + skill (pinned) | Deterministic anti-slop detector (`npx impeccable detect`, 61 rules) and the `/impeccable` design verbs. | [npm: impeccable](https://www.npmjs.com/package/impeccable) |
@@ -240,14 +240,17 @@ a different package, ships its own conflicting `graphify` bin) — see
| `/web-validate` | W3C HTML/CSS validity + WCAG 2.1 conformance audit (keyboard/alt/label basics → /a11y) |
| `/geo` | GEO-only audit — AI-search visibility (ChatGPT, Perplexity, Claude, Gemini…) |
| `/client-handover` | Final project delivery — audits + branded deliverable (Markdown / HTML / PDF) |
| `/profile` | Activate a skill profile (web / seo / web-full / full / max / backend / design / dev / qa / audit / minimal) (default: full) |
| `/profile` | Set this project's pack profile (`set <n>`, `enable <pack>`), show the effective one (`current`) |
| `/tour` | Grouped all-axes sweep — cleanup + security + reconcile + doc, fix and loop until clean |
| `/site-motion` | Site-level motion: scroll engine choice, page transitions, pin/scrub sequencing across a page or Astro route (design stack) |
| `/route` | model-router mod: show or set the main-loop route (show, clear, off, on, reload, pending, ask on\|off, <phase>, model=… effort=…, switch on\|off, classify on\|off, verbose on\|off: transitions only) |
> This table lists personal skills. Gstack skills (investigate, review, retro,
> office-hours, cso…) and marketplace plugins add many more — run
> `/skills-perso` to list your hand-written skills, or browse `skills/`.
> This table lists personal skills. `/seo` and `/geo` (pack-seo), `/web-validate`
> (pack-web-validate) and `/site-motion` (pack-design) live in packs: a profile that
> leaves the pack off hides them (`/profile current`). Gstack skills (investigate,
> review, retro, office-hours, cso…) and marketplace plugins add many more; run
> `/skills-perso` to list your hand-written skills, or browse `skills/` and
> `skills/pack-*/skills/`.
---
@@ -380,13 +383,12 @@ npm i -g @21st-dev/cli
`make plugin` does both (Step 8.7 installs the CLI, then offers the login in
an interactive terminal) and installs the skill pack that drives it:
`21st-ui-build`, `-ui-explore`, `-ui-review`, `-cli-use`, `-ai`, plus the two
publishing skills `-registry` and `-design-sync`. Of the five design skills, `21st-ui-build` and
`21st-cli-use` follow the active profile: on under `full`, the default profile, and under `design`,
`web` and `web-full`. The other three, `-ui-explore`, `-ui-review` and
`-ai`, are on under `max` only. The two publishing skills,
`-registry` and `-design-sync`, are in no profile and stay parked until
`bash lib/toggle-external.sh enable 21st` turns on all seven.
`21st-ui-build`, `-ui-explore`, `-ui-review`, `-cli-use`, `-ai`, plus the
publishing skills `-registry`, `-design-sync` and `-video`. `21st-ui-build`
and `21st-cli-use` sit in pack-design (on under `full`, `design` and
`web`). `-ui-explore`, `-ui-review` and `-ai` sit in pack-extras (on
under `max`, or after `bash ~/.claude/lib/profile.sh enable extras` in the project). `-registry`,
`-design-sync` and `-video` stay unlinked in `skills-external/`.
The pack is machine-owned and gitignored. It cannot be installed the way
upstream documents it (`21st install-skill`, i.e. `21st skills install
@@ -394,7 +396,7 @@ upstream documents it (`21st install-skill`, i.e. `21st skills install
follow a symlink anywhere on that path, while `~/.claude/skills` is itself a
symlink to this repo's `skills/`. So the install runs under a throwaway `HOME`
and the result is moved into `skills-external/21st-*`, where
`toggle-external.sh` and `profile.sh` symlink it in on demand.
the pack symlinks reach it.
The permission gate is now one `autoMode.soft_deny` entry covering the
outward-facing verbs (`21st publish*`, `submit`, `edit`, `delete`,
@@ -424,27 +426,21 @@ The copies are machine-owned and gitignored. They follow upstream `main`,
so a prompt change arrives with no diff to review, and a skill that
upstream removes keeps its last local copy.
The pack is off by default and belongs to no profile. It costs nothing until
you ask for it, and no `profile set` touches it:
The pack is off by default and on in `max` only. It costs nothing until
you ask for it:
```bash
bash lib/toggle-external.sh enable higgsfield # media skills
bash lib/toggle-external.sh enable higgsfield-websites # landing-page aid
bash lib/toggle-external.sh disable higgsfield
bash lib/toggle-external.sh disable higgsfield-websites
bash ~/.claude/lib/profile.sh enable higgsfield # from the project, then /reload-plugins
bash ~/.claude/lib/profile.sh disable higgsfield
```
`higgsfield` links a fixed list of seven media skills: generate, soul-id,
product-photoshoot, brandkit, marketplace-cards, video-explainer and
youtube-thumbnail. The list is `HIGGSFIELD_MEDIA_SKILLS` in
`lib/toggle-external.sh`. A skill that upstream adds later is synced, and
every `enable higgsfield` names it, the pack being on or not. It stays
unlinked until it is added to the list.
The pack (`skills/pack-higgsfield/skills/`) holds the 8 `higgsfield-*`
skills.
`higgsfield-websites` is kept apart. It helps with landing pages inside the
`higgsfield-websites` is one of them. It helps with landing pages inside the
design stack (assets, references), and `higgsfield website
create|deploy|publish` stays unused. Claude enables either toggle itself on
an explicit ask (Skill routing in `CLAUDE.global.md`) and checks the price
create|deploy|publish` stays unused. Claude runs `bash ~/.claude/lib/profile.sh enable higgsfield` on
a named media ask, then `/reload-plugins` (Skill routing in `CLAUDE.global.md`) and checks the price
with `higgsfield generate cost` before a paid run.
The skills are cloned, not installed with `npx skills add`: that installer
@@ -484,14 +480,13 @@ make scan-secrets [repos="…"] # gitleaks sweep of this repo's history and ~/.
make help # list make targets
make onboard # onboard an existing project (run from its dir)
make seo-connect # connect a Google account for /seo FULL (OAuth consent)
make profile cmd="set X" # activate a skill profile (web/seo/web-full/full/max/backend/design/dev/qa/audit/minimal)
make profile cmd="set X" dir=/path/to/project # activate a skill profile (web/seo/full/max/design/dev/qa/audit/minimal)
make profile-list # list skill profiles
make profile-current # show the active profile (full when none selected)
make profile-reset # go to the default profile (full)
make profile-current dir=/path/to/project # effective profile of this project and conversation
make new-skill name=myskill # scaffold agent + skill files
```
`doctor.sh` checks: symlinks, GStack submodule, vendored skills (curl-pinned externals in `plugins.lock.json` + `link.sh`'s `EXTERNAL_SKILLS`, per the active profile), Playwright browser cache, prerequisites (git, Node, Cargo, Python, Claude Code), plugins, permissions, token budget, config consistency, git hooks (global core.hooksPath + generated githooks/), mods (loading link and `@skills-dir` state), scratchpad (TMPDIR quota), Higgsfield CLI and session, seo-data layer, auto memory (`autoMemoryEnabled` false in `settings.json`, leftover files under `~/.claude/projects/*/memory/`).
`doctor.sh` checks: symlinks, GStack submodule, vendored skills (curl-pinned externals in `plugins.lock.json` + `link.sh`'s `EXTERNAL_SKILLS`), packs (census), profiles, Playwright browser cache, prerequisites (git, Node, Cargo, Python, Claude Code), plugins, permissions, token budget, config consistency, git hooks (global core.hooksPath + generated githooks/), mods (loading link and `@skills-dir` state), scratchpad (TMPDIR quota), Higgsfield CLI and session, seo-data layer, auto memory (`autoMemoryEnabled` false in `settings.json`, leftover files under `~/.claude/projects/*/memory/`).
---
+8 -4
View File
@@ -123,7 +123,7 @@ Tu veux...
| Comprendre un changement pas suivi | `/explain-diff` |
| Auditer garde-fous (RLS, consentement, fonctions, mots de passe, injection SQL, fuites navigateur) puis corriger | `/guardrails` |
| Sonder le projet en direct (lecture seule, cible à toi) | `/guardrails --live <url>` |
| Changer profil skills | `/profile` |
| Changer le profil de packs du projet (`set`), ou l'état effectif (`current`) | `/profile` |
| Audit/polish design (anti-slop) | `/impeccable` |
| Sweep groupé tous axes (nettoyage + sécu + reconcile + doc) | `/tour` |
| Rien ne marche | `make doctor` (terminal) |
@@ -171,10 +171,12 @@ Tu veux...
| `/impeccable` | Audit/polish design + détecteur anti-slop déterministe | 23 verbes ; `npx impeccable detect` (exit 0/2) |
| `/tour` | Sweep groupé sur un ou plusieurs projets | Sécu + nettoyage + reconcile + doc, boucle jusqu'à un pass propre |
| `/route` | Voir ou fixer la route du mod model-router | show / clear / off / on / reload / pending / ask on\|off / <phase> / model=… effort=… / switch on\|off / classify on\|off (classifieur de prompt) / verbose on\|off (transitions seules) |
| `/profile` | Changer le profil de skills | web / seo / web-full / full / max / backend / design / dev / qa / audit / minimal |
| `/profile` | Changer le profil de packs du projet (`set`), ou l'état effectif (`current`) | Profils dans `lib/profiles/*.json`, packs dans `skills/pack-*/` |
> Cette table couvre les skills personnels principaux. Les plugins (gstack,
> pr-review-toolkit…) et marketplaces externes en ajoutent beaucoup d'autres —
> Cette table couvre les skills personnels principaux. `/seo` et `/geo` (pack-seo)
> et `/web-validate` (pack-web-validate) vivent dans des packs : un profil qui laisse
> le pack éteint les masque (`/profile current`). Les plugins (gstack,
> pr-review-toolkit…) et marketplaces externes en ajoutent beaucoup d'autres ;
> `/skills-perso` liste tes skills personnels.
---
@@ -214,6 +216,8 @@ Hotfix/quick fix → tout OFF (skills superpowers vendorisés, toujours
**GSD v2** n'est pas un plugin Claude Code — c'est un CLI externe. Il ne consomme pas de tokens passifs. Tu le lances dans un terminal séparé avec `gsd`, puis `/gsd auto` pour le mode autonome.
**Profils et packs.** Un profil se règle par projet (`/profile set web` puis `/reload-plugins`) ou par conversation (`cc <nom> web`, la conversation est figée: relance-la pour changer). Neuf profils: `full`, `max`, `minimal`, `dev`, `design`, `web`, `seo`, `qa`, `audit`. Sans profil, c'est `full`. Un `--settings` édité en cours de session reste sans effet. `cc x web` sur un projet en `dev` garde les connecteurs higgsfield refusés (union); `set web` dans le projet les rend. `cc` est une fonction de `lib/cc.sh`, à sourcer depuis `~/.bashrc` (`[ -f "$HOME/.claude/lib/cc.sh" ] && . "$HOME/.claude/lib/cc.sh"`) ; `make doctor` le signale tant qu'elle manque.
---
## Patterns de workflow
+5 -5
View File
@@ -269,14 +269,14 @@ For web projects, dispatch in **a single message with two parallel Agent calls**
| Audit (web) | Subagent | Prompt template |
|---------------|-------------------|-----------------|
| SEO + GEO | `general-purpose` | "Read `~/.claude/skills/seo/SKILL.md` and execute it on this project. The /seo skill runs SEO + GEO in parallel and writes a unified report to `.claude/audits/SEO.md`. Run it in conservative mode: apply NOTHING, return the FIX BUNDLE (the handover main loop applies it — see 'Applying the bundle'). At the top of the report, the /seo skill MUST emit two distinct labeled score lines (already specified in its SKILL.md §1): `Score SEO (classique) : X.X / 20` and `Score GEO (IA) : X.X / 20`, plus the weighted global. The handover orchestrator parses SEO and GEO separately, so do not collapse them into a single `Score:` line. Return when the report file is written." |
| SEO + GEO | `general-purpose` | "Read `~/.claude/skills/pack-seo/skills/seo/SKILL.md` and execute it on this project. The /seo skill runs SEO + GEO in parallel and writes a unified report to `.claude/audits/SEO.md`. Run it in conservative mode: apply NOTHING, return the FIX BUNDLE (the handover main loop applies it — see 'Applying the bundle'). At the top of the report, the /seo skill MUST emit two distinct labeled score lines (already specified in its SKILL.md §1): `Score SEO (classique) : X.X / 20` and `Score GEO (IA) : X.X / 20`, plus the weighted global. The handover orchestrator parses SEO and GEO separately, so do not collapse them into a single `Score:` line. Return when the report file is written." |
| HARDEN | `general-purpose` | "Read `~/.claude/skills/harden/SKILL.md` and execute it on this project with `--fix` up to READY TO APPLY only: prepare the FIX BUNDLE (security headers, HSTS, CSP, HTTP→HTTPS redirects, canonical, 404 page), apply NOTHING — the handover main loop gates and applies it (see 'Applying the bundle'). Write report to `.claude/audits/HARDEN.md` with `Score: X/20` (or `X/100`) at the top. Return when the report file is written." |
Non-web variant:
| Audit (non-web) | Subagent | Prompt template |
|-----------------|-------------------|-----------------|
| CSO | `general-purpose` | "Read `~/.claude/skills/cso/SKILL.md` and execute in **daily mode** (8/10 confidence gate). Apply NOTHING: return the fixes as a FIX BUNDLE (gitignore additions and placeholder swaps tagged AUTO, dependency upgrades tagged GATED — the handover main loop applies AUTO and gates the rest, see 'Applying the bundle'). Write report to `.claude/audits/CSO.md` with `Score: X/20` (or `X/100`) at the top." |
| CSO | `general-purpose` | "Read `~/.claude/skills/pack-gstack-dev/skills/cso/SKILL.md` and execute in **daily mode** (8/10 confidence gate). Apply NOTHING: return the fixes as a FIX BUNDLE (gitignore additions and placeholder swaps tagged AUTO, dependency upgrades tagged GATED — the handover main loop applies AUTO and gates the rest, see 'Applying the bundle'). Write report to `.claude/audits/CSO.md` with `Score: X/20` (or `X/100`) at the top." |
Wait for both subagents to complete (parallel return).
@@ -426,7 +426,7 @@ for CSO) in the format
Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`):
> Read `~/.claude/skills/seo/SKILL.md` and re-run it on this project in
> Read `~/.claude/skills/pack-seo/skills/seo/SKILL.md` and re-run it on this project in
> **conservative (audit-only) intervention mode**: re-score and leave both
> FIX BUNDLEs in `.claude/audits/SEO.md` ready-to-apply. Apply NOTHING and
> ask the user NOTHING — the handover main loop is the dispatcher: it
@@ -470,7 +470,7 @@ Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`):
Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`):
> Read `~/.claude/skills/cso/SKILL.md` and re-run it in **daily mode**.
> Read `~/.claude/skills/pack-gstack-dev/skills/cso/SKILL.md` and re-run it in **daily mode**.
> Previous score: **`<SCORE_CSO_PREVIOUS>`/20** — below threshold.
> Iteration `<N>` of `<MAX_ITERATIONS>`. Apply NOTHING: return the fixes as
> a FIX BUNDLE in `.claude/audits/CSO.md` — gitignore additions and secret
@@ -679,7 +679,7 @@ VALIDATE as not-applicable rather than failed).
Dispatch `general-purpose` subagent (`model: "fable"`, `effort="high"`):
> Read `~/.claude/skills/web-validate/SKILL.md` and execute against the
> Read `~/.claude/skills/pack-web-validate/skills/web-validate/SKILL.md` and execute against the
> deployed URL: `<DEPLOYED_URL>`. Audit W3C HTML validity (validator.nu),
> W3C CSS validity (jigsaw.w3.org), WCAG 2.1 a11y (axe-core, pa11y).
> Apply NOTHING (the client controls deploy; the handover main loop applies
+28 -53
View File
@@ -19,7 +19,7 @@ Detection is NOT your job (plugin-probe did it); applying is NOT your job
## INPUT — PROBE REPORT (ground truth, from plugin-probe)
The dispatcher passes `REQUEST` (the project description, verbatim) and the
full `PROBE REPORT` (fields: PLUGINS, EXTERNAL, PROFILE, CLIS, MANIFESTS,
full `PROBE REPORT` (fields: PROFILE, PLUGINS, CLIS, MANIFESTS,
FRAMEWORK-DEPS, TSX-JSX-COUNT, DOCKER-COUNT, ANIM, MONOREPO, EMBEDDED,
CHECKPOINT). Treat it as ground truth — never re-detect, never invent a
field. PROBE REPORT missing or a field absent → emit
@@ -164,7 +164,7 @@ When the plugin-advisor detects a `simple` or `hotfix` signal, suggest the appro
**Escalation path:** `/hotfix` → `/bugfix` → `/ship-feature` (bugs), `/feat` → `/ship-feature` (features). Each skill documents when to escalate to the next level.
**Design gate:** `/feat`, `/hotfix`, and `/bugfix` include a lightweight design gate (`lib/design-gate.md`) that auto-detects UI/style signals and, if the design toolchain is incomplete, points the user at `/profile design`. This covers the gap where lightweight skills previously had no plugin awareness for design tasks.
**Design gate:** `/feat`, `/hotfix`, and `/bugfix` include a lightweight design gate (`lib/design-gate.md`) that auto-detects UI/style signals and, if the design toolchain is incomplete, points the user at the remedy line it printed. This covers the gap where lightweight skills previously had no plugin awareness for design tasks.
---
@@ -219,7 +219,7 @@ RULE: IF "monorepo" signal detected:
RULE: IF "frontend" signal OR .tsx/.jsx count > 0:
→ ui-ux-pro-max ON if "design-system" signal (~400t)
→ impeccable ON (external skill, 0t passive — ~/.claude/skills/impeccable)
→ impeccable ON (external skill, 0t passive — ~/.claude/skills/pack-design/skills/impeccable)
→ design-motion-principles ON if anim-lib-installed or description mentions animation/motion (external, 0t passive)
RULE: IF "deploy" AND "browser-qa" signals:
@@ -271,60 +271,35 @@ RULE: IF `complex-arch` signal (multiple services, event bus, distributed system
---
## TOGGLING EXTERNAL TOOLS
## WRITING A PROFILE OR A PACK
Marketplace plugins toggle via `claude plugin enable|disable <name>@<marketplace>`.
Non-marketplace tools (gstack per-skill symlinks, emil-design-eng, darwin-skill)
toggle via `bash $HOME/.claude/lib/toggle-external.sh enable|disable <tool>`.
Everything switches through `lib/profile.sh`, per project, never the user
scope. Emit the exact command; never write files directly.
When a recommendation flips the state of one of those tools, emit the exact
command — never write files directly.
```
# Enable gstack for a browser-QA signal:
bash $HOME/.claude/lib/toggle-external.sh enable gstack
# Disable darwin-skill when passive cost is too high for a hotfix:
bash $HOME/.claude/lib/toggle-external.sh disable darwin-skill
```
`higgsfield` / `higgsfield-websites`: never recommended from project signals.
They drive a paid generation service; explicit user ask only (CLAUDE.md
"Skill routing").
### Skill profiles (fine-grained partitioning, with plugin + MCP toggle)
For task-shaped activation (web only, seo only, backend only, design only,
etc.) prefer `lib/profile.sh` over toggling all of gstack at once. Profiles
activate a curated subset of skills + plugins + MCPs and disable the rest of
gstack + managed plugins — sessions stay focused and passive token cost drops.
`profile set <name>` actually toggles plugins (`claude plugin enable|disable`)
and external skill packs (delegates to `lib/toggle-external.sh`) — not just
advisory. No MCP server is auto-toggled today. Always-on plugins (`security-guidance`)
and the vendored superpowers skills are never toggled by a profile. Managed
plugins that `set` may toggle:
`ui-ux-pro-max@ui-ux-pro-max-skill`, `plugin-dev@claude-code-plugins`,
`pr-review-toolkit@claude-code-plugins`. Other plugins are never auto-toggled.
When the project signal matches one of the canonical profiles, recommend the
matching `profile set` command:
| Signal | Recommended profile | Command |
| Signal | Profile | Command |
|---|---|---|
| `frontend` public website (no backend, no SEO focus) | `web` | `bash $HOME/.claude/lib/profile.sh set web` |
| audit-only: SEO + GEO + W3C + WCAG | `seo` | `bash $HOME/.claude/lib/profile.sh set seo` |
| public website end-to-end (build + audit) | `web-full` | `bash $HOME/.claude/lib/profile.sh set web-full` |
| backend / API / system / library (no UI, no SEO) | `backend` | `bash $HOME/.claude/lib/profile.sh set backend` |
| `design-system` (heavy UI work, no dev) | `design` | `bash $HOME/.claude/lib/profile.sh set design` |
| `simple` / hotfix / typical dev session | `dev` | `bash $HOME/.claude/lib/profile.sh set dev` |
| `browser-qa` (e2e tests, no design work) | `qa` | `bash $HOME/.claude/lib/profile.sh set qa` |
| comprehensive audit (security + SEO + perf) | `audit` | `bash $HOME/.claude/lib/profile.sh set audit` |
| narrow session, minimal noise | `minimal` | `bash $HOME/.claude/lib/profile.sh set minimal` |
| public website, no SEO focus | `web` | `bash $HOME/.claude/lib/profile.sh set web` |
| audit-only: SEO + GEO + W3C + WCAG | `seo` | `… set seo` |
| public website end-to-end | `full` | `… set full` |
| backend / API / library | `dev` | `… set dev` |
| heavy UI, no dev | `design` | `… set design` |
| typical dev session | `dev` | `… set dev` |
| browser QA only | `qa` | `… set qa` |
| comprehensive audit | `audit` | `… set audit` |
| narrow session | `minimal` | `… set minimal` |
| one pack on top | — | `bash $HOME/.claude/lib/profile.sh enable <pack>` |
To go back to the default profile: `bash $HOME/.claude/lib/profile.sh reset`
(= `set full`: enables full's list, parks non-listed gstack/managed items,
toggles the managed plugins like any `set`).
`<pack>` is one of design, scroll3d, seo, web-validate, gstack-dev,
gstack-browser, gstack-design, higgsfield, extras.
Read `PROFILE :` first: when it says `source=flag`, a pack it turns off
cannot be enabled in this conversation; recommend `relaunch: cc <name>
<profile>` instead of an `enable`. No profile = `full` (manifest defaults);
`unset` returns to it. Every write needs `/reload-plugins` to load the
packs; connectors and model apply to the next session.
`higgsfield`: never recommended from project signals. It drives a paid
generation service; explicit user ask only (CLAUDE.md "Skill routing").
## BLOCK if
+9 -14
View File
@@ -15,17 +15,13 @@ Facts only — no signals, no recommendations, no complexity scoring.
## PROBES (run all; a failing probe reports its fallback string, never aborts)
```bash
# Claude Code plugins
# Packs, managed plugins, connectors, model: the effective state of THIS
# project and conversation (lib/profile.sh, no claude call)
bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current --plain 2>/dev/null || echo "profile-unavailable"
# Marketplace plugins actually installed (ids, enabled state)
claude plugin list 2>/dev/null || echo "plugin-list-unavailable"
# External (non-marketplace) tools status — gstack, emil-design-eng,
# darwin-skill. Managed by lib/toggle-external.sh since
# `claude plugin enable|disable` does not apply to them.
bash "$HOME/.claude/lib/toggle-external.sh" list 2>/dev/null || echo "toggle-external-unavailable"
# Active skill profile — design / dev / qa / audit / minimal / custom.
bash "$HOME/.claude/lib/profile.sh" current 2>/dev/null || echo "profile-unavailable"
# Context7 CLI
command -v ctx7 &>/dev/null && ctx7 --version 2>/dev/null | head -1 || echo "ctx7-not-installed"
@@ -60,7 +56,7 @@ ls src/*.c 2>/dev/null | head -3
ls package.json Cargo.toml go.mod pubspec.yaml setup.py pyproject.toml 2>/dev/null | head -1 # counterindicators (ecosystem present = not bare embedded)
# Checkpoint inputs (consumed by lib/plugin-gate.md's validation checkpoint)
[ -x "$HOME/.claude/lib/toggle-external.sh" ] && echo "toggle-script: executable" || echo "toggle-script: UNAVAILABLE"
[ -f "$HOME/.claude/lib/profile.sh" ] && echo "profile-sh: available" || echo "profile-sh: UNAVAILABLE"
ls "$HOME/.claude/plugins/cache" 2>/dev/null | head -10
ls "$HOME/.agents/skills" 2>/dev/null | head -10
```
@@ -69,9 +65,8 @@ ls "$HOME/.agents/skills" 2>/dev/null | head -10
```
PROBE REPORT
PLUGINS : <claude plugin list output, one per line>
EXTERNAL : <toggle-external list output>
PROFILE : <profile current output>
PROFILE : <current --plain block, verbatim>
PLUGINS : <claude plugin list output>
CLIS : ctx7=<v|absent> gsd=<v|absent> rtk=<v|absent>
MANIFESTS : <files found>
FRAMEWORK-DEPS: <exact "dep": "version" pairs, or framework-deps-none>
@@ -80,7 +75,7 @@ DOCKER-COUNT : <n>
ANIM : eligibility=<status|package|reason> installed=<lib|no>
MONOREPO : dirs=<hits> configs=<hits> parent=<hits>
EMBEDDED : cmake-pio=<hits> linker=<hits> makefile=<y/n> src-c=<hits> ecosystem=<first manifest|none>
CHECKPOINT : toggle-script=<executable|UNAVAILABLE> plugin-dirs=<cache+skills listing>
CHECKPOINT : profile-sh=<available|UNAVAILABLE> plugin-dirs=<cache+skills listing>
```
## RULES
+34 -34
View File
@@ -111,18 +111,16 @@ else
warn "GStack submodule missing — run: git submodule update --init"
fi
# GStack skills are exposed as PER-SKILL symlinks directly under skills/ (browse,
# cso, review, …) pointing into skills-external/gstack/ — there is NO single
# skills/gstack symlink (link.sh deliberately removes it: it duplicated the
# top-level gstack SKILL.md alongside the per-skill entries). The bin/ +
# browse/dist/ helper links under skills/gstack/ are checked in §7 Consistency.
# `|| true` guards pipefail if skills/ is unexpectedly absent (checked above).
gstack_skill_links=$( { find "$HOME/.claude/skills/" -maxdepth 1 -type l -lname '*skills-external/gstack/*' 2>/dev/null || true; } | wc -l | tr -d ' ')
if [ "${gstack_skill_links:-0}" -gt 0 ]; then
pass "GStack: ${gstack_skill_links} skills linked (per-skill symlinks)"
else
warn "GStack skills not linked — run: cd skills-external/gstack && ./setup"
echo "── Packs ──"
_pc="$(bash "$REPO/lib/pack-census.sh" --installed 2>&1)" && _pc_rc=0 || _pc_rc=$?
while read -r _w; do [ -n "$_w" ] && warn "${_w#WARN }"; done < <(grep '^WARN' <<<"$_pc" || true)
while read -r _r; do [ -n "$_r" ] && fail "${_r#RED }"; done < <(grep '^RED' <<<"$_pc" || true)
if [ "$_pc_rc" -eq 0 ]; then
pass "$(tail -1 <<<"$_pc")"
elif ! grep -q '^RED' <<<"$_pc"; then
fail "pack census failed (rc=$_pc_rc)"
fi
unset _pc _pc_rc _w _r
echo ""
@@ -132,29 +130,31 @@ echo ""
# externals the GStack section above does not cover)
# ────────────────────────────────────────────────────────────
echo "── Vendored skills ──"
# Mirrors lib/profile.sh's active_profile() (read_cache + the
# blank/"none" -> DEFAULT_PROFILE fallback) without sourcing profile.sh
# itself (its main() would run unconditionally) and without ever
# invoking `claude`.
_dv_active_profile=$(head -n1 "$REPO/.active-profile" 2>/dev/null \
| tr -d '[:space:]')
[ -z "$_dv_active_profile" ] && _dv_active_profile="none"
[ "$_dv_active_profile" = "none" ] && _dv_active_profile="full"
# .active-profile's value is spliced into a lib/profiles/ path below —
# reject anything outside the profile-name allowlist before that splice.
if ! _dv_valid_profile_name "$_dv_active_profile"; then
warn ".active-profile has invalid value \"$_dv_active_profile\" — \
falling back to profile full"
_dv_active_profile="full"
fi
_dv_profile_file="$REPO/lib/profiles/$_dv_active_profile.profile"
if [ -f "$_dv_profile_file" ]; then
check_vendored_skills "$REPO" "$HOME/.claude" "$_dv_profile_file"
check_vendored_skills "$REPO" "$HOME/.claude"
echo ""
echo "── Profiles ──"
if grep -q 'lib/cc\.sh' "$HOME/.bashrc" 2>/dev/null; then
pass "\$HOME/.bashrc sources lib/cc.sh (cc <name> [profile])"
else
# Active profile unresolved — every external is expected linked.
check_vendored_skills "$REPO" "$HOME/.claude"
warn "\$HOME/.bashrc does not source lib/cc.sh, add: [ -f \"\$HOME/.claude/lib/cc.sh\" ] && . \"\$HOME/.claude/lib/cc.sh\""
fi
unset _dv_active_profile _dv_profile_file
if grep -Eq 'alias cc=|dtach_claude' "$HOME/.bashrc" 2>/dev/null; then
warn "\$HOME/.bashrc still has alias cc= or dtach_claude: remove them, the alias shadows cc()"
fi
_ep_head="$(git -C "$REPO" show HEAD:settings.json 2>/dev/null | jq -S .enabledPlugins 2>/dev/null || true)"
_ep_work="$(jq -S .enabledPlugins "$REPO/settings.json" 2>/dev/null || true)"
if [ -z "$_ep_head" ] || [ -z "$_ep_work" ]; then
warn "enabledPlugins check skipped (jq or git show failed)"
elif [ "$_ep_head" = "$_ep_work" ]; then
pass "settings.json enabledPlugins matches HEAD (no user-scope residue)"
else
warn "user-scope residue: $(diff <(echo "$_ep_head") <(echo "$_ep_work") | grep '^[<>]' | tr -s ' ' | tr '\n' ';'); restore per MIGRATION "Profiles and packs" step 1"
fi
_m="$(jq -r '.model // "-"' "$REPO/settings.json" 2>/dev/null || echo "-")"
if [ "$_m" = opus ]; then pass "settings.json model is opus"
else warn "settings.json model is $_m (tracked default is opus)"; fi
unset _ep_head _ep_work _m
echo ""
@@ -587,7 +587,7 @@ fi
# every owned skill — permanent false-warn since. Inverted: warn if any
# owned skill REintroduces the key (regression watch on BDR-019).
PRESENT_DMI=()
for f in "$HOME/.claude/skills/"*/SKILL.md; do
for f in "$HOME/.claude/skills/"*/SKILL.md "$REPO"/skills/pack-*/skills/*/SKILL.md; do
[ -f "$f" ] || continue
dir=$(dirname "$f")
# Skip external skills (symlinked directory or symlinked SKILL.md — not owned by this repo)
@@ -643,7 +643,7 @@ fi
# Check CRLF — portable: grep -P not available on macOS BSD grep
CRLF_FILES=()
for f in "$REPO"/*.md "$REPO"/agents/*.md "$REPO"/skills/*/SKILL.md; do
for f in "$REPO"/*.md "$REPO"/agents/*.md "$REPO"/skills/*/SKILL.md "$REPO"/skills/pack-*/skills/*/SKILL.md; do
[ -f "$f" ] || continue
if grep -c $'\r' "$f" 2>/dev/null | grep -q "^[^0]"; then
CRLF_FILES+=("$(basename "$f")")
+18 -2
View File
@@ -64,6 +64,11 @@ unset _gg_lib
# ── Toggle plugin detection ──
# One profile.sh run, shared with detect_gstack through PROFILE_PLAIN.
PROFILE_PLAIN="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current \
--plain 2>/dev/null)" || PROFILE_PLAIN=""
export PROFILE_PLAIN
TOGGLE_ACTIVE=()
TOGGLE_INACTIVE=()
@@ -88,6 +93,17 @@ done
ACTIVE_STR="${TOGGLE_ACTIVE[*]:-none}"
INACTIVE_STR="${TOGGLE_INACTIVE[*]:-none}"
# Profile row: the project's local profile, the conversation's --settings
# one, or none (manifest defaults = full) with the /plugin-check pointer.
_pname="$(sed -n 's/^profile=//p' <<<"$PROFILE_PLAIN" | head -1)"
case "$(sed -n 's/^source=//p' <<<"$PROFILE_PLAIN" | head -1)" in
flag) PROFILE_ROW="profile: ${_pname} (conv)" ;;
local) PROFILE_ROW="profile: ${_pname} (local)" ;;
default) PROFILE_ROW="profile: none (full), try /plugin-check" ;;
*) PROFILE_ROW="profile: ? (profile.sh failed)" ;;
esac
unset _pname
# GSD v2 — standalone CLI (not a Claude Code plugin — shown separately)
if detect_gsd 2>/dev/null; then
GSD_STATUS="gsd v2 ✓"
@@ -289,7 +305,7 @@ if [ -n "$_remote_ver" ] && [ "$_remote_ver" != "$CONFIG_VERSION" ]; then
fi
unset _remote_ver REPO_DIR
echo "│ 💡 /plugin-check before starting a new project │"
printf "│ 🎛 %-46s│\n" "$PROFILE_ROW"
echo "│ 🩺 make doctor full diagnostic │"
echo "└───────────────────────────────────────────────────┘"
[ -n "$EFFORT_WARN" ] && printf '%s\n' "$EFFORT_WARN"
@@ -309,4 +325,4 @@ EOF
fi
unset _gx_root
echo ""
unset TOKEN_WARN
unset TOKEN_WARN PROFILE_PLAIN
+11 -12
View File
@@ -6,6 +6,8 @@ INPUT=$(cat)
MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "?"')
DIR=$(echo "$INPUT" | jq -r '.cwd // "?"')
PROJ=$(echo "$INPUT" \
| jq -r '.workspace.project_dir // .cwd // "."' 2>/dev/null)
FOLDER="${DIR##*/}"
PCT=$(echo "$INPUT" | jq -r \
'.context_window.used_percentage // 0' \
@@ -20,18 +22,15 @@ BRANCH_STR="${BRANCH:+ ($BRANCH)}"
REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# Default profile — same constant as lib/profile.sh's active_profile(),
# read without sourcing the lib (speed). Unreadable lib → literal fallback.
DEFAULT_PROFILE=$(sed -n 's/^DEFAULT_PROFILE="\([^"]*\)".*/\1/p' "$REPO/lib/profile.sh" 2>/dev/null)
[ -n "$DEFAULT_PROFILE" ] || DEFAULT_PROFILE=full
# Active profile (written by lib/profile.sh set|apply|reset to <repo>/.active-profile).
# Read directly — `profile.sh current` is 12s+ and unusable in a statusline.
# Cache absent/empty/legacy "none" (same rule as active_profile()) → default.
PROFILE=$(head -n1 "$REPO/.active-profile" 2>/dev/null | tr -d '[:space:]')
if [ -z "$PROFILE" ] || [ "$PROFILE" = "none" ]; then
PROFILE="$DEFAULT_PROFILE"
fi
# Profile of this project and conversation: `profile.sh current --plain`
# (two jq calls) on the session's project dir. `(conv)` = a --settings
# conversation. Any failure -> "?".
_plain="$(bash "$REPO/lib/profile.sh" -C "$PROJ" current --plain \
2>/dev/null)" || _plain=""
PROFILE="$(sed -n 's/^profile=//p' <<<"$_plain" | head -1)"
[ -n "$PROFILE" ] || PROFILE="?"
_src="$(sed -n 's/^source=//p' <<<"$_plain" | head -1)"
[ "$_src" = flag ] && PROFILE="$PROFILE (conv)"
# Effort level: the live value when the harness exports it (skill/agent
# `effort:` shifts included, BDR-107), else the persisted settings.json key
+49 -96
View File
@@ -341,35 +341,30 @@ if [ -d "$GSTACK_DIR" ]; then
# On a distro newer than gstack's pinned Playwright supports, bump Playwright
# BEFORE ./setup so its frozen-lockfile install picks up the new version and
# the browse binary is rebuilt against it (avoids the "does not support
# chromium" fail). Non-fatal if it can't — gstack is OFF by default.
# chromium" fail). Non-fatal if it can't — gstack packs follow the profile (full = on).
# See BLK-008 / LRN-040 / BDR-029; logic lives in lib/gstack-playwright.sh.
gstack_bump_playwright_if_unsupported "$GSTACK_DIR"
info "Running GStack setup..."
_gstack_setup_ok=0
if [ -x "$GSTACK_DIR/setup" ]; then
if (cd "$GSTACK_DIR" && ./setup); then
_gstack_setup_ok=1
if [ -d "$HOME/.claude/skills/gstack" ] && [ ! -L "$HOME/.claude/skills/gstack" ]; then
if (cd "$GSTACK_DIR" && ./setup); then
_gstack_setup_ok=1
else
warn "GStack ./setup failed — check output above"
fi
else
warn "GStack ./setup failed — check output above"
warn "gstack: ~/.claude/skills/gstack is not the helper tree yet — run 'make link' first, then 'make plugin' (setup would write skill dirs into skills/)"
fi
else
warn "GStack ./setup not found or not executable — skipping"
fi
# Default policy: gstack is installed but DISABLED — enable on demand
# via `bash lib/toggle-external.sh enable gstack`. Rationale: gstack
# ships ~40 skills that all load into context; keep them off until
# the user signals a project where they matter (browser QA, deploy).
if [ -x "$REPO/lib/toggle-external.sh" ] \
&& [ "$(bash "$REPO/lib/toggle-external.sh" status gstack 2>/dev/null)" = "enabled" ]; then
info "Disabling gstack by default (no context cost until enabled)..."
bash "$REPO/lib/toggle-external.sh" disable gstack >/dev/null
fi
# Success message gated on the real setup outcome — an unconditional ok
# after a `|| warn` reads as success even when setup failed (LRN-071 class).
if [ "$_gstack_setup_ok" -eq 1 ]; then
ok "GStack ready (disabled by default — enable: bash lib/toggle-external.sh enable gstack)"
ok "GStack ready (packs pack-gstack-dev / -browser / -design; profile.sh set <profile>)"
else
warn "GStack NOT ready — ./setup did not complete (see warnings above)"
fi
@@ -749,10 +744,10 @@ else
fi
fi
# Symlink handled by link.sh
if [ -L "$HOME/.claude/skills/emil-design-eng" ]; then
ok "emil-design-eng symlink OK"
if [ -L "$HOME/.claude/skills/pack-design/skills/emil-design-eng" ]; then
ok "emil-design-eng linked by pack-design"
else
info "Symlinking — will be created by link.sh"
info "pack-design link not present yet (git checkout)"
fi
echo ""
@@ -774,10 +769,10 @@ else
warn "frontend-design: anthropic-agent-skills plugin not cached — install via: claude plugin install example-skills@anthropic-agent-skills"
fi
fi
if [ -L "$HOME/.claude/skills/frontend-design" ]; then
ok "frontend-design symlink OK"
if [ -L "$HOME/.claude/skills/pack-design/skills/frontend-design" ]; then
ok "frontend-design linked by pack-design"
else
info "Symlinking — will be created by link.sh"
info "pack-design link not present yet (git checkout)"
fi
echo ""
@@ -790,10 +785,10 @@ if [ -f "$DMP_DIR/SKILL.md" ]; then
else
warn "design-motion-principles: not installed — clone from https://github.com/kylezantos/design-motion-principles"
fi
if [ -L "$HOME/.claude/skills/design-motion-principles" ]; then
ok "design-motion-principles symlink OK"
if [ -L "$HOME/.claude/skills/pack-design/skills/design-motion-principles" ]; then
ok "design-motion-principles linked by pack-design"
else
info "Symlinking — will be created by link.sh"
info "pack-design link not present yet (git checkout)"
fi
echo ""
@@ -801,11 +796,12 @@ echo ""
# 61 deterministic detector rules (`impeccable detect`, exit 0/2), the
# /impeccable skill (23 verbs) and 4 `impeccable-*` subagents.
#
# GLOBAL scope, no staging: the installer writes ~/.claude/skills/impeccable/
# (skill + its self-contained engine binary) and ~/.claude/agents/
# GLOBAL scope, no staging: the installer writes impeccable/ into skills/ through
# the ~/.claude/skills symlink (skill + its self-contained engine binary) and ~/.claude/agents/
# impeccable-*.md, and both of those are symlinks into this repo — so the
# global install IS the repo install. Machine-owned and gitignored on both
# sides. `--scope=project` was wrong twice over: it writes <cwd>/.claude/,
# sides. The skill is then moved to skills-external/impeccable (pack-design
# links it). `--scope=project` was wrong twice over: it writes <cwd>/.claude/,
# which serves only the directory it ran in, and the staged `mv` that
# followed it moved the skill alone, silently dropping the subagents.
#
@@ -816,8 +812,14 @@ echo ""
# @latest and says, loudly, that the lock needs bumping.
echo "── Step 8d: Impeccable — design detector, skill + agents ──"
echo ""
IMP_SKILL_DIR="$HOME/.claude/skills/impeccable"
IMP_PARKED="$REPO/skills-disabled/impeccable"
IMP_SKILL_DIR="$REPO/skills/impeccable"
IMP_HOME="$REPO/skills-external/impeccable"
# A real skills/impeccable (older install) is adopted, never removed.
if [ ! -e "$IMP_HOME" ] && [ -f "$IMP_SKILL_DIR/SKILL.md" ] \
&& [ ! -L "$IMP_SKILL_DIR" ]; then
mkdir -p "$REPO/skills-external"
(cd "$REPO" && mv skills/impeccable skills-external/impeccable)
fi
IMP_VER=$(pinned_version "impeccable")
NODE_MAJOR=$(node -v 2>/dev/null | sed 's/^v//' | cut -d. -f1)
@@ -856,17 +858,12 @@ if [ "$IMP_READY" != true ]; then
warn "impeccable: ~/.claude/skills and ~/.claude/agents are not this repo's symlinks yet"
warn " → run 'make link' first, then re-run 'make plugin'"
elif [ -z "${NODE_MAJOR:-}" ] || [ "$NODE_MAJOR" -lt 24 ]; then
if [ -f "$IMP_SKILL_DIR/SKILL.md" ] || [ -f "$IMP_PARKED/SKILL.md" ]; then
if [ -f "$IMP_HOME/SKILL.md" ]; then
ok "impeccable already present (update skipped — needs Node >= 24, found ${NODE_MAJOR:-none})"
else
warn "impeccable: needs Node >= 24 (found ${NODE_MAJOR:-none}) — skipped. Bump Node, then: make plugin"
fi
else
# A profile may hold impeccable parked in skills-disabled/. Install writes
# to the live slot, so remember the state and put the fresh copy back where
# it was — otherwise `make plugin` silently re-enables a disabled skill.
IMP_WAS_PARKED=false
[ -d "$IMP_PARKED" ] && IMP_WAS_PARKED=true
IMP_USED=""
if [ "$IMP_VER" != "latest" ]; then
info "Installing impeccable ${IMP_VER} (pinned in plugins.lock.json, global scope)..."
@@ -893,14 +890,13 @@ else
if [ "$IMP_AGENTS" -eq 0 ]; then
warn "no impeccable-* agent landed in agents/ — the skill's finish/document verbs dispatch to them"
fi
if [ "$IMP_WAS_PARKED" = true ]; then
rm -rf "${IMP_PARKED:?}"
mv "$IMP_SKILL_DIR" "$IMP_PARKED"
info "impeccable was parked by a profile — refreshed copy returned to skills-disabled/"
fi
# The CLI writes into skills/impeccable (through the ~/.claude/skills
# symlink); the copy lives in skills-external/, linked by pack-design.
[ ! -L "$IMP_SKILL_DIR" ] && cd "$REPO" && rm -rf skills-external/impeccable \
&& mv "$IMP_SKILL_DIR" skills-external/impeccable
info "Per-project step, in the agent chat of each frontend project: /impeccable init"
info " (writes PRODUCT.md — the design context every impeccable verb reads)"
elif [ -f "$IMP_SKILL_DIR/SKILL.md" ] || [ -f "$IMP_PARKED/SKILL.md" ]; then
elif [ -f "$IMP_HOME/SKILL.md" ]; then
ok "impeccable already present (install failed: ${IMP_FAIL:-no SKILL.md written} — existing copy kept)"
else
warn "impeccable install failed (${IMP_FAIL:-no SKILL.md written}) — run manually: npx impeccable skills install -y --providers=claude --scope=global --no-hooks"
@@ -997,11 +993,10 @@ echo ""
# credits. Its skills come from github.com/higgsfield-ai/skills, cloned by
# lib/higgsfield-skills.sh into skills-external/higgsfield-* (gitignored).
#
# Nothing is linked here. The pack is OFF by default and belongs to no
# profile: `lib/toggle-external.sh enable higgsfield` turns the media skills
# on, `enable higgsfield-websites` the landing-page aid. Keeping it out of
# link.sh and of every profile is what stops a re-run from re-enabling it
# (BDR-093).
# Nothing is linked here. pack-higgsfield is OFF by default and ON in `max`
# only; `bash lib/profile.sh enable higgsfield` turns it on elsewhere. Its
# 8 skills include `higgsfield-websites`. Keeping it out of link.sh is what
# stops a re-run from re-enabling it (BDR-093).
echo "── Step 8.6: Higgsfield CLI + skill pack ───────────────────"
echo ""
# shellcheck source=lib/higgsfield-skills.sh disable=SC1091
@@ -1054,7 +1049,7 @@ if higgsfield_cli_ok; then
else
info "Not signed in. Generation needs: higgsfield auth login"
fi
info "Pack is off by default — enable: bash lib/toggle-external.sh enable higgsfield"
info "Pack is off by default — enable: bash lib/profile.sh enable higgsfield, then /reload-plugins"
fi
echo ""
@@ -1071,13 +1066,8 @@ echo ""
# <HOME>/.claude/skills/<name>/ and REFUSES to follow a symlink anywhere on
# that path — and ~/.claude/skills IS a symlink to this repo's skills/. So
# install under a staged HOME, then move each skill into skills-external/
# (gitignored), where toggle-external.sh / profile.sh symlink it in.
# (gitignored); skills/pack-design and skills/pack-extras link it.
#
# The pack's state is governed by profiles, not by this step: Step 11
# applies the default profile (`full`), which links the five design skills
# in; the two publishing skills (21st-registry, 21st-design-sync) stay on
# demand — no profile lists them, so they are never auto-linked. A re-run
# must never re-park what the selected profile or the user already enabled.
echo "── Step 8.7: 21st.dev CLI + skill pack ─────────────────────"
echo ""
if command -v 21st &>/dev/null; then
@@ -1150,9 +1140,6 @@ if command -v 21st &>/dev/null; then
fi
fi
# The pack's state is governed by profiles (Step 11), not parked here: a
# re-run must never re-park what the selected profile or the user enabled.
# See the Step 11 banner for how the default profile applies.
echo ""
# ============================================================
@@ -1257,40 +1244,6 @@ else
fi
echo ""
# ============================================================
# STEP 11 — DEFAULT PROFILE
# ============================================================
# The profile decides which skills / externals / plugins are on. No
# selection yet (.active-profile absent, empty or legacy "none" — same
# rule as lib/profile.sh active_profile()) → apply the default via
# `profile.sh reset`. An existing selection is re-applied (`set`). Plugin legs
# are install-immutable (the EXIT guard restores settings.json, BDR-028;
# the committed enabledPlugins already match the default profile), so
# only the skill / external legs matter here.
echo "── Step 11: Default profile ────────────────────────────────"
echo ""
if [ -f "$REPO/lib/profile.sh" ]; then
SEL="$(head -n1 "$REPO/.active-profile" 2>/dev/null | tr -d '[:space:]' || true)"
case "$SEL" in
""|none)
info "No profile selected — applying the default profile (bash lib/profile.sh reset)..."
bash "$REPO/lib/profile.sh" reset \
|| warn "default profile not applied — run: bash lib/profile.sh reset"
;;
*)
# Steps 2 (gstack parked) and 10 (link.sh re-links the design
# externals) rewrite skill state on every run: re-apply the
# selection so its state comes back, label unchanged.
info "Profile kept: $SEL — re-applying it (bash lib/profile.sh set $SEL)..."
bash "$REPO/lib/profile.sh" set "$SEL" \
|| warn "profile $SEL not re-applied — run: bash lib/profile.sh set $SEL"
;;
esac
else
warn "lib/profile.sh not found — skipping the default profile"
fi
echo ""
# ============================================================
# SUMMARY
# ============================================================
@@ -1305,7 +1258,7 @@ echo " ✅ rtk — token compression hook (0 tokens)"
echo " ✅ superpowers skills — 7 vendored (brainstorming, writing-plans, subagent-driven-development, test-driven-development, requesting-code-review, using-git-worktrees, writing-skills), pinned v6.4.1, curl → symlink, no plugin, no session injection"
echo ""
echo " TOGGLE (plugin state = settings.json enabledPlugins; skills/CLIs = profiles):"
echo " 🔄 gstack — disabled by default (toggle: lib/toggle-external.sh enable gstack)"
echo " 🔄 gstack — packs pack-gstack-dev / -browser / -design (bash lib/profile.sh set <profile> | enable <pack>, then /reload-plugins)"
echo " 🔄 gsd v2 — standalone CLI 'gsd' (gsd-pi, not a Claude Code plugin)"
echo " 🔄 pr-review-toolkit — /review-pr + 6 PR agents (~2.2k tokens when enabled) [claude-code-plugins]"
echo " 🔄 ui-ux-pro-max — user scope (~780 tokens when enabled)"
@@ -1318,14 +1271,14 @@ echo " 🔄 design-motion-principles — motion/animation design, 3-designer
echo " 🔄 agent-skills trio — observability-and-instrumentation, deprecation-and-migration, ci-cd-and-automation (curl → symlink, pinned commit)"
echo " 🔄 mengto scroll skills — scroll-world-storytelling, build-threejs-scroll-worlds, scroll-scrubbed-visual-sequence, scroll-scrubbed-word-reveal, scroll-progress-timeline (curl → symlink, pinned commit)"
echo " 🔄 darwin-skill — autonomous skill optimizer (npx skills, ~/.agents/skills/)"
echo " 🔄 21st skill pack — 21st.dev CLI skills; design ones follow the profile (full by default), publishing ones on demand (toggle: lib/toggle-external.sh enable 21st)"
echo " 🔄 higgsfield pack — Higgsfield CLI media skills (image, video, audio, brand), OFF by default (toggle: lib/toggle-external.sh enable higgsfield; landing-page aid: enable higgsfield-websites)"
echo " 🔄 21st skill pack — 21st.dev CLI skills; linked by skills/pack-design and skills/pack-extras (bash lib/profile.sh set <profile> | enable <pack>, then /reload-plugins)"
echo " 🔄 higgsfield pack — Higgsfield CLI media skills (image, video, audio, brand), OFF by default (bash lib/profile.sh enable higgsfield, then /reload-plugins; landing-page aid: \`higgsfield-websites\` ships in pack-higgsfield)"
echo ""
echo " All plugins installed at: user scope (~/.claude/plugins/)"
echo " GStack skills symlinked individually into ~/.claude/skills/ (→ submodule)"
echo " Emil Design Eng at: ~/.claude/skills/emil-design-eng/ (symlink → skills-external)"
echo " Frontend Design at: ~/.claude/skills/frontend-design/ (symlink → skills-external)"
echo " Design Motion Principles at: ~/.claude/skills/design-motion-principles/ (symlink → skills-external)"
echo " GStack skills live in packs skills/pack-gstack-*/ (symlinks into the submodule)"
echo " Emil Design Eng at: ~/.claude/skills/pack-design/skills/emil-design-eng/ (symlink → skills-external)"
echo " Frontend Design at: ~/.claude/skills/pack-design/skills/frontend-design/ (symlink → skills-external)"
echo " Design Motion Principles at: skills/pack-design/skills/design-motion-principles/ (symlink → skills-external)"
echo " Agent Skills trio at: ~/.claude/skills/{observability-and-instrumentation,deprecation-and-migration,ci-cd-and-automation}/ (symlink → skills-external)"
echo " Mengto scroll skills at: ~/.claude/skills/{scroll-world-storytelling,build-threejs-scroll-worlds,scroll-scrubbed-visual-sequence,scroll-scrubbed-word-reveal,scroll-progress-timeline}/ (symlink → skills-external)"
echo " Superpowers skills at: ~/.claude/skills/{brainstorming,writing-plans,subagent-driven-development,test-driven-development,requesting-code-review,using-git-worktrees,writing-skills}/ (symlink → skills-external)"
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# ============================================================
# lib/cc.sh — `cc <name> [profile]`: a named dtach session running claude,
# optionally under a per-conversation profile.
#
# Sourced from ~/.bashrc (user step, MIGRATION.md), guarded so a checkout
# without the file does not break the shell:
# [ -f "$HOME/.claude/lib/cc.sh" ] && . "$HOME/.claude/lib/cc.sh"
# The old `dtach_claude()` and `alias cc='dtach_claude'` must go (an alias
# wins over this function and drops the profile argument; doctor warns).
#
# With a profile, claude starts with `--settings lib/profiles/<profile>.json`
# and the session exports CLAUDE_PROFILE + CLAUDE_PROFILE_SETTINGS, which
# `profile.sh current` reads (source=flag). That conversation is frozen:
# `/reload-plugins` re-reads neither the flag file nor a local value the
# flag overrides; to change packs, start another `cc <name> <profile>`.
# Without a profile: manifest defaults + local settings, as before.
# TMPDIR goes to ~/.cache/claude-tmp either way (BLK-021).
# ============================================================
_cc_name_ok() { [[ "$1" =~ ^[a-z0-9][a-z0-9-]*$ ]]; }
cc() {
local name="${1:-claude-$(date +%H%M%S)}" profile="${2:-}"
local lib="$HOME/.claude/lib" settings=""
_cc_name_ok "$name" \
|| { echo "cc: invalid name '$name' (a-z 0-9 -)" >&2; return 2; }
if [ -n "$profile" ]; then
_cc_name_ok "$profile" \
|| { echo "cc: invalid profile '$profile' (a-z 0-9 -)" >&2; return 2; }
settings="$lib/profiles/$profile.json"
if [ ! -f "$settings" ]; then
echo "cc: unknown profile '$profile'. Known:" >&2
bash "$lib/profile.sh" list >&2
return 2
fi
fi
mkdir -p "$HOME/.cache/claude-tmp" "$HOME/.dtach"
# The inner shell expands $HOME; '^\' is dtach's detach key.
# shellcheck disable=SC2016,SC1003
CLAUDE_PROFILE="$profile" CLAUDE_PROFILE_SETTINGS="$settings" \
TMPDIR="$HOME/.cache/claude-tmp" \
systemd-run --user --quiet --collect --scope --slice=dev.slice \
--unit="cc-${name}" \
dtach -c "$HOME/.dtach/${name}" -e '^\' \
bash -c 'set -a; [ -f "$HOME/.claude/.env" ] && . "$HOME/.claude/.env"
set +a
if [ -n "$CLAUDE_PROFILE_SETTINGS" ]; then
exec claude --settings "$CLAUDE_PROFILE_SETTINGS"
fi
exec claude'
}
+54 -62
View File
@@ -25,9 +25,10 @@ Check BOTH the task description AND the filesystem:
## DECISION
Source of truth for activation is the **profile system** — never an atomic
per-tool toggle. The gate's whole job: confirm the design toolchain is active,
and if not, point at ONE command — `/profile design`.
Source of truth is `profile.sh current --plain` (packs and managed plugins of
THIS project and conversation) — never an atomic per-tool toggle. The gate's
whole job: confirm the design toolchain is active, and if not, print ONE
remedy line (see §3).
### 1. Tier — does the gate even apply?
@@ -37,52 +38,48 @@ and if not, point at ONE command — `/profile design`.
- In doubt (trivial tweak vs real UI change) → do NOT silently skip: ask the
user, or default to the Build tier.
Tier does NOT change WHAT gets checked. Every non-trivial design tier draws from
the one `design` profile — so the gate checks that profile's **design-core
tools** (the `# GATE-BLOCK:` allowlist in `design.profile`: impeccable,
ui-ux-pro-max, emil-design-eng, design-motion-principles, design-html,
design-review, design-consultation, the `21st` CLI and `21st-ui-build` — the
canary for the whole 21st skill pack). The profile also bundles
browser/plan/shotgun tooling and graphify for convenience; those never trip the
gate. Motion (`design-motion-principles`) and static-HTML (`design-html`) are
already in the core set — checked regardless; the Design work section
(`rules/web-building.md`) names them as the motion and static tools, not a
separate activation step.
Tier does NOT change WHAT gets checked. Every non-trivial design tier needs
the same required set, declared as `NEEDED=` in `lib/design-tool-gate.sh`:
packs `design` and `gstack-design`, the `ui-ux-pro-max` plugin, and the `21st`
CLI signed in. Other packs and browser/plan tooling never trip the gate.
Motion and static-HTML skills ride inside those packs; the Design work section
(`rules/web-building.md`) names them, not a separate activation step.
`site-motion` (personal skill, site-level scroll/page choreography) rides the
same Build chain but isn't on the GATE-BLOCK list: it ships with the repo,
nothing to install or verify.
same Build chain but isn't required: it ships with the repo, nothing to
install or verify.
### 2. State — run the deterministic check
bash "$HOME/.claude/lib/design-tool-gate.sh"
It reads the design-core tools (`# GATE-BLOCK:` in `design.profile`) plus their
types (`profile.sh show design --plain`) and checks each on its own channel —
skill symlink, `claude plugin list`, `claude mcp list`, `command -v`. It never
reads `disabledMcpServers` (unreliable for bi-modal servers like context7).
The core set lives in `design.profile`, not in the script or here — single source.
It runs `profile.sh current --plain` and checks the `NEEDED=` entries of the
script (the single source of the required set), then `command -v 21st` and
`21st whoami`. It makes no `claude` call.
Exit codes: `0` = ready · `11` = ready-but-unverified (proceed, but surface it) · `10` = incomplete (gate trips) · `12` = sign-in required (21st installed, signed out) · `2` = error.
### 3. Branch on the result
- **0 / `READY`** → proceed silently. Toolchain is active.
- **10 / `INCOMPLETE`** → STOP. The script reports up to three groups; relay
them and the remedy to the user:
- **10 / `INCOMPLETE`** → STOP. The script names what is off and prints the
remedy; relay both to the user:
🎨 DESIGN DETECTED — the design toolchain isn't fully active.
activate with /profile design: <skills / ui-ux-pro-max>
required + manual step: <e.g. 21st — needs the CLI>
→ run /profile design to activate it, then continue.
design toolchain: INCOMPLETE
off: pack-design plugin:ui-ux-pro-max@ui-ux-pro-max-skill
→ run: bash ~/.claude/lib/profile.sh set web
or: bash ~/.claude/lib/profile.sh enable design
or: bash ~/.claude/lib/profile.sh enable ui-ux-pro-max@ui-ux-pro-max-skill
then /reload-plugins
- **activate with /profile design** → skills + the plugin; `/profile design`
turns them on directly.
- **required + manual step** → required tools the profile can't flip silently.
**the `21st` CLI lands here: it TRIPS the gate** (it's required for Build),
it is NOT a silent "optional". `/profile design` symlinks the 21st skills,
but the CLI they shell out to is a global npm install: tell the user to run
`npm i -g @21st-dev/cli` then `21st login` (no API key, no MCP).
- Do NOT hand-activate individual tools. The profile is the unit of activation.
- **source=local or default** → `profile.sh set web`, or one `profile.sh
enable <pack | plugin id>` per entry listed as off, then `/reload-plugins`.
- **source=flag** (the conversation runs under `claude --settings`, frozen)
→ relaunch it with a design profile: `cc <name> web`.
- **the `21st` CLI TRIPS the gate** when absent (required for Build), it is
NOT a silent "optional". It is a global npm install the profile cannot
do: tell the user to run `npm i -g @21st-dev/cli` then `21st login`
(no API key, no MCP).
- Do NOT hand-activate individual tools. Packs are the unit of activation.
- **12 / `SIGN-IN REQUIRED`** → STOP. The 21st CLI is installed but `21st
whoami` reports signed out. Relay the script's block, then ask the user to
run `! 21st login` (the `!` prefix runs it in this session, browser flow,
@@ -100,22 +97,20 @@ Exit codes: `0` = ready · `11` = ready-but-unverified (proceed, but surface it)
and needs the human. `TWENTYFIRST_TOKEN` is a shell-profile setting
followed by a session restart, never an in-session `export` (tool calls
don't share a shell, and a secret doesn't belong in the transcript).
- **11 / `READY BUT UNVERIFIED`** → `claude` was unreachable, so the design
plugin (ui-ux-pro-max) could NOT be checked. Do NOT report a plain "ready":
proceed only after telling the user that N tool(s) went unverified and having
them confirm with `claude plugin list`. Fail-visible, not fail-silent. A
`21st (whoami: rc=… …)` entry in this block means the CLI itself could not
answer (a runtime/PATH problem, e.g. node under nvm) — the remedy is the
diagnostic the script prints, never a sign-in prompt; relay its own line.
- **11 / `READY BUT UNVERIFIED`** → `21st whoami` could not answer (a
runtime/PATH problem, e.g. node under nvm). Do NOT report a plain "ready":
proceed only after telling the user, relaying the diagnostic the script
prints (`whoami: rc=… …`). Never a sign-in prompt. Fail-visible, not
fail-silent.
### 4. Animation library — suggest-only (fires only on a real motion signal)
Orthogonal to the toolchain check above: §2-3 are about Claude's design TOOLS;
this is about the PROJECT's runtime dep. Evaluate it only once the toolchain is
resolved and you're actually proceeding with the build (READY, after the user
ran `/profile design`, or after the sign-in re-run returns READY). Never on
the INCOMPLETE stop path — that path has one action only (`/profile
design`); don't stack an optional note on it.
applied the remedy, or after the sign-in re-run returns READY). Never on
the INCOMPLETE stop path — that path has one action only (the remedy
line); don't stack an optional note on it.
**Fires only when ALL THREE hold** — drop any one → no suggestion, stay silent:
@@ -160,7 +155,7 @@ count:
10 libs incl gsap / react-spring / lottie) kills it the instant any anim lib
lands, so only "eligible + pure-CSS + actively declined" ever sees it twice.
- **Two "motion"s (agent-facing).** The lib `motion` (npm dep, this step) ≠ the
skill `design-motion-principles` (`# GATE-BLOCK:` core set, §2-3). The
skill `design-motion-principles` (inside the design packs, §2-3). The
toolchain check handles the skill; this step handles the lib. Don't conflate
them when talking to the user.
@@ -173,7 +168,7 @@ context, which is worse than not running it — and nothing else in the process
says so, because init has to happen in the agent chat, not in an installer.
**Fires when** the project has no `PRODUCT.md` at its root, else stay
silent. impeccable itself is on the `# GATE-BLOCK:` list, so §3 has already
silent. impeccable ships in the required design packs, so §3 has already
guaranteed it is installed by the time this runs.
Evaluate it on the same path as §4: after the toolchain resolves, never on the
@@ -192,25 +187,22 @@ INCOMPLETE stop path. One line, non-blocking:
### Other toolchains
The script defaults to the `design` profile. A task needing another profile's
toolchain passes it: `design-tool-gate.sh <profile>`. Scope comes from that
profile's `# GATE-BLOCK:` line (absent → every skill/plugin/mcp entry). The
remedy is always `/profile <that>` — a profile, never a lone tool.
The script takes no argument: it checks the one design set (`NEEDED=`). A
task needing another toolchain adds its own gate; the remedy stays a pack
or profile, never a lone tool.
## IMPORTANT
- Remedy is ALWAYS a profile (`/profile design`), never an atomic tool toggle —
the profile system is the single source of truth for what's active.
- the `21st` CLI is REQUIRED (it trips the gate) and `/profile design` cannot
- Remedy is ALWAYS the printed line (`profile.sh set web` / `enable <pack>`
+ `/reload-plugins`, or `cc <name> web` under a flag), never an atomic
tool toggle; `current --plain` is the single source of what's active.
- the `21st` CLI is REQUIRED (it trips the gate) and no profile can
install it — the gate names the two commands; surface them to the user.
Signed out → exit 12: ask `! 21st login`, wait, re-run; explicit opt-out
only, never a silent skip.
- The design-core set (what trips the gate) is declared in `design.profile` on
the `# GATE-BLOCK:` line(s) — edit there to add/remove a blocking design tool,
not in the script.
- The state check shells out to `claude` (plugin/mcp list): a few seconds.
Trivial / non-design tasks skip it entirely (no signal, or trivial tier).
- `design-tool-gate.sh`'s per-type state checks MIRROR
`profile.sh:skill_status()` — change one, sync the other, except the 21st
auth state: gate-only, no skill_status counterpart.
- The required set (what trips the gate) is `NEEDED=` in
`design-tool-gate.sh` — edit there to add/remove a blocking pack or plugin.
- The gate makes no `claude` call; it runs `profile.sh current --plain` and
`21st whoami`. Trivial / non-design tasks skip it entirely.
- The 21st sign-in state is gate-only: `profile.sh` has no counterpart.
- Do NOT run this gate on pure backend/API/CLI tasks (no signals = no gate).
+95 -227
View File
@@ -1,95 +1,37 @@
#!/usr/bin/env bash
# ============================================================
# lib/design-tool-gate.sh — Deterministic design-toolchain state check.
# lib/design-tool-gate.sh — deterministic design-toolchain state check.
#
# Answers ONE question for the design gate (design-gate.md §DECISION):
# "Is the design toolchain active enough to proceed?"
# Answers one question for lib/design-gate.md § DECISION: "is the design
# toolchain active enough to proceed?" Source of truth = `profile.sh
# current --plain` (packs + managed plugins of THIS project and
# conversation). Required: pack-design, pack-gstack-design and the
# ui-ux-pro-max plugin, plus the `21st` CLI signed in (gate-only state:
# in / out / unknown, from `21st whoami`).
#
# Source of truth = the profile system. The gate never activates a single
# tool atomically; it checks whether a profile's DESIGN-CORE tools (default
# profile: `design`) are active and, if not, points at `/profile <name>`.
#
# Two inputs from the profile, both claude-free:
# - structure: profile.sh show <profile> --plain -> "<type>\t<name>"
# - gate scope: the "# GATE-BLOCK:" line(s) in <profile>.profile — the
# allowlist of tools the gate trips on. A comment, so
# read_profile strips it and --plain never shows it. Absent
# -> fall back to every skill/plugin/mcp entry (coarse).
#
# State (active or not) is checked per channel, by type. These per-type
# checks MIRROR profile.sh:skill_status() — change one, sync the other,
# except the 21st auth state: gate-only, no skill_status counterpart.
#
# type channel class
# gstack|external|personal skill symlink in skills/ blocking
# plugin `claude plugin list` -> enabled blocking
# mcp | cli `claude mcp list` / command -v required-manual
#
# Class:
# blocking required + `/profile design` activates it directly.
# required-manual required but the profile can't flip it silently (API
# key / external install) — the gate STILL trips, names
# it, and the remedy is `/profile design` + a manual step.
# This is where the `21st` CLI lands: required, never
# silent (npm i -g @21st-dev/cli, then 21st login).
# 21st's sign-in state is three-valued: in (active),
# out (exit 12, ask to sign in), unknown (exit 11).
# Both classes trip the gate. Tools NOT on the GATE-BLOCK allowlist are
# ignored entirely (browser/plan/shotgun tooling, graphify).
#
# disabledMcpServers is NEVER read — unreliable for bi-modal servers
# (context7 can appear there yet be active via another channel).
#
# Exit: 0 = ready · 11 = ready-but-unverified (proceed, say so) ·
# 10 = incomplete (trips) · 12 = sign-in required (21st) · 2 = error.
# Usage: design-tool-gate.sh [profile] (default profile: design)
# Exit: 0 ready · 10 incomplete (a pack or plugin off, or no 21st CLI) ·
# 11 ready-but-unverified (21st could not answer) · 12 sign-in
# required · 2 error (profile.sh failed or gave no pack lines).
# Remedy on 10: source=flag → relaunch `cc <name> web` (a --settings
# conversation is frozen); else `profile.sh set web`, or `enable <pack>` /
# `enable <plugin id>` per missing entry, then /reload-plugins. The CLI is
# a global npm install either way.
# READY also needs the packs to resolve: every skills/pack-<n>/skills/*
# entry of pack-design and pack-gstack-design must have a SKILL.md.
# Usage: design-tool-gate.sh (no argument; env DESIGN_GATE_PROFILE_SH,
# DESIGN_GATE_SKILLS_DIR)
# ============================================================
set -euo pipefail
REPO="${DESIGN_GATE_REPO_OVERRIDE:-$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PROFILE_SH="${DESIGN_GATE_PROFILE_SH:-$REPO/lib/profile.sh}"
CLAUDE_BIN="${CLAUDE_BIN:-claude}"
PROFILES_DIR="$REPO/lib/profiles"
SKILLS_DIR="$REPO/skills"
PROFILE="${1:-design}"
PROFILE_FILE="$PROFILES_DIR/$PROFILE.profile"
SKILLS_DIR="${DESIGN_GATE_SKILLS_DIR:-$REPO/skills}"
NEEDED=(pack-design pack-gstack-design
"plugin:ui-ux-pro-max@ui-ux-pro-max-skill")
[ -x "$PROFILE_SH" ] || { echo "design-gate: profile.sh not executable at $PROFILE_SH" >&2; exit 2; }
[ -f "$PROFILE_FILE" ] || { echo "design-gate: profile '$PROFILE' not found" >&2; exit 2; }
# Ensure the claude CLI + its node runtime are reachable even when a skill/hook
# shells this script out with a sanitized PATH. The interactive alias
# claude->dtach_claude never reaches a non-interactive subshell; the real binary
# AND its node bin dir are what matter (claude's shebang needs node, same dir).
# If `command -v claude` already resolves, do nothing; else probe known install
# dirs and prepend. nvm keeps old node versions after an upgrade, so pick the
# newest that actually ships claude (sort -V), not the first glob match.
ensure_claude_on_path() {
command -v "$CLAUDE_BIN" >/dev/null 2>&1 && return
local cand
for cand in \
"$HOME/.claude/local/claude" \
"$HOME/.local/bin/claude" \
/opt/homebrew/bin/claude \
/usr/local/bin/claude; do
[ -x "$cand" ] && { PATH="$(dirname "$cand"):$PATH"; return; }
done
local m newest matches=()
for m in "$HOME"/.nvm/versions/node/*/bin/claude; do
[ -x "$m" ] && matches+=("$m")
done
if [ "${#matches[@]}" -gt 0 ]; then
newest="$(printf '%s\n' "${matches[@]}" | sort -V | tail -1)"
PATH="$(dirname "$newest"):$PATH"
fi
}
ensure_claude_on_path
# Same sanitized-PATH problem for `21st` (an npm global bin), with a twist:
# the repair above only fires when claude ITSELF is unresolvable, and claude
# often lives in ~/.local/bin while the npm global bin dir is missing from a
# hook's PATH. Probe for the binary directly and prepend the dir that has it,
# otherwise a perfectly installed CLI reads as "missing" and trips the gate.
# ---- 21st CLI on PATH + sign-in state ---------------------------------------
# A hook's PATH often lacks the npm global bin dir: find `21st` there and
# prepend its dir, or an installed CLI reads as missing and trips the gate.
ensure_21st_on_path() {
command -v 21st >/dev/null 2>&1 && return
local cand
@@ -142,154 +84,80 @@ twentyfirst_auth_state() {
echo "unknown:whoami: rc=$rc ${line:0:60}"
}
# Gate scope: the "# GATE-BLOCK:" allowlist (one or more lines, concatenated).
# Empty => fall back to "every gate-relevant entry is in scope" (coarse).
core_set="$(grep '^# GATE-BLOCK:' "$PROFILE_FILE" 2>/dev/null \
| sed 's/^# GATE-BLOCK:[[:space:]]*//' | tr '\n' ' ' || true)"
# Membership in the allowlist. Empty allowlist = everything in scope.
in_scope() {
[ -z "$core_set" ] && return 0
case " $core_set " in *" $1 "*) return 0 ;; *) return 1 ;; esac
}
# State of one tool, by type. Mirrors profile.sh:skill_status() — keep in
# sync, except the 21st auth state (gate-only, no skill_status counterpart).
# Echoes: active | inactive | unknown (can't verify, claude absent) |
# signedout | unknown:<diagnostic> (last two: 21st CLI only)
tool_active() {
local name="$1" type="$2"
case "$type" in
gstack|external|personal)
if [ -e "$SKILLS_DIR/$name" ]; then echo active; else echo inactive; fi
;;
plugin)
if ! command -v "$CLAUDE_BIN" >/dev/null 2>&1; then echo unknown; return; fi
# capture first, then match: an early-exit awk/grep -q in a pipe
# SIGPIPEs the producer (rc 141 under pipefail on macOS)
local plist
plist="$("$CLAUDE_BIN" plugin list 2>/dev/null)" || true
if grep -q "✔ enabled" < <(awk -v p="^[[:space:]]*❯ ${name}@" \
'$0 ~ p {f=1; next} f && /Status:/ {print; exit}' <<<"$plist")
then echo active; else echo inactive; fi
;;
mcp)
if ! command -v "$CLAUDE_BIN" >/dev/null 2>&1; then echo unknown; return; fi
if grep -q "^${name}" \
<<<"$("$CLAUDE_BIN" mcp list 2>/dev/null)"; then
echo active
else
echo inactive
fi
;;
cli)
command -v "$name" >/dev/null 2>&1 || { echo inactive; return; }
[ "$name" = "21st" ] || { echo active; return; }
local auth
auth="$(twentyfirst_auth_state)"
case "$auth" in
in) echo active ;;
out) echo signedout ;;
unknown:*) echo "$auth" ;;
esac
;;
*) echo inactive ;;
esac
}
# Structure via the parse contract (claude-free). Fail loud on a bad profile —
# an empty read must NOT silently report "ready".
plain="$("$PROFILE_SH" show "$PROFILE" --plain 2>/dev/null)" \
|| { echo "design-gate: 'profile.sh show $PROFILE --plain' failed" >&2; exit 2; }
[ -n "$plain" ] || { echo "design-gate: profile '$PROFILE' is empty or unreadable" >&2; exit 2; }
blocking=() # inactive, /profile design activates it (skill/plugin)
manual=() # inactive, required but needs a manual step (mcp key / cli install)
unverified=() # can't check (claude CLI absent)
signedout=() # 21st CLI installed, not signed in
unverified_cli=() # 21st CLI: whoami answered something unexpected
while IFS=$'\t' read -r type name; do
[ -n "$type" ] || continue
in_scope "$name" || continue # ignore non-core tooling (browser, plan-*, graphify)
state="$(tool_active "$name" "$type")"
case "$state" in
active) ;;
signedout) signedout+=("$name") ;;
unknown) unverified+=("$name") ;;
unknown:*) unverified_cli+=("$name (${state#unknown:})") ;;
*)
case "$type" in
gstack|external|personal|plugin) blocking+=("$name") ;;
*) manual+=("$name") ;;
esac
;;
esac
done <<< "$plain"
# print_unverified — the "also unverified" lines shared by the 10, 11 and 12
# blocks: a claude-unreachable tool keeps its existing remedy; a 21st CLI
# that answered whoami with something unexpected gets its own — the two are
# never merged, so no block blames 21st for a claude problem or vice versa.
print_unverified() {
if [ "${#unverified[@]}" -gt 0 ]; then
echo " also unverified (claude CLI unreachable): ${unverified[*]}"
fi
local entry name diag
# bash 3.2 (macOS /bin/bash) errors on an empty array under set -u
for entry in ${unverified_cli[@]+"${unverified_cli[@]}"}; do
name="${entry%% (*}"
diag="${entry#*\(}"; diag="${diag%\)}"
echo " $name could not answer: $diag —" \
"a CLI runtime/PATH problem (node under nvm?)," \
"not a sign-in problem; fix it, then re-run"
# ---- packs and plugin from profile.sh ---------------------------------------
plain="$(bash "$PROFILE_SH" -C "$PWD" current --plain 2>/dev/null)" \
|| { echo "design-gate: profile.sh current --plain failed" >&2; exit 2; }
grep -q '^pack-design=' <<<"$plain" || {
echo "design-gate: profile.sh current --plain gave no pack-design line" >&2
exit 2; }
plain_get() { sed -n "s/^$1=//p" <<<"$plain" | head -1; }
missing=()
for k in "${NEEDED[@]}"; do
[ "$(plain_get "$k")" = on ] || missing+=("$k")
done
source="$(plain_get source)"; profile="$(plain_get profile)"
dangling=()
for n in design gstack-design; do
for e in "$SKILLS_DIR/pack-$n/skills/"*; do
[ -e "$e" ] || [ -L "$e" ] || continue
[ -e "$e/SKILL.md" ] || dangling+=("pack-$n:${e##*/}")
done
done
# ---- 21st: CLI present, then signed in ---------------------------------------
cli_hint=""; auth=in
if ! command -v 21st >/dev/null 2>&1; then
cli_hint=" 21st needs the CLI: npm i -g @21st-dev/cli then 21st login"
else
auth="$(twentyfirst_auth_state)"
fi
# ---- remedy lines: set web, one enable per missing pack ---------------------
print_remedy() {
local k
if [ "$source" = flag ]; then
echo " → relaunch this conversation with a design profile:" \
" cc <name> web"
return
fi
echo " → run: bash ~/.claude/lib/profile.sh set web"
for k in "${missing[@]}"; do
case "$k" in
pack-*)
echo " or: bash ~/.claude/lib/profile.sh enable ${k#pack-}" ;;
*)
echo " or: bash ~/.claude/lib/profile.sh enable ${k#plugin:}" ;;
esac
done
echo " then /reload-plugins"
}
# Verdict — four outcomes, checked in order:
# blocking/manual non-empty -> INCOMPLETE (exit 10): the gate trips.
# else signedout non-empty -> SIGN-IN REQUIRED (exit 12): ask the user to
# run `21st login`, end the turn, wait, re-run — never a silent skip.
# else unverified/unverified_cli non-empty -> READY BUT UNVERIFIED (exit
# 11): fail-VISIBLE. claude unreachable and/or 21st couldn't answer
# whoami — never pass either as a silent READY.
# nothing pending -> READY (exit 0).
if [ "${#blocking[@]}" -gt 0 ] || [ "${#manual[@]}" -gt 0 ]; then
# ---- verdict -----------------------------------------------------------------
if [ "${#missing[@]}" -gt 0 ] || [ "${#dangling[@]}" -gt 0 ] \
|| [ -n "$cli_hint" ]; then
echo "design toolchain: INCOMPLETE"
if [ "${#blocking[@]}" -gt 0 ]; then
echo " activate with /profile $PROFILE: ${blocking[*]}"
fi
if [ "${#manual[@]}" -gt 0 ]; then
echo " required + manual step (external install / sign-in): ${manual[*]}"
case " ${manual[*]} " in
*" 21st "*) echo " 21st needs the CLI: npm i -g @21st-dev/cli then 21st login" ;;
esac
fi
print_unverified
echo " → run: /profile $PROFILE"
[ "${#missing[@]}" -gt 0 ] && echo " off: ${missing[*]}"
for e in ${dangling[@]+"${dangling[@]}"}; do
echo " not installed: $e (run make plugin)"
done
[ -n "$cli_hint" ] && echo "$cli_hint"
[ "${#missing[@]}" -gt 0 ] && print_remedy
exit 10
fi
if [ "${#signedout[@]}" -gt 0 ]; then
echo "design toolchain: SIGN-IN REQUIRED — 21st CLI installed, not signed in"
echo " ask the user to run in this session:" \
" ! 21st login" \
" (browser flow, saves a local token)"
echo " then re-run this gate before any 21st step — never skip 21st silently"
print_unverified
exit 12
fi
if [ "${#unverified[@]}" -gt 0 ] || [ "${#unverified_cli[@]}" -gt 0 ]; then
echo "design toolchain: READY BUT UNVERIFIED —" \
"$(( ${#unverified[@]} + ${#unverified_cli[@]} )) tool(s) not checked"
print_unverified
if [ "${#unverified[@]}" -gt 0 ]; then
echo " the gate could NOT confirm the design plugin (ui-ux-pro-max) is"
echo " active. Proceed only after checking manually:"
echo " claude plugin list"
fi
exit 11
fi
echo "design toolchain: READY — profile '$PROFILE' design tools active"
case "$auth" in
out)
echo "design toolchain: SIGN-IN REQUIRED —" \
"21st CLI installed, not signed in"
echo " ask the user to run in this session: ! 21st login (browser flow)"
echo " then re-run this gate before any 21st step —" \
"never skip 21st silently"
exit 12 ;;
unknown:*)
echo "design toolchain: READY BUT UNVERIFIED — 21st could not answer:" \
"${auth#unknown:}"
echo " a CLI runtime/PATH problem (node under nvm?), not a sign-in problem"
exit 11 ;;
esac
echo "design toolchain: READY —" \
"packs design + gstack-design + ui-ux-pro-max on ($profile)"
exit 0
+6 -4
View File
@@ -26,10 +26,12 @@ detect_superpowers() {
# --- Toggle plugins ---
detect_gstack() {
# gstack is exposed via per-skill symlinks (browse, canary, qa, …);
# the legacy top-level symlink was removed to avoid duplicate entries.
# Detect by checking any of its individual skills.
[ -L "$HOME/.claude/skills/browse" ] || [ -L "$HOME/.claude/skills/qa" ]
# gstack = the three packs; "on" = pack-gstack-dev on for this project and
# conversation. PROFILE_PLAIN (session-start) avoids a second profile.sh run.
local plain="${PROFILE_PLAIN:-}"
[ -n "$plain" ] || plain="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" \
current --plain 2>/dev/null)" || return 1
grep -q '^pack-gstack-dev=on' <<<"$plain"
}
detect_gsd() {
+1
View File
@@ -47,6 +47,7 @@ module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
paths = glob.glob(skills_dir + "/*/SKILL.md")
paths += glob.glob(skills_dir + "/pack-*/skills/*/SKILL.md")
chars = sum(len(module.extract_description(p) or "") for p in paths)
print(len(paths), chars)
PY
+23 -81
View File
@@ -4,12 +4,11 @@
# skills (curl-pinned externals in plugins.lock.json + link.sh's
# EXTERNAL_SKILLS array). doctor.sh's "GStack submodule" section only
# covers the gstack submodule — this covers the OTHER external skill
# packs (emil-design-eng, the agent-skills trio, the five Mengto scroll
# skills, the seven superpowers skills, and any name link.sh links with
# no lock entry at all, e.g. frontend-design, design-motion-principles).
# packs (the agent-skills trio, the seven superpowers skills, and any
# name link.sh links with no lock entry at all).
#
# One entry point, `check_vendored_skills <repo> <claude_home>
# [profile_file]`, sourced and called by doctor.sh. Two things checked
# One entry point, `check_vendored_skills <repo> <claude_home>`, sourced
# and called by doctor.sh. Two things checked
# per name in link.sh's EXTERNAL_SKILLS array:
# 1. its file(s) exist under skills-external/<name>/ — expected file
# list comes from the matching plugins.lock.json entry (list shape
@@ -17,13 +16,8 @@
# emil-design-eng single-file "path" shape -> the key itself is the
# name, file "SKILL.md") or, when no lock entry names it at all,
# defaults to ["SKILL.md"].
# 2. when the name is listed in <profile_file> (or no <profile_file>
# is passed — the "could not resolve the active profile" case),
# the <claude_home>/skills/<name> symlink points at
# <repo>/skills-external/<name>. A name absent from the profile is
# reported parked, not failed — unless its lock entry is
# "always_on": true (the superpowers entry is), in which case the
# symlink is checked regardless of the profile (see _dv_check_link).
# 2. the <claude_home>/skills/<name> symlink points at
# <repo>/skills-external/<name>.
#
# Lock parsing via python3 argv (never string-spliced) — same pattern as
# lib/vendor-skills.sh's _vendor_read_lock. link.sh's EXTERNAL_SKILLS
@@ -33,9 +27,7 @@
# Every name/file pulled from the lock or link.sh is spliced into a
# filesystem path (skills-external/<name>/<file>,
# <claude_home>/skills/<name>): _dv_valid_item_name allowlists it first
# (a rejection is a warn + skip, never a fail). doctor.sh's active
# profile splices into lib/profiles/<name>.profile the same way, guarded
# by _dv_valid_profile_name.
# (a rejection is a warn + skip, never a fail).
#
# No `set -euo pipefail` here (mirrors lib/vendor-skills.sh): a sourced
# lib must not change the caller's shell options.
@@ -63,9 +55,7 @@ fi
# _dv_lock_expectations <lockfile> — prints "<name>\t<file>" for every
# skill named under a plugins.lock.json entry whose "managed_by" is
# "curl", plus a THIRD column "\t1" when that entry is "always_on": true
# (the superpowers entry is) — read by _dv_is_always_on, ignored by the
# $1==n {print $2} awk in _dv_check_files: a bare list defaults each name
# "curl". A bare list defaults each name
# to ["SKILL.md"]; a dict names its own per-skill file list; an entry
# with neither (the emil-design-eng single-file "path" shape) is itself
# the skill name, file "SKILL.md" (the literal "path" value is upstream
@@ -123,13 +113,12 @@ for key, entry in data.items():
sys.exit(1)
if not valid_skills(skills):
sys.exit(1)
suffix = "\t1" if entry.get("always_on") is True else ""
if skills is None:
print(f"{key}\tSKILL.md{suffix}")
print(f"{key}\tSKILL.md")
continue
for name, files in skill_files(skills).items():
for file in files:
print(f"{name}\t{file}{suffix}")
print(f"{name}\t{file}")
PY
}
@@ -145,22 +134,6 @@ _dv_link_names() {
| grep -v '^$'
}
# _dv_profile_has <profile_file> <name> — true when a line's FIRST
# whitespace-separated token equals <name> (the profile line's label
# column — comments and the type column are ignored).
_dv_profile_has() {
local profile_file="$1" name="$2"
awk -v n="$name" '$1 == n { found=1 } END { exit !found }' "$profile_file"
}
# _dv_valid_profile_name <name> — true when <name> matches the
# profile-name allowlist (letters, digits, underscore, hyphen only).
# <name> is spliced into "lib/profiles/<name>.profile" by doctor.sh, so
# a path-traversal or separator character must never reach it.
_dv_valid_profile_name() {
[[ "$1" =~ ^[A-Za-z0-9_-]+$ ]]
}
# _dv_valid_item_name <name> — true when <name> (a skill name from
# link.sh's EXTERNAL_SKILLS array, or a relative file named by a
# plugins.lock.json entry) matches the item-name allowlist (letters,
@@ -202,59 +175,28 @@ allowlist — skipped"
[ "$all_ok" -eq 1 ]
}
# _dv_is_always_on <name> <lock_out> — true when <lock_out> (the
# "<name>\t<file>[\t1]" lines from _dv_lock_expectations) carries the
# always_on third column for <name>'s lock entry.
_dv_is_always_on() {
local name="$1" lock_out="$2"
awk -F'\t' -v n="$name" '$1 == n && $3 == 1 { found=1 } \
END { exit !found }' <<< "$lock_out"
}
# _dv_check_link <claude_home> <repo> <name> <profile_file> <always_on> —
# when <always_on> is "1" (the name's lock entry is "always_on": true),
# the symlink is checked whatever <profile_file> says — never parked.
# Otherwise, when <profile_file> is non-empty and does not list <name>,
# reports it parked (info), not failed. Otherwise (listed, always_on, or
# no <profile_file> was passed — active profile could not be resolved,
# every external is then expected linked) checks the
# <claude_home>/skills/<name> symlink points at
# <repo>/skills-external/<name>.
# _dv_check_link <claude_home> <repo> <name> — the
# <claude_home>/skills/<name> symlink points at <repo>/skills-external/<name>.
_dv_check_link() {
local claude_home="$1" repo="$2" name="$3" profile_file="$4" \
always_on="$5"
local link target label
if [ "$always_on" != "1" ] && [ -n "$profile_file" ] \
&& ! _dv_profile_has "$profile_file" "$name"; then
label="$(basename "$profile_file" .profile)"
info "$name: parked by profile $label"
return
fi
link="$claude_home/skills/$name"
target="$repo/skills-external/$name"
local claude_home="$1" repo="$2" name="$3"
local link="$claude_home/skills/$name"
local target="$repo/skills-external/$name"
if [ -L "$link" ] && [ "$(readlink "$link")" = "$target" ]; then
pass "$name: vendored + linked"
else
fail "$name: symlink missing/wrong — run: make link (or: bash \
lib/profile.sh apply <profile>)"
fail "$name: symlink missing/wrong — run: make link"
fi
}
# _dv_check_name <repo> <claude_home> <name> <profile_file> <lock_out> —
# per-name dispatch for check_vendored_skills's loop: files first (the
# link check runs only when every expected file is present, same as
# before), then the symlink, passing _dv_is_always_on's verdict as
# _dv_check_link's 5th param.
# _dv_check_name <repo> <claude_home> <name> <lock_out> — per-name
# dispatch: files first, the symlink only when every file is present.
_dv_check_name() {
local repo="$1" claude_home="$2" name="$3" profile_file="$4" lock_out="$5"
local always_on=""
_dv_is_always_on "$name" "$lock_out" && always_on=1
local repo="$1" claude_home="$2" name="$3" lock_out="$4"
_dv_check_files "$repo" "$name" "$lock_out" \
&& _dv_check_link "$claude_home" "$repo" "$name" "$profile_file" \
"$always_on"
&& _dv_check_link "$claude_home" "$repo" "$name"
}
# check_vendored_skills <repo> <claude_home> [profile_file] — see the
# check_vendored_skills <repo> <claude_home> — see the
# file header. Either the lock or link.sh being unreadable (or a
# malformed lock entry — _dv_lock_expectations rc 1) is a warn, never a
# fail; link.sh unreadable skips the whole check (there is nothing to
@@ -262,7 +204,7 @@ _dv_check_name() {
# allowlist before it is spliced into a path — a rejected one is
# warned and skipped, not failed.
check_vendored_skills() {
local repo="$1" claude_home="$2" profile_file="${3:-}"
local repo="$1" claude_home="$2"
local lock_out names name
if ! lock_out="$(_dv_lock_expectations "$repo/plugins.lock.json")"; then
@@ -285,6 +227,6 @@ check skipped"
item-name allowlist — skipped"
continue
fi
_dv_check_name "$repo" "$claude_home" "$name" "$profile_file" "$lock_out"
_dv_check_name "$repo" "$claude_home" "$name" "$lock_out"
done <<< "$names"
}
+25
View File
@@ -0,0 +1,25 @@
# 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
autoplan
context-save
learn
careful
guard
design-shotgun
-85
View File
@@ -1,85 +0,0 @@
#!/usr/bin/env bash
# ============================================================
# lib/gstack-removed.sh — the gstack skills this config never exposes
#
# Single source for the denylist. Sourced by lib/profile.sh
# (enable_all_gstack, enable_skill) and lib/toggle-external.sh
# (`enable gstack`), read by lib/tests/profile-census.test.sh. A name
# listed here is in no profile, `max` included, and every "bring gstack
# back" path skips it. Decided 2026-09-28 (skill-catalog prune, user go):
#
# 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
#
# Also hosts the gstack helpers the two scripts share (gstack_skills and
# the park/unpark moves below). They live in this file because it is the
# only one the fixture suites copy next to profile.sh / toggle-external.sh:
# a new sourced file would be missing there. Each takes its directories as
# arguments (no reliance on the caller's globals).
#
# No `set -euo pipefail` here (sourced lib, mirrors lib/detect-plugins.sh).
# ============================================================
GSTACK_REMOVED=(ship land-and-deploy setup-deploy autoplan context-save
learn careful guard design-shotgun)
# gstack_is_removed <name> — exit 0 when <name> is on the denylist.
gstack_is_removed() {
local name="$1" entry
for entry in "${GSTACK_REMOVED[@]}"; do
[ "$entry" = "$name" ] && return 0
done
return 1
}
# gstack_skills <gstack_src> — prints the directory basenames under
# <gstack_src>/*/ that hold a SKILL.md; nothing when the dir is absent.
# Source of truth for "which skills belong to gstack".
gstack_skills() {
local src="$1" d
[ -d "$src" ] || return 0
for d in "$src"/*/; do
[ -f "${d}SKILL.md" ] || continue
basename "$d"
done
}
# gstack_parked_names <disabled_dir> — prints <name> for every
# <disabled_dir>/gstack__<name> entry (a dangling symlink is skipped).
gstack_parked_names() {
local entry
[ -d "$1" ] || return 0
for entry in "$1"/gstack__*; do
[ -e "$entry" ] || continue
basename "$entry" | sed 's/^gstack__//'
done
}
# gstack_park <skills_dir> <disabled_dir> <name> — moves skills/<name> to
# skills-disabled/gstack__<name>. A stale destination is clobbered first:
# gstack ./setup creates skills/<name>/ as directories, so mv onto an
# existing dir would nest it (gstack__<name>/<name>/) instead of renaming.
# Content is symlinks to the submodule, `gstack ./setup` regenerates it.
# Call as a plain statement (never `|| …`, `if`, `!`): errexit must stay on.
gstack_park() {
local skills_dir="$1" disabled_dir="$2" name="$3"
rm -rf "$disabled_dir/gstack__$name"
mv "$skills_dir/$name" "$disabled_dir/gstack__$name"
}
# gstack_unpark <skills_dir> <disabled_dir> <name> — moves
# skills-disabled/gstack__<name> back to skills/<name>, replacing whatever
# sits there. Same plain-statement rule as gstack_park.
gstack_unpark() {
local skills_dir="$1" disabled_dir="$2" name="$3"
rm -rf "${skills_dir:?}/${name:?}"
mv "$disabled_dir/gstack__$name" "$skills_dir/$name"
}
+4 -5
View File
@@ -4,9 +4,8 @@
#
# Sourced by install-plugins.sh (Step 8.6), update-all.sh (7.3b) and
# doctor.sh. The pack is machine-owned: cloned from upstream and moved
# into skills-external/higgsfield-* (gitignored), then linked on demand by
# lib/toggle-external.sh. It is listed in neither link.sh nor any profile:
# either would re-enable a parked pack on every run (BDR-093).
# into skills-external/higgsfield-* (gitignored), then linked by
# skills/pack-higgsfield (`profile.sh enable higgsfield`).
# ============================================================
# Upstream skills repo, single source for both installers. An env value
@@ -38,8 +37,8 @@ _higgsfield_adopt() {
# The stage sits next to the destination, on the same filesystem, so each
# replacement is a rename. Prints the number of skills synced. Returns 1,
# existing copies untouched, when the clone fails or upstream holds no
# higgsfield-*/SKILL.md. A parked skill (skills-disabled/<name>, a symlink
# to the source path) stays parked. Known limit: a skill that upstream
# higgsfield-*/SKILL.md. Linked by skills/pack-higgsfield (`profile.sh
# enable higgsfield`), never touched here. Known limit: a skill that upstream
# removes or renames keeps its last local copy.
higgsfield_sync_skills() {
local dest="$1/skills-external" stage count=0
+43
View File
@@ -0,0 +1,43 @@
# 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,
# 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
| ($all[] | select(.f == "full.json") | .frag) as $full
| ($full.enabledPlugins | keys) as $keys
| ($deny | split(" ") | map(. + ".json")) as $deny_files
| ($m | map({key: .id, value: .on}) | from_entries) as $mdef
| ($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"
else empty end ),
( ["model-router@skills-dir", "security-guidance@claude-code-plugins"][]
| select($g.enabledPlugins[.] != true)
| "RED lib/profiles/\($f): \(.) must be true" ),
( ["example-skills@anthropic-agent-skills", "brightdata-plugin@synced"][]
| select($g.enabledPlugins[.] != false)
| "RED lib/profiles/\($f): \(.) must be false" ),
( (["claude.ai higgsfield", "claude.ai Higgsfield AI"] | sort) as $both
| if (($deny_files | index($f)) != null) and (($g | dn) != $both)
then "RED lib/profiles/\($f): must deny both higgsfield connectors"
elif (($deny_files | index($f)) == null) and (($g | dn) | length) > 0
then "RED lib/profiles/\($f): must deny no connector"
else empty end ),
( if $f == "full.json" then
($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 ),
( $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)/" ) )
+139
View File
@@ -0,0 +1,139 @@
#!/usr/bin/env bash
# shellcheck disable=SC2088 # the literal "~/.claude/skills" is a grep pattern
# ============================================================
# lib/pack-census.sh — census of the pack layout and its readers
#
# Packs are skills-dir plugins `skills/pack-<n>/` (manifest
# `.claude-plugin/plugin.json`, entries `skills/<s>` = tracked relative
# symlinks into skills-external/ or real dirs). Checks:
# 1. manifest parses, name = folder; every entry resolves (dangling =
# WARN; RED with --installed on a pack ON by manifest); no skill both
# flat and in a pack; no retired gstack name (lib/gstack-removed.list).
# 2. fragments lib/profiles/*.json: same key set as full.json; model-router
# + security-guidance true, example-skills + brightdata false
# everywhere; the two higgsfield connectors denied on exactly
# DENY_PROFILES; full.json packs = manifest defaults.
# 3. no reader of the old layout left (scope and terms in check_citers).
# Shared by make test (lib/tests/pack-census.test.sh) and doctor.sh.
# Prints RED/WARN lines, then `PACKS OK <p> packs <s> skills` when no RED.
# Exit: 0 clean or WARN only · 1 any RED.
# Usage: pack-census.sh [--repo <dir>] [--installed]
# ============================================================
set -euo pipefail
REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
INSTALLED=0
while [ $# -gt 0 ]; do
case "$1" in
--repo) REPO="$2"; shift 2 ;;
--installed) INSTALLED=1; shift ;;
*) echo "pack-census: unknown option $1" >&2; exit 2 ;;
esac
done
SKILLS="$REPO/skills"
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 dev minimal qa seo" # spec § 2
red=0; packs=0; skills=0
declare -A seen
red() { echo "RED $*"; red=1; }
pack_on() {
jq -e '.defaultEnabled != false' "$1/.claude-plugin/plugin.json" >/dev/null
}
check_manifest() { # $1 pack dir
local n m name; n="$(basename "$1")"; m="$1/.claude-plugin/plugin.json"
[ -f "$m" ] || { red "$n: no .claude-plugin/plugin.json"; return; }
jq -e . "$m" >/dev/null 2>&1 || { red "$n: manifest is not JSON"; return; }
name="$(jq -r '.name // ""' "$m")"
[ "$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
if [ "$INSTALLED" = 1 ] && pack_on "$1"; then
red "$n: $s target missing (pack ON)"
else echo "WARN $n: $s target missing (installer not run)"; fi
fi
[ -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; run: $(dup_remedy "$s")"
else seen[$s]="$n"; fi
skills=$((skills+1))
}
check_fragments() {
local files=("$PROFILES"/*.json) full="$PROFILES/full.json" out
[ -f "$full" ] || { red "lib/profiles/full.json missing"; return; }
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"
! grep -q '^RED' <<<"$out" || red=1
}
manifests_json() { # [{id, on}] for every pack manifest
jq -cn '[inputs | {id: (.name + "@skills-dir"),
on: (.defaultEnabled != false)}]' \
"$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.
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"
-e "\(^\|[^A-Za-z0-9_./}~-]\)skills/$n/")
done
hit="$( { grep -rno --include='*.sh' --include='*.md' --include='*.py' \
--include='*.json' --include='Makefile' "${args[@]}" "$REPO"/hooks \
"$REPO"/lib "$REPO"/agents "$REPO"/skills "$REPO"/rules \
"$REPO"/templates "$REPO"/mods "$REPO"/*.sh "$REPO"/CLAUDE.global.md \
"$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-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"
done <<<"$hit"
}
main() {
local d s p e names=()
[ -f "$REMOVED" ] || red "lib/gstack-removed.list missing"
for d in "$SKILLS"/*/; do
d="${d%/}"; s="$(basename "$d")"
case "$s" in pack-*) continue ;; esac
[ -e "$d/SKILL.md" ] && seen[$s]="skills/$s"
done
for p in "$SKILLS"/pack-*/; do
p="${p%/}"; packs=$((packs+1)); check_manifest "$p"
for e in "$p"/skills/*; do
[ -e "$e" ] || [ -L "$e" ] || continue
check_entry "$p" "$e"; names+=("$(basename "$e")")
done
done
check_fragments
[ "${#names[@]}" -gt 0 ] && check_citers "${names[@]}"
[ "$red" -eq 0 ] && echo "PACKS OK $packs packs $skills skills"
exit "$red"
}
main
+20 -40
View File
@@ -12,18 +12,17 @@ Agent(subagent_type="plugin-probe", description="plugin gate — probe",
prompt="Run your probes from <PROJECT_ROOT>. Emit the PROBE REPORT.")
```
## 2. VALIDATION CHECKPOINT (main loop — between probe and reasoner)
## 2. VALIDATION CHECKPOINT (main loop: between probe and reasoner)
Validate the PROBE REPORT before any reasoning:
- `EXTERNAL` non-empty AND each listed plugin's directory appears under
`CHECKPOINT plugin-dirs`.
- `PROFILE` block holds a `profile=` line.
- At least one project signal present (MANIFESTS / FRAMEWORK-DEPS /
TSX-JSX-COUNT > 0 / DOCKER-COUNT > 0 / EMBEDDED hits). Else print
`⚠️ No project signals detected — recommendations will be conservative.`
`⚠️ No project signals detected: recommendations will be conservative.`
and continue.
- `CHECKPOINT toggle-script=UNAVAILABLE` → print `⚠️ toggle script
unavailable — recommendations will be advisory only, no auto-activation.`
and SKIP step 5 (apply) entirely.
- `CHECKPOINT profile-sh=UNAVAILABLE` → print `⚠️ profile.sh unavailable:
recommendations will be advisory only, no auto-activation.` and SKIP
step 5 (apply) entirely.
- PROBE REPORT missing/unparsable → retry the probe ONCE fresh; a 2nd
failure → STOP and surface (never reason over invented detection).
@@ -45,7 +44,7 @@ Show the returned PLUGIN CHECK block.
answered.
- OK → print `✅ Plugin check passed — [active plugins] — complexity: <score>%`.
## 5. APPLY GATE (main loop — only when the flow auto-activates)
## 5. APPLY GATE (main loop: only when the flow auto-activates)
If any plugin has ⚡ ENABLE status:
1. List the changes:
@@ -55,36 +54,17 @@ If any plugin has ⚡ ENABLE status:
⚡ Pre-fetch ctx7 docs for next.js, prisma
Apply these changes? (yes / no / customize)
```
2. "yes" → apply via the exact commands the advisor emitted. "customize" →
user picks. "no" → proceed with current config.
2. "yes" → run the advisor's commands in order, each one `bash
"$HOME/.claude/lib/profile.sh" -C <PROJECT_ROOT> set <name>` or `enable
<pack>`. Each call writes `.claude/settings.local.json` atomically or
refuses (rc 2, nothing written), so there is nothing to roll back: stop at
the first non-zero rc, print its stderr, and continue with the current
config. "customize" → user picks. "no" → proceed with current config.
3. After a successful write print `✅ Applied N change(s): run
/reload-plugins to load the packs in this session (connectors and model:
next session).` In a `--settings` conversation (`PROFILE :` block says
`source=flag`) the advisor emits no enable for a pack the flag turns off;
it says `relaunch: cc <name> <profile>` instead.
**Never auto-activate without showing the list and getting confirmation.**
### Rollback on partial failure
Track each toggle; roll back the partial set rather than leave a
half-applied configuration:
```bash
applied=()
for change in "${PROPOSED_CHANGES[@]}"; do
if bash "$HOME/.claude/lib/toggle-external.sh" enable "$change"; then
applied+=("$change")
else
echo "❌ failed to enable $change — rolling back ${#applied[@]} prior change(s)"
for prior in "${applied[@]}"; do
bash "$HOME/.claude/lib/toggle-external.sh" disable "$prior" \
|| echo "⚠️ rollback of $prior also failed — manual cleanup required: see ~/.claude/plugins/cache"
done
exit 1
fi
done
```
Surface: `✅ Applied N change(s).` — or on failure:
```
⚠️ Toggle failed at change <name>. Rolled back the N prior change(s).
To inspect manually: ls ~/.claude/plugins/cache; bash ~/.claude/lib/toggle-external.sh list
Re-run /plugin-check after fixing the underlying cause (e.g. permissions).
```
**Never auto-activate without showing the list and getting confirmation.
Never write the user scope.**
+72
View File
@@ -0,0 +1,72 @@
# lib/profile-state.jq — effective profile state of one project and
# conversation, in one pass (lib/profile.sh `current`, `unset`).
# Args: $u $p $l $f raw settings files (user, project, local, --settings;
# "" when absent), $cj raw ~/.claude.json, $m manifests [{id,on}],
# $mode "plain" | "human" | "json", $proj project dir, $flagname CLAUDE_PROFILE
# or "-", $hasflag "1" when a --settings file is in force.
# inputs = lib/profiles/*.json (one fragment per file).
def parse: try fromjson catch {};
def name_of: input_filename | sub(".*/"; "") | sub("\\.json$"; "");
def ep: (.enabledPlugins // {});
def dn: [(.deniedMcpServers // [])[] | .serverName];
def onoff: if . then "on" else "off" end;
def is_pack: startswith("pack-") and endswith("@skills-dir");
def short: sub("@skills-dir$"; "");
def src_word($s):
if $s.source == "flag" then "conv \($s.flag)" else $s.source end;
def listing($plugins; $on):
[$plugins | to_entries[] | select(.value == $on) | .key | short]
| if length == 0 then "none" else join(" ") end;
[inputs | {name: name_of, frag: .}] as $profiles
| ($u | parse) as $U | ($p | parse) as $P
| ($l | parse) as $L | ($f | parse) as $F
| ([$profiles[].frag | ep | keys[]] | unique) as $ids
| ([$profiles[].frag | dn[]] | unique) as $managed
| ($m | map({key: .id, value: .on}) | from_entries) as $mdef
| ($ids | map({key: ., value: ($mdef[.]
// (if endswith("@skills-dir") and (is_pack | not) then true
else false end))}) | from_entries) as $d
| (($d + ($U|ep) + ($P|ep) + ($L|ep) + ($F|ep))
| with_entries(select(.key as $k | $d | has($k)))) as $plugins
| ((($U|dn) + ($P|dn) + ($L|dn) + ($F|dn)) | unique) as $denied
| ([$U, $P, $L, $F] | any(.disableClaudeAiConnectors == true)) as $all
| ($F.model // $L.model // $P.model // $U.model // "-") as $model
| (if ($F | has("model")) then "flag" elif ($L | has("model")) then "local"
elif ($P | has("model")) then "project"
elif ($U | has("model")) then "user" else "-" end) as $msrc
| (if $hasflag == "1" then "flag"
elif ((($L|ep) | length) + (($L|dn) | length)) > 0 then "local"
else "default" end) as $src
| (try ($cj | fromjson | .projects[$proj].disabledMcpServers // []
| if length == 0 then "-" else join(",") end)
catch (if $cj == "" then "-" else "unknown" end)) as $off
| ([$denied[] | select(. as $x | $managed | index($x))]) as $mdenied
| ([$profiles[] | select((.frag | ep) == $plugins
and ((.frag | dn | sort) == ($mdenied | sort)) and ($all | not))
| .name] | .[0] // "custom") as $name
| {name: $name, source: $src, flag: $flagname, plugins: $plugins,
denied: $denied, managed_denied: $mdenied, all_denied: $all,
model: $model, model_source: $msrc, mcp_off: $off} as $s
| if $mode == "json" then $s
elif $mode == "plain" then
( ["profile=\($s.name)", "source=\($s.source)", "flag=\($s.flag)"]
+ [$plugins | to_entries | sort_by(.key)[] | select(.key | is_pack)
| "\(.key | short)=\(.value | onoff)"]
+ [$plugins | to_entries | sort_by(.key)[]
| select(.key | is_pack | not) | "plugin:\(.key)=\(.value | onoff)"]
+ [$denied[] | "connector:\(.)=denied"]
+ (if $all then ["connector:*=denied"] else [] end)
+ ["model=\($s.model)", "model-source=\($s.model_source)",
"mcp-off=\($s.mcp_off)"] ) | .[]
else
( [ (if $s.mcp_off != "-"
then "profile: custom (off: \($s.mcp_off)) [\(src_word($s))]"
else "profile: \($s.name) [\(src_word($s))]" end),
" on : \(listing($plugins; true))",
" off: \(listing($plugins; false))",
" connectors denied: \(if $all then "all"
elif ($denied | length) == 0 then "none"
else ($denied | join(", ")) end)",
" model: \($s.model) (\($s.model_source))" ] ) | .[]
end
+285 -816
View File
File diff suppressed because it is too large. Load diff
+32
View File
@@ -0,0 +1,32 @@
# Profiles
A profile is a literal Claude Code settings fragment: `enabledPlugins`
(every pack `pack-<n>@skills-dir` and managed plugin, explicit), optional
`deniedMcpServers` (the two higgsfield claude.ai connectors), optional
`model`. Per project: `bash ~/.claude/lib/profile.sh set <name>` writes it
into `.claude/settings.local.json`, then `/reload-plugins`. Per
conversation: `cc <session> <name>` (lib/cc.sh) runs
`claude --settings lib/profiles/<name>.json`; that conversation is frozen
(no reload brings a pack back; relaunch instead). No profile = the manifest
defaults = `full` with the connectors present. `deniedMcpServers` is a union
across files: a `cc x web` over a project set to `dev` keeps the connectors
denied; `set web` in the project brings them back next session.
`profile.sh list` reads these lines (format `- **name**: text`):
- **full**: every pack except higgsfield and extras; ui-ux-pro-max on; connectors present. The default.
- **max**: everything on, pr-review-toolkit included; for a one-off session, not a project.
- **minimal**: no pack, no design plugin, connectors denied; the smallest listing.
- **dev**: gstack-dev only; backend or tooling work without UI.
- **design**: design, scroll3d, gstack-design, gstack-browser, ui-ux-pro-max; connectors present.
- **web**: design + scroll3d + web-validate + the three gstack packs + ui-ux-pro-max; public site work.
- **seo**: seo, web-validate, gstack-browser, gstack-dev; audit and fixes on a live site.
- **qa**: gstack-browser + web-validate; dogfooding and conformance only.
- **audit**: seo, web-validate, gstack-dev, gstack-browser, pr-review-toolkit; read-mostly audits.
Invariants (checked by `lib/pack-census.sh`): the same key set in every
fragment; `model-router@skills-dir` and `security-guidance@claude-code-plugins`
true everywhere; `example-skills@anthropic-agent-skills` and
`brightdata-plugin@synced` false everywhere; the connectors denied on exactly
minimal, dev, seo, qa, audit; `full` equal to the manifest defaults.
Add your own profile as another `<name>.json` with the same key set.
+27
View File
@@ -0,0 +1,27 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": false,
"pack-scroll3d@skills-dir": false,
"pack-seo@skills-dir": true,
"pack-web-validate@skills-dir": true,
"pack-gstack-dev@skills-dir": true,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": false,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": false,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": true,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
},
"deniedMcpServers": [
{
"serverName": "claude.ai higgsfield"
},
{
"serverName": "claude.ai Higgsfield AI"
}
]
}
-30
View File
@@ -1,30 +0,0 @@
# DESC: Comprehensive audit — security + SEO + GEO + W3C + perf + health
# Activate when: doing a top-to-bottom audit pass on an existing project.
# Wider than `seo` (adds security + dependency review).
# Security
cso
harden personal
guardrails personal
a11y personal
analyze personal
# SEO / GEO / web standards
seo personal
geo personal
web-validate personal
# Code + perf health
health
benchmark
review
# Browser tooling for live audits
browse
open-gstack-browser
# Plugin: PR review toolkit (audit context for diffs)
pr-review-toolkit plugin@claude-code-plugins
# CLI: graphify for code structure
graphify cli
-44
View File
@@ -1,44 +0,0 @@
# DESC: Backend / API / system dev — no design, no SEO, focused on logic
# Activate when: building backend services, APIs, CLIs, libraries, system
# code, data pipelines. UI/visual work is out of scope. SEO/GEO out of scope.
# Code work — primary
feat personal
ship-feature personal
hotfix personal
bugfix personal
investigate
refactor personal
code-clean personal
commit-change personal
analyze personal
# Dev-lifecycle skills (agent-skills trio)
observability-and-instrumentation external
deprecation-and-migration external
ci-cd-and-automation external
# Review
review
# Second opinion for hard problems
codex
# Security + health (always relevant for backend)
cso
guardrails personal
health
# Session hygiene
freeze
unfreeze
retro
# pr-review-toolkit removed (audit 2026-07-02 #12 — ~2.2k tokens, PR-only):
# enable per PR session via `bash lib/profile.sh apply audit` or
# claude plugin enable pr-review-toolkit@claude-code-plugins
# CLIs (advisory)
ctx7 cli
gsd cli
graphify cli
+19
View File
@@ -0,0 +1,19 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": true,
"pack-scroll3d@skills-dir": true,
"pack-seo@skills-dir": false,
"pack-web-validate@skills-dir": false,
"pack-gstack-dev@skills-dir": false,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": true,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": true,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
}
}
-55
View File
@@ -1,55 +0,0 @@
# DESC: Design work — visual QA, design systems, mockups, polish
# Activate when: building/reviewing UI, picking aesthetics, design tokens.
# Companion CLIs (advisory): graphify (visual structure).
#
# Gate scope (design-tool-gate.sh): only the tools on the GATE-BLOCK lines
# below trip the design gate. The rest of this profile (browser/plan/shotgun
# tooling, graphify) is bundled for convenience but never blocks. Keep these
# lines in sync when adding/removing a core design tool.
# GATE-BLOCK: impeccable ui-ux-pro-max emil-design-eng design-html
# GATE-BLOCK: design-motion-principles design-review design-consultation
# GATE-BLOCK: 21st 21st-ui-build
# Core design skills (gstack)
design-review
design-consultation
design-html
plan-design-review
# Browser tooling — design-review relies on it
browse
open-gstack-browser
setup-browser-cookies
# Plan-mode review companion (taste decisions before code)
plan-ceo-review
# External: design skills
emil-design-eng external
frontend-design external
design-motion-principles external
impeccable external
# External: Mengto scroll-choreography skills (curl, commit-pinned)
scroll-world-storytelling external
build-threejs-scroll-worlds external
scroll-scrubbed-visual-sequence external
scroll-scrubbed-word-reveal external
scroll-progress-timeline external
# Personal: motion implementation companion (skills/site-motion)
site-motion personal
# External: 21st.dev pack — CLI-driven (no MCP, no API key). 21st-registry
# and 21st-design-sync are publishing flows; installed but left parked.
21st-ui-build external
21st-cli-use external
# Plugin (auto-toggle)
ui-ux-pro-max plugin@ui-ux-pro-max-skill
# CLIs (advisory only — installed/not-installed)
# 21st is NOT advisory: it is on the GATE-BLOCK list, so a missing CLI trips
# the design gate. Install: npm i -g @21st-dev/cli then 21st login
21st cli
graphify cli
+27
View File
@@ -0,0 +1,27 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": false,
"pack-scroll3d@skills-dir": false,
"pack-seo@skills-dir": false,
"pack-web-validate@skills-dir": false,
"pack-gstack-dev@skills-dir": true,
"pack-gstack-browser@skills-dir": false,
"pack-gstack-design@skills-dir": false,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": false,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
},
"deniedMcpServers": [
{
"serverName": "claude.ai higgsfield"
},
{
"serverName": "claude.ai Higgsfield AI"
}
]
}
-27
View File
@@ -1,27 +0,0 @@
# DESC: Daily code work — small features, fixes, refactor, ship (any stack)
# Activate when: implementing features, debugging, shipping PRs without a
# specific frontend or backend bias. Lighter than `backend` (no security audit
# baggage) and lighter than `web` (no design pipeline).
# Implementation
feat personal
ship-feature personal
# Bug fixing
hotfix personal
bugfix personal
investigate
# Code health
review
refactor personal
code-clean personal
commit-change personal
explain-diff personal
guardrails personal
a11y personal
# Dev-lifecycle skills (agent-skills trio)
observability-and-instrumentation external
deprecation-and-migration external
ci-cd-and-automation external
+19
View File
@@ -0,0 +1,19 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": true,
"pack-scroll3d@skills-dir": true,
"pack-seo@skills-dir": true,
"pack-web-validate@skills-dir": true,
"pack-gstack-dev@skills-dir": true,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": true,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": true,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
}
}
-104
View File
@@ -1,104 +0,0 @@
# DESC: Default profile — carries everything every other profile carries
# (user rule 2026-09-28: full does what each profile does), minus the
# broken or doctrine-breaking gstack skills (lib/gstack-removed.sh) and
# the parked tools (make-pdf, diagram, 21st-ai/ui-explore/ui-review) that
# live in `max`. One named exception: pr-review-toolkit (see below).
# === Brainstorm + plan-mode reviews ==================================
office-hours
plan-ceo-review
plan-eng-review
plan-design-review
plan-devex-review
spec
# === Design pipeline =================================================
design-review
design-consultation
design-html
# === Browser + dogfooding ============================================
browse
open-gstack-browser
setup-browser-cookies
scrape
skillify
# === Code work — implementation ======================================
feat personal
ship-feature personal
hotfix personal
bugfix personal
investigate
refactor personal
code-clean personal
commit-change personal
# === Review ===========================================================
review
# === Second opinion ==================================================
codex
# === SEO / GEO / standards / security ================================
seo personal
geo personal
web-validate personal
harden personal
guardrails personal
a11y personal
analyze personal
cso
# === Perf + canary + QA ==============================================
health
benchmark
canary
qa
qa-only
# === Docs + translation ==============================================
doc personal
document-release
pdf-translate personal
explain-diff personal
# === Session hygiene + memory ========================================
close personal
prune-memory personal
status personal
retro
freeze
unfreeze
# === External + plugin + MCP =========================================
emil-design-eng external
frontend-design external
design-motion-principles external
impeccable external
observability-and-instrumentation external
deprecation-and-migration external
ci-cd-and-automation external
scroll-world-storytelling external
build-threejs-scroll-worlds external
scroll-scrubbed-visual-sequence external
scroll-scrubbed-word-reveal external
scroll-progress-timeline external
ui-ux-pro-max plugin@ui-ux-pro-max-skill
# pr-review-toolkit REMOVED from full (audit 2026-07-02 #12): heaviest
# single plugin cost (~2.2k tokens of agent descriptions/session), useful
# only when reviewing PRs. Reactivate per PR session:
# claude plugin enable pr-review-toolkit@claude-code-plugins
# or profile-based: bash lib/profile.sh apply audit (audit.profile keeps it;
# a later `set full` re-disables it — MANAGED_PLUGINS lifecycle).
21st-ui-build external
21st-cli-use external
# Personal: motion implementation companion (skills/site-motion)
site-motion personal
# === CLIs (advisory) =================================================
21st cli
ctx7 cli
graphify cli
gsd cli
+19
View File
@@ -0,0 +1,19 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": true,
"pack-scroll3d@skills-dir": true,
"pack-seo@skills-dir": true,
"pack-web-validate@skills-dir": true,
"pack-gstack-dev@skills-dir": true,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": true,
"pack-higgsfield@skills-dir": true,
"pack-extras@skills-dir": true,
"ui-ux-pro-max@ui-ux-pro-max-skill": true,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": true,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
}
}
-105
View File
@@ -1,105 +0,0 @@
# DESC: Everything — full + the parked generation/review tools + PR review
# SUPERSET-OF: full
# Activate when: you need make-pdf, diagram, the 21st-ai/ui-explore/
# ui-review generation trio, or pr-review-toolkit, on top of everything
# full carries. Never a broken or doctrine-breaking gstack skill
# (lib/gstack-removed.sh) — max is full's superset, not the raw catalog.
# === Brainstorm + plan-mode reviews ==================================
office-hours
plan-ceo-review
plan-eng-review
plan-design-review
plan-devex-review
spec
# === Design pipeline =================================================
design-review
design-consultation
design-html
# === Browser + dogfooding ============================================
browse
open-gstack-browser
setup-browser-cookies
scrape
skillify
# === Code work — implementation ======================================
feat personal
ship-feature personal
hotfix personal
bugfix personal
investigate
refactor personal
code-clean personal
commit-change personal
# === Review ===========================================================
review
# === Second opinion ==================================================
codex
# === SEO / GEO / standards / security ================================
seo personal
geo personal
web-validate personal
harden personal
guardrails personal
a11y personal
analyze personal
cso
# === Perf + canary + QA ==============================================
health
benchmark
canary
qa
qa-only
# === Docs + translation ==============================================
doc personal
document-release
diagram
make-pdf
pdf-translate personal
explain-diff personal
# === Session hygiene + memory ========================================
close personal
prune-memory personal
status personal
retro
freeze
unfreeze
# === External + plugin + MCP =========================================
emil-design-eng external
frontend-design external
design-motion-principles external
impeccable external
observability-and-instrumentation external
deprecation-and-migration external
ci-cd-and-automation external
scroll-world-storytelling external
build-threejs-scroll-worlds external
scroll-scrubbed-visual-sequence external
scroll-scrubbed-word-reveal external
scroll-progress-timeline external
ui-ux-pro-max plugin@ui-ux-pro-max-skill
pr-review-toolkit plugin@claude-code-plugins
21st-ui-build external
21st-ui-explore external
21st-ui-review external
21st-cli-use external
21st-ai external
# Personal: motion implementation companion (skills/site-motion)
site-motion personal
# === CLIs (advisory) =================================================
21st cli
ctx7 cli
graphify cli
gsd cli
+27
View File
@@ -0,0 +1,27 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": false,
"pack-scroll3d@skills-dir": false,
"pack-seo@skills-dir": false,
"pack-web-validate@skills-dir": false,
"pack-gstack-dev@skills-dir": false,
"pack-gstack-browser@skills-dir": false,
"pack-gstack-design@skills-dir": false,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": false,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
},
"deniedMcpServers": [
{
"serverName": "claude.ai higgsfield"
},
{
"serverName": "claude.ai Higgsfield AI"
}
]
}
-7
View File
@@ -1,7 +0,0 @@
# DESC: Strip all gstack skills (only essential personal skills + plugins remain)
# Activate when: you want a quiet session with no gstack noise.
#
# Empty by design — `profile set minimal` disables every gstack skill,
# leaves personal skills (analyze, doc, init-project, onboard, plugin-check,
# refactor, seo, validate, harden, etc.) untouched, and makes no plugin/MCP
# changes. To revert: `profile reset`.
+27
View File
@@ -0,0 +1,27 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": false,
"pack-scroll3d@skills-dir": false,
"pack-seo@skills-dir": false,
"pack-web-validate@skills-dir": true,
"pack-gstack-dev@skills-dir": false,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": false,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": false,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
},
"deniedMcpServers": [
{
"serverName": "claude.ai higgsfield"
},
{
"serverName": "claude.ai Higgsfield AI"
}
]
}
-11
View File
@@ -1,11 +0,0 @@
# DESC: QA + testing — site checks, perf, canary, validation
# Activate when: running QA, checking deployed pages, perf regressions.
qa
qa-only
browse
benchmark
canary
web-validate personal
open-gstack-browser
setup-browser-cookies
+27
View File
@@ -0,0 +1,27 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": false,
"pack-scroll3d@skills-dir": false,
"pack-seo@skills-dir": true,
"pack-web-validate@skills-dir": true,
"pack-gstack-dev@skills-dir": true,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": false,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": false,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
},
"deniedMcpServers": [
{
"serverName": "claude.ai higgsfield"
},
{
"serverName": "claude.ai Higgsfield AI"
}
]
}
-25
View File
@@ -1,25 +0,0 @@
# DESC: SEO + GEO + W3C audit — search/AI indexability + standards
# Activate when: auditing a site for Google/Bing indexability, AI search
# (ChatGPT/Perplexity/Claude/Gemini), W3C HTML/CSS validity, WCAG a11y.
# No design skills, no dev skills — pure audit pipeline.
# SEO + GEO audits (personal)
seo personal
geo personal
# W3C HTML/CSS validity + WCAG a11y
web-validate personal
# Web hardening (HSTS, CSP, redirects — affects ranking signals)
harden personal
# Code analysis (read structure for audit)
analyze personal
# Browser tooling — needed for live-page audits
browse
open-gstack-browser
# Health check + benchmark — Core Web Vitals, perf signals
health # gstack
benchmark # gstack
-66
View File
@@ -1,66 +0,0 @@
# DESC: Production website — design + dev + SEO + GEO + W3C + perf
# Activate when: shipping a public website end-to-end. Combines `web`
# and `seo` profiles into a single set so the same session can build,
# polish, audit, and verify.
# === Design ===========================================================
design-review
design-consultation
design-html
plan-design-review
# === Browser + dogfooding =============================================
browse
open-gstack-browser
setup-browser-cookies
# === Plan-mode reviews ================================================
plan-ceo-review
plan-eng-review
spec
# === Code work ========================================================
feat personal
ship-feature personal
hotfix personal
bugfix personal
review
commit-change personal
refactor personal
# === SEO / GEO / standards ===========================================
seo personal
geo personal
web-validate personal
harden personal
guardrails personal
a11y personal
analyze personal
# === Perf + canary ===================================================
health
benchmark
canary
qa-only
# === External + plugin + MCP =========================================
emil-design-eng external
frontend-design external
design-motion-principles external
impeccable external
scroll-world-storytelling external
build-threejs-scroll-worlds external
scroll-scrubbed-visual-sequence external
scroll-scrubbed-word-reveal external
scroll-progress-timeline external
21st-ui-build external
21st-cli-use external
ui-ux-pro-max plugin@ui-ux-pro-max-skill
# Personal: motion implementation companion (skills/site-motion)
site-motion personal
# === CLIs ============================================================
21st cli
ctx7 cli
graphify cli
+19
View File
@@ -0,0 +1,19 @@
{
"enabledPlugins": {
"model-router@skills-dir": true,
"pack-design@skills-dir": true,
"pack-scroll3d@skills-dir": true,
"pack-seo@skills-dir": false,
"pack-web-validate@skills-dir": true,
"pack-gstack-dev@skills-dir": true,
"pack-gstack-browser@skills-dir": true,
"pack-gstack-design@skills-dir": true,
"pack-higgsfield@skills-dir": false,
"pack-extras@skills-dir": false,
"ui-ux-pro-max@ui-ux-pro-max-skill": true,
"security-guidance@claude-code-plugins": true,
"pr-review-toolkit@claude-code-plugins": false,
"example-skills@anthropic-agent-skills": false,
"brightdata-plugin@synced": false
}
}
-62
View File
@@ -1,62 +0,0 @@
# DESC: Public website work — frontend + content + light dev
# Activate when: building/iterating a public-facing website (landing,
# portfolio, marketing, blog) where SEO is NOT the immediate focus.
# For SEO/GEO audit on top, use web-full or apply seo afterwards.
# Design skills (gstack) — full design pipeline
design-review
design-consultation
design-html
plan-design-review
# Browser tooling for design + dogfooding
browse
open-gstack-browser
setup-browser-cookies
# Plan-mode reviews relevant to web work
plan-ceo-review
plan-eng-review
# Code work skills — needed to actually build the site
feat personal
ship-feature personal
hotfix personal
review # gstack
commit-change personal
refactor personal
# Validation companion (basic W3C/a11y check during build)
web-validate personal
a11y personal
# External: design skills
emil-design-eng external
frontend-design external
design-motion-principles external
impeccable external
# External: Mengto scroll-choreography skills (curl, commit-pinned)
scroll-world-storytelling external
build-threejs-scroll-worlds external
scroll-scrubbed-visual-sequence external
scroll-scrubbed-word-reveal external
scroll-progress-timeline external
# Personal: motion implementation companion (skills/site-motion)
site-motion personal
# External: 21st.dev pack (publishing flows 21st-registry / -design-sync
# stay parked)
21st-ui-build external
21st-cli-use external
# Plugin: UI/UX intelligence (auto-toggle)
ui-ux-pro-max plugin@ui-ux-pro-max-skill
# CLI: 21st.dev component catalog + UI generation (needs `21st login`)
21st cli
# CLI: ctx7 (doc lookup for fast-evolving libs like Next.js)
ctx7 cli
graphify cli
+5 -5
View File
@@ -539,7 +539,7 @@ tf "gitleaks allowlist store" "$REPO/.gitleaks.toml" "seo-data/tokens"
tf "gitignore venv" "$REPO/.gitignore" ".venv-seo-data"
echo "── integration locks ──"
tf "skill step0 account select" "$REPO/skills/seo/SKILL.md" "COMPTE GOOGLE"
tf "skill step0 account select" "$REPO/skills/pack-seo/skills/seo/SKILL.md" "COMPTE GOOGLE"
tf "analyzer calls fetch crux" "$REPO/agents/seo-analyzer.md" "fetch.sh crux"
tf "analyzer calls fetch queries" "$REPO/agents/seo-analyzer.md" "fetch.sh queries"
tf "analyzer gsc subsection" "$REPO/agents/seo-analyzer.md" "Performance GSC"
@@ -548,10 +548,10 @@ tf "geo-analyzer wires schema_gen" "$REPO/agents/geo-analyzer.md" "fetch.sh sche
tf "geo-analyzer wires content_quality" "$REPO/agents/geo-analyzer.md" "fetch.sh content_quality"
echo "── account-mgmt locks ──"
tf "skill routes account verbs" "$REPO/skills/seo/SKILL.md" "forget --all"
tf "skill connect wrapper path" "$REPO/skills/seo/SKILL.md" "lib/seo-data/connect.sh"
tf "skill revocation notice" "$REPO/skills/seo/SKILL.md" "myaccount.google.com/permissions"
tf "skill label charset rule" "$REPO/skills/seo/SKILL.md" "A-Za-z0-9._-"
tf "skill routes account verbs" "$REPO/skills/pack-seo/skills/seo/SKILL.md" "forget --all"
tf "skill connect wrapper path" "$REPO/skills/pack-seo/skills/seo/SKILL.md" "lib/seo-data/connect.sh"
tf "skill revocation notice" "$REPO/skills/pack-seo/skills/seo/SKILL.md" "myaccount.google.com/permissions"
tf "skill label charset rule" "$REPO/skills/pack-seo/skills/seo/SKILL.md" "A-Za-z0-9._-"
echo "── readme lock ──"
tf "readme documents fetch.sh" "$REPO/lib/seo-data/README.md" "fetch.sh"
+1
View File
@@ -25,6 +25,7 @@ import sys
DEFAULT_ROOTS = ["~/.claude/skills", "~/.claude/plugins/cache"]
ROOT_SUFFIXES = [
"*/SKILL.md",
"pack-*/skills/*/SKILL.md",
"*/*/*/skills/*/SKILL.md",
"*/*/*/.claude/skills/*/SKILL.md",
]
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# lib/tests/cc.test.sh — lib/cc.sh `cc <name> [profile]`: unknown profile →
# list + rc 2, no session; a profile → claude --settings <fragment> with
# CLAUDE_PROFILE / CLAUDE_PROFILE_SETTINGS / TMPDIR exported through
# systemd-run + dtach; no profile → plain claude, TMPDIR still set; .env
# sourced. Hermetic: PATH shims, HOME in a fixture holding .claude/lib.
set -u
unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
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; }
check_has() { case "$2" in *"$3"*) pass=$((pass+1));; *) fail=$((fail+1));
printf 'FAIL %s: [%s] does not contain [%s]\n' "$1" "$2" "$3";; esac; }
FX="$(mktemp -d)"; trap 'rm -rf "$FX"' EXIT
mkdir -p "$FX/bin" "$FX/home/.claude/lib/profiles"
cp "$ROOT/lib/cc.sh" "$ROOT/lib/profile.sh" "$FX/home/.claude/lib/"
printf '{"enabledPlugins": {"x@skills-dir": true}}\n' > "$FX/home/.claude/lib/profiles/webx.json"
printf -- '- **webx**: web fixture\n' > "$FX/home/.claude/lib/profiles/README.md"
cat > "$FX/bin/systemd-run" <<'EOT'
#!/usr/bin/env bash
while [ $# -gt 0 ]; do case "$1" in --*) shift ;; *) break ;; esac; done
echo "systemd-run" >> "$CC_LOG"; exec "$@"
EOT
cat > "$FX/bin/dtach" <<'EOT'
#!/usr/bin/env bash
while [ $# -gt 0 ]; do case "$1" in -c|-e) shift 2 ;; *) break ;; esac; done
echo "dtach" >> "$CC_LOG"; exec "$@"
EOT
cat > "$FX/bin/claude" <<'EOT'
#!/usr/bin/env bash
{ echo "claude argv: $*"; echo "CLAUDE_PROFILE=${CLAUDE_PROFILE-unset}"
echo "CLAUDE_PROFILE_SETTINGS=${CLAUDE_PROFILE_SETTINGS-unset}"
echo "TMPDIR=${TMPDIR-unset}"; echo "canary=${CC_ENV_CANARY-unset}"; } >> "$CC_LOG"
EOT
chmod +x "$FX/bin/"*
export CC_LOG="$FX/log" HOME="$FX/home"
PATH="$FX/bin:$PATH"
# shellcheck disable=SC1091
. "$FX/home/.claude/lib/cc.sh"
: > "$CC_LOG"; out="$(cc s1 nope 2>&1)"; rc=$?
check T1-unknown-rc "$rc" 2; check_has T1-unknown-msg "$out" "cc: unknown profile 'nope'"
check_has T1-unknown-list "$out" "webx"; check T1-no-session "$(cat "$CC_LOG")" ""
: > "$CC_LOG"; cc s2 webx; rc=$?; log="$(cat "$CC_LOG")"
check T2-rc "$rc" 0; check_has T2-chain "$log" "systemd-run"; check_has T2-dtach "$log" "dtach"
check_has T2-argv "$log" "claude argv: --settings $FX/home/.claude/lib/profiles/webx.json"
check_has T2-profile "$log" "CLAUDE_PROFILE=webx"
check_has T2-settings "$log" "CLAUDE_PROFILE_SETTINGS=$FX/home/.claude/lib/profiles/webx.json"
check_has T2-tmpdir "$log" "TMPDIR=$FX/home/.cache/claude-tmp"
check T2-tmpdir-exists "$([ -d "$FX/home/.cache/claude-tmp" ] && echo yes)" yes
: > "$CC_LOG"; cc s3; rc=$?; log="$(cat "$CC_LOG")"
check T3-rc "$rc" 0; check_has T3-argv "$log" "claude argv: "$'\n'
check_has T3-profile-empty "$log" "CLAUDE_PROFILE="$'\n'
check_has T3-tmpdir "$log" "TMPDIR=$FX/home/.cache/claude-tmp"
# name allowlist: a path-like name or profile starts no session
for args in "x ../y" "../x webx" "x web/x" "-x webx"; do
: > "$CC_LOG"
# shellcheck disable=SC2086
out="$(cc $args 2>&1)"; rc=$?
check "T6-rc-$args" "$rc" 2; check_has "T6-msg-$args" "$out" "cc: invalid"
check "T6-no-session-$args" "$(cat "$CC_LOG")" ""
done
printf 'CC_ENV_CANARY=1\n' > "$FX/home/.claude/.env"
: > "$CC_LOG"; cc s4 webx; check_has T4-env "$(cat "$CC_LOG")" "canary=1"
check T5-shellcheck "$(shellcheck "$ROOT/lib/cc.sh" >/dev/null 2>&1 && echo ok)" ok
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
+61 -137
View File
@@ -1,22 +1,16 @@
#!/usr/bin/env bash
# lib/tests/design-tool-gate.test.sh — hermetic suite for the 21st sign-in
# state added to lib/design-tool-gate.sh (contract 2026-09-28-21st-signin-
# gate-1215): a fake `21st` CLI on a fixture PATH drives every whoami answer
# (signed in / signed out / garbage / nonzero rc) through the real gate
# script, with HOME and PATH redirected into the fixture so the machine's
# real CLI is never reachable. A loud precondition proves that redirection
# actually holds before any case runs.
# lib/tests/design-tool-gate.test.sh — lib/design-tool-gate.sh reads
# `profile.sh current --plain` (fake, $WORK/plain.txt) and the 21st sign-in
# state (fake `21st`, FAKE_21ST_MODE). READY (0); a pack off + source=local →
# INCOMPLETE (10) with the profile.sh remedy; source=flag → relaunch remedy;
# no 21st CLI → 10 with the npm hint; signed out → 12; whoami garbage → 11;
# a token → READY without whoami; bad --plain → 2.
set -u
unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
GATE="$ROOT/lib/design-tool-gate.sh"
PASS=0; FAIL=0
ok() { echo "PASS $1"; PASS=$((PASS + 1)); }
bad() { echo "FAIL $1 — $2"; FAIL=$((FAIL + 1)); }
# Precondition, loud: the sanitized PATH below and ensure_21st_on_path()'s
# own probes must never resolve a REAL 21st — else CLI_ABSENT_10 (and every
# other case) would silently exercise this machine's CLI instead of the stub.
ok() { PASS=$((PASS+1)); echo "PASS $1"; }
bad() { FAIL=$((FAIL+1)); echo "FAIL $1 — $2"; }
if PATH=/usr/bin:/bin command -v 21st >/dev/null 2>&1 \
|| [ -e /usr/local/bin/21st ] || [ -e /opt/homebrew/bin/21st ]; then
echo "FAIL precondition: system-wide 21st present," \
@@ -25,132 +19,62 @@ if PATH=/usr/bin:/bin command -v 21st >/dev/null 2>&1 \
echo "PASS=$PASS FAIL=$FAIL"
exit 1
fi
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
mkdir -p "$WORK/repo/lib/profiles" "$WORK/repo/skills" "$WORK/bin" "$WORK/home"
# GATE-BLOCK allowlist: 21st (cli) always, ghost-skill (external) only used
# by INCOMPLETE_WINS to prove a blocking miss still trips the gate.
cat > "$WORK/repo/lib/profiles/design.profile" <<'EOF'
# GATE-BLOCK: 21st ghost-skill
21st cli
ghost-skill external
EOF
# Fake profile.sh: `show design --plain` cats whatever the case wrote to
# plain.txt. $WORK is read from the environment at run time (exported
# below), never baked in here — the heredoc is quoted on purpose.
cat > "$WORK/repo/lib/profile.sh" <<'EOF'
#!/usr/bin/env bash
[ "$1" = show ] && [ "$3" = --plain ] && { cat "$WORK/plain.txt"; exit 0; }
exit 1
EOF
chmod +x "$WORK/repo/lib/profile.sh"
export WORK
# Fake 21st CLI: `whoami` answers per $FAKE_21ST_MODE, the real CLI's exact
# sentences for in/out (proven by STUB_CONTROL below), a garbage line at
# rc 0, or the signed-out sentence at a nonzero rc (proves rc wins).
mkdir -p "$WORK/bin" "$WORK/home"; export WORK
export DESIGN_GATE_SKILLS_DIR="$WORK/none"
printf '#!/usr/bin/env bash\ncat "$WORK/plain.txt"\n' > "$WORK/bin/profile.sh"
cat > "$WORK/bin/21st" <<'EOF'
#!/usr/bin/env bash
[ "${1:-}" = whoami ] || exit 1
signedout='Not logged in. Run `21st login`, or set TWENTYFIRST_TOKEN.'
case "${FAKE_21ST_MODE:-in}" in
in) echo "Logged in as tester (saved locally)."; exit 0 ;;
out) echo "$signedout"; exit 0 ;;
garbage) echo "Something unexpected"; exit 0 ;;
fail) echo "$signedout"; exit 3 ;;
in) echo "Logged in as fake@example.com" ;; out) echo "Not logged in" ;;
garbage) echo "boom"; exit 3 ;;
esac
EOF
chmod +x "$WORK/bin/21st"
# gate_run <FAKE_21ST_MODE> <plain, \t and \n escapes> [PATH override]
# -> sets $GATE_OUT / $GATE_RC. TWENTYFIRST_TOKEN and API_KEY_21ST are
# always unset here; TOKEN_READY below sets them explicitly instead.
gate_run() {
local mode="$1" plain="$2" gate_path="${3:-$WORK/bin:/usr/bin:/bin}"
printf '%b\n' "$plain" > "$WORK/plain.txt"
GATE_OUT="$(env -u TWENTYFIRST_TOKEN -u API_KEY_21ST \
HOME="$WORK/home" PATH="$gate_path" \
DESIGN_GATE_REPO_OVERRIDE="$WORK/repo" \
DESIGN_GATE_PROFILE_SH="$WORK/repo/lib/profile.sh" \
FAKE_21ST_MODE="$mode" bash "$GATE" 2>&1)"
GATE_RC=$?
chmod +x "$WORK/bin/"*
plain() { # design gstack-design ui source profile
printf 'profile=%s\nsource=%s\nflag=-\npack-design=%s\npack-gstack-design=%s\nplugin:ui-ux-pro-max@ui-ux-pro-max-skill=%s\nmodel=-\n' \
"$5" "$4" "$1" "$2" "$3" > "$WORK/plain.txt"
}
# ── stub positive control ────────────────────────────────────────────────
if FAKE_21ST_MODE=in "$WORK/bin/21st" whoami | grep -q '^Logged in as ' \
&& FAKE_21ST_MODE=out "$WORK/bin/21st" whoami | grep -q '^Not logged in'
then ok STUB_CONTROL; else bad STUB_CONTROL "stub sentences wrong"; fi
# ── SIGNED_IN_READY: whoami says logged in -> exit 0, READY ────────────────
gate_run in 'cli\t21st'
if [ "$GATE_RC" -eq 0 ] && echo "$GATE_OUT" | grep -q 'toolchain: READY'; then
ok SIGNED_IN_READY
else
bad SIGNED_IN_READY "rc=$GATE_RC out=$GATE_OUT"
fi
# ── SIGNED_OUT_12: whoami says not logged in -> exit 12, ask to sign in ────
gate_run out 'cli\t21st'
if [ "$GATE_RC" -eq 12 ] && echo "$GATE_OUT" | grep -q 'SIGN-IN REQUIRED' \
&& echo "$GATE_OUT" | grep -q '21st login' \
&& ! echo "$GATE_OUT" | grep -q 'INCOMPLETE'; then
ok SIGNED_OUT_12
else
bad SIGNED_OUT_12 "rc=$GATE_RC out=$GATE_OUT"
fi
# ── TOKEN_READY: a token env wins even while whoami reports signed out ─────
printf 'cli\t21st\n' > "$WORK/plain.txt"
out_t="$(env HOME="$WORK/home" PATH="$WORK/bin:/usr/bin:/bin" \
DESIGN_GATE_REPO_OVERRIDE="$WORK/repo" \
DESIGN_GATE_PROFILE_SH="$WORK/repo/lib/profile.sh" \
FAKE_21ST_MODE=out TWENTYFIRST_TOKEN=x bash "$GATE" 2>&1)"; rc_t=$?
out_k="$(env HOME="$WORK/home" PATH="$WORK/bin:/usr/bin:/bin" \
DESIGN_GATE_REPO_OVERRIDE="$WORK/repo" \
DESIGN_GATE_PROFILE_SH="$WORK/repo/lib/profile.sh" \
FAKE_21ST_MODE=out API_KEY_21ST=x bash "$GATE" 2>&1)"; rc_k=$?
if [ "$rc_t" -eq 0 ] && [ "$rc_k" -eq 0 ]; then
ok TOKEN_READY
else
bad TOKEN_READY "TOKEN rc=$rc_t ($out_t) | API_KEY rc=$rc_k ($out_k)"
fi
# ── CLI_ABSENT_10: 21st off PATH -> exit 10, INCOMPLETE (not sign-in) ──────
gate_run in 'cli\t21st' /usr/bin:/bin
if [ "$GATE_RC" -eq 10 ] && echo "$GATE_OUT" | grep -q 'INCOMPLETE'; then
ok CLI_ABSENT_10
else
bad CLI_ABSENT_10 "rc=$GATE_RC out=$GATE_OUT"
fi
# ── INCOMPLETE_WINS: a blocking miss outranks a signed-out 21st ────────────
gate_run out 'cli\t21st\nexternal\tghost-skill'
if [ "$GATE_RC" -eq 10 ] && echo "$GATE_OUT" | grep -q 'INCOMPLETE' \
&& ! echo "$GATE_OUT" | grep -q 'SIGN-IN REQUIRED'; then
ok INCOMPLETE_WINS
else
bad INCOMPLETE_WINS "rc=$GATE_RC out=$GATE_OUT"
fi
# ── UNKNOWN_11: whoami answers something else -> surfaced, never guessed ───
gate_run garbage 'cli\t21st'
if [ "$GATE_RC" -eq 11 ] && echo "$GATE_OUT" | grep -q 'whoami: rc=0' \
&& echo "$GATE_OUT" | grep -q 'Something unexpected' \
&& ! echo "$GATE_OUT" | grep -q '21st login' \
&& ! echo "$GATE_OUT" | grep -q 'claude CLI unreachable'; then
ok UNKNOWN_11
else
bad UNKNOWN_11 "garbage: rc=$GATE_RC out=$GATE_OUT"
fi
gate_run fail 'cli\t21st'
if [ "$GATE_RC" -eq 11 ] && echo "$GATE_OUT" | grep -q 'whoami: rc=3'; then
ok UNKNOWN_11
else
bad UNKNOWN_11 "fail: rc=$GATE_RC out=$GATE_OUT"
fi
echo "PASS=$PASS FAIL=$FAIL"
[ "$FAIL" -eq 0 ]
gate_run() { # $1 mode, $2 PATH prefix ("" = no 21st)
local p="$2"; [ -n "$p" ] && p="$p:"
env -u TWENTYFIRST_TOKEN -u API_KEY_21ST HOME="$WORK/home" PATH="${p}/usr/bin:/bin" \
FAKE_21ST_MODE="$1" WORK="$WORK" DESIGN_GATE_PROFILE_SH="$WORK/bin/profile.sh" \
bash "$ROOT/lib/design-tool-gate.sh"
}
expect() { # name rc-want substring
if [ "$rc" = "$2" ] && case "$out" in *"$3"*) true;; *) false;; esac
then ok "$1"; else bad "$1" "rc=$rc out=[$out]"; fi
}
plain on on on local web; out="$(gate_run in "$WORK/bin")"; rc=$?
expect T1-ready 0 "READY — packs design + gstack-design + ui-ux-pro-max on (web)"
plain off on on local dev; out="$(gate_run in "$WORK/bin")"; rc=$?
expect T2-incomplete 10 "INCOMPLETE"; expect T2-remedy-local 10 "bash ~/.claude/lib/profile.sh set web"
expect T2-names 10 "off: pack-design"
expect T2-enable 10 "profile.sh enable design"
plain on off off flag dev; out="$(gate_run in "$WORK/bin")"; rc=$?
expect T3-remedy-flag 10 "relaunch this conversation with a design profile: cc <name> web"
expect T3-names 10 "off: pack-gstack-design plugin:ui-ux-pro-max@ui-ux-pro-max-skill"
plain on on off local web; out="$(gate_run in "$WORK/bin")"; rc=$?
expect T3a-plugin 10 "profile.sh enable ui-ux-pro-max@ui-ux-pro-max-skill"
plain on on on local web
mkdir -p "$WORK/repo/skills/pack-design/skills"
ln -s /nonexistent "$WORK/repo/skills/pack-design/skills/x"
out="$(DESIGN_GATE_SKILLS_DIR="$WORK/repo/skills" gate_run in "$WORK/bin")"
rc=$?
expect T3b-dangling 10 "not installed: pack-design:x (run make plugin)"
rm -r "$WORK/repo"
out="$(gate_run in "")"; rc=$?
expect T4-no-cli 10 "21st needs the CLI: npm i -g @21st-dev/cli then 21st login"
case "$out" in *"profile.sh set web"*) bad T4-no-remedy "pack remedy shown";; *) ok T4-no-remedy;; esac
out="$(gate_run out "$WORK/bin")"; rc=$?
expect T5-signed-out 12 "SIGN-IN REQUIRED"; expect T5-ask 12 "! 21st login"
out="$(gate_run garbage "$WORK/bin")"; rc=$?
expect T6-unverified 11 "READY BUT UNVERIFIED — 21st could not answer: whoami: rc=3 boom"
out="$(TWENTYFIRST_TOKEN=x FAKE_21ST_MODE=out HOME="$WORK/home" PATH="$WORK/bin:/usr/bin:/bin" WORK="$WORK" \
DESIGN_GATE_PROFILE_SH="$WORK/bin/profile.sh" bash "$ROOT/lib/design-tool-gate.sh")"; rc=$?
expect T7-token 0 "READY"
printf 'nonsense\n' > "$WORK/plain.txt"; out="$(gate_run in "$WORK/bin" 2>&1)"; rc=$?
expect T8-bad-plain 2 "design-gate: profile.sh current --plain gave no pack-design line"
if shellcheck "$ROOT/lib/design-tool-gate.sh" >/dev/null 2>&1; then ok T9-shellcheck; else bad T9-shellcheck findings; fi
if [ "$(LC_ALL=C awk 'length($0) > 80' "$ROOT/lib/design-tool-gate.sh" | wc -l | tr -d ' ')" = 0 ]; then ok T9-width; else bad T9-width "lines over 80"; fi
echo "PASS=$PASS FAIL=$FAIL"; [ "$FAIL" -eq 0 ]
+13 -61
View File
@@ -3,25 +3,20 @@
# check_vendored_skills(): a fixture repo under mktemp with a fake
# plugins.lock.json (single-path shape, list shape, dict shape with a
# references/ file), a fake link.sh holding a multi-line
# EXTERNAL_SKILLS=(...) array, a fake <claude_home>/skills dir and a fake
# profile file. Cases: every file present + linked (ALL_PRESENT), a
# EXTERNAL_SKILLS=(...) array and a fake <claude_home>/skills dir.
# Cases: every file present + linked (ALL_PRESENT), a
# list-shape skill missing its SKILL.md (FILE_MISSING), a dict-shape
# skill missing one of two files — only that file is named
# (DICT_FILES_COMPLETE), a profile-listed name with no symlink
# (DICT_FILES_COMPLETE), a linked name with no symlink
# (SYMLINK_MISSING_ACTIVE) or a symlink to the wrong target
# (SYMLINK_WRONG_TARGET), a name absent from the profile reported parked
# rather than failed (SYMLINK_PARKED), the same name treated as
# expected-linked (fail, not parked) when no profile file is passed at
# all (NO_PROFILE_EXPECTS_LINK), an unreadable lock file degrading to a
# (SYMLINK_WRONG_TARGET), an unreadable lock file degrading to a
# warn instead of a fail (LOCK_UNREADABLE, rc 0), a lock entry whose
# "skills" is neither null/list/dict degrading the same way with no
# Python traceback leaking (LOCK_MALFORMED_ENTRY, rc 0), the
# profile-name allowlist rejecting a path-traversal value
# (REJECTS_BAD_PROFILE_NAME), the item-name allowlist rejecting a
# item-name allowlist rejecting a
# link.sh entry with a ".." segment — warned and skipped, not failed
# (REJECTS_BAD_NAME), and an "always_on": true lock entry's name, absent
# from the profile and with no symlink, checked (and failed) instead of
# reported parked (ALWAYS_ON_LINK_CHECKED).
# (REJECTS_BAD_NAME), and an "always_on": true lock entry's name with no
# symlink failing like any other (ALWAYS_ON_LINK_CHECKED).
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
LIB="$ROOT/lib/doctor-vendored.sh"
@@ -52,8 +47,7 @@ cat > "$REPO/plugins.lock.json" <<'JSON'
"list-entry": {
"managed_by": "curl",
"skills": [
"missing-skill", "active-nolink-skill", "active-wronglink-skill",
"parked-skill", "noprofile-skill"
"missing-skill", "active-nolink-skill", "active-wronglink-skill"
]
},
"dict-entry": {
@@ -72,43 +66,28 @@ JSON
cat > "$REPO/link.sh" <<'SH'
#!/usr/bin/env bash
EXTERNAL_SKILLS=(ok-skill missing-skill dict-skill
active-nolink-skill active-wronglink-skill
parked-skill noprofile-skill always-on-skill)
active-nolink-skill active-wronglink-skill always-on-skill)
SH
# ── skills-external/ tree: every name's SKILL.md present, except
# missing-skill (nothing at all) and dict-skill's references/notes.md.
# always-on-skill has its SKILL.md too — only its symlink is missing.
for n in ok-skill dict-skill active-nolink-skill active-wronglink-skill \
parked-skill noprofile-skill always-on-skill; do
always-on-skill; do
mkdir -p "$REPO/skills-external/$n"
echo "v1" > "$REPO/skills-external/$n/SKILL.md"
done
# ── claude_home symlinks: ok-skill correct, active-wronglink-skill
# points elsewhere, active-nolink-skill, noprofile-skill and
# always-on-skill have none.
# points elsewhere, active-nolink-skill and always-on-skill have none.
ln -sf "$REPO/skills-external/ok-skill" "$CLAUDE_HOME/skills/ok-skill"
mkdir -p "$WORK/elsewhere"
ln -sf "$WORK/elsewhere" "$CLAUDE_HOME/skills/active-wronglink-skill"
# ── active.profile: lists everything EXCEPT parked-skill,
# noprofile-skill and always-on-skill (all three proven absent from it).
cat > "$REPO/active.profile" <<'PROF'
# DESC: fixture profile
ok-skill external
missing-skill external
dict-skill external
active-nolink-skill external
active-wronglink-skill external
PROF
# shellcheck source=../doctor-vendored.sh disable=SC1091
source "$LIB"
# ── With the active profile passed ──────────────────────────────────
out1="$(check_vendored_skills "$REPO" "$CLAUDE_HOME" \
"$REPO/active.profile" 2>&1)"
out1="$(check_vendored_skills "$REPO" "$CLAUDE_HOME" 2>&1)"
check_bool ALL_PRESENT \
"$(printf '%s' "$out1" | grep -qF 'ok-skill: vendored + linked' \
@@ -135,28 +114,9 @@ check_bool SYMLINK_WRONG_TARGET \
grep -qF 'active-wronglink-skill: symlink missing/wrong' \
&& echo 1 || echo 0)"
check_bool SYMLINK_PARKED \
"$(printf '%s' "$out1" | grep -qF 'parked-skill: parked by profile active' \
&& ! printf '%s' "$out1" | \
grep -qF 'parked-skill: symlink missing/wrong' \
&& echo 1 || echo 0)"
# ── always-on-skill: absent from active.profile (same as parked-skill)
# but its lock entry is "always_on": true — checked (and failed, no
# symlink) instead of reported parked.
check_bool ALWAYS_ON_LINK_CHECKED \
"$(printf '%s' "$out1" | \
grep -qF 'always-on-skill: symlink missing/wrong' \
&& ! printf '%s' "$out1" | \
grep -qF 'always-on-skill: parked by profile' \
&& echo 1 || echo 0)"
# ── No profile file passed at all: noprofile-skill (absent from
# active.profile, parked above) must now be treated as expected-linked.
out2="$(check_vendored_skills "$REPO" "$CLAUDE_HOME" 2>&1)"
check_bool NO_PROFILE_EXPECTS_LINK \
"$(printf '%s' "$out2" | \
grep -qF 'noprofile-skill: symlink missing/wrong' && echo 1 || echo 0)"
grep -qF 'always-on-skill: symlink missing/wrong' && echo 1 || echo 0)"
# ── LOCK_UNREADABLE — a second, minimal fixture with an invalid
# plugins.lock.json: check_vendored_skills degrades to a warn (not a
@@ -203,14 +163,6 @@ check_bool LOCK_MALFORMED_ENTRY \
&& ! printf '%s' "$out4" | grep -q 'Error:' \
&& echo 1 || echo 0)"
# ── REJECTS_BAD_PROFILE_NAME — the profile-name allowlist helper
# rejects a path-traversal value and accepts a plain one.
check_bool REJECTS_BAD_PROFILE_NAME \
"$( { _dv_valid_profile_name "full" \
&& ! _dv_valid_profile_name "../x" \
&& ! _dv_valid_profile_name "a/b" \
&& ! _dv_valid_profile_name "a.b"; } && echo 1 || echo 0)"
# ── REJECTS_BAD_NAME — a link.sh EXTERNAL_SKILLS entry with a ".."
# segment: warned and skipped, never reaches _dv_check_files/
# _dv_check_link (no fail line names it), rc 0.
+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/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/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
+31 -3
View File
@@ -8,6 +8,7 @@
# shellcheck disable=SC2015,SC2016 # A && ok || ko is deliberate (ok/ko never fail)
set -u
R="$(cd "$(dirname "$0")/../.." && pwd)"
skdir() { ls -d "$R"/skills/"$1" "$R"/skills/pack-*/skills/"$1" 2>/dev/null | head -1 | sed "s#^$R/##"; }
MOD="$R/mods/model-router"
RJ="$MOD/routing.json"
REG="$MOD/hooks/register.ts"
@@ -157,6 +158,33 @@ check_skill() {
while IFS= read -r f; do check_skill "$f"; done < <(
cd "$R" && git ls-files 'skills/*/SKILL.md' 'skills-external/*/SKILL.md')
# ── (b2) every skills row resolves to a skill (short, pack entry, parked) ─
# Parked: written by `21st skills install` (install-plugins.sh Step 8.7),
# in no pack, so absent from a fresh clone until that step ran.
PARKED=" 21st-registry 21st-design-sync "
ext_named() { # ext_named <k>: <k> is in link.sh EXTERNAL_SKILLS
sed -n '/^EXTERNAL_SKILLS=(/,/)/p' "$R/link.sh" | grep -qw -- "$1"
}
row_resolves() { # row_resolves <key>
local k="$1" n p
case "$k" in
pack-*:*) n="${k%%:*}"; p="$R/skills/$n/skills/${k#*:}"
[ -L "$p" ] || [ -e "$p/SKILL.md" ];;
*) case "$PARKED" in *" $k "*) return 0;; esac
[ -e "$R/skills/$k/SKILL.md" ] || ext_named "$k" \
|| [ -L "$R/skills/$k" ] || [ -n "$(skdir "$k")" ] \
|| [ -e "$R/skills-external/$k/SKILL.md" ];;
esac
}
[ -L "$R/skills/pack-seo/skills/seo" ] || [ -d "$R/skills/pack-seo/skills/seo" ] \
&& ! row_resolves ghost-skill \
&& ! row_resolves pack-seo:ghost && ! row_resolves pack-ghost:seo \
&& ok || ko "row_resolves: flip-test (ghost rows must fail)"
while read -r kind key _; do
[ "$kind" = skills ] || continue
row_resolves "$key" && ok || ko "routing.json: skills row '$key' resolves to no skill"
done <<< "$RD"
# ── (c) tracked agents with a row: tier floor == model:, effort == effort: ─
NO_ROW_AGENTS=" interviewer client-handover-writer "
check_agent() {
@@ -185,7 +213,7 @@ done
# ── (e) D3 wiring markers ────────────────────────────────────────────────
mark() { # mark <phase> <skills...>
local ph="$1" s; shift
for s in "$@"; do has "skills/$s/SKILL.md" "route(phase=\"$ph\")"; done
for s in "$@"; do has "$(skdir "$s")/SKILL.md" "route(phase=\"$ph\")"; done
}
mark orchestrate feat hotfix bugfix ship-feature init-project code-clean seo geo harden web-validate audit-delta
mark apply feat hotfix bugfix ship-feature init-project
@@ -194,7 +222,7 @@ mark plan ship-feature init-project onboard code-clean audit-delta
mark escalate ship-feature
[ "$(grep -o 'route(phase="escalate")' "$R/lib/verify-secure-loop.md" | wc -l)" -eq 3 ] \
&& ok || ko "verify-secure-loop.md: escalate route must appear 3 times"
for s in ship-feature init-project; do has "skills/$s/SKILL.md" 'effort="xhigh"'; done
for s in ship-feature init-project; do has "$(skdir "$s")/SKILL.md" 'effort="xhigh"'; done
has "skills/tour/SKILL.md" 'effort="xhigh"'
n_opus="$(grep -c 'model="opus",$' "$R/skills/onboard/SKILL.md")"
n_eff="$(grep -c 'effort="xhigh",$' "$R/skills/onboard/SKILL.md")"
@@ -203,7 +231,7 @@ n_eff="$(grep -c 'effort="xhigh",$' "$R/skills/onboard/SKILL.md")"
bad="$(grep 'model: "fable"' "$R/agents/client-handover-writer.md" | grep -vc 'effort="high"')"
[ "$bad" -eq 0 ] && ok || ko "client-handover-writer: $bad model: \"fable\" line(s) without effort=\"high\""
for s in ship-feature init-project feat bugfix web-validate seo hotfix geo harden code-clean audit-delta tour onboard; do
has "skills/$s/SKILL.md" 'ROUTING: follow $HOME/.claude/lib/effort-shift.md'
has "$(skdir "$s")/SKILL.md" 'ROUTING: follow $HOME/.claude/lib/effort-shift.md'
done
has "agents/client-handover-writer.md" 'ROUTING: follow $HOME/.claude/lib/effort-shift.md'
+1
View File
@@ -0,0 +1 @@
ls $HOME/.claude/skills/a2 skills-disabled/foo; bash lib/toggle-external.sh; cat .active-profile; lib/profiles/web.profile
-66
View File
@@ -1,66 +0,0 @@
#!/usr/bin/env bash
# lib/tests/gstack-removed.test.sh — GSTACK_REMOVED denylist honored by
# every "bring gstack back" path: profile.sh `gstack on` and
# toggle-external.sh `enable gstack` both skip a policy-removed name and
# leave it parked, restoring only what policy allows; gstack_is_removed()
# itself, positive + negative. Covers contract criterion 17. Hermetic:
# fixture repo via PROFILE_REPO_OVERRIDE / TOGGLE_EXTERNAL_REPO_OVERRIDE —
# same harness as lib/tests/profile-default.test.sh and
# lib/tests/toggle-external-repo-resolution.test.sh.
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
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; }
check_has() { case "$2" in *"$3"*) pass=$((pass+1));; *) fail=$((fail+1));
printf 'FAIL %s: [%s] does not contain [%s]\n' "$1" "$2" "$3";; esac; }
check_not() { case "$2" in *"$3"*) fail=$((fail+1));
printf 'FAIL %s: [%s] unexpectedly contains [%s]\n' "$1" "$2" "$3";; *) pass=$((pass+1));; esac; }
# mk_fixture <dir> — minimal repo: profile.sh + toggle-external.sh +
# gstack-removed.sh under lib/, one removed name (ship) and one kept name
# (browse) parked in skills-disabled/.
mk_fixture() {
local fx="$1"
mkdir -p "$fx/skills" "$fx/skills-disabled/gstack__ship" \
"$fx/skills-disabled/gstack__browse" "$fx/lib"
cp "$ROOT/lib/profile.sh" "$ROOT/lib/toggle-external.sh" \
"$ROOT/lib/gstack-removed.sh" "$fx/lib/"
}
# --- T1-T5: profile.sh gstack on restores browse, skips + parks ship ---
FX1="$(mktemp -d)"; mk_fixture "$FX1"
out="$(PROFILE_REPO_OVERRIDE="$FX1" bash "$FX1/lib/profile.sh" gstack on 2>&1)"
check T1-browse-restored "$([ -e "$FX1/skills/browse" ] && echo on || echo off)" on
check T2-ship-parked "$([ -e "$FX1/skills-disabled/gstack__ship" ] && echo p || echo n)" p
check T3-ship-not-live "$([ -e "$FX1/skills/ship" ] && echo on || echo off)" off
check_has T4-skip-names-ship "$out" "ship"
check_has T5-real-count "$out" "1 parked gstack skills restored"
rm -rf "$FX1"
# --- T6-T9: toggle-external.sh enable gstack — same skip + restore ---
FX2="$(mktemp -d)"; mk_fixture "$FX2"
out="$(TOGGLE_EXTERNAL_REPO_OVERRIDE="$FX2" bash "$FX2/lib/toggle-external.sh" enable gstack 2>&1)"
check T6-browse-restored "$([ -e "$FX2/skills/browse" ] && echo on || echo off)" on
check T7-ship-parked "$([ -e "$FX2/skills-disabled/gstack__ship" ] && echo p || echo n)" p
check T8-ship-not-live "$([ -e "$FX2/skills/ship" ] && echo on || echo off)" off
check_has T9-skip-names-ship "$out" "ship"
rm -rf "$FX2"
# --- T10-T11: toggle-external.sh, only removed names parked — 0 restored,
# the policy message fires instead of the "re-run gstack setup" hint ---
FX3="$(mktemp -d)"
mkdir -p "$FX3/skills" "$FX3/skills-disabled/gstack__ship" "$FX3/lib"
cp "$ROOT/lib/toggle-external.sh" "$ROOT/lib/gstack-removed.sh" "$FX3/lib/"
out="$(TOGGLE_EXTERNAL_REPO_OVERRIDE="$FX3" bash "$FX3/lib/toggle-external.sh" enable gstack 2>&1)"
check_has T10-policy-msg "$out" "policy-removed skills remain parked"
check_not T11-no-setup-hint "$out" "re-run gstack setup"
rm -rf "$FX3"
# --- T12-T13: gstack_is_removed() itself, positive + negative ---
# shellcheck source=lib/gstack-removed.sh disable=SC1091
source "$ROOT/lib/gstack-removed.sh"
gstack_is_removed ship; check T12-removed-positive "$?" 0
gstack_is_removed browse; check T13-removed-negative "$?" 1
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
+2 -162
View File
@@ -2,9 +2,7 @@
# lib/tests/higgsfield.test.sh — hermetic suite for the Higgsfield pack.
# sync lib/higgsfield-skills.sh against a local git repo shaped like
# upstream (no network), and its CLI probes against a fake CLI
# toggle lib/toggle-external.sh `higgsfield` / `higgsfield-websites`
# against a fixture tree, fake CLIs first on PATH
# wiring static locks on the installers (order, off by default)
# wiring static locks on the installers (order)
# Each named case prints one `PASS <NAME>` or `FAIL <NAME>:<details>` line.
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
@@ -111,7 +109,7 @@ probe() {
# ── sync ────────────────────────────────────────────────────
UP="$WORK/upstream"; mk_upstream "$UP"
# The repo path carries a space on purpose: every expansion must be quoted.
R1="$WORK/r 1"; mkdir -p "$R1/skills" "$R1/skills-disabled"
R1="$WORK/r 1"; mkdir -p "$R1/skills"
EXT="$R1/skills-external"
expect fixture "$(yn test -f "$UP/.git/HEAD")" yes
@@ -137,16 +135,6 @@ expect stale-out "$(yn test -e "$EXT/higgsfield-generate/old.md")" no
expect new-in "$(yn test -f "$EXT/higgsfield-generate/new.md")" yes
verdict SYNC_REFRESH_DROPS_STALE
ln -s "$EXT/higgsfield-soul-id" "$R1/skills-disabled/higgsfield-soul-id"
ln -s "$EXT/higgsfield-generate" "$R1/skills/higgsfield-generate"
expect rc-count "$(sync_into "$R1")" "0:3"
expect parked-link "$(yn test -L "$R1/skills-disabled/higgsfield-soul-id")" yes
expect parked-reads \
"$(yn test -f "$R1/skills-disabled/higgsfield-soul-id/SKILL.md")" yes
expect not-enabled "$(yn test -e "$R1/skills/higgsfield-soul-id")" no
expect live-reads "$(yn test -f "$R1/skills/higgsfield-generate/SKILL.md")" yes
verdict SYNC_KEEPS_PARKED
BARE="$WORK/bare-upstream"; mkdir -p "$BARE"; echo "x" > "$BARE/README.md"
git_q "$BARE" init; git_q "$BARE" add -A; git_q "$BARE" commit -m fixture
expect no-repo "$(sync_into "$R1" "$WORK/no-such-repo")" "1:0"
@@ -171,158 +159,10 @@ chmod +x "$GT/gtimeout"
expect gtimeout "$(probe "$BIN:$GT:$CLEAN" higgsfield_signed_in)" "rc=0"
verdict PROBES_SILENT
# ── toggle ──────────────────────────────────────────────────
# mk_toggle_fx <dir> [skill...] — fixture repo: the toggle script plus one
# skills-external source per named skill (none → installed-nothing tree).
mk_toggle_fx() {
local fx="$1" s; shift
mkdir -p "$fx/lib" "$fx/skills"
cp "$ROOT/lib/toggle-external.sh" "$ROOT/lib/gstack-removed.sh" "$fx/lib/"
for s in "$@"; do
mkdir -p "$fx/skills-external/$s"
echo "---" > "$fx/skills-external/$s/SKILL.md"
done
}
PACK=(higgsfield-generate higgsfield-soul-id higgsfield-websites)
# tog <fixture> <args...> — run the fixture's toggle script, fake CLIs first.
tog() {
local fx="$1"; shift
TOGGLE_EXTERNAL_REPO_OVERRIDE="$fx" PATH="$BIN:$PATH" \
bash "$fx/lib/toggle-external.sh" "$@" 2>&1
}
# list_row <fixture> <tool> — the status column of `list` for one tool.
list_row() { tog "$1" list | awk -v t="$2" '$1 == t { print $2 }'; }
F0="$WORK/f0"; mk_toggle_fx "$F0"
F1="$WORK/f1"; mk_toggle_fx "$F1" "${PACK[@]}"
expect pack-missing "$(tog "$F0" status higgsfield)" missing
expect web-missing "$(tog "$F0" status higgsfield-websites)" missing
expect pack-disabled "$(tog "$F1" status higgsfield)" disabled
expect web-disabled "$(tog "$F1" status higgsfield-websites)" disabled
ln -s "$F1/skills-external/higgsfield-generate" "$F1/skills/higgsfield-generate"
expect pack-partial "$(tog "$F1" status higgsfield)" enabled
expect web-apart "$(tog "$F1" status higgsfield-websites)" disabled
expect list-pack "$(list_row "$F1" higgsfield)" enabled
expect list-web "$(list_row "$F1" higgsfield-websites)" disabled
verdict STATUS_STATES
F2="$WORK/f2"; mk_toggle_fx "$F2" "${PACK[@]}"
out="$(tog "$F2" enable higgsfield)"; rc=$?
expect rc "$rc" 0
expect generate "$(readlink "$F2/skills/higgsfield-generate")" \
"$F2/skills-external/higgsfield-generate"
expect soul-id "$(readlink "$F2/skills/higgsfield-soul-id")" \
"$F2/skills-external/higgsfield-soul-id"
expect no-websites "$(yn test -e "$F2/skills/higgsfield-websites")" no
expect_has count "$out" "higgsfield enabled (2 skills: 0 restored, 2 linked)"
out="$(tog "$F2" enable higgsfield)"; rc=$?
expect again-rc "$rc" 0
expect_has again "$out" "higgsfield already enabled"
verdict ENABLE_PACK_EXCLUDES_WEBSITES
# The media pack is an allowlist: a synced skill nobody listed is reported,
# never linked; neither is a listed name whose directory holds no SKILL.md.
F8="$WORK/f 8"; mk_toggle_fx "$F8" "${PACK[@]}" higgsfield-newcomer
mkdir -p "$F8/skills-external/higgsfield-brandkit" \
"$F8/skills-external/higgsfield-noskill"
out="$(tog "$F8" enable higgsfield)"; rc=$?
expect rc "$rc" 0
expect_has count "$out" "higgsfield enabled (2 skills: 0 restored, 2 linked)"
expect newcomer-off "$(yn test -e "$F8/skills/higgsfield-newcomer")" no
expect brandkit-off "$(yn test -e "$F8/skills/higgsfield-brandkit")" no
expect_has reported "$out" "higgsfield-newcomer"
expect_not noskill-quiet "$out" "higgsfield-noskill"
expect links "$(entries "$F8/skills")" 2
# Enabled is the steady state: a re-run must still name the drift.
out="$(tog "$F8" enable higgsfield)"; rc=$?
expect again-rc "$rc" 0
expect_has again-state "$out" "higgsfield already enabled"
expect_has again-reported "$out" "higgsfield-newcomer"
verdict UNLISTED_NOT_LINKED
F3="$WORK/f3"; mk_toggle_fx "$F3" "${PACK[@]}"
out="$(tog "$F3" enable higgsfield-websites)"; rc=$?
expect rc "$rc" 0
expect link "$(readlink "$F3/skills/higgsfield-websites")" \
"$F3/skills-external/higgsfield-websites"
expect no-generate "$(yn test -e "$F3/skills/higgsfield-generate")" no
expect pack-status "$(tog "$F3" status higgsfield)" disabled
expect web-status "$(tog "$F3" status higgsfield-websites)" enabled
tog "$F3" disable higgsfield-websites >/dev/null
out="$(FAKE_HF_SESSION=out tog "$F3" enable higgsfield-websites)"; rc=$?
expect hint-rc "$rc" 0
expect_has web-hint "$out" "higgsfield auth login"
verdict ENABLE_WEBSITES_ALONE
# Continues on F2: the pack is enabled, websites is not.
tog "$F2" enable higgsfield-websites >/dev/null
out="$(tog "$F2" disable higgsfield)"; rc=$?
expect rc "$rc" 0
expect_has msg "$out" "higgsfield disabled (2 skills parked)"
expect parked "$(yn test -L "$F2/skills-disabled/higgsfield-generate")" yes
expect unlinked "$(yn test -e "$F2/skills/higgsfield-generate")" no
expect web-untouched "$(yn test -e "$F2/skills/higgsfield-websites")" yes
out="$(tog "$F2" enable higgsfield)"
expect_has restored "$out" "2 restored, 0 linked"
tog "$F2" disable higgsfield-websites >/dev/null
expect web-parked "$(yn test -L "$F2/skills-disabled/higgsfield-websites")" yes
expect pack-on "$(tog "$F2" status higgsfield)" enabled
verdict DISABLE_PARKS
F4="$WORK/f4"; mk_toggle_fx "$F4" "${PACK[@]}"
out="$(FAKE_HF_SESSION=out tog "$F4" enable higgsfield)"; rc=$?
expect out-rc "$rc" 0
expect out-linked "$(yn test -e "$F4/skills/higgsfield-generate")" yes
expect_has out-hint "$out" "higgsfield auth login"
F5="$WORK/f5"; mk_toggle_fx "$F5" "${PACK[@]}"
out="$(FAKE_HF_SESSION=in tog "$F5" enable higgsfield)"
expect_not in-quiet "$out" "auth login"
expect_not in-no-token "$out" "fixture-token"
F6="$WORK/f6"; mk_toggle_fx "$F6" "${PACK[@]}"
out="$(TOGGLE_EXTERNAL_REPO_OVERRIDE="$F6" PATH="$CLEAN" \
bash "$F6/lib/toggle-external.sh" enable higgsfield 2>&1)"; rc=$?
expect absent-rc "$rc" 0
expect absent-linked "$(yn test -e "$F6/skills/higgsfield-generate")" yes
expect_has absent-hint "$out" "not on PATH"
F9="$WORK/f9"; mk_toggle_fx "$F9" "${PACK[@]}"
out="$(FAKE_HF_BINARY=missing tog "$F9" enable higgsfield)"; rc=$?
expect shim-rc "$rc" 0
expect_has shim-hint "$out" "does not answer"
expect_not shim-not-login "$out" "auth login"
verdict SIGNED_OUT_WARNS
out="$(tog "$F0" enable higgsfield)"; rc=$?
expect pack-rc "$rc" 1
expect_has pack-path "$out" "$F0/skills-external"
out="$(tog "$F0" enable higgsfield-websites)"; rc=$?
expect web-rc "$rc" 1
expect_has web-path "$out" "$F0/skills-external/higgsfield-websites"
verdict ENABLE_MISSING_ERRS
# The pack arms are shared with 21st: its behaviour must not move.
F7="$WORK/f7"; mk_toggle_fx "$F7" 21st-one 21st-two
expect off "$(tog "$F7" status 21st)" disabled
out="$(tog "$F7" enable 21st)"
expect_has on "$out" "21st enabled (2 skills: 0 restored, 2 linked)"
expect_not quiet "$out" "21st login"
expect hf-apart "$(tog "$F7" status higgsfield)" missing
out="$(tog "$F7" disable 21st)"
expect_has parked "$out" "21st disabled (2 skills parked)"
verdict PACK_21ST_UNCHANGED
# ── wiring ──────────────────────────────────────────────────
# count <file> <fixed string> — matching lines (0 when none).
count() { grep -cF -- "$2" "$ROOT/$1"; }
# Positive control first: the pattern does bite on a line that carries it.
expect control "$(echo 'higgsfield-x external' | grep -cF higgsfield)" 1
expect link-sh "$(count link.sh higgsfield)" 0
expect profile-sh "$(count lib/profile.sh higgsfield)" 0
expect profiles \
"$(cat "$ROOT"/lib/profiles/*.profile | grep -cF higgsfield)" 0
verdict OFF_BY_DEFAULT_WIRING
# ln_first / ln_last <file> <fixed string> — line number of a match.
ln_first() { grep -nF -- "$2" "$ROOT/$1" | head -1 | cut -d: -f1; }
ln_last() { grep -nF -- "$2" "$ROOT/$1" | tail -1 | cut -d: -f1; }
+17 -16
View File
@@ -2,6 +2,7 @@
# lib/tests/model-routing.test.sh — census: gate wiring + pins + executor shape (BDR-066, BDR-076)
set -u
R="$(cd "$(dirname "$0")/../.." && pwd)"
skdir() { ls -d "$R"/skills/"$1" "$R"/skills/pack-*/skills/"$1" 2>/dev/null | head -1 | sed "s#^$R/##"; }
pass=0; fail=0
ok() { pass=$((pass+1)); }
ko() { fail=$((fail+1)); printf 'FAIL %s\n' "$1"; }
@@ -11,11 +12,11 @@ fm_lacks() { if awk 'NR<=10' "$R/$1" | grep -qF "$2"; then ko "$1 frontmatter mu
# 1) gate wired in the 17 reflection skills (orchestrators, /analyze, /guardrails, /a11y)
for s in ship-feature init-project feat bugfix onboard seo geo web-validate harden audit-delta tour code-clean hotfix client-handover analyze guardrails a11y; do
has "skills/$s/SKILL.md" 'lib/model-gate.md'
has "$(skdir "$s")/SKILL.md" 'lib/model-gate.md'
done
# 2) gate NOT wired in the pure-execution/read-only skills (exclusion list)
for s in commit-change doc status release-candidate refactor; do
lacks "skills/$s/SKILL.md" 'lib/model-gate.md'
lacks "$(skdir "$s")/SKILL.md" 'lib/model-gate.md'
done
# 3) executor + gate pins
has "agents/feater.md" 'model: sonnet'
@@ -31,7 +32,7 @@ lacks "agents/feater.md" 'AskUserQuestion'
has "skills/ship-feature/SKILL.md" 'model: "sonnet"'
has "skills/init-project/SKILL.md" 'model: "sonnet"'
# 6) web-validate applies via L1 applier
has "skills/web-validate/SKILL.md" 'subagent_type="hotfixer"'
has "skills/pack-web-validate/skills/web-validate/SKILL.md" 'subagent_type="hotfixer"'
# 7) wave-2 — pure-execution skills dispatch their agent (pin takes effect, off the big session model)
has "skills/doc/SKILL.md" 'subagent_type="doc-syncer"'
has "skills/status/SKILL.md" 'subagent_type="status-reporter"'
@@ -105,9 +106,9 @@ lacks "agents/plugin-advisor.md" 'PHASE 1 — DETECT'
has "lib/plugin-gate.md" 'subagent_type="plugin-probe"'
has "lib/plugin-gate.md" 'subagent_type="plugin-advisor"'
for s in plugin-check onboard init-project ship-feature; do
has "skills/$s/SKILL.md" 'lib/plugin-gate.md'
has "$(skdir "$s")/SKILL.md" 'lib/plugin-gate.md'
# shellcheck disable=SC2016 # literal $HOME wanted: matching the exact inline-load string
lacks "skills/$s/SKILL.md" 'Load `$HOME/.claude/agents/plugin-advisor.md`'
lacks "$(skdir "$s")/SKILL.md" 'Load `$HOME/.claude/agents/plugin-advisor.md`'
done
# 14) BDR-077 W2/S2 — doc pipeline: ONE agent, TWO modes around the
# dispatcher's gate (audit = opus via call-site override — documented
@@ -124,10 +125,10 @@ has "skills/doc/SKILL.md" 'model="opus"'
has "skills/doc/SKILL.md" 'MODE: patch'
lacks "agents/scaffolder.md" 'INLINE-LOAD'
for s in bugfix hotfix feat ship-feature init-project; do
has "skills/$s/SKILL.md" 'MODE: audit'
has "skills/$s/SKILL.md" 'doc-syncer", model="opus"'
has "$(skdir "$s")/SKILL.md" 'MODE: audit'
has "$(skdir "$s")/SKILL.md" 'doc-syncer", model="opus"'
# shellcheck disable=SC2016 # literal $HOME wanted: matching the exact inline-load string
lacks "skills/$s/SKILL.md" 'Load `$HOME/.claude/agents/doc-syncer.md`'
lacks "$(skdir "$s")/SKILL.md" 'Load `$HOME/.claude/agents/doc-syncer.md`'
done
# 15) BDR-077 W2 — last inline execution converted: scaffolder + onboarder
# are DISPATCHED (pins live); their gates/arbitration stay in the
@@ -166,14 +167,14 @@ has "agents/geo-analyzer.md" 'MODE: collect'
has "agents/geo-analyzer.md" 'MODE: judge'
has "agents/geo-analyzer.md" 'MODE: template'
has "agents/geo-analyzer.md" 'COLLECTION COMPLETE'
has "skills/seo/SKILL.md" 'MODE: collect'
has "skills/seo/SKILL.md" 'seo-analyzer", model="sonnet"'
has "skills/seo/SKILL.md" 'never re-derive a score'
has "skills/seo/SKILL.md" 'DISPATCHER ERROR CONTRACT'
has "skills/geo/SKILL.md" 'MODE: collect'
has "skills/geo/SKILL.md" 'geo-analyzer", model="sonnet"'
has "skills/geo/SKILL.md" 'ERROR CONTRACT'
has "skills/geo/SKILL.md" 'never re-derive a score'
has "skills/pack-seo/skills/seo/SKILL.md" 'MODE: collect'
has "skills/pack-seo/skills/seo/SKILL.md" 'seo-analyzer", model="sonnet"'
has "skills/pack-seo/skills/seo/SKILL.md" 'never re-derive a score'
has "skills/pack-seo/skills/seo/SKILL.md" 'DISPATCHER ERROR CONTRACT'
has "skills/pack-seo/skills/geo/SKILL.md" 'MODE: collect'
has "skills/pack-seo/skills/geo/SKILL.md" 'geo-analyzer", model="sonnet"'
has "skills/pack-seo/skills/geo/SKILL.md" 'ERROR CONTRACT'
has "skills/pack-seo/skills/geo/SKILL.md" 'never re-derive a score'
has "agents/handover-doc-writer.md" 'SYNTH REPORT'
printf 'model-routing census: %d pass, %d fail\n' "$pass" "$fail"
+114
View File
@@ -0,0 +1,114 @@
#!/usr/bin/env bash
# lib/tests/pack-census.test.sh — lib/pack-census.sh: pack layout (manifest
# name = folder, entries resolve, no skill twice, retired gstack names absent),
# fragment invariants (same key set, fixed values, deny set, full = manifest
# defaults), old-layout citers. Fixture cases, then the hermetic part of the
# census on the real repo (dangling targets are WARN without --installed).
set -u
unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
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; }
check_has() { case "$2" in *"$3"*) pass=$((pass+1));; *) fail=$((fail+1));
printf 'FAIL %s: [%s] does not contain [%s]\n' "$1" "$2" "$3";; esac; }
FX="$(mktemp -d)"; trap 'rm -rf "$FX"' EXIT
mkdir -p "$FX/lib/profiles" "$FX/hooks" "$FX/skills/core-a"; touch "$FX/skills/core-a/SKILL.md"
printf 'gs-dead\n' > "$FX/lib/gstack-removed.list"
mk_pack() { # name defaultEnabled skill...
local n="$1" d="$2"; shift 2
mkdir -p "$FX/skills/pack-$n/.claude-plugin" "$FX/skills/pack-$n/skills"
printf '{"name":"pack-%s","version":"1.0.0","defaultEnabled":%s}\n' "$n" "$d" \
> "$FX/skills/pack-$n/.claude-plugin/plugin.json"
for s in "$@"; do mkdir -p "$FX/skills-external/$s"; touch "$FX/skills-external/$s/SKILL.md"
ln -s "../../../skills-external/$s" "$FX/skills/pack-$n/skills/$s"; done
}
mk_pack alpha true a1 a2
mk_pack beta false b1
frag() { # name alpha beta deny(yes|no) — the two real connector names
local d=""; [ "$4" = yes ] && d=', "deniedMcpServers": [{"serverName": "claude.ai higgsfield"}, {"serverName": "claude.ai Higgsfield AI"}]'
printf '{"enabledPlugins": {"model-router@skills-dir": true, "pack-alpha@skills-dir": %s, "pack-beta@skills-dir": %s, "security-guidance@claude-code-plugins": true, "example-skills@anthropic-agent-skills": false, "brightdata-plugin@synced": false}%s}\n' \
"$2" "$3" "$d" > "$FX/lib/profiles/$1.json"; }
frag full true false no; frag dev false false yes
census() { bash "$ROOT/lib/pack-census.sh" --repo "$FX" "$@" 2>&1; }
out="$(census)"; rc=$?
check T1-green-rc "$rc" 0; check_has T1-green "$out" "PACKS OK 2 packs 3 skills"
rm -r "$FX/skills-external/b1"
out="$(census)"; rc=$?
check T2-off-dangling-rc "$rc" 0; check_has T2-off-dangling "$out" "WARN pack-beta: b1 target missing"
rm -r "$FX/skills-external/a2"
out="$(census)"; rc=$?
check T3-on-dangling-test-rc "$rc" 0; check_has T3-on-dangling-test "$out" "WARN pack-alpha: a2 target missing"
out="$(census --installed)"; rc=$?
check T3-on-dangling-doctor-rc "$rc" 1; check_has T3-on-dangling-doctor "$out" "RED pack-alpha: a2 target missing (pack ON)"
mkdir -p "$FX/skills-external/a2" "$FX/skills-external/b1"; touch "$FX/skills-external/a2/SKILL.md" "$FX/skills-external/b1/SKILL.md"
sed -i.bak 's/"pack-alpha"/"pack-alpho"/' "$FX/skills/pack-alpha/.claude-plugin/plugin.json"
out="$(census)"; rc=$?
check T4-name-rc "$rc" 1; check_has T4-name "$out" "RED pack-alpha: manifest name is pack-alpho"
mv "$FX/skills/pack-alpha/.claude-plugin/plugin.json.bak" "$FX/skills/pack-alpha/.claude-plugin/plugin.json"
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; 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=$?
check T6-retired-rc "$rc" 1; check_has T6-retired "$out" "RED pack-alpha: gs-dead is a retired gstack skill"
rm "$FX/skills/pack-alpha/skills/gs-dead"
mv "$FX/lib/gstack-removed.list" "$FX/lib/gstack-removed.list.off"
out="$(census)"; rc=$?
check T6-nolist-rc "$rc" 1; check_has T6-nolist "$out" "RED lib/gstack-removed.list missing"
mv "$FX/lib/gstack-removed.list.off" "$FX/lib/gstack-removed.list"
printf 'Read ~/.claude/skills/a1/SKILL.md\n' > "$FX/hooks/x.sh"
cp "$ROOT/lib/tests/fixtures/pack-census-old-citers.sh" "$FX/hooks/y.sh" # the old-layout terms live in a fixture, not in this file (the census scans lib/tests/)
out="$(census)"; rc=$?
check T7-citer-rc "$rc" 1
check_has T7-citer-tilde "$out" "RED hooks/x.sh cites ~/.claude/skills/a1"
check_has T7-citer-home "$out" "RED hooks/y.sh cites \$HOME/.claude/skills/a2"
check_has T7-citer-disabled "$out" "RED hooks/y.sh cites skills-disable""d/"
check_has T7-citer-toggle "$out" "RED hooks/y.sh cites toggle-externa""l"
check_has T7-citer-active "$out" "RED hooks/y.sh cites .active-profil""e"
check_has T7-citer-profile "$out" "RED hooks/y.sh cites lib/profiles/web.profil""e"
rm "$FX/hooks/x.sh" "$FX/hooks/y.sh"
# fragment invariants
printf '{"enabledPlugins": {"model-router@skills-dir": true, "pack-alpha@skills-dir": true}}\n' > "$FX/lib/profiles/short.json"
out="$(census)"; rc=$?
check T8-keyset-rc "$rc" 1; check_has T8-keyset "$out" "RED lib/profiles/short.json: key set differs from full.json"
rm "$FX/lib/profiles/short.json"
frag full true true no
out="$(census)"; rc=$?
check T9-full-defaults-rc "$rc" 1; check_has T9-full-defaults "$out" "RED lib/profiles/full.json: pack-beta@skills-dir is true but the manifest default is false"
frag full true false no
sed -i.bak 's/"security-guidance@claude-code-plugins": true/"security-guidance@claude-code-plugins": false/' "$FX/lib/profiles/dev.json"
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"
check T12-shellcheck "$(shellcheck "$ROOT/lib/pack-census.sh" >/dev/null 2>&1 && echo ok)" ok
check T12-width "$(LC_ALL=C awk 'length($0) > 80' "$ROOT/lib/pack-census.sh" | wc -l | tr -d ' ')" 0
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
+3 -2
View File
@@ -5,6 +5,7 @@
# adversarial behavior needs a live model (manual smoke), not a CI gate.
set -u
R="$(cd "$(dirname "$0")/../.." && pwd)"
skdir() { ls -d "$R"/skills/"$1" "$R"/skills/pack-*/skills/"$1" 2>/dev/null | head -1 | sed "s#^$R/##"; }
pass=0; fail=0
ok() { pass=$((pass+1)); }
ko() { fail=$((fail+1)); printf 'FAIL %s\n' "$1"; }
@@ -41,8 +42,8 @@ has "$L" "fix-bundle"
# 3) every reflection orchestrator wires the phase + carries a challenge summary
# (hotfix wires it under a logic-only guard — STEP 1.8)
for s in ship-feature init-project feat bugfix hotfix onboard audit-delta code-clean seo geo harden web-validate; do
has "skills/$s/SKILL.md" "lib/challenge-plan.md"
has "skills/$s/SKILL.md" "CHALLENGE SUMMARY"
has "$(skdir "$s")/SKILL.md" "lib/challenge-plan.md"
has "$(skdir "$s")/SKILL.md" "CHALLENGE SUMMARY"
done
printf 'plan-challenge structure lock: %d pass, %d fail\n' "$pass" "$fail"
-193
View File
@@ -1,193 +0,0 @@
#!/usr/bin/env bash
# lib/tests/profile-census.test.sh — profile catalog invariants (skill-
# catalog prune, 2026-09-28): no GSTACK_REMOVED name listed in any
# profile, exactly one profile carries the `# SUPERSET-OF: full` marker
# and it is a superset of full + the parked tools + every name any
# profile carries, and `full` carries every name any other (non-max)
# profile carries save one named exception (pr-review-toolkit).
#
# Hermetic: a passing baseline fixture, then one single-change mutant per
# invariant (each mutant is a positive control — it MUST be detected).
# Live part runs against this repo's real lib/profiles/ (a violation
# there fails the suite for real, same style as
# lib/tests/skill-routing-census.test.sh).
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
# shellcheck source=lib/gstack-removed.sh disable=SC1091
source "$ROOT/lib/gstack-removed.sh"
# Parked = kept installed, out of `full`, listed only in the superset
# profile (`max`). Names come from the single denylist above for REMOVED;
# PARKED has no such shared source (it is a positive allowlist, not a
# denylist), so it is spelled out here.
PARKED=(make-pdf diagram 21st-ai 21st-ui-explore 21st-ui-review)
# full carries every name any other (non-max) profile carries, with one
# named exception: pr-review-toolkit is deliberately out of full (audit
# 2026-07-02 #12, heaviest single plugin, ~2.2k tokens/session, PR-only
# use) — measured 2026-09-28: it is the only name any specialized
# profile carries that full lacks (audit.profile).
FULL_EXCEPTIONS=(pr-review-toolkit)
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; }
# census_check <profiles_dir> [parked_csv] [exceptions_csv] — one
# violation code per line on stdout, rc 0 iff none. REMOVED always comes
# from the sourced denylist (single source, never overridden);
# PARKED/FULL_EXCEPTIONS default to the real production sets and can be
# overridden per call (fixture runs use a small standalone catalog).
census_check() {
local dir="$1"
# Unset (arg omitted, live call) falls back to the real production
# set; an explicitly EMPTY string (fixture calls) means "none" and
# must stay empty — hence "-" defaults, never ":-" (which would treat
# empty the same as unset and silently pull the real set back in).
local parked_csv="${2-$(IFS=,; echo "${PARKED[*]}")}"
local exc_csv="${3-$(IFS=,; echo "${FULL_EXCEPTIONS[*]}")}"
local removed_csv out
removed_csv="$(IFS=,; echo "${GSTACK_REMOVED[*]}")"
out=$(python3 - "$dir" "$removed_csv" "$parked_csv" "$exc_csv" <<'PY'
import glob, os, re, sys
def entries(path):
"""Entry = first whitespace token of a non-blank, non-comment line."""
names = set()
for line in open(path, encoding="utf-8"):
s = line.strip()
if s and not s.startswith("#"):
names.add(s.split()[0])
return names
def has_marker(path):
text = open(path, encoding="utf-8").read()
return re.search(r'^# SUPERSET-OF: full\s*$', text, re.M) is not None
def check_removed(by_name, removed):
return [f"REMOVED_LISTED:{n}:{e}" for n, ents in by_name.items()
for e in sorted(ents & removed)]
def find_superset(files):
hits = [p for p in files if has_marker(p)]
if not hits:
return None, ["NO_SUPERSET"]
if len(hits) > 1:
return None, ["MANY_SUPERSETS"]
return os.path.basename(hits[0])[:-len(".profile")], []
def check_superset_gap(by_name, sname, parked, exceptions):
full = by_name.get("full", set())
target = full | parked | exceptions
return [f"SUPERSET_GAP:{n}" for n in sorted(target - by_name[sname])]
def check_max_gap(by_name, sname, removed):
union = set().union(*by_name.values())
gap = (union - removed) - by_name[sname]
return [f"MAX_GAP:{n}" for n in sorted(gap)]
def check_full_gap(by_name, sname, removed, exceptions):
trio = {"21st-ai", "21st-ui-explore", "21st-ui-review"}
src = set().union(*(e for n, e in by_name.items()
if n not in ("full", sname)))
full = by_name.get("full", set())
gap = src - full - removed - trio - exceptions
return [f"FULL_GAP:{n}" for n in sorted(gap)]
def main():
d, removed_csv, parked_csv, exc_csv = sys.argv[1:5]
removed = {x for x in removed_csv.split(",") if x}
parked = {x for x in parked_csv.split(",") if x}
exceptions = {x for x in exc_csv.split(",") if x}
files = sorted(glob.glob(os.path.join(d, "*.profile")))
by_name = {os.path.basename(p)[:-len(".profile")]: entries(p)
for p in files}
violations = check_removed(by_name, removed)
sname, sup_violations = find_superset(files)
violations += sup_violations
if sname:
violations += check_superset_gap(by_name, sname, parked, exceptions)
violations += check_max_gap(by_name, sname, removed)
violations += check_full_gap(by_name, sname, removed, exceptions)
# Reason codes only, one per line; no exit here — the bash caller
# derives pass/fail from whether this captured output is empty.
print("\n".join(violations))
main()
PY
)
if [ -n "$out" ]; then
printf '%s\n' "$out"
return 1
fi
return 0
}
# run_mutant <label> <dir> <code> <flag> — census_check on <dir> (fixture
# PARKED override, empty FULL_EXCEPTIONS), asserts a non-zero rc AND the
# presence of <code>; echoes <flag> when both hold (the positive-control
# marker the contract CHECK greps for).
run_mutant() {
local label="$1" dir="$2" code="$3" flag="$4"
local out rc hit nonzero
out=$(census_check "$dir" "parked-x" ""); rc=$?
[ -n "$out" ] && printf '%s\n' "$out"
hit=$(printf '%s\n' "$out" | grep -qxF "$code" && echo yes || echo no)
nonzero=$([ "$rc" -ne 0 ] && echo yes || echo no)
check "$label-code" "$hit" yes
check "$label-nonzero" "$nonzero" yes
[ "$hit" = yes ] && [ "$nonzero" = yes ] && echo "$flag"
}
# ── live: this repo's real profiles dir (a violation here → suite RED) ──
live_out=$(census_check "$ROOT/lib/profiles"); live_rc=$?
[ -n "$live_out" ] && printf '%s\n' "$live_out"
check T1-live-clean "$live_rc" 0
# ── fixtures: baseline + one single-change mutant per invariant ────────
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
BASE="$WORK/baseline"
mkdir -p "$BASE"
cat > "$BASE/full.profile" <<'EOF'
alpha
beta
EOF
cat > "$BASE/qa.profile" <<'EOF'
alpha
EOF
cat > "$BASE/max.profile" <<'EOF'
# SUPERSET-OF: full
alpha
beta
parked-x
EOF
base_out=$(census_check "$BASE" "parked-x" ""); base_rc=$?
[ -n "$base_out" ] && printf '%s\n' "$base_out"
check T2-fixture-baseline-clean "$base_rc" 0
[ "$base_rc" -eq 0 ] && echo FIXTURE_BASELINE_OK
# Mutant 1: a REMOVED name (ship) added to a profile other than full.
M1="$WORK/mutant-removed"; cp -r "$BASE" "$M1"
printf 'ship\n' >> "$M1/qa.profile"
run_mutant T3-mutant-removed "$M1" 'REMOVED_LISTED:qa:ship' \
FIXTURE_REMOVED_DETECTED
# Mutant 2: the superset profile drops a name full carries.
M2="$WORK/mutant-superset"; cp -r "$BASE" "$M2"
# BSD sed -i needs a suffix argument
sed -i.bak '/^beta$/d' "$M2/max.profile" && rm -f "$M2/max.profile.bak"
run_mutant T4-mutant-superset "$M2" 'SUPERSET_GAP:beta' \
FIXTURE_SUPERSET_DETECTED
# Mutant 3: a non-full, non-superset profile carries a name full lacks.
M3="$WORK/mutant-fullgap"; cp -r "$BASE" "$M3"
printf 'gamma\n' >> "$M3/qa.profile"
run_mutant T5-mutant-fullgap "$M3" 'FULL_GAP:gamma' \
FIXTURE_FULLGAP_DETECTED
echo "PASS=$pass FAIL=$fail"
[ "$fail" -eq 0 ]
-136
View File
@@ -1,136 +0,0 @@
#!/usr/bin/env bash
# lib/tests/profile-default.test.sh — default profile (full) when nothing is
# selected: `current` is label-driven (BDR-030 — gstack starts off, so a
# parked count says nothing about which profile is on), `reset` lands on
# DEFAULT_PROFILE, `gstack off` resolves the default through active_profile(),
# and hooks/statusline.sh falls back to the same constant. Covers contract
# criteria 2/3/4/5. Hermetic: fixture repo via *_REPO_OVERRIDE + fake `claude`
# on PATH — same harness as profile-set-managed.test.sh.
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
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; }
check_has() { case "$2" in *"$3"*) pass=$((pass+1));; *) fail=$((fail+1));
printf 'FAIL %s: [%s] does not contain [%s]\n' "$1" "$2" "$3";; esac; }
check_not() { case "$2" in *"$3"*) fail=$((fail+1));
printf 'FAIL %s: [%s] unexpectedly contains [%s]\n' "$1" "$2" "$3";; *) pass=$((pass+1));; esac; }
FX="$(mktemp -d)"; trap 'rm -rf "$FX"' EXIT
mkdir -p "$FX/skills" "$FX/skills-disabled" "$FX/lib/profiles" "$FX/bin" \
"$FX/hooks" "$FX/skills-external/emil-design-eng" \
"$FX/skills-external/observability-and-instrumentation"
for g in gs-a gs-b gs-c; do
mkdir -p "$FX/skills-external/gstack/$g"
touch "$FX/skills-external/gstack/$g/SKILL.md"
done
cp "$ROOT/lib/profile.sh" "$ROOT/lib/toggle-external.sh" \
"$ROOT/lib/gstack-removed.sh" "$FX/lib/"
cp "$ROOT/hooks/statusline.sh" "$FX/hooks/"
cat > "$FX/lib/profiles/full.profile" <<'EOF'
gs-a
gs-b
emil-design-eng external
observability-and-instrumentation external
EOF
cat > "$FX/lib/profiles/otherish.profile" <<'EOF'
gs-c
EOF
# Fake claude: logs every call, prints nothing — skill_status greps for
# "✔ enabled" and finds nothing, so every managed plugin reads back
# "disabled" and set/reset never touch real plugin state.
cat > "$FX/bin/claude" <<EOF
#!/usr/bin/env bash
FX="$FX"
echo "\$*" >> "\$FX/claude-calls.log"
exit 0
EOF
chmod +x "$FX/bin/claude"
run() { PATH="$FX/bin:$PATH" PROFILE_REPO_OVERRIDE="$FX" \
TOGGLE_EXTERNAL_REPO_OVERRIDE="$FX" bash "$FX/lib/profile.sh" "$@"; }
statusline() { echo '{}' | bash "$FX/hooks/statusline.sh"; }
first_word() { printf '%s' "${1%% *}"; }
# --- T1: clean seed, no cache — current names the default, "not applied" ---
out="$(run current)"
check T1-first-word "$(first_word "$out")" full
check_has T1-not-applied "$out" "default — not applied yet"
check_not T1-no-all-gstack "$out" "all gstack"
# --- T2: clean seed, no cache — gstack off is a clean no-op (rc 0) ---
run gstack off >/dev/null 2>&1; rc=$?
check T2-rc "$rc" 0
# --- T2b: one gstack skill manually linked, no cache — off parks just it ---
ln -s "$FX/skills-external/gstack/gs-c" "$FX/skills/gs-c"
run gstack off >/dev/null 2>&1; rc=$?
check T2b-rc "$rc" 0
check T2b-gsc-parked "$([ -e "$FX/skills-disabled/gstack__gs-c" ] && echo p || echo n)" p
check T2b-gsa-absent "$([ -e "$FX/skills/gs-a" ] && echo on || echo off)" off
rm -rf "$FX/skills-disabled/gstack__gs-c" # back to the clean seed
# --- T3: cache "none" (CRLF) — off is still a clean no-op ---
printf 'none\r\n' > "$FX/.active-profile"
run gstack off >/dev/null 2>&1; rc=$?
check T3-rc "$rc" 0
# --- T4: cache names an unknown profile — off errors, current says so ---
printf 'ghost\n' > "$FX/.active-profile"
run gstack off >/dev/null 2>&1; rc=$?
check T4-rc "$rc" 1
out="$(run current)"
check T4-first-word "$(first_word "$out")" ghost
check_has T4-unknown "$out" "unknown profile"
# --- T5: reset lands on the default profile, exclusively ---
run reset >/dev/null 2>&1
check T5-cache "$(cat "$FX/.active-profile" 2>/dev/null)" full
check T5-gsa-on "$([ -e "$FX/skills/gs-a" ] && echo on || echo off)" on
check T5-gsb-on "$([ -e "$FX/skills/gs-b" ] && echo on || echo off)" on
check T5-gsc-off "$([ -e "$FX/skills/gs-c" ] && echo on || echo off)" off
check T5-emil-on "$([ -e "$FX/skills/emil-design-eng" ] && echo on || echo off)" on
check T5-obs-on "$([ -e "$FX/skills/observability-and-instrumentation" ] && echo on || echo off)" on
out="$(run current)"
check T5-first-word "$(first_word "$out")" full
check_has T5-match "$out" "100% match"
check_not T5-not-applied "$out" "not applied"
# --- T6: current is label-driven even for a gstack-only profile ---
run set otherish >/dev/null 2>&1
out="$(run current)"
check T6-first-word "$(first_word "$out")" otherish
run reset >/dev/null 2>&1
check T6-gsc-parked "$([ -e "$FX/skills-disabled/gstack__gs-c" ] && echo p || echo n)" p
check T6-gsa-on "$([ -e "$FX/skills/gs-a" ] && echo on || echo off)" on
check T6-cache "$(cat "$FX/.active-profile" 2>/dev/null)" full
# --- T7: gstack on restores parked skills, keeps the profile label ---
run set otherish >/dev/null 2>&1
run gstack on >/dev/null 2>&1
out="$(run current)"
check T7-first-word "$(first_word "$out")" otherish
check_not T7-no-default "$out" "default"
# --- T8-T11: statusline fallback + constant read ---
rm -f "$FX/.active-profile"
out="$(statusline)"
check_has T8-full "$out" "profile: full"
printf 'otherish\n' > "$FX/.active-profile"
out="$(statusline)"
check_has T9-otherish "$out" "profile: otherish"
printf ' none \r' > "$FX/.active-profile"
out="$(statusline)"
check_has T10-full "$out" "profile: full"
# BSD sed -i needs a suffix argument
sed -i.bak 's/^DEFAULT_PROFILE="full"/DEFAULT_PROFILE="otherish"/' "$FX/lib/profile.sh" && rm -f "$FX/lib/profile.sh.bak"
rm -f "$FX/.active-profile"
out="$(statusline)"
check_has T11-otherish "$out" "profile: otherish"
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
-104
View File
@@ -1,104 +0,0 @@
#!/usr/bin/env bash
# lib/tests/profile-set-managed.test.sh — `set` symmetry on managed
# externals, gstack on-demand, external from-source (BDR-079). No MCP is
# managed (MANAGED_MCPS is empty): the 21st skills are managed as externals,
# so the pack's park/restore round-trip is what this covers on that side.
# Hermetic: fixture repo via *_REPO_OVERRIDE + fake `claude` on PATH.
set -u
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
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; }
FX="$(mktemp -d)"; trap 'rm -rf "$FX"' EXIT
mkdir -p "$FX/skills" "$FX/skills-disabled" "$FX/lib/profiles" "$FX/bin" \
"$FX/skills-external/emil-design-eng" "$FX/skills-external/other-ext" \
"$FX/skills-external/21st-ui-build" \
"$FX/skills-external/observability-and-instrumentation"
for g in gs-a gs-b gs-c; do
mkdir -p "$FX/skills-external/gstack/$g"
touch "$FX/skills-external/gstack/$g/SKILL.md"
done
cp "$ROOT/lib/profile.sh" "$ROOT/lib/toggle-external.sh" \
"$ROOT/lib/gstack-removed.sh" "$FX/lib/"
# Non-managed external, enabled from the start — must never be touched.
ln -s "$FX/skills-external/other-ext" "$FX/skills/other-ext"
cat > "$FX/lib/profiles/designish.profile" <<'EOF'
gs-a
gs-b
emil-design-eng external
21st-ui-build external
observability-and-instrumentation external
EOF
cat > "$FX/lib/profiles/backendish.profile" <<'EOF'
gs-c
EOF
# Fake claude: logs every call. No MCP state to keep — MANAGED_MCPS is empty,
# so `set` must never reach for `claude mcp` at all (asserted below).
cat > "$FX/bin/claude" <<EOF
#!/usr/bin/env bash
FX="$FX"
echo "\$*" >> "\$FX/claude-calls.log"
exit 0
EOF
chmod +x "$FX/bin/claude"
run() { PATH="$FX/bin:$PATH" PROFILE_REPO_OVERRIDE="$FX" \
TOGGLE_EXTERNAL_REPO_OVERRIDE="$FX" bash "$FX/lib/profile.sh" "$@"; }
# --- set designish: gstack on-demand + externals from-source (21st + emil) ---
run set designish >/dev/null 2>&1
check T1-gsa-on "$([ -e "$FX/skills/gs-a" ] && echo on || echo off)" on
check T2-gsb-on "$([ -e "$FX/skills/gs-b" ] && echo on || echo off)" on
check T3-gsc-off "$([ -e "$FX/skills/gs-c" ] && echo on || echo off)" off
check T4-emil-src "$([ -L "$FX/skills/emil-design-eng" ] && echo on || echo off)" on
check T5-21st-src "$([ -L "$FX/skills/21st-ui-build" ] && echo on || echo off)" on
check T5b-obs-src "$([ -L "$FX/skills/observability-and-instrumentation" ] && echo on || echo off)" on
check T6-no-mcp "$(grep -c '^mcp ' "$FX/claude-calls.log" || true)" 0
# --- set backendish: managed leftovers parked/unregistered ---
run set backendish >/dev/null 2>&1
check T7-gsc-on "$([ -e "$FX/skills/gs-c" ] && echo on || echo off)" on
check T8-gsa-park "$([ -e "$FX/skills-disabled/gstack__gs-a" ] && echo p || echo n)" p
check T9-emil-off "$([ -e "$FX/skills/emil-design-eng" ] && echo on || echo off)" off
check T10-emil-park "$([ -e "$FX/skills-disabled/emil-design-eng" ] && echo p || echo n)" p
check T11-21st-off "$([ -e "$FX/skills/21st-ui-build" ] && echo on || echo off)" off
check T12-21st-park "$([ -e "$FX/skills-disabled/21st-ui-build" ] && echo p || echo n)" p
check T12b-obs-off "$([ -e "$FX/skills/observability-and-instrumentation" ] && echo on || echo off)" off
check T12c-obs-park "$([ -e "$FX/skills-disabled/observability-and-instrumentation" ] && echo p || echo n)" p
check T13-other-untouched "$([ -e "$FX/skills/other-ext" ] && echo on || echo off)" on
# --- back to designish: parked external restored (not re-sourced) ---
run set designish >/dev/null 2>&1
check T14-emil-back "$([ -e "$FX/skills/emil-design-eng" ] && echo on || echo off)" on
check T15-park-gone "$([ -e "$FX/skills-disabled/emil-design-eng" ] && echo p || echo n)" n
check T16-21st-back "$([ -e "$FX/skills/21st-ui-build" ] && echo on || echo off)" on
check T16b-obs-back "$([ -e "$FX/skills/observability-and-instrumentation" ] && echo on || echo off)" on
check T16c-obs-park-gone "$([ -e "$FX/skills-disabled/observability-and-instrumentation" ] && echo p || echo n)" n
check T17-no-mcp-ever "$(grep -c '^mcp ' "$FX/claude-calls.log" || true)" 0
# --- a failing `claude plugin enable` must warn, never abort `set` ---
# Guards the capture-inside-the-condition form: a bare out="$(claude …)"
# would trip errexit and skip every entry after the plugin.
mkdir -p "$FX/failbin"
cat > "$FX/failbin/claude" <<'EOF'
#!/usr/bin/env bash
[ "$1 $2" = "plugin enable" ] && exit 1
exit 0
EOF
chmod +x "$FX/failbin/claude"
cat > "$FX/lib/profiles/pluginish.profile" <<'EOF'
fake-plug plugin@fake-market
gs-a
EOF
rm -f "$FX/skills/gs-a"
PATH="$FX/failbin:$PATH" PROFILE_REPO_OVERRIDE="$FX" \
TOGGLE_EXTERNAL_REPO_OVERRIDE="$FX" bash "$FX/lib/profile.sh" set pluginish \
>/dev/null 2>&1
check T18-failing-plugin-enable-keeps-going \
"$([ -e "$FX/skills/gs-a" ] && echo on || echo off)" on
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
+186
View File
@@ -0,0 +1,186 @@
#!/usr/bin/env bash
# lib/tests/profile.test.sh — lib/profile.sh + lib/profile-state.jq on a
# fixture repo: fragments, the four precedence levels, the deniedMcpServers
# union, set/unset/enable/disable merge semantics, refusals (rc 2, nothing
# written), the /mcp toggle, root walk-up, timing. Hermetic:
# PROFILE_REPO_OVERRIDE + PROFILE_USER_SETTINGS + PROFILE_CLAUDE_JSON, no claude.
set -u
unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
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; }
check_has() { case "$2" in *"$3"*) pass=$((pass+1));; *) fail=$((fail+1));
printf 'FAIL %s: [%s] does not contain [%s]\n' "$1" "$2" "$3";; esac; }
FX="$(mktemp -d)"; trap 'rm -rf "$FX"' EXIT
mkdir -p "$FX/lib/profiles" "$FX/skills" "$FX/proj/.claude" "$FX/proj/sub/deeper" "$FX/home" "$FX/nowhere"
mk_pack() { mkdir -p "$FX/skills/pack-$1/.claude-plugin"
printf '{"name":"pack-%s","defaultEnabled":%s}\n' "$1" "$2" > "$FX/skills/pack-$1/.claude-plugin/plugin.json"; }
mk_pack a true; mk_pack b false # pack-c has no dir (missing)
frag() { # name pack-a pack-b pack-c ui deny(yes|no) [model]
local d="" m=""
[ "$6" = yes ] && d=', "deniedMcpServers": [{"serverName": "claude.ai X"}, {"serverName": "claude.ai Y"}]'
[ -n "${7:-}" ] && m=", \"model\": \"$7\""
printf '{"enabledPlugins": {"model-router@skills-dir": true, "pack-a@skills-dir": %s, "pack-b@skills-dir": %s, "pack-c@skills-dir": %s, "ui@mk": %s}%s%s}\n' \
"$2" "$3" "$4" "$5" "$d" "$m" > "$FX/lib/profiles/$1.json"; }
frag fullx true false false true no # = manifest defaults + user ui on
frag devx true false false false yes
frag minix false false false false yes haiku
printf -- '- **fullx**: everything\n- **devx**: dev only\n- **minix**: nothing\n' > "$FX/lib/profiles/README.md"
printf '{"enabledPlugins": {"ui@mk": true}}\n' > "$FX/home/settings.json"
printf '{}\n' > "$FX/home/claude.json"
printf '# proj\n' > "$FX/proj/CLAUDE.md"
P() { PROFILE_REPO_OVERRIDE="$FX" PROFILE_USER_SETTINGS="$FX/home/settings.json" \
PROFILE_CLAUDE_JSON="$FX/home/claude.json" bash "$ROOT/lib/profile.sh" -C "$FX/proj" "$@"; }
plain() { P current --plain | tr '\n' ' '; }
L="$FX/proj/.claude/settings.local.json"
out="$(P list)"; check_has T1-list "$out" "dev only"; check_has T1-list-name "$out" "devx"
out="$(P show devx)"; check_has T2-show-on "$out" "pack-a@skills-dir"
check_has T2-show-missing "$out" "off missing (no skills/pack-c/)"
check_has T2-show-deny "$out" "connectors denied: claude.ai X, claude.ai Y"
out="$(plain)"
check_has T3-default "$out" "profile=fullx source=default flag=- pack-a=on pack-b=off pack-c=off plugin:model-router@skills-dir=on plugin:ui@mk=on model=- model-source=- mcp-off=-"
out="$(P current)"; check_has T3-human "$out" "profile: fullx [default]"
# precedence, before any local write: project settings.json over user
printf '{"enabledPlugins": {"pack-b@skills-dir": true}, "model": "opus"}\n' > "$FX/proj/.claude/settings.json"
out="$(plain)"; check_has T6-project "$out" "profile=custom source=default flag=- pack-a=on pack-b=on "
check_has T6-project-model "$out" "model=opus model-source=project "
rm "$FX/proj/.claude/settings.json"
# set keeps the other keys, writes the managed ones
printf '{"permissions": {"allow": ["Bash(ls)"]}, "model": "sonnet"}\n' > "$L"
out="$(P set devx)"; rc=$?
check T4-set-rc "$rc" 0; check_has T4-set-hint "$out" "/reload-plugins"
check T4-keep-perm "$(jq -c .permissions "$L")" '{"allow":["Bash(ls)"]}'
check T4-keep-model "$(jq -r .model "$L")" sonnet
check T4-deny "$(jq -c '[.deniedMcpServers[].serverName]' "$L")" '["claude.ai X","claude.ai Y"]'
out="$(plain)"
check_has T5-local "$out" "profile=devx source=local flag=- pack-a=on pack-b=off pack-c=off plugin:model-router@skills-dir=on plugin:ui@mk=off connector:claude.ai X=denied connector:claude.ai Y=denied model=sonnet model-source=local mcp-off=-"
# local over project; flag over local
printf '{"enabledPlugins": {"pack-b@skills-dir": true}}\n' > "$FX/proj/.claude/settings.json"
out="$(plain)"; check_has T6-local-over-project "$out" "profile=devx source=local flag=- pack-a=on pack-b=off "
printf '{"enabledPlugins": {"pack-b@skills-dir": true}}\n' > "$FX/flag.json"
out="$(CLAUDE_PROFILE_SETTINGS="$FX/flag.json" CLAUDE_PROFILE=x plain)"
check_has T6-flag "$out" "profile=custom source=flag flag=x pack-a=on pack-b=on "
rm "$FX/proj/.claude/settings.json"
# union of deniedMcpServers: flag fullx over local devx keeps the denies → custom
out="$(CLAUDE_PROFILE_SETTINGS="$FX/lib/profiles/fullx.json" CLAUDE_PROFILE=fullx plain)"
check_has T7-union "$out" "profile=custom source=flag flag=fullx "
check_has T7-union-denied "$out" "connector:claude.ai X=denied "
# refusals
cp "$L" "$FX/before.json"; printf '{"enabledPlugins": \n' > "$L"; cp "$L" "$FX/broken.json"
out="$(P set devx 2>&1)"; rc=$?
check T8-invalid-rc "$rc" 2; check_has T8-invalid-msg "$out" "not valid JSON"
check T8-invalid-untouched "$(cmp -s "$FX/broken.json" "$L" && echo same)" same
cp "$FX/before.json" "$L"
out="$(PROFILE_REPO_OVERRIDE="$FX" PROFILE_USER_SETTINGS="$FX/home/settings.json" PROFILE_CLAUDE_JSON="$FX/home/claude.json" \
bash "$ROOT/lib/profile.sh" -C "$FX/nowhere" set devx 2>&1)"; rc=$?
check T9-root-rc "$rc" 2; check_has T9-root-msg "$out" "not a project root"; check T9-root-nothing "$(ls -A "$FX/nowhere")" ""
out="$(P set nope 2>&1)"; rc=$?; check T10-unknown-rc "$rc" 2; check_has T10-unknown-list "$out" "fullx"
# enable / disable, three spellings, flag note
P enable b >/dev/null; check T11-enable "$(jq -r '.enabledPlugins["pack-b@skills-dir"]' "$L")" true
P disable pack-b >/dev/null; check T11-disable "$(jq -r '.enabledPlugins["pack-b@skills-dir"]' "$L")" false
P enable pack-b@skills-dir >/dev/null; check T11-enable-id "$(jq -r '.enabledPlugins["pack-b@skills-dir"]' "$L")" true
out="$(P enable zzz 2>&1)"; rc=$?; check T11-unknown "$rc" 2
out="$(CLAUDE_PROFILE_SETTINGS="$FX/flag.json" CLAUDE_PROFILE=x P enable a 2>&1)"
check_has T11-flag-note "$out" "relaunch: cc <name> <profile>"
P disable b >/dev/null
# unset: managed keys gone, permissions kept; model removed only when it is the profile's
P unset >/dev/null
check T12-unset-ep "$(jq -c '.enabledPlugins // "gone"' "$L")" '"gone"'
check T12-unset-deny "$(jq -c '.deniedMcpServers // "gone"' "$L")" '"gone"'
check T12-unset-perm "$(jq -c .permissions "$L")" '{"allow":["Bash(ls)"]}'
check T12-unset-model-kept "$(jq -r .model "$L")" sonnet
P set minix >/dev/null; check T12-minix-model "$(jq -r .model "$L")" haiku
P unset >/dev/null; check T12-minix-model-gone "$(jq -r '.model // "gone"' "$L")" gone
# /mcp toggle; unreadable ~/.claude.json; disableClaudeAiConnectors any-source
printf '{"projects": {"%s": {"disabledMcpServers": ["foo", "bar"]}}}\n' "$FX/proj" > "$FX/home/claude.json"
out="$(P current)"; check_has T13-mcp-off "$out" "profile: custom (off: foo,bar) [default]"
out="$(plain)"; check_has T13-mcp-off-plain "$out" "mcp-off=foo,bar"
printf '{broken\n' > "$FX/home/claude.json"
out="$(plain)"; rc=$?; check T14-unknown-rc "$rc" 0; check_has T14-unknown "$out" "mcp-off=unknown"
printf '{}\n' > "$FX/home/claude.json"
printf '{"enabledPlugins": {"ui@mk": true}, "disableClaudeAiConnectors": true}\n' > "$FX/home/settings.json"
out="$(plain)"; check_has T15-all-denied "$out" "connector:*=denied"; check_has T15-custom "$out" "profile=custom "
printf '{"enabledPlugins": {"ui@mk": true}}\n' > "$FX/home/settings.json"
# a missing pack still written; diff
P set devx >/dev/null; check T16-missing-written "$(jq -r '.enabledPlugins["pack-c@skills-dir"]' "$L")" false
out="$(P diff fullx)"; check_has T17-diff-ui "$out" "ui@mk: off → on"
check_has T17-diff-conn "$out" "connectors denied: claude.ai X, claude.ai Y → "
out="$(P diff devx)"; check T17-nodiff "$out" "no difference from devx"
# shellcheck + width
check T18-shellcheck "$(shellcheck "$ROOT/lib/profile.sh" >/dev/null 2>&1 && echo ok)" ok
check T18-width "$(LC_ALL=C awk 'length($0) > 80' "$ROOT/lib/profile.sh" "$ROOT/lib/profile-state.jq" | wc -l | tr -d ' ')" 0
# root walk-up from a subdirectory; a bare dir stays itself
out="$(PROFILE_REPO_OVERRIDE="$FX" PROFILE_USER_SETTINGS="$FX/home/settings.json" PROFILE_CLAUDE_JSON="$FX/home/claude.json" \
bash "$ROOT/lib/profile.sh" -C "$FX/proj/sub/deeper" current --plain | tr '\n' ' ')"
check_has T19-walkup "$out" "profile=devx source=local "
# managed-connector match: a user-scope deny of an unmanaged connector keeps
# the profile name, shows in the plain lines, and never appears in diff
printf '{"enabledPlugins": {"ui@mk": true}, "deniedMcpServers": [{"serverName": "claude.ai Gmail"}]}\n' > "$FX/home/settings.json"
P set devx >/dev/null; out="$(plain)"
check_has T21-managed-name "$out" "profile=devx source=local "
check_has T21-plain-all "$out" "connector:claude.ai Gmail=denied"
check T21-diff "$(P diff devx)" "no difference from devx"
printf '{"enabledPlugins": {"ui@mk": true}}\n' > "$FX/home/settings.json"
# diff skips the model line when the fragment has none
check_has T22-diff-nomodel "$(P diff devx; jq -r .model "$L")" "no difference from devx"
# name allowlist: a refused name writes nothing and reads no path
cp "$L" "$FX/before-names.json"
for v in "set ../../settings" "show ../x" "diff a/b" "enable ../x" "disable y/z"; do
# shellcheck disable=SC2086
out="$(P $v 2>&1)"; rc=$?
check "T23-name-rc-$v" "$rc" 2; check_has "T23-name-msg-$v" "$out" "invalid"
done
check T23-untouched "$(cmp -s "$FX/before-names.json" "$L" && echo same)" same
check T23-no-escape "$([ -e "$FX/lib/settings.json" ] && echo leaked)" ""
# unset with nothing managed left: no write; no local file: none created
P unset >/dev/null; cp "$L" "$FX/before-unset.json"
out="$(P unset)"; check_has T24-nothing "$out" "nothing to unset"
check T24-untouched "$(cmp -s "$FX/before-unset.json" "$L" && echo same)" same
rm "$L"; P unset >/dev/null; check T24-no-file "$([ -e "$L" ] && echo created)" ""
# project root = parent of the git common dir; a worktree and a nested dir
# holding its own CLAUDE.md both resolve to the main checkout
G="$FX/gmain"; mkdir -p "$G/pkg/inner"; printf '# pkg\n' > "$G/pkg/inner/CLAUDE.md"
git init -q "$G"
git -C "$G" -c core.hooksPath=/dev/null -c user.email=t@t -c user.name=t commit -q --allow-empty -m x
git -C "$G" -c core.hooksPath=/dev/null worktree add -q "$FX/wt" -b wt 2>/dev/null
PX() { local d="$1"; shift; PROFILE_REPO_OVERRIDE="$FX" PROFILE_USER_SETTINGS="$FX/home/settings.json" \
PROFILE_CLAUDE_JSON="$FX/home/claude.json" bash "$ROOT/lib/profile.sh" -C "$d" "$@"; }
PX "$FX/wt" set devx >/dev/null; rc=$?
check T25-worktree-rc "$rc" 0
check T25-worktree-main "$(jq -r '.enabledPlugins["pack-a@skills-dir"]' "$G/.claude/settings.local.json")" true
check T25-worktree-none "$([ -e "$FX/wt/.claude/settings.local.json" ] && echo local)" ""
check_has T25-nested "$(PX "$G/pkg/inner" current --plain | tr '\n' ' ')" "profile=devx source=local "
# the walk stops below $HOME: a repo AT $HOME is not the project root
H2="$FX/home2"; mkdir -p "$H2/work"; git init -q "$H2"; printf '# w\n' > "$H2/work/CLAUDE.md"
HOME="$H2" PX "$H2/work" set devx >/dev/null; rc=$?
check T26-home-rc "$rc" 0
check T26-home-local "$([ -f "$H2/work/.claude/settings.local.json" ] && echo yes)" yes
check T26-home-not-root "$([ -e "$H2/.claude" ] && echo leaked)" ""
# timing: two jq calls, under 100 ms here (spec target 50 ms, measured in Task 12)
t0=$(date +%s%N); P current --plain >/dev/null; t1=$(date +%s%N)
ms=$(( (t1 - t0) / 1000000 )); echo "current --plain: ${ms} ms"
check T20-timing "$([ "$ms" -le 100 ] && echo fast || echo "slow:${ms}ms")" fast
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
+16 -16
View File
@@ -15,16 +15,16 @@ 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/seo/SKILL.md" 'SEO JUDGE — VERDICT: ERROR('
has "skills/geo/SKILL.md" 'GEO JUDGE — VERDICT: ERROR('
has "skills/pack-seo/skills/seo/SKILL.md" 'SEO JUDGE — VERDICT: ERROR('
has "skills/pack-seo/skills/geo/SKILL.md" 'GEO JUDGE — VERDICT: ERROR('
# 2) fix-bundle section + apply sentinel — parsed by /seo STEP 1b/1.5 and
# /geo STEP 1b/2 before any L1 apply
for f in "$SEO" "$GEO" skills/seo/SKILL.md skills/geo/SKILL.md; do
for f in "$SEO" "$GEO" skills/pack-seo/skills/seo/SKILL.md skills/pack-seo/skills/geo/SKILL.md; do
has "$f" '## FIX BUNDLE'
has "$f" 'READY TO APPLY — awaiting dispatcher confirmation'
done
@@ -32,8 +32,8 @@ done
# 3) signals handoff — judge loads the collect artifact fail-closed
has "$SEO" '.audit/seo-signals-'
has "$GEO" '.audit/geo-signals-'
has "skills/seo/SKILL.md" '.audit/seo-signals-<RUNID_SEO>.md'
has "skills/geo/SKILL.md" '.audit/geo-signals-<RUNID>.md'
has "skills/pack-seo/skills/seo/SKILL.md" '.audit/seo-signals-<RUNID_SEO>.md'
has "skills/pack-seo/skills/geo/SKILL.md" '.audit/geo-signals-<RUNID>.md'
# 4) STEP numbering — dispatchers reference agent step ranges literally:
# /seo: "STEP 2-5" collect · "STEP 6-11" seo judge · "STEP 6-12" geo
@@ -43,14 +43,14 @@ has "skills/geo/SKILL.md" '.audit/geo-signals-<RUNID>.md'
# and the ranges on the dispatcher side.
for n in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do has "$SEO" "## STEP $n —"; done
for n in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do has "$GEO" "## STEP $n —"; done
has "skills/seo/SKILL.md" 'STEP 2-5'
has "skills/seo/SKILL.md" 'STEP 6-11'
has "skills/seo/SKILL.md" 'STEP 6-12'
has "skills/seo/SKILL.md" 'STEP 12-14'
has "skills/seo/SKILL.md" 'STEP 13-15'
has "skills/geo/SKILL.md" 'STEP 0-5'
has "skills/geo/SKILL.md" '6-12, report scoring' # "STEP\n6-12" line-wraps
has "skills/geo/SKILL.md" 'STEP 13-15'
has "skills/pack-seo/skills/seo/SKILL.md" 'STEP 2-5'
has "skills/pack-seo/skills/seo/SKILL.md" 'STEP 6-11'
has "skills/pack-seo/skills/seo/SKILL.md" 'STEP 6-12'
has "skills/pack-seo/skills/seo/SKILL.md" 'STEP 12-14'
has "skills/pack-seo/skills/seo/SKILL.md" 'STEP 13-15'
has "skills/pack-seo/skills/geo/SKILL.md" 'STEP 0-5'
has "skills/pack-seo/skills/geo/SKILL.md" '6-12, report scoring' # "STEP\n6-12" line-wraps
has "skills/pack-seo/skills/geo/SKILL.md" 'STEP 13-15'
# 5) collect-mode report emission (dispatcher waits on it between phases)
has "$SEO" 'COLLECT REPORT'
@@ -71,7 +71,7 @@ has "$SEO" 'applier: bash'
# The emit instruction lives in /seo's DISPATCH PROMPTS, not in the agent
# specs (geo-analyzer.md never mentions it; seo-analyzer.md only once,
# incidentally — NOT locked, it is prose). Lock the dispatcher side only.
has "skills/seo/SKILL.md" 'CROSS-AGENT NOTES TO'
has "skills/pack-seo/skills/seo/SKILL.md" 'CROSS-AGENT NOTES TO'
# 8) trajectory block — mandatory in envelopes (/geo audit-end deliverables,
# /seo §1 merge)
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# lib/tests/statusline.test.sh — hooks/statusline.sh profile segment comes
# from `profile.sh -C <project_dir> current --plain`; a --settings
# conversation shows "(conv)"; profile.sh failing or missing prints
# "profile: ?" and never breaks the line.
set -u
unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
pass=0; fail=0
check_has() { case "$2" in *"$3"*) pass=$((pass+1));; *) fail=$((fail+1));
printf 'FAIL %s: [%s] does not contain [%s]\n' "$1" "$2" "$3";; esac; }
FX="$(mktemp -d)"; trap 'rm -rf "$FX"' EXIT
mkdir -p "$FX/hooks" "$FX/lib" "$FX/proj" "$FX/cwd"
cp "$ROOT/hooks/statusline.sh" "$FX/hooks/"
printf '{"effortLevel": "high"}\n' > "$FX/settings.json"
cat > "$FX/lib/profile.sh" <<'PROF'
#!/usr/bin/env bash
[ "$2" = "$FAKE_DIR" ] || { echo "wrong -C: $2" >&2; exit 2; }
printf 'profile=%s\nsource=%s\n' "$FAKE_PROFILE" "$FAKE_SOURCE"
PROF
# The project dir differs from the cwd: the segment must follow project_dir.
sl() { printf '{"cwd": "%s", "workspace": {"project_dir": "%s"}}\n' \
"$FX/cwd" "$FX/proj" | FAKE_DIR="$FX/proj" bash "$FX/hooks/statusline.sh"; }
out="$(FAKE_PROFILE=web FAKE_SOURCE=local sl)"; check_has T1-local "$out" "profile: web |"
out="$(FAKE_PROFILE=dev FAKE_SOURCE=flag sl)"; check_has T2-conv "$out" "profile: dev (conv) |"
out="$(FAKE_PROFILE=full FAKE_SOURCE=default sl)"; check_has T3-default "$out" "profile: full |"
printf 'exit 2\n' > "$FX/lib/profile.sh"
out="$(sl 2>&1)"; check_has T4-failing "$out" "profile: ? |"
rm "$FX/lib/profile.sh"; out="$(sl 2>&1)"; check_has T5-missing "$out" "profile: ? |"
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
@@ -1,36 +0,0 @@
#!/usr/bin/env bash
# lib/tests/toggle-external-repo-resolution.test.sh
#
# Regression test for J4-20 (BLK-006 class): toggle-external.sh:34 resolved
# REPO with a LOGICAL `cd` (no -P). Direct invocation via a symlinked path —
# exactly the real ~/.claude/lib -> <repo>/lib layout — resolves REPO to the
# SYMLINK's logical parent instead of the physical repo root, so every path
# derived from it (SKILLS_DIR, DISABLED_DIR) points at the wrong tree.
set -u
HELPER_SRC="$(cd "$(dirname "$0")/../.." && pwd)/lib/toggle-external.sh"
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; }
SANDBOX="$(mktemp -d)"
mkdir -p "$SANDBOX/repo/lib" "$SANDBOX/repo/skills-external/emil-design-eng" \
"$SANDBOX/repo/skills-external/observability-and-instrumentation" \
"$SANDBOX/repo/skills" "$SANDBOX/home/.claude"
cp "$HELPER_SRC" "$SANDBOX/repo/lib/toggle-external.sh"
cp "$(dirname "$HELPER_SRC")/gstack-removed.sh" "$SANDBOX/repo/lib/"
# mark emil-design-eng ENABLED in the real (physical) repo tree
ln -s "$SANDBOX/repo/skills-external/emil-design-eng" "$SANDBOX/repo/skills/emil-design-eng"
# replicate the real ~/.claude/lib -> <repo>/lib symlink
ln -s "$SANDBOX/repo/lib" "$SANDBOX/home/.claude/lib"
out="$(bash "$SANDBOX/home/.claude/lib/toggle-external.sh" status emil-design-eng)"
check T1-repo-resolves-through-symlink "$out" enabled
# Same case arm, generalized to $tool for the agent-skills trio (this PR) —
# left unlinked, so it must resolve through the symlink as "disabled", not
# "missing" (which would mean REPO fell back to the wrong tree again).
out="$(bash "$SANDBOX/home/.claude/lib/toggle-external.sh" status observability-and-instrumentation)"
check T2-generalized-tool-resolves-through-symlink "$out" disabled
rm -rf "$SANDBOX"
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
-382
View File
@@ -1,382 +0,0 @@
#!/usr/bin/env bash
# ============================================================
# lib/toggle-external.sh — enable/disable non-plugin tools
#
# Marketplace plugins are toggled by `claude plugin enable|disable`.
# Tools distributed outside the marketplace (gstack submodule, emil
# curl install, npx-installed skills) have no such lever — they live
# as symlinks inside skills/. This script moves those symlinks
# to/from skills-disabled/ so Claude Code stops/starts scanning them.
#
# A multi-skill pack (gstack, 21st, higgsfield) toggles all of its skills
# at once.
#
# Usage:
# toggle-external.sh list
# toggle-external.sh status <tool>
# toggle-external.sh enable <tool>
# toggle-external.sh disable <tool>
#
# Managed tools:
# gstack — per-skill symlinks populated by gstack's own setup
# emil-design-eng — single symlink → skills-external/emil-design-eng
# darwin-skill — single symlink → ~/.agents/skills/darwin-skill
# 21st — 21st.dev skill pack (needs the `21st` CLI + login)
# higgsfield — Higgsfield media pack (needs the CLI + login)
# higgsfield-websites — single skill, landing-page aid (named ask only)
# observability-and-instrumentation, deprecation-and-migration,
# ci-cd-and-automation — the agent-skills trio, same single-symlink shape
# as emil-design-eng (commit-pinned instead of main-branch tracking)
# scroll-world-storytelling, build-threejs-scroll-worlds,
# scroll-scrubbed-visual-sequence, scroll-scrubbed-word-reveal,
# scroll-progress-timeline — the Mengto scroll skills, same shape
#
# For fine-grained activation (only design skills, only qa skills, only
# audit skills, etc.) instead of all-or-nothing gstack toggling, use:
# bash lib/profile.sh list
# bash lib/profile.sh set <design|dev|qa|audit|minimal>
# bash lib/profile.sh reset # back to the default profile (full)
# ============================================================
set -euo pipefail
REPO="${TOGGLE_EXTERNAL_REPO_OVERRIDE:-$(cd -P "$(dirname "$0")/.." && pwd)}"
SKILLS_DIR="$REPO/skills"
DISABLED_DIR="$REPO/skills-disabled"
GSTACK_SRC="$REPO/skills-external/gstack" # gstack submodule: its skills
# GSTACK_REMOVED + gstack_is_removed() — single source, honored by the
# `enable gstack` loop below — plus the gstack helpers shared with
# profile.sh (gstack_skills, gstack_park, gstack_unpark, gstack_parked_names).
# Resolved from $0 like REPO above, not from $REPO/lib — gstack-removed.sh
# sits next to this file wherever it runs.
# shellcheck source=lib/gstack-removed.sh disable=SC1091
source "$(dirname "$0")/gstack-removed.sh"
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
ok() { echo -e "${GREEN}✓${NC} $1"; }
warn() { echo -e "${YELLOW}⚠${NC} $1"; }
err() { echo -e "${RED}✗${NC} $1"; }
# All non-plugin tools this script can toggle, in `list` order. The one
# roster: tool_kind() derives every tool's kind from it.
MANAGED_TOOLS=(gstack emil-design-eng darwin-skill 21st higgsfield
higgsfield-websites
observability-and-instrumentation deprecation-and-migration
ci-cd-and-automation
scroll-world-storytelling build-threejs-scroll-worlds
scroll-scrubbed-visual-sequence scroll-scrubbed-word-reveal
scroll-progress-timeline)
# Prints the kind of a tool: gstack | pack (21st, higgsfield) | single (one
# symlink: every other MANAGED_TOOLS entry) | unknown. Exact-match loop, so
# a name with spaces or glob characters can never match a roster entry.
tool_kind() {
local tool="$1" managed
case "$tool" in
gstack) echo gstack; return ;;
21st|higgsfield) echo pack; return ;;
esac
for managed in "${MANAGED_TOOLS[@]}"; do
[ "$managed" = "$tool" ] && { echo single; return; }
done
echo unknown
}
# Prints where a single-symlink tool is linked from: ~/.agents/skills for
# darwin-skill, skills-external/ for the others.
tool_source() {
case "$1" in
darwin-skill) echo "$HOME/.agents/skills/$1" ;;
*) echo "$REPO/skills-external/$1" ;;
esac
}
# Prints the skill names that belong to the "21st" pack. Source of truth:
# skills-external/21st-* — the `21st skills install` run in install-plugins.sh
# owns that list, so adding a skill upstream needs no edit here.
twentyfirst_skills() {
local d
for d in "$REPO"/skills-external/21st-*/; do
[ -f "${d}SKILL.md" ] || continue
basename "$d"
done
}
# Media skills of the "higgsfield" pack: an explicit allowlist. Upstream is
# unpinned, so a skill it adds or renames must never be linked by
# `enable higgsfield` without an edit here (default deny).
# higgsfield-websites is its own tool: landing-page aid, named ask only.
HIGGSFIELD_MEDIA_SKILLS=(higgsfield-generate higgsfield-soul-id
higgsfield-product-photoshoot higgsfield-brandkit
higgsfield-marketplace-cards higgsfield-video-explainer
higgsfield-youtube-thumbnail)
# Prints the allowlisted media skills synced under skills-external/.
higgsfield_skills() {
local name
for name in "${HIGGSFIELD_MEDIA_SKILLS[@]}"; do
[ -f "$REPO/skills-external/$name/SKILL.md" ] && echo "$name"
done
return 0
}
# Prints the synced higgsfield-* skills no tool owns: neither on the media
# allowlist nor higgsfield-websites. Upstream added or renamed something.
higgsfield_unlisted() {
local d name
for d in "$REPO"/skills-external/higgsfield-*/; do
[ -f "${d}SKILL.md" ] || continue
name="$(basename "$d")"
case " ${HIGGSFIELD_MEDIA_SKILLS[*]} higgsfield-websites " in
*" $name "*) ;;
*) echo "$name" ;;
esac
done
}
# Prints the member skills of a multi-skill pack tool (21st, higgsfield).
pack_skills() {
case "$1" in
21st) twentyfirst_skills ;;
higgsfield) higgsfield_skills ;;
esac
}
# bounded <cmd...> — run a CLI probe silently, 15 s at most when a timeout
# tool exists (`timeout`, or `gtimeout` from Homebrew coreutils on macOS):
# a closed-source binary must never hang a toggle, and what it prints (a
# token) must never reach the terminal. Twin of _higgsfield_probe in
# lib/higgsfield-skills.sh, kept here so the only file sourced beside this
# script stays gstack-removed.sh (the fixture suites copy just those two).
bounded() {
local tool
for tool in timeout gtimeout; do
if command -v "$tool" >/dev/null 2>&1; then
"$tool" 15 "$@" </dev/null >/dev/null 2>&1
return
fi
done
"$@" </dev/null >/dev/null 2>&1
}
# Post-enable notes for a pack. Its skills shell out to a CLI: without it
# (or without a session) they can only report failure. Warn, never block:
# the pack is still correctly wired and `make plugin` installs the CLI.
pack_hints() {
local name
case "$1" in
21st)
if ! command -v 21st >/dev/null 2>&1; then
warn "the \`21st\` CLI is not on PATH — install it: npm i -g @21st-dev/cli"
elif ! grep -q '^Logged in as ' <<<"$(21st whoami 2>/dev/null)"; then
warn "not signed in to 21st — component retrieval and 21st AI need: 21st login"
fi
;;
higgsfield)
if ! command -v higgsfield >/dev/null 2>&1; then
warn "the \`higgsfield\` CLI is not on PATH — run: make plugin"
elif ! bounded higgsfield version; then
warn "the \`higgsfield\` CLI does not answer (npm shim without its binary) — run: make plugin"
elif ! bounded higgsfield auth token; then
warn "not signed in to Higgsfield — generation needs: higgsfield auth login"
fi
while read -r name; do
warn "$name is synced but on no allowlist, not linked — see HIGGSFIELD_MEDIA_SKILLS in lib/toggle-external.sh"
done < <(higgsfield_unlisted)
;;
esac
}
# Prints "enabled" / "disabled" / "missing" for a tool.
status_tool() {
local tool="$1" installed=0 name
case "$(tool_kind "$tool")" in
gstack)
[ -d "$GSTACK_SRC" ] || { echo "missing"; return; }
while read -r name; do
[ -e "$SKILLS_DIR/$name" ] && { echo "enabled"; return; }
done < <(gstack_skills "$GSTACK_SRC")
echo "disabled"
;;
single)
[ -d "$(tool_source "$tool")" ] || { echo "missing"; return; }
[ -e "$SKILLS_DIR/$tool" ] && echo "enabled" || echo "disabled"
;;
pack)
while read -r name; do
installed=1
[ -e "$SKILLS_DIR/$name" ] && { echo "enabled"; return; }
done < <(pack_skills "$tool")
[ "$installed" -eq 1 ] && echo "disabled" || echo "missing"
;;
*)
echo "unknown"; return 1 ;;
esac
}
# Parks every live gstack skill (twin of profile.sh's disable_skill gstack
# arm, kept separate: the messages differ).
disable_gstack() {
local moved=0 name
while read -r name; do
[ -e "$SKILLS_DIR/$name" ] || continue
gstack_park "$SKILLS_DIR" "$DISABLED_DIR" "$name"
moved=$((moved + 1))
done < <(gstack_skills "$GSTACK_SRC")
ok "gstack disabled ($moved symlinks moved)"
}
# Parks one single-symlink external tool.
disable_external_single() {
local tool="$1"
if [ -e "$SKILLS_DIR/$tool" ]; then
rm -rf "${DISABLED_DIR:?}/${tool:?}"
mv "$SKILLS_DIR/$tool" "$DISABLED_DIR/$tool"
ok "$tool disabled"
else
warn "$tool already disabled"
fi
}
# Parks every live skill of a pack (21st, higgsfield). Parked under the
# plain skill name — same convention as the other externals, so profile.sh's
# park/restore path stays interoperable.
disable_pack() {
local tool="$1" parked=0 name
while read -r name; do
[ -e "$SKILLS_DIR/$name" ] || continue
rm -rf "${DISABLED_DIR:?}/${name:?}"
mv "$SKILLS_DIR/$name" "$DISABLED_DIR/$name"
parked=$((parked + 1))
done < <(pack_skills "$tool")
if [ "$parked" -gt 0 ]; then
ok "$tool disabled ($parked skills parked)"
else
warn "$tool already disabled"
fi
}
disable_tool() {
local tool="$1"
mkdir -p "$DISABLED_DIR"
case "$(tool_kind "$tool")" in
gstack) disable_gstack ;;
single) disable_external_single "$tool" ;;
pack) disable_pack "$tool" ;;
*) err "Unknown tool: $tool"; return 1 ;;
esac
}
# Re-links the gstack skills parked as gstack__<name>, honoring the
# policy denylist (lib/gstack-removed.sh).
enable_gstack() {
local moved=0 skipped=0 name
while IFS= read -r name; do
if gstack_is_removed "$name"; then
warn "skipped (removed by policy, lib/gstack-removed.sh): $name"
skipped=$((skipped + 1))
continue
fi
gstack_unpark "$SKILLS_DIR" "$DISABLED_DIR" "$name"
moved=$((moved + 1))
done < <(gstack_parked_names "$DISABLED_DIR")
if [ "$moved" -eq 0 ] && [ "$skipped" -ge 1 ]; then
warn "only policy-removed skills remain parked (lib/gstack-removed.sh)"
elif [ "$moved" -eq 0 ]; then
warn "gstack was not disabled — re-run gstack setup to (re)create symlinks"
else
ok "gstack enabled ($moved symlinks restored)"
fi
}
# Enables one single-symlink external tool: restore from the parking dir,
# else link its source (see tool_source).
enable_external_single() {
local tool="$1" src
src="$(tool_source "$tool")"
if [ -e "$DISABLED_DIR/$tool" ]; then
rm -rf "${SKILLS_DIR:?}/${tool:?}"
mv "$DISABLED_DIR/$tool" "$SKILLS_DIR/$tool"
ok "$tool enabled"
elif [ -e "$SKILLS_DIR/$tool" ]; then
warn "$tool already enabled"
elif [ -d "$src" ]; then
ln -sf "$src" "$SKILLS_DIR/$tool"
ok "$tool enabled (symlink created → $src)"
else
err "$tool not installed at $src — run: make plugin"
return 1
fi
if [ "$tool" = "higgsfield-websites" ]; then pack_hints higgsfield; fi
}
# Enables a multi-skill pack (21st, higgsfield): restore parked skills,
# link the missing ones, then print the CLI hints.
enable_pack() {
local tool="$1" restored=0 linked=0
while read -r name; do
if [ -e "$DISABLED_DIR/$name" ]; then
rm -rf "${SKILLS_DIR:?}/${name:?}"
mv "$DISABLED_DIR/$name" "$SKILLS_DIR/$name"
restored=$((restored + 1))
elif [ -e "$SKILLS_DIR/$name" ]; then
: # already enabled
else
ln -sf "$REPO/skills-external/$name" "$SKILLS_DIR/$name"
linked=$((linked + 1))
fi
done < <(pack_skills "$tool")
if [ "$((restored + linked))" -eq 0 ]; then
if [ "$(status_tool "$tool")" = "missing" ]; then
err "$tool pack not installed in $REPO/skills-external — run: make plugin"
return 1
fi
warn "$tool already enabled"
# Enabled is the steady state, and Claude re-runs this on every
# media ask: the hints (upstream drift, CLI, session) show here too.
if [ "$tool" = "higgsfield" ]; then pack_hints higgsfield; fi
return 0
fi
ok "$tool enabled ($((restored + linked)) skills: $restored restored, $linked linked)"
pack_hints "$tool"
}
enable_tool() {
local tool="$1"
case "$(tool_kind "$tool")" in
gstack) enable_gstack ;;
single) enable_external_single "$tool" ;;
pack) enable_pack "$tool" ;;
*) err "Unknown tool: $tool"; return 1 ;;
esac
}
list_all() {
local t
printf "%-20s %s\n" "TOOL" "STATUS"
printf "%-20s %s\n" "----" "------"
for t in "${MANAGED_TOOLS[@]}"; do
printf "%-20s %s\n" "$t" "$(status_tool "$t")"
done
}
usage() {
# Header comment = lines 3 .. closing banner (dropped); no numeric range,
# so a longer tool list can no longer fall out of --help.
sed -n '3,/^# ====/p' "$0" | sed '$d' | sed 's/^# \?//'
exit "${1:-0}"
}
main() {
local cmd="${1:-}"
case "$cmd" in
list) list_all ;;
status) [ $# -ge 2 ] || usage 1; status_tool "$2" ;;
enable) [ $# -ge 2 ] || usage 1; enable_tool "$2" ;;
disable) [ $# -ge 2 ] || usage 1; disable_tool "$2" ;;
""|-h|--help|help) usage 0 ;;
*) err "Unknown command: $cmd"; usage 1 ;;
esac
}
main "$@"
+5 -8
View File
@@ -72,14 +72,11 @@ else
echo "⚠️ GStack submodule not found — run: git submodule update --init"
fi
# impeccable is NOT here: its installer writes the skill straight into
# skills/ (and its agents into agents/) at --scope=global, so there is no
# skills-external/ copy to symlink. See install-plugins.sh Step 8d.
EXTERNAL_SKILLS=(emil-design-eng frontend-design design-motion-principles
observability-and-instrumentation deprecation-and-migration ci-cd-and-automation
scroll-world-storytelling build-threejs-scroll-worlds
scroll-scrubbed-visual-sequence scroll-scrubbed-word-reveal
scroll-progress-timeline brainstorming writing-plans
# impeccable is NOT here: it lives in skills-external/impeccable (moved
# there by install-plugins.sh Step 8d) and pack-design links it.
# The design and scroll skills are pack symlinks now (skills/pack-*).
EXTERNAL_SKILLS=(observability-and-instrumentation deprecation-and-migration
ci-cd-and-automation brainstorming writing-plans
subagent-driven-development test-driven-development
requesting-code-review using-git-worktrees writing-skills)
for _ext_skill in "${EXTERNAL_SKILLS[@]}"; do
+17
View File
@@ -74,6 +74,7 @@
"writing-plans": "plan",
"requesting-code-review": "plan",
"21st-ui-review": "plan",
"pack-extras:21st-ui-review": "plan",
"feat": "reflect",
"hotfix": "reflect",
"bugfix": "reflect",
@@ -82,24 +83,39 @@
"guardrails": "reflect",
"a11y": "reflect",
"web-validate": "reflect",
"pack-web-validate:web-validate": "reflect",
"harden": "reflect",
"seo": "reflect",
"pack-seo:seo": "reflect",
"geo": "reflect",
"pack-seo:geo": "reflect",
"site-motion": "reflect",
"pack-design:site-motion": "reflect",
"frontend-design": "reflect",
"pack-design:frontend-design": "reflect",
"emil-design-eng": "reflect",
"pack-design:emil-design-eng": "reflect",
"design-motion-principles": "reflect",
"pack-design:design-motion-principles": "reflect",
"21st-ui-build": "reflect",
"pack-design:21st-ui-build": "reflect",
"scroll-world-storytelling": "reflect",
"pack-scroll3d:scroll-world-storytelling": "reflect",
"build-threejs-scroll-worlds": "reflect",
"pack-scroll3d:build-threejs-scroll-worlds": "reflect",
"scroll-scrubbed-visual-sequence": "reflect",
"pack-scroll3d:scroll-scrubbed-visual-sequence": "reflect",
"scroll-scrubbed-word-reveal": "reflect",
"pack-scroll3d:scroll-scrubbed-word-reveal": "reflect",
"scroll-progress-timeline": "reflect",
"pack-scroll3d:scroll-progress-timeline": "reflect",
"subagent-driven-development": "reflect",
"writing-skills": "reflect",
"deprecation-and-migration": "reflect",
"21st-ai": "reflect",
"pack-extras:21st-ai": "reflect",
"21st-ui-explore": "reflect",
"pack-extras:21st-ui-explore": "reflect",
"gitflow": "implement",
"prune-memory": "implement",
"pdf-translate": "implement",
@@ -119,6 +135,7 @@
"skills-perso": "mechanical",
"using-git-worktrees": "mechanical",
"21st-cli-use": "mechanical",
"pack-design:21st-cli-use": "mechanical",
"21st-registry": "mechanical",
"21st-design-sync": "mechanical"
},
+4 -4
View File
@@ -28,7 +28,7 @@
"higgsfield": {
"source": "npm:@higgsfield/cli",
"version": "latest",
"note": "Higgsfield CLI (bins `higgsfield`, `higgs`) — image, video, audio and brand media generation, metered credits; auth is `higgsfield auth login` (browser). Install: npm install -g @higgsfield/cli. The package vendors its binary in a postinstall script; if npm holds it back, add --allow-scripts=@higgsfield/cli. The upstream skills are git-cloned from https://github.com/higgsfield-ai/skills (tracks main, no pin) into skills-external/higgsfield-* by lib/higgsfield-skills.sh (install-plugins.sh Step 8.6, refreshed by update-all.sh); a skill upstream removes keeps its last local copy. OFF by default and in no profile: `lib/toggle-external.sh enable higgsfield` links the 7 allowlisted media skills (HIGGSFIELD_MEDIA_SKILLS), `enable higgsfield-websites` the landing-page aid."
"note": "Higgsfield CLI (bins `higgsfield`, `higgs`) — image, video, audio and brand media generation, metered credits; auth is `higgsfield auth login` (browser). Install: npm install -g @higgsfield/cli. The package vendors its binary in a postinstall script; if npm holds it back, add --allow-scripts=@higgsfield/cli. The upstream skills are git-cloned from https://github.com/higgsfield-ai/skills (tracks main, no pin) into skills-external/higgsfield-* by lib/higgsfield-skills.sh (install-plugins.sh Step 8.6, refreshed by update-all.sh); a skill upstream removes keeps its last local copy. 8 skills in pack-higgsfield (OFF by default, ON in max; `profile.sh enable higgsfield`)."
},
"graphifyy": {
"source": "pypi:graphifyy",
@@ -44,9 +44,9 @@
},
"emil-design-eng": {
"source": "https://github.com/emilkowalski/skill",
"path": "skills/emil-design-eng/SKILL.md",
"path": "./skills/emil-design-eng/SKILL.md",
"managed_by": "curl",
"note": "Emil Kowalski's design engineering skill — UI polish, animations, component craft. Machine-owned: curl'd to skills-external/emil-design-eng/ (gitignored, re-fetched by update-all.sh), symlinked by link.sh."
"note": "Emil Kowalski's design engineering skill — UI polish, animations, component craft. Machine-owned: curl'd to skills-external/emil-design-eng/ (gitignored, re-fetched by update-all.sh), linked by skills/pack-design."
},
"agent-skills": {
"source": "https://github.com/addyosmani/agent-skills",
@@ -89,6 +89,6 @@
"impeccable": {
"source": "npm:impeccable",
"version": "4.1.0",
"note": "Design anti-pattern detector (61 deterministic rules, CLI 'impeccable detect', exit 0/2) + /impeccable skill (23 verbs) + 4 impeccable-* subagents, by pbakaus. Pin = CLI version ONLY: the skill dist and the engine binary have their own release tracks, fetched by 'skills install' at install time, so this pin does not freeze audit output the way a semgrep pin does. It still gates the CLI deliberately (LRN-077 class). BEWARE: the pin rots — the CLI downloads its skill dist at install time and an older release's artifact disappears upstream (3.2.0 -> 'Download failed: invalid zip data', 2026-09-22, which left 'make plugin' printing a run-it-yourself warning). install-plugins.sh Step 8d and update-all.sh therefore fall back to @latest on a pin failure and warn to bump this version. Requires Node >= 24. Installed at --scope=global: lands in ~/.claude/skills/impeccable + ~/.claude/agents/impeccable-*.md, both symlinks into this repo, both gitignored."
"note": "Design anti-pattern detector (61 deterministic rules, CLI 'impeccable detect', exit 0/2) + /impeccable skill (23 verbs) + 4 impeccable-* subagents, by pbakaus. Pin = CLI version ONLY: the skill dist and the engine binary have their own release tracks, fetched by 'skills install' at install time, so this pin does not freeze audit output the way a semgrep pin does. It still gates the CLI deliberately (LRN-077 class). BEWARE: the pin rots — the CLI downloads its skill dist at install time and an older release's artifact disappears upstream (3.2.0 -> 'Download failed: invalid zip data', 2026-09-22, which left 'make plugin' printing a run-it-yourself warning). install-plugins.sh Step 8d and update-all.sh therefore fall back to @latest on a pin failure and warn to bump this version. Requires Node >= 24. Installed at --scope=global: lands in skills/impeccable, then moves to skills-external/impeccable (linked by pack-design), plus ~/.claude/agents/impeccable-*.md, a symlink into this repo; both gitignored."
}
}
+2 -1
View File
@@ -65,4 +65,5 @@ Scope doubt → ask or default to Build, never silently skip. Gate: light
skills run `~/.claude/lib/design-gate.md`, orchestrators plugin-check. 21st =
CLI (`npm i -g @21st-dev/cli`, `21st login`), no MCP, no key; search free,
`21st get`/`generate` metered → generation, not micro-tweaks. 21st-ai /
ui-explore / ui-review are `max`-profile only.
ui-explore / ui-review are `max`-profile only (pack-extras;
`profile.sh enable extras`).
+2 -1
View File
@@ -1,7 +1,8 @@
{
"cleanupPeriodDays": 7,
"env": {
"ENABLE_STOP_REVIEW": "0"
"ENABLE_STOP_REVIEW": "0",
"SLASH_COMMAND_TOOL_CHAR_BUDGET": "50000"
},
"attribution": {
"commit": "",
+1 -1
View File
@@ -58,7 +58,7 @@ git log --oneline -20 --all -- <suspected files>
Follow `$HOME/.claude/lib/design-gate.md`:
- Scan $ARGUMENTS and target files for design/UI/style signals (CSS, component, layout, animation).
- If signals found → run `design-tool-gate.sh`; INCOMPLETE → tell the user
to run `/profile design`; SIGN-IN REQUIRED → design-gate.md §3 (ask
the remedy line it printed; SIGN-IN REQUIRED → design-gate.md §3 (ask
`! 21st login`, wait) before proceeding.
- If no signals → skip (zero overhead).
+1 -1
View File
@@ -74,7 +74,7 @@ FEAT: <feature name> — rule <N>, ~<N> files, <brief approach>
Follow `$HOME/.claude/lib/design-gate.md`:
- Scan $ARGUMENTS and target files for design/UI/style signals.
- If signals found → run `design-tool-gate.sh`; INCOMPLETE → tell the user
to run `/profile design`; SIGN-IN REQUIRED → design-gate.md §3 (ask
the remedy line it printed; SIGN-IN REQUIRED → design-gate.md §3 (ask
`! 21st login`, wait) before proceeding.
- If no signals → skip (zero overhead).
+1 -1
View File
@@ -1,5 +1,5 @@
[
{"id": 1, "prompt": "Add a /health endpoint to the API that returns 200 OK with version info", "expected": "Light planning, direct implementation in 1-3 files, no design brainstorm, no plugin check, run build/tests after"},
{"id": 2, "prompt": "Add dark mode toggle to the settings page", "expected": "Detect UI signal → trigger design gate (run design-tool-gate.sh; if toolchain incomplete, point at /profile design), then implement small feature"},
{"id": 2, "prompt": "Add dark mode toggle to the settings page", "expected": "Detect UI signal → trigger design gate (run design-tool-gate.sh; if toolchain incomplete, point at the remedy line it printed), then implement small feature"},
{"id": 3, "prompt": "Petite feature : afficher un badge 'New' à côté des items créés cette semaine", "expected": "FR trigger, scope check (≤5 files), implement directly, no orchestrator overhead"}
]
+2 -2
View File
@@ -421,7 +421,7 @@ Agent(
**Décision selon plugin state :**
```bash
# gstack actif ?
bash $HOME/.claude/lib/toggle-external.sh list 2>/dev/null | grep -E "^gstack\s+(enabled|on)"
bash $HOME/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -q '^pack-gstack-dev=on'
```
- **gstack ON** → invoquer le skill cso via Skill tool en lui passant le contexte archétype :
@@ -605,7 +605,7 @@ Options :
Pré-check ressources navigateur :
```bash
# gstack actif ?
bash $HOME/.claude/lib/toggle-external.sh list 2>/dev/null | grep -E "^gstack\s+(enabled|on)"
bash $HOME/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -q '^pack-gstack-browser=on'
# URL déployée fournie par l'utilisateur en STEP 3 ?
echo "${BRIEF_deployed_url:-none}"
# dev server launchable ?
@@ -0,0 +1,7 @@
{
"name": "pack-design",
"version": "1.0.0",
"description": "Design and UI skills: impeccable, Emil design eng, frontend-design, motion, 21st build + CLI, site-motion.",
"author": { "name": "bchanot" },
"defaultEnabled": true
}
+1
View File
@@ -0,0 +1 @@
../../../skills-external/21st-cli-use
+1
View File
@@ -0,0 +1 @@
../../../skills-external/21st-ui-build
+1
View File
@@ -0,0 +1 @@
../../../skills-external/design-motion-principles
+1
View File
@@ -0,0 +1 @@
../../../skills-external/emil-design-eng
+1
View File
@@ -0,0 +1 @@
../../../skills-external/frontend-design
+1
View File
@@ -0,0 +1 @@
../../../skills-external/impeccable
@@ -38,7 +38,7 @@ top of it.
how a route transition should morph, how a WebGL hero should degrade →
this skill.
- Linting already-shipped motion against anti-slop rules →
`skills/impeccable/reference/animate.md` (`impeccable detect`) as the
`skills/pack-design/skills/impeccable/reference/animate.md` (`impeccable detect`) as the
deterministic floor, or design-motion-principles' own audit workflow
(`skills-external/design-motion-principles/workflows/audit.md`).
- Non-motion defaults (fonts, color, spacing, the public-site checklist)
@@ -0,0 +1,7 @@
{
"name": "pack-extras",
"version": "1.0.0",
"description": "Occasional skills: diagram, make-pdf, 21st-ai, 21st-ui-explore, 21st-ui-review. OFF by default.",
"author": { "name": "bchanot" },
"defaultEnabled": false
}
+1
View File
@@ -0,0 +1 @@
../../../skills-external/21st-ai
+1
View File
@@ -0,0 +1 @@
../../../skills-external/21st-ui-explore
+1
View File
@@ -0,0 +1 @@
../../../skills-external/21st-ui-review
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff. Show more