@code-migration/wow-migrator 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/package.json +1 -1
  2. package/skills/android-project-analyst/SKILL.md +71 -28
  3. package/skills/android-project-analyst/bind.md +12 -6
  4. package/skills/android-project-analyst/dependencies.yaml +66 -10
  5. package/skills/android-project-analyst/output-contract.md +357 -0
  6. package/skills/android-project-analyst/roles/analysis-workspace-state.md +30 -8
  7. package/skills/android-project-analyst/roles/behavior-logic.md +12 -5
  8. package/skills/android-project-analyst/roles/data-contract-flow.md +11 -4
  9. package/skills/android-project-analyst/roles/presentation-resource.md +13 -4
  10. package/skills/android-project-analyst/roles/project-architecture.md +11 -4
  11. package/skills/android-project-analyst/workflow.md +88 -39
  12. package/skills/android-to-kmp-migrator/SKILL.md +62 -111
  13. package/skills/android-to-kmp-migrator/bind.md +29 -61
  14. package/skills/android-to-kmp-migrator/dependencies.yaml +72 -11
  15. package/skills/android-to-kmp-migrator/output-contract.md +318 -0
  16. package/skills/android-to-kmp-migrator/roles/completion-report.md +11 -2
  17. package/skills/android-to-kmp-migrator/roles/global-migration-phase.md +87 -0
  18. package/skills/android-to-kmp-migrator/roles/migration-planning-gate.md +75 -0
  19. package/skills/android-to-kmp-migrator/roles/migration-prep.md +75 -0
  20. package/skills/android-to-kmp-migrator/roles/migration-verification.md +47 -23
  21. package/skills/android-to-kmp-migrator/roles/migration-workspace-state.md +207 -20
  22. package/skills/android-to-kmp-migrator/roles/module-implementation.md +82 -0
  23. package/skills/android-to-kmp-migrator/roles/module-node-review-fix.md +9 -2
  24. package/skills/android-to-kmp-migrator/roles/target-project-assistant.md +104 -0
  25. package/skills/android-to-kmp-migrator/workflow.md +71 -170
  26. package/skills/kmp-test-validator/SKILL.md +63 -45
  27. package/skills/kmp-test-validator/bind.md +30 -36
  28. package/skills/kmp-test-validator/dependencies.yaml +101 -9
  29. package/skills/kmp-test-validator/output-contract.md +166 -0
  30. package/skills/kmp-test-validator/roles/validation-business-testing.md +83 -0
  31. package/skills/kmp-test-validator/roles/validation-code-gate.md +116 -0
  32. package/skills/kmp-test-validator/roles/validation-fidelity-gate.md +118 -0
  33. package/skills/kmp-test-validator/roles/validation-report.md +30 -16
  34. package/skills/kmp-test-validator/roles/validation-workspace-state.md +12 -4
  35. package/skills/kmp-test-validator/workflow.md +62 -97
  36. package/skills/migration-task-adapter/SKILL.md +67 -76
  37. package/skills/migration-task-adapter/bind.md +25 -89
  38. package/skills/migration-task-adapter/dependencies.yaml +21 -10
  39. package/skills/migration-task-adapter/roles/adapter-report.md +71 -0
  40. package/skills/migration-task-adapter/roles/adapter-workspace-state.md +71 -0
  41. package/skills/migration-task-adapter/roles/task-route-orchestrator.md +103 -0
  42. package/skills/migration-task-adapter/workflow.md +71 -143
  43. package/skills/android-project-analyst/MIGRATION.md +0 -53
  44. package/skills/android-to-kmp-migrator/MIGRATION.md +0 -104
  45. package/skills/android-to-kmp-migrator/roles/dependency-platform-gate.md +0 -63
  46. package/skills/android-to-kmp-migrator/roles/logic-implementation.md +0 -66
  47. package/skills/android-to-kmp-migrator/roles/migration-analysis-planning.md +0 -65
  48. package/skills/android-to-kmp-migrator/roles/presentation-integration.md +0 -65
  49. package/skills/android-to-kmp-migrator/roles/state-data-prep.md +0 -63
  50. package/skills/android-to-kmp-migrator/roles/ui-implementation.md +0 -64
  51. package/skills/kmp-test-validator/MIGRATION.md +0 -58
  52. package/skills/kmp-test-validator/roles/validation-intake-fidelity.md +0 -67
  53. package/skills/kmp-test-validator/roles/validation-plan-gate.md +0 -66
  54. package/skills/kmp-test-validator/roles/validation-remediation.md +0 -112
  55. package/skills/kmp-test-validator/roles/validation-test-runner.md +0 -61
  56. package/skills/migration-task-adapter/MIGRATION.md +0 -34
  57. package/skills/migration-task-adapter/roles/task-reporter.md +0 -129
  58. package/skills/migration-task-adapter/roles/task-understanding-router.md +0 -134
  59. package/skills/migration-task-adapter/roles/workflow-orchestrator.md +0 -140
  60. package/skills/migration-task-adapter/roles/workspace-state-discipline-inspector.md +0 -189
