Node.js CLI
Scaffold a publishable Node.js command-line package with Commander, TypeScript, and Nova's CLI presentation utilities.
Why Use This Command?
- Separates program construction from the executable entry point so tests can import the command without running it.
- Includes a fixed-width Nova
CLIHeaderand executable permissions so the built binary starts with consistent presentation. - Registers the workspace as a distributable package so Nova's release workflow can version and publish it.
Requirements
- Node.js runtime — Use any Node.js LTS release.
- Package name — Use
--workspace-namefor both the directory and unscoped npm package name. - Empty directory or monorepo root — Nova auto-detects whether to create a project or add a package.
Usage
Options
| Flag | Description |
|---|---|
-d, --dry-run | Run without writing any files. |
--name <name> | Project slug when creating a new monorepo; omit at an existing root. |
--non-interactive | Require every answer as a flag and do not open prompts. |
--workspace-name <name> | Workspace directory, package name, and binary name. |
--output <dir> | Output directory. |
Output Files
| File | Description |
|---|---|
src/index.ts | Executable entry point. |
src/program.ts | Import-safe Commander program factory. |
src/index.test.ts | Vitest smoke test for the generated binary identity. |
tsconfig.json | Strict Node.js configuration with declaration output. |
package.json | npm bin mapping, publish files, and grouped scripts. |
Non-Interactive Mode
nova scaffold package node-cli --non-interactive --name my-tools --workspace-name my-cli --output ./my-tools
nova scaffold package node-cli --non-interactive --workspace-name my-cli --output ./packages/my-cli
Registration
Nova creates packages under packages/ by default and registers this workspace with the package role and distributable policy. The package name is exactly the selected workspace name.