Overview
A modern CLI template with pre-configured tools, best practices, and CI/CD setup for rapid project development.
Features
- Yargs — command routing, option parsing, auto-completion, and env-var binding
- Inquirer — interactive prompts (select, confirm, autocomplete, search)
- Conf — persistent user preferences with JSON-schema validation
- Winston — structured file logging (error, warn, info, verbose, debug)
- Chalk — terminal colour output
- Ora — spinner for long-running tasks
- dotenv —
.envfile support with a configurable namespace prefix - update-notifier — nudges users to upgrade when a new version is published
Installation
npm install --global @theholocron/cli-templateUsage
cli-template --help
# Run a built-in commandcli-template log
# Enable debug output for a single runcli-template log --debug
# Or set it persistently via envCLI_TEMPLATE_DEBUG=true cli-template logEnvironment Variables
Copy .env.example to .env. The CLI_TEMPLATE prefix is the project namespace — replace it consistently when building on this template.
| Variable | Default | Description |
|---|---|---|
CLI_TEMPLATE_DEBUG |
false |
Enable debug output |
CLI_TEMPLATE_SOUND |
false |
Enable sound effects |
CLI_TEMPLATE_VERBOSE |
false |
Enable verbose logging |
Project Structure
src/├── cli.ts # yargs entry point and global options├── const.ts # shared path/OS constants├── commands/ # one file per sub-command│ ├── conf.ts # persistent config management│ └── log.ts # example logging command├── ui/│ ├── prompts/ # select, confirm, autocomplete, search│ └── open/ # open URLs or files in the default app└── utils/ ├── config/ # conf wrapper and preferences schema ├── env/ # dotenv reader/writer ├── log/ # winston logger + chalk helpers └── string.ts # string utilities