chant import
Synopsis
Section titled “Synopsis”chant import <template-file> [flags]Description
Section titled “Description”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:
- Reads and parses the template file (JSON)
- Asks each lexicon plugin if it recognizes the template via
detectTemplate() - Uses the matching lexicon’s
templateParser()to extract resources into an intermediate representation - Uses the lexicon’s
templateGenerator()to produce TypeScript files - Organizes generated files by resource category (storage, compute, network, other)
| Flag | Description |
|---|---|
-o, --output <dir> | Output directory (default: ./infra/) |
--force | Overwrite existing files |
# Import a templatechant import template.json
# Import to a specific directorychant import template.json --output src/
# Overwrite existing fileschant import template.json --forceExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Import completed successfully |
| 1 | Error (unrecognized template format, parse error, or write failure) |
See Also
Section titled “See Also”- Importing Templates — user guide
- Lexicon Authoring — implementing
detectTemplate()andtemplateParser()