15 releases (4 breaking)
Uses new Rust 2024
| 0.5.0 | Dec 24, 2025 |
|---|---|
| 0.4.3 | Dec 19, 2025 |
| 0.3.3 | Dec 10, 2025 |
| 0.2.0 | Dec 9, 2025 |
| 0.1.5 | Dec 9, 2025 |
#831 in Command line utilities
730KB
18K
SLoC
baobao
Bao is a very opinionated tool to generate CLI applications in multiple programming languages from a single configuration file.
Crates
[!Note] Crates are published as
baobao*on crates.io instead ofbao*to avoid confusion with an already existing and unrelatedbaocrate.
| Crate | Description |
|---|---|
| baobao | CLI tool for generating CLI applications from TOML |
| baobao-core | Core utilities for Bao CLI generator |
| baobao-manifest | TOML manifest parsing and validation |
| baobao-codegen | Shared code generation utilities |
| baobao-codegen-rust | Rust code generator |
| baobao-codegen-typescript | TypeScript code generator |
Installation
cargo install baobao
Quick Start
Initialize a new project:
bao init myapp
# Select language interactively, or use: bao init myapp --language rust
This creates a complete project with a bao.toml manifest:
[cli]
name = "myapp"
version = "0.1.0"
[commands.hello]
description = "Say hello"
args = ["name"]
flags = ["uppercase"]
Edit bao.toml to add commands, then regenerate:
bao bake
Commands
| Command | Description |
|---|---|
bao init [name] |
Initialize a new CLI project |
bao bake |
Generate code from bao.toml |
bao add command <name> |
Add a new command |
bao remove command <name> |
Remove a command |
bao rename command <old> <new> |
Rename a command |
bao list |
List commands and context |
bao info |
Display project info and statistics |
bao check |
Validate bao.toml |
bao clean |
Remove orphaned generated files |
bao fmt |
Format bao.toml |
bao run |
Run the CLI (shortcut for cargo run --) |
bao completions <shell> |
Generate shell completions |
Features
- Type-safe argument parsing (clap for Rust, boune for TypeScript)
- Handler stubs generated for each command
- Context for shared state (database pools, HTTP clients, etc.)
- Multiple language targets from a single manifest
License
This project is licensed under the MIT LICENSE
Dependencies
~9–22MB
~248K SLoC