| name | migrate-all |
| description | Orchestrate the full Find-to-Graph SDK migration pipeline end-to-end: scan → transform → validate → build-fix, with one retry pass on validation failures. Produces a final summary report. Invoke via /migrate-all [--project path/to/solution-or-project]. Use this whenever someone wants to run the complete migration in one go, asks for 'full migration', 'migrate everything', 'end-to-end migration', or wants to chain scan/transform/validate automatically. |
migrate-all — End-to-End Migration Orchestration
Chains the full migration pipeline in sequence: scan the codebase for legacy Find SDK usage, confirm the plan with the user, transform the code to Graph SDK, validate the build, rebuild and fix remaining errors, then produce a single aggregated report.
This is a pure orchestrator — it delegates all domain work to /migrate-scan, /migrate-transform, and /migrate-validate. It adds no transformation logic of its own.
Input Parsing
Extract from the user's input:
- Project path: from
--project /path/to/solution-or-project argument.
- If no
--project provided, search the current working directory for .sln files.
- If no
.sln found, ask the user for the path before proceeding.
Store:
PROJECT_PATH = resolved path to .sln or .csproj
Phase 1: Scan
-
Print:
═══════════════════════════════════════════════════
Phase 1/6: Scanning codebase for Find SDK usage...
═══════════════════════════════════════════════════
-
Invoke /migrate-scan --project <PROJECT_PATH>.
-
After scan completes, find the scan report:
ls -1 .cg-migrations/migrate-scan/*-scan-report.md 2>/dev/null | sort -r | head -1
Store the result as SCAN_REPORT_PATH.
-
Read SCAN_REPORT_PATH. Extract from the Summary section:
TOTAL_TARGETS: total migration targets count
TOTAL_FILES: total files count
DIRECT_SWAP_COUNT, PATTERN_REWRITE_COUNT, MANUAL_COUNT: by complexity
-
If TOTAL_TARGETS == 0:
Scan complete: no Find SDK usage detected. Nothing to migrate.
Skip to Phase 6 with MIGRATION_STATUS = "Nothing to migrate".
-
Print scan summary:
Scan found <TOTAL_TARGETS> migration targets across <TOTAL_FILES> files:
direct-swap: <DIRECT_SWAP_COUNT>
pattern-rewrite: <PATTERN_REWRITE_COUNT>
manual: <MANUAL_COUNT>
Phase 2: Confirm Before Transform
Before running any destructive code changes, always pause to confirm the plan with the user.
-
Print:
═══════════════════════════════════════════════════
Phase 2/6: Confirming migration plan...
═══════════════════════════════════════════════════
-
Present a plain-language summary of what will happen:
Ready to transform <TOTAL_FILES> files.
Automated (no input needed):
• <DIRECT_SWAP_COUNT> direct-swap patterns — 1:1 API replacements
• <PATTERN_REWRITE_COUNT> pattern-rewrites — async/type changes
Requires your decisions:
• <MANUAL_COUNT> manual patterns — no Graph SDK equivalent;
you will be asked how to handle each group during the transform phase.
If MANUAL_COUNT == 0, omit the "Requires your decisions" section and note that the transform is fully automated.
-
Use AskUserQuestion to confirm:
- Question: "Proceed with transformation? This will modify source files."
- Options:
"Yes, proceed" — continue to Phase 3
"No, stop here" — print the scan report path and exit
-
If the user chooses to stop, print:
Migration paused after scan. Review the scan report before continuing:
<SCAN_REPORT_PATH>
Re-run /migrate-all when ready to proceed.
Then exit.
-
If MANUAL_COUNT > 0, also explain what will happen during the decision phase:
Note: during transformation you will be asked how to handle
<MANUAL_COUNT> manual pattern group(s). Common choices are:
remove — comment out with a TODO (recommended for server-side indexing)
skip — leave unchanged, flag for manual review
redesign — flag for architectural redesign
You can decide per-group when prompted.
Phase 3: Transform
-
Print:
═══════════════════════════════════════════════════
Phase 3/6: Transforming code from Find SDK to Graph SDK...
═══════════════════════════════════════════════════
-
Invoke /migrate-transform --project <PROJECT_PATH> --scan-report <SCAN_REPORT_PATH>.
The transform skill handles all interactive decision-making for manual patterns in its own Phase 1. No pre-generated decisions file is needed.
-
After transform completes, read the transform report:
cat .cg-migrations/migrate-transform/transform-report.md
Extract:
FILES_TRANSFORMED: count of files changed
PATTERNS_APPLIED: total pattern applications
FLAGGED_ITEMS: count of items flagged for manual review
TRANSFORM_REPORT_PATH = .cg-migrations/migrate-transform/transform-report.md
-
Print transform summary:
Transform complete:
Files transformed: <FILES_TRANSFORMED>
Patterns applied: <PATTERNS_APPLIED>
Flagged for review: <FLAGGED_ITEMS>
Phase 4: Validate
-
Print:
═══════════════════════════════════════════════════
Phase 4/6: Validating migration (building project)...
═══════════════════════════════════════════════════
-
Invoke /migrate-validate --project <PROJECT_PATH>.
-
After validation completes, read the validation report from .cg-migrations/migrate-validate/. Extract:
FIRST_PASS_ERRORS: count of migration-caused errors
FIRST_PASS_WARNINGS: count of migration-related warnings
FAILED_FILES: list of files with migration-caused errors (file paths)
VALIDATION_REPORT_PATH = path to the validation report
-
If FIRST_PASS_ERRORS == 0:
Build succeeded with 0 migration-caused errors.
Set RETRY_NEEDED = false. Skip to Phase 5.
-
If FIRST_PASS_ERRORS > 0:
Build found <FIRST_PASS_ERRORS> migration-caused errors in <N> files.
Attempting retry pass...
Set RETRY_NEEDED = true.
Phase 4b: Retry (one pass)
Only runs if RETRY_NEEDED == true.
-
Print:
───────────────────────────────────────────────────
Retry: Re-transforming <N> failed files...
───────────────────────────────────────────────────
-
For each file in FAILED_FILES, re-read the file and apply transformations again using /migrate-transform --project <PROJECT_PATH> --scan-report <SCAN_REPORT_PATH>.
The key instruction to migrate-transform for the retry: focus only on the files listed in FAILED_FILES, not the entire manifest. Pass these files explicitly or let migrate-transform process its full manifest — the transform is idempotent so re-running on already-transformed files is safe.
-
Re-run validation:
Re-validating after retry...
Invoke /migrate-validate --project <PROJECT_PATH>.
-
Extract updated results:
RETRY_ERRORS: count of remaining migration-caused errors
RETRY_FIXED: FIRST_PASS_ERRORS - RETRY_ERRORS
-
Print:
Retry results: fixed <RETRY_FIXED> errors, <RETRY_ERRORS> remaining.
Phase 5: Build & Fix Remaining Errors
This phase rebuilds the project and iteratively fixes every error it can. The loop runs without a fixed iteration cap — it stops only when no more errors can be resolved automatically. Errors that require understanding of business logic or project-specific domain knowledge are flagged for human review, not guessed at.
Initialize tracking variables:
BUILD_FIX_ITERATIONS = 0
BUILD_FIXES_APPLIED = [] (list of {file, line, error_code, fix_applied})
LOGIC_ERRORS = [] (errors deferred because they need human input)
BUILD_ERRORS_BEFORE_FIX = 0
BUILD_ERRORS_AFTER_FIX = 0
-
Print:
═══════════════════════════════════════════════════
Phase 5/6: Rebuilding and fixing remaining errors...
═══════════════════════════════════════════════════
-
Run the build:
dotnet build <PROJECT_PATH> -v q -clp:NoSummary 2>&1 | tee .cg-migrations/migrate-all/build-phase5.txt
Parse the output for compile errors (error CS*) and NuGet errors (error NU*). Count as BUILD_ERRORS_BEFORE_FIX.
-
If BUILD_ERRORS_BEFORE_FIX == 0:
Build passed — no errors to fix.
Set BUILD_ERRORS_AFTER_FIX = 0. Skip to Phase 6.
-
Classify each error into one of three categories:
Fixable with clear context — the right fix is unambiguous from the error message and surrounding code alone. Fix these immediately:
| Error | Typical Fix |
|---|
CS0266 type covariance (IContentQuery<T>) | Cast or change variable declaration to correct type |
CS1061 missing method (e.g., .GetResult(), .SearchFor()) | Apply correct Graph SDK method from migrate-map Rule 11/4 |
CS0246 unknown type (Find SDK type removed) | Add shim, comment out with TODO, or replace with Graph SDK equivalent |
CS1002 ; expected / syntax error from prior transformation | Fix comment/semicolon placement |
NU1107 version conflict | Add explicit package reference to resolve version |
NU1605 package downgrade | Bump pinned version to match transitive requirement |
CS0029 implicit conversion | Apply explicit cast or change declared type |
CS1503 argument type mismatch with obvious replacement | Update method call signature or add cast |
CS0619 obsolete API (CMS 13 breaking change) | Replace with documented CMS 13 equivalent |
CS0234 namespace not found (from excluded/removed package) | Add // TODO: comment, exclude file, or add using |
Fixable after reading the file — read the full context of the failing file before deciding:
CS1503/CS0266 where the replacement isn't obvious from the error line alone
CS0115 / CS0535 interface contract broken (read the interface and implementor before fixing)
- Cascade errors downstream of a primary error (fix the root cause first, re-build)
Requires business logic — defer to human — do NOT guess. Add to LOGIC_ERRORS and move on:
- The error implies the wrong algorithm or data flow (e.g., a filter that should include/exclude based on domain rules)
- The fix would change observable runtime behavior in a non-trivial way
- The correct replacement API is unknown without reading external docs or business requirements
- The error is in a method where the intent is unclear from names and comments alone
-
Fix-and-rebuild loop (no iteration limit — stop only when no more fixable errors remain):
Each iteration:
a. Read each fixable error. Open the file if you need more context.
b. Apply the fix. For each fix, record it in BUILD_FIXES_APPLIED:
{
"file": "path/to/File.cs",
"line": 42,
"error_code": "CS0266",
"error_message": "...",
"fix_applied": "Changed variable type from IContentQuery<SpecificPage> to IContentQuery<IContent>"
}
c. Add any unfixable errors to LOGIC_ERRORS:
{
"file": "path/to/File.cs",
"line": 88,
"error_code": "CS1503",
"error_message": "...",
"reason_deferred": "Replacement method requires understanding which ISiteDefinitionRepository filter to apply — depends on domain routing rules"
}
d. Re-run the build. Increment BUILD_FIX_ITERATIONS.
e. If the new error list contains errors not in LOGIC_ERRORS → loop again.
f. Stop when every remaining error is either fixed or already in LOGIC_ERRORS (meaning no progress can be made automatically).
Print progress after each build:
Iteration <N>: <ERRORS_THIS_BUILD> errors remaining (<FIXED_THIS_BATCH> fixed this pass)
-
Set BUILD_ERRORS_AFTER_FIX = count of remaining errors (those in LOGIC_ERRORS plus any that couldn't be classified).
-
Print summary:
Build fix complete (after <BUILD_FIX_ITERATIONS> iteration(s)):
Errors before fix: <BUILD_ERRORS_BEFORE_FIX>
Fixes applied: <count(BUILD_FIXES_APPLIED)>
Logic errors (need human review): <count(LOGIC_ERRORS)>
Errors after fix: <BUILD_ERRORS_AFTER_FIX>
Phase 6: Final Report
-
Print:
═══════════════════════════════════════════════════
Phase 6/6: Generating final report...
═══════════════════════════════════════════════════
-
Determine MIGRATION_STATUS:
- If
TOTAL_TARGETS == 0: "Nothing to migrate"
- If
BUILD_ERRORS_AFTER_FIX == 0 (or build was never run): "Complete"
- If
BUILD_ERRORS_AFTER_FIX > 0 and count(BUILD_FIXES_APPLIED) > 0: "Partial — build fixes applied, errors remain"
- If
BUILD_ERRORS_AFTER_FIX > 0 and no fixes applied: "Partial — manual fixes required"
-
Create directory:
mkdir -p .cg-migrations/migrate-all
-
Generate the timestamp for the filename:
date +"%Y-%m-%d-%H-%M"
Store as TIMESTAMP. Set REPORT_PATH = .cg-migrations/migrate-all/<TIMESTAMP>-migration-report.md.
-
Write REPORT_PATH with this structure:
---
title: End-to-End Migration Report
date: <YYYY-MM-DD>
solution: <PROJECT_PATH>
scan_report: <SCAN_REPORT_PATH>
transform_report: <TRANSFORM_REPORT_PATH>
validation_report: <VALIDATION_REPORT_PATH>
migration_status: <MIGRATION_STATUS>
---
## Summary
| Metric | Value |
|--------|-------|
| Total targets scanned | <TOTAL_TARGETS> |
| Files transformed | <FILES_TRANSFORMED> |
| Build errors (validate pass) | <FIRST_PASS_ERRORS> |
| Build errors (after retry) | <RETRY_ERRORS or N/A> |
| Build errors (before Phase 5 fix) | <BUILD_ERRORS_BEFORE_FIX> |
| Fixes applied in Phase 5 | <count(BUILD_FIXES_APPLIED)> |
| Build errors (after Phase 5 fix) | <BUILD_ERRORS_AFTER_FIX> |
| Remaining manual items | <FLAGGED_ITEMS + BUILD_ERRORS_AFTER_FIX> |
| Migration status | <MIGRATION_STATUS> |
## Scan Results
(Copy the complexity breakdown table and top affected files from the scan report)
## Transform Results
(Copy the transformation summary from the transform report: files changed, patterns applied, flagged items)
## Validation Results
### First Pass
(Error count, categorized by migration-caused vs pre-existing vs out-of-scope, from the validation report)
### Retry Pass
(If retry was performed: what was re-attempted, what was fixed, what remains)
(If no retry needed: "Not needed — first pass succeeded.")
## Build Fix Results (Phase 5)
### Fixes Applied
(If BUILD_FIXES_APPLIED is empty: "No code changes were required — build passed without fixes.")
(If fixes were applied, list each fix as a table:)
| # | File | Line | Error | Fix Applied |
|---|------|------|-------|-------------|
| 1 | path/to/File.cs | 42 | CS0266 | Changed variable type from IContentQuery<SpecificPage> to IContentQuery<IContent> |
| 2 | path/to/Other.cs | 17 | NU1107 | Added explicit EPiServer.Cms.Core 13.0.0 reference to csproj |
…
### Remaining Build Errors
(If BUILD_ERRORS_AFTER_FIX == 0: "All migration-caused build errors resolved.")
(If BUILD_ERRORS_AFTER_FIX > 0, list each remaining error:)
| # | File | Line | Error | Reason Not Fixed |
|---|------|------|-------|-----------------|
| 1 | path/to/File.cs | 88 | CS1503 | Requires architectural redesign — type mismatch in ISearchProvider interface |
| 2 | path/to/Other.cs | 55 | CS0619 | Pre-existing CMS 13 breaking change, not migration-caused |
…
(Classify each remaining error as: migration-caused (needs more work) | pre-existing (predates migration) | out-of-scope (not related to Find→Graph))
## Remaining Manual Work
(List all items requiring human attention:
- Flagged items from transform report
- Migration-caused build errors that could not be fixed automatically
- Manual patterns that were skipped or redesigned
Each with file:line and reason)
## Next Steps
1. Address <N> remaining build errors (listed above in "Remaining Build Errors")
2. Review and implement TODO comments left by the migration (`grep -rn "TODO.*GRAPH-MIGRATION"`)
3. Address flagged items in .cg-migrations/migrate-decisions.md
4. Run test suite to verify runtime behavior
5. Remove any remaining EPiServer.Find package references if not already removed
-
Print console summary:
═══════════════════════════════════════════════════
Migration <MIGRATION_STATUS>
═══════════════════════════════════════════════════
Scanned: <TOTAL_TARGETS> targets across <TOTAL_FILES> files
Transformed: <FILES_TRANSFORMED> files
Build fixes: <count(BUILD_FIXES_APPLIED)> applied, <BUILD_ERRORS_AFTER_FIX> errors remain
Manual items: <FLAGGED_ITEMS + BUILD_ERRORS_AFTER_FIX>
Full report: <REPORT_PATH>
-
If MIGRATION_STATUS contains "Partial":
Some items could not be migrated automatically.
Review the "Remaining Build Errors" and "Remaining Manual Work" sections in the report for actionable guidance.