@sun-asterisk/sungen 3.2.2-beta.10 → 3.2.2-beta.13

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 (146) hide show
  1. package/dist/capabilities/discover.d.ts.map +1 -1
  2. package/dist/capabilities/discover.js +26 -3
  3. package/dist/capabilities/discover.js.map +1 -1
  4. package/dist/cli/commands/add-flow.d.ts.map +1 -1
  5. package/dist/cli/commands/add-flow.js +2 -0
  6. package/dist/cli/commands/add-flow.js.map +1 -1
  7. package/dist/cli/commands/add.d.ts.map +1 -1
  8. package/dist/cli/commands/add.js +4 -0
  9. package/dist/cli/commands/add.js.map +1 -1
  10. package/dist/cli/commands/capability.d.ts.map +1 -1
  11. package/dist/cli/commands/capability.js +61 -0
  12. package/dist/cli/commands/capability.js.map +1 -1
  13. package/dist/cli/commands/delivery.d.ts.map +1 -1
  14. package/dist/cli/commands/delivery.js +89 -2
  15. package/dist/cli/commands/delivery.js.map +1 -1
  16. package/dist/cli/commands/generate.d.ts.map +1 -1
  17. package/dist/cli/commands/generate.js +2 -1
  18. package/dist/cli/commands/generate.js.map +1 -1
  19. package/dist/cli/commands/init.d.ts.map +1 -1
  20. package/dist/cli/commands/init.js +27 -2
  21. package/dist/cli/commands/init.js.map +1 -1
  22. package/dist/dashboard/snapshot-builder.d.ts.map +1 -1
  23. package/dist/dashboard/snapshot-builder.js +10 -1
  24. package/dist/dashboard/snapshot-builder.js.map +1 -1
  25. package/dist/exporters/csv-exporter.d.ts.map +1 -1
  26. package/dist/exporters/csv-exporter.js +3 -1
  27. package/dist/exporters/csv-exporter.js.map +1 -1
  28. package/dist/exporters/json-exporter.js +3 -1
  29. package/dist/exporters/json-exporter.js.map +1 -1
  30. package/dist/exporters/mobile-app-id.d.ts +22 -0
  31. package/dist/exporters/mobile-app-id.d.ts.map +1 -0
  32. package/dist/exporters/mobile-app-id.js +37 -0
  33. package/dist/exporters/mobile-app-id.js.map +1 -0
  34. package/dist/exporters/spec-parser.d.ts.map +1 -1
  35. package/dist/exporters/spec-parser.js +6 -2
  36. package/dist/exporters/spec-parser.js.map +1 -1
  37. package/dist/generators/test-generator/adapters/adapter-interface.d.ts +3 -0
  38. package/dist/generators/test-generator/adapters/adapter-interface.d.ts.map +1 -1
  39. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/scroll-action.hbs +7 -4
  40. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/toggle-action.hbs +20 -3
  41. package/dist/generators/test-generator/adapters/appium/templates/steps/assertions/checked-assertion.hbs +4 -1
  42. package/dist/generators/test-generator/adapters/appium/templates/steps/assertions/not-checked-assertion.hbs +4 -1
  43. package/dist/generators/test-generator/adapters/appium/templates/test-file.hbs +3 -0
  44. package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
  45. package/dist/generators/test-generator/code-generator.js +38 -3
  46. package/dist/generators/test-generator/code-generator.js.map +1 -1
  47. package/dist/generators/test-generator/template-engine.d.ts +3 -0
  48. package/dist/generators/test-generator/template-engine.d.ts.map +1 -1
  49. package/dist/generators/test-generator/template-engine.js +11 -1
  50. package/dist/generators/test-generator/template-engine.js.map +1 -1
  51. package/dist/generators/test-generator/utils/selector-resolver.d.ts +11 -1
  52. package/dist/generators/test-generator/utils/selector-resolver.d.ts.map +1 -1
  53. package/dist/generators/test-generator/utils/selector-resolver.js +33 -0
  54. package/dist/generators/test-generator/utils/selector-resolver.js.map +1 -1
  55. package/dist/harness/audit.js +1 -1
  56. package/dist/harness/audit.js.map +1 -1
  57. package/dist/harness/catalog/universal-viewpoints.yaml +15 -0
  58. package/dist/harness/journey.d.ts.map +1 -1
  59. package/dist/harness/journey.js +22 -11
  60. package/dist/harness/journey.js.map +1 -1
  61. package/dist/harness/sensors.d.ts +1 -1
  62. package/dist/harness/sensors.d.ts.map +1 -1
  63. package/dist/harness/sensors.js +32 -9
  64. package/dist/harness/sensors.js.map +1 -1
  65. package/dist/orchestrator/flow-manager.d.ts +11 -0
  66. package/dist/orchestrator/flow-manager.d.ts.map +1 -1
  67. package/dist/orchestrator/flow-manager.js +147 -29
  68. package/dist/orchestrator/flow-manager.js.map +1 -1
  69. package/dist/orchestrator/mobile-runtime-scaffolder.d.ts +59 -0
  70. package/dist/orchestrator/mobile-runtime-scaffolder.d.ts.map +1 -0
  71. package/dist/orchestrator/mobile-runtime-scaffolder.js +298 -0
  72. package/dist/orchestrator/mobile-runtime-scaffolder.js.map +1 -0
  73. package/dist/orchestrator/project-initializer.d.ts +25 -7
  74. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  75. package/dist/orchestrator/project-initializer.js +115 -62
  76. package/dist/orchestrator/project-initializer.js.map +1 -1
  77. package/dist/orchestrator/screen-manager.d.ts +30 -0
  78. package/dist/orchestrator/screen-manager.d.ts.map +1 -1
  79. package/dist/orchestrator/screen-manager.js +205 -22
  80. package/dist/orchestrator/screen-manager.js.map +1 -1
  81. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +32 -4
  82. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +51 -10
  83. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +12 -1
  84. package/dist/orchestrator/templates/ai-instructions/claude-cmd-delivery.md +6 -0
  85. package/dist/orchestrator/templates/ai-instructions/claude-cmd-locale.md +25 -4
  86. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +7 -0
  87. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +38 -4
  88. package/dist/orchestrator/templates/ai-instructions/claude-skill-delivery.md +2 -0
  89. package/dist/orchestrator/templates/ai-instructions/claude-skill-locale.md +106 -9
  90. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +33 -3
  91. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +50 -9
  92. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +9 -1
  93. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-delivery.md +6 -0
  94. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-locale.md +25 -4
  95. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +7 -0
  96. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +38 -4
  97. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +2 -0
  98. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-locale.md +106 -9
  99. package/package.json +3 -3
  100. package/src/capabilities/discover.ts +29 -3
  101. package/src/cli/commands/add-flow.ts +2 -0
  102. package/src/cli/commands/add.ts +4 -0
  103. package/src/cli/commands/capability.ts +64 -1
  104. package/src/cli/commands/delivery.ts +89 -2
  105. package/src/cli/commands/generate.ts +2 -1
  106. package/src/cli/commands/init.ts +38 -3
  107. package/src/dashboard/snapshot-builder.ts +10 -1
  108. package/src/exporters/csv-exporter.ts +3 -1
  109. package/src/exporters/json-exporter.ts +3 -1
  110. package/src/exporters/mobile-app-id.ts +34 -0
  111. package/src/exporters/spec-parser.ts +6 -2
  112. package/src/generators/test-generator/adapters/adapter-interface.ts +3 -0
  113. package/src/generators/test-generator/adapters/appium/templates/steps/actions/scroll-action.hbs +7 -4
  114. package/src/generators/test-generator/adapters/appium/templates/steps/actions/toggle-action.hbs +20 -3
  115. package/src/generators/test-generator/adapters/appium/templates/steps/assertions/checked-assertion.hbs +4 -1
  116. package/src/generators/test-generator/adapters/appium/templates/steps/assertions/not-checked-assertion.hbs +4 -1
  117. package/src/generators/test-generator/adapters/appium/templates/test-file.hbs +3 -0
  118. package/src/generators/test-generator/code-generator.ts +39 -3
  119. package/src/generators/test-generator/template-engine.ts +14 -1
  120. package/src/generators/test-generator/utils/selector-resolver.ts +51 -1
  121. package/src/harness/audit.ts +1 -1
  122. package/src/harness/catalog/universal-viewpoints.yaml +15 -0
  123. package/src/harness/journey.ts +21 -9
  124. package/src/harness/sensors.ts +25 -8
  125. package/src/orchestrator/flow-manager.ts +165 -29
  126. package/src/orchestrator/mobile-runtime-scaffolder.ts +277 -0
  127. package/src/orchestrator/project-initializer.ts +127 -64
  128. package/src/orchestrator/screen-manager.ts +237 -22
  129. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +32 -4
  130. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +51 -10
  131. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +12 -1
  132. package/src/orchestrator/templates/ai-instructions/claude-cmd-delivery.md +6 -0
  133. package/src/orchestrator/templates/ai-instructions/claude-cmd-locale.md +25 -4
  134. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +7 -0
  135. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +38 -4
  136. package/src/orchestrator/templates/ai-instructions/claude-skill-delivery.md +2 -0
  137. package/src/orchestrator/templates/ai-instructions/claude-skill-locale.md +106 -9
  138. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +33 -3
  139. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +50 -9
  140. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +9 -1
  141. package/src/orchestrator/templates/ai-instructions/copilot-cmd-delivery.md +6 -0
  142. package/src/orchestrator/templates/ai-instructions/copilot-cmd-locale.md +25 -4
  143. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +7 -0
  144. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +38 -4
  145. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +2 -0
  146. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-locale.md +106 -9
