This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Amplitude Audio CLI (am) - A Rust command-line tool for managing projects that use the Amplitude Audio SDK, a cross-platform audio engine designed for games.
The SDK uses a data-driven approach where developers define audio behavior through JSON configuration files rather than code. This CLI tool manages the creation, registration, and organization of these project files and directory structures.
Local state: ~/.amplitude/am.db (SQLite database tracking registered projects and templates)
cargo build # Debug build
cargo build --release # Release build
cargo run # Run the CLI
cargo run -- --verbose # Run with debug/trace logging
cargo run -- --help # Show available commandssrc/main.rs- Entry point: parses args, initializes logger/database, routes commands, handles signalssrc/app.rs- CLI definition using clap derive macros, definesCommandsenumsrc/commands/- Command handlers (project.rs, sudo.rs)
connection.rs- Thread-safe SQLite wrapper usingArc<Mutex<Connection>>migrations.rs- Version-based schema migrations with checksum verificationentities.rs- Data models (Project,Template,ProjectConfiguration)mod.rs- CRUD helper functions (db_get_*,db_create_*, etc.)
- Custom
logtrait implementation with colored console output - In-memory buffer (1000 entries) for crash log writing to
~/.amplitude/ - Use
success!()macro for green checkmark success messages
Default project templates in resources/ are compiled into the binary via rust-embed. These templates define starting configurations for SDK features (buses, pipelines, audio configs).
New Command:
- Create handler in
src/commands/your_command.rs - Add variant to
Commandsenum insrc/app.rs - Wire handler in
run_command()insrc/main.rs
Database Changes:
- Add migration in
src/database/migrations.rs(increment version) - Add CRUD helpers in
src/database/mod.rs
- Error handling: Use
anyhow::Result<T>with?operator - Async runtime: Tokio (full features)
- Interactive prompts:
inquirecrate with validators - Project config stored as
.amprojectJSON files
Projects created by am project init follow the SDK's data-driven architecture:
project_name/
├── .amproject # Project configuration (name, paths, version)
├── sources/ # Audio asset definitions (JSON files)
│ ├── attenuators/ # Distance-based volume falloff curves
│ ├── collections/ # Grouped sound variations
│ ├── effects/ # Audio effects (reverb, EQ, etc.)
│ ├── events/ # Triggerable audio events
│ ├── pipelines/ # Audio processing chains
│ ├── rtpc/ # Real-Time Parameter Controls
│ ├── soundbanks/ # Packaged audio assets for runtime
│ ├── sounds/ # Individual sound definitions
│ ├── switch_containers/ # State-based sound switching
│ └── switches/ # Switch state definitions
├── build/ # Compiled/processed assets output
├── data/ # Raw audio files (wav, ogg, etc.)
└── plugins/ # Custom SDK plugins
The *.config.json, and *.buses.json files in project roots configure the SDK's audio engine, and bus hierarchy (for mixing/ducking) respectively.