Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

D - infs CLI Reference

infs is the unified command-line interface for the Inference compiler toolchain. It wraps the infc compiler with project management, toolchain installation, and build/run commands.

Compilation Commands

CommandDescription
infs build <file>Compile an Inference source file to WebAssembly
infs run <file>Build and execute with wasmtime

Build Options

infs build always runs the full compilation pipeline (parse, analyze, codegen) and writes out/<name>.wasm.

OptionDescription
-vAlso generate Rocq (.v) translation file

Run Options

OptionDescription
--entry-point <NAME>Function to invoke (default: main)
[ARGS]...Arguments passed to the invoked function

Examples

# Full compilation (writes out/example.wasm)
$ infs build example.inf

# Compile with Rocq translation (writes out/example.wasm and out/example.v)
$ infs build example.inf -v

# Build and run
$ infs run example.inf

# Run a specific exported function
$ infs run example.inf --entry-point my_function

Using infc Directly

The underlying infc compiler accepts additional flags for selective phase execution:

FlagDescription
--parseParse only (syntax check)
--analyzeRun type checking and semantic analysis
--codegenGenerate WebAssembly
-oWrite WASM binary to the out/ directory
-vGenerate Rocq (.v) translation file

When no flags are given, infc performs full compilation and writes the WASM binary — equivalent to --codegen -o.

Project Management

CommandDescription
infs new <name>Create a new project in a new directory
infs initInitialize a project in the current directory

Creating a New Project

$ infs new myproject

This creates the following project structure:

myproject/
├── Inference.toml
├── src/
│   └── main.inf
├── tests/
└── proofs/

The generated src/main.inf contains a minimal program:

// Entry point for the Inference program

pub fn main() -> i32 {
    return 0;
}

Use --no-git to skip git initialization:

$ infs new myproject --no-git

Initializing an Existing Directory

$ infs init

Creates Inference.toml and src/main.inf in the current directory. If a .git directory exists, it also creates .gitignore and .gitkeep files.

Toolchain Management

CommandDescription
infs install [version]Install a toolchain version
infs uninstall <version>Remove an installed toolchain
infs listList installed toolchains
infs versionsList available toolchain versions
infs default <version>Set the default toolchain
infs doctorCheck installation health
infs self updateUpdate infs itself

Installing a Toolchain

# Install latest stable version
$ infs install

# Install a specific version
$ infs install 0.1.0

On first install, infs automatically configures your system PATH:

  • Linux/macOS: Adds ~/.inference/bin to your shell profile (~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish)
  • Windows: Updates the user PATH in the registry

After installation, restart your terminal or source your shell profile.

Checking Installation Health

$ infs doctor

This runs diagnostic checks and provides recommendations if anything needs attention.

Other Commands

CommandDescription
infs versionDisplay version information
infs (no arguments)Launch interactive TUI (experimental)

Compiler Resolution

When running build or run, infs locates the infc compiler using the following priority:

PrioritySourceDescription
1 (highest)INFC_PATH env varExplicit path to a specific infc binary
2System PATHFinds infc via which
3 (lowest)Managed toolchainUses ~/.inference/toolchains/VERSION/infc

Environment Variables

VariablePurpose
INFC_PATHExplicit path to infc binary (highest priority)
INFERENCE_HOMEToolchain installation directory (default: ~/.inference)
INFS_NO_TUIDisable interactive TUI
INFS_DIST_SERVERDistribution server URL (default: https://inference-lang.org)