Contributing
Development Setup
bash
git clone <repo-url> && cd venpm
node scripts/setup.mjsThe setup script:
- Checks Node.js >= 18 and npm
- Installs dependencies
- Compiles TypeScript
- Links
venpmglobally vianpm link
After setup, you have a working venpm command that points at your local build.
Development Workflow
bash
npm run dev # watch mode — auto-rebuild on source changes
npm test # run all 224 tests
npm run lint # type-check (tsc --noEmit)
npm run build # one-shot compileThe global venpm command uses the compiled output in dist/, so changes are picked up immediately in watch mode.
Project Structure
src/
core/ # Pure logic — never imports from cli/
cli/ # Commander commands — compose core modules
index.ts # CLI entry point
schemas/v1/ # JSON Schemas (primary deliverable)
tests/
unit/ # Core module tests (mocked IOContext)
integration/ # Full workflow tests (mocked IOContext)
e2e/ # Subprocess tests (real filesystem)
fixtures/ # Test dataSee Architecture for the full module map and design principles.
Code Conventions
- ESM only —
"type": "module"in package.json,.jsextensions in imports - TypeScript strict mode — no
anyunless unavoidable - No global state — all state flows through function parameters
- IOContext for I/O — core modules never import
fs,fetch,child_processdirectly - Immutable data — lockfile operations return new objects, never mutate
- Graceful exits —
process.exitCode = 1; return, neverprocess.exit(1) - No native deps — only
commander,ajv,ajv-formats,tar
Adding a New Command
- Create
src/cli/my-command.tswith aregisterMyCommand(program: Command)function - Implement the logic in
src/core/if needed (keeping I/O behind IOContext) - Register the command in
src/index.ts - Add unit tests in
tests/unit/for core logic - Add integration tests in
tests/integration/for the full workflow - Add
--jsonsupport using the envelope format fromcore/json.ts
Adding a New Core Module
- Create
src/core/my-module.ts - Accept
IOContext(or the specific interfaces you need) as parameters - Never import from
cli/ - Add unit tests in
tests/unit/my-module.test.ts
Cleanup
bash
npm run unsetup # remove global link