A small TypeScript CLI for scaffolding new project directories for Pion engineers.
The current scaffold creates a project folder with a starter README.md. The code is intentionally structured so future templates or commands can be added without rewriting the CLI entrypoint.
- Node.js 18 or newer
- npm
Install dependencies:
npm installBuild the CLI:
npm run buildRun tests:
npm testRun locally:
npm start -- my-projectdxcli <project-name> [options]When running through npm during local development, pass arguments after --:
npm start -- my-project --dry-run| Option | Description |
|---|---|
--dry-run |
Prints the filesystem changes that would happen without creating or changing files. |
--force |
Allows the CLI to update an existing project directory. Existing scaffold-owned files may be replaced, but unrelated files are left in place. |
--help, -h |
Prints usage information and exits successfully. |
--version, -v |
Prints the current version number and exits. |
Create a project:
npm start -- my-projectPreview a project without writing files:
npm start -- my-project --dry-runUpdate an existing project directory:
npm start -- my-project --forcePreview what --force would do:
npm start -- my-project --force --dry-runShow help:
npm start -- --helpThe CLI exits with a non-zero status and a clear message when:
- no project name is provided;
- an unknown flag is used;
- more than one project name is provided;
- the project name is path-like, such as
../apporapps/app; - the target directory already exists and
--forceis not provided; - the target path exists but is not a directory.
cli-tool/
index.ts CLI entrypoint: parse input, call project creation, print output
lib/
errors.ts CLI-specific error type
parser.ts Argument parsing and flag validation
project.ts Filesystem scaffold logic
test/ Node test runner tests
If this grew into a broader internal DX tool, the next step would be a command registry, for example dxcli create, dxcli doctor, and dxcli upgrade. Each command should own its parser, validation, and handler while sharing common logging, error handling, and filesystem utilities.