Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This file records changes to what chant prints or writes for a plain project, th

## Unreleased

- `@intentius/chant` publishes `dist/` and no longer `src/`, so a plain install of the package is 25 MB where it was 60 MB. Its `default` exports name the compiled `dist/*.js`, as `import` already did. The `development` condition still names `src/*.ts` for this repository's own tools. The JSON schemas and `.astro` components the compiled modules read are copied into `dist/`. The lexicon packages publish `dist/` only as well, and each lexicon's build copies the JSON its compiled modules read, such as the generated lexicon file, next to them. `chant update` reads a package's declaration files from `dist/` when it has no `src/`. `esbuild` and `tsx` are optional peer dependencies of `@intentius/chant` now, where they were dependencies, so installing a lexicon no longer installs them. A command that loads a project's own TypeScript, for example `chant build`, `chant lint` or `chant update`, stops with `chant needs tsx to run TypeScript; install it with: npm i -D tsx` until the project installs `tsx`. `chant build --sandbox` also needs `esbuild`, which `tsx` installs. `chant init` and `chant carve` add `tsx` to the project they write. `chant import` needs neither. A project that read a file under `node_modules/@intentius/chant/src/` or a lexicon's `src/` reads it under `dist/` now. `@intentius/chant/workspace/conformance` no longer has `index.mjs`; its `default` export is the compiled `index.js`. No level-0 golden moves.
- [#5118](https://github.com/INTENTIUS/chant/issues/5118) `chant audit` and `chant lint` take `--preset pull-request` and `--baseline <file>`. The preset reports only its rules, each as merge-blocking or report-only, with `LEX002` and `EVL001` as tool notices, drops findings below `warning`, and fails the run on a merge-blocking finding (`chant audit` unless `--fail-on` is given). With `--baseline`, the JSON or SARIF report of the same command on the base, only findings whose identity is not in it are reported. A preset run's JSON and SARIF findings carry `gate`, and `chant lint`'s carry `identity` (SARIF `partialFingerprints`). Without `--preset` nothing changes, except that `chant lint --format json` gives a post-synth finding its `locator`.
- [#5094](https://github.com/INTENTIUS/chant/issues/5094) `chant workspace graph` stamps an Application an ApplicationSet generates with the `helmReferences` the reader gives one written by hand, so its chart joins the chart node and its values files are read by the Helm rule, under `k8s:K8s::Argo::Application:helmReferences.valuesFiles[]`, in place of the path rule. A values file it names that exists becomes a `Helm::Values` node, with a node for each object under its `extraObjects`, at `<ApplicationSet id>/values/<path>` in the ApplicationSet's member and with `generatedBy` naming the generated Application and `generator: "file"`. A catalog's generate rule takes `files`, and the pass takes a `readFile`.
- [#5094](https://github.com/INTENTIUS/chant/issues/5094) The terraform lexicon's evaluator reads `a == b` and `a != b` over two values the files determine, with Terraform's rule that values of different types are not equal, so `count = var.is_prod_cluster == "true" ? 1 : 0` gets its instance nodes: `chant graph` draws `google_container_cluster.prod_cluster[0]` where it drew the block alone, and the catalog matches the instance. A `count` or `for_each` that comes to zero plans nothing, so its block carries `evaluated: { instances: {} }` and the catalog matches none of its arguments; the test block beside a prod block of the same name is no longer an ambiguous match. A comparison with an unknown side stays unknown and names that side's reference.
Expand Down
2 changes: 2 additions & 0 deletions docs/src/content/docs/cli/build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ chant build [path] --components --generate <lexicon> [--env <name>] [--promote-t

`chant build` loads the project at the given path, parses all TypeScript source files, evaluates resource definitions, and serializes the output.

It loads the project's TypeScript through `tsx`, an optional peer dependency of `@intentius/chant`: install it with `npm i -D tsx`. Without it the command stops with `chant needs tsx to run TypeScript; install it with: npm i -D tsx`. See [Installation](/chant/getting-started/installation/#tsx-and-esbuild). `--sandbox` also needs `esbuild` (`tsx` installs it; `npm i -D esbuild` adds it alone).

### Source directory

With a path, `chant build` builds that directory. With none, run at the root of a project, it builds the config's `sourceDir`, else the project root. Run below the root with no path, it builds the directory it runs in. This is the rule every command that picks a source directory shares ([#4794](https://github.com/INTENTIUS/chant/issues/4794)): `chant lifecycle`'s `--src`, `chant release compile`, `chant graph`, `chant search`, `chant components status` and the lexicon commands all take an explicit directory first, then `sourceDir`, then the project root. There is no `src` fallback; a project whose declarations live in `src/` beside other code sets `sourceDir: "src"`.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/cli/import.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ chant import --index <ref> [selection] [flags]

## Description

`chant import` reads an existing infrastructure template (e.g. a CloudFormation JSON template), detects which lexicon handles it, and generates TypeScript resource definitions. Use it to adopt chant one template at a time.
`chant import` reads an existing infrastructure template (e.g. a CloudFormation JSON template), detects which lexicon handles it, and generates TypeScript resource definitions. Use it to adopt chant one template at a time. It runs without `tsx` or `esbuild`, the optional peers that commands reading a project's TypeScript need (see [Installation](/chant/getting-started/installation/#tsx-and-esbuild)).

With `--from <env>` it reads the **live** cloud/cluster instead of a file: it resolves the environment, calls each project lexicon's `exportResources()` for full-fidelity config, and generates TypeScript from that. Use it to bring an orphaned resource back into source.

Expand Down
2 changes: 2 additions & 0 deletions docs/src/content/docs/cli/lint.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ chant lint [path] [flags]

`chant lint` loads the project at the given path, runs all configured lint rules, and reports diagnostics. Each diagnostic includes a rule ID (e.g. `COR010`, `EVL001`) alongside the file location and message.

It loads the project's TypeScript through `tsx`, an optional peer dependency of `@intentius/chant`: install it with `npm i -D tsx`. Without it the command stops with `chant needs tsx to run TypeScript; install it with: npm i -D tsx`. See [Installation](/chant/getting-started/installation/#tsx-and-esbuild). `--sandbox` also needs `esbuild`.

## Flags

| Flag | Type | Default | Description |
Expand Down
2 changes: 2 additions & 0 deletions docs/src/content/docs/cli/list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ chant list [path] [flags]

`chant list` scans all TypeScript source files in the project and lists every exported declaration with its name and kind.

It loads the project's TypeScript through `tsx`, an optional peer dependency of `@intentius/chant`: install it with `npm i -D tsx`. Without it the command stops with `chant needs tsx to run TypeScript; install it with: npm i -D tsx`. See [Installation](/chant/getting-started/installation/#tsx-and-esbuild).

## Flags

| Flag | Type | Default | Description |
Expand Down
2 changes: 2 additions & 0 deletions docs/src/content/docs/cli/update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ chant sync [path]

`chant update` syncs lexicon type definitions into `.chant/types/` for the project. It also refreshes lexicon skill files in `skills/`. `chant sync` is an alias.

It loads the project's TypeScript through `tsx`, an optional peer dependency of `@intentius/chant`: install it with `npm i -D tsx`. Without it the command stops with `chant needs tsx to run TypeScript; install it with: npm i -D tsx`. See [Installation](/chant/getting-started/installation/#tsx-and-esbuild).

Each lexicon in `chant.config.ts` is read from `node_modules`, and nothing is installed. A configured lexicon that is not installed is skipped with a warning naming the `npm install --save-dev` command to run.

Run it after adding a lexicon, after `npm install` or `npm update` changes a lexicon's version, and in CI before a step that reads `.chant/types/`.
Expand Down
14 changes: 13 additions & 1 deletion docs/src/content/docs/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,23 @@ prompt: setup
A **lexicon** is the plugin that generates output for one platform, such as AWS or Kubernetes. Install the lexicon for your platform, which also installs the chant CLI:

```bash
npm install --save-dev @intentius/chant-lexicon-aws
npm install --save-dev @intentius/chant-lexicon-aws tsx
```

See the [AWS lexicon reference](/chant/lexicons/aws/) for intrinsic functions, composites, and examples.

### tsx and esbuild

`tsx` and `esbuild` are optional peer dependencies of `@intentius/chant`, so installing a lexicon does not install them. chant loads a project's own TypeScript (`chant.config.ts` and the files under `src/`) through `tsx`, so every command that reads a project needs it: `chant build`, `chant lint`, `chant list`, `chant graph`, `chant audit` and `chant update`, among others. `chant build --sandbox` and `chant lint --sandbox` also bundle the project with `esbuild`, which `tsx` installs for itself. Commands that read no project TypeScript, such as `chant --version` and `chant import`, run without either.

When one is missing, the command stops with a single line that names the install, for example:

```text
chant needs tsx to run TypeScript; install it with: npm i -D tsx
```

Install `esbuild` on its own with `npm i -D esbuild` if you use the sandbox and keep `tsx` out of the project.

## Verify the Installation

Check the install:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/getting-started/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ The [getting-started example](https://github.com/INTENTIUS/chant/tree/main/examp

## Step 1: Install chant

Install a lexicon for your target platform (this also installs chant):
Install a lexicon for your target platform (this also installs chant) and `tsx`, which chant uses to load your project's TypeScript:

```bash
npm install --save-dev @intentius/chant-lexicon-aws # or another lexicon
npm install --save-dev @intentius/chant-lexicon-aws tsx # or another lexicon
```

Verify it works:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/lexicon-authoring/package.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ sidebar is grouped from, is in [Docs Site](/chant/lexicon-authoring/docs-site/).
Once the bundle is built:

1. Run `chant dev check-lexicon <dir>` and confirm tier 1 is clean
2. Set `files` to `["src/", "dist/"]`. tsc compiles modules only, so a compiled module reads the generated files beside its source from `src/` (`moduleSourceDir` in `@intentius/chant/module-source`). Fold reads a composite's source there too. Shipping only `dist/` breaks both
2. Set `files` to `["dist/"]`. tsc compiles modules only, so the build also copies the JSON a compiled module reads beside itself (the generated lexicon file, vendored schemas) from `src/` to the same path under `dist/`; `scripts/copy-lexicon-assets.mjs` in this repository does it. A module names such a file from `moduleSourceDir` in `@intentius/chant/module-source`, which finds it under `src/` in a checkout and beside the compiled module in an installed package. A lexicon that still lists `src/` in `files` keeps working, with a larger install
3. Give every module export two conditions: `development` on `./src/*.ts` and `default` on the compiled `./dist/*.js`. The `build` script runs tsc on `tsconfig.build.json` and keeps the `.js` it emits. Both are tier-1 checks, and `scripts/lexicon-exports.test.ts` checks every export of every lexicon in this repository
4. Chain the bundle step and the build into `prepack`, so `dist/` is rebuilt from the pinned spec at publish time rather than from whatever is on disk
5. Publish with `npm pack` (for testing) or `npm publish`
Expand Down
1 change: 1 addition & 0 deletions docs/src/content/docs/reference/level-0-exceptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The `version` field has shipped, and `v0.80.0` is the warning release for the ot
| The otel lexicon's collector pin moves from collector-contrib v0.130.0 to v0.162.0 (`COLLECTOR_PIN`), and its built-in config types are generated from upstream `config.schema.yaml` at that release. `COLLECTOR_IMAGE`, the default image of the k8s, docker and fly collector composites, moves from `otel/opentelemetry-collector-contrib:0.130.0` to `:0.162.0`, so the image those composites write moves with it. Fields the lexicon typed change on the way: the prometheus receiver's `use_start_time_metric` and `start_time_metric_regex` are gone (removed in v0.143.0); the prometheus exporter ignores `add_metric_suffixes` by default (v0.154.0), so `spanMetricsNames()`, `serviceGraphNames()` and PROM301 read `translation_strategy` for it, and `resource_to_telemetry_conversion` is deprecated (v0.160.0) for `resource_constant_labels`; the routing connector's `request` context (v0.156.0), the `k8snode` detector (v0.154.0, alias of `k8s_api`) and the flat confighttp keepalive fields (v0.160.0) are deprecated; tail_sampling's inverted decisions lost their gate (v0.155.0); and `error_mode` defaults to `ignore` for filter, transform and routing (v0.157.0). OTEL126 and OTEL127 check against the v0.162.0 lists, which add `k8s.cronjob.uid`, `container.image.tags` and the detectors added since v0.130.0 | [#3361](https://github.com/INTENTIUS/chant/issues/3361) ([#2525](https://github.com/INTENTIUS/chant/issues/2525#issuecomment-6376504335)) | none: the maintainer accepted it without a warning release on 2026-10-23, as chant has few users. No CLI golden runs a collector composite; the composites' tests read `COLLECTOR_IMAGE` |
| One [exit-code table](/chant/reference/exit-codes/) for every command. A step that refuses a plan that moved since it was approved makes `chant run --components`, `fan-out`, `promote`, `rollback`, `redeploy` and `pr-apply` exit 4 where they exited 3, and `pr-apply` exits 4 for a digest that moved after its approval. `chant lock`, and `pr-apply` under `ci.locks`, exit 5 for a target another pull request holds, where they exited 3. A policy denial exits 7 at `pr-plan` (where it exited 1) and at `pr-apply` (where it exited 3). `chant lifecycle drift` refuses a read with 1 in place of 3. A gate, a decision point and every other wait keep 3, and `--gated-exit` still remaps only 3 | [#4553](https://github.com/INTENTIUS/chant/issues/4553) | none: accepted without a warning release, as chant's breaking changes are, by the 2026-10-27 ruling on #4553. No CLI golden runs a moved plan, a lock, a policy or a refused drift read |
| `chant lint --format json` gives a lexicon post-synth finding its `locator`, the place in the object (a container, for the `WK82*` checks) the check named, so `chant lint --preset` names the finding as `chant audit` does. A finding with no locator is unchanged, and the only golden that moved is `getting-started/lint-format-json.golden`, whose `WK8105` and `WK8203` findings gain it, and also the `entity` that [behold#919](https://github.com/INTENTIUS/behold/issues/919) added and the golden had not caught up with | [#5118](https://github.com/INTENTIUS/chant/issues/5118) | shipped without a warning release: the field is additive |
| The package `@intentius/chant` and the lexicon packages publish `dist/` without `src/`. The packages `esbuild` and `tsx` become optional peer dependencies of `@intentius/chant`. A project that runs `chant build` installs `tsx` itself. Without it the command stops with a one-line error that names `npm i -D tsx`. The commands `chant init` and `chant carve` write `tsx` into the `package.json` they create. A file a project read from `node_modules/@intentius/chant/src/` is under `dist/` now | not filed yet | shipped without a warning release: the install fails with a one-line error that names the fix |

## Landing a listed change

Expand Down
3 changes: 1 addition & 2 deletions lexicons/aws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
],
"type": "module",
"files": [
"src/",
"dist/",
"schemas/",
"workspace-kinds.json"
Expand Down Expand Up @@ -72,7 +71,7 @@
"validate": "tsx src/validate-cli.ts",
"docs": "tsx src/codegen/docs-cli.ts",
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json"
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node ../../scripts/copy-lexicon-assets.mjs"
},
"dependencies": {
"fflate": "^0.8.2",
Expand Down
2 changes: 1 addition & 1 deletion lexicons/aws/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"noEmit": false,
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"outDir": "dist",
"rootDir": "src",
"paths": {},
Expand Down
3 changes: 1 addition & 2 deletions lexicons/azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
],
"type": "module",
"files": [
"src/",
"dist/"
],
"publishConfig": {
Expand Down Expand Up @@ -69,7 +68,7 @@
"validate": "tsx src/validate-cli.ts",
"docs": "tsx src/codegen/docs-cli.ts",
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json"
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node ../../scripts/copy-lexicon-assets.mjs"
},
"dependencies": {
"fflate": "^0.8.2"
Expand Down
2 changes: 1 addition & 1 deletion lexicons/azure/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"noEmit": false,
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"outDir": "dist",
"rootDir": "src",
"paths": {},
Expand Down
3 changes: 1 addition & 2 deletions lexicons/cedar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
],
"type": "module",
"files": [
"src/",
"dist/"
],
"publishConfig": {
Expand Down Expand Up @@ -62,7 +61,7 @@
"docs:dev": "cd docs && npm run dev",
"docs:build": "cd docs && npm install && npm run build",
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json"
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node ../../scripts/copy-lexicon-assets.mjs"
},
"dependencies": {
"@cedar-policy/cedar-wasm": "4.12.0"
Expand Down
2 changes: 1 addition & 1 deletion lexicons/cedar/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"noEmit": false,
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"outDir": "dist",
"rootDir": "src",
"paths": {},
Expand Down
3 changes: 1 addition & 2 deletions lexicons/cpln/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.124.34",
"type": "module",
"files": [
"src/",
"dist/"
],
"publishConfig": {
Expand Down Expand Up @@ -41,7 +40,7 @@
"docs": "tsx src/codegen/docs-cli.ts",
"snapshot": "tsx src/spec/snapshot-cli.ts",
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json"
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node ../../scripts/copy-lexicon-assets.mjs"
},
"devDependencies": {
"@intentius/chant": "*",
Expand Down
2 changes: 1 addition & 1 deletion lexicons/cpln/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"noEmit": false,
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"outDir": "dist",
"rootDir": "src",
"paths": {},
Expand Down
3 changes: 1 addition & 2 deletions lexicons/docker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
],
"type": "module",
"files": [
"src/",
"dist/"
],
"publishConfig": {
Expand Down Expand Up @@ -60,7 +59,7 @@
"validate": "tsx src/validate-cli.ts",
"docs": "tsx src/codegen/docs-cli.ts",
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json"
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node ../../scripts/copy-lexicon-assets.mjs"
},
"dependencies": {
"@intentius/chant-lexicon-otel": "^0.124.34"
Expand Down
2 changes: 1 addition & 1 deletion lexicons/docker/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"noEmit": false,
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"outDir": "dist",
"rootDir": "src",
"paths": {},
Expand Down
Loading
Loading