Skip to content

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.

Terminal window
git clone https://github.com/pasindu-premachandra/crewrota.git
cd crewrota
npm install
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

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, plus helpers.ts.
  • They use node:test and node:assert/strict; there is no test framework to install.
  • They run from dist/test/, so change the TypeScript and run npm 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.ts checks the plugin: one marketplace entry, the plugin’s version equal to package.json’s, the firstmate files and the hook command.

Run one file after a build:

Terminal window
npm run build
node --test dist/test/ships.test.js
Terminal window
export CREWROTA_CLAUDE=src/test/fixtures/fake-claude.mjs
export CREWROTA_QUOTA_AXI=src/test/fixtures/fake-quota-axi.mjs
export CREWROTA_HOME=/tmp/crew-try
node dist/cli.js list

In 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.

The scripts check Node 22, run npm ci, build, npm pack, install the tarball globally, delete it and print crew --version:

Terminal window
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1
Terminal window
sh scripts/install.sh

Run either again to update. Remove it with npm uninstall --global crewrota.