baobao

Crates.iobaobao
lib.rsbaobao
version0.5.0
created_at2025-12-07 15:21:16.712792+00
updated_at2025-12-24 15:35:17.632889+00
descriptionGenerate type-safe CLI applications from a simple TOML schema
homepagehttps://github.com/roushou/bao
repositoryhttps://github.com/roushou/bao
max_upload_size
id1971772
size98,260
Roushou (roushou)

documentation

README

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 of bao* to avoid confusion with an already existing and unrelated bao crate.

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

Commit count: 0

cargo fmt