Repository navigation
Description
Tier: mechanical Found: 2026-10-01, checking the plugin against Anthropic's directory pre-submission checklist.
Problem. The post-tool hook runs npx prettier --write "$FILE_PATH" after every Edit or Write of a .ts/.tsx/.js/.jsx/.json file (templates/hooks/post-tool.sh:221,228; plugin copy hooks/post-tool.sh:210,217). It has been there since the first commit (49bf820) and nothing gates it except CLAUDE_HOOKS_DISABLED and IS_PARALLEL_AGENT. Checked 2026-10-01 in a scratch project (npm 10.9.8):
- No local prettier, cold npx cache, non-TTY stdin: npm auto-confirms, downloads the latest prettier (
[email protected]), formats the file and exits 0. So every sequant-installed project without prettier fetches and runs an unpinned package from the registry, Python and Go projects included (any.jsonedit). - Offline:
ENOTCACHED, exit 1, swallowed by2>/dev/null. On the JSON branch (:228) the failure isn't logged either. - Local prettier installed:
npxrunsnode_modules/.bin/prettier, so projects that do use prettier are unaffected by the fix below. - The directory checklist classes an unpinned launcher as Blocks ("Unpinned npx launcher"), and launchers in scripts a hook runs as held for review.
Using the project's configured formatter instead isn't available: StackConfig (src/lib/stacks.ts:620-635) has no format command, and stacks/*.yaml format: is never read. That would be a separate feature.
Scope: every installed project, not only the plugin. templates/hooks/post-tool.sh is what sequant init/sync/update install into .claude/hooks/ (src/lib/templates.ts:560,1317), and npm run sync:hooks regenerates this repo's .claude/hooks/ from it.
- The plugin's root
hooks/copy is hand-maintained, already drifted from templates (it lacks the relay-check and coverage blocks), andscripts/sync-hooks.shdoesn't cover it. - The slim plugin folder issue (fix(plugin): ship a slim ./plugin folder — the repo-root plugin pulls ~700 MB of dev dependencies into every install and fails directory review limits #1265) regenerates the plugin's hooks from
templates/hooks/, so this issue edits the template only. Until that lands, plugin users keep the npx call. That's acceptable because the slim-folder issue gates the directory resubmission anyway.
AC
- AC-1:
templates/hooks/post-tool.shruns no package launcher. It finds the edited file's repo root (git -C "$(dirname "$FILE_PATH")" rev-parse --show-toplevel) and runs"$ROOT/node_modules/.bin/prettier"only when that file is executable. Otherwise it skips and logsSKIP_FORMAT (no local prettier)to the hook log. Evidence:grep -nE '\b(npx|bunx|pnpm dlx|yarn dlx|uvx)\b' templates/hooks/post-tool.shmatches 0 lines - AC-2: A behaviour gate test runs the hook against a temp project with no prettier and a
.tsedit: no download happens (npm cache dir set to an empty temp dir stays empty), and the skip line is logged. A second case with a stubnode_modules/.bin/prettiershows the stub ran, including for a file in a subdirectory or worktree. Evidence: a hook test file, mutation-verified by restoringnpx prettier - AC-3:
.claude/hooks/post-tool.shis regenerated withnpm run sync:hooksand stays byte-identical to the template. Evidence:npx vitest run src/lib/relay/__tests__/hook-sync.test.ts - AC-4: The CHANGELOG records the behaviour change: projects without a local prettier are no longer auto-formatted. Evidence:
grep -n 'prettier' CHANGELOG.mdin the Unreleased section
Non-Goals
- Editing the plugin's root
hooks/copy by hand (the slim-folder issue regenerates it). - A per-stack formatter setting.
May touch
templates/hooks/post-tool.sh,.claude/hooks/post-tool.sh(regenerated), a new hook test,CHANGELOG.md
Activity
fix(#1264): post-tool hook runs only the project's local prettier, ne…
admarble commentedon Oct 1, 2026
Reopened: #1267 fixed
templates/hooks/post-tool.shand.claude/hooks/post-tool.sh, but the plugin shipshooks/post-tool.sh(hooks/hooks.json→${CLAUDE_PLUGIN_ROOT}/hooks/post-tool.sh). That copy still runsnpx prettier --write(lines 210 and 217 on main @ e35f43a), so plugin installs, the main install path, don't get the fix. A follow-up PR ports the block and extends the integration test to every shipped copy. It lands before 2.19.0.admarble commentedon Oct 2, 2026
Fixed in v2.19.0. #1267 fixed
templates/hooks/post-tool.sh, and since #1265 (PR #1275) the shipped plugin hookplugin/hooks/post-tool.shis generated from that template and drift-tested. I verified it in thev2.19.0tag: it runs onlynode_modules/.bin/prettier. The roothooks/post-tool.shstill containsnpx prettier, but it is no longer shipped (marketplacesource: ./plugin) and goes away when roothooks/is retired. PR #1274 closed as redundant.