MCPcopy Index your code
hub / github.com/BoundaryML/baml

github.com/BoundaryML/baml @0.223.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.223.0 ↗ · + Follow
74,734 symbols 294,088 edges 4,310 files 11,322 documented · 15% 4 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Development Setup Guide

This guide provides detailed instructions for setting up your BAML development environment.

Quick Start

# Clone the repository
git clone https://github.com/BoundaryML/baml.git
cd baml

mise trust
pnpm setup-dev
pnpm clean:ws
pnpm install
pnpm typecheck
pnpm build

# Start developing!
pnpm dev

Tool Management with mise

We use mise (formerly rtx) as our polyglot tool version manager. This ensures all developers use the exact same versions of tools, preventing "works on my machine" issues.

What is mise?

mise is a tool version manager that can handle multiple programming languages and tools in one place. It replaces the need for nvm, rbenv, pyenv, rustup, and other version managers.

Configuration

Our tool versions are defined in mise.toml:

[tools]
rust = "1.88.0"
go = "1.23"
python = "3.12"
ruby = "3.2.2"
node = "lts"
# ... and more

Common mise Commands

# List all installed tools
mise list

# Install/update all tools to match mise.toml
mise install

# Show current tool versions
mise current

# Upgrade tools to latest versions (respecting version constraints)
mise upgrade

# Trust the configuration file (required after changes)
mise trust

Manual Setup (Not Recommended)

If you prefer to install tools manually or need to understand what the setup script does:

Required Tools

  1. Rust (1.88.0) bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup install 1.88.0 rustup default 1.88.0

  2. Go (1.23)

  3. Download from https://golang.org/dl/
  4. Install protoc-gen-go: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.6

  5. Python (3.12)

  6. Install Python 3.12
  7. Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh

  8. Ruby (3.2.2)

  9. Install Ruby 3.2.2
  10. Install bundler: gem install bundler

  11. Node.js (LTS)

  12. Install Node.js LTS
  13. pnpm will be installed via mise

Platform-Specific Dependencies

macOS:

brew install libyaml openssl@3

Linux: Dependencies vary by distribution. The setup script will guide you.

Development Workflow

Running Everything

# Start all services with hot reloading
pnpm dev

# Run only specific components
pnpm dev:vscode       # VSCode extension
pnpm dev:playground   # Web playground
pnpm dev:language-server  # Language server

Building Specific Components

After the TypeScript refactor, use these commands:

# Build everything
pnpm build

# Build specific apps
pnpm build:fiddle-web-app  # Web playground app
pnpm build:vscode         # VSCode extension
pnpm build:playground     # Playground package
pnpm build:cli           # CLI tool

# Release commands
pnpm release:fiddle-web-app  # Release web app
pnpm release:vscode         # Release VSCode extension
pnpm release:cli           # Release CLI

TypeScript Project Structure

The TypeScript codebase follows a monorepo structure:

typescript/
├── apps/                    # All applications
│   ├── fiddle-web-app/     # Web playground
│   └── vscode-ext/         # VSCode extension
├── packages/               # All reusable packages
│   ├── ui/                # Shared UI components
│   ├── common/            # Common utilities
│   ├── playground-common/ # Playground shared code
│   ├── language-server/   # Language server
│   └── ...               # Other packages
└── workspace-tools/       # Build and config tools

Running Tests

# Run all tests
./run-tests.sh

# Run specific language tests
cd integ-tests/typescript && pnpm test
cd integ-tests/python && uv run pytest
cd integ-tests/ruby && rake test

Building

# Build everything
pnpm build

# Build specific components
cargo build --release    # Rust components
pnpm build              # TypeScript components

Troubleshooting

mise Issues

"mise: command not found" - The setup script installs mise to ~/.local/bin. Make sure this is in your PATH. - Try: source ~/.bashrc or source ~/.zshrc

"mise trust required" - Run: mise trust in the project root

Tool version conflicts - Run: mise doctor to diagnose issues - Try: mise install --force to reinstall tools

Language-Specific Issues

Rust compilation errors - Ensure you're using the correct Rust version: rustc --version - Clear cargo cache: cargo clean

Go module errors - Clear module cache: go clean -modcache - Ensure GOPATH is set correctly

Python/uv issues - Clear uv cache: uv cache clean - Reinstall dependencies: uv sync --reinstall

