Expand description
Workflow guard — keep the reusable workflow in step with the CLI (issue #92).
The reusable workflow (.github/workflows/testing-conventions.yml) is the
documented @v0 consumption path: a consumer pins @v0, and the workflow runs
the published testing-conventions binary via npx. When a CLI subcommand is
renamed or removed — e.g. unit location → unit colocated-test (#55) — but a
workflow still invokes the old name, every @v0 consumer breaks with
unrecognized subcommand, silently: the workflow file is frozen at the tag
while npx keeps pulling the latest binary.
This module is the deterministic guard against that drift. invocations
extracts every testing-conventions … call from a workflow file’s shell, and
unknown_subcommands checks each one’s subcommand chain against the binary’s
own command tree (the source of truth, crate::command), flagging any chain
the binary no longer exposes. Run in CI against the reusable workflow it fails
the build the moment a workflow and the CLI fall out of step — before a release
can strand @v0.
Extraction is a line-based, shell-aware scan, not a full GitHub Actions parser:
it tokenizes each non-comment line, finds the testing-conventions binary token
(the bare command word, optionally version-pinned …@x /
…${VERSION:+@$VERSION} — the npx / on-PATH form the reusable workflow and
the docs use), and reads the tokens after it as the invocation. That is the
deterministic bright-line; a path-qualified invocation (./bin/testing-conventions),
a subcommand split across a \-continuation, or one named in non-run: prose is
a documented limit.
Structs§
- Invocation
- A single
testing-conventionsinvocation found in a workflow file.
Functions§
- check
- Check
path(a workflow file or directory): everytesting-conventionsinvocation must name a subcommandrootstill exposes. Returns oneViolationper offending invocation. - invocations
- Walk
path— a workflow file, or a directory of them — and return everytesting-conventionsinvocation, in file-then-line order. - unknown_
subcommands - Of
invocations, the ones whose subcommand chain names a subcommand the binary — described byroot, its clap command tree — no longer exposes.