Skip to content

CLI Overview

chant provides a CLI for building, linting, and managing infrastructure definitions.

The CLI is included in @intentius/chant. Install a lexicon package to get everything:

Terminal window
npm install --save-dev @intentius/chant-lexicon-aws
chant <command> [options] [path]
CommandDescription
initScaffold a new chant project
init lexiconScaffold a new lexicon plugin project
buildSynthesize and write infrastructure output
lintLint intent definitions with semantic rules
listList exported declarations in a project
importImport infrastructure templates and generate TypeScript
updateSync lexicon type definitions
doctorCheck project health and configuration

These commands are for lexicon authors — project users don’t typically need them.

CommandDescription
dev generateGenerate lexicon artifacts (+ validate + coverage)
dev publishPackage lexicon for distribution
dev onboardOnboard a new lexicon plugin
dev check-lexiconValidate a lexicon bundle
CommandDescription
serve lspStart the LSP server for editor integration
serve mcpStart MCP server for AI agent integration
Terminal window
# Initialize and build a project
chant init my-infra --lexicon aws
cd my-infra
chant build
# Lint definitions
chant lint
# Import existing templates
chant import template.json
# Check project health
chant doctor

The CLI automatically discovers infrastructure files based on these rules:

Included:

  • All .ts files in the specified directory and subdirectories

Excluded:

  • Files in node_modules/ directories
  • Test files: *.test.ts, *.spec.ts
  • TypeScript declaration files: *.d.ts

The CLI provides structured error output for different types of errors:

Reported when files can’t be loaded or imported. Common causes: missing dependencies, syntax errors, invalid import paths, circular dependencies.

Reported during serialization. Common causes: circular dependencies between resources, invalid attribute references, missing required properties.

Show stack traces on errors.

Display help information for the CLI.

Terminal window
chant --help