Aivi CLI
The Aivi Command Line Interface (CLI) is the primary tool for managing Aivi projects. It handles project creation, dependency management, compilation, and execution.
Installation
The CLI is distributed as a single binary named aivi. It can be installed directly from source or via pre-built binaries (roadmap).
Commands
Project Management
init / new
Creates a new Aivi project in a directory.
aivi init <name> [--bin|--lib] [--edition 2024] [--language-version 0.1] [--force]<name>: The name of the project.--bin: Create a binary (application) project (default).--lib: Create a library project.--edition: Set the Rust edition (default: 2024).--language-version: Set the Aivi language version (default: 0.1).--force: Force creation even if the directory is not empty.
install
Installs a dependency into the current project.
aivi install <spec> [--no-fetch]<spec>: The dependency specification.name: Installs the latest version from the registry.name@version: Installs a specific version.git+https://github.com/user/repo: Installs from a Git repository.path:../local-crate: Installs from a local path.
- Validation: installs are strict by default. The dependency must declare
[package.metadata.aivi]withlanguage_versionandkind = "lib". If the project declareslanguage_versioninaivi.toml, it must match. --no-fetch: UpdatesCargo.tomlbut skips runningcargo fetch.
search
Searches for Aivi packages in the registry.
aivi search <query>package
Packages the current project using Cargo (creates a .crate archive under target/package).
aivi package [--allow-dirty] [--no-verify] [-- <cargo args...>]- Preflight validation: requires
aivi.tomland[package.metadata.aivi]inCargo.toml. --allow-dirty: Forwards tocargo package --allow-dirty.--no-verify: Forwards tocargo package --no-verify.<cargo args...>: Additional arguments forwarded tocargo packageafter--.
publish
Publishes the current project to crates.io via Cargo.
aivi publish [--dry-run] [--allow-dirty] [--no-verify] [-- <cargo args...>]- Preflight validation: requires
aivi.tomland[package.metadata.aivi]inCargo.toml. --dry-run: Forwards tocargo publish --dry-run.--allow-dirty: Forwards tocargo publish --allow-dirty.--no-verify: Forwards tocargo publish --no-verify.<cargo args...>: Additional arguments forwarded tocargo publishafter--.
clean
Cleans build artifacts.
aivi clean [--all]--all: Cleans both Aivi-generated code (target/aivi-gen) and Cargo artifacts (target/debug,target/release).
Build & Run
build
Compiles the current project.
aivi build [--release] [-- <cargo args...>]--release: Build in release mode (optimizations enabled).<cargo args...>: Additional arguments passed tocargo build.- Backend selection: controlled by
aivi.tomlvia[build].codegen = "embed" | "native".
run
Runs the current project (if it is a binary).
aivi run [--release] [-- <cargo args...>]--release: Run in release mode.<cargo args...>: Additional arguments passed tocargo run.- Backend selection: controlled by
aivi.tomlvia[build].codegen = "embed" | "native".
Development Tools
fmt
Formats Aivi source code.
aivi fmt <path>check
Checks the code for errors without generating code.
aivi check <path|dir/...>Calculates diagnostics and performs type checking.
parse
Parses a file and outputs the concrete syntax tree (CST) and any syntax errors.
aivi parse <path|dir/...>desugar
Shows the desugared high-level intermediate representation (HIR) of a module.
aivi desugar <path|dir/...>kernel
Shows the Kernel (Core Calculus) representation of a module.
aivi kernel <path|dir/...>rust-ir
Shows the Rust Intermediate Representation (Rust IR) of a module.
aivi rust-ir <path|dir/...>Services
lsp
Starts the Language Server Protocol (LSP) server. This is typically used by editor extensions, not directly by users.
aivi lspmcp
Starts the Model Context Protocol (MCP) server for a specific file or directory. This allows LLMs to context-aware interaction with the codebase.
aivi mcp serve <path|dir/...> [--allow-effects]--allow-effects: Allows the MCP server to execute tools that have side effects.