@@ -1,30 +1,50 @@
1
1
  ---
2
2
  name: sungen-add-flow
3
3
  description: 'Add a new Sungen flow — scaffolds directories for E2E cross-screen testing, helps fill spec.md, and can capture visuals via the capture skills'
4
- argument-hint: '[flow-name] [--path <start-url>]'
4
+ argument-hint: '[flow-name] [--path <start-url>] [--reach <steps>]'
5
5
  agent: 'agent'
6
- tools: [vscode, execute, read, agent, edit, search, todo]
6
+ tools: [vscode, execute, read, agent, edit, search, todo, 'appium-mcp/*']
7
7
  ---
8
8
 
9
9
  **Input**: Flow name and optional starting URL (e.g., `/sungen-add-flow award-submission --path /login`).
10
+ For mobile: `/sungen-add-flow my-flow --reach "tap [My Page] tab"`.
10
11
 
11
12
  You are adding a new Sungen flow for E2E cross-screen test generation.
12
13
 
14
+ ## Platform detection (do this FIRST)
15
+
16
+ Read `qa/capabilities.yaml` and check the `platform` field.
17
+
18
+ - If `platform: mobile` → follow the **mobile path** in each step below.
19
+ - If `platform: web` or field absent → follow the **web path** (all steps unchanged).
20
+
13
21
  ## Parameters
14
22
 
15
23
  - **flow** — ${input:flow:flow name (e.g., award-submission, user-onboarding)}
16
- - **--path \<url\>** — starting page URL path (default: `/login`)
24
+ - **--path \<url\>** — starting page URL path for web (default: `/login`); or app entry for mobile (`<appPackage>`)
25
+ - **--reach \<steps\>** — (mobile only) navigation recipe for the flow's first screen: `>`-separated nav steps from app launch. Ignored (with warning) on web projects.
17
26
  - **--description \<text\>** — flow description (optional)
18
27
 
19
28
  ## Steps
20
29
 
21
30
  ### 1. Scaffold the flow
22
31
 
32
+ **Web:**
33
+
23
34
  Run with #tool:terminal:
24
35
  ```bash
25
36
  sungen add-flow --flow ${input:flow} --path ${input:path}
26
37
  ```
27
38
 
39
+ **Mobile (when `platform: mobile` in `qa/capabilities.yaml`):**
40
+
41
+ Run with #tool:terminal:
42
+ ```bash
43
+ sungen add-flow --flow ${input:flow} [--reach "tap [My Page] tab > tap [Settings] row"]
44
+ # --reach is the navigation recipe for the flow's first screen → scaffolded into the Background.
45
+ # Directories are always qa/flows/<name>/ (never qa/mobile/).
46
+ ```
47
+
28
48
  This creates:
29
49
  ```
30
50
  qa/flows/${input:flow}/
@@ -47,6 +67,16 @@ Record the screen list — you will need it for:
47
67
 
48
68
  ### 2. Capture visual source
49
69
 
70
+ **Mobile path (when `platform: mobile` in `qa/capabilities.yaml`):**
71
+
72
+ Ask: *"Capture a live screen via Appium MCP now?"*
73
+ - **1) Yes, capture now (Recommended)** — invoke the `sungen-capture-mobile` skill (Appium MCP) for the first screen of the flow. Repeat for each screen in the flow as needed.
74
+ - **2) Skip** — user will capture later via `/sungen-run-test` or manually.
75
+
76
+ Do NOT invoke `sungen-capture` (web/Figma) for a mobile project. Use `sungen-capture-mobile` only.
77
+
78
+ **Web path:**
79
+
50
80
  Ask: *"Pick a visual source for this flow's screens:"*
51
81
  - **Figma designs** (Recommended for pre-launch) — invoke `sungen-capture` skill (mode figma-mcp) for each screen
52
82
  - **Live page scan** (dev/staging is up) — invoke `sungen-capture` skill (mode live) for each screen URL
@@ -1,23 +1,33 @@
1
1
  ---
2
2
  name: sungen-add-screen
3
- description: 'Add a new Sungen screen or a sub-feature to an existing one — scaffolds directories, helps fill spec.md, and can auto-capture a live-page screenshot via Playwright MCP'
4
- argument-hint: '[screen-name] [url-path] [--feature <name>] [--figma <url>]'
3
+ description: 'Add a new Sungen screen or a sub-feature to an existing one — scaffolds directories, helps fill spec.md, and can capture visuals via Playwright MCP (web) or Appium MCP (mobile)'
4
+ argument-hint: '[screen-name] [url-path] [--feature <name>] [--figma <url>] [--reach <steps>] [--platform android|ios]'
5
5
  agent: 'agent'
6
- tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*']
6
+ tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*', 'appium-mcp/*']
7
7
  ---
8
8
 
9
9
  **Input**: Screen name and URL path (e.g., `/sungen-add-screen login /login`).
10
10
  Optionally include a Figma URL: `/sungen-add-screen login /login --figma https://www.figma.com/design/...`.