@@ -1,21 +1,82 @@
1
- # dependencies.yaml — Swarm Skill startup dependency check
1
+ # dependencies.yaml — Swarm Skill startup dependency check (android-to-kmp-migrator)
2
2
  #
3
- # Leader reads this file in SKILL.md Workflow Step 0 (pre-flight) and reports missing items.
4
- # Populated from Stage 2 auto-matching (local CLI scan): rg, git, curl found locally; the target
5
- # project's own Gradle wrapper drives builds (incremental-build-check selects a documented/discovered
6
- # command and returns blocked rather than inventing one). All entries are required: false — the team
7
- # degrades gracefully (built-in Grep/Read substitute for rg; resource downloads become resource_gaps
8
- # without curl; build check returns blocked without a trustworthy command).
3
+ # Leader reads this in Workflow Step 0 and records results in run_manifest.json
4
+ # dependency_preflight. All CLI entries are required: false.
5
+ # Android Studio MCP is optional auxiliary evidence for the KMP target — it never
6
+ # replaces durable node artifacts or upstream android-project-analyst package P6 inputs.
7
+ # Full KMP project compile/build is NOT a migrator dependency; kmp-test-validator owns that at package V0.
9
8
 
10
- skills: [] # Stage 2 auto-matching confirmed no local domain-specific skill matches for any role.
9
+ skills: [] # No local domain-specific skill packages required for active roles.
10
+
11
+ # Read-only upstream inputs (not MCP — verified at Step 1)
12
+ upstream_inputs:
13
+ - source: android-project-analyst
14
+ handoff_package: P6
15
+ required: true
16
+ purpose: |
17
+ Legacy understanding via analyst artifacts only: modules_index.json,
18
+ migration_assembly_basis.json, cross_module_* globals, module representations,
19
+ SPEC (prd/design/plan/verification). Migrator does not re-run full legacy analysis.
20
+
21
+ optional_mcp:
22
+ - server: jetbrains
23
+ required: false
24
+ used_by:
25
+ - Leader
26
+ - target-project-assistant
27
+ - migration-planning-gate
28
+ - migration-prep
29
+ - module-implementation
30
+ - global-migration-phase
31
+ - migration-verification
32
+ purpose: |
33
+ Optional indexed KMP target-project context from Android Studio / JetBrains IDE.
34
+ Typical tools: get_project_modules, get_project_dependencies, get_repositories,
35
+ find_files_by_glob, search_in_files_by_regex, get_symbol_info, get_file_problems.
36
+ Always pass projectPath = kmp_target_project_path (target project open in IDE).
37
+ Supports target layout survey, anchor-path discovery, reuse inventory, symbol ownership,
38
+ and integration glue placement. Legacy Android evidence comes from analyst P6 artifacts
39
+ and file-system reads — not from re-surveying legacy via MCP unless explicitly scoped.
40
+ MCP output is supporting evidence only; node JSON artifacts still require target source paths.
11
41
 
12
42
  tools:
13
43
  - name: rg
14
44
  required: false
15
- purpose: Fast source search across the Legacy and target projects for every node; built-in Grep/Read substitute if unavailable.
45
+ used_by:
46
+ - target-project-assistant
47
+ - migration-planning-gate
48
+ - migration-prep
49
+ - module-implementation
50
+ - module-node-review-fix
51
+ - global-migration-phase
52
+ - migration-verification
53
+ - completion-report
54
+ purpose: Fast search across Legacy source (read-only) and KMP target project. Built-in Grep/Read substitute if unavailable.
16
55
  - name: git
17
56
  required: false
18
- purpose: Inspect changed-file sets and diffs in the target project for review, guard, parity, and workspace-state nodes.
57
+ used_by:
58
+ - migration-workspace-state
59
+ - module-node-review-fix
60
+ - migration-verification
61
+ - completion-report
62
+ purpose: Changed-file sets, diffs, timestamps, and ownership evidence for ledger, review/fix, verification, and plan-vs-code gaps.
19
63
  - name: curl
20
64
  required: false
