Skip to content

CLI Reference

The ionc command-line tool compiles .ion schemas, validates contracts, and manages schema locks.

Commands

Command Description
ionc compile Full compilation with code generation. Alias: ionc build
ionc check Fast parse and validate without code generation
ionc init Interactive scaffolding — creates ion.config.json with feature/platform selection
ionc lock init Create initial ion.lock.json from current schema
ionc lock check Validate current schema against existing lock file
ionc lock update Update lock file to match current schema (acknowledges breaking changes)
ionc serve Start the Language Server Protocol (LSP) server for editor integration

Serve Flags

Flag Description
--stdio Use standard input/output for LSP transport (default for most editors)
--port <number> Use TCP transport on the specified port

Compile Flags

Flag Description
-n, --no-emit-csproj Skip .csproj generation for .NET targets
-o, --only <target> Generate only for a specific platform: dotnet or browser
--maybe Use Maybe wrapper for nullable types instead of native nullability
--update-lock Force-update the lock file, acknowledging any breaking changes
--no-lock Skip schema lock validation entirely
--check Validate only — no code generation (same as ionc check)
-v, --verbose Show detailed timing per compilation stage
--json Output diagnostics as JSON (for CI/CD integration)

Examples

# Full compile
ionc compile

# Validate only, with verbose output
ionc check --verbose

# Generate only TypeScript
ionc compile --only browser

# Compile and update lock file
ionc compile --update-lock

# CI/CD mode — JSON diagnostics, no lock validation
ionc compile --json --no-lock

# Initialize lock file for the first time
ionc lock init

Exit Codes

Code Meaning
0 Success — compilation completed without errors
1 Compilation failed — one or more errors found