A best-practice TypeScript CLI project template powered by Bun.
- Runtime: Bun for ultra-fast execution, native TypeScript support, and built-in testing.
- CLI Framework: Commander.js for structured subcommands.
- Linting & Formatting: Biome for ultra-fast linting and formatting.
- Configuration: Platform-standard config paths using
platformdirsandzodfor validation. - Visuals: Emoji-enhanced logging with
chalkand timestamps. - Compilation: Easy binary compilation using
bun build --compile.
- Clone the repository.
- Install dependencies:
bun install
- Run pre-check:
bun start precheck
- Initialize config:
bun start config init
- Setup Development Environment:
Git hooks are installed automatically by
bun run dev-register # Register your git identitybun install. Runbun run setup-hooksif you need to repair or reinstall them. - Run the application:
bun start run
- Run tests:
bun test
Configuration is stored in platform-standard locations via platformdirs:
- macOS:
~/Library/Application Support/ts-cli-template/config.json - Linux:
~/.config/ts-cli-template/config.json - Windows:
%APPDATA%\ts-cli-template\config.json
For tests or isolated runs, set TS_CLI_TEMPLATE_CONFIG_DIR to override the config directory.
- Linting:
bun run lint - Formatting:
bun run format - Check (Lint + Format Validation):
bun run check - Check and Fix:
bun run check:fix - Type Checking:
bun run typecheck - Git Hooks:
bun installautomatically installs hooks fromlefthook.yml;bun run setup-hooksreinstalls them manually.
Lefthook verifies your registered Git identity and runs bun run check before commits. Before pushes it verifies identity, runs bun run typecheck, and runs bun test.
Compile your CLI into a single, standalone executable:
bun run buildThe output will be located in dist/ts-cli-template. This binary includes the Bun runtime, your code, and all dependencies.