21
- purpose: Used by resource-migration to fetch concrete online resource URLs when alignment requires local copies; without it those resources are recorded as resource_gaps.
65
+ used_by:
66
+ - migration-prep
67
+ purpose: Fetch concrete online resource URLs for the presentation section of migration-prep; without curl, record resource_gaps.
68
+
69
+ # Target Gradle wrapper: path discovery reference only during migrator.
70
+ # migration-verification MUST NOT invoke assemble/test; kmp-test-validator uses the wrapper at V0.
71
+
72
+ degraded_modes:
73
+ - trigger: analyst P6 not ready
74
+ effect: blocked — do not dispatch migration nodes; repair upstream analyst handoff first
75
+ - trigger: rg missing
76
+ effect: Use built-in Grep/Read; record in run_manifest dependency_preflight
77
+ - trigger: git missing
78
+ effect: migration-workspace-state uses artifact timestamps only; stale detection less precise
79
+ - trigger: curl missing
80
+ effect: migration-prep records resource_gaps for remote media URLs
81
+ - trigger: jetbrains MCP missing or wrong open project
82
+ effect: TPA and planning-gate use file-system target evidence only; record MCP gap in migration_report or alignment_report
@@ -0,0 +1,318 @@
1
+ # Output Contract: File Recording System, Upstream Inputs, And Downstream Trigger Gates
2
+
3
+ This document is the **canonical path and content contract** for `android-to-kmp-migrator`. Downstream handlers (`kmp-test-validator`, `migration-task-adapter`) **MUST treat missing, empty, out-of-path, stale, or schema-invalid artifacts as hard blockers** — they do not infer from chat summaries.
4
+
5
+ The Leader and every node MUST read this file before writing artifacts. When `SKILL.md` or `workflow.md` diverge, **this file wins on paths, filenames, upstream inputs, and trigger gates**.
6
+
7
+ ## Upstream Input Contract (android-project-analyst)
8
+
9
+ Migration starts only when analyst handoff package **`P6`** (see `android-project-analyst/output-contract.md`) is ready. Required upstream paths (read-only inputs):
10
+
11
+ | Upstream artifact | Purpose for migrator |
12
+ |---|---|
13
+ | `analyst_output_root/run_manifest.json` | Source path, mode, analyst `handoff_package` |
14
+ | `analyst_output_root/module-index/modules_index.json` | Legacy `module_id` → folder/dimension paths |
15
+ | `analyst_output_root/module-index/module_inventory.json` | Module schedule, scopes, `depends_on` |
16
+ | `analyst_output_root/global/migration_assembly_basis.json` | Module assembly order, integration checkpoints |
17
+ | `analyst_output_root/global/cross_module_architecture.json` | Inter-module topology for global integration |
18
+ | `analyst_output_root/global/cross_module_data_logic.json` | Cross-module data/control links |
19
+ | `analyst_output_root/global/global_representation.json` | Full-project legacy synthesis |
20
+ | `analyst_output_root/SPEC/prd.md`, `design.md`, `plan.md`, `verification.md` | Product/design/plan baseline |
21
+
22
+ Per legacy `module_id`, migrator may consume:
23
+
24
+ - `modules/<module_id>/representation/module_representation.json`
25
+ - `modules/<module_id>/dimension_index.json`
26
+ - dimension JSON artifacts under `node-results/<dimension>/`
27
+
28
+ Record all resolved upstream paths in `run_manifest.json` → `upstream_analyst_artifacts`.
29
+
30
+ **Fail closed**: if analyst `handoff_gates.P6.ready` is false or paths are missing, migrator returns `blocked` — do not start module dispatch.
31
+
32
+ ---
33
+
34
+ ## Migration Output Root Layout
35
+
36
+ ```text
37
+ output_root = <output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator
38
+
39
+ <output_root>/
40
+ ├── run_manifest.json
41
+ ├── upstream-index/
42
+ │ └── upstream_analyst_index.json # resolved analyst paths + P6 gate snapshot
43
+ ├── module-index/
44
+ │ ├── migration_module_inventory.json
45
+ │ ├── migration_module_inventory.md
46
+ │ └── modules_migration_index.json # migration_module_id → paths + legacy module_id map
47
+ ├── global/
48
+ │ ├── node-results/
49
+ │ │ ├── migration-workspace-state/
50
+ │ │ │ ├── migration_workspace_state.json
51
+ │ │ │ └── migration_workspace_state.md
52
+ │ │ ├── target-project-assistant/
53
+ │ │ │ ├── target_project_assistant.json
54
+ │ │ │ ├── target_project_assistant.md
55
+ │ │ │ ├── target_alignment_revision.json
56
+ │ │ │ └── target_alignment_revision.md
57
+ │ │ └── global-migration-phase/
58
+ │ │ ├── integrate/
59
+ │ │ │ ├── global_system_integration.json
60
+ │ │ │ └── global_system_integration.md
61
+ │ │ └── align/
62
+ │ │ ├── post_integration_alignment.json
63
+ │ │ └── post_integration_alignment.md
64
+ │ ├── global_migration_representation.json
65
+ │ └── global_migration_representation.md
66
+ ├── modules/
67
+ │ └── <migration_module_id>/
68
+ │ ├── module_brief.json
69
+ │ ├── node-results/
70
+ │ │ ├── migration-workspace-state/ # per-module ledger slice
71
+ │ │ ├── target-project-assistant/ # per-module anchors (mode module_anchors)
72
+ │ │ ├── migration-planning-gate/
73
+ │ │ │ ├── migration_planning_gate.json
74
+ │ │ │ └── migration_planning_gate.md
75
+ │ │ ├── migration-prep/
76
+ │ │ │ ├── migration_prep.json
77
+ │ │ │ └── migration_prep.md
78
+ │ │ ├── module-implementation/
79
+ │ │ │ ├── ui/
80
+ │ │ │ │ ├── module_implementation_ui.json
81
+ │ │ │ │ └── module_implementation_ui.md
82
+ │ │ │ └── logic/
83
+ │ │ │ ├── module_implementation_logic.json
84
+ │ │ │ └── module_implementation_logic.md
85
+ │ │ ├── module-node-review-fix/
86
+ │ │ ├── migration-verification/
87
+ │ │ └── completion-report/
88
+ │ └── representation/
89
+ │ ├── module_migration_representation.json
90
+ │ ├── module_migration_representation.md
91
+ │ └── module_completion_record.json
92
+ └── report/
93
+ ├── alignment_report.json
94
+ ├── alignment_report.md
95
+ ├── migration_report.json
96
+ └── migration_report.md
97
+ ```
98
+
99
+ ### Path Variables
100
+
101
+ | Variable | Resolved path |
102
+ |---|---|
103
+ | `output_root` | `<output_dir or ~/.a2c_agents/migration>/android-to-kmp-migrator` |
104
+ | `upstream_index_dir` | `<output_root>/upstream-index` |
105
+ | `module_index_dir` | `<output_root>/module-index` |
106
+ | `module_root` | `<output_root>/modules/<migration_module_id>` |
107
+ | `node_result_dir` | `<module_root>/node-results/<node_id>` |
108
+ | `module_representation_dir` | `<module_root>/representation` |
109
+ | `global_dir` | `<output_root>/global` |
110
+ | `report_dir` | `<output_root>/report` |
111
+
112
+ ### Build Boundary (mandatory)
113
+
114
+ - **Migrator verification** runs **syntax/code structure checks** and **UI/logic restoration checks** against upstream analyst evidence. It does **NOT** compile or build the entire KMP project.
115
+ - **`incremental_build` is forbidden** in `migration-verification` during migrator runs.
116
+ - **Full compile/build/preview/behavioral tests** are delegated to **`kmp-test-validator`** after `migration_report.*` handoff package **`V0`** is ready.
117
+
118
+ ---
119
+
120
+ ## Write Order (Leader Schedule)
121
+
122
+ | Step | Gate | Required artifacts before next step |
123
+ |---|---|---|
124
+ | `MG0` | Run lock | `run_manifest.json`, `upstream-index/upstream_analyst_index.json` |
125
+ | `MG1` | Workspace init | global `migration_workspace_state.*` |
126
+ | `MG2` | Migration index | `migration_module_inventory.*`, `modules_migration_index.json`, per-module `module_brief.json` |
127
+ | `MG3` | Target baseline | global `target-project-assistant/*` (`mode: global_baseline`) + `target_alignment_revision.*` |
128
+ | `MG4` | Per-module anchors | per-module `target-project-assistant/target_module_anchors.json` |
129
+ | `MG5` | Per-module plan+gate | `migration-planning-gate/migration_planning_gate.*` |
130
+ | `MG6`–`MG10` | Per-module impl | prep → review/fix → module-implementation `ui` → review/fix → `logic` → review/fix |
131
+ | `MG11` | Module verify | `migration_verification.*` (no full build) + `module_completion_record.json` |
132
+ | `MG12` | Module rep | `module_migration_representation.*` |
133
+ | `MG13` | All modules done | every scheduled module passes `MG11`–`MG12` |
134
+ | `MG14` | Global integrate | `global-migration-phase/integrate/global_system_integration.*` |
135
+ | `MG15` | Global align | `global-migration-phase/align/post_integration_alignment.*`, `report/alignment_report.*` (read-only) |
136
+ | `MG16` | Global rep + report | `global_migration_representation.*`, `migration_report.*` |
137
+ | `MG17` | Validator handoff | invoke `kmp-test-validator` |
138
+
139
+ ---
140
+
141
+ ## Handoff Packages (Downstream Trigger Conditions)
142
+
143
+ ### Package `M0` — Migration run identity
144
+
145
+ | Required paths |
146
+ |---|
147
+ | `run_manifest.json` |
148
+ | `upstream-index/upstream_analyst_index.json` |
149
+ | global `migration_workspace_state.json` |
150
+
151
+ ### Package `M1` — Migration module routing
152
+
153
+ | Required paths |
154
+ |---|
155
+ | `migration_module_inventory.json` |
156
+ | `modules_migration_index.json` |
157
+
158
+ ### Package `M2` — Target alignment ready
159
+
160
+ | Required paths |
161
+ |---|
162
+ | Package `M1` |
163
+ | `global/node-results/target-project-assistant/target_alignment_revision.json` |
164
+ | per scheduled module: `node-results/target-project-assistant/target_module_anchors.json` |
165
+
166
+ ### Package `M3` — Module implementation complete (per `migration_module_id`)
167
+
168
+ | Required paths |
169
+ |---|
170
+ | Package `M2` for this module |
171
+ | `migration-planning-gate/migration_planning_gate.json` |
172
+ | `migration-prep/migration_prep.json` |
173
+ | `module-implementation/ui/module_implementation_ui.json`, `module-implementation/logic/module_implementation_logic.json` + approved reviews |
174
+ | `migration_verification.json` with all required `check_ids` passed |
175
+ | `module_completion_record.json` with `ui_restoration` and `logic_restoration` passed |
176
+
177
+ ### Package `M4` — All modules migrated
178
+
179
+ | Required paths |
180
+ |---|
181
+ | Package `M3` for every `migration_module_id` in `assembly_order` |
182
+ | all `module_migration_representation.json` files |
183
+
184
+ ### Package `M5` — Global system integrated
185
+
186
+ | Required paths |
187
+ |---|
188
+ | Package `M4` |
189
+ | `global/node-results/global-migration-phase/integrate/global_system_integration.json` |
190
+ | `global_migration_representation.json` |
191
+
192
+ ### Package `M6` — Post-integration alignment passed
193
+
194
+ | Required paths |
195
+ |---|
196
+ | Package `M5` |
197
+ | `global/node-results/global-migration-phase/align/post_integration_alignment.json` with `alignment_verdict: passed \| passed_with_assumptions` |
198
+ | `report/alignment_report.json` |
199
+
200
+ ### Package `V0` — kmp-test-validator entry (downstream)
201
+
202
+ | Required paths |
203
+ |---|
204
+ | Package `M6` |
205
+ | `report/migration_report.json` |
206
+ | `global_migration_representation.json` |
207
+ | analyst `SPEC/*` paths recorded in `run_manifest.json` |
208
+
209
+ **Fail closed**: `kmp-test-validator` MUST NOT start when `V0` is false. It owns full project build, preview, and behavioral tests.
210
+
211
+ ---
212
+
213
+ ## Key Artifact Content Requirements
214
+
215
+ ### `upstream_analyst_index.json`
216
+
217
+ ```json
218
+ {
219
+ "analyst_output_root": "",
220
+ "analyst_handoff_package": "P6",
221
+ "analyst_handoff_ready": true,
222
+ "modules_index_path": "",
223
+ "migration_assembly_basis_path": "",
224
+ "cross_module_architecture_path": "",
225
+ "cross_module_data_logic_path": "",
226
+ "global_representation_path": "",
227
+ "spec_paths": {},
228
+ "legacy_module_map": [{ "legacy_module_id": "", "migration_module_id": "" }]
229
+ }
230
+ ```
231
+
232
+ ### `modules_migration_index.json`
233
+
234
+ Machine lookup: `migration_module_id` → `legacy_module_id`, `module_output_root`, `upstream_module_representation_path`, `target_anchor_paths`, `completion_status`.
235
+
236
+ ### `target_alignment_revision.json` (Target-Project-Assistant)
237
+
238
+ `target_project_layout`, `reusable_components[]`, `anchor_points[]` (legacy scope → target path), `revised_alignment[]`, `integration_constraints[]`, `consultation_log[]`.
239
+
240
+ ### `target_module_anchors.json` (per module)
241
+
242
+ `migration_module_id`, `legacy_module_id`, `target_paths[]`, `anchor_points[]`, `reuse_decisions[]`, `alignment_revision_refs[]`.
243
+
244
+ ### `module_completion_record.json`
245
+
246
+ ```json
247
+ {
248
+ "migration_module_id": "",
249
+ "legacy_module_id": "",
250
+ "completion_status": "completed | needs_rerun | blocked",
251
+ "verification_ref": "",
252
+ "ui_restoration": { "status": "passed | failed", "gaps": [] },
253
+ "logic_restoration": { "status": "passed | failed", "gaps": [] },
254
+ "upstream_match": { "module_representation_path": "", "matched_claims": [], "missing_claims": [] },
255
+ "rerun_required": false,
256
+ "evidence_paths": []
257
+ }
258
+ ```
259
+
260
+ ### `migration_verification.json` — required `check_ids` (migrator only)
261
+
262
+ - `source_set` — files in allowed source sets
263
+ - `syntax_check` — Kotlin/syntax validity on changed files (static; no full project compile)
264
+ - `api_contract` — API/model shape vs planning + analyst data contracts
265
+ - `ui_render` — static UI surface check (Compose structure/resources; no full render pipeline build)
266
+ - `ui_restoration` — migrated UI coverage vs upstream `presentation_resource` + module representation
267
+ - `logic_restoration` — migrated logic coverage vs upstream `behavior_logic` + module representation
268
+
269
+ **Forbidden**: `incremental_build`, `full_project_compile`, `gradle_assemble`.
270
+
271
+ ### `global_system_integration.json`
272
+
273
+ `assembly_order`, `ui_transition_edges[]`, `control_logic_handoffs[]`, `data_call_edges[]`, `shared_contracts_applied[]`, `integration_changed_files[]`, evidence paths from analyst cross-module globals.
274
+
275
+ ### `post_integration_alignment.json` (analysis only — no target edits)
276
+
277
+ `alignment_verdict`, `module_alignment_results[]`, `global_alignment_results`, `omissions[]`, `poor_restoration[]`, `rerun_modules[]`, `comparison_evidence[]` (analyst path vs target path pairs).
278
+
279
+ ### `migration_planning_gate.json`
280
+
281
+ Combined `planning` (spec deltas, source-to-target map, tasks) and `dependency_platform` (capability map, platform boundaries) sections. Status `ready_for_implementation` when both complete.
282
+
283
+ ### `migration_prep.json`
284
+
285
+ Combined `presentation` (tokens, resources, routes) and `state_data` (state/models/API expectations) sections.
286
+
287
+ ### `module_implementation_ui.json` / `module_implementation_logic.json`
288
+
289
+ UI mode and logic mode outputs under `module-implementation/ui/` and `module-implementation/logic/` respectively.
290
+
291
+ ### `alignment_report.json`
292
+
293
+ Human/agent-readable synthesis of align mode; routes reruns to `migration_module_id` or `global-migration-phase integrate`.
294
+
295
+ ---
296
+
297
+ ## Leader Obligations
298
+
299
+ 1. Verify analyst package `P6` before `MG0` completes.
300
+ 2. Dispatch `target-project-assistant` for all target-project questions; other roles MUST reference TPA artifacts instead of re-analyzing target ad hoc.
301
+ 3. Write `module_completion_record.json` after each module passes `migration-verification`.
302
+ 4. Run `global-migration-phase` `integrate` only after package `M4`.
303
+ 5. Run `global-migration-phase` `align` only after integrate; **no code changes** in align mode.
304
+ 6. Dispatch only role IDs listed in [SKILL.md](SKILL.md).
305
+ 7. Set `handoff_gates` (`M0`–`M6`, `V0`) in workspace ledger and `migration_report.json`.
306
+ 8. Invoke `kmp-test-validator` only when `V0` is true.
307
+
308
+ ## Invalid Artifact Handling
309
+
310
+ | Condition | Action |
311
+ |---|---|
312
+ | Missing path | `blocked`, `reason: missing` |
313
+ | Empty file | `blocked`, `reason: empty` |
314
+ | Out of `output_root` | `blocked`, `reason: out_of_path` |
315
+ | Stale per workspace ledger | `needs_rerun`, name owner |
316
+ | `module_completion_record` failed | Re-enter module loop from routed node |
317
+ | `post_integration_alignment` omissions | Rerun listed modules or `global-migration-phase integrate` |
318
+ | Full build requested during migrator | Reject — route to `kmp-test-validator` |
@@ -24,6 +24,8 @@ Forbidden:
24
24
  - Do not fix implementation gaps.
