CLI reference
Commands for running, querying, and validating an anfra project
Run anfra --help for the list of commands, or anfra <command> --help for details on one command. Run commands from inside your anfra project folder.
Commands
| Command | What it does |
|---|---|
anfra init | Set up a project: data source config and folders for models, datasets and apps. See Installation. |
anfra show | Show the project's datasets, or one dataset: their models, fields and metrics. |
anfra agent setup | Install or update the anfra skills in your coding agents. See Installation. |
anfra serve | Start a warm server for the current project. Other commands route to it when it is running. |
anfra query | Compile and run an AMQL query against a dataset. |
anfra validate | Validate the AMQL project, optionally scoped to file globs. |
anfra ingest | Build the local search catalog from context sources. |
anfra search | Search the local catalog. |
anfra lineage | Trace fields through the local catalog to what they are built from. |
anfra status | Report whether a warm server is running and its sidecars are healthy. |
anfra update | Update the binary to the latest release. |
anfra version | Print the anfra version. |
anfra serve
Starts the anfra server for the current project and keeps it running. While it runs, database connections are reused across requests, and other anfra commands send their work to it instead of starting from scratch.
Only one server can run per project.
It listens on 127.0.0.1:7878, or on a free port when another project's server holds that one. anfra status says where. It also serves the project's data apps at /apps/, reloading them as their files change. It has no authentication, so keep it on a loopback address unless you pass --addr deliberately.
anfra query
Compiles and runs an AMQL query against a dataset.
| Flag | Description |
|---|---|
-d, --dataset | Name of the dataset to compile against. Required. |
-a, --aql | The AMQL query. If omitted, it is read from stdin. |
-g, --generate | Print the generated SQL instead of running the query. |
-c, --validate, --check | Type-check the query and report diagnostics instead of running it. |
anfra validate
Validates the models and datasets in the project. Pass file globs to report diagnostics only for matching files:
anfra validate "models/*.aml"anfra ingest
Builds the local catalog from context sources. anfra search and anfra lineage read this catalog, not your AML files, so run anfra ingest again after you change a model or dataset.
| Flag | Description |
|---|---|
-s, --source | Ingest only this context source. |
anfra search
Searches the local catalog:
anfra search "monthly revenue"A query can also filter by property and follow lineage, such as type:aml.dataset depends_on:(name:orders). See Search for the syntax.
anfra lineage
Traces each field through the local catalog to what it is built from: the metrics and model fields it uses, the models those fields belong to, and the source tables behind them.
anfra lineage --targets '[{"parent":"ecommerce","child":"revenue"}]'Name each target by what holds it, not as model.field:
- A dataset metric: the dataset name and the metric name, such as
{"parent":"ecommerce","child":"revenue"}. - A model field: the model name and the field name, such as
{"parent":"customers","child":"country"}.
| Flag | Description |
|---|---|
--targets | The fields to trace, as a JSON array e.g. [{"parent": "ecommerce", "child": "revenue"}]. |
--limit | Return at most this many upstream entities per field. If omitted, all of them. |
--offset | Skip this many upstream entities first. Use with --limit to page. |
anfra update
Replaces the binary with the latest release.
| Flag | Description |
|---|---|
--check | Only check for a newer release. Do not install it. |