Repository navigation
CLI
github-actions[bot] edited this page Nov 25, 2026
·
4 revisions
The
factlangcommand lints, formats, explains and checks claim files from a terminal or CI job. It uses only the standard library'sargparse, and its exit codes say what happened: 0 fine, 1 a claim failed, 2 invalid input, 3 errors or undecidable. Output is text by default;--format jsonor--format markdownis available before or after the subcommand.
| Command | What it does |
|---|---|
factlang lint FILE... |
reports diagnostics; never executes anything |
factlang fmt [--check] FILE... |
rewrites files in canonical form; with --check only reports and exits 1 if any would change |
factlang explain FILE --dialect D |
prints each claim's SQL for dialect D (no warehouse needed) |
factlang check FILE --dsn URL |
checks claims on a warehouse through SQLAlchemy |
factlang check FILE --connector module:attr [--dialect D] |
uses a connector (or a factory, or a DB-API connection with --dialect) from your code |
factlang check FILE (no --dsn) |
reads the URL from the FACTLANG_DSN environment variable |
factlang verbs [--json] |
lists the standard verbs |
factlang mcp [--dsn URL | --dialect D] [--timeout S] [--max-bytes N] [--max-claims N] [--name N] |
serves the FactLang tools over MCP on stdio (needs factlang[mcp]); without --dsn or --dialect it reads FACTLANG_DSN, and exits 2 if that is unset too; --max-claims (default 200) refuses factlang_check / factlang_explain calls with more claims, error code too_many_claims
|
factlang --version |
prints the version |
- A
FILEof-means standard input (factlang lint -,factlang explain - --dialect duckdb); withfmtit prints the canonical form. -
checkusesFACTLANG_DSNwhen neither--dsnnor--connectoris given;mcpuses it when neither--dsnnor--dialectis given. Prefer it:--dsnputs the password in the process list, the environment variable does not.
factlang lint facts.fl
factlang fmt --check facts.fl
factlang explain facts.fl --dialect bigquery
echo "UNIQUE orders.id" | factlang lint -
FACTLANG_DSN=postgresql://reader@db/shop factlang check facts.fl --format markdown
| Code | Meaning |
|---|---|
| 0 | everything fine |
| 1 | a claim FAILED (or fmt --check found a file that would change) |
| 2 | invalid input: bad usage, unreadable file, front-end errors in a claim, unloadable connector |
| 3 | an error or no_data outcome, or a claim that cannot be rendered |
When several apply the order is 2, then 1, then 3. That makes the CLI usable as a CI gate: a non-zero code fails the job, and the code says why.
- run: factlang lint facts.fl && factlang fmt --check facts.fl
- run: factlang check facts.fl
env:
FACTLANG_DSN: ${{ secrets.WAREHOUSE_URL }}FactLang
Using it
Components
Extending
Help