CLI · Contracts and schema
Data contracts (ODCS v3 with kiri.* extensions) are the project’s source of truth. These verbs create, validate, lint, diff, promote, and export them.
kiri contract
Authoring
kiri contract new— scaffold a new contract in MVP form with AI-assisted descriptions. Prompts for anything omitted:--source,--table,--name(snake_case),--description,--owner,--classification public|internal|confidential|restricted,--domain(defaults to the source’s domain).--yesskips the save confirmation for CI;--legacy-contractsis the escape hatch for writing undercontracts/when the project uses the layer-contract layout.kiri contract scaffold— rendercontracts/<name>.ymlnon-interactively from a source table. Identify the table with--source-urn urn:kirimana:source:crm:customersor--source+--table;--semantic-entitysetskiri.semantic.entity(defaults to the source entity).
Validation and inspection
kiri contract validate PATH [--strict]— structural + semantic validation of one contract.--strictexits non-zero on semantic warnings (errors always fail).kiri contract show PATH— print a canonical-model view of the contract.kiri diff A B— semantic-aware diff of two ODCS contracts (top-level verb).kiri contract schema-export [-o contracts.schema.json]— emit a JSON Schema document for the contract surface.--standard odcsstripskiri.*extensions,kiri-onlyemits only the extensions,odcs+kiri(default) is the full surface.--draft 2020-12|07.
Governance lint
Usage: kiri contract lint [OPTIONS]
| Flag | Description | Default |
|---|---|---|
--project, -p | Project directory | |
--format | text | pr | json | text |
--domain | Restrict findings to one information domain. Cross-contract rules still run project-wide so cross-domain-consumption findings still fire; results are filtered to the scoped domain’s files. | |
--suggest-zones | Data Vault helper: walk silver-state DV contracts and suggest a kiri.medallion.silver_zone for each, inferred from its parent’s zone (satellites) or connected hubs (links). Emits a YAML-patch guide instead of regular lint findings. | off |
kiri lint [PROJECT] (top-level) is a narrower check: it reports the override count and per-override drift for generator-owned files.
Live-schema reconciliation
kiri contract verify-live --contract <yml> --catalog <c> --schema <s>— diff the live table’s schema (Unity Catalog) against the contract.--fail-on add|drop|type-mismatch|meta-mismatch|all(defaulttype-mismatch) controls the exit code; the JSON report goes to--output(defaultverify-live.json).kiri contract sync-from-live --contract <yml> --catalog <c> --schema <s>— propose contract patches that would bring the contract in line with the live table.--proposeemits a YAML proposal for review (default./sync-proposal.yml);--applywrites the patched contract back (refused when the project’s policy is fail-closed).
Lifecycle
Usage: kiri contract promote [OPTIONS] NAME
Promote a contract along the medallion states: --to draft|bronze|silver|gold|deprecated. --active / --inactive also flips kiri.medallion.active — --inactive pauses runtime execution without demoting the state.
Export and emission
kiri contract emit CONTRACT_PATH --dbt-project <dir>— emit framework artefacts from a contract into the target dbt project’smodels/_kiri_generated/. Semantic validation runs first by default (--no-validateto skip).kiri contract export semantic-layer— export gold contracts as semantic-layer artefacts.--target metricflow | dbt-semantic | cube | databricks-metric-viewsoverridessemantic_layer.targetinkiri.yml;--outputoverridessemantic_layer.output_path;--contract <name>exports one contract.
kiri contract export semantic-layer
kiri contract export semantic-layer --contract orders
kiri contract export semantic-layer --target metricflow --output models/semantic/
CI helpers
kiri contract approval-count --changed-files-from <file>— print the required approver count for a change set (the workflow computes the file viagit diff --name-only).--restricted-raises-fromand--cross-domain-fromlist changed paths that introducedvalue: restrictedor a new cross-domain consumer, both of which raise the bar.kiri contract codeowners [-o .github/CODEOWNERS] [--check]— emit a CODEOWNERS file derived from contract ownership;--checkexits 1 in CI when the on-disk file diverges from the synthesised body.kiri contract merge-classification --contracts <dir> --proposals <dir>— stampkiri.classificationonto contracts fromkiri inventory pre-classifyproposals.--ai-resultsmerges an AI-batch results JSONL on top;--operator-overrideswin every precedence contest;--precedencecaps the highest source allowed through (operator | ai_gateway | heuristic_high | heuristic_default);--dry-runreports without writing.
kiri layer
Per-(domain, layer) manifests under 01-config/<domain>/<layer>.yml — the consolidated alternative to per-table contract files.
kiri layer list— list every discovered (domain, layer) manifest.kiri layer show DOMAIN LAYER [--target <t>] [--format text|json]— render the resolved view of one manifest (LAYERisbronze|silver|gold|pit).kiri layer validate [--strict]— run the per-(domain, layer) project validation.kiri layer diff --target <a> --vs <b>— per-(domain, layer) deltas between two targets.kiri layer migrate-from-contracts --contracts <dir> [--out <dir>] [--dry-run] [--keep-archive]— atomically collapse per-table contracts into layer manifests under<out>/<domain>/<layer>.yml.--keep-archivearchives the source directory instead of deleting it.
kiri intent
Propose-only Semantic Intent designer.
Usage: kiri intent propose [OPTIONS]
Proposes a technique-neutral Semantic Intent Model for the project. --source-shape flat|kimball|data_vault|mixed|unknown|greenfield tells Kiri what already exists so it calibrates confidence honestly; output goes to --output (default <project>/.kirimana/proposed-intent.json).
kiri schema
Schema-registry push.
Usage: kiri schema push [OPTIONS]
Push Avro-rendered contract schemas to an external schema registry. --backend confluent|glue selects the registry kind (--url for a Confluent-compatible registry; --registry-name and optional --region for AWS Glue). --contract <name> limits the push to one contract; --dry-run prints the Avro JSON that would be pushed without contacting the registry — safe for CI previews.