diff --git a/.claude/tasks/contracts/2026-11-21-modern-web-guidance-2314.md b/.claude/tasks/contracts/2026-11-21-modern-web-guidance-2314.md index 292b674..5664706 100644 --- a/.claude/tasks/contracts/2026-11-21-modern-web-guidance-2314.md +++ b/.claude/tasks/contracts/2026-11-21-modern-web-guidance-2314.md @@ -17,6 +17,7 @@ Q: path rule globs / A: unchanged (no .js/.mjs/.ts); plain client JS relies on t Q: chrome-extensions placement / A: always on, as is (its CHROMEWEBSTORE.md behaviour accepted, it only triggers on extension work) [gated 2026-11-21] Q: plugin gate, switch this repo to the dev profile / A: no, keep full [gated 2026-11-21] Q: challenge deferred point (confirmation MAJOR): any main-loop Skill call sets model-router `st.skillRun` (register.ts:4634) and opens the write guard for the session, so the rule's skill call would let the main loop write front code outside a code skill (find-docs already does) / A: reopen — model-router gets a reference-skill list (`modern-web-guidance`, `find-docs`) that never opens the guard, with tests; FILE SCOPE gains mods/model-router/hooks/register.ts and register.test.ts [gated 2026-11-22] +Q: final review Minor 1: a machine without the chrome-extensions copy gets a doctor FAIL (files check), so `make update` exits 1 / A: warning only — check_vendored_skills skips the files check for a link.sh name that is a git-tree dest, checks its symlink only once the copy exists; check_vendored_trees keeps the `make plugin` warn [gated 2026-11-22] ## ACCEPTANCE CRITERIA 1. The Modern Web Guidance guides of tag v1.0.1 (commit 64a6d708f5a43f2cd3fde5d4d7db3905ba1bdf65) and the chrome-extensions skill are vendored, pinned by that commit in plugins.lock.json, installed by `make plugin` and refreshed at the pin by `make update`; no install or use path runs `npx modern-web-guidance` or reaches the network at use time. @@ -51,6 +52,10 @@ Q: challenge deferred point (confirmation MAJOR): any main-loop Skill call sets EVIDENCE: MET exit=0 marker-found :: all suites green 12. [gated 2026-11-22] Doctor: check_vendored_trees warns (never errors) on a missing or stale vendored tree with the remedy `make plugin`, and a missing vendored copy no longer stops doctor under `set -euo pipefail`. 13. [gated 2026-11-22] vendor_pinned_tree refuses before writing anything: a commit not upstream, unsafe lock paths, a dest it did not create (no marker), a symlink in the fetched content or a listed path leaving the checkout; a failed swap restores the previous copy. +14. [gated 2026-11-22] A link.sh EXTERNAL_SKILLS name that is a git-tree dest never gets a doctor error for a missing copy: check_vendored_skills skips its files check and checks its symlink only when skills-external/ exists; a non-tree name keeps the files FAIL; a malformed lock never stops doctor under `set -euo pipefail`; CHANGELOG states it. + CHECK: grep -q 'TREE_OWNED_ABSENT_WARN_ONLY' lib/tests/doctor-vendored.test.sh && grep -q 'TREE_OWNED_LINK_CHECKED' lib/tests/doctor-vendored.test.sh && grep -q 'TREE_NAMES_ERREXIT_BROKEN_LOCK' lib/tests/doctor-vendored.test.sh && make test suite=lib/tests/doctor-vendored.test.sh 2>&1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green ## FILE SCOPE [gated 2026-11-22, STEP 3 approved plan docs/superpowers/plans/2026-11-21-modern-web-guidance.md] diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f499b..5314887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The BDR-125 context queue is delivered: phases 0, 0b, 4a, 1, 5, 2 and 4b-4d ship - **Modern Web Guidance**: Google's guides (GoogleChrome/modern-web-guidance, tag v1.0.1, commit `64a6d70`) are vendored as a git-tree pin (`managed_by: git-tree` in `plugins.lock.json`) into `skills-external/mwg/`, with `chrome-extensions` into `skills-external/chrome-extensions/`. `make plugin` (install-plugins.sh Step 8e) and `make update` fetch them through `lib/vendor-skills.sh vendor_pinned_tree`; a failed fetch keeps the previous copy and warns. Licenses: Apache-2.0 (code), CC-BY 4.0 (guides). - **`modern-web-guidance` skill** (always on): picks guides from the generated `mwg/INDEX.md` and reads them locally, Read only, no npx, no network. It runs first for front-end work (HTML, CSS, client-side JS, components, forms, layout, motion, Core Web Vitals, images, accessibility), and the answer that delivers a front-end change ends with one line, `Modern Web Guidance: , `. - **chrome-extensions**: linked always on by `link.sh`. -- **doctor**: `check_vendored_trees` (lib/doctor-vendored.sh) warns when a git-tree copy under `skills-external/` is missing or its `.vendored-commit` differs from the pin, naming `make plugin`. A warning, never an error. +- **doctor**: `check_vendored_trees` (lib/doctor-vendored.sh) warns when a git-tree copy under `skills-external/` is missing or its `.vendored-commit` differs from the pin, naming `make plugin`. A warning, never an error. `check_vendored_skills` skips the file check for a git-tree copy listed in `link.sh` and checks its symlink only once the copy exists, so a machine that has not fetched it yet gets that warning, not an error. ### Changed - **memory recall**: a prompt after 30 minutes idle now needs 8 content words, up from 5 (a context's first prompt or a design/analysis prompt still needs 5), and the haiku rerank keeps at most 2 entries, down from 3. Measured on the first feedback gate: idle precision 44 %, third pick 35 %. diff --git a/lib/doctor-vendored.sh b/lib/doctor-vendored.sh index 8b9f66a..38210c7 100644 --- a/lib/doctor-vendored.sh +++ b/lib/doctor-vendored.sh @@ -20,6 +20,9 @@ # defaults to ["SKILL.md"]. # 2. the /skills/ symlink points at # /skills-external/. +# A name that is a git-tree dest skips check 1 (check_vendored_trees warns +# on a missing or stale copy) and gets check 2 only once its copy exists, +# since link.sh links it only then. # # Lock parsing via python3 argv (never string-spliced) — same pattern as # lib/vendor-skills.sh's _vendor_read_lock. link.sh's EXTERNAL_SKILLS @@ -202,12 +205,13 @@ _dv_check_name() { # 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 -# iterate). Each from link.sh is checked against the item-name +# iterate). A git-tree dest is left to check_vendored_trees unless its copy +# exists. Each from link.sh is checked against the item-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" - local lock_out names name + local lock_out names name tree_names if ! lock_out="$(_dv_lock_expectations "$repo/plugins.lock.json")"; then warn "plugins.lock.json unreadable or malformed (missing, invalid \ @@ -216,6 +220,10 @@ vendored-skills file check falls back to SKILL.md-only defaults" lock_out="" fi + # git-tree dests: check_vendored_trees owns their presence and pin. + tree_names="$(_dv_tree_expectations "$repo/plugins.lock.json" \ + | cut -f2)" || tree_names="" + if ! names="$(_dv_link_names "$repo/link.sh")" || [ -z "$names" ]; then warn "link.sh EXTERNAL_SKILLS array unreadable — vendored-skills \ check skipped" @@ -229,6 +237,13 @@ check skipped" item-name allowlist — skipped" continue fi + if grep -qxF -- "$name" <<<"$tree_names"; then + # A git-tree copy: a missing one is check_vendored_trees' warn; + # link.sh links it only once the copy exists. + [ -d "$repo/skills-external/$name" ] || continue + _dv_check_link "$claude_home" "$repo" "$name" || true + continue + fi # fail() reports a miss; doctor.sh (set -e) still reaches its summary. _dv_check_name "$repo" "$claude_home" "$name" "$lock_out" || true done <<< "$names" diff --git a/lib/tests/doctor-vendored.test.sh b/lib/tests/doctor-vendored.test.sh index cec7c6a..fde15e4 100644 --- a/lib/tests/doctor-vendored.test.sh +++ b/lib/tests/doctor-vendored.test.sh @@ -16,7 +16,12 @@ # 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 with no -# symlink failing like any other (ALWAYS_ON_LINK_CHECKED). +# symlink failing like any other (ALWAYS_ON_LINK_CHECKED). Git-tree +# dests in link.sh: an absent one only warns via check_vendored_trees +# (TREE_OWNED_ABSENT_WARN_ONLY), a present one skips the file check +# (TREE_OWNED_FILES_SKIPPED) but has its symlink checked +# (TREE_OWNED_LINK_CHECKED), and a broken lock never trips errexit +# (TREE_NAMES_ERREXIT_BROKEN_LOCK). set -u ROOT="$(cd "$(dirname "$0")/../.." && pwd)" LIB="$ROOT/lib/doctor-vendored.sh" @@ -220,5 +225,39 @@ check_bool TREES_MISSING_WARN "$R3" check_bool TREES_NEVER_FAIL "$R4" check_bool TREES_ERREXIT_SURVIVES "$R5" +# ── git-tree dests named in link.sh: presence is check_vendored_trees' job +OWN="$WORK/owned" +mkdir -p "$OWN/skills-external/own-present" "$WORK/owned_home/skills" +printf '%s\n' 1111111111111111111111111111111111111111 \ + > "$OWN/skills-external/own-present/.vendored-commit" +cat > "$OWN/plugins.lock.json" <<'JSON' +{"g": {"managed_by": "git-tree", "commit": "1111111111111111111111111111111111111111", "trees": {"own-present": {".": "x"}, "own-absent": {".": "x"}}}} +JSON +printf 'EXTERNAL_SKILLS=(own-present own-absent plain-missing)\n' \ + > "$OWN/link.sh" +out_o1="$(check_vendored_skills "$OWN" "$WORK/owned_home" 2>&1)" +out_ot="$(check_vendored_trees "$OWN" 2>&1)" +ln -s "$OWN/skills-external/own-present" "$WORK/owned_home/skills/own-present" +out_o2="$(check_vendored_skills "$OWN" "$WORK/owned_home" 2>&1)" +out_eb="$(bash "$WORK/errexit.sh" "$LIB" "$BROKEN" 2>&1)" +check_bool TREE_OWNED_ABSENT_WARN_ONLY \ + "$(! printf '%s' "$out_o1" | grep -qF 'own-absent' \ + && printf '%s' "$out_ot" | grep -qF \ + 'g: skills-external/own-absent missing — run: make plugin' \ + && printf '%s' "$out_o1" | grep -qF \ + 'plain-missing: skills-external/plain-missing/SKILL.md missing' \ + && echo 1 || echo 0)" +check_bool TREE_OWNED_FILES_SKIPPED \ + "$(! printf '%s' "$out_o1" | grep -qF \ + 'own-present: skills-external/own-present/SKILL.md missing' \ + && echo 1 || echo 0)" +check_bool TREE_OWNED_LINK_CHECKED \ + "$(printf '%s' "$out_o1" | grep -qF 'own-present: symlink missing/wrong' \ + && printf '%s' "$out_o2" | grep -qF 'own-present: vendored + linked' \ + && echo 1 || echo 0)" +check_bool TREE_NAMES_ERREXIT_BROKEN_LOCK \ + "$(printf '%s\n' "$out_eb" | grep -qx 'DOCTOR_GOES_ON' \ + && echo 1 || echo 0)" + echo "PASS=$pass FAIL=$fail" [ "$fail" -eq 0 ]