feat(release): smoke-test the packed tarball before every npm publish

Merged
DA
11d ago
+65-11

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 --skill install failing, and the only gate before npm publish was the version sync. Now prepublishOnly stops the publish unless:

  1. versions are in sync (as before),
  2. npm run test:install-paths passes (the --skill test from #1503), and
  3. scripts/prepublish-check.mjs passes. It runs npm pack (the exact tarball npm will upload), then prod-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.
  • CLAUDE.md: publishing uses npm login --auth-type=web, not a token. It also documents the new gate and what 202 and E404 mean.
  • CCT_SKIP_PREPUBLISH_SMOKE=1 skips step 3 only (it needs network: GitHub and www.aitmpl.com).

Type

  • New component
  • Change to an existing component
  • CLI (cli-tool/src, cli-tool/bin)
  • Website (dashboard/)
  • Docs or other (release tooling)

How I tested it

  • node scripts/prepublish-check.mjs on main: 10/10 CLI checks pass against the packed 1.33.1 tarball.
  • With the 1.33.0 line (source,) restored: FAIL batch install …, prepublish-check: the CLI smoke test failed against the packed tarball: not publishing, exit 1.
  • The published 1.33.1 against npm: prod-smoke-test.mjs --only cli --cli-version 1.33.1 → 10/10, Installed 7 of 7 · 0 failed.
  • Root npm test green.

Touches scripts/ and package.json, so it merges by hand.


Generated by Claude Code


Summary by cubic

Blocks npm publish unless the packed tarball passes the same CLI smoke test that missed the broken 1.33.0 release, where every --skill install failed. Affects release tooling only (scripts/ and package.json) — no new components, so docs/components.json needs no regeneration.

  • prepublishOnly now also runs npm run test:install-paths and the new scripts/prepublish-check.mjs, which runs npm pack and 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.mjs gains a --cli-tarball <path> option for that flow; its default behavior is unchanged.
  • Optional env var CCT_SKIP_PREPUBLISH_SMOKE=1 skips only the smoke step — it needs network (GitHub and www.aitmpl.com); do not use it for a release.
  • CLAUDE.md now guides publishing through npm login --auth-type=web instead of a token and documents the new gate plus the 202/E404 npm responses.