Complete reference for the IntentScript command-line interface.
cargo install --path intentscript-cliintentscript [OPTIONS] <COMMAND>-h, --help- Print help information-V, --version- Print version information-v, --verbose- Enable verbose output-q, --quiet- Suppress non-error output
Compile IntentScript source to Execution Plan IR.
intentscript build [OPTIONS] <SOURCE><SOURCE>- Path to IntentScript source file (.intent)
-o, --output <FILE>- Output IR file path (default:<source>.ir.json)--json- Output diagnostics in JSON format--policy <FILE>- Path to policy file (optional)--check- Check compilation without writing output
# Basic compilation
intentscript build task.intent
# Specify output file
intentscript build task.intent -o my_task.ir.json
# Check without writing
intentscript build task.intent --check
# JSON diagnostics for CI
intentscript build task.intent --json > diagnostics.json0- Success1- Compilation error2- Warning (with --check)
Execute an Execution Plan IR file.
intentscript run [OPTIONS] <IR_FILE><IR_FILE>- Path to Execution Plan IR file (.ir.json)
--input <KEY=VALUE>- Provide input values (can be repeated)--host <TYPE>- Host adapter type (default:default)--timeout <MS>- Execution timeout in milliseconds--output-dir <DIR>- Directory for output artifacts (default:./artifacts)--audit-log <FILE>- Path to write audit log (default:./audit.log)--json- Output results in JSON format
# Basic execution
intentscript run task.ir.json
# With inputs
intentscript run task.ir.json --input file_path=./data.txt --input count=10
# With timeout
intentscript run task.ir.json --timeout 30000
# Custom output directory
intentscript run task.ir.json --output-dir ./results
# JSON output for CI
intentscript run task.ir.json --json > results.json0- Success (all checks passed)1- Runtime error2- Validation failure3- Timeout4- Capability violation
Check IntentScript source for errors and warnings.
intentscript lint [OPTIONS] <SOURCE><SOURCE>- Path to IntentScript source file (.intent)
--json- Output diagnostics in JSON format--policy <FILE>- Path to policy file (optional)--strict- Treat warnings as errors
# Basic linting
intentscript lint task.intent
# JSON output for CI
intentscript lint task.intent --json
# Strict mode
intentscript lint task.intent --strict
# Lint multiple files
intentscript lint tasks/*.intentText format:
error[E0001]: unexpected token
--> task.intent:5:10
|
5 | input: name text
| ^^^^ expected ':', found 'text'
JSON format:
{
"diagnostics": [
{
"level": "error",
"code": "E0001",
"message": "unexpected token",
"location": {
"file": "task.intent",
"line": 5,
"column": 10
},
"suggestion": "expected ':', found 'text'"
}
]
}0- No errors1- Errors found2- Warnings found (with --strict)
Format IntentScript source code.
intentscript fmt [OPTIONS] <SOURCE><SOURCE>- Path to IntentScript source file (.intent)
--check- Check if file is formatted without modifying--write- Write formatted output to file (default)--stdout- Print formatted output to stdout
# Format file in place
intentscript fmt task.intent
# Check formatting
intentscript fmt task.intent --check
# Print to stdout
intentscript fmt task.intent --stdout
# Format multiple files
intentscript fmt tasks/*.intent- Consistent indentation (2 spaces)
- Aligned colons in input/constraint blocks
- Consistent spacing around operators
- Normalized string quotes
- Sorted imports (future feature)
0- Success (or already formatted with --check)1- Error2- Not formatted (with --check)
Explain an Execution Plan IR file.
intentscript explain [OPTIONS] <IR_FILE><IR_FILE>- Path to Execution Plan IR file (.ir.json)
--format <FORMAT>- Output format:text,json,markdown(default:text)--verbose- Include detailed step information--audit-log <FILE>- Include execution results from audit log
# Basic explanation
intentscript explain task.ir.json
# Verbose output
intentscript explain task.ir.json --verbose
# Markdown format
intentscript explain task.ir.json --format markdown > explanation.md
# With execution results
intentscript explain task.ir.json --audit-log ./audit.log- Metadata: Task name, version, compiler version, policy hash
- Inputs: Required and optional inputs with types
- Capabilities: Enabled capabilities and constraints
- Limits: Execution limits (max repairs, timeout)
- Steps: Execution pipeline with step details
- Outputs: Expected output artifacts
- Checks: Validation checks and their status (if audit log provided)
0- Success1- Error reading IR file
Default path to policy file.
export INTENTSCRIPT_POLICY_PATH=./policies/default.toml
intentscript build task.intentDefault host adapter type.
export INTENTSCRIPT_HOST=custom
intentscript run task.ir.jsonLogging level: error, warn, info, debug, trace.
export INTENTSCRIPT_LOG_LEVEL=debug
intentscript run task.ir.jsonCreate .intentscript.toml in your project root:
[build]
policy = "./policies/default.toml"
output_dir = "./ir"
[run]
host = "default"
timeout = 60000
output_dir = "./artifacts"
audit_log = "./audit.log"
[lint]
strict = false
[fmt]
indent = 2
max_line_length = 100name: IntentScript CI
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install IntentScript
run: cargo install --path intentscript-cli
- name: Lint tasks
run: intentscript lint tasks/*.intent --json > lint-results.json
- name: Upload results
uses: actions/upload-artifact@v2
with:
name: lint-results
path: lint-results.json
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install IntentScript
run: cargo install --path intentscript-cli
- name: Build tasks
run: |
for task in tasks/*.intent; do
intentscript build "$task" -o "ir/$(basename "$task" .intent).ir.json"
done
- name: Upload IR
uses: actions/upload-artifact@v2
with:
name: execution-plans
path: ir/
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install IntentScript
run: cargo install --path intentscript-cli
- name: Download IR
uses: actions/download-artifact@v2
with:
name: execution-plans
path: ir/
- name: Run tasks
run: |
for ir in ir/*.ir.json; do
intentscript run "$ir" --json > "results/$(basename "$ir" .ir.json).json"
done
- name: Upload results
uses: actions/upload-artifact@v2
with:
name: test-results
path: results/stages:
- lint
- build
- test
lint:
stage: lint
script:
- cargo install --path intentscript-cli
- intentscript lint tasks/*.intent --json > lint-results.json
artifacts:
reports:
junit: lint-results.json
build:
stage: build
script:
- cargo install --path intentscript-cli
- mkdir -p ir
- for task in tasks/*.intent; do
intentscript build "$task" -o "ir/$(basename "$task" .intent).ir.json";
done
artifacts:
paths:
- ir/
test:
stage: test
dependencies:
- build
script:
- cargo install --path intentscript-cli
- mkdir -p results
- for ir in ir/*.ir.json; do
intentscript run "$ir" --json > "results/$(basename "$ir" .ir.json).json";
done
artifacts:
paths:
- results/Generate shell completion scripts:
intentscript completions bash > /etc/bash_completion.d/intentscriptintentscript completions zsh > /usr/local/share/zsh/site-functions/_intentscriptintentscript completions fish > ~/.config/fish/completions/intentscript.fishintentscript completions powershell > $PROFILECommand not found
# Ensure cargo bin is in PATH
export PATH="$HOME/.cargo/bin:$PATH"Permission denied
# Make binary executable
chmod +x ~/.cargo/bin/intentscriptSlow compilation
# Use release build
cargo build --release
cargo install --path intentscript-cli --releaseJSON parsing errors
# Validate IR file
jq . task.ir.json# Use custom host implementation
intentscript run task.ir.json --host custom
# With host configuration
intentscript run task.ir.json --host custom --host-config config.toml# Enable debug logging
INTENTSCRIPT_LOG_LEVEL=debug intentscript run task.ir.json
# Trace execution
INTENTSCRIPT_LOG_LEVEL=trace intentscript run task.ir.json --verbose
# Dump IR
intentscript build task.intent --output - | jq .# Time compilation
time intentscript build task.intent
# Time execution
time intentscript run task.ir.json
# Profile with cargo
cargo build --release --bin intentscript
perf record target/release/intentscript run task.ir.json
perf report