Skip to content

Add cigen expand: the whole config as one cigen.yml - #17

Merged
ndbroadbent merged 3 commits into
mainfrom
tools/expand
Dec 4, 2026
Merged

ndbroadbent merged 3 commits into
mainfrom
tools/expand

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Item 4 of the agent-tools work. Stacked on #14, which is stacked on #13. The base is tools/explain.

What changed

  • cigen expand [--config <path>] [--format yaml|json] checks the config, then prints the document the loader builds: a .cigen/ directory's files merged into one cigen.yml, in the loader's order (config.yml, then config/*.yml, commands, workflows and jobs). An invalid config prints its errors instead, through the shared printer, and exits 1.
  • config::expand(path) returns that document. load and expand share one read that refuses a project with both layouts.
  • It prints the merged document rather than the lowered CigenConfig, so the output is what the user wrote: no defaults filled in, and provider blocks untouched. That's what's useful for moving between layouts, and it's what the loader sees. Comments are lost; the --format help says so.
  • JSON is the same document. Its keys come out sorted, because serde_json's map is ordered.

The direction doc also mentions cigen expand <job>. The brief asked for the whole config, so I left out a job argument. It would be easy to add if you want it.

Tests

tests/expand.rs, for cigen's own .cigen/ and every fixture:

  • the expanded cigen.yml loads to a CigenConfig equal to the directory's;
  • expanding that file again gives identical output;
  • the JSON output is the same document as the YAML;
  • an invalid config isn't expanded, and its errors go to stderr.

task ci passes with no warnings.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@ndbroadbent
ndbroadbent force-pushed the tools/explain branch 3 times, most recently from e430612 to 348aa75 Compare December 4, 2026 03:20
@ndbroadbent
ndbroadbent force-pushed the tools/expand branch 2 times, most recently from 1194876 to 0bcd6a4 Compare December 4, 2026 03:48
cigen expand [--config <path>] [--format yaml|json] checks the config and
prints the document the loader builds: a .cigen/ directory's files merged
into one cigen.yml. tests/expand.rs expands every config in the repo and
checks the output loads to the same config and expands to itself.
The CLI page documents cigen expand: its options, the output for an example
.cigen/ directory, and what it keeps and doesn't. The overview, roadmap and
homepage list it as built.
@ndbroadbent
ndbroadbent changed the base branch from tools/explain to main December 4, 2026 04:00
@ndbroadbent
ndbroadbent merged commit 295c11e into main Dec 4, 2026
9 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.

1 participant