From 8baf98a43822ccb949a901d7b0bd57b8b4735e4a Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 13:44:37 +1300 Subject: [PATCH 1/5] Make the trycmd snapshot tests real The .trycmd files had no fenced code blocks, so trycmd ignored every case, and their expected output was years stale. They now cover every command's help, validate on a broken config (text, JSON, and generate printing the same errors), and validate, explain, hash --job and expand on a small project. The project case runs in a sandbox (project.out/), and GIT_DIR points nowhere, so neither the cigen repo nor a git hook's environment changes what the patterns match. cigen's version and the hash it feeds are elided, so a release doesn't break them. Refresh with TRYCMD=overwrite cargo test --test cli -- cli_coverage. --- .cigen/config.yml | 1 + internal_docs/STATUS.md | 3 + tests/cli.rs | 15 +- tests/cmd/generate_inline.trycmd | 7 - tests/cmd/help.trycmd | 100 +++++++++- tests/cmd/invalid_config.trycmd | 4 - .../cmd/project.in/.cigen/commands/setup.yml | 2 + tests/cmd/project.in/.cigen/config.yml | 3 + tests/cmd/project.in/.cigen/workflows/ci.yml | 4 + .../.cigen/workflows/ci/jobs/test.yml | 5 + tests/cmd/project.in/Cargo.lock | 1 + tests/cmd/project.in/Cargo.toml | 2 + tests/cmd/project.in/scripts/check.sh | 1 + tests/cmd/project.in/src/lib.rs | 1 + tests/cmd/project.out/Cargo.toml | 2 + tests/cmd/project.trycmd | 178 ++++++++++++++++++ tests/cmd/validate.in/.cigen/config.yml | 3 + .../.cigen/workflows/ci/jobs/build.yml | 2 + .../.cigen/workflows/ci/jobs/lint.yml | 2 + .../.cigen/workflows/ci/jobs/test.yml | 4 + tests/cmd/validate.trycmd | 94 +++++++++ 21 files changed, 418 insertions(+), 16 deletions(-) delete mode 100644 tests/cmd/generate_inline.trycmd delete mode 100644 tests/cmd/invalid_config.trycmd create mode 100644 tests/cmd/project.in/.cigen/commands/setup.yml create mode 100644 tests/cmd/project.in/.cigen/config.yml create mode 100644 tests/cmd/project.in/.cigen/workflows/ci.yml create mode 100644 tests/cmd/project.in/.cigen/workflows/ci/jobs/test.yml create mode 100644 tests/cmd/project.in/Cargo.lock create mode 100644 tests/cmd/project.in/Cargo.toml create mode 100644 tests/cmd/project.in/scripts/check.sh create mode 100644 tests/cmd/project.in/src/lib.rs create mode 100644 tests/cmd/project.out/Cargo.toml create mode 100644 tests/cmd/project.trycmd create mode 100644 tests/cmd/validate.in/.cigen/config.yml create mode 100644 tests/cmd/validate.in/.cigen/workflows/ci/jobs/build.yml create mode 100644 tests/cmd/validate.in/.cigen/workflows/ci/jobs/lint.yml create mode 100644 tests/cmd/validate.in/.cigen/workflows/ci/jobs/test.yml create mode 100644 tests/cmd/validate.trycmd diff --git a/.cigen/config.yml b/.cigen/config.yml index 247252c..0e77d29 100644 --- a/.cigen/config.yml +++ b/.cigen/config.yml @@ -18,6 +18,7 @@ input_groups: - "tests/**/*.rs" - "tests/**/*.yml" - "tests/**/*.trycmd" + - "tests/cmd/**" - "integration_tests/**/*" # tests/json_schema.rs reads the committed schemas and checks every config against them - "schemas/v1/**" diff --git a/internal_docs/STATUS.md b/internal_docs/STATUS.md index bee69dc..98fd6b6 100644 --- a/internal_docs/STATUS.md +++ b/internal_docs/STATUS.md @@ -150,6 +150,9 @@ What the code does today, checked against the code in December 2026. Where cigen input or a needed job changes, and for a matrix entry. - `tests/expand.rs`: expanding every config in the repository gives a `cigen.yml` that loads to the same config and expands to itself; the JSON form is the same document; an invalid config isn't expanded. +- `tests/cli.rs` runs the trycmd snapshots in `tests/cmd/*.trycmd`: every command's help, `validate` on a broken + config (text, JSON and `generate`'s matching errors), and `validate`, `explain`, `hash --job` and `expand` on a + small project. Refresh them with `TRYCMD=overwrite cargo test --test cli -- cli_coverage` and review the diff. - `tests/derived_inputs.rs`: changing a script a step runs, a command the job uses, a toolchain pin or the `package.json` script that `npm run test` runs (the root's or a sub-package's) makes the job run in mockci, and changing a used command, a named service, a top-level provider block, a local action, a lockfile or the `packageManager` pin changes the job's hash; an unused command or service doesn't. diff --git a/tests/cli.rs b/tests/cli.rs index 3dd9bf3..f0e110f 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -15,9 +15,18 @@ fn cli_coverage() { // Stable env cases.env("CIGEN_SKIP_CIRCLECI_CLI", "1"); - // Note: paths in outputs will be absolute to the CI runner; acceptable for snapshots. - - cases.case("tests/cmd/**/*.trycmd"); + cases.env( + "CIGEN_PLUGIN_DIR", + support::plugin_dir().display().to_string(), + ); + // Inside a git hook, an inherited GIT_DIR would point `cigen hash` at this repository. + // trycmd can't unset a variable, so point it nowhere: git fails and patterns are matched + // on the filesystem, as they are in the sandboxes, which aren't repositories. + let no_git = support::repo_root().join("target/no-git-here"); + cases.env("GIT_DIR", no_git.display().to_string()); + // Refresh the snapshots after an intended change with + // `TRYCMD=overwrite cargo test --test cli -- cli_coverage`, and review the diff. + cases.case("tests/cmd/*.trycmd"); } #[test] diff --git a/tests/cmd/generate_inline.trycmd b/tests/cmd/generate_inline.trycmd deleted file mode 100644 index 46bb451..0000000 --- a/tests/cmd/generate_inline.trycmd +++ /dev/null @@ -1,7 +0,0 @@ -$ cd integration_tests/circleci_node_simple_inline -$ cigen generate -? status = 0 -Generating CI configuration from: -Generating all workflows -Skipping CircleCI CLI validation due to CIGEN_SKIP_CIRCLECI_CLI environment variable -✅ Generated circleci configuration for all workflows to diff --git a/tests/cmd/help.trycmd b/tests/cmd/help.trycmd index a570438..621c339 100644 --- a/tests/cmd/help.trycmd +++ b/tests/cmd/help.trycmd @@ -1,4 +1,100 @@ +The commands and their options. + +```console $ cigen --help -? status = 0 -A CLI tool that generates CI pipeline configurations from templates +A CLI tool that generates CI pipeline configurations + Usage: cigen [OPTIONS] [COMMAND] + +Commands: + generate Generate CI configuration (default command) + hash Compute hashes for file patterns or jobs + explain Show what a job's hash covers: its inputs, the files they match, and the hash + expand Print the whole config as one cigen.yml document, the way the loader sees it + validate Check the config and list every problem in it + help Print this message or the help of the given subcommand(s) + +Options: + -v, --verbose... Enable verbose output (use -vv for debug output) + -h, --help Print help + -V, --version Print version + +``` + +```console +$ cigen validate --help +Check the config and list every problem in it + +Usage: cigen validate [OPTIONS] + +Options: + -c, --config The config: a cigen.yml file or a .cigen/ directory (found in the current directory by default) + --format Output format [default: text] [possible values: text, json] + -v, --verbose... Enable verbose output (use -vv for debug output) + -h, --help Print help + +``` + +```console +$ cigen explain --help +Show what a job's hash covers: its inputs, the files they match, and the hash + +Usage: cigen explain [OPTIONS] + +Arguments: + The job's id + +Options: + -c, --config The config: a cigen.yml file or a .cigen/ directory (found in --base-dir by default) + --base-dir The project root, where input patterns and step paths are looked up [default: .] + --format Output format [default: text] [possible values: text, json] + -v, --verbose... Enable verbose output (use -vv for debug output) + -h, --help Print help + +``` + +```console +$ cigen expand --help +Print the whole config as one cigen.yml document, the way the loader sees it + +Usage: cigen expand [OPTIONS] + +Options: + -c, --config The config: a cigen.yml file or a .cigen/ directory (found in the current directory by default) + --format Output format. YAML output is a cigen.yml that loads to the same config (comments aren't kept) [default: yaml] [possible values: yaml, json] + -v, --verbose... Enable verbose output (use -vv for debug output) + -h, --help Print help + +``` + +```console +$ cigen hash --help +Compute hashes for file patterns or jobs + +Usage: cigen hash [OPTIONS] + +Options: + -p, --pattern Glob patterns to include when computing the hash (relative to --base-dir) + --job Optional job identifier to hash using the loaded cigen config + --config The config: a cigen.yml file or a .cigen/ directory (found in --base-dir by default) + --output Optional name for the output value (written to $GITHUB_OUTPUT when set) + --base-dir Base directory the patterns are evaluated relative to (defaults to current dir) [default: .] + --cache Optional cache file path to persist per-file hashes + -v, --verbose... Enable verbose output (use -vv for debug output) + -h, --help Print help + +``` + +```console +$ cigen generate --help +Generate CI configuration (default command) + +Usage: cigen generate [OPTIONS] + +Options: + -c, --config Path to .cigen directory or cigen.yml file + -o, --output Output directory for generated files (default: .) + -v, --verbose... Enable verbose output (use -vv for debug output) + -h, --help Print help + +``` diff --git a/tests/cmd/invalid_config.trycmd b/tests/cmd/invalid_config.trycmd deleted file mode 100644 index ca36f4e..0000000 --- a/tests/cmd/invalid_config.trycmd +++ /dev/null @@ -1,4 +0,0 @@ -$ cigen generate --config does-not-exist -? status = 1 -Generating CI configuration from: -Error: Failed to load configuration diff --git a/tests/cmd/project.in/.cigen/commands/setup.yml b/tests/cmd/project.in/.cigen/commands/setup.yml new file mode 100644 index 0000000..24829b2 --- /dev/null +++ b/tests/cmd/project.in/.cigen/commands/setup.yml @@ -0,0 +1,2 @@ +steps: + - run: echo setting up diff --git a/tests/cmd/project.in/.cigen/config.yml b/tests/cmd/project.in/.cigen/config.yml new file mode 100644 index 0000000..e94bbb8 --- /dev/null +++ b/tests/cmd/project.in/.cigen/config.yml @@ -0,0 +1,3 @@ +provider: github +input_groups: + rust: ["src/**/*.rs", "Cargo.toml"] diff --git a/tests/cmd/project.in/.cigen/workflows/ci.yml b/tests/cmd/project.in/.cigen/workflows/ci.yml new file mode 100644 index 0000000..53e897f --- /dev/null +++ b/tests/cmd/project.in/.cigen/workflows/ci.yml @@ -0,0 +1,4 @@ +github: + on: + push: + branches: [main] diff --git a/tests/cmd/project.in/.cigen/workflows/ci/jobs/test.yml b/tests/cmd/project.in/.cigen/workflows/ci/jobs/test.yml new file mode 100644 index 0000000..a695c77 --- /dev/null +++ b/tests/cmd/project.in/.cigen/workflows/ci/jobs/test.yml @@ -0,0 +1,5 @@ +image: rust:latest +inputs: ["@rust"] +steps: + - setup + - run: sh scripts/check.sh diff --git a/tests/cmd/project.in/Cargo.lock b/tests/cmd/project.in/Cargo.lock new file mode 100644 index 0000000..17c6700 --- /dev/null +++ b/tests/cmd/project.in/Cargo.lock @@ -0,0 +1 @@ +# lock diff --git a/tests/cmd/project.in/Cargo.toml b/tests/cmd/project.in/Cargo.toml new file mode 100644 index 0000000..f76ed9f --- /dev/null +++ b/tests/cmd/project.in/Cargo.toml @@ -0,0 +1,2 @@ +[package] +name = "demo" diff --git a/tests/cmd/project.in/scripts/check.sh b/tests/cmd/project.in/scripts/check.sh new file mode 100644 index 0000000..e8117c6 --- /dev/null +++ b/tests/cmd/project.in/scripts/check.sh @@ -0,0 +1 @@ +echo ok diff --git a/tests/cmd/project.in/src/lib.rs b/tests/cmd/project.in/src/lib.rs new file mode 100644 index 0000000..8655f8e --- /dev/null +++ b/tests/cmd/project.in/src/lib.rs @@ -0,0 +1 @@ +pub fn one() {} diff --git a/tests/cmd/project.out/Cargo.toml b/tests/cmd/project.out/Cargo.toml new file mode 100644 index 0000000..f76ed9f --- /dev/null +++ b/tests/cmd/project.out/Cargo.toml @@ -0,0 +1,2 @@ +[package] +name = "demo" diff --git a/tests/cmd/project.trycmd b/tests/cmd/project.trycmd new file mode 100644 index 0000000..96d302b --- /dev/null +++ b/tests/cmd/project.trycmd @@ -0,0 +1,178 @@ +A small project (`project.in/`): one job with an input group, a command and a script. + +```console +$ cigen validate +.cigen is valid: 1 job(s) in 1 workflow(s). + +``` + +What the job's hash covers. The hash is the one `cigen hash --job test` prints. + +```console +$ cigen explain test +Job `test` in workflow `ci` + +Declared inputs: + @rust + Cargo.toml (1 file) + Cargo.toml + src/**/*.rs (1 file) + src/lib.rs + +Derived inputs: + command:setup + Cargo.lock (lockfile) + scripts/check.sh (named in a step) + +Also hashed: + cigen [..] + the job's definition (workflows.ci.jobs.test) + the settings of workflow `ci` + +Hash: [..] + +``` + +```console +$ cigen hash --job test +[..] + +``` + +```console +$ cigen explain test --format json +{ + "job": "test", + "workflow": "ci", + "inputs": [ + { + "entry": "@rust", + "patterns": [ + { + "pattern": "Cargo.toml", + "files": [ + "Cargo.toml" + ] + }, + { + "pattern": "src/**/*.rs", + "files": [ + "src/lib.rs" + ] + } + ] + } + ], + "derived": { + "config": [ + "command:setup" + ], + "files": [ + { + "path": "Cargo.lock", + "reason": "lockfile" + }, + { + "path": "scripts/check.sh", + "reason": "named in a step" + } + ] + }, + "also_hashed": [ + "cigen [..]", + "the job's definition (workflows.ci.jobs.test)", + "the settings of workflow `ci`" + ], + "hash": "[..]" +} + +``` + +```console +$ cigen explain tset +? failed +error: there's no job named `tset` + help: did you mean `test`? + +``` + +The `.cigen/` directory as one `cigen.yml`: + +```console +$ cigen expand +provider: github +input_groups: + rust: + - src/**/*.rs + - Cargo.toml +commands: + setup: + steps: + - run: echo setting up +workflows: + ci: + jobs: + test: + image: rust:latest + inputs: + - '@rust' + steps: + - setup + - run: sh scripts/check.sh + github: + on: + push: + branches: + - main + +``` + +```console +$ cigen expand --format json +{ + "commands": { + "setup": { + "steps": [ + { + "run": "echo setting up" + } + ] + } + }, + "input_groups": { + "rust": [ + "src/**/*.rs", + "Cargo.toml" + ] + }, + "provider": "github", + "workflows": { + "ci": { + "github": { + "on": { + "push": { + "branches": [ + "main" + ] + } + } + }, + "jobs": { + "test": { + "image": "rust:latest", + "inputs": [ + "@rust" + ], + "steps": [ + "setup", + { + "run": "sh scripts/check.sh" + } + ] + } + } + } + } +} + +``` diff --git a/tests/cmd/validate.in/.cigen/config.yml b/tests/cmd/validate.in/.cigen/config.yml new file mode 100644 index 0000000..b5b8ddf --- /dev/null +++ b/tests/cmd/validate.in/.cigen/config.yml @@ -0,0 +1,3 @@ +provider: github +input_groups: + rust: ["src/**"] diff --git a/tests/cmd/validate.in/.cigen/workflows/ci/jobs/build.yml b/tests/cmd/validate.in/.cigen/workflows/ci/jobs/build.yml new file mode 100644 index 0000000..f6e5401 --- /dev/null +++ b/tests/cmd/validate.in/.cigen/workflows/ci/jobs/build.yml @@ -0,0 +1,2 @@ +steps: + - run: cargo build diff --git a/tests/cmd/validate.in/.cigen/workflows/ci/jobs/lint.yml b/tests/cmd/validate.in/.cigen/workflows/ci/jobs/lint.yml new file mode 100644 index 0000000..2a57849 --- /dev/null +++ b/tests/cmd/validate.in/.cigen/workflows/ci/jobs/lint.yml @@ -0,0 +1,2 @@ +stpes: + - run: cargo clippy diff --git a/tests/cmd/validate.in/.cigen/workflows/ci/jobs/test.yml b/tests/cmd/validate.in/.cigen/workflows/ci/jobs/test.yml new file mode 100644 index 0000000..e69b8f2 --- /dev/null +++ b/tests/cmd/validate.in/.cigen/workflows/ci/jobs/test.yml @@ -0,0 +1,4 @@ +needs: [lint, biuld] +inputs: ["@rusty"] +steps: + - run: cargo test diff --git a/tests/cmd/validate.trycmd b/tests/cmd/validate.trycmd new file mode 100644 index 0000000..f7e9066 --- /dev/null +++ b/tests/cmd/validate.trycmd @@ -0,0 +1,94 @@ +`cigen validate` on a config with three mistakes (`validate.in/`): every problem, with its file, key +path and fix. + +```console +$ cigen validate +? failed +error: .cigen/workflows/ci/jobs/lint.yml (at workflows.ci.jobs.lint.stpes): unknown key `stpes` + help: did you mean `steps`? +error: .cigen/workflows/ci/jobs/test.yml (at workflows.ci.jobs.test.inputs): job `test` uses `@rusty`, which isn't defined + help: did you mean `@rust`? +error: .cigen/workflows/ci/jobs/test.yml (at workflows.ci.jobs.test.needs): job `test` needs `biuld`, which isn't a job + help: did you mean `build`? + +The config has 3 problems. `cigen validate --format json` lists them as data. + +``` + +The same errors as data: + +```console +$ cigen validate --format json +? failed +{ + "valid": false, + "config": ".cigen", + "errors": [ + { + "file": ".cigen/workflows/ci/jobs/lint.yml", + "line": null, + "path": [ + "workflows", + "ci", + "jobs", + "lint", + "stpes" + ], + "message": "unknown key `stpes`", + "suggestion": "did you mean `steps`?" + }, + { + "file": ".cigen/workflows/ci/jobs/test.yml", + "line": null, + "path": [ + "workflows", + "ci", + "jobs", + "test", + "inputs" + ], + "message": "job `test` uses `@rusty`, which isn't defined", + "suggestion": "did you mean `@rust`?" + }, + { + "file": ".cigen/workflows/ci/jobs/test.yml", + "line": null, + "path": [ + "workflows", + "ci", + "jobs", + "test", + "needs" + ], + "message": "job `test` needs `biuld`, which isn't a job", + "suggestion": "did you mean `build`?" + } + ] +} + +``` + +`generate` reports them the same way, and so does any other command that loads the config. + +```console +$ cigen generate +? failed +Loading config from: .cigen +error: .cigen/workflows/ci/jobs/lint.yml (at workflows.ci.jobs.lint.stpes): unknown key `stpes` + help: did you mean `steps`? +error: .cigen/workflows/ci/jobs/test.yml (at workflows.ci.jobs.test.inputs): job `test` uses `@rusty`, which isn't defined + help: did you mean `@rust`? +error: .cigen/workflows/ci/jobs/test.yml (at workflows.ci.jobs.test.needs): job `test` needs `biuld`, which isn't a job + help: did you mean `build`? + +The config has 3 problems. `cigen validate --format json` lists them as data. + +``` + +```console +$ cigen validate --config does-not-exist.yml +? failed +error: does-not-exist.yml: config not found + help: Pass the path of a cigen.yml file or a .cigen/ directory. + +``` From caf4c276fead5be38bd750aa198958a82bdd495c Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 14:34:32 +1300 Subject: [PATCH 2/5] CONTRIBUTING: how to refresh the trycmd snapshots --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a9e1cec..406e730 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,6 +33,9 @@ open an issue first so we can agree on the approach. `CIGEN_UPDATE_GOLDEN=1 cargo test --test golden_fixtures` and review the diff before committing. - **JSON schemas.** `schemas/v1/` is generated from the config types in `src/schema/`. Refresh it with `CIGEN_UPDATE_GOLDEN=1 cargo test --test json_schema`. +- **CLI snapshots.** `tests/cmd/*.trycmd` hold the exact output of cigen commands, run by `tests/cli.rs`. After an + intended change to help text or output, refresh them with `TRYCMD=overwrite cargo test --test cli -- cli_coverage` + and review the diff before committing. - **cigen's own CI.** `.github/workflows/` is generated from `.cigen/`, so never edit it by hand. Change `.cigen/`, then run `cargo build --workspace && cargo run -- generate --config .cigen` (the build matters: `cargo run` alone doesn't rebuild the provider binaries) and commit both. From 63dae13b27e4de10c9fdeeb8fe146043d51f9339 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 16:05:49 +1300 Subject: [PATCH 3/5] Refresh the trycmd snapshots for hash --modules-digest and explain's new fields --- tests/cmd/help.trycmd | 26 ++++++++++++++++++-------- tests/cmd/project.trycmd | 9 +++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/tests/cmd/help.trycmd b/tests/cmd/help.trycmd index 621c339..c8352d1 100644 --- a/tests/cmd/help.trycmd +++ b/tests/cmd/help.trycmd @@ -74,14 +74,24 @@ Compute hashes for file patterns or jobs Usage: cigen hash [OPTIONS] Options: - -p, --pattern Glob patterns to include when computing the hash (relative to --base-dir) - --job Optional job identifier to hash using the loaded cigen config - --config The config: a cigen.yml file or a .cigen/ directory (found in --base-dir by default) - --output Optional name for the output value (written to $GITHUB_OUTPUT when set) - --base-dir Base directory the patterns are evaluated relative to (defaults to current dir) [default: .] - --cache Optional cache file path to persist per-file hashes - -v, --verbose... Enable verbose output (use -vv for debug output) - -h, --help Print help + -p, --pattern + Glob patterns to include when computing the hash (relative to --base-dir) + --job + Optional job identifier to hash using the loaded cigen config + --config + The config: a cigen.yml file or a .cigen/ directory (found in --base-dir by default) + --output + Optional name for the output value (written to $GITHUB_OUTPUT when set) + --base-dir + Base directory the patterns are evaluated relative to (defaults to current dir) [default: .] + --cache + Optional cache file path to persist per-file hashes + -v, --verbose... + Enable verbose output (use -vv for debug output) + --modules-digest + The digest of the job's module expansions when its CI config was generated. It goes into the hash, so the hash covers the steps that config runs + -h, --help + Print help ``` diff --git a/tests/cmd/project.trycmd b/tests/cmd/project.trycmd index 96d302b..2a4df94 100644 --- a/tests/cmd/project.trycmd +++ b/tests/cmd/project.trycmd @@ -23,6 +23,7 @@ Derived inputs: command:setup Cargo.lock (lockfile) scripts/check.sh (named in a step) + **/package.json (every package.json, no files) Also hashed: cigen [..] @@ -76,8 +77,16 @@ $ cigen explain test --format json "path": "scripts/check.sh", "reason": "named in a step" } + ], + "patterns": [ + { + "pattern": "**/package.json", + "reason": "every package.json", + "files": [] + } ] }, + "needs": [], "also_hashed": [ "cigen [..]", "the job's definition (workflows.ci.jobs.test)", From a6c1f4b5270df3345fae76843d9ea150adc3ba75 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 16:22:30 +1300 Subject: [PATCH 4/5] Refresh the trycmd snapshots for --matrix on hash and explain --- tests/cmd/help.trycmd | 3 +++ tests/cmd/project.trycmd | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tests/cmd/help.trycmd b/tests/cmd/help.trycmd index c8352d1..57a5ec6 100644 --- a/tests/cmd/help.trycmd +++ b/tests/cmd/help.trycmd @@ -48,6 +48,7 @@ Options: -c, --config The config: a cigen.yml file or a .cigen/ directory (found in --base-dir by default) --base-dir The project root, where input patterns and step paths are looked up [default: .] --format Output format [default: text] [possible values: text, json] + --matrix A matrix entry as JSON, for a job that runs GitHub's own matrix: the hash is that entry's, as its CI hash step computes it -v, --verbose... Enable verbose output (use -vv for debug output) -h, --help Print help @@ -90,6 +91,8 @@ Options: Enable verbose output (use -vv for debug output) --modules-digest The digest of the job's module expansions when its CI config was generated. It goes into the hash, so the hash covers the steps that config runs + --matrix + The job's matrix entry as JSON (`${{ toJSON(matrix) }}`), for a job that runs GitHub's own matrix. It goes into the hash, so each entry has its own hash and pass marker -h, --help Print help diff --git a/tests/cmd/project.trycmd b/tests/cmd/project.trycmd index 2a4df94..c101608 100644 --- a/tests/cmd/project.trycmd +++ b/tests/cmd/project.trycmd @@ -92,6 +92,8 @@ $ cigen explain test --format json "the job's definition (workflows.ci.jobs.test)", "the settings of workflow `ci`" ], + "runs_matrix": false, + "matrix_entry": null, "hash": "[..]" } From 1c8bba8873e0660cc2b28b5eaea45b5e9c8933ca Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 16:46:32 +1300 Subject: [PATCH 5/5] Refresh the trycmd snapshots for the one-problem summary --- tests/cmd/project.trycmd | 2 ++ tests/cmd/validate.trycmd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/cmd/project.trycmd b/tests/cmd/project.trycmd index c101608..1da8640 100644 --- a/tests/cmd/project.trycmd +++ b/tests/cmd/project.trycmd @@ -105,6 +105,8 @@ $ cigen explain tset error: there's no job named `tset` help: did you mean `test`? +The config has 1 problem. `cigen validate --format json` lists them as data. + ``` The `.cigen/` directory as one `cigen.yml`: diff --git a/tests/cmd/validate.trycmd b/tests/cmd/validate.trycmd index f7e9066..5a82617 100644 --- a/tests/cmd/validate.trycmd +++ b/tests/cmd/validate.trycmd @@ -91,4 +91,6 @@ $ cigen validate --config does-not-exist.yml error: does-not-exist.yml: config not found help: Pass the path of a cigen.yml file or a .cigen/ directory. +The config has 1 problem. `cigen validate --format json` lists them as data. + ```