11
11
  To add a sub-feature file to an existing screen: `/sungen-add-screen awards --feature modal`.
12
+ For mobile: `/sungen-add-screen home --reach "tap [My Page] tab > tap [Settings] row"`.
12
13
 
13
14
  You are adding a new Sungen screen for test generation, or extending an existing screen with an additional `.feature` file (sub-feature).
14
15
 
16
+ ## Platform detection (do this FIRST)
17
+
18
+ Read `qa/capabilities.yaml` and check the `platform` field.
19
+
20
+ - If `platform: mobile` → follow the **mobile path** in each step below.
21
+ - If `platform: web` or field absent → follow the **web path** (all steps unchanged).
22
+
15
23
  ## Parameters
16
24
 
17
25
  - **screen** — ${input:screen:screen name (e.g., login, dashboard)}
18
- - **path** — ${input:path:URL path (e.g., /login, /dashboard)} — optional when --figma is provided or when adding a sub-feature
26
+ - **path** — ${input:path:URL path (web) or app entry (mobile, e.g., com.example.app)} — optional when --figma is provided or when adding a sub-feature
27
+ - **`--reach <steps>`** — (mobile only) navigation recipe: `>`-separated nav steps from app launch to this screen. Ignored (with warning) on web projects.
28
+ - **`--platform android|ios`** — (mobile only, optional) emit `@platform:android/ios` tag for OS-specific screens. Does NOT affect directory routing.
19
29
  - **`--feature <name>`** — sub-feature name to add to an existing screen (e.g., `modal`, `filter`, `create-flow`). Creates `<screen>-<feature>.feature` + matching `selectors/<screen>-<feature>.yaml` + `test-data/<screen>-<feature>.yaml` without touching the screen's other files. Use this when one screen has multiple `.feature` files.
20
- - **`--figma <url>`** — Figma share URL (optional)
30
+ - **`--figma <url>`** — Figma share URL (optional, web only)
21
31
  - **`--refresh`** — bypass Figma cache and re-fetch (optional, use with --figma)
22
32
  - **`--scale <n>`** — PNG export scale factor, default 2 (optional)
23
33
  - **`--hi-res`** — export at 4× scale, shorthand for --scale 4 (optional)
@@ -31,13 +41,29 @@ You are adding a new Sungen screen for test generation, or extending an existing
31
41
 
32
42
  ### 1. Scaffold the screen (or sub-feature)
33
43
 
34
- **Standard path (no --figma, no --feature):**
44
+ **Web — standard path (no --figma, no --feature):**
35
45
 
36
46
  Run with #tool:terminal:
37
47
  ```bash
38
48
  sungen add --screen ${input:screen} --path ${input:path}
39
49
  ```
40
50
 
51
+ **Mobile path (when `platform: mobile` in `qa/capabilities.yaml`):**
52
+
53
+ `--path` is the app entry — the Android **package** alone (launch activity auto-detected; append `/<appActivity>` only to pin a non-standard launcher), an iOS bundleId, or the dual-id `"<pkg> | <bundleId>"` for cross-platform. After confirming the app entry, ask the user *"After the app launches, what taps reach this screen? e.g. `tap [My Page] tab > tap [Settings] row` — leave blank if this IS the launcher screen"* and pass it as `--reach`.
54
+
55
+ Run with #tool:terminal:
56
+ ```bash
57
+ sungen add --screen ${input:screen} \
58
+ --path "<appPackage>[ | <iosBundleId>]" \
59
+ [--reach "tap [My Page] tab > tap [Settings] row"] \
60
+ [--platform android|ios]
61
+ # --reach is scaffolded into the Background so capture-mobile / the test run land on THIS screen.
62
+ # Omit --reach when the screen IS the launcher/home screen.
63
+ # --platform android|ios is optional: emits @platform:android/ios for OS-specific screens only.
64
+ # Directories are always qa/screens/<screen>/ (never qa/mobile/).
65
+ ```
66
+
41
67
  **Sub-feature mode (`--feature <name>` provided):**
42
68
 
43
69
  Run with #tool:terminal:
@@ -87,6 +113,16 @@ After `sungen add --figma` succeeds, the envelope of `spec_figma.md` is determin
87
113
 
88
114
  ### 2. Capture visual source
89
115
 
116
+ **Mobile path (when `platform: mobile` in `qa/capabilities.yaml`):**
117
+
118
+ Ask: *"Capture a live screen via Appium MCP now?"*
119
+ - **1) Yes, capture now (Recommended)** — invoke the `sungen-capture-mobile` skill (Appium MCP). It replays the Background nav recipe to reach this screen, scans the locator tree, and saves a screenshot to `requirements/ui/`.
120
+ - **2) Skip** — user will capture later via `/sungen-run-test` or manually.
121
+
122
+ Do NOT invoke `sungen-capture` (web/Figma) for a mobile project. Use `sungen-capture-mobile` only.
123
+
124
+ **Web path:**
125
+
90
126
  **If Figma branch (Step 1) already downloaded PNGs** → visuals already exist. Offer:
91
127
  - **1) Continue** — Figma visuals are enough (Recommended)
92
128
  - **2) Also capture live page** — supplement Figma with real page scan (invoke `sungen-capture` skill (mode live))
@@ -119,12 +155,17 @@ Then offer next steps:
119
155
 
