Build and test crewrota from source
Clone the repo, run npm install, then npm test: it builds src/ to dist/ with TypeScript and runs every test with Node’s own test runner.
You need Node.js 22.19 or newer and git; no real Claude Code account is used by the tests.
npm run typecheck checks the types without writing anything.
Get the code
Section titled “Get the code”git clone https://github.com/pasindu-premachandra/crewrota.gitcd crewrotanpm installThe npm scripts
Section titled “The npm scripts”| Script | Runs | What it does |
|---|---|---|
npm run build |
tsc |
Compiles src/ to dist/ |
npm run typecheck |
tsc --noEmit |
Checks the types only |
npm test |
npm run build && node --test "dist/test/*.test.js" |
Builds, then runs every test file |
npm run check:private |
node scripts/check-private.mjs |
Scans files against a private denylist; see CI and the private scan |
prepack |
npm run build |
Builds before npm pack and npm publish |
TypeScript
Section titled “TypeScript”tsconfig.json: target ES2023, module and moduleResolution NodeNext, strict, rootDir src, outDir dist.
The package is an ES module ("type": "module"), so imports between modules end in .js.
- One file per area in
src/test/: backup, check-private, cli, config, doctor, init, launch, members, menu, names, plugin, progress, remove, setup, shared, ships, shortcuts, statusline and widget, plushelpers.ts. - They use
node:testandnode:assert/strict; there is no test framework to install. - They run from
dist/test/, so change the TypeScript and runnpm test, which builds first. - Every test points HOME and the config folders at a temp folder and Claude Code and quota-axi at fakes; see Testing with the fakes.
src/test/plugin.test.tschecks the plugin: one marketplace entry, the plugin’s version equal topackage.json’s, the firstmate files and the hook command.
Run one file after a build:
npm run buildnode --test dist/test/ships.test.jsTry the CLI without accounts
Section titled “Try the CLI without accounts”export CREWROTA_CLAUDE=src/test/fixtures/fake-claude.mjsexport CREWROTA_QUOTA_AXI=src/test/fixtures/fake-quota-axi.mjsexport CREWROTA_HOME=/tmp/crew-trynode dist/cli.js listIn a shell that is itself a crew member, also set HOME and the config folders to a scratch folder and unset CLAUDE_CONFIG_DIR; the full recipe is in Testing with the fakes.
Install your build
Section titled “Install your build”The scripts check Node 22, run npm ci, build, npm pack, install the tarball globally, delete it and print crew --version:
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1sh scripts/install.shRun either again to update.
Remove it with npm uninstall --global crewrota.