Skip to content

feat: add Fallout.Migrate CLI for NUKE → Fallout repo migration#68

Merged
ChrisonSimtian merged 1 commit into
mainfrom
feature/fallout-migrate-cli
May 21, 2026
Merged

feat: add Fallout.Migrate CLI for NUKE → Fallout repo migration#68
ChrisonSimtian merged 1 commit into
mainfrom
feature/fallout-migrate-cli

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Summary

New dotnet tool that migrates a NUKE consumer repo to Fallout in place:

dotnet tool install -g Fallout.Migrate
cd path/to/my-nuke-repo
fallout-migrate              # apply
fallout-migrate --dry-run    # preview

Closes the MVP scope of #48. See "deferred" below for the leftovers.

Transformations

Layer Rewriter What changes
.csproj CsprojRewriter PackageReference Include="Nuke.X"Fallout.X; the known P3.5b MSBuild props (NukeRootDirectory, NukeBaseDirectory, etc.) → Fallout*
.cs CodeRewriter \bNuke\.(?=[A-Z]) for using/attribute/qualified-type refs; \bNukeBuild\bFalloutBuild; \bINukeBuild\bIFalloutBuild
build.{cmd,ps1,sh} ScriptRewriter dotnet nukedotnet fallout; .nuke/ paths → .fallout/; NUKE_* env vars → FALLOUT_*
.nuke/ dir Migration.RenameNukeDirectory Rename to .fallout/; warn if both already exist

Anchored-regex approach — same as #54/#59 used for the rebrand itself. No Roslyn dependency keeps the tool a single small binary; works on any environment with the .NET 10 runtime.

CLI shape

fallout-migrate — migrating: /path/to/repo
edit    build/_build.csproj  (3 changes)
edit    build/Build.cs       (2 changes)
edit    build.sh             (2 changes)
rename  .nuke -> .fallout

Files changed:   3
Edits made:      7
Directories:     1 renamed

--dry-run/-n for preview. --help/-h for usage. Auto-detects repo root by walking up looking for build.cmd / build.ps1 / build.sh / .nuke/ / build/.

Tests

17 new tests cover each rewriter (positive cases + false-positive guards) and an end-to-end integration test with a vanilla fixture. Plus a manual smoke run on a /tmp fixture matched the expected diff exactly.

What's deferred (still open on #48)

  • Roslyn-based AST rewrites — kept it regex-only for MVP. Switch to Roslyn when we hit cases regex can't handle (partial identifier disambiguation, semantic-aware refactors). Nothing observed in vanilla consumer repos yet.
  • Real-repo verification — issue's "Done when" wants a volunteer-repo migration. You could try this against ChrisonSimtian/ErpForFactoryGames once published.
  • Publication — release pipeline picks this up on next push to main (project is in fallout.slnx with PackAsTool=true).
  • Migration guide link[P5] Write NUKE → Fallout migration guide #37 doesn't exist yet; will reference once it does.

Side-effect

StronglyTypedSolutionGeneratorTest.Test#Solution.g.verified.cs regenerated — solution source generator now emits Solution.Fallout_Migrate and Solution.Fallout_Migrate_Tests properties.

Verification

  • dotnet build src/Fallout.Migrate: 0 errors, 0 warnings
  • dotnet test fallout.slnx: 408 passed (was 391, +17 new), 7 skipped, 0 failed

🤖 Generated with Claude Code

Closes part of #48 (MVP — see "What's NOT in this PR" below).

## What it does

A new `dotnet tool` that walks a consumer repo and rewrites the
NUKE-era artifacts into their Fallout equivalents in place:

  dotnet tool install -g Fallout.Migrate
  cd path/to/my-nuke-repo
  fallout-migrate            # apply
  fallout-migrate --dry-run  # preview without writing

Transformations:

| Layer | Rewriter | What changes |
|---|---|---|
| `.csproj` | CsprojRewriter | PackageReference Include="Nuke.X" → Fallout.X; MSBuild props on the known P3.5b list (NukeRootDirectory, NukeBaseDirectory, NukeTelemetryVersion, NukeTasksEnabled, …) → Fallout* |
| `.cs` | CodeRewriter | `\bNuke\.(?=[A-Z])` → `Fallout.` for using directives, attribute namespaces, qualified type references; `\bNukeBuild\b` → `FalloutBuild`; `\bINukeBuild\b` → `IFalloutBuild` |
| `build.{cmd,ps1,sh}` | ScriptRewriter | `dotnet nuke` → `dotnet fallout`; `.nuke/` path references → `.fallout/`; legacy NUKE_* env vars → FALLOUT_* |
| `.nuke/` dir | DirectoryRenamer | Renames to `.fallout/` (warning emitted if both exist) |

Each rewriter uses anchored regex matching the same approach the
rebrand itself used in #54 / #59 (`\bNuke\.` with case-aware lookaheads).
Internal regex-only — no Roslyn dependency, no MSBuild evaluation,
keeps the tool a single small binary.

## Output

  fallout-migrate — migrating: /path/to/repo
  edit    build/_build.csproj  (3 changes)
  edit    build/Build.cs       (2 changes)
  edit    build.sh             (2 changes)
  rename  .nuke -> .fallout

  Files changed:   3
  Edits made:      7
  Directories:     1 renamed

  Migration complete. Verify the build:  ./build.ps1   (or ./build.sh on unix)

## Tests

17 tests:
- CsprojRewriterTest: PackageReference, MSBuild property, false-positive guard, no-op
- CodeRewriterTest: using directive, qualified type, NukeBuild, INukeBuild, partial-identifier guard, lowercase .nuke guard
- ScriptRewriterTest: dotnet nuke, .nuke dir refs, env vars, plain-word guard
- MigrationIntegrationTest: end-to-end vanilla fixture (csproj+cs+sh+.nuke), dry-run, both-dirs warning

Plus a manual end-to-end smoke from a fixture in /tmp confirmed dry-run
output matches the expected diff.

## What's NOT in this PR (deferred)

- Roslyn-based AST rewrites — kept it regex-only for MVP. The issue
  mentions reusing the Cake rewriting infrastructure; that's more
  appropriate when we hit cases regex can't handle (e.g. partial
  identifier disambiguation, semantic-aware refactors). None observed
  in vanilla consumer repos yet.
- Tested on a real external NUKE consumer repo — volunteer needed
  per the issue's "Done when" list. Open follow-up.
- Published to GitHub Packages — release pipeline will pick this up
  on next push to main since the project is in fallout.slnx and
  PackAsTool=true.
- Link from migration guide (#37) — that PR doesn't exist yet.

## Side-effect

StronglyTypedSolutionGeneratorTest verify snapshot regenerated —
solution generator now emits Solution.Fallout_Migrate and
Solution.Fallout_Migrate_Tests properties from the two new projects.

## Verification

- dotnet build src/Fallout.Migrate: 0 errors, 0 warnings
- dotnet test fallout.slnx: 408 passed (was 391; +17 new), 7 skipped, 0 failed
- End-to-end dry-run on /tmp fixture: edits + rename reported correctly

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit 867c5a4 into main May 21, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the feature/fallout-migrate-cli branch May 21, 2026 05:54
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