120
156
  ```
121
157
  sungen add --screen <name>
122
- [-p, --path <path>] URL route (e.g., /awards). Required for capture; defaults to /<screen> when omitted.
158
+ [-p, --path <path>] Web: URL route (e.g., /awards). Mobile: app entry (<appPackage> or dual-id).
159
+ Required for capture; defaults to /<screen> when omitted on web.
123
160
  [-f, --feature <name>] Add a sub-feature .feature file to an existing screen.
124
161
  Output filename = <screen>-<feature>.{feature,yaml,yaml}.
125
- [-c, --capture] Auto-capture a live screenshot to requirements/ui/ (needs --path).
162
+ [-c, --capture] Auto-capture a live screenshot to requirements/ui/ (web only, needs --path).
126
163
  [-d, --description <text>] Screen description (used in spec.md stub).
127
- [--figma <url>] Figma share URL generates spec_figma.md + ui/*.png.
164
+ [--reach <steps>] Mobile navigation recipe: ">"-separated steps from app launch to this screen.
165
+ Scaffolded into the Background. Ignored (with warning) on web projects.
166
+ [--platform android|ios] Mobile only: emit @platform:android/ios tag for OS-specific screens.
167
+ Does NOT affect directory routing.
168
+ [--figma <url>] Figma share URL — generates spec_figma.md + ui/*.png (web only).
128
169
  [--refresh] Bypass Figma cache (use with --figma).
129
170
  [--scale <n>] PNG export scale (default 2).
130
171
  [--hi-res] Shorthand for --scale 4.
@@ -8,6 +8,13 @@ tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwri
8
8
 
9
9
  **Input**: Screen or flow name (e.g., `/sungen-create-test admin-users`).
10
10
 
11
+ ## Platform detection (do this FIRST)
12
+
13
+ Read `qa/capabilities.yaml` and check the `platform` field.
14
+
15
+ - If `platform: mobile` → this is a **mobile project**. When generating scenarios, use mobile gesture vocabulary and selector patterns from the `sungen-mobile-gestures` and `sungen-capture-mobile` skills (tap, swipe, long-press, etc. instead of click/hover; `[accessibility-id]` selectors instead of CSS/role). Mobile-specific steps (permission dialogs, clipboard, geolocation) are valid — do not flag them as invalid Gherkin. The `@platform` tag is not required on individual scenarios (one project = one platform). Visual capture via the `sungen-capture-mobile` skill (Appium MCP live capture) is preferred over web-based capture.
16
+ - If `platform: web` or field absent → **web path**, proceed as normal below.
17
+
11
18
  ## Role
12
19
 
13
20
  You are a **Senior QA Engineer**. You structure test cases by viewpoint categories and translate UI into Gherkin test cases following the `sungen-gherkin-syntax` and `sungen-tc-generation` skills. **Tier 1 (critical+high) first** — expand coverage later. **Gherkin scenarios and test data only** — selectors are handled during `/sungen-run-test`.
@@ -66,11 +73,12 @@ If the unit is **api-first** (`qa/api/<name>/` or `qa/api/flows/<name>/`), the d
66
73
  4. Follow the `sungen-tc-generation` skill for section identification, viewpoint generation, and output format. **For flows**, use the "Flow Test Generation" section in the skill. When requirements exist, use the "Requirements-Driven Generation" strategy. **For Tier 1**, apply the **Lightweight Guard** — verify required fields, validation rules, business rules, security checks, and key state transitions all have TCs after generation. **For Tier 2+**, **MUST** apply the full **Mapping Contract** — walk every `spec.md` section top-to-bottom and produce the indicated TCs per Table 1; handle `test-viewpoint.md` per Table 2. Do not silently skip sections. Present sections as a numbered list and let user pick.
67
74
  5. Generate or update `.feature` + `test-data.yaml` following `sungen-gherkin-syntax` and `sungen-tc-generation` skills. Generate **group-by-group** (one viewpoint group at a time, tier-by-tier `Write`/`Edit` batches) to stay under the output-token cap. **For flows**: use `[Screen:Element]` namespace format, namespace test-data by phase, add `@flow` tag.
68
75
  > **No parallel fan-out here.** Copilot has no sub-agents, so generation is sequential (the Claude Code variant fans out one `sungen-generator` per viewpoint group and merges). Same output, no speedup.
76
+ > **Load lazily (budget, S4).** Per group, load **only** the one matching `sungen-viewpoint` group file + the relevant `spec.md` section(s) — never all five groups or the whole spec. On a tight (~200k) budget, write smaller tier-by-tier batches and keep prior batches on disk; this is what keeps generation inside a non-1M context.
69
77
  5.4. **Depth self-check (deterministic — BEFORE the audit).** Run `sungen depth-lint --screen ${input:name}`. It splits every shallow business-critical scenario into **DEEPEN IN PLACE** (add a real value assertion — the printed `template` is a theme-keyed hint, apply judgment to the actual claim; never fake one onto a visibility/behavior scenario) and **CROSS-SCREEN** (route to a flow / tag `@manual:Mx` + reason — removes it from the depth denominator honestly). Act on both, re-run until `deepen` is empty (or only honest over-counts remain), THEN gate. Lifts first-pass `businessDepth` mechanically instead of via 2–3 repair rounds.
70
78
  5.5. **Quality gate & repair (harness — always run).** Per `sungen-harness-audit`: run `sungen audit --screen ${input:name}` (structural), THEN do an **independent semantic review inline** using the `sungen-reviewer` criteria (does each scenario's steps PROVE its title/viewpoint? observable Thens? business-critical assertion depth?). Merge both sets of issues; if gate FAILs / findings exist, repair (budget 3) and re-audit — GATE missing theme → generate it (cross-screen → **automate it in the flow** via `/sungen:add-flow`, NOT a full `@manual` screen duplicate — `sungen audit` flags an automatable `@manual` as `MANUAL-AUTOMATABLE`; reserve `@manual:Mx` for true judgment/missing-capability); DEPTH → add data assertions; BALANCE → add business-core first; TRACE → align VP ids. Never fake a pass.
71
79
  5.5b. **Phase gate (boundary — do NOT skip).** Run `sungen gate --screen ${input:name} --phase create` (exit 2 = HALT): every required obligation (spec · coverage · depth · trace) must be **satisfied or explicitly waived**. On **HALT**, keep repairing within budget; a genuinely-accepted gap → `sungen journey --screen ${input:name} --waive <OB> --reason "..."` (reason mandatory). Do **not** converge (step 6) past a HALT without a fix or a reasoned waiver.
72
80
  5.6. **Record.** `sungen manifest --screen ${input:name}`. Ledger **each phase** (not just repair) — pick one `runId` at the start and pass it so `trace`/`ledger report` show THIS run, not a mix: `sungen ledger record --screen ${input:name} --run <runId> --step <discovery|viewpoint|gherkin|audit|repair:N> --ms <elapsed>`. On re-run, start with `sungen manifest --screen ${input:name} --diff` and only regenerate changed sections.
73
- 6. **Converge — show the trace.** Run `sungen trace --screen ${input:name}` and present: process map (phases + repair rounds), bottlenecks, **HUMAN-LOOP FOCUS** (@manual to verify), audit score + gate + residual gaps. Then offer next steps based on which tier was just generated:
81
+ 6. **Converge — show the journey board first, then the trace.** First run `sungen journey --screen ${input:name}` and present the board: **📍 you-are-here**, the **obligation checklist** (what must still be true), and **especially the 🔎 Review queue** each item carries an IDE-jumpable anchor 〔`VP-id · file:line`〕 that tells the user *what to review and where*. End with the board's **→ Next**. Then run `sungen trace --screen ${input:name}` for the process map (phases + repair rounds), bottlenecks, audit score + gate + residual gaps. Then offer next steps based on which tier was just generated:
74
82
 
75
83
  > The harness gate + reviewer already ran above — `/sungen-review` is the independent checkpoint (hand/prompt-authored or pre-delivery), not a needed next step here.
76
84
 
@@ -19,6 +19,10 @@ If `--env` is passed but no value follows, ask the user which locale to use.
19
19
 
20
20
  ## Steps
21
21
 
22
+ ### 0. Sign-off gate (per screen — the deliver boundary)
23
+
24
+ Delivery is the **last phase** and its boundary requires a human sign-off (S5). For each screen/flow, run `sungen gate --screen <name> --phase deliver` (exit 2 = HALT). On **HALT** the screen is **not signed off yet**: present `sungen journey --screen <name>` (the **🔎 Review queue** + anchors 〔`VP-id · file:line`〕) so the user reviews *what / where*, then resolve the items or sign off with `sungen journey --screen <name> --signoff --by "<name>"`. Do **not** export past a deliver HALT without a sign-off (skip only for an explicit draft/preview export).
25
+
22
26
  ### 1. Invoke the CLI
23
27
 
24
28
  Run via Bash (single command, no extra parsing):
@@ -42,6 +46,8 @@ The CLI handles:
42
46
  - Generating CSV/XLSX at `qa/deliverables/<name>-testcases[.<env>].csv` / `.xlsx`
43
47
  - Printing summary table
44
48
 
49
+ **Mobile projects (`platform: mobile`):** a plain `delivery <name>` (no `SUNGEN_ENV`) auto-emits one deliverable PER OS — `<name>-testcases.android.{csv,xlsx}` + `<name>-testcases.ios.{csv,xlsx}` (from each `<name>-test-result.<os>.json`) — and writes **NO** base `<name>-testcases.{csv,xlsx}` (a stale base pair is removed). The **Test Environment** column shows only that OS's app id (Android package vs iOS bundle id), never the combined dual-id `Path:`. `SUNGEN_ENV=android|ios` still targets a single OS.
50
+
45
51
  ### 2. Handle pre-flight failures (if CLI exits non-zero)
46
52
 
47
53
  If the CLI exits with blocking issues, it will have already printed a clear table showing exactly what's missing per target.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: sungen-locale
3
- description: 'Bootstrap i18n for a screen/flow — audit selectors, detect locale switch mechanism via Playwright, generate test-data overlay so `sungen:run-test --env <locale>` works.'
3
+ description: 'Bootstrap i18n for a screen/flow — audit selectors, detect locale switch mechanism via Playwright (web) or device locale (mobile), generate test-data overlay so `sungen:run-test --env <locale>` works.'
4
4
  argument-hint: "<name> <locale> [--base-locale <code>] [--offline]"
5
- tools: [read, execute, edit, vscode/askQuestions, playwright/*]
5
+ tools: [read, execute, edit, vscode/askQuestions, playwright/*, appium/*]
6
6
  ---
7
7
 
8
8
  ## Role
@@ -15,10 +15,31 @@ Parse from `$ARGUMENTS`:
15
15
  - **name** — screen or flow name (e.g. `home`, `awards`). If missing, ask the user.
16
16
  - **locale** — target locale code (e.g. `en`, `ja`, `en-US`, `staging-ja`). If missing, ask. This becomes the suffix in `test-data/<feature>.<locale>.yaml` and `SUNGEN_ENV=<locale>` at run time.
17
17
  - **`--base-locale <code>`** — optional. Locale of the existing `test-data/<feature>.yaml`. Default `vi`. Reporting only — files are never renamed.
18
- - **`--offline`** — force OFFLINE mode (skip Playwright capture). Useful when you know the live page can't be reached.
18
+ - **`--offline`** — force OFFLINE mode (skip live capture). Useful when you know the live page/device can't be reached.
19
19
 
20
20
  Reject if name == locale.
21
21
 
22
+ ## Platform detection (do this FIRST)
23
+
24
+ Read `qa/capabilities.yaml` and check the `platform` field.
25
+
26
+ - If `platform: mobile` → switch to the **mobile path** (below).
27
+ - If `platform: web` or field absent → follow the **web path** (existing behavior, unchanged).
28
+
29
+ ### Mobile path
30
+
31
+ When `platform: mobile`:
32
+
33
+ - **Live capture**: use **Appium MCP** (`select_device` → `appium_session_management(create)` with device at base locale → `appium_get_page_source` / `appium_screenshot`) — NOT Playwright browser tools.
34
+ - **Locale-switch mechanism**: **device locale** — `appium:language` / `appium:locale` caps + `noReset:false` (set by wdio `resolveLocaleCaps` at runtime). There is no URL prefix, query param, or browser-storage injection on mobile.
35
+ - **Phases skipped for mobile**: 3.5 (browser storage diff), 3.6 (storage verification), 6d (Pages URL update), 6f (locale-config.json / locale-fixture). These are web-only; wdio `resolveLocaleCaps` handles runtime locale on mobile automatically — no fixture files needed.
36
+ - **OFFLINE mode** (when device unreachable or `--offline` flag): scaffold overlay template + let user fill manually.
37
+ - **Hand-off**: print `SUNGEN_ENV=<locale> npm run test:mobile`. Include note: "If the device locale code differs from the overlay env name, set `SUNGEN_LOCALE=<code>` — wdio `resolveLocaleCaps` reads it as an override."
38
+ - **Phase 6 (mobile) writes only**: 6a selectors `{{var}}`, 6b base `test-data/<feature>.yaml`, 6c overlay `test-data/<feature>.<locale>.yaml`. No 6d or 6f.
39
+ - **Compile**: `sungen generate --screen <name>` (appium adapter auto-selected in a mobile project).
40
+
41
+ Stop here for mobile — do not continue to the web path.
42
+
22
43
  ## Auto-detect context
23
44
 
24
45
  Same as `/sungen:run-test`:
@@ -26,7 +47,7 @@ Same as `/sungen:run-test`:
26
47
  - Else `qa/screens/<name>/` exists → screen mode (base path: `qa/screens/<name>/`)
27
48
  - Neither → tell user and stop
28
49
 
29
- ## Steps
50
+ ## Steps (web)
30
51
 
31
52
  The `sungen-locale` skill defines 7 phases. Execute them in order:
32
53
 
@@ -8,6 +8,13 @@ tools: [vscode, execute, read, edit, search, todo]
8
8
 
9
9
  **Input**: Screen or flow name (e.g., `/sungen-review admin-users`).
10
10
 
11
+ ## Platform detection (do this FIRST)
12
+
13
+ Read `qa/capabilities.yaml` and check the `platform` field.
14
+
15
+ - If `platform: mobile` → this is a **mobile project**. When reviewing scenarios, apply the **mobile viewpoint**: mobile-specific steps (tap, swipe, long-press, permission dialogs, clipboard, geolocation) are valid — do not flag them as incorrect or web-incompatible. Judge selector references against mobile accessibility patterns (`[accessibility-id]`, content-desc, etc.), not CSS/role. Load `sungen-mobile-gestures` for the canonical mobile step vocabulary. All other harness steps (audit, script-check, scorecard) run unchanged.
16
+ - If `platform: web` or field absent → **web path**, proceed as normal below.
17
+
11
18
  ## Role
12
19
 
13
20
  You are an **independent QA Reviewer** — you did not author these tests. You do **not** invent a parallel score; you run the **harness** and present its signals as a human scorecard. Skills: `sungen-tc-review` (presentation rubric), `sungen-viewpoint`, `sungen-gherkin-syntax`.
@@ -1,13 +1,47 @@
1
1
  ---
2
2
  name: sungen-run-test
3
3
  description: 'Generate selectors + auth state via Playwright MCP, compile, and run Playwright tests — auto-fixes selectors on failure'
4
- argument-hint: "[name] [--env <locale>]"
5
- tools: [read, execute, edit, vscode/askQuestions, playwright/*]
4
+ argument-hint: "[name] [--env <locale>] [--ios|--android|--both]"
5
+ tools: [read, execute, edit, vscode/askQuestions, playwright/*, appium/*]
6
6
  ---
7
7
 
8
8
  ## Role
9
9
 
10
- You are a **Senior Developer**. Use `sungen-selector-fix`, `sungen-selector-keys`, and `sungen-error-mapping` skills.
10
+ You are a **Senior Developer**.
11
+ - **Web screens/flows** → use `sungen-selector-fix`, `sungen-selector-keys`, and `sungen-error-mapping` skills (Playwright MCP + `npx playwright test`).
12
+ - **Mobile screens** (`platform: mobile` in `qa/capabilities.yaml`) → use `sungen-selector-fix-mobile`, `sungen-capture-mobile`, `sungen-mobile-gestures`, `sungen-selector-keys` (Appium MCP + `npm run test:mobile`).
13
+
14
+ ## Platform detection (do this FIRST)
15
+
16
+ Read `qa/capabilities.yaml` and check the `platform` field.
17
+
18
+ - If `platform: mobile` → switch to the **mobile path** (below).
19
+ - If `platform: web` or field absent → follow the **web path** (all steps below, unchanged).
20
+
21
+ ### Mobile path
22
+
23
+ When `platform: mobile`:
24
+
25
+ - **Selectors**: use **Appium MCP** (`select_device` → `appium_session_management(create)` → `generate_locators`), per the `sungen-selector-fix-mobile` skill. Also load `sungen-capture-mobile` and `sungen-mobile-gestures`.
26
+ - **Auth**: web Phase 0.5 (`storageState`) does not exist on mobile. When the feature has `@auth:<role>`, check `specs/.auth-mobile/<role>.json`; if missing, run the guided auth-contract builder (Phase 0.5 in `sungen-selector-fix-mobile`) BEFORE Phase 1.
27
+ - **Compile**: `npx sungen generate --screen <name> --framework appium`
28
+ - **OS selection**: parse the target OS from `$ARGUMENTS` — `--ios`, `--android`, or `--both`
29
+ (alias: `--platform <android|ios|both>`) → set `MOBILE_PLATFORM=<value>`. Default to `android` when no flag is given.
30
+ - **Run**: WebdriverIO, not Playwright. Scope one spec with `SUNGEN_SPECS`; prefix the parsed `MOBILE_PLATFORM`:
31
+ ```bash
32
+ # Android (default — no flag, or --android)
33
+ SUNGEN_SPECS='./specs/generated/<name>/<name>.spec.ts' npm run test:mobile
34
+ # iOS only (--ios)
35
+ SUNGEN_SPECS='./specs/generated/<name>/<name>.spec.ts' MOBILE_PLATFORM=ios npm run test:mobile
36
+ # both OSes (--both)
37
+ SUNGEN_SPECS='./specs/generated/<name>/<name>.spec.ts' MOBILE_PLATFORM=both npm run test:mobile
38
+ ```
39
+ `wdio.conf.ts` auto-selects `@wdio/globals` specs and auto-starts Appium. iOS needs a booted Simulator and `IOS_BUNDLE_ID`/`IOS_UDID` env vars.
40
+ - **Results**: the wdio reporter writes `<name>-test-result.<android|ios>[.<env>].json` — one file per capability, so a both-OS run keeps both outcomes.
41
+ - **Skip** the "Playwright command guidelines" section below — it applies to web only.
42
+ - The phased waves (smoke → priority → full → regression), attempt budgets, and next-steps mirror the web flow — follow the `sungen-selector-fix-mobile` skill for the mobile equivalents.
43
+
44
+ Stop here for mobile — do not continue to the web path.
11
45
 
12
46
  > ⛔ **Source of truth — the live page is NOT the oracle; `.feature`/`test-data`/`spec.md` are.** Auto-fix is for **selector-resolution** failures (wrong locator → fix `selectors.yaml`). An **assertion-value** failure where the app contradicts the spec is a **CANDIDATE BUG → report it, let it FAIL** — never loosen the rule, weaken the assertion, edit the expected value/`.feature`, or hand-edit the generated `.spec.ts` to make it pass. See `sungen-error-mapping` § "Source of truth". (A `password > 8` test that fails on 6 chars is a bug to report, not a `>= 6` edit.)
13
47
 
@@ -94,7 +128,7 @@ If the unit is **api-first**, skip every selector/capture phase (an API test has
94
128
  6. **Phase 2 — Priority Wave**: Run all `@high` scenarios. Fix only failures from this wave. Max 2 attempts. Shared selectors fixed here cascade to later phases.
95
129
  7. **Phase 3 — Full Run**: Run all tests. Fix only **new** failures (elements unique to `@normal`/`@low`). Max 1 attempt. Don't loop on low-priority failures.
96
130
  8. **Phase 4 — Regression**: One final full run. Report results. No more fix loops.
97
- 9. **Integrity & trace (always run after the final run).** `sungen script-check --screen <name>` — verify the spec is a **1:1** of the Gherkin; if **DRIFT**, re-run `sungen generate --screen <name>` (never hand-edit the `.spec.ts` — auto-fix edits `selectors.yaml`). Then `sungen ledger record --screen <name> --step run --ms <elapsed>` and `sungen trace --screen <name>` to show the process map + bottlenecks + **HUMAN-LOOP FOCUS**.
131
+ 9. **Integrity & trace (always run after the final run).** `sungen script-check --screen <name>` — verify the spec is a **1:1** of the Gherkin; if **DRIFT**, re-run `sungen generate --screen <name>` (never hand-edit the `.spec.ts` — auto-fix edits `selectors.yaml`). Then `sungen ledger record --screen <name> --step run --ms <elapsed>` and **present the journey board** — `sungen journey --screen <name>` as the human-facing close-out: **📍 you-are-here**, the **obligation checklist**, and **especially the 🔎 Review queue** with per-item anchors 〔`VP-id · file:line`〕 (*review what / where*) plus any candidate bugs left FAILING by the source-of-truth rule (#387). Then `sungen trace --screen <name>` for the process map + bottlenecks; the board's **→ Next** says whether to sign off & deliver.
98
132
  9b. **Phase gate (boundary — do NOT skip).** `sungen gate --screen <name> --phase run` (exit 2 = HALT): run-boundary obligations (incl. automation) must be **satisfied or explicitly waived**. On HALT, classify per `sungen-error-mapping` § Source of truth (#387): selector-resolution failure → fix `selectors.yaml` + re-run; assertion-vs-spec failure → **report as a candidate bug / leave it FAIL** (never weaken to pass); accepted gap → `sungen journey --screen <name> --waive <OB> --reason "..."`. Don't declare "done" past a HALT without a fix, a reported bug, or a reasoned waiver.
99
133
  10. **Capability-pending offer (consent-gated).** If `sungen audit` reports `AUTOMATION-READY-PENDING` (or `@requires:<cap>` tests are skipped "requires …"), offer: *"N scenario(s) are automation-ready — enable `<cap>` to run them? (`sungen capability add <cap>`)"*. Only on the user's yes, run `sungen capability add <cap>` + re-run; on no, leave skipped (not failures, not manual). **Never auto-install.**
100
134
 
@@ -53,6 +53,8 @@ Source modules: `src/exporters/*.ts`
53
53
 
54
54
  The CLI reads the **per-target result file first** (co-located with `.spec.ts`), then falls back to the global `test-results/results.json`. Per-target is preferred because the global file gets OVERWRITTEN each time Playwright runs, losing results from earlier targets.
55
55
 
56
+ **Mobile (per-OS deliverables):** an Appium run writes one result file per capability — `<name>-test-result.<android|ios>[.<env>].json`. For a mobile project (`platform: mobile`), a plain `sungen delivery <name>` (no `SUNGEN_ENV`) **auto-emits one deliverable PER OS** — `<name>-testcases.android.{csv,xlsx}` + `<name>-testcases.ios.{csv,xlsx}` — and does **NOT** write a base `<name>-testcases.{csv,xlsx}` (android/ios are separate platform runs, not locales of one run, so a base aggregate would be empty/misleading; a stale base pair is removed). The Appium spec (mocha `describe()/it()`) is recognized as compiled (issue #391), so each per-OS CSV shows real Passed/Failed with `@manual` rows as N/A. `SUNGEN_ENV=android|ios sungen delivery <name>` still works to target a single OS. The **Test Environment** column is OS-precise: it shows only that OS's app id from the dual-id `Path:` — the Android **package** (`com.kngroup.media.converter`) on android, the iOS **bundle id** (`com.kngroup.media.converter.dev`) on ios — never the combined dual-id.
57
+
56
58
  ---
57
59
 
58
60
  ## Column mapping (handled by CLI)
@@ -30,7 +30,88 @@ Try: browser_navigate(baseURL)
30
30
 
31
31
  Announce which mode is being used before Phase 1.
32
32
 
33
- ## Phase 1 — Audit selectors (always, no MCP)
33
+ ---
34
+
35
+ ## Mobile (Appium) variant
36
+
37
+ > **When to use:** `qa/capabilities.yaml` has `platform: mobile`. The command reads this file and dispatches here. The web phases below still apply for web projects.
38
+
39
+ ### Mechanism overview
40
+
41
+ | Web | Mobile |
42
+ |---|---|
43
+ | Switch via URL prefix / query param / UI switcher; persist via cookie / localStorage | Switch via **device locale** (`appium:language` / `appium:locale` caps + `noReset:false`) — wdio `resolveLocaleCaps` drives this at runtime |
44
+ | Capture via Playwright MCP `browser_snapshot` | Capture via **Appium MCP** (`select_device` → `appium_session_management` → `appium_get_page_source` / `appium_screenshot`) |
45
+ | Phase 6 writes selectors + test-data + Pages `{{base_path}}` + `locale-config.json` + `locale-fixture.ts` | Phase 6 writes **only** selectors + test-data (6a/6b/6c). No 6d, no 6f. |
46
+ | Handoff: `SUNGEN_ENV=<locale> npx playwright test` | Handoff: `SUNGEN_ENV=<locale> npm run test:mobile` |
47
+
48
+ ### Mobile Phase 1 — Audit selectors (same as web, no MCP)
49
+
50
+ Identical to the web Phase 1 below. Read the screen's `selectors/<feature>.yaml` and list every entry with hardcoded `name` or `value` text. Multi-source text rules for mobile: Android elements expose text via `@text` first, then `@content-desc`; iOS exposes via `@label` first, then `@value`. Treat both as potential locale-dependent candidates.
51
+
52
+ ### Mobile Phase 2 — Capture base locale (LIVE only)
53
+
54
+ 1. `select_device` — choose the connected device (or emulator/simulator).
55
+ 2. `appium_session_management(create)` with the app at the **base locale** (do not set `appium:language` / `appium:locale` — use the device's current locale, which should match the base test-data locale).
56
+ 3. Navigate to the target screen using the Background navigation recipe from the `.feature` file (same as `sungen-capture-mobile` does).
57
+ 4. `appium_get_page_source` + `appium_screenshot` — capture the accessibility tree and visual state.
58
+ 5. For each Phase-1 candidate: verify the hardcoded text appears in the page source (check `@text`, `@content-desc`, `@label`, `@value` attributes). Drop stale candidates that don't appear.
59
+
60
+ Save state as `baseLocale = { pageSource, screenshot }`.
61
+
62
+ ### Mobile Phase 3 — Switch locale (LIVE only) — device locale
63
+
64
+ There is **no URL prefix, query param, or browser storage injection on mobile**. The locale switch mechanism is always **device locale**:
65
+
66
+ 1. Close the current Appium session: `appium_session_management(delete)`.
67
+ 2. Relaunch with `appium:language` set to the language code (e.g. `ja`) and `appium:locale` set to the region code (e.g. `JP`), plus `appium:noReset: false` — this forces the app to re-run its first-launch locale detection from the OS locale, clearing any cached in-app override.
68
+ 3. Navigate to the target screen again (same Background recipe).
69
+ 4. `appium_get_page_source` + `appium_screenshot` — capture target-locale state.
70
+ 5. Compare a known Phase-1 candidate text between base and target snapshots — confirm text differs.
71
+
72
+ **Optional in-app language picker**: if the app has a Settings screen with a language selector, that can be used as an alternative to relaunching. Default is device locale (above). Only use in-app picker if the user confirms it or if `noReset: false` is known ineffective for this app.
73
+
74
+ ### Mobile Phases 3.5 / 3.6 — N/A on mobile (web-only)
75
+
76
+ **Skip entirely.** Phases 3.5 (browser storage diff) and 3.6 (storage verification via `addInitScript`) are Playwright / browser-only. On mobile, runtime locale is driven by `wdio resolveLocaleCaps()` reading `SUNGEN_LOCALE || SUNGEN_ENV` and setting `appium:language` / `appium:locale` caps automatically — no fixture injection needed.
77
+
78
+ ### Mobile Phase 4 — Diff base ↔ target (LIVE only)
79
+
80
+ Same logic as web Phase 4 — pair each surviving candidate with its translated text from the target-locale page source. Match by element type + position in the accessibility tree. Mark unmatched candidates as "needs manual".
81
+
82
+ ### Mobile Phase 5 — Confirm proposal
83
+
84
+ Same as web Phase 5. Present the proposal table; ask user to confirm / edit / cancel.
85
+
86
+ ### Mobile Phase 6 — Apply files
87
+
88
+ Write **only these three outputs**:
89
+
90
+ **6a. Update `selectors/<feature>.yaml`** — replace hardcoded `name`/`value` with `{{varName}}`. (Same as web 6a.)
91
+
92
+ **6b. Update `test-data/<feature>.yaml`** — append new keys under `# === i18n: <screen> ===`. (Same as web 6b.)
93
+
94
+ **6c. Create `test-data/<feature>.<locale>.yaml`** — overlay with only changed keys. Comment header: `# Run with: SUNGEN_ENV=<locale> npm run test:mobile`. (Same as web 6c but different run command.)
95
+
96
+ **6d — SKIP (web-only)**: no Pages `{{base_path}}` changes. Mobile has no URL prefix routing.
97
+
98
+ **6f — SKIP (web-only)**: no `locale-config.json` / `locale-fixture.ts`. wdio `resolveLocaleCaps` handles device locale at runtime — no Playwright context fixture needed.
99
+
100
+ **6e. Compile**: `sungen generate --screen <name>` (or `--flow`). The appium adapter is auto-selected in a mobile project.
101
+
102
+ ### Mobile Phase 7 — Hand off
103
+
104
+ Print summary (same fields as web Phase 7), then suggest:
105
+
106
+ ```
107
+ SUNGEN_ENV=<locale> npm run test:mobile
108
+ ```
109
+
110
+ Add note: *"If the device locale code differs from the overlay env name (e.g. `SUNGEN_ENV=staging-ja` but the device needs `ja`), set `SUNGEN_LOCALE=ja` — wdio `resolveLocaleCaps` reads it as an override."*
111
+
112
+ ---
113
+
114
+ ## Phase 1 — Audit selectors (web + mobile, always, no MCP)
34
115
 
35
116
  For each `.feature` file under the screen, read the matching `selectors/<feature>.yaml`. List every entry whose `name` or `value` field contains literal text WITHOUT `{{…}}` AND is not a CSS/href selector.
36
117
 
@@ -54,7 +135,9 @@ nav kudos | name | Sun* Kudos | brand — skip
54
135
 
55
136
  If zero candidates and zero `{{var}}` already in place → screen has no localizable text. Tell user, stop.
56
137
 
57
- ## Phase 2 — Capture base locale (LIVE only)
138
+ ## Phase 2 — Capture base locale (web, LIVE only)
139
+
140
+ > **Mobile**: see "Mobile Phase 2" in the Mobile (Appium) variant section above.
58
141
 
59
142
  1. Read `playwright.config.ts` for `baseURL`. Read `Path:` from `.feature` for entry path.
60
143
  2. If screen has `@auth:<role>` tags, load `specs/.auth/<role>.json` via `browser_set_storage_state` first.
@@ -69,7 +152,9 @@ Save state in memory as `baseLocale = { url, snapshot, storage }`.
69
152
 
70
153
  If page redirects to `/login` (auth blocker) → stop. Print: *"Auth blocked — cannot capture live page. Re-run with `--offline` flag, or unblock auth first."*
71
154
 
72
- ## Phase 3 — Switch locale (LIVE only) — detect mechanism + storage delta
155
+ ## Phase 3 — Switch locale (web, LIVE only) — detect mechanism + storage delta
156
+
157
+ > **Mobile**: see "Mobile Phase 3" in the Mobile (Appium) variant section above. Phases 3.5 and 3.6 are web-only — skip on mobile.
73
158
 
74
159
  Goal: identify (a) HOW to switch the app to the target locale, and (b) WHAT app-side storage state ends up holding the locale preference so a fresh BrowserContext can be primed identically without driving the UI.
75
160
 
@@ -149,7 +234,9 @@ If verification fails → drop confidence one tier, ask user.
149
234
 
150
235
  Save mechanism + verified storage delta to memory for Phase 6.
151
236
 
152
- ## Phase 4 — Diff base ↔ target (LIVE only)
237
+ ## Phase 4 — Diff base ↔ target (LIVE only, web + mobile)
238
+
239
+ > **Mobile**: use Appium page-source snapshots instead of Playwright snapshots. Logic is identical.
153
240
 
154
241
  For each candidate from Phase 1 that survived Phase 2:
155
242
  - Find the SAME element in target-locale snapshot (match by `role`+position, by `aria-label`, by neighbor structure)
@@ -183,7 +270,9 @@ If user wants to edit a row → fall through to a per-row prompt for `var name`
183
270
 
184
271
  OFFLINE mode: same table but `target text` column blank — user fills via subsequent prompts or by editing the overlay file after the skill finishes.
185
272
 
186
- ## Phase 6 — Apply changes (always, after confirmation)
273
+ ## Phase 6 — Apply changes (web, always, after confirmation)
274
+
275
+ > **Mobile**: follow "Mobile Phase 6" in the Mobile (Appium) variant section — only 6a/6b/6c apply. Skip 6d and 6f entirely.
187
276
 
188
277
  For each confirmed row:
189
278
 
@@ -211,7 +300,7 @@ nav_about: 'About SAA 2025'
211
300
  nav_awards: 'Awards Info'
212
301
  ```
213
302
 
214
- **6d. (URL/query mechanism only) Update Pages selectors**
303
+ **6d. (web, URL/query mechanism only) Update Pages selectors**
215
304
 
216
305
  URL prefix:
217
306
 
@@ -237,7 +326,9 @@ Query param mechanism: append `query_suffix` similarly.
237
326
 
238
327
  UI switcher: do NOT modify Pages. Write storage delta into `specs/generated/locale-config.json` (sibling of generated `base.ts` + `locale-fixture.ts`) (6f).
239
328
 
240
- **6f. Storage injection config — `specs/generated/locale-config.json` (sibling of generated `base.ts` + `locale-fixture.ts`)**
329
+ **6f. (web-only) Storage injection config — `specs/generated/locale-config.json` (sibling of generated `base.ts` + `locale-fixture.ts`)**
330
+
331
+ > **Mobile**: skip 6f entirely. wdio `resolveLocaleCaps` sets the device locale via Appium caps — no Playwright fixture needed.
241
332
 
242
333
  Always write `specs/generated/locale-config.json` (sibling of generated `base.ts` + `locale-fixture.ts`) with the verified storage delta from Phase 3.5/3.6. Consumed by `specs/locale-fixture.ts` (auto-generated alongside `specs/base.ts`), which wraps Playwright's context and calls `addInitScript` + `addCookies` BEFORE the first navigation.
243
334
 
@@ -269,15 +360,21 @@ Print summary:
269
360
  - N selectors converted to `{{var}}`
270
361
  - M base keys added to `test-data/<feature>.yaml`
271
362
  - K overlay keys written to `test-data/<feature>.<locale>.yaml`
272
- - Pages selectors updated: yes/no
273
- - Locale-switching mechanism: URL prefix `/en` / query `?lang=en` / UI switcher / manual
363
+ - Pages selectors updated: yes/no (web only; N/A on mobile)
364
+ - Locale-switching mechanism: URL prefix `/en` / query `?lang=en` / UI switcher / manual (web) | device locale via `appium:language`/`appium:locale` (mobile)
274
365
 
275
366
  Suggest:
276
367
 
277
368
  ```
369
+ # web
278
370
  /sungen:run-test <name> --env <locale>
371
+
372
+ # mobile
373
+ SUNGEN_ENV=<locale> npm run test:mobile
279
374
  ```
280
375
 
376
+ > **Mobile note**: if the device locale code differs from the overlay env name (e.g. `SUNGEN_ENV=staging-ja` but device needs `ja`), set `SUNGEN_LOCALE=ja` — wdio `resolveLocaleCaps` reads it as an override.
377
+
281
378
  ## Multi-feature screens
282
379
 
283
380
  If the screen has multiple `.feature` files (e.g. `home.feature` + `home-modal.feature`), repeat Phase 1 → Phase 6 for each feature file with its own selectors + test-data pair. Phase 2 + 3 run **once per screen** — mechanism is the same. Phase 4 runs per feature because UI scope differs.