Skip to content

Importing Templates

llms.txt lists every page for an agent
Optional: hand this page to your coding agentThe steps work by hand too.
Show the whole prompt
Read https://intentius.io/chant/guide/importing-templates/.
Convert the template file I name to chant source with `npx chant import <file> --output src/`, as the lexicon's page describes.
Run `npx chant build` and `npx chant lint`, compare the built output with the original template, and list each difference.
Open a pull request with the generated source. Leave the original template in place.
Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.

Some lexicons provide an import command that converts existing infrastructure templates into chant TypeScript resource definitions. Import your current templates to adopt chant without rewriting them.

Terminal window
chant import <template-file> --output src/
chant build

The import process:

  1. Reads the existing template
  2. Maps resources to lexicon types
  3. Converts property names to TypeScript conventions
  4. Generates TypeScript files organized by resource
  5. Generates import statements for cross-resource references

See your lexicon’s documentation for provider-specific import commands and options.

Lexicons may provide roundtrip tests that verify the full import pipeline:

  1. Parse the original template into an intermediate representation
  2. Generate TypeScript source from the IR
  3. Import the generated code (verifying constructors resolve)
  4. Serialize back to the target format
  5. Compare the output structurally against the original

The Kubernetes lexicon includes a full roundtrip suite and optional k3d cluster validation. See the K8s Testing & Validation docs for details.

The OpenTelemetry Collector lexicon imports collector YAML and checks that every fixture builds back to the same config, with otelcol validate over the result when otelcol-contrib is installed. See Importing a Collector Config.

Prometheus rule files and alertmanager.yml import the same way: every fixture must build back to the same file, and promtool check rules and amtool check-config run over the result when those are installed. Importing Rule Files and alertmanager.yml has the details.

The Grafana lexicon imports dashboard JSON exported from Grafana’s UI and checks that Grafana 12.4 and 13.2 exports and community dashboards from grafana.com build back to the same dashboard, with anything it cannot carry printed as a warning. See Importing Dashboards.

chant