@code-migration/wow-migrator 0.1.0
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.
- package/README.md +113 -0
- package/bin/kmp-skills.js +407 -0
- package/package.json +48 -0
- package/scripts/sync-skills.js +74 -0
- package/skills/android-project-analyst/MIGRATION.md +37 -0
- package/skills/android-project-analyst/SKILL.md +115 -0
- package/skills/android-project-analyst/bind.md +49 -0
- package/skills/android-project-analyst/dependencies.yaml +16 -0
- package/skills/android-project-analyst/roles/android-ecosystem.md +141 -0
- package/skills/android-project-analyst/roles/api-list.md +136 -0
- package/skills/android-project-analyst/roles/architecture-pattern.md +131 -0
- package/skills/android-project-analyst/roles/data-flow.md +143 -0
- package/skills/android-project-analyst/roles/logic-understand.md +154 -0
- package/skills/android-project-analyst/roles/resource-understand.md +151 -0
- package/skills/android-project-analyst/roles/ui-understand.md +136 -0
- package/skills/android-project-analyst/workflow.md +132 -0
- package/skills/android-to-kmp-migrator/MIGRATION.md +44 -0
- package/skills/android-to-kmp-migrator/SKILL.md +203 -0
- package/skills/android-to-kmp-migrator/bind.md +54 -0
- package/skills/android-to-kmp-migrator/dependencies.yaml +21 -0
- package/skills/android-to-kmp-migrator/roles/api-contract-parity.md +95 -0
- package/skills/android-to-kmp-migrator/roles/dataflow-logic-implementation.md +130 -0
- package/skills/android-to-kmp-migrator/roles/dependency-resolution.md +106 -0
- package/skills/android-to-kmp-migrator/roles/incremental-build-check.md +105 -0
- package/skills/android-to-kmp-migrator/roles/legacy-spec-delta-review.md +104 -0
- package/skills/android-to-kmp-migrator/roles/migration-alignment.md +119 -0
- package/skills/android-to-kmp-migrator/roles/migration-report.md +108 -0
- package/skills/android-to-kmp-migrator/roles/migration-workspace-state.md +100 -0
- package/skills/android-to-kmp-migrator/roles/module-node-migration-fix.md +111 -0
- package/skills/android-to-kmp-migrator/roles/module-node-migration-review.md +108 -0
- package/skills/android-to-kmp-migrator/roles/navigation-migration.md +104 -0
- package/skills/android-to-kmp-migrator/roles/platform-api-replacement.md +104 -0
- package/skills/android-to-kmp-migrator/roles/prd-completion-check.md +124 -0
- package/skills/android-to-kmp-migrator/roles/resource-migration.md +109 -0
- package/skills/android-to-kmp-migrator/roles/source-set-placement-guard.md +95 -0
- package/skills/android-to-kmp-migrator/roles/state-model-mapping.md +109 -0
- package/skills/android-to-kmp-migrator/roles/target-project-understand.md +118 -0
- package/skills/android-to-kmp-migrator/roles/theme-design-system-mapping.md +101 -0
- package/skills/android-to-kmp-migrator/roles/ui-mockup-implementation.md +121 -0
- package/skills/android-to-kmp-migrator/roles/ui-render-fidelity-check.md +100 -0
- package/skills/android-to-kmp-migrator/workflow.md +180 -0
- package/skills/kmp-test-validator/MIGRATION.md +43 -0
- package/skills/kmp-test-validator/SKILL.md +137 -0
- package/skills/kmp-test-validator/bind.md +53 -0
- package/skills/kmp-test-validator/dependencies.yaml +17 -0
- package/skills/kmp-test-validator/roles/android-kmp-fidelity-audit.md +102 -0
- package/skills/kmp-test-validator/roles/build-preview-gate.md +109 -0
- package/skills/kmp-test-validator/roles/kmp-validation-plan.md +108 -0
- package/skills/kmp-test-validator/roles/test-case-decomposition.md +103 -0
- package/skills/kmp-test-validator/roles/test-execution.md +104 -0
- package/skills/kmp-test-validator/roles/validation-input-contract.md +111 -0
- package/skills/kmp-test-validator/roles/validation-remediation.md +112 -0
- package/skills/kmp-test-validator/roles/validation-report.md +114 -0
- package/skills/kmp-test-validator/roles/validation-workspace-state.md +102 -0
- package/skills/kmp-test-validator/workflow.md +151 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Workflow: Legacy Android source → verified node artifacts → SPEC package
|
|
2
|
+
|
|
3
|
+
This Swarm Skill is **Mixed B+C**: a parallel decomposition (Stage A foundation nodes) feeding a specialization pipeline with hard handoff gates (Stage B resource/data-flow, Stage C logic), integrated by the Leader (`android-project-analyst` controller) into the SPEC package. Each node owns a disjoint analysis slice; the Leader never does node work and never invents claims that no node traced to source.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph TD
|
|
9
|
+
L0[Leader: Step 0 dependency pre-flight] --> L1[Leader: Step 1 trigger + mode + shared brief]
|
|
10
|
+
L1 --> G0{Android evidence + valid scope?}
|
|
11
|
+
G0 -- No --> STOP[Stop: explain failed check / recommend Explore]
|
|
12
|
+
G0 -- Yes --> S1{Input scale OK?}
|
|
13
|
+
S1 -- "Over-scale (see bind.md)" --> DEG[Degraded mode<br/>narrow scope / fewer nodes]
|
|
14
|
+
S1 -- Yes --> F1[ui-understand]
|
|
15
|
+
S1 -- Yes --> F2[architecture-pattern]
|
|
16
|
+
S1 -- Yes --> F3[android-ecosystem]
|
|
17
|
+
S1 -- Yes --> F4[api-list]
|
|
18
|
+
F1 --> GA{Foundation outputs verified?}
|
|
19
|
+
F2 --> GA
|
|
20
|
+
F3 --> GA
|
|
21
|
+
F4 --> GA
|
|
22
|
+
GA -- "missing/empty/!=completed" --> RR1[Re-dispatch failed node<br/>with failure reason]
|
|
23
|
+
RR1 --> GA
|
|
24
|
+
GA -- Yes --> D1[resource-understand]
|
|
25
|
+
GA -- Yes --> D2[data-flow]
|
|
26
|
+
D1 --> GB{Dependent outputs verified?}
|
|
27
|
+
D2 --> GB
|
|
28
|
+
GB -- fail --> RR2[Re-dispatch failed node]
|
|
29
|
+
RR2 --> GB
|
|
30
|
+
GB -- Yes --> C1[logic-understand]
|
|
31
|
+
C1 --> GC{Logic output verified?}
|
|
32
|
+
GC -- fail --> RR3[Re-dispatch logic-understand]
|
|
33
|
+
RR3 --> GC
|
|
34
|
+
GC -- Yes --> INT[Leader: Step 5 reconcile + coverage/evidence matrix]
|
|
35
|
+
DEG --> INT
|
|
36
|
+
INT --> OUT[Leader: Step 6 write SPEC + verification verdict]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Detailed Steps
|
|
40
|
+
|
|
41
|
+
### Step 0 — Pre-flight: dependency check
|
|
42
|
+
|
|
43
|
+
- **Executor**: Leader (`android-project-analyst` controller)
|
|
44
|
+
- **Input**: [dependencies.yaml](dependencies.yaml)
|
|
45
|
+
- **Action**: verify each `tools[]` entry (`rg`, `curl`) is available; built-in Grep/Read substitute when `rg` is absent. Resource downloads degrade to `download_gaps` when `curl` is absent.
|
|
46
|
+
- **Output**: pre-flight note to the user
|
|
47
|
+
- **Quality gate**: all deps are `required: false` → the run proceeds even if missing; user is informed of any degraded mode. The Leader does NOT auto-skip nodes.
|
|
48
|
+
|
|
49
|
+
### Step 1 — Trigger verification + mode selection + shared brief
|
|
50
|
+
|
|
51
|
+
- **Executor**: Leader
|
|
52
|
+
- **Input**: `source_project_path`, optional `analysis_scope` / `mode` / `target_project_path` / `output_dir` / `language`, optional `jetbrains` MCP context
|
|
53
|
+
- **Action**: verify the target is an Android project (`AndroidManifest.xml`, `settings.gradle(.kts)`, `build.gradle(.kts)`, or a `com.android.*` module) and that the request needs structured analysis, not a one-off lookup. Select `exploration` or `migration`. Build a minimal shared brief (confirmed paths, scope, output root, Android evidence, module/build files, optional MCP evidence, known constraints).
|
|
54
|
+
- **Output**: announced mode banner + shared brief; default `output_dir` = `~/.a2c_agents/understand/` (SPEC under `<output_dir>/SPEC`, node artifacts under `<output_dir>/node-results/<node>`)
|
|
55
|
+
- **Serial / Parallel**: serial (precedes all dispatch)
|
|
56
|
+
- **Quality gate**: Android evidence present AND scope valid → proceed; otherwise STOP and explain the failed check (recommend a generic exploration agent for simple lookups). Migration mode without `target_project_path` → ask before producing `plan.md`.
|
|
57
|
+
|
|
58
|
+
### Step 2 — Stage A: dispatch foundation nodes (parallel, B-pattern)
|
|
59
|
+
|
|
60
|
+
- **Executor**: `ui-understand`, `architecture-pattern`, `android-ecosystem`, `api-list`
|
|
61
|
+
- **Input**: per-node contract `{ source_project_path, analysis_scope, mode, shared_brief, skill_spec_path (roles/<id>.md), output_dir: <output_dir>/node-results/<node>, return_format: json }`; `api-list` may also receive `ui_entry_points`
|
|
62
|
+
- **Action**: each node validates inputs, performs its bounded slice, writes its JSON+MD artifacts, and returns the controller JSON shape
|
|
63
|
+
- **Output**: `ui_understanding.*`, `architecture_pattern.*`, `android_ecosystem.*`, `api_list.*`
|
|
64
|
+
- **Serial / Parallel**: parallel — all four run together (slices are dispatch-time fixed, not negotiated)
|
|
65
|
+
- **Quality gate**: each return must be `status: "completed"` with `output_files` that exist and are non-empty. On missing/empty/non-`completed` output → re-dispatch that node with the same contract plus the failure reason (retry policy in [bind.md](bind.md) § Failure Handling). Do NOT synthesize around a failed node.
|
|
66
|
+
|
|
67
|
+
### Step 3 — Stage B: dispatch resource + data-flow nodes (gated handoff, C-pattern)
|
|
68
|
+
|
|
69
|
+
- **Executor**: `resource-understand`, `data-flow`
|
|
70
|
+
- **Input**: Stage A verified output paths. `resource-understand` receives optional `ui_understanding_path` / `api_list_path` / `android_ecosystem_path`; `data-flow` receives required `api_list_path` + optional `architecture_pattern_path` / `android_ecosystem_path` / `ui_understanding_path`
|
|
71
|
+
- **Action**: `resource-understand` maps local + online resources and safely downloads concrete URLs into `<output_dir>/node-results/resource-understand/downloaded_resources/`; `data-flow` traces sources→repositories→streams→UI state, aligning API IDs to `api_list`
|
|
72
|
+
- **Output**: `resource_understanding.*`, `data_flow.*`
|
|
73
|
+
- **Serial / Parallel**: starts only after Stage A gate passes; the two nodes may run in parallel with each other
|
|
74
|
+
- **Quality gate**: same return-shape + output-file checks as Step 2. If a node needs upstream data that is missing/stale, it returns `needs_rerun`/`blocked` rather than rebuilding another node's catalog.
|
|
75
|
+
|
|
76
|
+
### Step 4 — Stage C: dispatch logic node (final pipeline stage)
|
|
77
|
+
|
|
78
|
+
- **Executor**: `logic-understand`
|
|
79
|
+
- **Input**: required `ui_understanding_path`, `architecture_pattern_path`, `android_ecosystem_path`, `api_list_path`, `data_flow_path`
|
|
80
|
+
- **Action**: synthesize user-action / lifecycle / state-machine / business-rule behavior, referencing (not rebuilding) upstream catalogs
|
|
81
|
+
- **Output**: `logic_understanding.*`
|
|
82
|
+
- **Serial / Parallel**: serial — runs last, after Stage B gate passes
|
|
83
|
+
- **Quality gate**: return-shape + output-file checks; every major UI module from `ui_understanding_path` has logic coverage or an explicit reason for none.
|
|
84
|
+
|
|
85
|
+
### Step 5 — Integrate: reconcile verified outputs
|
|
86
|
+
|
|
87
|
+
- **Executor**: Leader
|
|
88
|
+
- **Input**: all verified node JSON/MD outputs
|
|
89
|
+
- **Action**: integrate ONLY from verified outputs. Prefer evidence with exact source paths. Mark cross-node conflicts that affect architecture/data-flow/ecosystem/migration as `Needs confirmation`. Build a **coverage matrix** (screen/module → UI → architecture role → APIs/data sources → resource usage → data flows → logic flows → ecosystem constraints) and an **evidence index** (claim → node output → source paths → confidence `verified|inferred|assumed|unknown`).
|
|
90
|
+
- **Output**: reconciled coverage matrix + evidence index (in-memory, feeds Step 6)
|
|
91
|
+
- **Serial / Parallel**: serial
|
|
92
|
+
- **Quality gate**: no unknowns hidden — every unresolved item lands in SPEC risks/assumptions or `Needs confirmation`.
|
|
93
|
+
|
|
94
|
+
### Step 6 — Final: write SPEC package + emit completion report
|
|
95
|
+
|
|
96
|
+
- **Executor**: Leader
|
|
97
|
+
- **Input**: coverage matrix + evidence index from Step 5
|
|
98
|
+
- **Action**: write SPEC artifacts under `<output_dir>/SPEC`. **Exploration** mode → `prd.md`, `design.md`, `verification.md`. **Migration** mode → adds `plan.md`. SPEC must synthesize, not paste node summaries; every important claim maps to node output + source path or is marked assumption/gap. `design.md` sections include a Mermaid diagram, structured table, or evidence mapping; architecture/UI-navigation/data-flow/cross-module sections include diagrams when evidence exists.
|
|
99
|
+
- **Output**: SPEC files + the completion report below
|
|
100
|
+
|
|
101
|
+
#### Final Report Format
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"status": "completed",
|
|
106
|
+
"mode": "exploration | migration",
|
|
107
|
+
"source_project_path": "...",
|
|
108
|
+
"target_project_path": "... or null",
|
|
109
|
+
"node_outputs": {
|
|
110
|
+
"ui_understand": ["..."],
|
|
111
|
+
"architecture_pattern": ["..."],
|
|
112
|
+
"android_ecosystem": ["..."],
|
|
113
|
+
"api_list": ["..."],
|
|
114
|
+
"resource_understand": ["..."],
|
|
115
|
+
"data_flow": ["..."],
|
|
116
|
+
"logic_understand": ["..."]
|
|
117
|
+
},
|
|
118
|
+
"spec_outputs": ["..."],
|
|
119
|
+
"readiness": "ready | ready_with_assumptions | blocked",
|
|
120
|
+
"blocking_gaps": []
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Acceptance Criteria
|
|
125
|
+
|
|
126
|
+
- All dispatched nodes returned outputs matching their role `## Output Schema` (no malformed returns); any `[ROLE MISSING]` is recorded per [bind.md](bind.md).
|
|
127
|
+
- All required node artifacts exist and are non-empty; all required SPEC artifacts for the selected mode exist and are non-empty.
|
|
128
|
+
- **Coverage check (B-pattern)**: every Stage A slice is accounted for — screens from `ui-understand` are represented in `design.md` or marked out of scope; APIs from `api-list` appear or are marked unknown; local/online resources from `resource-understand` appear or are marked unknown.
|
|
129
|
+
- **Gate check (C-pattern)**: Stage B ran only after Stage A verification; Stage C ran only after Stage B verification; every kicked-back node is recorded.
|
|
130
|
+
- Data-flow and logic-flow names align across `design.md`, `plan.md`, and `verification.md`.
|
|
131
|
+
- `verification.md` carries a readiness verdict (`ready | ready_with_assumptions | blocked`); if `blocked`, the final response lists blockers and exact missing evidence.
|
|
132
|
+
- No artifact claims certainty for unknown or dynamic code paths.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Conversion Note: `android-to-kmp-migrator` → Swarm Skill
|
|
2
|
+
|
|
3
|
+
Converted from a single controller-support skill (a flat SKILL.md node registry plus 20 sibling node-spec files) into a compliant **Swarm Skill** using `swarmskill-creator` convert mode.
|
|
4
|
+
|
|
5
|
+
## Source structure (before)
|
|
6
|
+
|
|
7
|
+
- `SKILL.md` — node registry: node table, required dispatch order (13 controller steps), shared input contract, shared return shape, and shared rules.
|
|
8
|
+
- 20 flat node specs at the skill root, each with Role / Inputs / Mandatory Input Validation & Output Storage / Specific Task / Do-not list / Required Outputs (JSON schema) / Shared Return Shape / Return Shape.
|
|
9
|
+
|
|
10
|
+
## What was lost in the pre-swarm form
|
|
11
|
+
|
|
12
|
+
The registry separated controller from nodes and even encoded the staged dispatch order, but it did not encode the team as a first-class artifact: no per-role anti-convergence mottos, no `Forbidden`/`Mandatory` boundary blocks the validator could check, no pasteable `Inline Persona` (each of the 20 dispatches re-derived its contract by hand), no Mermaid topology making the pipeline + parallel fan-outs + review→fix loops explicit, and no resource/behavioral guardrails (parallel cap, token/wall-clock budgets, `max_review_fix_cycles`, degraded modes). Stage gates and the single-project / dependency-gate invariants lived only in prose.
|
|
13
|
+
|
|
14
|
+
## Decomposition
|
|
15
|
+
|
|
16
|
+
- **Pattern: C (specialization pipeline) + embedded B (parallel fan-outs) + review→fix loops.**
|
|
17
|
+
- Serial analysis chain: `legacy-spec-delta-review` → `target-project-understand` → `migration-alignment`.
|
|
18
|
+
- Hard gate: `dependency-resolution` (minimal-change) before any implementation.
|
|
19
|
+
- Parallel prep (B): `theme-design-system-mapping`, `resource-migration`, `navigation-migration`, `platform-api-replacement`, `state-model-mapping`.
|
|
20
|
+
- Sequential implementation: `ui-mockup-implementation` before `dataflow-logic-implementation`.
|
|
21
|
+
- Review→fix loop after any file-changing node: `module-node-migration-review` ↔ `module-node-migration-fix`.
|
|
22
|
+
- Parallel verify (B): `source-set-placement-guard`, `api-contract-parity`, `ui-render-fidelity-check`, `incremental-build-check`.
|
|
23
|
+
- Completion + report: `prd-completion-check` → `migration-report` → `kmp-test-validator` handoff.
|
|
24
|
+
- Cross-cutting: `migration-workspace-state` ledger refreshed after major completions.
|
|
25
|
+
- **Disjointness check: PASS.** Each node owns a distinct slice (state ledger vs SPEC delta vs target understanding vs alignment vs dependency gate vs theme vs resource vs navigation vs platform vs state/model vs UI vs logic vs review vs fix vs source-set guard vs API parity vs render vs build vs completion vs report). `module-node-migration-review` and `-fix` are intentionally complementary (read-only judge vs scoped editor) and gated as a loop, not overlapping.
|
|
26
|
+
|
|
27
|
+
## Content port map
|
|
28
|
+
|
|
29
|
+
| Source node-spec content | Ported to |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `## Role` first paragraph | role `## Identity` (rewritten as a 1-line motto + context) |
|
|
32
|
+
| `## Specific Task` numbered steps | role `## Inline Persona for Teammate` HANDLER |
|
|
33
|
+
| `## Mandatory Input Validation And Output Storage` | role `## Boundary > Mandatory` + Inline Persona CONTROL block |
|
|
34
|
+
| `Do not:` lists + sibling routing | role `## Boundary > Forbidden` |
|
|
35
|
+
| `## Required Outputs` JSON schema | role `## Output Schema` + Inline Persona OUTPUTS |
|
|
36
|
+
| `## Return Shape` + shared return | role Inline Persona RETURN TO CONTROLLER + SKILL.md § Shared Return Shape |
|
|
37
|
+
| Required dispatch order (13 steps) | `workflow.md` staged steps + Mermaid + gates |
|
|
38
|
+
| Mandatory node contract enforcement + shared rules | `bind.md` § Behavioral Constraints + SKILL.md § Shared Rules |
|
|
39
|
+
| Shared return status semantics + controller handling | SKILL.md § Shared Return Shape |
|
|
40
|
+
| Optional Android Studio MCP context | SKILL.md § Optional Android Studio MCP Context + per-role Inline Persona MCP inputs |
|
|
41
|
+
|
|
42
|
+
## Team-vs-single delta
|
|
43
|
+
|
|
44
|
+
The conversion preserves every source contract while adding: explicit pipeline + parallel + loop topology with verifiable gates, per-role anti-overlap boundaries that name siblings, self-contained pasteable personas (no re-derivation per dispatch across 20 nodes), resource/token/wall-clock budgets plus a `max_review_fix_cycles` bound, failure-routing rules, and concrete degraded modes for large monorepos and missing tooling. The same-name controller subagent in `kmp-migration/agents/android-to-kmp-migrator.md` is unchanged in behavior; its node table now points at `roles/<id>.md`.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: android-to-kmp-migrator
|
|
3
|
+
description: |
|
|
4
|
+
20-role pipeline Swarm Skill (C+B) that migrates Legacy Android into an existing KMP target project: analysis, dependency gate, parallel prep, UI-then-logic implementation, review→fix loops, verification, and a migration report.
|
|
5
|
+
Use with the android-to-kmp-migrator controller to port Android UI, resources, navigation, state, and logic into one KMP project, then hand to kmp-test-validator.
|
|
6
|
+
Do NOT use for Legacy Android analysis, KMP-only feature work, quick lookups, or non-migration refactors.
|
|
7
|
+
version: "0.2"
|
|
8
|
+
kind: swarm-skill
|
|
9
|
+
disable-model-invocation: true
|
|
10
|
+
roles:
|
|
11
|
+
- id: migration-workspace-state
|
|
12
|
+
kind: ai_agent
|
|
13
|
+
purpose: State ledger — node status, changed-file ownership, stale outputs, rerun/blocker history, next actions. No code analysis or edits.
|
|
14
|
+
skills: []
|
|
15
|
+
tools: [git]
|
|
16
|
+
- id: legacy-spec-delta-review
|
|
17
|
+
kind: ai_agent
|
|
18
|
+
purpose: Cross-check Legacy SPEC vs raw source for missing coverage and contradictions; classify and route deltas. Raw source wins.
|
|
19
|
+
skills: []
|
|
20
|
+
tools: [rg]
|
|
21
|
+
- id: target-project-understand
|
|
22
|
+
kind: ai_agent
|
|
23
|
+
purpose: First migration node — verify KMP target, capture baseline env, detect relevant sub-module, build reuse inventory and constraints.
|
|
24
|
+
skills: []
|
|
25
|
+
tools: [rg]
|
|
26
|
+
- id: migration-alignment
|
|
27
|
+
kind: ai_agent
|
|
28
|
+
purpose: Build source-to-target map, integration scaffold, and ordered implementation tasks; record SPEC/Design/Plan deltas. No implementation.
|
|
29
|
+
skills: []
|
|
30
|
+
tools: [rg]
|
|
31
|
+
- id: dependency-resolution
|
|
32
|
+
kind: ai_agent
|
|
33
|
+
purpose: Minimal-change build gate — map capabilities to baseline/reuse, justify any build-config change. Returns dependency readiness.
|
|
34
|
+
skills: []
|
|
35
|
+
tools: [rg]
|
|
36
|
+
- id: theme-design-system-mapping
|
|
37
|
+
kind: ai_agent
|
|
38
|
+
purpose: Map Legacy visual tokens to target design-system tokens/components, reuse-first; produce UI guidance and visual gaps.
|
|
39
|
+
skills: []
|
|
40
|
+
tools: [rg]
|
|
41
|
+
- id: resource-migration
|
|
42
|
+
kind: ai_agent
|
|
43
|
+
purpose: Migrate or model local & online resources into target KMP conventions, preserving semantics; record resource gaps.
|
|
44
|
+
skills: []
|
|
45
|
+
tools: [rg, curl]
|
|
46
|
+
- id: navigation-migration
|
|
47
|
+
kind: ai_agent
|
|
48
|
+
purpose: Migrate routes, parameters, back behavior, deep links, and result passing into target navigation; record route gaps.
|
|
49
|
+
skills: []
|
|
50
|
+
tools: [rg]
|
|
51
|
+
- id: platform-api-replacement
|
|
52
|
+
kind: ai_agent
|
|
53
|
+
purpose: Replace Android-only APIs with target-safe abstractions or expect/actual; keep Android-only code out of commonMain.
|
|
54
|
+
skills: []
|
|
55
|
+
tools: [rg]
|
|
56
|
+
- id: state-model-mapping
|
|
57
|
+
kind: ai_agent
|
|
58
|
+
purpose: Map state holders and DTO/domain/UI models to target structures, preserving state semantics; hand off to the logic node.
|
|
59
|
+
skills: []
|
|
60
|
+
tools: [rg]
|
|
61
|
+
- id: ui-mockup-implementation
|
|
62
|
+
kind: ai_agent
|
|
63
|
+
purpose: Implement migrated UI layout/components/states/resources first in the target project; expose binding surfaces. No business logic.
|
|
64
|
+
skills: []
|
|
65
|
+
tools: [rg]
|
|
66
|
+
- id: dataflow-logic-implementation
|
|
67
|
+
kind: ai_agent
|
|
68
|
+
purpose: Implement architecture, data flow, API integration, navigation effects, lifecycle, and business logic bound to UI surfaces.
|
|
69
|
+
skills: []
|
|
70
|
+
tools: [rg]
|
|
71
|
+
- id: module-node-migration-review
|
|
72
|
+
kind: ai_agent
|
|
73
|
+
purpose: Read-only review of one migration slice for contract/scope/parity/conventions/handoff; classify and route must-fix findings.
|
|
74
|
+
skills: []
|
|
75
|
+
tools: [rg, git]
|
|
76
|
+
- id: module-node-migration-fix
|
|
77
|
+
kind: ai_agent
|
|
78
|
+
purpose: Apply assigned must-fix findings inside allowed files only; preserve conventions; require mandatory re-review.
|
|
79
|
+
skills: []
|
|
80
|
+
tools: [rg, git]
|
|
81
|
+
- id: source-set-placement-guard
|
|
82
|
+
kind: ai_agent
|
|
83
|
+
purpose: Verify KMP source-set placement; catch Android-only APIs in shared code and missing/duplicate actuals; route violations.
|
|
84
|
+
skills: []
|
|
85
|
+
tools: [rg, git]
|
|
86
|
+
- id: api-contract-parity
|
|
87
|
+
kind: ai_agent
|
|
88
|
+
purpose: Diff migrated KMP API contracts vs Legacy API/data evidence; classify and route mismatches. No fixes.
|
|
89
|
+
skills: []
|
|
90
|
+
tools: [rg]
|
|
91
|
+
- id: ui-render-fidelity-check
|
|
92
|
+
kind: ai_agent
|
|
93
|
+
purpose: Verify migrated screens render and cover visual states/resources/theme; route UI failures. Static coverage when no render command.
|
|
94
|
+
skills: []
|
|
95
|
+
tools: [rg]
|
|
96
|
+
- id: incremental-build-check
|
|
97
|
+
kind: ai_agent
|
|
98
|
+
purpose: Run the smallest trustworthy target build/check; parse failures and route to responsible nodes. Early gate, not final validation.
|
|
99
|
+
skills: []
|
|
100
|
+
tools: [git]
|
|
101
|
+
- id: prd-completion-check
|
|
102
|
+
kind: ai_agent
|
|
103
|
+
purpose: Judge readiness vs PRD/raw task/SPEC/node outputs and invariants; emit node-routed rerun requests or ready_for_validation.
|
|
104
|
+
skills: []
|
|
105
|
+
tools: [rg, git]
|
|
106
|
+
- id: migration-report
|
|
107
|
+
kind: ai_agent
|
|
108
|
+
purpose: Synthesize final migration report and validation inputs for kmp-test-validator; ready_for_validation only when completion is ready.
|
|
109
|
+
skills: []
|
|
110
|
+
tools: [git]
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
# Android To KMP Migrator Swarm Skill
|
|
114
|
+
|
|
115
|
+
This is the agent-facing registry and team definition for the `android-to-kmp-migrator` controller (the same-name subagent in `kmp-migration/agents/`). It converts a Legacy Android SPEC plus an existing KMP target project into migrated, validation-ready KMP code.
|
|
116
|
+
|
|
117
|
+
The team is a **specialization pipeline (C) with embedded parallel fan-outs (B) and review→fix loops**: a serial analysis chain feeds a dependency gate, then a parallel prep stage, then UI-before-logic implementation, then parallel verification, completion check, and report. A single agent attempting the whole migration blurs the hard stage boundaries — it implements logic before the UI surface exists, skips the dependency minimal-change gate, lets Android-only APIs leak into `commonMain`, and self-approves its own work. Isolating each concern into an owned node with hard handoff gates and a mandatory review→fix→re-review loop keeps every change scoped, traceable, and reviewed before downstream nodes consume it. The controller (Leader) owns routing, contract enforcement, rerun handling, and the `kmp-test-validator` handoff; nodes own bounded target-understanding and implementation work.
|
|
118
|
+
|
|
119
|
+
## Workflow
|
|
120
|
+
|
|
121
|
+
The full playbook (Mermaid topology, per-step gates, review→fix loop, failure routing, Final Report format) is in [workflow.md](workflow.md). Protocol summary:
|
|
122
|
+
|
|
123
|
+
0. **Pre-flight: check dependencies** — read [dependencies.yaml](dependencies.yaml) and verify `rg` / `git` / `curl` (all `required: false`; the target Gradle wrapper drives builds). Report status; **user decides** whether to proceed.
|
|
124
|
+
1. **Trigger + shared brief + workspace state** — Leader confirms the migration trigger and Legacy SPEC context, builds the shared brief, and initializes `migration-workspace-state`. Default `output_dir` = `~/.a2c_agents/migration/`.
|
|
125
|
+
2. **Analysis chain (serial)** — `legacy-spec-delta-review` → `target-project-understand` (must confirm KMP, else `blocked`) → `migration-alignment`.
|
|
126
|
+
3. **Dependency gate** — `dependency-resolution` must return `ready_for_implementation` before any implementation node runs (minimal-change gate; see [bind.md](bind.md)).
|
|
127
|
+
4. **Stage Prep (parallel)** — `theme-design-system-mapping`, `resource-migration`, `navigation-migration`, `platform-api-replacement`, `state-model-mapping`.
|
|
128
|
+
5. **Review→fix loop** — after any file-changing node: `module-node-migration-review` → `module-node-migration-fix` (if `needs_fix`) → mandatory re-review, until `approved`.
|
|
129
|
+
6. **UI implementation** — `ui-mockup-implementation` (before logic), then the review→fix loop.
|
|
130
|
+
7. **Dataflow/logic implementation** — `dataflow-logic-implementation`, then the review→fix loop.
|
|
131
|
+
8. **Stage Verify (parallel)** — `source-set-placement-guard`, `api-contract-parity`, `ui-render-fidelity-check`, `incremental-build-check`; failures route back to the responsible node.
|
|
132
|
+
9. **Completion check** — `prd-completion-check` → `ready_for_validation`, `needs_rerun` (route to nodes), or `blocked`.
|
|
133
|
+
10. **Final: migration report** — `migration-report` returns `ready_for_validation` only when completion is ready; the Leader then invokes `kmp-test-validator`. Leader routes failures verbatim, never mediates.
|
|
134
|
+
|
|
135
|
+
## Roles
|
|
136
|
+
|
|
137
|
+
Each node is dispatched as a subagent that must read its role file (`skill_spec_path`), paste its `## Inline Persona for Teammate` into the dispatch prompt, and execute only that role's bounded slice. The dispatch order enforces upstream→downstream data availability and the review→fix gates.
|
|
138
|
+
|
|
139
|
+
| id | Purpose | When dispatched | Key dependencies | Role file |
|
|
140
|
+
|---|---|---|---|---|
|
|
141
|
+
| migration-workspace-state | State ledger / stale-output tracking | Step 1 + refreshed after major completions | git | [roles/migration-workspace-state.md](roles/migration-workspace-state.md) |
|
|
142
|
+
| legacy-spec-delta-review | SPEC-vs-source delta review | Step 2 (serial) | rg | [roles/legacy-spec-delta-review.md](roles/legacy-spec-delta-review.md) |
|
|
143
|
+
| target-project-understand | Target KMP understanding + reuse inventory | Step 2 (serial) | rg | [roles/target-project-understand.md](roles/target-project-understand.md) |
|
|
144
|
+
| migration-alignment | Source-to-target map + ordered tasks | Step 2 (serial) | rg | [roles/migration-alignment.md](roles/migration-alignment.md) |
|
|
145
|
+
| dependency-resolution | Minimal-change dependency gate | Step 3 (gate) | rg | [roles/dependency-resolution.md](roles/dependency-resolution.md) |
|
|
146
|
+
| theme-design-system-mapping | Visual token mapping | Step 4 (parallel prep) | rg | [roles/theme-design-system-mapping.md](roles/theme-design-system-mapping.md) |
|
|
147
|
+
| resource-migration | Local & online resource migration | Step 4 (parallel prep) | rg, curl | [roles/resource-migration.md](roles/resource-migration.md) |
|
|
148
|
+
| navigation-migration | Route/param/back/deep-link migration | Step 4 (parallel prep) | rg | [roles/navigation-migration.md](roles/navigation-migration.md) |
|
|
149
|
+
| platform-api-replacement | Android-only API → expect/actual | Step 4 (parallel prep) | rg | [roles/platform-api-replacement.md](roles/platform-api-replacement.md) |
|
|
150
|
+
| state-model-mapping | State holder & model mapping | Step 4 (parallel prep) | rg | [roles/state-model-mapping.md](roles/state-model-mapping.md) |
|
|
151
|
+
| ui-mockup-implementation | UI surface implementation (first) | Step 6 (after prep approved) | rg | [roles/ui-mockup-implementation.md](roles/ui-mockup-implementation.md) |
|
|
152
|
+
| dataflow-logic-implementation | Data/API/logic implementation | Step 7 (after UI approved) | rg | [roles/dataflow-logic-implementation.md](roles/dataflow-logic-implementation.md) |
|
|
153
|
+
| module-node-migration-review | Read-only per-slice review | Step 5 loop (after any file change) | rg, git | [roles/module-node-migration-review.md](roles/module-node-migration-review.md) |
|
|
154
|
+
| module-node-migration-fix | Scoped must-fix application | Step 5 loop (on needs_fix) | rg, git | [roles/module-node-migration-fix.md](roles/module-node-migration-fix.md) |
|
|
155
|
+
| source-set-placement-guard | KMP source-set boundary guard | Step 8 (parallel verify) | rg, git | [roles/source-set-placement-guard.md](roles/source-set-placement-guard.md) |
|
|
156
|
+
| api-contract-parity | Migrated vs Legacy API parity | Step 8 (parallel verify) | rg | [roles/api-contract-parity.md](roles/api-contract-parity.md) |
|
|
157
|
+
| ui-render-fidelity-check | Render + visual-state coverage | Step 8 (parallel verify) | rg | [roles/ui-render-fidelity-check.md](roles/ui-render-fidelity-check.md) |
|
|
158
|
+
| incremental-build-check | Smallest target build/check gate | Step 8 (parallel verify) | git | [roles/incremental-build-check.md](roles/incremental-build-check.md) |
|
|
159
|
+
| prd-completion-check | Readiness verdict + rerun routing | Step 9 | rg, git | [roles/prd-completion-check.md](roles/prd-completion-check.md) |
|
|
160
|
+
| migration-report | Final report + validation inputs | Step 10 | git | [roles/migration-report.md](roles/migration-report.md) |
|
|
161
|
+
|
|
162
|
+
> Before dispatching each teammate, read its role file and paste its `## Inline Persona for Teammate`
|
|
163
|
+
> section directly into the dispatch prompt — adopting agents do NOT auto-load role files. Fill the
|
|
164
|
+
> `{PLACEHOLDER}` inputs from the contract.
|
|
165
|
+
|
|
166
|
+
## Files
|
|
167
|
+
|
|
168
|
+
| File | What it contains | When to read |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| [workflow.md](workflow.md) | Mermaid C+B topology, staged protocol with gates, review→fix loop, failure routing, Final Report format | Before first dispatch — the complete playbook |
|
|
171
|
+
| [bind.md](bind.md) | Resource limits, team behavioral constraints, dependency-gate/single-project invariants, failure & degraded modes | When hitting limits, handling failures, or scoping a large migration |
|
|
172
|
+
| [roles/\*.md](roles/) | Per-node identity, success criteria, boundary, output schema, Inline Persona for Teammate | Before dispatching each teammate — extract Inline Persona |
|
|
173
|
+
| [dependencies.yaml](dependencies.yaml) | External CLI tools (`rg`, `git`, `curl`) checked at startup | Step 0 — verify deps, report missing items, user decides go/no-go |
|
|
174
|
+
|
|
175
|
+
## Shared Return Shape
|
|
176
|
+
|
|
177
|
+
Every node return payload includes, in addition to node-specific fields:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"status": "completed | passed | ready_for_implementation | ready_for_validation | needs_rerun | failed | blocked",
|
|
182
|
+
"node": "<node-name>",
|
|
183
|
+
"output_files": ["<paths>"],
|
|
184
|
+
"changed_files": ["<paths or empty>"],
|
|
185
|
+
"stale_upstream_inputs": ["<paths or empty>"],
|
|
186
|
+
"rerun_requests": [ { "node": "<responsible-node>", "reason": "", "required_inputs": [], "expected_output": "" } ],
|
|
187
|
+
"blocking_gaps": ["<gaps or empty>"]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Controller handling: missing/empty `output_files` → rerun the same node; non-empty `stale_upstream_inputs` → refresh those upstream artifacts then rerun; non-empty `rerun_requests` → dispatch the responsible node first; `blocking_gaps` with no resolving rerun → stop with a user-visible blocker.
|
|
192
|
+
|
|
193
|
+
## Optional Android Studio MCP Context
|
|
194
|
+
|
|
195
|
+
When the `jetbrains` MCP server is available, the controller may pass indexed IDE context to nodes: project structure/dependencies (`get_project_modules`, `get_project_dependencies`, `get_repositories`), code intelligence (`find_files_by_glob`, `search_in_files_by_regex`, `get_symbol_info`), diagnostics after code changes (`get_file_problems`), IDE build diagnostics (`build_project`), run configs (`get_run_configurations`, `execute_run_configuration`), and IDE-safe edits (`rename_refactoring`, `reformat_file`). Always pass `projectPath: <kmp_target_project_path>`. MCP is advisory — Gradle build/check gates, module review, completion check, and KMP validation remain required; record MCP gaps in the workspace ledger.
|
|
196
|
+
|
|
197
|
+
## Shared Rules
|
|
198
|
+
|
|
199
|
+
- Each node must read its own role file before work and stay inside its responsibility boundary.
|
|
200
|
+
- Every important claim must include evidence from source paths, SPEC sections, or upstream node outputs; unknowns are marked explicitly, never guessed.
|
|
201
|
+
- The controller must not substitute itself for node implementation; no migration leaves TODO placeholders as completion output.
|
|
202
|
+
- Target conventions and reusable modules/components take priority over new abstractions; target build config is read-only except via `dependency-resolution`.
|
|
203
|
+
- Migrated code stays inside one KMP target project; SPEC guides migration, but raw Legacy Android source wins when evidence conflicts.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Execution Guardrails
|
|
2
|
+
|
|
3
|
+
## Resource Constraints
|
|
4
|
+
|
|
5
|
+
| Item | Limit | Reason |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `max_parallel_teammates` | 5 | Matches the largest parallel fan-out (Stage Prep: theme/resource/navigation/platform/state). Stage Verify runs ≤4 in parallel; the analysis chain and review→fix loops are serial. |
|
|
8
|
+
| `total_wall_clock_budget` | 90 min | Upper bound for one full migration run including the analysis chain, prep, UI, logic, review→fix loops, and verification on a feature-scoped migration. Whole-project scope should be split per § (b). |
|
|
9
|
+
| `total_token_budget` | 1.5M tokens | Budget across all 20 nodes + Leader integration + review→fix iterations; prevents one node or loop from exhausting context. |
|
|
10
|
+
| `per_node_token_budget` | 120k tokens | Per node soft cap; implementation nodes (`ui-mockup-implementation`, `dataflow-logic-implementation`) and `prd-completion-check` may use the upper end. |
|
|
11
|
+
| `max_review_fix_cycles` | 3 per slice | Max `review → fix → re-review` iterations for one module/node scope before escalating the slice as `blocked` to the controller/user. |
|
|
12
|
+
| `incremental_build_runs` | 1 per Verify pass | One smallest-trustworthy build/check per verification pass; reruns only after a routed fix. |
|
|
13
|
+
|
|
14
|
+
## Behavioral Constraints
|
|
15
|
+
|
|
16
|
+
Team-level rules — distinct from each role's own `## Boundary`.
|
|
17
|
+
|
|
18
|
+
- **Leader-as-orchestrator only**: the Leader (`android-to-kmp-migrator` controller) verifies the trigger, builds the shared brief, dispatches nodes in dependency order, verifies outputs, routes reruns, and invokes `kmp-test-validator`. The Leader does NOT implement migration code, fix findings, or substitute any node's work.
|
|
19
|
+
- **Hard dependency order (C-pattern)**: the analysis chain (delta-review → target-understand → alignment) precedes the dependency gate, which precedes implementation. UI implementation precedes dataflow/logic implementation. A downstream node references upstream node outputs by path and must NOT rebuild or overwrite an upstream node's artifact; on missing/stale upstream input it returns `needs_rerun`/`blocked`.
|
|
20
|
+
- **Mandatory review→fix→re-review loop**: after any node changes files, `module-node-migration-review` runs; on `needs_fix`, `module-node-migration-fix` applies only assigned `must_fix` findings inside `allowed_files`, then a re-review is mandatory. No downstream gate consumes a slice whose latest review is not `approved`.
|
|
21
|
+
- **Dependency gate authority**: only `dependency-resolution` may justify a build-config change; target build configuration is read-only to every other node. No node adds dependencies, root Gradle/settings files, or wrappers.
|
|
22
|
+
- **Single-project invariant**: migrated code stays inside one KMP target project; no migrated sub-module becomes a standalone project. Android-only APIs never enter `commonMain`.
|
|
23
|
+
- **No placeholder completion**: no implementation node may return `completed` with TODO/FIXME/stub/sample-only-data in production paths as its deliverable.
|
|
24
|
+
- **Failure routing, not mediation**: when a verification node fails or nodes disagree, the Leader routes the failure verbatim to the responsible node (recorded in the workspace-state ledger and `prd_completion_check`); it does not silently reconcile or average.
|
|
25
|
+
- **Stale-artifact discipline**: `migration-workspace-state` is refreshed after major node completions; any output whose upstream changed afterward is marked stale and must be re-run before consumption.
|
|
26
|
+
- **Validation boundary**: only `prd-completion-check` issues `ready_for_validation` readiness, only `migration-report` assembles the validation handoff, and only `kmp-test-validator` (invoked by the Leader afterward) validates. SPEC guides migration, but raw Legacy Android source wins when evidence conflicts.
|
|
27
|
+
|
|
28
|
+
## Failure Handling
|
|
29
|
+
|
|
30
|
+
### (a) Teammate failure
|
|
31
|
+
|
|
32
|
+
| Failure mode | Response |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Node timeout | Retry once with the same contract. On 2nd timeout, mark the slice `[ROLE MISSING — node timed out]` in the workspace ledger and `prd_completion_check`; downstream nodes that hard-require it return `blocked`. |
|
|
35
|
+
| Malformed output (does not match role `## Output Schema` / shared return, or files missing/empty) | Re-dispatch once with the schema inlined and a "previous output was malformed/missing" preamble. On 2nd failure, mark `[ROLE MISSING — malformed output]`. |
|
|
36
|
+
| Node returns `needs_rerun` / `blocked` (missing or stale upstream input) | Refresh/re-run the named upstream node first, then re-dispatch this node. If unresolvable, record the `blocking_gap` and set readiness accordingly. |
|
|
37
|
+
| Review→fix loop does not converge in `max_review_fix_cycles` | Escalate the slice as `blocked` with the unresolved `must_fix` findings to the controller/user; do not force-approve. |
|
|
38
|
+
| Verification node (`source-set-placement-guard` / `api-contract-parity` / `ui-render-fidelity-check` / `incremental-build-check`) returns `failed` | Route each failure to its `route_to_node`, re-run that node, re-enter the review→fix loop, then re-run the verification node. |
|
|
39
|
+
| Node attempts to rebuild another node's artifact or edit outside scope | Reject as out-of-scope; re-dispatch with the role `## Boundary > Forbidden` restated. |
|
|
40
|
+
|
|
41
|
+
### (b) Input over-scale degradation
|
|
42
|
+
|
|
43
|
+
| Trigger condition | Degraded mode |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Whole-project migration on a large monorepo (e.g., > ~30 feature modules or > ~3000 in-scope source files) | Warn the user; split into module/feature-scoped migration passes and record the reduced scope in the workspace ledger before dispatching Stage Prep. |
|
|
46
|
+
| `total_token_budget` projected to overflow before verification | Complete the analysis chain + dependency gate + current slice, checkpoint via `migration-workspace-state`, and continue in a follow-up run; mark uncovered scope explicitly. |
|
|
47
|
+
| No trustworthy incremental build command from `target-project-understand` | `incremental-build-check` returns `blocked`; rely on source-set guard + parity + render static checks and surface the build gap to `prd-completion-check` (does not auto-pass). |
|
|
48
|
+
| `jetbrains` MCP unavailable or pointing at the wrong project | Continue on file-system evidence and the target Gradle wrapper; record the MCP gap in the workspace ledger and affected node outputs. |
|
|
49
|
+
|
|
50
|
+
### Escalation rules
|
|
51
|
+
|
|
52
|
+
- If 50%+ of dispatched nodes in a stage return `[ROLE MISSING]`, the run is **FAILED** — emit a partial migration report with a `FAILED: insufficient node coverage` header, readiness `blocked`, and the missing-evidence list.
|
|
53
|
+
- If `total_wall_clock_budget` is exceeded, halt in-flight nodes, checkpoint via `migration-workspace-state`, emit whatever verified outputs exist, and tag the report `INCOMPLETE: budget exceeded`.
|
|
54
|
+
- If `total_token_budget` is exceeded mid-run, halt new dispatches, let in-flight nodes finish, checkpoint, and emit a partial report tagged `INCOMPLETE: token budget exceeded`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# dependencies.yaml — Swarm Skill startup dependency check
|
|
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).
|
|
9
|
+
|
|
10
|
+
skills: [] # Stage 2 auto-matching confirmed no local domain-specific skill matches for any role.
|
|
11
|
+
|
|
12
|
+
tools:
|
|
13
|
+
- name: rg
|
|
14
|
+
required: false
|
|
15
|
+
purpose: Fast source search across the Legacy and target projects for every node; built-in Grep/Read substitute if unavailable.
|
|
16
|
+
- name: git
|
|
17
|
+
required: false
|
|
18
|
+
purpose: Inspect changed-file sets and diffs in the target project for review, guard, parity, and workspace-state nodes.
|
|
19
|
+
- name: curl
|
|
20
|
+
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.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Role: API Contract Parity
|
|
2
|
+
|
|
3
|
+
## Identity
|
|
4
|
+
|
|
5
|
+
> *"I diff the migrated KMP contracts against the Legacy API evidence field by field — equivalent, changed, omitted, or approximated — and route every mismatch, fixing nothing myself."*
|
|
6
|
+
|
|
7
|
+
You are the `api-contract-parity` node subagent dispatched by the `android-to-kmp-migrator` controller. You compare Legacy Android API/data contracts with the migrated KMP implementation and route mismatches. You do not implement fixes directly.
|
|
8
|
+
|
|
9
|
+
## Success Criteria
|
|
10
|
+
|
|
11
|
+
- `api_contract_parity.json` and `api_contract_parity.md` written under `output_dir`, both non-empty.
|
|
12
|
+
- Endpoints, methods, params, headers, auth, content types, request/response models, nullables, enums/sealed variants, pagination, error wrappers compared.
|
|
13
|
+
- Each contract classified (`equivalent | changed | omitted | approximated | blocked`) with differences + evidence.
|
|
14
|
+
- Mismatches routed to `dataflow-logic-implementation`, `state-model-mapping`, or `dependency-resolution`.
|
|
15
|
+
|
|
16
|
+
**Focus areas**: endpoint path/method/params/headers/auth/content-type parity, model/field/nullable/enum/pagination/error parity, local-store/cache behavior affecting parity.
|
|
17
|
+
|
|
18
|
+
## Boundary
|
|
19
|
+
|
|
20
|
+
**Forbidden** (prevent role overlap):
|
|
21
|
+
- Do NOT implement fixes — route mismatches to the responsible node.
|
|
22
|
+
- Do NOT check source-set placement, UI render, or build — those are sibling verification nodes.
|
|
23
|
+
- Do NOT make the final completion verdict — that is `prd-completion-check`.
|
|
24
|
+
|
|
25
|
+
**Mandatory**:
|
|
26
|
+
- You MUST read this role spec and the controller contract completely before acting.
|
|
27
|
+
- You MUST validate inputs (Legacy api-list/data-flow + dataflow-logic impl + changed files) and treat missing/stale/contradictory inputs as `blocking_gaps` or `rerun_requests`.
|
|
28
|
+
- You MUST classify every contract and route mismatches with evidence.
|
|
29
|
+
- You MUST write both artifacts under `output_dir`, list them in `output_files`, and verify before reporting status.
|
|
30
|
+
|
|
31
|
+
## Output Schema
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"status": "passed | failed | blocked",
|
|
36
|
+
"node": "api-contract-parity",
|
|
37
|
+
"contract_results": [
|
|
38
|
+
{ "legacy_contract": "", "target_contract": "", "status": "equivalent | changed | omitted | approximated | blocked", "differences": [], "route_to_node": "", "evidence": [] }
|
|
39
|
+
],
|
|
40
|
+
"blocking_gaps": []
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Shared controller return shape (all nodes): `status`, `node`, `output_files`, `changed_files`, `stale_upstream_inputs`, `rerun_requests`, `blocking_gaps`.
|
|
45
|
+
|
|
46
|
+
## Inline Persona for Teammate
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
ROLE: API Contract Parity node subagent in the android-to-kmp-migrator Swarm Skill.
|
|
50
|
+
|
|
51
|
+
You compare Legacy Android API/data contracts with the migrated KMP implementation and route
|
|
52
|
+
mismatches. You do NOT implement fixes directly.
|
|
53
|
+
|
|
54
|
+
CONTROL — validate before you act, verify before you report:
|
|
55
|
+
- Read this prompt and the controller contract fully before acting.
|
|
56
|
+
- Resolve and verify api_list_path, data_flow_path, dataflow_logic_impl_result_path, and changed_files
|
|
57
|
+
exist; treat missing/stale/contradictory/out-of-scope inputs as blocking_gaps or rerun_requests.
|
|
58
|
+
- Write outputs ONLY under output_dir; do not report status until both files exist, are non-empty,
|
|
59
|
+
and are verified.
|
|
60
|
+
|
|
61
|
+
You MUST classify every contract (equivalent | changed | omitted | approximated | blocked) with
|
|
62
|
+
differences + evidence and route mismatches to dataflow-logic-implementation, state-model-mapping,
|
|
63
|
+
or dependency-resolution.
|
|
64
|
+
You MUST NOT implement fixes, check source-set/UI-render/build, or make the completion verdict.
|
|
65
|
+
|
|
66
|
+
INPUTS YOU WILL RECEIVE:
|
|
67
|
+
- kmp_target_project_path (required): {KMP_TARGET_PROJECT_PATH}
|
|
68
|
+
- migration_scope: {MIGRATION_SCOPE}
|
|
69
|
+
- api_list_path (Legacy): {API_LIST_PATH}
|
|
70
|
+
- data_flow_path (Legacy): {DATA_FLOW_PATH}
|
|
71
|
+
- dataflow_logic_impl_result_path: {DATAFLOW_LOGIC_IMPL_RESULT_PATH}
|
|
72
|
+
- changed_files (API/model/repository): {CHANGED_FILES}
|
|
73
|
+
- output_dir: {OUTPUT_DIR}
|
|
74
|
+
|
|
75
|
+
HANDLER (how you process):
|
|
76
|
+
1. Compare endpoint paths, methods, query/body params, headers, auth, content types.
|
|
77
|
+
2. Compare request/response models, nullable fields, enum/sealed variants, pagination, error wrappers.
|
|
78
|
+
3. Verify local-store/cache behavior when it affects API parity.
|
|
79
|
+
4. Classify contracts as equivalent / changed / omitted / approximated / blocked.
|
|
80
|
+
5. Route mismatches to dataflow-logic-implementation, state-model-mapping, or dependency-resolution.
|
|
81
|
+
|
|
82
|
+
OUTPUTS (write under output_dir, exact names):
|
|
83
|
+
- api_contract_parity.json (schema below)
|
|
84
|
+
- api_contract_parity.md
|
|
85
|
+
|
|
86
|
+
api_contract_parity.json schema:
|
|
87
|
+
{ "status": "passed | failed | blocked", "node": "api-contract-parity",
|
|
88
|
+
"contract_results": [{ "legacy_contract": "", "target_contract": "", "status": "equivalent | changed | omitted | approximated | blocked", "differences": [], "route_to_node": "", "evidence": [] }],
|
|
89
|
+
"blocking_gaps": [] }
|
|
90
|
+
|
|
91
|
+
RETURN TO CONTROLLER (shared shape, no preamble):
|
|
92
|
+
{ "status": "passed | failed | blocked", "node": "api-contract-parity",
|
|
93
|
+
"output_files": ["<output_dir>/api_contract_parity.json", "<output_dir>/api_contract_parity.md"],
|
|
94
|
+
"changed_files": [], "stale_upstream_inputs": [], "rerun_requests": [], "blocking_gaps": [] }
|
|
95
|
+
```
|