Overview
The Hello World example is the absolute simplest Bunli CLI. It demonstrates basic command structure, options, validation, and both TUI and handler-based execution. Perfect for understanding Bunli fundamentals in under 5 minutes. Location:examples/hello-world/
Quick Start
Project Structure
Commands
greet - Basic Greeting
A minimal command demonstrating core Bunli concepts.
Source: commands/greet.tsx
password - Password Input Demo
Demonstrates the PasswordField component with form validation.
Source: commands/password.tsx
password-prompt - Standard Buffer Password
Demonstrates password prompting in standard buffer mode.
Usage:
showcase - Component Showcase
A comprehensive showcase of @bunli/tui/interactive and @bunli/tui/charts components.
Features:
- Modal dialogs
- Confirmation dialogs
- Choose dialogs
- Toast notifications
- Command palette
- Menu navigation
- Data tables
- Charts (Bar, Line, Sparkline)
- Tabs
- Progress indicators
qorEsc: quitTab/Shift+Tab: cycle focus regionsF1: focus command paletteF2: focus menuF3: focus tabsF4: focus data tableF5: focus viewportPgUp/PgDn: scroll viewportCtrl+M: toggle modalCtrl+Y: open confirm dialogCtrl+P: open choose dialogCtrl+T: show toast
Configuration
Source:bunli.config.ts
CLI Entry Point
Source:cli.ts
Key Concepts
1. Command Definition
UsedefineCommand to create a command with options and handlers:
2. Option Schemas
Wrap Zod schemas withoption() for CLI metadata:
3. Type Coercion
Usez.coerce to convert CLI string inputs:
4. Command Composition
Commands can provide bothrender and handler:
render: TUI component (alternate buffer)handler: Standard CLI output (standard buffer)
5. Buffer Modes
Alternate Buffer Mode:- Fullscreen TUI rendering
- Configured globally or per-command
- No terminal history pollution
- Regular CLI output
- Appears in terminal history
- Default for handler-only commands
Development Workflow
What You Learned
- ✅ Creating commands with
defineCommand - ✅ Defining options with Zod schemas
- ✅ Type coercion with
z.coerce - ✅ Using short flags
- ✅ Accessing command context (
flags,colors, etc.) - ✅ Building TUI components with React
- ✅ Buffer mode configuration
- ✅ Command registration
Next Steps
Ready for more? Check out these examples:- Task Runner - Complex validation and interactive prompts
- Git Tool - External tool integration and command organization
- Dev Server - Plugin system and configuration management