Merge bugfix/banner-effective-profile into develop
This commit is contained in:
commit
a655b06eee
13 files changed
+307
-17
No files matched your search
@@ -5,8 +5,10 @@
|
||||
|
||||
<!-- code-clean run 2026-11-09 (BDR-125 obsolescence pass), report .claude/tasks/plans/2026-11-09-bdr125-obsolescence-clean-1650.md -->
|
||||
- hooks/session-start.sh:200-217 + lib/detect-plugins.sh:49-52 (`detect_uiux_pro_max`) — the banner "ALWAYS ON" row and the ui-ux-pro-max toggle row read user-scope settings.json / plugin cache, not the effective profile (`profile.sh current --plain`, BDR-134 single source of truth): a dev or minimal project shows ui-ux-pro-max on; pr-review-toolkit on in max/audit is not shown. Severity: low (banner only). Discovered while: code-clean 2026-11-09 (phase 5 sweep). Not fixed.
|
||||
FIXED 2026-11-10 (/bugfix, bugfix/banner-effective-profile): new `list_on_plugins` (lib/detect-plugins.sh) = effective profile for the ids lib/profiles manages, user-scope true for the others; the ✅ row reads it (model-router now shown, user choice) and `detect_uiux_pro_max` = cache AND enabled; pipefail-safe for doctor.sh; test lib/tests/session-banner.test.sh SB1-SB8.
|
||||
- hooks/session-start.sh:177-183 + agents/plugin-advisor.md:193,197,211,226,233,263 vs doctor.sh:520-526 — passive-cost constants disagree (banner/advisor: gstack 2750, ui-ux-pro-max 400, context7 200, graphify 300; doctor dropped gstack/context7/graphify 2026-09-28 as double counting, ui-ux-pro-max 670); agents/status-reporter.md:26-30 names doctor as source of truth. Severity: low (estimates). Discovered while: code-clean 2026-11-09. Not fixed.
|
||||
- hooks/session-start.sh:404-408 (`_digest_journal`) — greps `^- ` without skipping HTML comments; templates/memory/journal.md:19-21 holds `- <line …>` bullets inside `<!-- -->`, so a template-born project prints "- journal: <line 3-5 max>" in the session digest until its first journal write. Fix template and digest together. Severity: low. Discovered while: code-clean 2026-11-09 (phase 4 sweep). Not fixed.
|
||||
FIXED 2026-11-09 (/hotfix, bugfix/digest-journal-comment): the digest skips HTML comment blocks (opener anchored at line start, CommonMark rule; an inline `<!--` in a bullet stays text), test SD18; the template stays byte-identical (copied by onboarder/init-project/memory.sh), so fixing the template was not needed.
|
||||
- agents/status-reporter.md:35 + agents/plugin-probe.md:22-23,69 — report installed (cache) or user-scope `claude plugin list` state as "active"; the per-project state is the PROFILE line (`current --plain`). Severity: low. Discovered while: code-clean 2026-11-09. Not fixed.
|
||||
FIXED 2026-11-10 (/bugfix, bugfix/banner-effective-profile): status-reporter takes `Plugins ON:` from `list_on_plugins` + `pack-*=on` (cache = installed only); plugin-probe comment and plugin-advisor INPUT name PROFILE as the per-project source (PLUGINS = installed).
|
||||
- agents/handover-doc-writer.md:77-84 — parses registry statuses by hand ("open vs resolved"), the class behind the BLK-032..034 false-open (BDR-129). A fix must read `memory.sh -C <project> index` on v2 registries and keep the `## Index` read on v1 registries never upgraded (`memory.sh index` ignores a v1 Index; memory.sh:21-23). Severity: medium (client deliverable). Discovered while: code-clean 2026-11-09. Not fixed.
|
||||
@@ -391,3 +391,9 @@ rules:
|
||||
- **Real cause**: stub pattern (LRN-263) copied inline, fail-open: failed write (no `set -e`) or noexec TMPDIR (`command -v` skips non-exec) → real CLI; relative work dir passes same-cwd check, breaks after hook's `cd`.
|
||||
- **Solution**: shared `lib/tests/claude-stub.sh`: `stub_first_or_die` (command -v == stub else exit 1), `claude_stub_install` (absolute dir via `cd -P`, every step `|| exit 1`, control from `/`, `GIT_CEILING_DIRECTORIES`), `claude_stub_calls`; 6 suites adopt, each ends zero-call check; `lib/tests/claude-stub.test.sh` proves fail-closed (no-op chmod script + sentinel fake claude). Commits dc5f127, 7ca6b18 on bugfix/safety-residuals.
|
||||
- **Status**: resolved dc5f127
|
||||
|
||||
## BLK-046 — Banner plugin rows showed user-scope state, not effective profile [resolved 556d0e6] (2026-11-10)
|
||||
- **Date**: 2026-11-10
|
||||
- **Friction**: session banner plugin rows showed user-scope state, not project's. dev project showed `ui-ux-pro-max` in `🟢 ON`; audit project hid `pr-review-toolkit`; /status read `~/.claude/plugins/cache` as active.
|
||||
- **Real cause**: `detect_uiux_pro_max` tested plugin cache only (installed = on); ✅ row grepped `"<id>": true` in user `~/.claude/settings.json`. PROFILE_PLAIN (`profile.sh current --plain`) already held effective state, unused there. Found by code-clean 2026-11-09 (G1, G4).
|
||||
- **Solution**: `list_on_plugins` in lib/detect-plugins.sh: profile `plugin:<id>=on` for managed ids, user-scope true for rest, awk set difference, `return 0`. ✅ row + detect_uiux_pro_max (cache AND enabled) + status-reporter read it; plugin-advisor INPUT names PROFILE. Test lib/tests/session-banner.test.sh SB1-SB8. Commit 556d0e6.
|
||||
@@ -712,3 +712,6 @@ rules:
|
||||
- 2026-11-09: /ship-feature connector-deny-cleanup (chore): dead higgsfield deniedMcpServers + census rule + prose citers removed, 12 files, T13 deny-set test; challenge 3x SOLID, verifier ECARTS x2 (revert hint) -> CONFORME, security PASS x3, opus review fixes. BDR-134 amended, LRN-272/273. Merge on signal.
|
||||
- 2026-11-09: /code-clean BDR-125 obsolescence pass: phases 0/1/2 clean, 4a-4d code clean, 5 all declared artifacts gone; 2 dead sources + 5 stale comments fixed; challenge FATAL x3 on r1 (A2 bench importer, B9 unique security rules, prompt edits = behavior) -> r2; bugs G1-G5 logged, D1-D6 queued in TODO.
|
||||
- 2026-11-09: /hotfix G3 digest journal: _digest_journal awk skips <!-- --> blocks (opener anchored line start, END guard), SD18 3 checks; challenge MAJOR x2 (unanchored opener) folded; template untouched; security PASS.
|
||||
|
||||
## 2026-11-10
|
||||
- 2026-11-10: /bugfix G1+G4 banner effective profile: list_on_plugins (profile managed ids, user scope rest) feeds ✅ row, detect_uiux_pro_max, /status; 2 challenge rounds (doctor pipefail BLOCKER r2), gates MET/CONFORME/PASS; 556d0e6, changelog 6cdc374.
|
||||
@@ -2016,3 +2016,8 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
- **Pattern**: `gitflow finish` purges transient `docs/superpowers/{specs,plans}` only on feature/bugfix branches (BDR-065, `_gitflow_purge_transient`). /ship-feature on a `chore/*` branch (cleanup, no new behavior per gitflow doctrine) → write the plan to `.claude/tasks/plans/<date>-<slug>-<HHMM>.md` (durable, allowlisted), else transient plan lands on develop.
|
||||
- **Context**: 2026-11-09 connector-deny cleanup via /ship-feature: writing-plans default path docs/superpowers/plans; caught by the transient-artifacts path rule before commit, plan moved.
|
||||
- **Future use**: ship-feature STEP 4 says `start feature`; when doctrine says chore, also move the plan path. Candidate: ship-feature/writing-plans note.
|
||||
|
||||
## LRN-274 — Pipefail callers: no pipe into grep -q, capture output, awk set difference, return 0 (2026-11-10)
|
||||
- **Context**: `list_on_plugins` r2 draft = brace group piped into while loop, ending on `grep -vxF -f`; `detect_uiux_pro_max` = `list_on_plugins | grep -q`. doctor.sh runs `set -euo pipefail`. Grep selecting nothing exits 1; `grep -q` early exit gives SIGPIPE 141. Under pipefail both leak: detect reads OFF though match found. Challenger ran it: `list rc=1`, `detect rc=1`. Test suites run `set -u` only, so tests stayed green.
|
||||
- **Pattern**: lib function sourced by a pipefail caller: capture output into var, test with here-string (`grep -q x <<<"$(fn)"`); set difference in awk not `grep -v -f` (empty pattern file also non-portable); assignment fallbacks `|| var=""`; explicit `return 0` on printing functions.
|
||||
- **Future application**: any lib/*.sh sourced by doctor.sh or another `set -euo pipefail` script; add one test case run inside a `set -euo pipefail` subshell.
|
||||
@@ -0,0 +1,28 @@
|
||||
# CONTRACT — banner-effective-profile
|
||||
- date: 2026-11-10 | flow: bugfix | branch: bugfix/banner-effective-profile
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
G1+G4 from .claude/audits/BUGS-FOUND.md (code-clean 2026-11-09). G1: hooks/session-start.sh:200-217 banner "ALWAYS ON" row + ui-ux-pro-max toggle row, and lib/detect-plugins.sh:49-52 `detect_uiux_pro_max`, read user-scope settings.json / plugin cache, not the effective profile (`bash lib/profile.sh current --plain`, BDR-134 single source of truth): a dev or minimal project shows ui-ux-pro-max on; pr-review-toolkit on in max/audit is not shown. G4: agents/status-reporter.md:35 + agents/plugin-probe.md:22-23,69 report installed (cache) or user-scope `claude plugin list` state as "active"; the per-project state is the PROFILE line (`current --plain`). Fix: per-project effective state from profile.sh in the banner rows and detection, and agents report active per the profile, installed separately. Regression test in the existing session-start / detect-plugins test suites. Mark both BUGS-FOUND entries FIXED. make test needs GATES_TIMEOUT=600 + PATH=$HOME/.bun/bin:$PATH (LRN-271). Foreign-code style (keep file style).
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: once the ✅ ON row reads the effective profile, model-router (on in every profile) appears; show it? / A: show it (user, 2026-11-10) [gated]
|
||||
Q: regression test location ("existing session-start / detect-plugins suites" do not exist; only session-digest.test.sh runs the hook)? / A: new lib/tests/session-banner.test.sh, same harness style (orchestrator, internal)
|
||||
Q: plan revisions? / A: plan r3 after two challenge rounds: .claude/tasks/plans/2026-11-10-banner-effective-profile-1015.md is the binding FIX PLAN (orchestrator)
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. Symptom gone: in a project whose local profile is dev, the banner's 🟢 row omits ui-ux-pro-max; under audit the ✅ row shows pr-review-toolkit; `detect_uiux_pro_max` follows the effective profile and stays correct under `set -euo pipefail`; regression suite present and green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && make test suite=lib/tests/session-banner.test.sh 2>&1 | tail -1 | grep -q 'all suites green' && grep -q 'SB1' lib/tests/session-banner.test.sh && grep -q 'SB2' lib/tests/session-banner.test.sh && grep -q 'pipefail' lib/tests/session-banner.test.sh && grep -q '^list_on_plugins()' lib/detect-plugins.sh && echo SYMPTOM-GONE
|
||||
EXPECT: SYMPTOM-GONE
|
||||
EVIDENCE: MET exit=0 marker-found :: SYMPTOM-GONE
|
||||
2. Agents report per-project state: status-reporter derives Plugins ON from `list_on_plugins` (no `bash -c`), cache = installed only; plugin-probe comment and plugin-advisor INPUT name PROFILE as the per-project source.
|
||||
CHECK: cd /home/bchanot/Documents/claude && grep -q 'list_on_plugins' agents/status-reporter.md && ! grep -q 'for active marketplace plugins' agents/status-reporter.md && ! grep -q 'bash -c' agents/status-reporter.md && grep -q 'profile-unavailable' agents/status-reporter.md && grep -q 'per-project state = PROFILE' agents/plugin-probe.md && grep -q 'never per-project' agents/plugin-advisor.md && echo AGENTS-OK
|
||||
EXPECT: AGENTS-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: AGENTS-OK
|
||||
3. Build/tests green (full suite, GATES_TIMEOUT=600, bun on PATH); shellcheck at warning level clean on the touched shell files.
|
||||
CHECK: cd /home/bchanot/Documents/claude && shellcheck -S warning lib/detect-plugins.sh hooks/session-start.sh lib/tests/session-banner.test.sh && make test 2>&1 | tail -1 | grep -q 'all suites green' && echo GREEN
|
||||
EXPECT: GREEN
|
||||
EVIDENCE: MET exit=0 marker-found :: GREEN
|
||||
|
||||
## FILE SCOPE
|
||||
lib/detect-plugins.sh, hooks/session-start.sh (✅ row source + comment only), agents/status-reporter.md, agents/plugin-probe.md (:22 comment only), agents/plugin-advisor.md (one INPUT sentence), lib/tests/session-banner.test.sh (new); bookkeeping (orchestrator): .claude/audits/BUGS-FOUND.md
|
||||
@@ -0,0 +1,83 @@
|
||||
# FIX — banner-effective-profile (/bugfix G1+G4, 2026-11-10) — r3 after two challenge rounds
|
||||
|
||||
Source: .claude/audits/BUGS-FOUND.md entries G1 (session-start banner) and G4 (status-reporter, plugin-probe).
|
||||
|
||||
## Diagnosis
|
||||
Symptom: the session banner and two agents report user-scope / installed plugin state as the project's active state.
|
||||
- `lib/detect-plugins.sh` `detect_uiux_pro_max` only tests the plugin cache: installed = on. A project whose effective profile disables it (dev, minimal, seo, qa, audit) still shows `ui-ux-pro-max` in the 🟢 ON row.
|
||||
- `hooks/session-start.sh` ✅ ON row (≈:200-219) greps `"<name>@<mkt>": true` in `$HOME/.claude/settings.json` (user scope). A project profile that enables `pr-review-toolkit` (max, audit) is not shown; one that disables a user-enabled plugin still shows it.
|
||||
- `PROFILE_PLAIN` (session-start ≈:98-100, one `profile.sh -C "$PWD" current --plain` run, exported) already holds the effective state: `pack-*=on|off` lines and `plugin:<id>=on|off` lines for every id managed by lib/profiles/*.json (one shared key set of 15 ids; 6 non-pack: model-router@skills-dir, security-guidance@claude-code-plugins, ui-ux-pro-max@ui-ux-pro-max-skill, pr-review-toolkit@claude-code-plugins, example-skills@anthropic-agent-skills, brightdata-plugin@synced). `detect_gstack` already reads it.
|
||||
- G4: `agents/status-reporter.md:23` "Active plugins (from session-start detection)" and :35 "Check `~/.claude/plugins/cache` for active marketplace plugins" (cache = installed, not active); :181 error row ties ON to the cache. `agents/plugin-probe.md:22` labels `claude plugin list` "(ids, enabled state)" and the PROBE REPORT `PLUGINS` field (:69) carries it raw; plugin-advisor (`ACTIVE:` block, plugin-advisor.md:98) has no rule saying which field holds per-project state, so it can read PLUGINS as active.
|
||||
Evidence: fake HOME (lib + skills symlinked, cache dir, user settings ui-ux-pro-max true) + project settings.local.json = lib/profiles/dev.json → `profile.sh current --plain` prints `plugin:ui-ux-pro-max@ui-ux-pro-max-skill=off`, banner prints `🟢 ON : gstack ui-ux-pro-max context7 graphify`.
|
||||
Blast radius: doctor.sh:528 calls `detect_uiux_pro_max` for its passive-cost sum (repo cwd; after the fix it follows the cwd profile, intended; constants are G2). No other caller.
|
||||
|
||||
## Rule (r3, after round 2: doctor pipefail BLOCKER, scope trimmed)
|
||||
ENABLED for this project and conversation = `plugin:<id>=on` in the effective profile for the ids lib/profiles manages (BDR-134); for an id the profile does not list, `"<id>": true` in user-scope `$HOME/.claude/settings.json` (today's behavior, LRN-005); `pack-*@skills-dir` ids are never plugins here. Profile empty (profile.sh failed) → every id falls to the user-scope rule.
|
||||
No new install check: the ✅ row never had one; `detect_uiux_pro_max` keeps its existing cache glob AND adds ENABLED.
|
||||
Round-2 findings deliberately NOT taken (named in the shortcut comment, deferred to a later run): a mod's per-machine off switch (`~/.claude/model-router.json` enabled false still shows model-router); unmanaged skills-dir mods absent from every scope (memory@skills-dir, pre-existing omission, not a regression); project/local scope for unmanaged ids; install checks for the `synced` marketplace and for local-scope installs (moot without an install check on the ✅ row).
|
||||
|
||||
## Fix plan
|
||||
1. `lib/detect-plugins.sh`:
|
||||
- header lines 6-7: `detect_*` return 0/1 silently; `detect_plan` and `list_on_plugins` print to stdout.
|
||||
- new function `list_on_plugins` above `# --- Toggle plugins ---` (or in a short "Effective plugin state" block), pipefail-safe, always `return 0`, no pipeline whose status matters, set difference in awk (no `grep -f` on a possibly empty file):
|
||||
```bash
|
||||
list_on_plugins() {
|
||||
# Enabled plugin ids for this project and conversation, one per line:
|
||||
# the effective profile for the ids lib/profiles manages (BDR-134),
|
||||
# user-scope true for the others (LRN-005). Always returns 0.
|
||||
# shortcut: unmanaged ids read user scope only (not project/local) and
|
||||
# a skills-dir mod set in no scope (memory) is not seen, nor a mod's
|
||||
# ~/.claude/<name>.json off switch; upgrade = jq merge of the scopes +
|
||||
# plugin manifests.
|
||||
local plain="${PROFILE_PLAIN:-}" user
|
||||
[ -n "$plain" ] || plain="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" \
|
||||
current --plain 2>/dev/null)" || plain=""
|
||||
user="$(grep -oE '"[A-Za-z0-9_-]+@[A-Za-z0-9_-]+"[[:space:]]*:[[:space:]]*true' \
|
||||
"$HOME/.claude/settings.json" 2>/dev/null)" || user=""
|
||||
awk -F= 'FNR == NR { if (sub(/^plugin:/, "", $1)) { m[$1] = 1
|
||||
if ($2 == "on") print $1 }; next }
|
||||
{ sub(/^"/, ""); sub(/".*$/, "") }
|
||||
$0 != "" && !($0 in m) && $0 !~ /^pack-.*@skills-dir$/' \
|
||||
<(printf '%s\n' "$plain") <(printf '%s\n' "$user")
|
||||
return 0
|
||||
}
|
||||
```
|
||||
(printf always emits at least one line, so FNR == NR stays a valid first-file test even when `plain` is empty. Executor may tidy, keeping: awk set difference, explicit return 0, no pipe into the status.)
|
||||
- `detect_uiux_pro_max`: keep the cache-glob test, then `&& grep -q '^ui-ux-pro-max@' <<<"$(list_on_plugins)"` (here-string, not a pipe), one comment line (installed AND enabled for this project).
|
||||
2. `hooks/session-start.sh` ✅ ON row: the while-loop reads `done < <(sed 's/@.*//' <<<"$(list_on_plugins)")` instead of the user-settings grep; toggle-owned exclusion unchanged; rewrite the comment above it (effective profile for managed ids, user scope for the others, same function as detect_uiux_pro_max and /status). User decision 2026-11-10: `model-router` shown; real order on a default project: `rtk model-router security-guidance` (profile lines sort by id). Empty lines skipped.
|
||||
3. `agents/status-reporter.md`:
|
||||
- PHASE 1 bash block: replace the :23 comment; add (no `bash -c`: settings.json asks on it) `. "$HOME/.claude/lib/detect-plugins.sh" && list_on_plugins || echo "plugins-unavailable"` and `bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current --plain 2>/dev/null | grep -E '^(profile|pack-[a-z0-9-]+)=' || echo "profile-unavailable"`.
|
||||
- :35 → `~/.claude/plugins/cache` = installed, not active; `Plugins ON:` = rtk (if present) + the names printed by `list_on_plugins` (part before `@`) + the `pack-*=on` packs.
|
||||
- Error table :181 → cache unreadable: no effect on `Plugins ON:`; `profile-unavailable` → `Plugins ON:` from `list_on_plugins` (user-scope fallback) with suffix `(profile.sh unavailable: user scope)`; `plugins-unavailable` → `Plugins ON: unknown (detect-plugins.sh unavailable)`.
|
||||
- Passive-cost rule unchanged (G2 separate).
|
||||
4. `agents/plugin-probe.md`: :22 comment only → "Marketplace plugins installed; the enabled column may not reflect the project profile or --settings: per-project state = PROFILE above". PROBE REPORT template unchanged (one carrier for the rule: the advisor, step 5).
|
||||
5. `agents/plugin-advisor.md` INPUT section (after :22-27), one sentence: "`ACTIVE:` = the managed ids from `PROFILE` (`pack-*=on`, `plugin:<id>=on`); an id absent from PROFILE keeps its `PLUGINS` enabled state (user scope); CLIs from `CLIS`. `PLUGINS` alone is installed state, never per-project." No output-format change (D3 untouched).
|
||||
6. Regression test: new `lib/tests/session-banner.test.sh` (Makefile SUITES glob picks it up), `set -u` like its neighbours, summary line `session-banner: %d passed, %d failed` (session-digest format; exit 1 on any fail).
|
||||
Fixtures with mkdir/printf only, never links of the real ~/.claude (no mkhome copy); no `rm` in the body:
|
||||
- `WORK=$(mktemp -d)`, cleanup only by the `trap 'rm -rf "$WORK"' EXIT` of session-digest.test.sh; it removes the two lib/skills links without following them (assert `[ -L ]` on both right after creating them).
|
||||
- fake HOME `$WORK/h1`: `.claude/lib` → `$ROOT/lib` and `.claude/skills` → `$ROOT/skills` (the only two symlinks); real file `.claude/settings.json` = `{"enabledPlugins":{"ui-ux-pro-max@ui-ux-pro-max-skill":true,"security-guidance@claude-code-plugins":true,"foo-extra@somewhere":true,"pack-seo@skills-dir":true}}`; real dir `.claude/plugins/cache/ui-ux-pro-max-skill/ui-ux-pro-max`.
|
||||
- `$WORK/h2` = h1 without the cache dir. `$WORK/h3` = h1 without the `.claude/lib` symlink (profile.sh unreachable). `$WORK/h4` = h1 with user settings holding only managed ids (`ui-ux-pro-max@ui-ux-pro-max-skill`, `security-guidance@claude-code-plugins` true).
|
||||
- Guard before writing any fixture file: `[ ! -L "$h/.claude/settings.json" ] && [ ! -L "$h/.claude/plugins" ]`, else exit 1.
|
||||
- rtk pinned: executable `rtk` stub (`exit 0`) in the claude stub dir on PATH. claude stub (lib/tests/claude-stub.sh, BLK-043); `SESSION_START_OFFLINE=1`.
|
||||
- every fixture project has a `.claude/` dir: `pdev` (settings.local.json = copy of `$ROOT/lib/profiles/dev.json`), `paudit` (audit.json), `pfull` (empty `.claude/`).
|
||||
- helper `onrow` = the `✅ ON` line plus the next line when it is a continuation (`│` + 13 spaces); `toggleon` = `🟢 ON` line plus continuation; `toggleoff` = `⚫ OFF` line plus continuation. Every assertion, positive and negative, runs over these.
|
||||
Cases:
|
||||
- SB1 dev (h1): toggleon lacks `ui-ux-pro-max`, toggleoff has it; onrow has `rtk`, `model-router`, `security-guidance`, `foo-extra`; lacks `pr-review-toolkit`, `pack-seo`.
|
||||
- SB2 audit (h1): onrow has `pr-review-toolkit`; toggleon lacks `ui-ux-pro-max`.
|
||||
- SB3 full (h1): toggleon has `ui-ux-pro-max`; onrow lacks `pr-review-toolkit`.
|
||||
- SB4 `detect_uiux_pro_max` sourced from `$ROOT/lib/detect-plugins.sh`, PROFILE_PLAIN unset: dev/h1 → 1; full/h1 → 0; full/h2 → 1 (not installed).
|
||||
- SB5 profile.sh unreachable (h3, pdev): `detect_uiux_pro_max` → 0 (user-scope true + installed); `list_on_plugins` prints `security-guidance@claude-code-plugins`, `ui-ux-pro-max@ui-ux-pro-max-skill`, `foo-extra@somewhere`, not `pack-seo@skills-dir`.
|
||||
- SB6 pipefail (h4, pfull), in a subshell with `set -euo pipefail` (doctor.sh options): `detect_uiux_pro_max` → 0 and `list_on_plugins` rc 0 and the subshell survives.
|
||||
Red before the fix: SB1 (ui-ux in 🟢), SB2 (pr-review hidden), SB4 dev/h1, SB5/SB6 (function absent).
|
||||
7. Bookkeeping (orchestrator): BUGS-FOUND G1 and G4 FIXED continuation lines.
|
||||
|
||||
## Edge cases
|
||||
- Profile empty (profile.sh missing/failed, no jq): user-scope view for every id; ui-ux still cache-checked.
|
||||
- Id managed and user-enabled: profile wins, no duplicate.
|
||||
- Profile-enabled but not installed (pr-review-toolkit on a host without it): shown in ✅ (no install check, as today for user-enabled ids); ui-ux-pro-max keeps its cache check.
|
||||
- `pack-*@skills-dir` true at user scope: excluded.
|
||||
- doctor.sh (`set -euo pipefail`): `detect_uiux_pro_max` and `list_on_plugins` never return non-zero through a pipe (SB6).
|
||||
- Row width: line 2 of the ✅ row pads but never truncates (pre-existing, unchanged).
|
||||
|
||||
## In-force
|
||||
BDR-134 (profile = single source of truth for per-project state), LRN-005 (never hide a user-enabled plugin), BLK-043 (claude stub in hook tests), LRN-271 (make test env). Foreign-code style: keep file style. Files: 5 code/prompt + 1 new test (the advisor line is the G4 consumer side; > 5 by one, justified: one-sentence edit).
|
||||
@@ -84,6 +84,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
||||
- `hooks/session-start.sh` bounds its `memory.sh check` with `timeout 2` when `timeout` is installed: a hung check no longer stalls every session start.
|
||||
- `lib/memory.sh` reads a path shaped like an awk assignment (`x=1.md`, `a=b`) as a file: `add --body-file`, `check` and `upgrade` prefix it with `./`, where awk took it for a `var=value` operand and read stdin. Tests: `lib/tests/memory.test.sh` T19, T19b, T19c.
|
||||
- Hook-running test suites source `lib/tests/claude-stub.sh`: a logging `claude` stub goes first on PATH and the suite exits if it is not the one resolved, so a hook run can no longer start a real session that re-runs the hook (fork bomb). Suite `lib/tests/claude-stub.test.sh`.
|
||||
- The session banner's ✅ row, `detect_uiux_pro_max` and `/status` `Plugins ON:` follow the effective profile of the project and conversation (`list_on_plugins` in `lib/detect-plugins.sh`). Ids that `lib/profiles` manages come from `profile.sh current --plain`; other ids come from the user-scope `settings.json`. Before, the row read the user-scope `settings.json` and the plugin cache. A `dev` project showed ui-ux-pro-max as on, an `audit` project hid pr-review-toolkit, and model-router (enabled through the profile) did not appear. `/status` no longer treats the plugin cache as active state (the cache means installed). The plugin advisor takes per-project state from PROFILE, not from `claude plugin list`.
|
||||
|
||||
## [2.0.0] — 2026-10-06
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@ field. PROBE REPORT missing or a field absent → emit
|
||||
`PLUGIN CHECK — VERDICT: ERROR(probe report missing/invalid: <what>)` and
|
||||
STOP. Fail closed: no recommendations over invented detection.
|
||||
|
||||
`ACTIVE:` = the managed ids from `PROFILE` (`pack-*=on`, `plugin:<id>=on`);
|
||||
an id absent from PROFILE keeps its `PLUGINS` enabled state (user scope);
|
||||
CLIs from `CLIS`. `PLUGINS` alone is installed state, never per-project.
|
||||
|
||||
`FRAMEWORK-DEPS` carries exact `"dep": "version"` pairs (or
|
||||
`framework-deps-none`). Derive signal classes from those names + versions:
|
||||
`frontend` = react/react-dom/vue/nuxt/svelte/astro/next present;
|
||||
|
||||
@@ -19,7 +19,8 @@ Facts only — no signals, no recommendations, no complexity scoring.
|
||||
# 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)
|
||||
# Marketplace plugins installed; the enabled column may not reflect the
|
||||
# project profile or --settings: per-project state = PROFILE above
|
||||
claude plugin list 2>/dev/null || echo "plugin-list-unavailable"
|
||||
|
||||
# Context7 CLI
|
||||
|
||||
@@ -20,7 +20,9 @@ No modifications. No design. No proposals. Facts only.
|
||||
# Config version
|
||||
cat ~/.claude/lib/../version.txt 2>/dev/null || echo "unknown" # lib symlink resolves into the repo
|
||||
|
||||
# Active plugins (from session-start detection)
|
||||
# Active plugins: enabled for THIS project (effective profile), not the cache
|
||||
. "$HOME/.claude/lib/detect-plugins.sh" && list_on_plugins || echo "plugins-unavailable"
|
||||
bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current --plain 2>/dev/null | grep -E '^(profile|pack-[a-z0-9-]+)=' || echo "profile-unavailable"
|
||||
command -v rtk &>/dev/null && echo "rtk: installed" || echo "rtk: missing"
|
||||
command -v gsd &>/dev/null && gsd --version 2>/dev/null | head -1 || echo "gsd: not installed"
|
||||
|
||||
@@ -32,7 +34,7 @@ grep -E 'PLUGIN_TOKENS \+ [0-9]+' "$(readlink -f "$HOME/.claude/lib")/../doctor.
|
||||
# defer cost to /plugin-check.
|
||||
```
|
||||
|
||||
Check `~/.claude/plugins/cache` for active marketplace plugins.
|
||||
`~/.claude/plugins/cache` = installed, not active. `Plugins ON:` = rtk (if present) + the names printed by `list_on_plugins` (part before `@`) + the `pack-*=on` packs.
|
||||
Check `~/.claude.json` for active MCP servers.
|
||||
|
||||
---
|
||||
@@ -178,7 +180,7 @@ The report is best-effort: a single failing data source must not abort the whole
|
||||
| Failure | Behavior |
|
||||
|---|---|
|
||||
| Permission denied on `git` (sandbox/CI without `.git` access) | Mark `Branch: N/A (permission denied)`, `Uncommitted: N/A`, `RECENT COMMITS: N/A`. Continue to PROJECT/GSD sections. |
|
||||
| Permission denied on `~/.claude/plugins/cache` or `~/.claude.json` | Mark `Plugins ON: unknown (cannot read cache)`. Continue. |
|
||||
| Permission denied on `~/.claude/plugins/cache` or `~/.claude.json` | Cache unreadable: no effect on `Plugins ON:`. `profile-unavailable` → `Plugins ON:` from `list_on_plugins` (user-scope fallback) with suffix `(profile.sh unavailable: user scope)`. `plugins-unavailable` → `Plugins ON: unknown (detect-plugins.sh unavailable)`. Continue. |
|
||||
| gsd CLI snapshot fails or `.gsd/` state unreadable (`gsd.db`, `STATE.md`, per-milestone `<ID>-ROADMAP.md` — post-ADR-013 layout) | Mark `Progress: N/A (gsd state unreadable)`, do NOT abort the section — still print `Status: initialized` and `Milestone: N/A`. |
|
||||
| `package.json` / `pyproject.toml` parse error | Mark `Tests: N/A (manifest parse error)`. Continue. |
|
||||
| `python3` not available in PATH | Skip the python parsing fallbacks; rely on log files + bash-only checks. Mark Tests as `unknown` if no log found. |
|
||||
|
||||
@@ -198,23 +198,22 @@ unset _passive_t _budget_pct _budget
|
||||
echo ""
|
||||
echo "┌─ Claude Code config ──────────────────────────────────┐"
|
||||
# "ALWAYS ON" row — actual state, not hardcoded. RTK is a binary on PATH;
|
||||
# the others are marketplace plugins whose state lives in
|
||||
# settings.json:enabledPlugins. Anything missing/disabled is omitted so
|
||||
# the user sees the real picture instead of a misleading literal.
|
||||
# the others come from list_on_plugins (lib/detect-plugins.sh, same source
|
||||
# as detect_uiux_pro_max and /status): the effective profile for the ids
|
||||
# lib/profiles manages, user-scope settings.json for the rest. A hardcoded
|
||||
# SET under-reports newly enabled plugins (pr-review-toolkit was enabled
|
||||
# yet invisible). LRN-005 class. Missing/disabled is omitted. Plugins owned
|
||||
# by the toggle row below are excluded (dual display).
|
||||
ALWAYS_ON=()
|
||||
detect_rtk &>/dev/null && ALWAYS_ON+=("rtk")
|
||||
# Derive the plugin list from settings.json:enabledPlugins (true entries)
|
||||
# instead of a hardcoded name pair — a hardcoded SET under-reports newly
|
||||
# enabled plugins (pr-review-toolkit was enabled yet invisible). LRN-005
|
||||
# class. Plugins owned by the toggle row below are excluded (dual display).
|
||||
_toggle_owned=" gstack ui-ux-pro-max plugin-dev context7 graphify "
|
||||
while IFS= read -r _pl; do
|
||||
[ -n "$_pl" ] || continue
|
||||
case "$_toggle_owned" in
|
||||
*" $_pl "*) : ;;
|
||||
*) ALWAYS_ON+=("$_pl") ;;
|
||||
esac
|
||||
done < <(grep -oE '"[A-Za-z0-9_-]+@[A-Za-z0-9_-]+"[[:space:]]*:[[:space:]]*true' "$HOME/.claude/settings.json" 2>/dev/null \
|
||||
| sed -E 's/^"([^@]+)@.*$/\1/')
|
||||
done < <(sed 's/@.*//' <<<"$(list_on_plugins)")
|
||||
unset _toggle_owned _pl
|
||||
ALWAYS_ON_STR="${ALWAYS_ON[*]:-none}"
|
||||
# Same 40-char-width split policy as the toggle row below — keeps the
|
||||
|
||||
+30
-4
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# lib/detect-plugins.sh — Single source of truth for plugin detection
|
||||
# Sourced by: session-start.sh, doctor.sh
|
||||
# Sourced by: session-start.sh, doctor.sh, agents/status-reporter.md
|
||||
#
|
||||
# Each function returns 0 (detected) or 1 (not detected).
|
||||
# No output — callers handle messaging.
|
||||
# detect_* return 0 (detected) or 1 (not detected), silently — callers
|
||||
# handle messaging. detect_plan and list_on_plugins print to stdout.
|
||||
# ============================================================
|
||||
|
||||
# --- Always-on plugins ---
|
||||
@@ -23,6 +23,30 @@ detect_superpowers() {
|
||||
}
|
||||
|
||||
|
||||
# --- Effective plugin state ---
|
||||
|
||||
list_on_plugins() {
|
||||
# Enabled plugin ids for this project and conversation, one per line:
|
||||
# the effective profile for the ids lib/profiles manages (BDR-134),
|
||||
# user-scope true for the others (LRN-005). Always returns 0.
|
||||
# shortcut: unmanaged ids read user scope only (not project/local) and
|
||||
# a skills-dir mod set in no scope (memory) is not seen, nor a mod's
|
||||
# ~/.claude/<name>.json off switch; upgrade = jq merge of the scopes +
|
||||
# plugin manifests.
|
||||
local plain="${PROFILE_PLAIN:-}" user
|
||||
[ -n "$plain" ] || plain="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" \
|
||||
current --plain 2>/dev/null)" || plain=""
|
||||
user="$(grep -oE '"[A-Za-z0-9_-]+@[A-Za-z0-9_-]+"[[:space:]]*:[[:space:]]*true' \
|
||||
"$HOME/.claude/settings.json" 2>/dev/null)" || user=""
|
||||
awk -F= 'FNR == NR { if (sub(/^plugin:/, "", $1)) { m[$1] = 1
|
||||
if ($2 == "on") print $1 }; next }
|
||||
{ sub(/^"/, ""); sub(/".*$/, "") }
|
||||
$0 != "" && !($0 in m) && $0 !~ /^pack-.*@skills-dir$/' \
|
||||
<(printf '%s\n' "$plain") <(printf '%s\n' "$user")
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# --- Toggle plugins ---
|
||||
|
||||
detect_gstack() {
|
||||
@@ -47,8 +71,10 @@ detect_plugin_dev() {
|
||||
}
|
||||
|
||||
detect_uiux_pro_max() {
|
||||
# installed (cache) AND enabled for this project (here-string: no pipe)
|
||||
local cache_dir="$HOME/.claude/plugins/cache"
|
||||
[ -d "$cache_dir" ] && compgen -G "$cache_dir"/*ui-ux-pro-max* &>/dev/null
|
||||
[ -d "$cache_dir" ] && compgen -G "$cache_dir"/*ui-ux-pro-max* &>/dev/null \
|
||||
&& grep -q '^ui-ux-pro-max@' <<<"$(list_on_plugins)"
|
||||
}
|
||||
|
||||
detect_context7() {
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib/tests/session-banner.test.sh — the banner and detect_uiux_pro_max
|
||||
# follow the project's effective profile, not user scope / the plugin cache
|
||||
# (BDR-134). Fake HOME and projects under mktemp -d; the real ~/.claude is
|
||||
# never linked or touched (only lib/ and skills/ of the repo are linked).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
SS="$ROOT/hooks/session-start.sh"
|
||||
DP="$ROOT/lib/detect-plugins.sh"
|
||||
WORK="$(mktemp -d)" || exit 1; trap 'rm -rf "$WORK"' EXIT
|
||||
export SESSION_START_OFFLINE=1
|
||||
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; }
|
||||
# has <text> <word>: 1 when the text contains the word, else 0
|
||||
has() { case "$1" in *"$2"*) echo 1 ;; *) echo 0 ;; esac; }
|
||||
|
||||
# shellcheck source=lib/tests/claude-stub.sh
|
||||
. "$ROOT/lib/tests/claude-stub.sh" || exit 1
|
||||
claude_stub_install "$WORK"
|
||||
# rtk pinned present, whatever the machine has
|
||||
printf '#!/bin/sh\nexit 0\n' >"$WORK/stub/rtk" || exit 1
|
||||
chmod +x "$WORK/stub/rtk" || exit 1
|
||||
|
||||
UIUX='"ui-ux-pro-max@ui-ux-pro-max-skill":true'
|
||||
SEC='"security-guidance@claude-code-plugins":true'
|
||||
USER_ALL='{"enabledPlugins":{'"$UIUX,$SEC"',"foo-extra@somewhere":true,
|
||||
"pack-seo@skills-dir":true}}'
|
||||
USER_MANAGED='{"enabledPlugins":{'"$UIUX,$SEC"'}}'
|
||||
|
||||
# mkhome <name> <cache:1|0> <lib:1|0> <settings>: fake HOME, two links only
|
||||
mkhome() {
|
||||
local h="$WORK/$1"
|
||||
mkdir -p "$h/.claude" || exit 1
|
||||
if [ -L "$h/.claude/settings.json" ] || [ -L "$h/.claude/plugins" ]; then
|
||||
echo "fixture path is a symlink: $h" >&2; exit 1
|
||||
fi
|
||||
printf '%s\n' "$4" >"$h/.claude/settings.json" || exit 1
|
||||
[ "$2" = 1 ] && mkdir -p \
|
||||
"$h/.claude/plugins/cache/ui-ux-pro-max-skill/ui-ux-pro-max"
|
||||
if [ "$3" = 1 ]; then
|
||||
ln -s "$ROOT/lib" "$h/.claude/lib" || exit 1
|
||||
[ -L "$h/.claude/lib" ] || exit 1
|
||||
fi
|
||||
ln -s "$ROOT/skills" "$h/.claude/skills" || exit 1
|
||||
[ -L "$h/.claude/skills" ] || exit 1
|
||||
}
|
||||
mkhome h1 1 1 "$USER_ALL"
|
||||
mkhome h2 0 1 "$USER_ALL"
|
||||
mkhome h3 1 0 "$USER_ALL"
|
||||
mkhome h4 1 1 "$USER_MANAGED"
|
||||
|
||||
mkdir -p "$WORK/pdev/.claude" "$WORK/paudit/.claude" "$WORK/pfull/.claude" \
|
||||
|| exit 1
|
||||
cp "$ROOT/lib/profiles/dev.json" "$WORK/pdev/.claude/settings.local.json"
|
||||
cp "$ROOT/lib/profiles/audit.json" "$WORK/paudit/.claude/settings.local.json"
|
||||
|
||||
# banner <home> <proj>: the hook output
|
||||
banner() {
|
||||
(cd "$WORK/$2" && HOME="$WORK/$1" bash "$SS" </dev/null 2>/dev/null)
|
||||
}
|
||||
# row <marker> <text>: the marker line plus its continuation line
|
||||
row() {
|
||||
awk -v m="$1" 'f && /^│ {13}/ { print; f = 0; next } { f = 0 }
|
||||
index($0, m) { print; f = 1 }' <<<"$2"
|
||||
}
|
||||
|
||||
# SB1: dev project, user scope has ui-ux-pro-max on
|
||||
out="$(banner h1 pdev)"
|
||||
on="$(row '🟢 ON' "$out")"; off="$(row '⚫ OFF' "$out")"
|
||||
ok="$(row '✅ ON' "$out")"
|
||||
check SB1-toggle-on-no-uiux "$(has "$on" ui-ux-pro-max)" 0
|
||||
check SB1-toggle-off-uiux "$(has "$off" ui-ux-pro-max)" 1
|
||||
for w in rtk model-router security-guidance foo-extra; do
|
||||
check "SB1-onrow-$w" "$(has "$ok" "$w")" 1
|
||||
done
|
||||
for w in pr-review-toolkit pack-seo; do
|
||||
check "SB1-onrow-no-$w" "$(has "$ok" "$w")" 0
|
||||
done
|
||||
|
||||
# SB2: audit project shows pr-review-toolkit, hides ui-ux-pro-max
|
||||
out="$(banner h1 paudit)"
|
||||
check SB2-onrow-pr-review "$(has "$(row '✅ ON' "$out")" pr-review-toolkit)" 1
|
||||
check SB2-toggle-on-no-uiux "$(has "$(row '🟢 ON' "$out")" ui-ux-pro-max)" 0
|
||||
|
||||
# SB3: no profile (full): ui-ux-pro-max on, pr-review-toolkit absent
|
||||
out="$(banner h1 pfull)"
|
||||
check SB3-toggle-on-uiux "$(has "$(row '🟢 ON' "$out")" ui-ux-pro-max)" 1
|
||||
ok="$(row '✅ ON' "$out")"
|
||||
check SB3-onrow-no-pr-review "$(has "$ok" pr-review-toolkit)" 0
|
||||
|
||||
# uiux <home> <proj>: exit status of detect_uiux_pro_max, PROFILE_PLAIN unset
|
||||
uiux() {
|
||||
(cd "$WORK/$2" && unset PROFILE_PLAIN && HOME="$WORK/$1" bash -c \
|
||||
". '$DP'; detect_uiux_pro_max; echo \$?")
|
||||
}
|
||||
# SB4: follows the profile, still needs the cache
|
||||
check SB4-dev-off "$(uiux h1 pdev)" 1
|
||||
check SB4-full-on "$(uiux h1 pfull)" 0
|
||||
check SB4-not-installed "$(uiux h2 pfull)" 1
|
||||
|
||||
# SB5: profile.sh unreachable, user-scope fallback
|
||||
check SB5-uiux-fallback "$(uiux h3 pdev)" 0
|
||||
lst="$(cd "$WORK/pdev" && unset PROFILE_PLAIN && HOME="$WORK/h3" bash -c \
|
||||
". '$DP'; list_on_plugins")"
|
||||
for w in security-guidance@claude-code-plugins \
|
||||
ui-ux-pro-max@ui-ux-pro-max-skill foo-extra@somewhere; do
|
||||
check "SB5-list-$w" "$(has "$lst" "$w")" 1
|
||||
done
|
||||
check SB5-list-no-pack "$(has "$lst" pack-seo@skills-dir)" 0
|
||||
|
||||
# SB6: survives set -euo pipefail (doctor.sh options)
|
||||
res="$(cd "$WORK/pfull" && unset PROFILE_PLAIN && HOME="$WORK/h4" bash -c \
|
||||
"set -euo pipefail; . '$DP'; detect_uiux_pro_max; echo u\$?;
|
||||
list_on_plugins >/dev/null; echo l\$?; echo alive" | tr '\n' ' ')"
|
||||
check SB6-pipefail "$res" 'u0 l0 alive '
|
||||
|
||||
# SB7: empty list_on_plugins (no profile.sh, no user id) leaves no empty
|
||||
# element in the ✅ row
|
||||
mkhome h5 0 0 '{"enabledPlugins":{"x@y":false}}'
|
||||
out="$(banner h5 pfull)"
|
||||
ao="$(row '✅ ON' "$out")"; ao="${ao#*: }"; ao="${ao%│}"
|
||||
ao="${ao%"${ao##*[![:space:]]}"}"
|
||||
check SB7-empty-list-rtk-only "$ao" rtk
|
||||
|
||||
# SB8: no hook run of this suite called the claude CLI (BLK-043)
|
||||
check SB8-no-claude-calls "$(claude_stub_calls)" 0
|
||||
|
||||
printf 'session-banner: %d passed, %d failed\n' "$pass" "$fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
Reference in new issue
Block a user