Skip to content

chant import

chant import <template-file> [flags]

chant import reads an existing infrastructure template (e.g. a CloudFormation JSON template), detects which lexicon handles it, and generates TypeScript resource definitions. This lets you adopt chant incrementally by importing your current infrastructure rather than rewriting it from scratch.

The import process:

  1. Reads and parses the template file (JSON)
  2. Asks each lexicon plugin if it recognizes the template via detectTemplate()
  3. Uses the matching lexicon’s templateParser() to extract resources into an intermediate representation
  4. Uses the lexicon’s templateGenerator() to produce TypeScript files
  5. Organizes generated files by resource category (storage, compute, network, other)
FlagDescription
-o, --output <dir>Output directory (default: ./infra/)
--forceOverwrite existing files
Terminal window
# Import a template
chant import template.json
# Import to a specific directory
chant import template.json --output src/
# Overwrite existing files
chant import template.json --force
CodeMeaning
0Import completed successfully
1Error (unrecognized template format, parse error, or write failure)