Skip to main content

Node.js CLI

Scaffold a publishable Node.js command-line package with Commander, TypeScript, and Nova's CLI presentation utilities.

Why Use This Command?

  1. Separates program construction from the executable entry point so tests can import the command without running it.
  2. Includes a fixed-width Nova CLIHeader and executable permissions so the built binary starts with consistent presentation.
  3. 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-name for 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

FlagDescription
-d, --dry-runRun without writing any files.
--name <name>Project slug when creating a new monorepo; omit at an existing root.
--non-interactiveRequire 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

FileDescription
src/index.tsExecutable entry point.
src/program.tsImport-safe Commander program factory.
src/index.test.tsVitest smoke test for the generated binary identity.
tsconfig.jsonStrict Node.js configuration with declaration output.
package.jsonnpm bin mapping, publish files, and grouped scripts.

Non-Interactive Mode

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