
buncli
A template for building full-featured CLI tools with Bun, Commander, and Inquirer. Clone it, add your commands, ship a standalone binary.
What it is
buncli is a ready-to-fork template for building CLI tools in TypeScript. It combines three things that work well together:
- Commander for parsing commands, options, and arguments with built-in help text
- @inquirer/prompts for interactive input: text, select lists, confirmations, checkboxes, password fields, searchable lists, and more
- Bun as the runtime, bundler, package manager, and compiler
Clone the repo, install with bun install, and you have a working CLI with a sample greet command. Add your own commands in minutes.
Why Bun
Bun is a compelling choice for CLI tools for several reasons:
- TypeScript without a build step. Bun runs
.tsfiles directly. Notsc, nots-node, no bundler config. Write TypeScript and run it. - Bun Shell. Import
$frombunand run shell commands with tagged template literals. Nochild_process, noexeca, no callback gymnastics. - Fast startup. CLI tools need to feel instant. Bun's startup time is significantly faster than Node, which matters when your tool runs dozens of times a day.
- Built-in file I/O.
Bun.file()andBun.write()replacefs.readFileandfs.writeFilewith a cleaner API. JSON parsing is one method call. - Standalone binaries.
bun build --compileproduces a single executable that embeds the Bun runtime. No Node, no Bun, nonode_moduleson the target machine. Download it,chmod +x, run it. - Cross-compilation. Build for Linux, macOS, and Windows from any platform with
--target=bun-{linux,darwin,windows}-{x64,arm64}. - Auto-loaded
.envfiles. Environment variables from.envare available onprocess.envwithoutdotenvor any config.
Use cases
A shared internal CLI is one of the fastest ways to bring consistency to a fragmented team:
- Standardized project scaffolding. Prompt developers through required setup steps so every new project starts from the same baseline.
- Guided deployment workflows. Walk engineers through pre-flight checks, environment selection, and confirmation steps before pushing to production.
- Environment and service status checks. Poll endpoints, database connections, and third-party integrations to surface issues before they become support tickets.
- Onboarding automation. New hire runs one command and gets their local environment configured: dependencies installed,
.envfiles populated, seed data loaded. - Incident response runbooks. Encode the steps engineers take during an outage into a guided interactive script so the playbook is actually followed under pressure.
- Secrets and credential rotation. Walk through rotating API keys across services with confirmation prompts and validation that new credentials work before old ones are revoked.
- Automated release notes. Pull merged PRs and commit history since the last tag, format them into a changelog, consistently, every time.
- Internal data lookups. Query internal APIs or databases by record ID, customer name, or date range without digging through five dashboards.
- Audit and compliance reporting. Generate point-in-time snapshots of user access, configuration state, or data exports in a consistent format.
Getting started
bash
# Clone and install
git clone https://github.com/sethdavis512/buncli.git mycli
cd mycli
bun install
# Run in development
bun run index.ts greet
# Compile to a standalone binary
bun build --compile --minify --bytecode ./index.ts --outfile mycli
./mycli greet
Links
Looking for a technical partner on your next project?
I build CLI tools and Contentful-powered websites on React Router 7. Fixed scope, fixed price.