Skip to content

CLI reference ​

The aid command, generated from the COMMANDS table in packages/cli/src/main.ts. The table is also what the parser enforces and what aid --help prints, so this page cannot list a flag the CLI does not accept.

sh
npx @aid-framework/cli --help

Every command accepts -h / --help for its own usage. All except dev accept --json for one JSON document on stdout; a running server or stream is not a finished run. Human-readable text and progress go to stderr, so aid validate --json | jq needs no filtering.

Commands at a glance ​

CommandWhat it does
initscaffold a project: a starter spec and a README
validateparse the spec, build the IR, and run every build-time gate
gencompile the spec and reconcile the tree with it
devregenerate the tree and run the application on a local server
guardmeasure the guardrails against a red-team corpus
migrateemit the SQL the declared vector stores need, for an operator to apply
ingestindex a retriever corpus into the store the spec declares
evalrun the eval gate, or record the baseline it measures against
costreport cost and latency from the local trace sink
traceinspect a traced run: the span tree, timings, models, tokens and cost
doctordiagnose the tree against the spec: drift, versions, missing files
ejecttake ownership of a generated file: move it to business/ and stop generating it
infraderive the deployment wiring from the spec and drive OpenTofu or AWS CDK

init ​

scaffold a project: a starter spec and a README

sh
aid init [dir] [--from <spec>] [--target <name>] [--force] [--gen]
OptionDescription
--from <spec>import an existing spec instead of writing the starter
--target <name>generator target; one of py-fastapi, ts-vercel
--forcereplace a spec or README that is already there
--gengenerate immediately after scaffolding
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

validate ​

parse the spec, build the IR, and run every build-time gate

sh
aid validate [spec]
OptionDescription
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

gen ​

compile the spec and reconcile the tree with it

sh
aid gen [spec] [--target <name>] [--dry-run] [--check] [--force]
OptionDescription
--target <name>generator target; one of py-fastapi, ts-vercel
--dry-runreport what would change, and write nothing
--checkfail when the committed tree does not match the spec; writes nothing
--forceoverwrite generated files that were edited by hand
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

dev ​

regenerate the tree and run the application on a local server

sh
aid dev [spec] [--target <name>] [--port <n>] [--no-gen] [--no-reload]
OptionDescription
--target <name>generator target; one of py-fastapi, ts-vercel
--port <n>the port to serve on; defaults to 8000, the uvicorn default
--no-genserve the tree as it is, without regenerating it first
--no-reloadturn off the reloader that restarts the server on code changes
-h, --helpprint this command's usage

guard ​

measure the guardrails against a red-team corpus

sh
aid guard [spec] [--target <name>] [--red-team <file>]
OptionDescription
--target <name>generator target; one of py-fastapi, ts-vercel
--red-team <file>the corpus to measure against; defaults to redteam.json beside the spec, then at the project root
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

migrate ​

emit the SQL the declared vector stores need, for an operator to apply

sh
aid migrate [spec] [--out <dir>] [--check] [--dry-run]
OptionDescription
--out <dir>directory for the migration file; defaults to migrations
--checkfail when the committed file does not match the spec; writes nothing
--dry-runreport what would change, and write nothing
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

ingest ​

index a retriever corpus into the store the spec declares

sh
aid ingest [spec] [--target <name>] [--retriever <id> | --all] [--dry-run]
OptionDescription
--retriever <id>ingest one declared retriever, by the id the spec used
--allingest every retriever the spec declares
--dry-runreport what a run would write, and write nothing
--target <name>generator target; one of py-fastapi, ts-vercel
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

eval ​

run the eval gate, or record the baseline it measures against

sh
aid eval [spec] [--target <name>] [--suite <id>] [--baseline]
OptionDescription
--suite <id>run one eval instead of all of them
--target <name>generator target; one of py-fastapi, ts-vercel
--baselinerecord a fresh baseline instead of gating
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

cost ​

report cost and latency from the local trace sink

sh
aid cost [dir] [--since <date>] [--budget <usd>]
OptionDescription
--since <date>only count spans that started at or after this date (YYYY-MM-DD or an ISO 8601 instant)
--budget <usd>fail when the measured cost exceeds this ceiling
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

trace ​

inspect a traced run: the span tree, timings, models, tokens and cost

sh
aid trace [run] [--dir <dir>] [--all]
OptionDescription
--dir <dir>the trace directory to read (default: $AID_TRACE_DIR)
--allprint every run in the directory, not just the run list
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

doctor ​

diagnose the tree against the spec: drift, versions, missing files

sh
aid doctor [spec] [--target <name>]
OptionDescription
--target <name>generator target; one of py-fastapi, ts-vercel
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

eject ​

take ownership of a generated file: move it to business/ and stop generating it

sh
aid eject <path> [--target <name>] [--dry-run]
OptionDescription
--target <name>generator target; one of py-fastapi, ts-vercel
--dry-runreport the move, and write nothing
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

infra ​

derive the deployment wiring from the spec and drive OpenTofu or AWS CDK

sh
aid infra <gen|plan|apply|drift> [spec] [--dry-run|--check] [--env <name>] [--iac <tofu|cdk>] [--cloud <aws|gcp>] [--force]
OptionDescription
--dry-rungen: report what would change, and write nothing
--checkgen: exit non-zero when the generated tree is out of date
--env <name>environment root (infra/envs/<name>, infra/envs/gcp-<name>, or infra/cdk/<name>); plan, apply and drift use dev
--iac <tofu|cdk>plan, apply and drift: which backend to drive; defaults to tofu
--cloud <aws|gcp>which cloud the module set targets, and so which env root an action runs in; defaults to aws
--confirm-prodrequired to apply to prod
--forcegen: overwrite generated files that were edited by hand
--jsonprint one JSON document on stdout
-h, --helpprint this command's usage

Exit codes ​

The exit code is the contract CI reads, so the three values are distinct on purpose.

CodeMeaning
0The project is in the shape the command asked for
1The spec, a gate, the target, or the working tree said no
2The invocation was wrong, or the CLI failed internally

A red build caused by 1 is fixed in the spec; a red build caused by 2 is fixed in the invocation or is a bug. Collapsing them sends people to the wrong file.


This page is generated from the source by site/scripts/gen-reference.mjs. Do not edit it by hand: run pnpm --filter @aid-framework/docs gen and commit the result.

Next: the spec reference or getting started.

Latest release v0.1.98 · Released under the Apache-2.0 licence · Licence · Notice · Security