25
25
  - Do not mark validation passed.
26
26
  - Do not run report mode when module/global representations are missing.
27
+ - Do not run report mode when package `M6` is false (`global-migration-phase align` / `alignment_report` missing or failed).
28
+ - Do not mark `ready_for_validation` when `handoff_gates.V0` is false.
27
29
 
28
30
  Mandatory:
29
31
  - Validate `mode`, `migration_module_id`, module/global representation paths, workspace state, and exact `output_dir`.
@@ -53,6 +55,13 @@ Mandatory:
53
55
 
54
56
  Shared return shape applies.
55
57
 
58
+ ## Output Files And Contents
59
+
60
+ - `completion_readiness.json`: machine-routable readiness artifact containing requirement coverage, migration invariants, module/global representation references when applicable, verification/review status, validation inputs readiness, rerun requests, and blockers.
61
+ - `completion_readiness.md`: agent-readable readiness handoff containing coverage tables, invariant checks, incomplete markers, rerun routing, blockers, and whether representation/report gates may proceed.
62
+ - `migration_report.json`: machine-routable final migration handoff containing migration scope, source/target paths, analyst_output_root, upstream_analyst_index, `handoff_gates` (`M0`–`M6`, `V0`), `handoff_package: V0`, module representations, global representation, `alignment_report` path, `global_system_integration` path, changed files by role, coverage summary, validation inputs for kmp-test-validator, `validation_deferred_to: kmp-test-validator`, limitations, blockers.
63
+ - `migration_report.md`: agent-readable final migration report for `kmp-test-validator` and follow-up agents, preserving exact artifact paths, changed-file ownership, validation handoff context, limitations, and blockers.
64
+
56
65
  ## Inline Persona for Teammate
