Repository navigation
feat(release): smoke-test the packed tarball before every npm publish - #1504
Conversation
1.33.0 was published with every --skill install failing; the only check before publish was the version sync. prepublishOnly now also runs the --skill install test and scripts/prepublish-check.mjs, which packs the package and runs prod-smoke-test.mjs's CLI checks (an install of every component type, tracking off) against that tarball. Verified: passes on main, stops the publish with the 1.33.0 line restored. - prod-smoke-test.mjs: --cli-tarball <path> - CLAUDE.md: publish with npm login --auth-type=web (no tokens), the new prepublish gate, 202/E404 meanings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012PXzcbUeN566p89EuSse2f
|
Generated by Claude Code |
[Medium impact] The changes affect the npm release workflow for the CLI. The Windows publishing failure must be fixed before merging. Findings
SummaryAdds checks before npm publication:
|
| const run = (cmd, args, opts = {}) => spawnSync(cmd, args, { cwd: root, stdio: 'inherit', ...opts }); | ||
|
|
||
| try { | ||
| const pack = spawnSync('npm', ['pack', '--ignore-scripts', '--pack-destination', out, '--json'], { cwd: root, encoding: 'utf8' }); |
There was a problem hiding this comment.
On Windows, spawnSync('npm', ...) cannot launch the standard npm.cmd shim without a shell. The new required gate therefore stops at npm pack, even when the package is valid.
Start npm through process.execPath and process.env.npm_execpath, or use a Windows-safe launcher. The npx call in runCli needs the same treatment because this gate now requires it.
Requested by Daniel · project thread
What this PR does
Follow-up to #1503. Daniel asked that a broken release never go out again. 1.33.0 was published with every
--skillinstall failing, and the only gate beforenpm publishwas the version sync. NowprepublishOnlystops the publish unless:npm run test:install-pathspasses (the--skilltest from fix(cli): 1.33.1, --skill installs reported failure and were not tracked #1503), andscripts/prepublish-check.mjspasses. It runsnpm pack(the exact tarball npm will upload), thenprod-smoke-test.mjs --only cli --cli-tarball <tgz>: the same batch install of agent, command, mcp, hook, setting, skill and mod the prod smoke test runs, into a temp folder with tracking off.Other changes:
prod-smoke-test.mjs: new--cli-tarball <path>option (npx --package <tgz> claude-code-templates). Its default behaviour is unchanged.npm login --auth-type=web, not a token. It also documents the new gate and what 202 and E404 mean.CCT_SKIP_PREPUBLISH_SMOKE=1skips step 3 only (it needs network: GitHub and www.aitmpl.com).Type
cli-tool/src,cli-tool/bin)dashboard/)How I tested it
node scripts/prepublish-check.mjsonmain: 10/10 CLI checks pass against the packed 1.33.1 tarball.source,) restored:FAIL batch install …,prepublish-check: the CLI smoke test failed against the packed tarball: not publishing, exit 1.prod-smoke-test.mjs --only cli --cli-version 1.33.1→ 10/10,Installed 7 of 7 · 0 failed.npm testgreen.Touches
scripts/andpackage.json, so it merges by hand.Generated by Claude Code
Summary by cubic
Blocks
npm publishunless the packed tarball passes the same CLI smoke test that missed the broken 1.33.0 release, where every--skillinstall failed. Affects release tooling only (scripts/andpackage.json) — no new components, sodocs/components.jsonneeds no regeneration.prepublishOnlynow also runsnpm run test:install-pathsand the newscripts/prepublish-check.mjs, which runsnpm packand the prod smoke test's CLI checks (an install of every component type, tracking off) against that exact tarball; a publish stops when any install fails.prod-smoke-test.mjsgains a--cli-tarball <path>option for that flow; its default behavior is unchanged.CCT_SKIP_PREPUBLISH_SMOKE=1skips only the smoke step — it needs network (GitHub and www.aitmpl.com); do not use it for a release.CLAUDE.mdnow guides publishing throughnpm login --auth-type=webinstead of a token and documents the new gate plus the 202/E404 npm responses.Written for commit 8b37062. Summary will update on new commits.