Repository navigation
fix(cli): skills pre-flight is warn-only; serve is side-effect-free; shipped .mcp.json pinned (#988) - #989
Merged
admarble merged 2 commits intoSep 7, 2026
Conversation
…cp.json (#988) The commander preAction hook ran `syncCommand({ quiet: true })` on a version-marker mismatch — a silent forced copy of .claude/skills, hooks, agents, AGENTS.md, scripts/dev and the manifest. The plugin's MCP config is the repo-root .mcp.json (marketplace.json source "./"), which shipped `npx sequant@latest serve`; Claude Code starts that server with cwd = the open project, so every post-release session rewrote tracked files in every project whose marker lagged @latest, with no output. Three downstream repos lost in-place hook customizations on 2026-09-06. - preAction delegates to runVersionPreflight (src/commands/version-preflight.ts): warn-only for both stale marker and content drift, exempt for init/sync/update/serve. Nothing under the project is written from the hook. - serve is exempt (stdout is the MCP channel); it reports install status on stderr ("... No files were modified. Run: sequant update"), merges a `skillsInstall` field into sequant://config when settings is plain JSON, and exposes sequant://install as the always-parseable channel. - prepare-marketplace stamps and validates the .mcp.json that marketplace.json `source` resolves to — the file plugin users install — not only the dist copy #793 pinned; the release skill force-adds the gitignored-but-tracked file into the release commit. Root .mcp.json pinned to 2.13.0. - Tests: warn-only unit test (fixture tree byte-identical), serve subprocess integration test (stale install → warning on stderr, tree unchanged), MCP resource tests, marketplace-resolved pin test, docs/cli contract gate. - Docs: plugin-updates.md rewritten for warn-only + the #988 history; what-weve-built bullet; CHANGELOG Changed/Added/Fixed. Claude-Session: https://claude.ai/code/session_017eTXiiVdL34aaiv3JwYcBJ
…he only install-status channel (#988) Merging a server-computed `skillsInstall` field into the user's settings document was the wrong shape: the field appeared only when the file parsed as plain JSON, the file was re-serialized (formatting/key order rewritten), and a status value shared a namespace with real settings. sequant://config now returns the settings file byte-for-byte again, and sequant://install is always an object — `{ installed: false }` with no manifest, otherwise the startup status with `filesModified: false` as the report-only contract. Claude-Session: https://claude.ai/code/session_017eTXiiVdL34aaiv3JwYcBJ
admarble
deleted the
feature/988-fix-cli-preaction-auto-sync-fires-on-serve-the
branch
September 7, 2026 03:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #988.
What happened
Three downstream repos got unreviewed working-tree churn on 2026-09-06 —
pre-tool.sh,.claude/skills/**,AGENTS.md,scripts/dev/*,.sequant-manifest.json— fromnpm exec sequant@latest serve, erasing an in-place hook customization in one of them. Chain, each link verified in source or on disk:marketplace.jsondeclaressource: "./", so the plugin ships the repo-root.mcp.json—npx -y sequant@latest serve. Reconsider sequant@latest pinning in generated MCP config (forces npx reinstall every release; surfaces as -32000) #793's pin only ever landed in adist/copy the GitHub marketplace never installs (plugin cache2.12.0and2.13.0both carry@latest).bin/cli.tspreActionexcluded onlyinit/sync/update; on a version-marker mismatch it ransyncCommand({ quiet: true })→copyTemplates({ force: true }), silently rewriting the managed trees.constitution.md);.claude/.local/twins are honored by the classifier but not the copy.Repeat trigger: every new session re-ran the sync until the marker bump was committed.
Changes
src/commands/version-preflight.ts,runVersionPreflight). Stale marker and content drift both print the existing warning namingsequant update/sequant sync; nothing is written from the hook. Exempt:init,sync,update,serve. The fix(sync): areSkillsOutdated/checkAndWarnSkillsOutdated pre-flight is version-only — misses content drift (sibling of #708) #713 rule ("never clobber in-place customizations") now covers version bumps.serveis side-effect-free and reports install status its own way (stdout is the MCP channel): one stderr line —! Skills install is stale (x → y). No files were modified. Run: sequant update— and a newsequant://installresource, always an object ({ installed: false }with no manifest; otherwise the startup status withfilesModified: falseas the report-only contract).sequant://configis unchanged: the settings file, verbatim. An earlier commit on this branch merged askillsInstallfield into config; reverted in5d9e06e5— server-computed status doesn't belong on a user-authored document (shape varied with JSON vs JSONC, re-serialized the file, shared a namespace with real settings).createServer(version, { install })/registerResources(server, context)— additive, defaulted..mcp.jsonis pinned.prepare-marketplaceresolves the file frommarketplace.jsonsource, stamps it to the release version, and validates it (the dist copy is still stamped for the official-marketplace path). Root.mcp.jsonpinned to2.13.0now; the/releaseskill (all three mirrors) force-adds the gitignored-but-tracked file into the release commit.docs/internal/plugin-updates.mdtable row + a "Why version bumps stopped auto-syncing (fix(cli): preAction auto-sync fires onserve— the plugin's @latest MCP server silently rewrites .claude/hooks, skills, AGENTS.md in every project it starts in (#793 pin never ships via marketplace source "./") #988)" section;what-weve-built.mdbullet; CHANGELOG Changed/Added/Fixed.Verification
server.test.ts:285,mcp-e2e.integration.test.ts:231) that now includesequant://install; updated, re-run green.npm run lintclean,tsc --noEmitclean.version-preflight.test.ts(AC-1/AC-3),serve.integration.test.ts(AC-2/AC-3 — realdist/bin/cli.js servesubprocess, cwd = stale fixture project, tree snapshot before/after),install-resource.test.ts(AC-3 — install resource shape + config verbatim for JSON and JSONC),scripts/plugin-mcp-pin.test.ts(AC-4),version-preflight.docs.test.ts(AC-5).Mutation-verified: AC-1 — reinstated
await syncCommand({ quiet: true })in theoutdatedbranch ofrunVersionPreflight;version-preflight.test.ts › warns on a stale marker and writes nothingfailed; restored.Mutation-verified: AC-2 — inserted
await syncCommand({ quiet: true })at the top ofserveCommand, rebuilt dist;serve.integration.test.ts › starts, warns on stderr naming update, and leaves every file byte-identicalfailed; restored and rebuilt.Mutation-verified: AC-4 — set the root
.mcp.jsonarg back tosequant@latest;plugin-mcp-pin.test.ts › resolves the shipped .mcp.json from marketplace.json source and finds the exact pinfailed; restored.Mutation-verified: AC-5 — changed the docs table Action cell back to
**Auto-sync (copy)**and addedawait syncCommand({ quiet: true })inside thepreActionhook; bothversion-preflight.docs.test.tsgates (docs table…andbin/cli.ts preAction hook…) failed; restored.Not in this PR
copyTemplateshonor.claude/.local/twins on the write path) — separate decision; D1 alone closes the incident..claude/.local/hooks/(documented path).🤖 Generated with Claude Code