feat: add npm publish readiness (task 0020) #20

Merged
alexion merged 1 commits from task-0020-npm-distribution into main 2026-07-14 12:02:58 -04:00
Owner

Task: .claude/tasks/0020-npm-distribution.md

Summary

Publish readiness for the unscoped gitea-axi npm package.

  • Adds the missing repository (plus conventional homepage/bugs) to package.json; the rest of the metadata (unscoped name, description, type: module, MIT, engines.node >=20, the gitea-axi bin, and the dist+skills files allowlist) already shipped.
  • Adds publishConfig (access: public, npmjs registry) and replaces prepublishOnly with prepack: npm run build, so npm publish is a genuine single command that always rebuilds dist/ first (prepack also fires on npm pack).
  • Documents the flow in PUBLISHING.md.
  • Adds a packaging smoke-test tier (vitest.packaging.config.ts + test:pack, excluded from the fast npm test) that packs the real tarball, installs it globally into a throwaway prefix, and drives the installed binary: --help, the dashboard header (against an in-process fixture Gitea), and setup finding the bundled skill. Distribution touches no Gitea API, so this stands in for the absent live-Gitea e2e tier.

Deviations

  • TDD sequencing: the test-writer sub-agent ran concurrently with the package.json/PUBLISHING.md edits, so its final run observed GREEN and it did not report a clean RED for the metadata/publish facets. The pre-edit tree was genuinely RED for those (no repository, prepack, publishConfig, or PUBLISHING.md); the file-presence and installed-binary facets were already GREEN from task 0018.
  • Test robustness: the test tolerates npm pack --json's array-vs-object shape across npm majors, and uses a promisified execFile for the dashboard facet so the in-process fixture server isn't deadlocked by a synchronous spawn.

Review

Risk

Overall: Low

  • Blast radius — Low: additive packaging metadata and new test/doc files; only vitest.config.ts gets a one-line exclude touching existing behavior.
  • Reversibility — Low: pure additions and metadata; nothing published or migrated yet, trivial to revert.
  • Test coverage — Low: the change itself adds a packaging smoke test that packs, installs, and drives the binary end-to-end.
  • Sensitive domain — Low: no auth, permissions, payments, or data migrations.
  • Size & complexity — Low: small metadata diff plus a self-contained test with a straightforward pack/extract/install flow.
  • Runtime criticality — Low: dev/release tooling and docs; no production runtime path altered.

Standards (unaddressed)

  • Duplicated run/runAsync helpers (judgement call) — two near-identical wrappers differing only in sync vs. async; kept deliberately because the dashboard facet needs an async spawn to let the in-process fixture server respond while the others don't.
  • Repeated as casts of the packed manifest (judgement call, low severity) — each metadata assertion re-casts packedManifest; left as-is since it's idiomatic and readable for a test.

(Addressed and not listed: the parent-env inheritance now carries a comment explaining why this subprocess tier diverges from the CLI-seam harness's env isolation.)

Spec

No findings — full spec fidelity across all four acceptance criteria.

Task: `.claude/tasks/0020-npm-distribution.md` ## Summary Publish readiness for the unscoped `gitea-axi` npm package. - Adds the missing `repository` (plus conventional `homepage`/`bugs`) to `package.json`; the rest of the metadata (unscoped name, description, `type: module`, MIT, `engines.node >=20`, the `gitea-axi` bin, and the `dist`+`skills` `files` allowlist) already shipped. - Adds `publishConfig` (`access: public`, npmjs registry) and replaces `prepublishOnly` with `prepack: npm run build`, so `npm publish` is a genuine single command that always rebuilds `dist/` first (`prepack` also fires on `npm pack`). - Documents the flow in `PUBLISHING.md`. - Adds a packaging smoke-test tier (`vitest.packaging.config.ts` + `test:pack`, excluded from the fast `npm test`) that packs the real tarball, installs it globally into a throwaway prefix, and drives the installed binary: `--help`, the dashboard header (against an in-process fixture Gitea), and `setup` finding the bundled skill. Distribution touches no Gitea API, so this stands in for the absent live-Gitea e2e tier. ### Deviations - **TDD sequencing:** the test-writer sub-agent ran concurrently with the `package.json`/`PUBLISHING.md` edits, so its final run observed GREEN and it did not report a clean RED for the metadata/publish facets. The pre-edit tree was genuinely RED for those (no `repository`, `prepack`, `publishConfig`, or `PUBLISHING.md`); the file-presence and installed-binary facets were already GREEN from task 0018. - **Test robustness:** the test tolerates `npm pack --json`'s array-vs-object shape across npm majors, and uses a promisified `execFile` for the dashboard facet so the in-process fixture server isn't deadlocked by a synchronous spawn. ## Review ### Risk **Overall: Low** - Blast radius — Low: additive packaging metadata and new test/doc files; only `vitest.config.ts` gets a one-line exclude touching existing behavior. - Reversibility — Low: pure additions and metadata; nothing published or migrated yet, trivial to revert. - Test coverage — Low: the change itself adds a packaging smoke test that packs, installs, and drives the binary end-to-end. - Sensitive domain — Low: no auth, permissions, payments, or data migrations. - Size & complexity — Low: small metadata diff plus a self-contained test with a straightforward pack/extract/install flow. - Runtime criticality — Low: dev/release tooling and docs; no production runtime path altered. ### Standards (unaddressed) - **Duplicated `run`/`runAsync` helpers** (judgement call) — two near-identical wrappers differing only in sync vs. async; kept deliberately because the dashboard facet needs an async spawn to let the in-process fixture server respond while the others don't. - **Repeated `as` casts of the packed manifest** (judgement call, low severity) — each metadata assertion re-casts `packedManifest`; left as-is since it's idiomatic and readable for a test. _(Addressed and not listed: the parent-env inheritance now carries a comment explaining why this subprocess tier diverges from the CLI-seam harness's env isolation.)_ ### Spec No findings — full spec fidelity across all four acceptance criteria.
alexion added 1 commit 2026-07-14 12:01:29 -04:00
feat: add npm publish readiness (task 0020)
All checks were successful
CI / test (pull_request) Successful in 52s
CI / test (push) Successful in 52s
ed87f023cb
Complete the distribution metadata and publish flow for the unscoped
`gitea-axi` package:

- add `repository`, `homepage`, and `bugs` to package.json
- add `publishConfig` (public access, npmjs registry) so `npm publish`
  needs no extra flags
- replace `prepublishOnly` with `prepack: npm run build`, so both
  `npm pack` and `npm publish` rebuild `dist/` first
- document the single-command flow in PUBLISHING.md
- add a packaging smoke-test tier (`test:pack`) that packs the real
  tarball, installs it globally, and drives the installed binary
  (`--help`, dashboard header, and `setup` finding the bundled skill)
alexion merged commit ed87f023cb into main 2026-07-14 12:02:58 -04:00
alexion deleted branch task-0020-npm-distribution 2026-07-14 12:02:58 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alexion/gitea-axi#20