feat: add Fallout.Migrate CLI for NUKE → Fallout repo migration#68
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
dotnet toolthat migrates a NUKE consumer repo to Fallout in place:Closes the MVP scope of #48. See "deferred" below for the leftovers.
Transformations
.csprojCsprojRewriterPackageReference Include="Nuke.X"→Fallout.X; the known P3.5b MSBuild props (NukeRootDirectory,NukeBaseDirectory, etc.) →Fallout*.csCodeRewriter\bNuke\.(?=[A-Z])for using/attribute/qualified-type refs;\bNukeBuild\b→FalloutBuild;\bINukeBuild\b→IFalloutBuildbuild.{cmd,ps1,sh}ScriptRewriterdotnet nuke→dotnet fallout;.nuke/paths →.fallout/;NUKE_*env vars →FALLOUT_*.nuke/dirMigration.RenameNukeDirectory.fallout/; warn if both already existAnchored-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
--dry-run/-nfor preview.--help/-hfor usage. Auto-detects repo root by walking up looking forbuild.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
/tmpfixture matched the expected diff exactly.What's deferred (still open on #48)
ChrisonSimtian/ErpForFactoryGamesonce published.fallout.slnxwithPackAsTool=true).Side-effect
StronglyTypedSolutionGeneratorTest.Test#Solution.g.verified.csregenerated — solution source generator now emitsSolution.Fallout_MigrateandSolution.Fallout_Migrate_Testsproperties.Verification
dotnet build src/Fallout.Migrate: 0 errors, 0 warningsdotnet test fallout.slnx: 408 passed (was 391, +17 new), 7 skipped, 0 failed🤖 Generated with Claude Code