[Tool Name]
A small TypeScript CLI. Installs from npm, runs anywhere Node 22+ runs.
Source of truth
GitHub. Published to npm under your scope (@yourname/your-tool). Every release is a git tag plus an npm publish.
Tech stack
Node 22 + TypeScript + tsx (for dev; ships compiled to ESM in dist/). commander for arg parsing. kleur for colors (small, no deps). ora for spinners. prompts for interactive input. execa for spawning subprocesses. Tests via Vitest.
Deploy
- Local dev:
npm run dev -- your-args(tsx watches and re-runs) - Build:
npm run build(tsc ->dist/) - Release:
npm version patch && npm publish && git push --follow-tags
File map
src/cli.tsshebang line, commander setup, command routingsrc/commands/one file per subcommandsrc/lib/shared helpers (config loader, fs ops)package.json"bin"field pointing atdist/cli.jstsconfig.jsonESM + NodeNext + strictvitest.config.ts
.env keys
None at runtime. CLI reads config from ~/.config/yourtool/config.json (xdg-compliant) and CLI flags.
Hard rules
- Shebang line on
src/cli.tsis#!/usr/bin/env node(NOTnode22or any version). Lets users with any modern Node run it. package.json"bin"points at the BUILT file indist/, notsrc/."type": "module"and ESM only. Don't dual-publish CJS in 2026.- Every command has a
--helpexample in the description. Test it. - Exit codes: 0 on success, 1 on user error, 2 on internal error. Catch unhandled rejections and exit cleanly.
- No
process.cwd()for finding the package root. Useimport.meta.urlresolution.
Recent significant changes
- 2026-04-28: Scaffolded. Locked: tsx for dev, plain tsc for build, commander for parsing (yargs is overkill).
Next session: start here
- Set
nameinpackage.json(scoped is safest:@yourname/tool). npm init -wfor the bin entry, set"bin"mapping.- Implement first command under
src/commands/. npm linklocally to test the binary as if installed.npm publish --access publicwhen ready.