Skip to content

refactor(cli): split the build pipeline into named phases - #26

Merged
ikelaiah merged 1 commit into
mainfrom
quality/cli-runbuild-split
Sep 18, 2026
Merged

ikelaiah merged 1 commit into
mainfrom
quality/cli-runbuild-split

Conversation

@ikelaiah

Copy link
Copy Markdown
Owner

Summary

Final Stage D slice: RunBuild in src/cli/PasWeave.CLI.pas is split into named phases. The procedure body drops from ~470 lines to a ~47-line orchestrator:

Phase Lines Responsibility
ParseCommandLine ~223 Option parsing and validation, including --help
ExecuteBuild ~128 Source validation, Lazarus loading, fingerprint, up-to-date check, parse/build
RenderAndReport ~80 Source links, branding, coverage gate, output writing, diagnostics, summary, manifest/stale cleanup, exit code

The phases are nested procedures that share the existing locals, so no option or build-state record is threaded and the single outer try/finally remains the only owner of the option objects.

One behavior-preserving detail: --help inside pasweave build now sets a handled flag instead of calling Exit(0) from a nested procedure (nested procedures cannot return a value).

Verification

  • make test passes (CLI suite covers help, usage errors, exit codes, incremental parity, corruption recovery, coverage policy, and source links).
  • Checked-in example goldens are byte-identical.
  • Full production build is clean.

This completes the Stage D decomposition program.

RunBuild is now a short orchestrator over three nested phases:
ParseCommandLine, ExecuteBuild, and RenderAndReport. The phases share the
existing locals, so no option or build-state record is threaded, and the
single outer try/finally remains the only owner of the option objects.

No behavior changes; the CLI suite covers help, exit codes, incremental
parity, coverage policy, and source links.

Verified: make test (CLI and functional suites) and byte-identical checked-in
example output.
@ikelaiah
ikelaiah merged commit 6895b77 into main Sep 18, 2026
3 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