The problem with existing CLI frameworks
Traditional CLI frameworks for Node.js have several limitations:- Limited type safety - Manual type assertions and runtime validation
- Slow startup - Node.js initialization overhead affects CLI performance
- Complex builds - Multiple tools needed for bundling, compilation, and testing
- No native shell - External dependencies for running shell commands
- Basic UIs - Simple text output without interactive capabilities
What makes Bunli different
Full type safety with Zod integration
Bunli uses Zod schemas for option definitions, providing both runtime validation and compile-time type inference:Native Bun Shell integration
Every handler receives Bun’s shell ($) directly, with no external dependencies:
React-powered terminal UIs
Bunli includes@bunli/tui with OpenTUI-backed components for building rich interactive experiences:
Bunli commands can have both a
handler (for headless execution) and a render function (for interactive TUI). The framework automatically chooses based on the terminal capabilities.Powerful plugin architecture
Plugins extend functionality with typed stores that are accessible in all command handlers:@bunli/plugin-ai-detect- Detect AI coding assistants (Claude, Cursor, Copilot)@bunli/plugin-completions- Generate shell completions@bunli/plugin-config- Load and merge configuration files@bunli/plugin-mcp- Model Context Protocol integration
Integrated development toolchain
Thebunli CLI provides everything you need for development:
Standalone binary compilation
Compile your CLI to a single executable with all dependencies included:Comparison with alternatives
Commander.js / Yargs
Limitations:- Manual type definitions required
- No built-in validation
- Node.js-only
- No TUI capabilities
- No plugin system
- Automatic type inference from schemas
- Built-in validation with Zod
- Bun-native with faster startup
- React-based TUI components
- Extensible plugin architecture
Oclif
Limitations:- Heavy framework with many dependencies
- Class-based architecture with decorators
- Slower startup time
- Complex plugin development
- Minimal core with zero runtime dependencies
- Function-based API with hooks
- Instant startup with Bun
- Simple plugin creation with typed stores
Ink (React for CLIs)
Limitations:- Node.js-only
- Requires separate CLI framework
- No command parsing
- No validation
- Integrated with command parsing
- Bun-native with OpenTUI renderer
- Built-in validation and type safety
- Optional TUI - commands work without it
When to use Bunli
Bunli is ideal for: ✅ New CLI projects - Start with the best practices baked in ✅ Developer tools - Fast startup matters for tools run frequently ✅ Interactive applications - Build rich TUIs with React components ✅ Type-safe CLIs - Leverage TypeScript’s full power ✅ Bun-first projects - Take advantage of Bun’s ecosystem Bunli may not be right if: ❌ You need Node.js compatibility (Bunli requires Bun) ❌ You’re maintaining a legacy CLI with established patterns ❌ You need Windows support (Bun’s Windows support is experimental)Getting started
Ready to build with Bunli? Start with the quickstart guide:Quickstart
Create your first Bunli CLI in 5 minutes
Architecture
Learn about Bunli’s design and structure