Bootstrap a new TypeScript CLI application with a pluginable action system. Scaffolds a complete project skeleton using commander, tsup, and a kit-style action pattern where each action exports { name, description, run } and is auto-registered as both an interactive picker option and a named subcommand. Use when the user asks to: create a CLI app, scaffold a CLI tool, bootstrap a command-line application, start a new CLI project, or build a CLI with pluginable commands/actions.
Ask the user for (skip if already provided):
| Input | Placeholder | Example |
|---|---|---|
| Package name | {{PKG_NAME}} | my-awesome-cli |
| Binary name | {{BIN_NAME}} | awesome |
| Description | {{DESCRIPTION}} | A CLI for doing awesome things |
| Target directory | — | ./my-awesome-cli |
If binary name is not provided, derive it from the package name (strip scope, use last segment).
Copy the entire assets/template/ directory to the target directory.
In all copied files, replace these literal strings:
{{PKG_NAME}} → package name{{BIN_NAME}} → binary name{{DESCRIPTION}} → descriptioncd <target> && npm install && npm run build
Show the scaffolded structure and explain how to add new actions.
Each action is a file in src/actions/ exporting an Action:
// src/types.ts
interface Action {
name: string;
description: string;
run: () => Promise<void>;
}
To add a new action:
src/actions/<name>.ts exporting an Action objectactions array in src/actions/index.tsThe CLI auto-registers every action as:
<bin> <action-name><bin> (no args)src/bin.ts → dist/bin.js, ESM, tree-shaken)Suggest the user:
npm link to test the CLI globallysrc/actions/ following the hello.ts patternnpm run dev for watch mode during development