57
66
 
58
67
  ```text
@@ -65,8 +74,8 @@ Report mode: consume module/global representations and write migration_report.js
65
74
  INPUTS: mode, migration_module_id, module_scope, raw user task, SPEC paths, module outputs or module/global representations, changed files, workspace state, output_dir.
66
75
 
67
76
  OUTPUTS:
68
- - readiness mode: completion_readiness.json/md
69
- - report mode: migration_report.json/md
77
+ - readiness mode: completion_readiness.json/md (coverage, invariants, review/verification status, rerun requests, blockers)
78
+ - report mode: migration_report.json/md (validation-ready handoff, representation paths, changed files, coverage, validation inputs)
70
79
 
71
80
  Return JSON only. Report mode can return ready_for_validation only after representation gates pass.
72
81
  ```
@@ -0,0 +1,87 @@
1
+ # Role: Global Migration Phase
2
+
3
+ ## Identity
4
+
5
+ > *"After all modules complete, I integrate the system then audit alignment — integrate edits, align read-only."*
6
+
7
+ You are the `global-migration-phase` node subagent. You merge **global system integration** and **post-integration alignment** with strict modes.
8
+
9
+ ## Modes
10
+
11
+ | Mode | When | May edit target? | Output |
12
+ |---|---|---|---|
13
+ | `integrate` | Package `M4` true | Yes — integration glue only | `global_system_integration.json` / `.md` |
14
+ | `align` | After `integrate` completes | **No** — analysis only | `post_integration_alignment.json` / `.md` + `report/alignment_report.*` |
15
+
16
+ ## Success Criteria
17
+
18
+ **Integrate mode**:
19
+ - Wire `ui_transition_edges`, `control_logic_handoffs`, `data_call_edges` from analyst cross-module globals.
20
+ - `integration_changed_files` limited to glue; route module gaps via `rerun_requests`.
21
+
22
+ **Align mode**:
23
+ - True comparison: analyst artifacts vs migrated target; `alignment_verdict` explicit.
24
+ - `rerun_modules[]` and `rerun_global_integration` when omissions found.
25
+ - Write `alignment_report.*` under `report_dir`.
26
+
27
+ ## Boundary
28
+
29
+ **Forbidden**:
30
+ - Do not combine `integrate` and `align` in one invocation.
31
+ - Align mode: no target or legacy edits, no full project build.
32
+ - Integrate mode: no full module reimplementation; no alignment comparison.
33
+
34
+ **Mandatory**:
35
+ - Integrate: `output_dir = <global_dir>/node-results/global-migration-phase/integrate`
36
+ - Align: primary output under `<global_dir>/node-results/global-migration-phase/align`; alignment report under `report_dir`
37
+
38
+ ## Output Schema (integrate)
39
+
40
+ ```json
41
+ {
42
+ "status": "completed | needs_rerun | blocked",
43
+ "node": "global-migration-phase",
44
+ "mode": "integrate",
45
+ "migration_module_id": "global",
46
+ "ui_transition_edges": [],
47
+ "control_logic_handoffs": [],
48
+ "data_call_edges": [],
49
+ "integration_changed_files": [],
50
+ "blocking_gaps": []
51
+ }
52
+ ```
53
+
54
+ ## Output Schema (align)
55
+
56
+ ```json
57
+ {
58
+ "status": "completed | needs_rerun | blocked",
59
+ "node": "global-migration-phase",
60
+ "mode": "align",
61
+ "alignment_verdict": "passed | passed_with_assumptions | failed",
62
+ "module_alignment_results": [],
63
+ "global_alignment_results": {},
64
+ "rerun_modules": [],
65
+ "rerun_global_integration": false,
66
+ "comparison_evidence": [],
67
+ "blocking_gaps": []
68
+ }
69
+ ```
70
+
71
+ ## Inline Persona for Teammate
72
+
73
+ ```text
74
+ ROLE: global-migration-phase node. Modes: integrate | align. NEVER combine.
75
+
76
+ INTEGRATE: wire cross-module UI transitions, control logic, data calls. Edit glue files only.
77
+ ALIGN: compare analyst vs migrated target. NO edits. Write alignment_report under report_dir.
78
+
79
+ INPUTS: mode, analyst globals, module representations, module_completion_records,
80
+ target_alignment_revision, kmp_target_project_path, global_system_integration (align mode), output_dir, report_dir.
81
+
82
+ OUTPUTS:
83
+ - integrate: global_system_integration.json/.md under .../global-migration-phase/integrate/
84
+ - align: post_integration_alignment.json/.md under .../align/ + alignment_report.json/.md under report/
85
+
86
+ Do NOT run full project build.
87
+ ```
@@ -0,0 +1,75 @@
1
+ # Role: Migration Planning Gate
2
+
3
+ ## Identity
4
+
5
+ > *"I turn legacy evidence and TPA anchors into one plan and one dependency/platform gate before any migration code changes."*
6
+
7
+ You are the `migration-planning-gate` node subagent. You merge **migration analysis planning** and **dependency/platform gating** for one `migration_module_id` in a single bounded pass.
8
+
9
+ ## Success Criteria
10
+
11
+ - `migration_planning_gate.json` and `migration_planning_gate.md` written under `output_dir`.
12
+ - **Planning section**: SPEC/raw-source deltas, source-to-target map (from TPA anchors), reuse inventory, ordered `implementation_tasks`.
13
+ - **Dependency/platform section**: capability map, minimal-change dependency decisions, platform boundaries, `ready_for_implementation` or `blocked`.
14
+ - No feature UI/logic implementation; build-config changes only when gate justifies them.
15
+
16
+ ## Boundary
17
+
18
+ **Forbidden**:
19
+ - Do not re-survey target project (consume `target-project-assistant` artifacts only).
20
+ - Do not implement UI, repositories, or business logic.
21
+ - Do not add dependencies for convenience.
22
+
23
+ **Mandatory**:
24
+ - Validate TPA paths, SPEC paths, `module_brief_path`, `output_dir`.
25
+ - Use `output_dir = <output_root>/modules/<migration_module_id>/node-results/migration-planning-gate`.
26
+ - Return `ready_for_implementation` only when both planning and gate sections are complete.
27
+
28
+ ## Output Schema
29
+
30
+ ```json
31
+ {
32
+ "status": "ready_for_implementation | blocked",
33
+ "node": "migration-planning-gate",
34
+ "migration_module_id": "",
35
+ "module_scope": {},
36
+ "output_root": "",
37
+ "output_dir": "",
38
+ "planning": {
39
+ "spec_deltas": [],
40
+ "source_to_target_map": [],
41
+ "resource_project_map": [],
42
+ "integration_scaffold": {},
43
+ "implementation_tasks": []
44
+ },
45
+ "dependency_platform": {
46
+ "capability_map": [],
47
+ "build_config_changes": [],
48
+ "platform_capabilities": [],
49
+ "implementation_constraints": []
50
+ },
51
+ "changed_files": [],
52
+ "blocking_gaps": []
53
+ }
54
+ ```
55
+
56
+ ## Output Path Contract
57
+
58
+ See [output-contract.md](../output-contract.md). Artifact basename: `migration_planning_gate.json` / `.md`.
59
+
60
+ ## Inline Persona for Teammate
61
+
62
+ ```text
63
+ ROLE: migration-planning-gate node. Merge planning + dependency/platform gate in ONE invocation.
64
+
65
+ PLANNING: SPEC deltas, source-to-target map from TPA anchors, ordered tasks. No target re-survey.
66
+ GATE: capability map, minimal-change deps, platform boundaries. ready_for_implementation or blocked.
67
+
68
+ INPUTS: migration_module_id, module_scope, module_brief_path, target_module_anchors_path,
69
+ target_alignment_revision_path, upstream module_representation, SPEC paths, target path,
70
+ allowed_files, allowed_source_sets, output_dir.
71
+
72
+ OUTPUTS: migration_planning_gate.json, migration_planning_gate.md
73
+
74
+ Return ready_for_implementation only when planning and gate sections are complete.
75
+ ```