Skip to content

chant init lexicon

Scaffold a new lexicon plugin project with compilable stubs for all required LexiconPlugin lifecycle methods.

chant init lexicon <name> [path] [flags]
ArgumentDescription
<name>Lexicon name (e.g. k8s, gcp). Used to derive package name, variable names, and rule prefix.
[path]Target directory (default: ./lexicons/<name>)
FlagDescription
--forceInitialize even if the target directory is not empty

chant init lexicon creates a complete lexicon plugin project with stubs for every required lifecycle method. The generated code compiles out of the box, imports from @intentius/chant, and mirrors the structure of the AWS lexicon.

From the provided name, the command derives:

Derived valueFormulaExample (k8s)
Plugin variablecamelCase(name) + "Plugin"k8sPlugin
Serializer variablecamelCase(name) + "Serializer"k8sSerializer
Rule prefixname.toUpperCase() (first 3 alphanumeric chars)K8S
Package name@intentius/chant-lexicon-<name>@intentius/chant-lexicon-k8s
FilePurpose
src/plugin.tsLexiconPlugin with all 4 required lifecycle methods
src/index.tsRe-exports plugin and serializer
src/serializer.tsStub Serializer producing minimal JSON
src/codegen/generate.tsCalls core generatePipeline with TODO callbacks
src/codegen/generate-cli.tsBun entry point for just generate
src/codegen/naming.tsNamingStrategy with empty data tables
src/codegen/package.tsCalls core packagePipeline
src/codegen/docs.tsCalls core docsPipeline
src/spec/fetch.tsfetchWithCache stub with TODO URL
src/spec/parse.tsparseSchema stub with ParseResult type
src/lint/rules/sample.tsExample LintRule using derived prefix
src/lint/rules/index.tsRe-export for lint rules
src/lsp/completions.tsStub using core lexiconCompletions
src/lsp/hover.tsStub using core lexiconHover
src/import/parser.tsStub TemplateParser
src/import/generator.tsStub TypeScriptGenerator
src/coverage.tsStub coverage analysis
src/validate.tsStub validation checks
src/validate-cli.tsBun entry point for just validate
package.jsonPackage config with workspace:* dep on @intentius/chant
tsconfig.jsonExtends root TypeScript config
justfilegenerate, validate, docs, package recipes
.gitignoreIgnores snapshots, dist, cache
README.mdGetting started guide
Terminal window
# Scaffold a new lexicon
chant init lexicon k8s
# Scaffold at a custom path
chant init lexicon gcp ./my-gcp-lexicon
# Overwrite an existing directory
chant init lexicon k8s --force

After scaffolding:

  1. cd lexicons/<name>
  2. bun install
  3. Edit src/spec/fetch.ts — point at your upstream schema source
  4. Edit src/spec/parse.ts — parse your schema format
  5. chant dev generate to generate types
  6. chant dev publish to package for distribution
  7. chant dev onboard <name> to wire into CI, Docker, and npm publish

See the full authoring workflow for details on each step.

CodeMeaning
0Lexicon project created successfully
1Error (missing name, target directory not empty without --force)