Skip to content

Collapse Program to a thin entry point; extract residual helpers into services (#392)#404

Draft
ChrisonSimtian wants to merge 1 commit into
cli-cmd-navigationfrom
cli-cmd-collapse
Draft

Collapse Program to a thin entry point; extract residual helpers into services (#392)#404
ChrisonSimtian wants to merge 1 commit into
cli-cmd-navigationfrom
cli-cmd-collapse

Conversation

@ChrisonSimtian

@ChrisonSimtian ChrisonSimtian commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Capstone of the #392 stack — removes the last of the Program god-class now that every command is its own IFalloutCommand. Stacked on #403; rebase onto main once the chain lands (draft until then).

What changed

  • Extracts the residual shared helpers off Program into injectable services: ConfigurationReader (build-script # CONFIGURATION parsing), BuildScaffolder (scripts/config/solution/templates), PackageManager (package add/replace), static CakeConverter, plus ToolBanner (was PrintInfo) and CliConventions.
  • Rewires every command to take these via the constructor instead of Program.X(...).
  • Deletes the transitional scaffolding: the Program.* residual partials, the Program.Setup shim, the static prompt delegators, and DelegateCommand. Program is now just Main + the DI composition root + root-directory resolution — no longer partial.
  • Migrates the Program-internal tests to the new types; adds ConfigurationReaderTests.

Program drops from a 14-method partial across ~10 files to a ~90-line entry point.

Verification

dotnet build src/Fallout.Cli clean · Fallout.Cli.Tests 45 pass · fallout :bogus lists all 15 commands.

Note

add-package, setup, and the navigation commands still aren't unit-tested at the command level (they call MSBuild/NuGet/env-var access inline) — fuller coverage needs more seams, out of scope here.

Part of #392.

🤖 Generated with Claude Code

… services

Final step of the #392 CLI refactor. With every command now its own type, this
removes the last of the god-class:

- Extract the residual shared helpers off Program into focused, injectable types:
  ConfigurationReader (IConfigurationReader), BuildScaffolder (IBuildScaffolder),
  PackageManager (IPackageManager), and a static CakeConverter. PrintInfo becomes
  ToolBanner; the build-script-name convention becomes CliConventions.
- Rewire every command to take these via the constructor instead of calling
  Program.X(...). CakeConvertCommand depends on SetupCommand directly (registered
  as a concrete singleton and re-exposed as IFalloutCommand).
- Delete the transitional scaffolding: the Program.* residual partials, the
  Program.Setup shim, the static prompt delegators, and DelegateCommand. Program
  is now just Main + the DI composition root + root-directory resolution, and is
  no longer partial.
- Migrate the tests that reached into Program internals to the new types
  (UpdateSolutionFileContent → BuildScaffolder; cake helpers → CakeConverter;
  package-type constants → PackageManager) and add ConfigurationReaderTests.

Tests: 45 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/2026 Targets the 2026 calendar-version line (current). See ADR-0004.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant