Package & Publish
The package lifecycle method bundles your lexicon’s generated artifacts into a distributable format. Core provides packagePipeline to orchestrate this.
Packaging Pipeline
Section titled “Packaging Pipeline”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.tsfor the AWS packaging pipeline.
Bundle Layout
Section titled “Bundle Layout”The pipeline produces a dist/ directory:
| Artifact | Description |
|---|---|
manifest.json | Lexicon metadata (name, version, intrinsics, pseudo-parameters) |
meta.json | Record<shortName, LexiconEntry> resource registry |
integrity.json | xxhash64 per-artifact hashes + composite hash |
types/index.d.ts | TypeScript declarations for all resource and property types |
rules/*.ts | Lint rule implementations |
skills/*.md | AI assistant skill definitions |
LexiconManifest Fields
Section titled “LexiconManifest Fields”The buildManifest callback must return a LexiconManifest:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Lexicon identifier (e.g. "aws", "k8s") |
version | string | Yes | Lexicon version (e.g. "1.0.0") |
chantVersion | string | No | Minimum chant version required |
namespace | string | No | Type namespace prefix (e.g. "AWS") |
intrinsics | IntrinsicDef[] | No | Intrinsic function definitions |
pseudoParameters | Record<string, string> | No | Pseudo-parameter names and descriptions |
Documentation Pipeline
Section titled “Documentation Pipeline”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.
Publishing to npm
Section titled “Publishing to npm”Once the bundle is built:
- Verify the
dist/directory contains all expected artifacts - Ensure
package.jsonhas the correctfilesfield pointing todist/ - Publish with
bun pm pack(for testing) ornpm publish
Users install your lexicon with:
npm install --save-dev @intentius/chant-lexicon-<name>Next step
Section titled “Next step”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.
CLI Commands
Section titled “CLI Commands”chant dev generate— run the generation pipelinechant dev publish— build the distributable bundlechant dev onboard— wire CI, Docker, and publish workflow