Ruby/bundler issues - Clear bundler cache: bundle clean --force - Reinstall gems: bundle install --force

Getting Help

  1. Check the CONTRIBUTING.md guide
  2. Search existing GitHub issues
  3. Ask in our Discord #contributing channel

IDE Setup

VSCode: - Install recommended extensions when prompted - mise tools will be automatically detected

IntelliJ/RustRover: - Configure SDK paths to use mise-installed versions - Go: ~/.local/share/mise/installs/go/1.23/ - Rust: ~/.local/share/mise/installs/rust/1.88.0/ - Python: ~/.local/share/mise/installs/python/3.12/ - Ruby: ~/.local/share/mise/installs/ruby/3.2.2/

Other IDEs: - Point to tool installations in ~/.local/share/mise/installs/

Keeping Your Environment Updated

When other developers update tool versions:

  1. Pull the latest changes
  2. Run: mise install
  3. Restart your terminal/IDE if needed

The setup script can be run anytime to ensure your environment is up to date.

Extension points exported contracts — how you extend this code

PatCtx (Interface)
Operations the algorithm needs from the type system. The TIR builder implements this. Keeping the algorithm trait-bound [7 …
baml_language/crates/baml_compiler2_tir/src/exhaustiveness.rs
KnownTypes (Interface)
Trait for project-specific known types enum. Implemented by `CodeGen`'d `Types` and `StreamTypes` enums. NOTE: No blank [40 …
languages/rust/baml/src/known_types.rs
WithRetryPolicy (Interface)
#[delegatable_trait] #[enum_dispatch] [8 implementers]
engine/baml-runtime/src/internal/llm_client/traits/mod.rs
RequestHandler (Interface)
A supertrait for any server request handler. [10 implementers]
engine/language_server/src/server/api/traits.rs
WithRepr (Interface)
Implement this for every node in the IR AST, where T is the type of IR node [17 implementers]
engine/baml-lib/baml-core/src/ir/repr.rs
LanguageFeatures (Interface)
Controls output-type-specific behavior of codegen [6 implementers]
engine/generators/utils/dir_writer/src/lib.rs
BamlSerializer (Interface)
BamlSerializer interface for custom class encoding [669 implementers]
engine/language_client_go/baml_go/serde/encode.go
ApiEndpoint (Interface)
Trait for POST endpoints that have an associated request body and response. [19 implementers]
engine/baml-rpc/src/rpc.rs

Core symbols most depended-on inside this repo

new
called by 13339
baml_language/crates/bex_project/src/lib.rs
filter
called by 7829
baml_language/crates/bex_vm/src/package_baml/array.rs
cloneContext
called by 7055
engine/language_client_typescript/async_context_vars.js
toBamlError
called by 6967
engine/language_client_typescript/errors.js
cast
called by 5413
baml_language/crates/baml_compiler_syntax/src/ast.rs
cast_to
called by 4303
engine/language_client_python/src/types/function_results.rs
expect
called by 3543
baml_language/crates/baml_compiler_parser/src/parser.rs
to_string
called by 3490
baml_language/crates/bex_vm/src/package_baml/json.rs

Shape

Method 42,792
Function 18,656
Class 8,080
Interface 2,400
Struct 1,502
Enum 1,137
TypeAlias 117
Route 29
FuncType 21

Languages

Rust37%
Python24%
TypeScript20%
Go18%
Ruby2%
Kotlin1%

Modules by API surface

integ-tests/python/baml_client/type_builder.py1,676 symbols
integ-tests/python-v1/baml_client/type_builder.py1,676 symbols
integ-tests/python/baml_client/sync_client.py1,192 symbols
integ-tests/python-v1/baml_client/sync_client.py1,192 symbols
integ-tests/python/baml_client/async_client.py1,190 symbols
integ-tests/python-v1/baml_client/async_client.py1,190 symbols
integ-tests/go/baml_client/type_builder/classes.go703 symbols
integ-tests/typescript/baml_client/sync_request.ts594 symbols
integ-tests/typescript/baml_client/parser.ts594 symbols
integ-tests/typescript/baml_client/async_request.ts594 symbols
integ-tests/typescript-esm/baml_client/sync_request.ts594 symbols
integ-tests/typescript-esm/baml_client/parser.ts594 symbols

Datastores touched

mydbDatabase · 1 repos

For agents

$ claude mcp add baml \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact