Skip to content

fix(core): chant build --components --generate --format json forwards env (#2060) - #2201

Merged
lex00 merged 1 commit into
mainfrom
fix/2060-components-json-env
Sep 7, 2026
Merged

fix(core): chant build --components --generate --format json forwards env (#2060)#2201
lex00 merged 1 commit into
mainfrom
fix/2060-components-json-env

Conversation

@lex00

@lex00 lex00 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Closes #2060.

#2046 put env on the components generator result so a structured consumer can tell which environment a generated pipeline deploys. The JSON printer in the build handler never forwarded it: chant build --components --generate --format json emitted only stages, jobs and yaml, so the consumer had to re-parse the YAML to recover the environment. The graph --components --format ir projection path already forwarded env; this makes the build handler match it.

env is spread into the JSON result when the generator returns one and omitted otherwise, so existing consumers of the three-key shape see nothing new unless the generator has an environment to report. Text output is unchanged.

Tests in build.test.ts: env present in JSON output, env omitted when the generator returns none, text format prints only the raw YAML. The build reference page's description of the JSON shape now lists env.

Gates

Run by the orchestrator in the worktree after the agent's own run.

npx vitest run packages/core           385 files, 6160 passed
npx tsc --noEmit                       clean
npx tsx scripts/typecheck.ts           37 known failure(s), no regressions (37 baselined)
node scripts/lint-docs-sentences.mjs   4111 gated finding(s), no regressions (4111 baselined)
node scripts/check-docs-diataxis.mjs   clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01FoXyD9UvKQ5ZdhiR9JT1yB

… env

The JSON printer at build.ts:66 only emitted stages, jobs and yaml,
dropping the environment the generator resolved and returned on
GenerateComponentsResult.env (#2046, PR #2050). A consumer reading the
structured output, like behold, had no environment identity except by
parsing the YAML back, which #2046 was meant to retire.

Forward result.env into the JSON payload the same way handlers/graph.ts
already does for the IR pipeline projection: {stages, jobs, yaml,
...(result.env ? { env: result.env } : {})}. The text/yaml output path
is unchanged.

Closes #2060

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FoXyD9UvKQ5ZdhiR9JT1yB
@lex00
lex00 merged commit 942bb07 into main Sep 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chant build --components --generate --format json drops the generator's env (#2046) — only stages/jobs/yaml reach stdout

1 participant