Skip to content

Package & Publish

The package lifecycle method bundles your lexicon’s generated artifacts into a distributable format. Core provides packagePipeline to orchestrate this.

import { packagePipeline, collectSkills } from "@intentius/chant/codegen/package";
const result = await packagePipeline({
generate: (opts) => myGenerate(opts),
buildManifest: (genResult) => ({ name: "my-lexicon", version: "1.0.0" }),
srcDir: __dirname,
collectSkills: () => collectSkills(myPlugin.skills()),
});

See lexicons/aws/src/codegen/package.ts for the AWS packaging pipeline.

The pipeline produces a dist/ directory:

ArtifactDescription
manifest.jsonLexicon metadata (name, version, intrinsics, pseudo-parameters)
meta.jsonRecord<shortName, LexiconEntry> resource registry
integrity.jsonxxhash64 per-artifact hashes + composite hash
types/index.d.tsTypeScript declarations for all resource and property types
rules/*.tsLint rule implementations
skills/*.mdAI assistant skill definitions

The buildManifest callback must return a LexiconManifest:

FieldTypeRequiredDescription
namestringYesLexicon identifier (e.g. "aws", "k8s")
versionstringYesLexicon version (e.g. "1.0.0")
chantVersionstringNoMinimum chant version required
namespacestringNoType namespace prefix (e.g. "AWS")
intrinsicsIntrinsicDef[]NoIntrinsic function definitions
pseudoParametersRecord<string, string>NoPseudo-parameter names and descriptions

Core provides docsPipeline and writeDocsSite for generating a standalone Starlight docs site from your lexicon’s dist/ artifacts:

import { docsPipeline, writeDocsSite } from "@intentius/chant/codegen/docs";
const config = {
name: "my-lexicon",
displayName: "My Lexicon",
description: "Description for page metadata",
distDir: "./dist",
outDir: "./docs",
serviceFromType: (type) => type.split("::")[1],
resourceTypeUrl: (type) => `https://docs.example.com/${type}`,
};
const result = docsPipeline(config);
writeDocsSite(config, result);

This creates a self-contained Starlight site with pages for resources, intrinsics, pseudo-parameters, rules, and serialization. Build it with cd docs && bun install && bun run build.

Add a docs() method to your plugin and a "docs" script to your package.json so documentation stays in sync with each generation cycle.

Once the bundle is built:

  1. Verify the dist/ directory contains all expected artifacts
  2. Ensure package.json has the correct files field pointing to dist/
  3. Publish with bun pm pack (for testing) or npm publish

Users install your lexicon with:

Terminal window
npm install --save-dev @intentius/chant-lexicon-<name>

Once the bundle is ready, run chant dev onboard to wire the lexicon into CI, Docker smoke tests, and the npm publish workflow. See CI & Distribution for the full checklist.