@sun-asterisk/sungen 3.2.2-beta.11 → 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 +11 -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 +8 -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 +11 -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 +8 -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
@@ -41,6 +41,7 @@ exports.ScreenManager = void 0;
41
41
  const fs = __importStar(require("fs"));
42
42
  const path = __importStar(require("path"));
43
43
  const test_1 = require("@playwright/test");
44
+ const capability_1 = require("../harness/capability");
44
45
  class ScreenManager {
45
46
  constructor() {
46
47
  this.cwd = process.cwd();
@@ -52,15 +53,27 @@ class ScreenManager {
52
53
  async addScreen(options) {
53
54
  // Validate screen name
54
55
  this.validateScreenName(options.name);
56
+ // Detect project platform from qa/capabilities.yaml (single source of truth)
57
+ const caps = (0, capability_1.readCapabilities)(this.cwd);
58
+ const isMobile = caps.platform === 'mobile';
59
+ // --reach is mobile-only; warn and drop when the project is web
60
+ if (options.reach && !isMobile) {
61
+ console.warn(`Warning: --reach is a mobile navigation recipe and is ignored for web projects ` +
62
+ `(web screens are addressed by their --path URL). Dropping it.`);
63
+ options = { ...options, reach: undefined };
64
+ }
55
65
  // Normalize screen name for directory
56
66
  const screenName = this.normalizeScreenName(options.name);
67
+ // Always use qa/screens/ regardless of platform (1-platform model — no qa/mobile/ tree)
57
68
  const screenDir = path.join(this.screensDir, screenName);
58
- // Derive filename: --feature flag creates "<screen>-<feature>" name
69
+ // Derive filename: --feature flag creates "<screen>-<feature>" name.
70
+ // For mobile, `path` is the app entry (pkg/Activity), NOT a URL — never derive
71
+ // the filename from it; use the screen name instead.
59
72
  let filename;
60
73
  if (options.feature) {
61
74
  filename = `${screenName}-${this.normalizeScreenName(options.feature)}`;
62
75
  }
63
- else if (options.path) {
76
+ else if (options.path && !isMobile) {
64
77
  filename = this.extractFilenameFromPath(options.path);
65
78
  }
66
79
  else {
@@ -108,18 +121,25 @@ class ScreenManager {
108
121
  // Generate and write feature file
109
122
  const featureContent = this.generateFeatureTemplate(options, filename);
110
123
  fs.writeFileSync(featurePath, featureContent, 'utf-8');
111
- // Generate empty selector YAML (with page entry)
124
+ // Generate empty selector YAML. Web gets a `page` entry (the route); mobile
125
+ // selectors come from Appium MCP at run-test, so it's just a header comment.
112
126
  if (!fs.existsSync(selectorPath)) {
113
- const pagePath = options.path || `/${screenName}`;
114
- fs.writeFileSync(selectorPath, [
115
- `# ${options.name} Screen Selectors`,
116
- `# Fill via AI or manually`,
117
- ``,
118
- `${screenName}:`,
119
- ` type: 'page'`,
120
- ` value: '${pagePath}'`,
121
- ``,
122
- ].join('\n'), 'utf-8');
127
+ const selectorLines = isMobile
128
+ ? [
129
+ `# ${options.name} Screen Selectors (mobile)`,
130
+ `# Generated at /sungen:run-test via Appium MCP — accessibility-id preferred.`,
131
+ ``,
132
+ ]
133
+ : [
134
+ `# ${options.name} Screen Selectors`,
135
+ `# Fill via AI or manually`,
136
+ ``,
137
+ `${screenName}:`,
138
+ ` type: 'page'`,
139
+ ` value: '${options.path || `/${screenName}`}'`,
140
+ ``,
141
+ ];
142
+ fs.writeFileSync(selectorPath, selectorLines.join('\n'), 'utf-8');
123
143
  }
124
144
  // Generate empty test-data YAML
125
145
  if (!fs.existsSync(testDataPath)) {
@@ -198,9 +218,9 @@ class ScreenManager {
198
218
  '',
199
219
  ].join('\n'), 'utf-8');
200
220
  }
201
- // Auto-screenshot: capture page only when --capture is set (requires --path)
221
+ // Auto-screenshot: capture page only when --capture is set and not mobile (requires --path)
202
222
  // Use filename (not screenName) so each feature gets its own screenshots
203
- if (options.capture && options.path) {
223
+ if (options.capture && options.path && !isMobile) {
204
224
  await this.captureScreenshot(options.path, requirementsUiDir, filename);
205
225
  }
206
226
  // Display success
@@ -214,12 +234,22 @@ class ScreenManager {
214
234
  console.log(` ${path.relative(this.cwd, requirementsUiDir)}/`);
215
235
  }
216
236
  console.log('');
217
- console.log('Next steps:');
218
- console.log(` 1. Fill requirements/spec.md with screen spec (fields, validation, business rules)`);
219
- console.log(` Optionally add UI designs to requirements/ui/ (screenshots, mockups)`);
220
- console.log(` 2. Generate test cases: /sungen:create-test ${screenName} (or /sungen-create-test)`);
221
- console.log(` 3. Compile: sungen generate --screen ${screenName}`);
222
- console.log(` 4. Run: npx playwright test\n`);
237
+ if (isMobile) {
238
+ console.log('Next steps:');
239
+ console.log(` 1. Fill requirements/spec.md with screen spec (elements, actions, business rules)`);
240
+ console.log(` Use /sungen:add-screen with sungen-capture-mobile to scan via Appium MCP`);
241
+ console.log(` 2. Generate test cases: /sungen:create-test ${screenName}`);
242
+ console.log(` 3. Compile: sungen generate --screen ${screenName} --framework appium`);
243
+ console.log(` 4. Run: npm run test:mobile\n`);
244
+ }
245
+ else {
246
+ console.log('Next steps:');
247
+ console.log(` 1. Fill requirements/spec.md with screen spec (fields, validation, business rules)`);
248
+ console.log(` Optionally add UI designs to requirements/ui/ (screenshots, mockups)`);
249
+ console.log(` 2. Generate test cases: /sungen:create-test ${screenName} (or /sungen-create-test)`);
250
+ console.log(` 3. Compile: sungen generate --screen ${screenName}`);
251
+ console.log(` 4. Run: npx playwright test\n`);
252
+ }
223
253
  }
224
254
  /**
225
255
  * Capture full-page screenshot of the screen URL
@@ -295,6 +325,55 @@ class ScreenManager {
295
325
  return this.normalizeScreenName(lastSegment);
296
326
  }
297
327
  generateSpecTemplate(options, screenName) {
328
+ const caps = (0, capability_1.readCapabilities)(this.cwd);
329
+ const isMobile = caps.platform === 'mobile';
330
+ if (isMobile) {
331
+ const appEntry = options.path || this.readWdioAppEntry() || '<appPackage>';
332
+ return `# ${options.name} Screen Specification
333
+
334
+ ## Overview
335
+ - **App Entry:** ${appEntry}
336
+ - **Platform:** mobile (Android + iOS)
337
+ - **Auth Required:** no
338
+ - **Reach:** ${options.reach || '<!-- nav recipe: how to reach this screen from app launch, e.g. "tap [My Page] tab > tap [Settings] row" -->'}
339
+
340
+ ## Sections
341
+
342
+ ### Section: [Section Name]
343
+ - **Type:** list | card | form | modal | navigation | tab-bar
344
+ - **Description:** [Brief description of this section]
345
+
346
+ #### Elements
347
+ | Element | Type | Identifier | Notes |
348
+ |---------|------|------------|-------|
349
+ | [Element Name] | button | accessibility-id | [tap target, e.g., submits form] |
350
+
351
+ #### Actions
352
+ | Action | Element | Behavior |
353
+ |--------|---------|----------|
354
+ | [Action Name] | button | [What happens on tap] |
355
+
356
+ #### States
357
+ | State | Condition | Visual |
358
+ |-------|-----------|--------|
359
+ | Default | Screen load | [Default appearance] |
360
+ | Loading | After tap | [Loading indicator] |
361
+ | Error | Action fails | [Error appearance] |
362
+ | Success | Action complete | [Success behavior] |
363
+
364
+ ## Business Rules
365
+ <!-- Rules that affect test logic: limits, permissions, conditions -->
366
+ - [Rule 1]
367
+
368
+ ## Accessibility
369
+ <!-- Accessibility IDs, content-desc, aria-labels -->
370
+ - Accessibility IDs: [element: id]
371
+
372
+ ## Notes
373
+ <!-- Edge cases, known issues, environment-specific behavior -->
374
+ - [Note 1]
375
+ `;
376
+ }
298
377
  const pagePath = options.path || `/${screenName}`;
299
378
  return `# ${options.name} Screen Specification
300
379
 
@@ -351,8 +430,41 @@ class ScreenManager {
351
430
  }
352
431
  generateFeatureTemplate(options, filename) {
353
432
  const screenName = this.normalizeScreenName(options.name);
354
- const featurePath = options.path || `/${screenName}`;
355
433
  const description = options.description || `interact with the ${options.name} screen`;
434
+ const caps = (0, capability_1.readCapabilities)(this.cwd);
435
+ const isMobile = caps.platform === 'mobile';
436
+ if (isMobile) {
437
+ // Determine platform tag: --platform android/ios emits a per-OS tag for OS-specific screens.
438
+ // Default (no --platform) = cross-platform, no OS-specific tag.
439
+ const platformTag = options.platform === 'android' ? '@platform:android'
440
+ : options.platform === 'ios' ? '@platform:ios'
441
+ : '@platform:mobile';
442
+ // App entry: explicit --path → wdio.conf.ts default → placeholder.
443
+ const appEntry = options.path || this.readWdioAppEntry() || '<appPackage>';
444
+ // Navigation recipe (Background block)
445
+ const background = this.buildMobileBackground(options.reach);
446
+ return `${platformTag}
447
+ Feature: ${options.name} Screen
448
+
449
+ As a user
450
+ I want to ${description}
451
+ So that I can accomplish my tasks
452
+ Path: ${appEntry}
453
+
454
+ # Mobile (Appium) — selectors generated at /sungen:run-test via Appium MCP.
455
+ # Use accessibility-id selectors; assert text content with \`header with {{var}}\`
456
+ # (compiles to content-desc/label via toHaveAttribute). See sungen-mobile-gestures
457
+ # for swipe/long-press/scroll steps.
458
+
459
+ ${background}
460
+ @high
461
+ Scenario: Sample scenario for ${options.name}
462
+ When User tap [element]
463
+ Then User see [result] header with {{result_text}}
464
+ `;
465
+ }
466
+ // Web feature stub
467
+ const featurePath = options.path || `/${screenName}`;
356
468
  return `Feature: ${options.name} Screen
357
469
 
358
470
  As a user
@@ -369,6 +481,77 @@ class ScreenManager {
369
481
  Then User see [result] text with {{success}}
370
482
  `;
371
483
  }
484
+ /**
485
+ * Read the default app entry (`<appPackage>/<appActivity>`) from the project's wdio.conf.ts so a
486
+ * mobile `add-screen` without `--path` scaffolds a real, runnable `Path:` matching the configured
487
+ * app instead of a `<placeholder>`. Supports both the env-default form
488
+ * (`APP_PACKAGE = process.env.APP_PACKAGE || '…'`) and the literal capability form
489
+ * (`'appium:appPackage': '…'`). Returns null when wdio.conf.ts is absent or unparseable.
490
+ */
491
+ readWdioAppEntry() {
492
+ const wdioPath = path.join(this.cwd, 'wdio.conf.ts');
493
+ if (!fs.existsSync(wdioPath))
494
+ return null;
495
+ let src;
496
+ try {
497
+ src = fs.readFileSync(wdioPath, 'utf-8');
498
+ }
499
+ catch {
500
+ return null;
501
+ }
502
+ const pick = (re) => src.match(re)?.[1]?.trim();
503
+ const pkg = pick(/APP_PACKAGE\s*=\s*process\.env\.APP_PACKAGE\s*\|\|\s*['"]([^'"]+)['"]/) ??
504
+ pick(/['"]appium:appPackage['"]\s*:\s*['"]([^'"]+)['"]/);
505
+ if (!pkg)
506
+ return null;
507
+ const activity = pick(/APP_ACTIVITY\s*=\s*process\.env\.APP_ACTIVITY\s*\|\|\s*['"]([^'"]+)['"]/) ??
508
+ pick(/['"]appium:appActivity['"]\s*:\s*['"]([^'"]+)['"]/);
509
+ return activity ? `${pkg}/${activity}` : pkg;
510
+ }
511
+ /**
512
+ * Build the Background block for a mobile screen — the navigation recipe (in-app web-path
513
+ * analog). Line 1 is the `Given User is on [Home] screen` launcher/landing anchor; each step
514
+ * from `--reach` (a `>`-separated list) becomes a `When/And User <step>` nav line, taking the
515
+ * app from launch to THIS screen. capture-mobile replays these to land on the target screen
516
+ * before scanning. With no recipe, emit a guided stub (anchor + commented placeholder).
517
+ */
518
+ buildMobileBackground(reach) {
519
+ // Normalize one nav segment to a bare step body ("tap [My Page] tab"): drop any leading
520
+ // Gherkin keyword and a leading "User " so we can re-emit "When/And User <body>" cleanly.
521
+ const normalizeStep = (raw) => raw
522
+ .trim()
523
+ .replace(/^(given|when|and|then|but)\s+/i, '')
524
+ .replace(/^user\s+/i, '')
525
+ .trim();
526
+ const steps = (reach || '')
527
+ .split('>')
528
+ .map(normalizeStep)
529
+ .filter(Boolean);
530
+ if (steps.length === 0) {
531
+ // No recipe → guided stub. Keep the anchor (correct as-is when this IS the launcher
532
+ // screen); the comments tell create-test / capture-mobile how to fill the nav steps.
533
+ return [
534
+ ' Background:',
535
+ ' # Navigation recipe — how to reach THIS screen from app launch (the in-app',
536
+ ' # web-path analog). Line 1 is the launcher/landing screen the app opens on;',
537
+ ' # add a `When/And User tap [...]` per hop to reach this screen. capture-mobile',
538
+ ' # replays these so Appium lands here (not the launcher) before scanning. Leave',
539
+ ' # only the anchor if this IS the launcher screen. Prefill with',
540
+ ' # --reach "tap [Tab] > tap [Row]" at add-screen time.',
541
+ ' Given User is on [Home] screen',
542
+ ' # When User tap [<tab or button that leads to this screen>]',
543
+ '',
544
+ ].join('\n');
545
+ }
546
+ const navLines = steps.map((body, i) => ` ${i === 0 ? 'When' : 'And'} User ${body}`);
547
+ return [
548
+ ' Background:',
549
+ ' # Navigation recipe — replayed by capture-mobile to land on this screen before scanning.',
550
+ ' Given User is on [Home] screen',
551
+ ...navLines,
552
+ '',
553
+ ].join('\n');
554
+ }
372
555
  }
373
556
  exports.ScreenManager = ScreenManager;
374
557
  //# sourceMappingURL=screen-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"screen-manager.js","sourceRoot":"","sources":["../../src/orchestrator/screen-manager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA4C;AAU5C,MAAa,aAAa;IAIxB;QACE,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,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CAAC;QACF,OAAO;YACL,eAAe;YACf,8FAA8F;YAC9F,oCAAoC;YACpC,GAAG,QAAQ;YACX,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF;AAxiBD,sCAwiBC"}
@@ -1,30 +1,48 @@
1
1
  ---
2
2
  name: 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>]
5
- allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_snapshot, mcp__figma__get_design_context, mcp__figma__get_variable_defs, mcp__figma__get_screenshot
4
+ argument-hint: "[flow-name] [--path <start-url>] [--reach <steps>]"
5
+ allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_snapshot, mcp__figma__get_design_context, mcp__figma__get_variable_defs, mcp__figma__get_screenshot, mcp__appium-mcp__select_device, mcp__appium-mcp__appium_session_management, mcp__appium-mcp__generate_locators, mcp__appium-mcp__appium_get_page_source, mcp__appium-mcp__appium_find_element, mcp__appium-mcp__appium_gesture, mcp__appium-mcp__appium_screenshot
6
6
  ---
7
7
 
8
8
  You are adding a new Sungen flow for E2E cross-screen test generation.
9
9
 
10
+ ## Platform detection (do this FIRST)
11
+
12
+ Read `qa/capabilities.yaml` and check the `platform` field.
13
+
14
+ - If `platform: mobile` → follow the **mobile path** in each step below.
15
+ - If `platform: web` or field absent → follow the **web path** (all steps unchanged).
16
+
10
17
  ## Parameters
11
18
 
12
19
  Parse from `$ARGUMENTS`:
13
20
  - **flow** — flow name (e.g., `award-submission`, `user-onboarding`)
14
- - **--path \<url\>** — starting page URL path (default: `/login`)
21
+ - **--path \<url\>** — starting page URL path for web (default: `/login`); or app entry for mobile (`<appPackage>`)
22
+ - **--reach \<steps\>** — (mobile only) navigation recipe for the flow's first screen: `>`-separated nav steps from app launch. Ignored (with warning) on web projects.
15
23
  - **--description \<text\>** — flow description (optional)
16
24
 
17
25
  If **flow** is missing, ask: "What is the flow name? (e.g., `award-submission`, `user-onboarding`)"
18
- If **path** is missing, ask: "What is the starting URL path? (e.g., `/login`)"
26
+ If **path** is missing:
27
+ - **Web** → ask: "What is the starting URL path? (e.g., `/login`)"
28
+ - **Mobile** → read `wdio.conf.ts` and propose the app entry (package alone). Use `AskUserQuestion` to confirm before scaffolding.
19
29
 
20
30
  ## Steps
21
31
 
22
32
  ### 1. Scaffold the flow
23
33
 
34
+ **Web:**
24
35
  ```bash
25
36
  sungen add-flow --flow <name> --path <path>
26
37
  ```
27
38
 
39
+ **Mobile (when `platform: mobile` in `qa/capabilities.yaml`):**
40
+ ```bash
41
+ sungen add-flow --flow <name> [--reach "tap [My Page] tab > tap [Settings] row"]
42
+ # --reach is the navigation recipe for the flow's first screen → scaffolded into the Background.
43
+ # Directories are always qa/flows/<name>/ (never qa/mobile/).
44
+ ```
45
+
28
46
  This creates:
29
47
  ```
30
48
  qa/flows/<name>/
@@ -47,6 +65,16 @@ Record the screen list — you will need it for:
47
65
 
48
66
  ### 2. Capture visual source
49
67
 
68
+ **Mobile path (when `platform: mobile` in `qa/capabilities.yaml`):**
69
+
70
+ Use `AskUserQuestion`: *"Capture a live screen via Appium MCP now?"*
71
+ - **Yes, capture now (Recommended)** — invoke the `sungen-capture-mobile` skill (Appium MCP) for the first screen of the flow. It replays the Background nav recipe, scans the locator tree, and saves a screenshot to `requirements/ui/`. Repeat for each screen in the flow as needed.
72
+ - **Skip** — user will capture later via `/sungen:run-test` or manually.
73
+
74
+ Do NOT invoke `sungen-capture` (web/Figma) for a mobile project. Use `sungen-capture-mobile` only.
75
+
76
+ **Web path:**
77
+
50
78
  Use `AskUserQuestion`: *"Pick a visual source for this flow's screens:"*
51
79
  - **Figma designs** (Recommended for pre-launch) — invoke `sungen-capture` skill (mode figma-mcp) for each screen
52
80
  - **Live page scan** (dev/staging is up) — invoke `sungen-capture` skill (mode live) for each screen URL
@@ -1,25 +1,38 @@
1
1
  ---
2
2
  name: add-screen
3
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 from Figma (pre-launch) or live page via the capture skills'
4
- argument-hint: "[screen-name] [url-path] [--feature <name>] [--figma <url>]"
5
- allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_snapshot, mcp__figma__get_design_context, mcp__figma__get_variable_defs, mcp__figma__get_screenshot
4
+ argument-hint: "[screen-name] [url-path] [--feature <name>] [--figma <url>] [--reach <steps>] [--platform android|ios]"
5
+ allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_snapshot, mcp__figma__get_design_context, mcp__figma__get_variable_defs, mcp__figma__get_screenshot, mcp__appium-mcp__select_device, mcp__appium-mcp__appium_session_management, mcp__appium-mcp__generate_locators, mcp__appium-mcp__appium_get_page_source, mcp__appium-mcp__appium_find_element, mcp__appium-mcp__appium_gesture, mcp__appium-mcp__appium_screenshot
6
6
  ---
7
7
 
8
8
  You are adding a new Sungen screen for test generation, or extending an existing screen with an additional `.feature` file (sub-feature).
9
9
 
10
+ ## Platform detection (do this FIRST)
11
+
12
+ Read `qa/capabilities.yaml` and check the `platform` field.
13
+
14
+ - If `platform: mobile` → follow the **mobile path** in each step below.
15
+ - If `platform: web` or field absent → follow the **web path** (all steps unchanged).
16
+
10
17
  ## Parameters
11
18
 
12
19
  Parse from `$ARGUMENTS`:
13
20
  - **screen** — screen name (e.g., `login`, `dashboard`, `settings`)
14
- - **path** — URL path (e.g., `/login`, `/dashboard`, `/settings`) - optional when `--figma` is provided or when adding a sub-feature to an existing screen
21
+ - **path** — URL path for web (e.g., `/login`), or app entry for mobile (`<appPackage>` / `<iosBundleId>` / dual-id `"<pkg> | <bundleId>"`). Optional when `--figma` is provided or when adding a sub-feature.
22
+ - **`--reach <steps>`** — (mobile only) navigation recipe: `>`-separated nav steps from app launch to this screen, e.g. `"tap [My Page] tab > tap [Settings] row"`. Scaffolded into the Background. Ignored (with a warning) on web projects.
23
+ - **`--platform android|ios`** — (mobile only, optional) emit `@platform:android` or `@platform:ios` on the stub for OS-specific screens. Omit for cross-platform mobile. Does NOT affect directory routing.
15
24
  - **`--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 (e.g. main listing + modal + filter panel).
16
- - **`--figma <url>`** — Figma share URL (optional)
25
+ - **`--figma <url>`** — Figma share URL (optional, web only)
17
26
  - **`--refresh`** — bypass Figma cache and re-fetch (optional, use with `--figma`)
18
27
  - **`--scale <n>`** — PNG export scale factor, default 2 (optional)
19
28
  - **`--hi-res`** — export at 4× scale, shorthand for `--scale 4` (optional)
20
29
 
21
30
  If **screen** is missing, ask: "What is the screen name? (e.g., `login`, `dashboard`)"
22
- If **path** is missing and **`--feature`** is NOT used and `--figma` was NOT provided, ask: "What is the URL path? (e.g., `/login`, `/dashboard`)"
31
+ If **path** is missing and **`--feature`** is NOT used and `--figma` was NOT provided:
32
+ - **Web** → ask: "What is the URL path? (e.g., `/login`, `/dashboard`)"
33
+ - **Mobile** → read `wdio.conf.ts` at the repo root and derive a proposal from `APP_PACKAGE` (Android) and `IOS_BUNDLE_ID` (iOS). Propose the package alone for mobile-android/mobile-ios, or the dual-id `"<pkg> | <bundleId>"` for cross-platform. Use `AskUserQuestion` to confirm before scaffolding.
34
+
35
+ After confirming the app entry for a mobile project, ask: "After the app launches, what taps reach this screen? e.g. `tap [My Page] tab > tap [Account Settings] row` — leave blank if this IS the launcher/home screen." Pass the answer as `--reach "..."`.
23
36
 
24
37
  **Mode detection** — before invoking the CLI, check whether `qa/screens/<screen>/` already exists:
25
38
  - Screen does NOT exist → fresh screen creation (need `--path` unless `--figma` provided)
@@ -30,11 +43,24 @@ If **path** is missing and **`--feature`** is NOT used and `--figma` was NOT pro
30
43
 
31
44
  ### 1. Scaffold the screen (or sub-feature)
32
45
 
33
- **Standard path (no `--figma`, no `--feature`):**
46
+ **Web — standard path (no `--figma`, no `--feature`):**
34
47
  ```bash
35
48
  sungen add --screen <screen> --path <path>
36
49
  ```
37
50
 
51
+ **Mobile path (when `platform: mobile` in `qa/capabilities.yaml`):**
52
+ ```bash
53
+ sungen add --screen <screen> \
54
+ --path "<appPackage>[ | <iosBundleId>]" \
55
+ [--reach "tap [My Page] tab > tap [Account Settings] row"] \
56
+ [--platform android|ios]
57
+ # --path is the app entry (package alone; launch activity auto-detected).
58
+ # --reach is the navigation recipe → scaffolded into the Background.
59
+ # Omit --reach when the screen IS the launcher/home screen.
60
+ # --platform android|ios is optional: emits @platform:android/ios for OS-specific screens only.
61
+ # Directories are always qa/screens/<screen>/ (never qa/mobile/).
62
+ ```
63
+
38
64
  **Sub-feature mode (`--feature <name>` provided):**
39
65
  ```bash
40
66
  sungen add --screen <screen> --feature <name> [--path <path>]
@@ -43,7 +69,7 @@ sungen add --screen <screen> --feature <name> [--path <path>]
43
69
  # --path is optional — defaults to /<screen> when omitted. Pass --path only if the sub-feature lives at a different URL.
44
70
  ```
45
71
 
46
- **Figma branch (when `--figma <url>` is in `$ARGUMENTS`):**
72
+ **Figma branch (when `--figma <url>` is in `$ARGUMENTS`, web only):**
47
73
 
48
74
  Invoke the `sungen-capture` skill (mode figma-pat) by running:
49
75
  ```bash
@@ -86,6 +112,16 @@ After `sungen add --figma` succeeds, the envelope of `spec_figma.md` is determin
86
112
 
87
113
  ### 2. Capture visual source
88
114
 
115
+ **Mobile path (when `platform: mobile` in `qa/capabilities.yaml`):**
116
+
117
+ Use `AskUserQuestion`: *"Capture a live screen via Appium MCP now?"*
118
+ - **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/`.
119
+ - **Skip** — user will capture later via `/sungen:run-test` or manually.
120
+
121
+ Do NOT invoke `sungen-capture` (web/Figma) for a mobile project. Use `sungen-capture-mobile` only.
122
+
123
+ **Web path:**
124
+
89
125
  **If Figma branch (Step 1) already downloaded PNGs** → visuals already exist. Use `AskUserQuestion` to offer:
90
126
  - **Continue** — Figma visuals are enough (Recommended)
91
127
  - **Also capture live page** — supplement Figma with real page scan (invoke `sungen-capture` skill (mode live))
@@ -120,12 +156,17 @@ If user picks `/sungen:create-test`, **you MUST use the Skill tool** to invoke i
120
156
 
121
157
  ```
122
158
  sungen add --screen <name>
123
- [-p, --path <path>] URL route (e.g., /awards). Required for capture; defaults to /<screen> when omitted.
159
+ [-p, --path <path>] Web: URL route (e.g., /awards). Mobile: app entry (<appPackage> or dual-id).
160
+ Required for capture; defaults to /<screen> when omitted on web.
124
161
  [-f, --feature <name>] Add a sub-feature .feature file to an existing screen.
125
162
  Output filename = <screen>-<feature>.{feature,yaml,yaml}.
126
- [-c, --capture] Auto-capture a live screenshot to requirements/ui/ (needs --path).
163
+ [-c, --capture] Auto-capture a live screenshot to requirements/ui/ (web only, needs --path).
127
164
  [-d, --description <text>] Screen description (used in spec.md stub).
128
- [--figma <url>] Figma share URL generates spec_figma.md + ui/*.png.
165
+ [--reach <steps>] Mobile navigation recipe: ">"-separated steps from app launch to this screen.
166
+ Scaffolded into the Background. Ignored (with warning) on web projects.
167
+ [--platform android|ios] Mobile only: emit @platform:android/ios tag for OS-specific screens.
168
+ Does NOT affect directory routing.
169
+ [--figma <url>] Figma share URL — generates spec_figma.md + ui/*.png (web only).
129
170
  [--refresh] Bypass Figma cache (use with --figma).
130
171
  [--scale <n>] PNG export scale (default 2).
131
172
  [--hi-res] Shorthand for --scale 4.
@@ -13,6 +13,13 @@ If `spec_figma.md` exists OR the user provides a Figma URL for the PAT flow:
13
13
 
14
14
  ---
15
15
 
16
+ ## Platform detection (do this FIRST)
17
+
18
+ Read `qa/capabilities.yaml` and check the `platform` field.
19
+
20
+ - 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.
21
+ - If `platform: web` or field absent → **web path**, proceed as normal below.
22
+
16
23
  ## Role
17
24
 
18
25
  You are a **Senior QA Engineer** specialized in test case design. You structure test cases by viewpoint categories and translate UI into Gherkin test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills. **Tier 1 (critical+high) first** — expand coverage later. Focus on **Gherkin scenarios and test data only** — selectors are handled during `/sungen:run-test`.
@@ -112,7 +119,10 @@ If the unit is **api-first** (`qa/api/<name>/` or `qa/api/flows/<name>/`), the d
112
119
  - `sungen manifest --screen <name>` — fingerprints for next-run change detection. On a **re-run**, start the whole command by `sungen manifest --screen <name> --diff` and only regenerate scenarios whose spec section changed (keep/regenerate/retire).
113
120
  - **Ledger each phase** (so `sungen trace` can map the whole process): pick one `runId` at the start (e.g. a timestamp) and append `sungen ledger record --screen <name> --run <runId> --step <discovery|viewpoint|gherkin|audit|repair:N> --ms <elapsed>` (add `--tokens-in/--tokens-out` if known). The `--run` id groups this invocation so `trace`/`ledger report` show THIS run, not a mix of past runs. Do this for **every** phase, not just repair.
114
121
 
115
- 6. **Converge — show the trace.** Run `sungen trace --screen <name>` and present to the user: the process map (phases + repair rounds), bottlenecks, and the **HUMAN-LOOP FOCUS** (@manual scenarios they must verify) + audit score & gate status & residual/cross-screen gaps. Then use `AskUserQuestion` to offer next steps based on which tier was just generated:
122
+ 6. **Converge — show the journey board first, then the trace.**
123
+ - **Board (the human-facing review surface — do this first).** Run `sungen journey --screen <name>` and present the board to the user verbatim-in-spirit: **📍 you-are-here** (current phase), the **obligation checklist** ("what must still be true" — each ✅ satisfied / ⏳ needs-work / 🚫 waived), and **especially the 🔎 Review queue** — every item carries an IDE-jumpable **anchor** 〔`VP-id · file:line`〕. This is what answers *"review what, review where, what's doubtful"*: read each queued item aloud with its anchor so the user knows exactly which scenario/line to look at. End with the board's **→ Next**.
124
+ - **Trace (the process detail).** Then run `sungen trace --screen <name>` for the process map (phases + repair rounds), bottlenecks, and audit score & gate status & residual/cross-screen gaps.
125
+ - Then use `AskUserQuestion` to offer next steps based on which tier was just generated:
116
126
 
117
127
  > The harness gate + reviewer already ran above — you do **not** need `/sungen:review` as a next step (it's the independent checkpoint for hand/prompt-authored or pre-delivery cases). Recommend `run-test` or expanding coverage.
118
128
 
@@ -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 being delivered, run `sungen gate --screen <name> --phase deliver` (exit 2 = HALT). On **HALT** it means the screen is **not signed off yet** (or an obligation is still open): present `sungen journey --screen <name>` — the **🔎 Review queue** with its anchors 〔`VP-id · file:line`〕 — so the user can review *what / where*, then either resolve the items or, when satisfied, sign off with `sungen journey --screen <name> --signoff --by "<name>"`. Do **not** export a screen past a deliver HALT without a sign-off. (Skip this gate only if the user explicitly asks for a draft/preview export.)
25
+
22
26
  ### 1. Invoke the CLI
23
27
 
24
28
  Run via Bash (single command, no extra parsing). Prefer the local `./bin/sungen.js` when it exists — the sungen monorepo ships local-only features the global npm package doesn't have yet (multi-sheet locale aggregation, `.<env>` filename suffix, locale-aware step rendering). Fall back to `npx sungen` in downstream projects.
@@ -41,6 +45,8 @@ The CLI handles:
41
45
  - Generating CSV/XLSX at `qa/deliverables/<name>-testcases[.<env>].csv` / `.xlsx`
42
46
  - Printing summary table
43
47
 
48
+ **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.
49
+
44
50
  ### 2. Handle pre-flight failures (if CLI exits non-zero)
45
51
 
46
52
  If the CLI exits with blocking issues, it will have already printed a clear table showing exactly what's missing per screen.
@@ -1,7 +1,7 @@
1
1
  ---
2
- 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.'
2
+ 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.'
3
3
  argument-hint: "<name> <locale> [--base-locale <code>] [--offline]"
4
- allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_wait_for, mcp__playwright__browser_evaluate, mcp__playwright__browser_click, mcp__playwright__browser_storage_state, mcp__playwright__browser_set_storage_state
4
+ allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_wait_for, mcp__playwright__browser_evaluate, mcp__playwright__browser_click, mcp__playwright__browser_storage_state, mcp__playwright__browser_set_storage_state, mcp__appium-mcp__select_device, mcp__appium-mcp__appium_session_management, mcp__appium-mcp__appium_get_page_source, mcp__appium-mcp__appium_screenshot, mcp__appium-mcp__generate_locators
5
5
  ---
6
6
 
7
7
  ## Role
@@ -14,10 +14,31 @@ Parse from `$ARGUMENTS`:
14
14
  - **name** — screen or flow name (e.g. `home`, `awards`, `kudo-to-display-on-kudos`). If missing → AskUserQuestion.
15
15
  - **locale** — target locale code (e.g. `en`, `ja`, `en-US`, `staging-ja`). If missing → AskUserQuestion. This becomes the suffix in `test-data/<feature>.<locale>.yaml` and `SUNGEN_ENV=<locale>` at run time.
16
16
  - **`--base-locale <code>`** — optional. The locale of existing `test-data/<feature>.yaml`. Default `vi`. Used only for reporting/UX — files never get renamed.
17
- - **`--offline`** — force OFFLINE mode (skip Playwright capture). Useful when you know the live page can't be reached or when prepping a test-only template.
17
+ - **`--offline`** — force OFFLINE mode (skip live capture). Useful when you know the live page/device can't be reached or when prepping a test-only template.
18
18
 
19
19
  Reject if name == locale (common typo).
20
20
 
21
+ ## Platform detection (do this FIRST)
22
+
23
+ Read `qa/capabilities.yaml` and check the `platform` field.
24
+
25
+ - If `platform: mobile` → switch to the **mobile path** (below).
26
+ - If `platform: web` or field absent → follow the **web path** (existing behavior, unchanged).
27
+
28
+ ### Mobile path
29
+
30
+ When `platform: mobile`:
31
+
32
+ - **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.
33
+ - **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.
34
+ - **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.
35
+ - **OFFLINE mode** (when device unreachable or `--offline` flag): scaffold overlay template + let user fill manually. Same as web offline mode.
36
+ - **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."
37
+ - **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.
38
+ - **Compile**: `sungen generate --screen <name>` (appium adapter auto-selected in a mobile project).
39
+
40
+ Stop here for mobile — do not continue to the web path.
41
+
21
42
  ## Auto-detect context
22
43
 
23
44
  Same as `/sungen:run-test`:
@@ -25,7 +46,7 @@ Same as `/sungen:run-test`:
25
46
  - Else `qa/screens/<name>/` exists → screen mode (base path: `qa/screens/<name>/`)
26
47
  - Neither exists → tell user and stop
27
48
 
28
- ## Steps
49
+ ## Steps (web)
29
50
 
30
51
  The `sungen-locale` skill defines 7 phases. Execute them in order:
31
52