Skip to content

chore(#738): reconcile skill-mirror divergences (8 diverged, 10 missing) + CI gate - #742

Merged
admarble merged 3 commits into
mainfrom
feature/738-chore-reconcile-skill-mirror-divergences-8-diverge
Jun 23, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/738-chore-reconcile-skill-mirror-divergences-8-diverge

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Reconciles the three mirrored skill roots and adds a CI gate so they cannot drift again. check-skill-sync.ts previously reported 8 diverged, 10 missing across .claude/skills/ (canonical), templates/skills/ (consumed by sequant init/sync), and skills/ (published plugin) — meaning downstream installs could get stale or missing skill content.

  • AC-2 (8 diverged → 0): reconciled in the canonical direction (.claude/skills/ → mirrors) after per-file review for intentional vs. accidental drift. qa/scripts/quality-checks.sh required a real merge, not a blind copy: .claude carried test-tautology detection (feat(#298): Add test tautology detector to QA quality gates #310) while the mirrors carried the #278/#303 structured cache-metrics JSON writer that worktree-manager.ts reads to populate PhaseLog.cacheMetrics (surfaced via sequant logs). Both features now live in all three roots — restoring cache-metrics observability that had silently broken in this repo. Dropped the vestigial - Task tool grant from the security-review mirror (canonical SKILL.md has zero Task/Agent usage).
  • AC-3 (10 missing → 0): copied all 10 into the mirrors (all legitimate skill content).
  • AC-5 (robustness): check-skill-sync.ts now skips dotfiles/dot-directories (kills the .sequant/.token-usage-*.json false-positive "missing") and gained a documented EXCLUDE allowlist escape hatch. collectFiles/EXCLUDE are exported and main() is guarded so the module is importable for tests.
  • AC-1 (document direction): added a Skill mirror sync section to CONTRIBUTING.md and strengthened the source-of-truth header in the script.
  • AC-4 (CI gate): added npm run lint:skill-sync + a CI step alongside lint:skill-calls that fails the build on any future drift.

Pre-PR AC Verification

AC Source Description Status Evidence
AC-1 Original Confirm + document canonical source root ✅ CONTRIBUTING.md "Skill mirror sync"; scripts/check-skill-sync.ts header
AC-2 Original Reconcile 8 diverged → 0 (per-file review) ✅ check-skill-sync.ts reports 0 diverged; quality-checks.sh merged (not blind-copied)
AC-3 Original Resolve 10 missing files ✅ 0 missing; 10 files copied into mirrors
AC-4 Original check-skill-sync.ts passes clean in CI (gated) ✅ ci.yml "Check skill sync" step; npm run lint:skill-sync exits 0
AC-5 Derived (Robustness) Skip dotfiles/dot-dirs + documented allowlist ✅ collectFiles dotfile/dot-dir skip + EXCLUDE; unit tests

Test plan

  • npm run lint:skill-sync → 42 synced, 0 diverged, 0 missing, exit 0 (idempotent on re-run)
  • npm run build (tsc) passes
  • npm run lint (eslint) passes
  • Unit: scripts/check-skill-sync.test.ts (collectFiles dotfile/dot-dir/allowlist skip) — 6 pass
  • Integration: __tests__/integration/skill-sync.integration.test.ts (whole-repo 0/0, exit 0) — 2 pass
  • No regression: batch-executor.test.ts (cache-metrics consumer), existing behavior-rule-skill-sync.integration.test.ts
  • bash -n clean on quality-checks.sh across all 3 roots

Known follow-ups (out of scope)

  • The 3-mirror model is a recurring drift hazard; the durable fix is generating templates/skills/ + skills/ from .claude/skills/ at build/release time. This PR detects + gates drift but contributors still hand-sync. (Open Question feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1 in spec.)
  • npm run sync:skills copies templates/skills/* → .claude/skills/ — the opposite of the canonical direction. Flagged for a separate fix to avoid changing contributor workflow here.

Closes #738

Skill files live in three mirrored roots (.claude/skills/ canonical,
templates/skills/ consumed by sequant init/sync, skills/ published as
the plugin). check-skill-sync.ts reported 8 diverged, 10 missing — so
downstream installs could receive stale or missing skill content.

- AC-2/AC-3: reconciled all 18 in the canonical direction
  (.claude/skills/ -> mirrors) after per-file review. quality-checks.sh
  needed a MERGE not a blind copy: .claude had test-tautology detection
  (#310), the mirrors had the #278/#303 cache-metrics JSON writer that
  worktree-manager.ts reads for PhaseLog.cacheMetrics. Both features now
  live in all three roots, restoring cache-metrics observability that had
  silently broken here. Dropped the vestigial `- Task` tool grant from the
  security-review mirror (canonical has no Task usage).
- AC-5: check-skill-sync.ts now skips dotfiles/dot-dirs (kills the
  .sequant/.token-usage-*.json false-positive "missing") + documented
  EXCLUDE allowlist escape hatch. collectFiles/EXCLUDE exported and main()
  guarded so the module is importable for tests.
- AC-1: documented the canonical direction in CONTRIBUTING.md
  ("Skill mirror sync") and strengthened the script header.
- AC-4: added `npm run lint:skill-sync` + a CI step (alongside
  lint:skill-calls) that fails the build on any future drift.

Tests: unit (collectFiles dotfile/dot-dir/allowlist skip) + integration
(whole-repo 0 diverged / 0 missing, exit 0).

Entire-Checkpoint: 00964ffb6426
admarble added 2 commits June 22, 2026 09:23
Reconciling the mirrors (AC-3) propagated references/shared/framework-gotchas.md
into skills/ and templates/skills/, creating a new top-level references/ dir in
each. .claude/skills/ has had this non-skill dir since #43, but the mirrors never
did, so the gap was hidden. Both CI validators (Plugin Structure Validation,
validate-skills) treat every top-level dir except _shared/ as a skill and failed
because references/ has no SKILL.md.

Skip references/ alongside _shared/ in both jobs and in the validate:skills npm
script (POSIX case so it runs under npm's sh). The framework-gotchas.md content
stays propagated — AC-3 still satisfied.

Entire-Checkpoint: c8b3aebfa756
`npm run sync:skills` ran `cp -r templates/skills/* .claude/skills/` —
mirror -> canonical, the reverse of the direction this PR establishes and
documents in CONTRIBUTING. A contributor editing the canonical copy and
running the obvious-named `sync:skills` to "sync" would silently revert
their edits to stale mirror content: the exact drift bug #738 fixes,
re-armed under a misleading name. Repoint it at `check-skill-sync.ts --fix`,
which propagates canonical -> mirrors (same logic CONTRIBUTING documents).
Only CHANGELOG referenced the old script (historical #30 entry, left as-is).
Idempotent no-op when already synced.
@admarble
admarble merged commit 4115b1a into main Jun 23, 2026
8 checks passed
@admarble
admarble deleted the feature/738-chore-reconcile-skill-mirror-divergences-8-diverge branch June 23, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: reconcile skill-mirror divergences (8 diverged, 10 missing across the 3 roots)

1 participant