Skip to content

feat: add internal/scaffold package for cascade init - #169

Merged
joshua-temple merged 1 commit into
mainfrom
feat/scaffold-package
Jun 15, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
feat/scaffold-package

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

After the inline run: removal, cascade callbacks are reusable-workflow-only, so a cold start requires hand-authoring workflow_call files. There is no programmatic way to produce a known-good starter manifest plus the build/deploy stubs it references.

Fix

Adds a new internal/scaffold package (PR1 of cascade init, no CLI yet). It produces an in-memory set of files for a chosen topology and guarantees they are never handed out broken.

  • Scaffold(project, trunkBranch, envs, ...Option) returns a path->content map: a starter .github/manifest.yaml plus the build (and, when environments exist, deploy) reusable-workflow stubs it references. An empty envs slice yields the no-env, release-only topology.
  • The manifest carries the # yaml-language-server: $schema=... directive for editor autocomplete (inert YAML comment), pins cli_version to config.DefaultCLIVersion, and applies environment names positionally.
  • Stub workflows are valid on: workflow_call reusable workflows declaring the environment/sha/dry_run inputs cascade passes; the build stub wires the artifact_id output through, matching the callback contract.
  • SelfCheck(files) writes the files to a temp dir and confirms they parse (config.ParseManifestFile), validate (config.Validate), and generate (internal/generate orchestrate + promote) without error. Scaffold runs it before returning.
  • Topology presets: no-env [], two-env [dev prod], three-env [dev staging prod], four-env [dev test uat prod].

Verification

  • go build ./..., full go test ./... (all packages green), and golangci-lint run ./... pass.
  • Table-driven unit tests over all four topologies: each scaffold parses, validates, and generates; stub input/output keys are asserted against the contract; the $schema directive and positional env ordering are checked; negative SelfCheck cases (invalid env name, malformed YAML, build missing workflow:) exercise real validation failures.
  • New code is confined to internal/scaffold/; no dogfood-workflow drift.

PR2 will wire the cascade init cobra command on top of this package; cascade adopt will reuse the same writer and self-check.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 890efcb into main Jun 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant