Skip to content

feat: add cascade init command to scaffold a project#170

Merged
joshua-temple merged 1 commit into
mainfrom
feat/cascade-init-command
Jun 15, 2026
Merged

feat: add cascade init command to scaffold a project#170
joshua-temple merged 1 commit into
mainfrom
feat/cascade-init-command

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

cascade had a scaffold package but no command to drive it. New adopters had to hand-write the manifest and callback stubs before they could generate anything.

Fix

Adds cascade init, the command that drives internal/scaffold.

Flags: --topology (preset: no-env/two-env/three-env/four-env, default two-env), --envs (custom ordered list, overrides --topology, last name is the release stage), --name (default: target dir base name), --dir (default .), --cli-version, --force, --dry-run.

Behavior:

  • Resolves the environment list, then calls scaffold.Scaffold, which self-checks (parse + validate + generate) before returning. A scaffold that cannot survive the real generator is never written, so validate-failure rollback is inherent.
  • Refuse-on-existing: if any target file exists and --force is unset, aborts and lists the conflicts, writing nothing. --force overwrites.
  • --dry-run: prints the file list and exits without writing.
  • On success: writes the files and prints a summary plus next steps (fill in the stubs, commit, run generate-workflow), noting the manifest already carries the $schema directive.

Docs

  • cli-reference: new init entry with the full flag table.
  • getting-started: a "Fast path: scaffold with cascade init" section.
  • adoption: points at cascade init as the fast path for building a pipeline from scratch.

Housekeeping

go mod tidy flips santhosh-tekuri/jsonschema/v6 from indirect to direct (it is a direct test dependency) and records its transitive go.sum entries. One-line marker fix; nothing else pulled in.

Verification

  • go build ./..., go test ./... (1345 pass), golangci-lint run ./... (clean).
  • Unit tests cover topology resolution, custom --envs, refuse-on-existing (with and without --force), --dry-run writes nothing, a successful init whose written manifest re-passes self-check, and the scaffold-failure path.
  • Dogfood drift: generate-workflow --config .github/manifest.yaml --force then git diff --exit-code -- .github/workflows .github/actions is clean.
  • Manual run of cascade init --topology two-env --name demo produces a valid scaffold that generate-workflow --validate-only accepts.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple joshua-temple merged commit 7b707f7 into main Jun 15, 2026
9 checks passed
@joshua-temple joshua-temple deleted the feat/cascade-init-command branch June 15, 2026 20:34
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