← 全部工具

theholocron/cli-template

热度 75 更新于 DevOps 与云

A modern CLI template with pre-configured tools, best practices, and CI/CD setup for rapid project development.

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

@theholocron/cli-template

A modern CLI template with pre-configured tools, best practices, and CI/CD setup for rapid project development.

Getting Started

Use the Holocron CLI to scaffold a new CLI project from this template. It clones the repo, renames all placeholder references, and runs holocron setup in one step:

npx @theholocron/cli new cli my-cli \
  --description "My CLI description" \
  --homepage "https://my-cli.example.com"

This will:

  • Create theholocron/my-cli on GitHub from this template
  • Replace all CLITEMPLATE and cli-template references with your CLI name
  • Run pnpm install
  • Run holocron setup to configure branch protection, labels, workflows, and repo settings

Installation

npm install --global @theholocron/cli-template

Usage

cli-template --help

# Run a command
cli-template log

# Use with debug output
cli-template log --debug

# Use with verbose output
cli-template log --verbose

Environment Variables

Copy .env.example to .env and configure as needed. Variables follow a two-level namespace cascade: HOLOCRON sets org-wide defaults, CLITEMPLATE overrides them per-tool. Replace both prefixes with your own when building on this template.

| Variable | Default | Description | | --------------------------- | ------- | ---------------------------------------------- | | CLITEMPLATEDEBUG | false | Enable debug output | | CLITEMPLATEVERBOSE | false | Enable verbose logging | | CLITEMPLATESENTRYDSN | — | Sentry DSN — enables error telemetry when set | | CLITEMPLATENOTELEMETRY | — | Set to any value to opt out of error telemetry |

Development

pnpm build         # compile src/ → dist/
pnpm dev         # run via tsx (no build needed)
pnpm test          # run tests
pnpm test:coverage # run tests with coverage
pnpm typecheck     # type-check without emitting
pnpm lint          # run super-linter locally (requires Docker)

What's Included

| Category | Tool | Purpose | | ----------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------- | | CLI framework | Yargs | Command routing, option parsing, env-var binding, auto-completion | | Prompts | Inquirer | Interactive select, confirm, and search prompts | | Config | Conf | Persistent user preferences with JSON-schema validation | | Logging | Winston | Structured file logging; terminal output via style utilities | | Terminal UI | Chalk + Ora | Colour output and spinners for long-running tasks | | Environment | @theholocron/env-utils | Namespace-scoped env var parsing with cascade priority | | Updates | update-notifier | Prompts users to upgrade when a new version is published | | Telemetry | Sentry | Error tracking and command-level tracing; disabled until DSN is set | | Build | tsdown | Compiles src/cli.ts → dist/cli.mjs with a Node.js shebang | | CI/CD | GitHub Actions + semantic-release | Automated lint, test, typecheck, and publish on push to main |