baobao-ir

Crates.iobaobao-ir
lib.rsbaobao-ir
version0.5.0
created_at2025-12-24 15:35:04.01609+00
updated_at2025-12-24 15:35:04.01609+00
descriptionIntermediate representation types for Bao CLI generator
homepagehttps://github.com/roushou/bao
repositoryhttps://github.com/roushou/bao
max_upload_size
id2003434
size23,510
Roushou (roushou)

documentation

README

baobao-ir

Intermediate representation types for Bao CLI generator.

This crate provides unified type definitions used across the Bao code generation pipeline. These types serve as the single source of truth for configuration and resource representation, bridging manifest parsing and code generation.

Architecture

bao.toml (TOML) → bao-manifest (parsing) → bao-ir (unified types) → codegen

The IR types are designed to be:

  • Language-agnostic - No Rust/TypeScript-specific concerns
  • Application-type agnostic - CLI, HTTP server, etc.
  • Self-contained - No external dependencies beyond std

Features

  • Application IR - Unified representation for CLI applications (AppIR, AppMeta)
  • Operations - Command and route abstractions (Operation, CommandOp)
  • Resources - Database and HTTP client configuration (Resource, DatabaseResource, HttpClientResource)
  • Inputs - Type-safe parameter definitions (Input, InputType, InputKind)
  • Pool Configuration - Connection pool settings (PoolConfig)
  • SQLite Options - SQLite-specific configuration (SqliteOptions, JournalMode, SynchronousMode)

Usage

This crate is used internally by bao-manifest and language-specific code generators. You typically don't need to use it directly unless you're implementing manifest lowering or a new language generator.

use baobao_ir::{AppIR, AppMeta, CommandOp, Input, InputType, InputKind};

// Create an application IR
let app = AppIR {
    meta: AppMeta {
        name: "myapp".into(),
        version: "0.1.0".into(),
        description: Some("My CLI application".into()),
        author: None,
    },
    resources: vec![],
    operations: vec![],
};

License

This project is licensed under the MIT license.

Commit count: 0

cargo fmt