From 8a8d77f98e90288b8fec638278f24420b16a336f Mon Sep 17 00:00:00 2001 From: bchanot Date: Sun, 22 Nov 2026 04:14:23 +0100 Subject: [PATCH] feat(vendor): pin Modern Web Guidance v1.0.1 and chrome-extensions, doctor checks the pin --- .gitignore | 9 ++++++ doctor.sh | 1 + install-plugins.sh | 5 +++- lib/doctor-vendored.sh | 47 ++++++++++++++++++++++++++++++- lib/tests/doctor-vendored.test.sh | 35 +++++++++++++++++++++++ link.sh | 2 +- plugins.lock.json | 13 +++++++++ update-all.sh | 5 ++++ 8 files changed, 114 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 08e43a3..178b92d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ skills/test-driven-development skills/requesting-code-review skills/using-git-worktrees skills/writing-skills +skills/chrome-extensions # Impeccable — `impeccable skills install --scope=global` writes # impeccable/ into the skills dir through the ~/.claude/skills symlink; install-plugins.sh @@ -150,6 +151,14 @@ skills-external/requesting-code-review/ skills-external/using-git-worktrees/ skills-external/writing-skills/ +# Modern Web Guidance, vendored (plugins.lock.json 'modern-web-guidance', +# managed_by git-tree) — machine-owned, fetched at the pinned commit by +# install-plugins.sh Step 8e and update-all.sh 7.3 through +# lib/vendor-skills.sh vendor_pinned_tree. Bump the commit deliberately. +skills-external/mwg/ +skills-external/chrome-extensions/ +skills-external/.vendor-stage.*/ + # 21st.dev skill pack — machine-owned: `21st skills install` output, staged by # install-plugins.sh Step 8.7 (the installer refuses to write through the # ~/.claude/skills symlink, so it runs under a throwaway HOME and the skills diff --git a/doctor.sh b/doctor.sh index 74f9fa8..950190a 100644 --- a/doctor.sh +++ b/doctor.sh @@ -131,6 +131,7 @@ echo "" # ──────────────────────────────────────────────────────────── echo "── Vendored skills ──" check_vendored_skills "$REPO" "$HOME/.claude" +check_vendored_trees "$REPO" echo "" echo "── Profiles ──" diff --git a/install-plugins.sh b/install-plugins.sh index 4e6c533..e4c607a 100644 --- a/install-plugins.sh +++ b/install-plugins.sh @@ -926,10 +926,13 @@ EXT_SKILL_NAMES=(observability-and-instrumentation deprecation-and-migration scroll-scrubbed-visual-sequence scroll-scrubbed-word-reveal scroll-progress-timeline brainstorming writing-plans subagent-driven-development test-driven-development - requesting-code-review using-git-worktrees writing-skills) + requesting-code-review using-git-worktrees writing-skills chrome-extensions) vendor_pinned_skills agent-skills vendor_pinned_skills mengto-skills vendor_pinned_skills superpowers +if ! vendor_pinned_tree modern-web-guidance; then + warn "Modern Web Guidance not vendored (previous copy kept, if any) — rerun: make plugin" +fi for _ext_skill in "${EXT_SKILL_NAMES[@]}"; do if [ -L "$HOME/.claude/skills/$_ext_skill" ]; then ok "$_ext_skill symlink OK" diff --git a/lib/doctor-vendored.sh b/lib/doctor-vendored.sh index 390fab6..cee16a8 100644 --- a/lib/doctor-vendored.sh +++ b/lib/doctor-vendored.sh @@ -227,6 +227,51 @@ check skipped" item-name allowlist — skipped" continue fi - _dv_check_name "$repo" "$claude_home" "$name" "$lock_out" + # fail() reports a miss; doctor.sh (set -e) still reaches its summary. + _dv_check_name "$repo" "$claude_home" "$name" "$lock_out" || true done <<< "$names" } + +# _dv_tree_expectations — prints "\t\t" for +# every "managed_by": "git-tree" entry; dest and commit format-checked, +# an invalid one skipped. Lockfile via argv, stderr discarded. +_dv_tree_expectations() { + python3 - "$1" 2>/dev/null <<'PY' +import json, re, sys +NAME = re.compile(r'^[A-Za-z0-9_-][A-Za-z0-9._-]*$') +COMMIT = re.compile(r'^[0-9a-f]{40}$') +with open(sys.argv[1]) as f: + data = json.load(f) +for key, entry in sorted(data.items()): + if not isinstance(entry, dict) or entry.get("managed_by") != "git-tree": + continue + sha = entry.get("commit", "") + trees = entry.get("trees", {}) + if not COMMIT.fullmatch(sha) or not isinstance(trees, dict): + continue + for dest in sorted(trees): + if NAME.fullmatch(dest): + print(f"{key}\t{dest}\t{sha}") +PY +} + +# check_vendored_trees — every git-tree dest exists under +# skills-external/ with a .vendored-commit equal to its pin. Never fails +# and never trips doctor.sh's errexit: a missing or stale copy is a warn +# naming `make plugin`. +check_vendored_trees() { + local repo="$1" key dest sha got + while IFS=$'\t' read -r key dest sha; do + [ -n "$key" ] || continue + got="$(cat "$repo/skills-external/$dest/.vendored-commit" \ + 2>/dev/null || true)" + if [ -z "$got" ]; then + warn "$key: skills-external/$dest missing — run: make plugin" + elif [ "$got" != "$sha" ]; then + warn "$key: skills-external/$dest at ${got:0:7}, pin ${sha:0:7} \ +— run: make plugin" + else + pass "$key: $dest at pin ${sha:0:7}" + fi + done < <(_dv_tree_expectations "$repo/plugins.lock.json") +} diff --git a/lib/tests/doctor-vendored.test.sh b/lib/tests/doctor-vendored.test.sh index 7a9e557..492e1ea 100644 --- a/lib/tests/doctor-vendored.test.sh +++ b/lib/tests/doctor-vendored.test.sh @@ -183,5 +183,40 @@ check_bool REJECTS_BAD_NAME \ && ! printf '%s' "$out5" | grep -qF '../evil: symlink' \ && echo 1 || echo 0)" +# ── check_vendored_trees: git-tree lock entries; doctor survives errexit ── +TR="$WORK/trees" +mkdir -p "$TR/skills-external/at-pin" "$TR/skills-external/stale" +printf '%s\n' 1111111111111111111111111111111111111111 \ + > "$TR/skills-external/at-pin/.vendored-commit" +printf '%s\n' 2222222222222222222222222222222222222222 \ + > "$TR/skills-external/stale/.vendored-commit" +cat > "$TR/plugins.lock.json" <<'JSON' +{"t": {"managed_by": "git-tree", "commit": "1111111111111111111111111111111111111111", + "trees": {"at-pin": {"x": "a"}, "stale": {"x": "a"}, "absent": {"x": "a"}}}, + "c": {"managed_by": "curl", "commit": "1111111111111111111111111111111111111111", "skills": ["s"]}} +JSON +printf 'EXTERNAL_SKILLS=(\n ghost-ext\n)\n' > "$TR/link.sh" +out_t="$(check_vendored_trees "$TR" 2>&1)" +printf '%s\n' "$out_t" | grep -q 't: at-pin at pin 1111111' && R1=1 || R1=0 +printf '%s\n' "$out_t" | grep -q 't: skills-external/stale at 2222222, pin 1111111' && R2=1 || R2=0 +printf '%s\n' "$out_t" | grep -q 't: skills-external/absent missing' && R3=1 || R3=0 +# Positive control first: the three lines above must exist. +[ "$R1$R2$R3" = 111 ] && ! printf '%s\n' "$out_t" | grep -q '✗' \ + && R4=1 || R4=0 +# doctor.sh runs under `set -euo pipefail`: a missing tree dest and a +# missing external copy are reported and doctor goes on to its summary. +# shellcheck disable=SC2016 +out_e="$(bash -c 'set -euo pipefail; source "$1" + check_vendored_trees "$2"; check_vendored_skills "$2" "$2/home" + echo DOCTOR_GOES_ON' _ "$LIB" "$TR" 2>&1)" +printf '%s\n' "$out_e" | grep -qx 'DOCTOR_GOES_ON' \ + && printf '%s\n' "$out_e" | grep -q 'ghost-ext: skills-external/ghost-ext/SKILL.md missing' \ + && R5=1 || R5=0 +check_bool TREES_AT_PIN "$R1" +check_bool TREES_STALE_WARN "$R2" +check_bool TREES_MISSING_WARN "$R3" +check_bool TREES_NEVER_FAIL "$R4" +check_bool TREES_ERREXIT_SURVIVES "$R5" + echo "PASS=$pass FAIL=$fail" [ "$fail" -eq 0 ] diff --git a/link.sh b/link.sh index 8b75a24..be8f467 100644 --- a/link.sh +++ b/link.sh @@ -78,7 +78,7 @@ fi 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) + requesting-code-review using-git-worktrees writing-skills chrome-extensions) for _ext_skill in "${EXTERNAL_SKILLS[@]}"; do if [ -d "$REPO/skills-external/$_ext_skill" ]; then if [ -L "$CLAUDE/skills/$_ext_skill" ] && [ "$(readlink "$CLAUDE/skills/$_ext_skill")" = "$REPO/skills-external/$_ext_skill" ]; then diff --git a/plugins.lock.json b/plugins.lock.json index 2126086..b4f6567 100644 --- a/plugins.lock.json +++ b/plugins.lock.json @@ -86,6 +86,19 @@ "always_on": true, "note": "Seven superpowers skills vendored byte-for-byte at the v6.4.1 tag commit (obra/superpowers), always on (no profile lists them). Bump the commit deliberately. Scripts inside run as `bash scripts/`, no exec bit needed. Upstream cross-references to the plugin prefix and to the 8 non-vendored skills stay in the text; CLAUDE.global.md Skill routing maps them." }, + "modern-web-guidance": { + "source": "https://github.com/GoogleChrome/modern-web-guidance", + "commit": "64a6d708f5a43f2cd3fde5d4d7db3905ba1bdf65", + "tag": "v1.0.1", + "license": "Apache-2.0 (code), CC-BY 4.0 (guides)", + "managed_by": "git-tree", + "always_on": true, + "trees": { + "mwg": {"guides": "skills/modern-web-guidance/guides", "LICENSE": "LICENSE", "README.md": "README.md"}, + "chrome-extensions": {".": "skills/chrome-extensions"} + }, + "note": "Google Modern Web Guidance (Chrome, Edge, Firefox, MDN). Guides read locally by skills/modern-web-guidance; the upstream SKILL.md (npx @latest) is never copied. README.md feeds INDEX.md descriptions. chrome-extensions linked as is by link.sh. Bump commit + tag deliberately." + }, "impeccable": { "source": "npm:impeccable", "version": "4.1.0", diff --git a/update-all.sh b/update-all.sh index 64a26ff..2f994d1 100644 --- a/update-all.sh +++ b/update-all.sh @@ -381,6 +381,11 @@ vendor_pinned_skills mengto-skills refresh echo "" echo "── Updating superpowers skills (obra/superpowers)..." vendor_pinned_skills superpowers refresh +echo "" +echo "── Updating Modern Web Guidance (GoogleChrome/modern-web-guidance)..." +if ! vendor_pinned_tree modern-web-guidance; then + warn "Modern Web Guidance not vendored (previous copy kept, if any) — rerun: make update" +fi # ── Impeccable (design detector + skill + subagents) ── # Global scope: the installer writes through the ~/.claude/{skills,agents}