@sun-asterisk/sungen 2.5.0 → 2.5.1

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 (129) hide show
  1. package/README.md +88 -7
  2. package/dist/cli/commands/add.d.ts.map +1 -1
  3. package/dist/cli/commands/add.js +109 -9
  4. package/dist/cli/commands/add.js.map +1 -1
  5. package/dist/cli/commands/figma.d.ts +11 -0
  6. package/dist/cli/commands/figma.d.ts.map +1 -0
  7. package/dist/cli/commands/figma.js +178 -0
  8. package/dist/cli/commands/figma.js.map +1 -0
  9. package/dist/cli/index.js +4 -2
  10. package/dist/cli/index.js.map +1 -1
  11. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  12. package/dist/orchestrator/ai-rules-updater.js +2 -0
  13. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  14. package/dist/orchestrator/figma/figma-scaffolder-helpers.d.ts +33 -0
  15. package/dist/orchestrator/figma/figma-scaffolder-helpers.d.ts.map +1 -0
  16. package/dist/orchestrator/figma/figma-scaffolder-helpers.js +135 -0
  17. package/dist/orchestrator/figma/figma-scaffolder-helpers.js.map +1 -0
  18. package/dist/orchestrator/figma/figma-scaffolder-types.d.ts +25 -0
  19. package/dist/orchestrator/figma/figma-scaffolder-types.d.ts.map +1 -0
  20. package/dist/orchestrator/figma/figma-scaffolder-types.js +7 -0
  21. package/dist/orchestrator/figma/figma-scaffolder-types.js.map +1 -0
  22. package/dist/orchestrator/figma/figma-scaffolder.d.ts +23 -0
  23. package/dist/orchestrator/figma/figma-scaffolder.d.ts.map +1 -0
  24. package/dist/orchestrator/figma/figma-scaffolder.js +212 -0
  25. package/dist/orchestrator/figma/figma-scaffolder.js.map +1 -0
  26. package/dist/orchestrator/figma/node-path-collapser.d.ts +16 -0
  27. package/dist/orchestrator/figma/node-path-collapser.d.ts.map +1 -0
  28. package/dist/orchestrator/figma/node-path-collapser.js +37 -0
  29. package/dist/orchestrator/figma/node-path-collapser.js.map +1 -0
  30. package/dist/orchestrator/figma/spec-figma-renderer.d.ts +44 -0
  31. package/dist/orchestrator/figma/spec-figma-renderer.d.ts.map +1 -0
  32. package/dist/orchestrator/figma/spec-figma-renderer.js +45 -0
  33. package/dist/orchestrator/figma/spec-figma-renderer.js.map +1 -0
  34. package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts +23 -0
  35. package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts.map +1 -0
  36. package/dist/orchestrator/figma/spec-figma-section-renderers.js +47 -0
  37. package/dist/orchestrator/figma/spec-figma-section-renderers.js.map +1 -0
  38. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +56 -11
  39. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +30 -17
  40. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +4 -3
  41. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +33 -1
  42. package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -0
  43. package/dist/orchestrator/templates/ai-instructions/claude-skill-figma-source.md +151 -0
  44. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +39 -20
  45. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +2 -0
  46. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +53 -9
  47. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +21 -16
  48. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +4 -3
  49. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +33 -1
  50. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -0
  51. package/dist/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +151 -0
  52. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +151 -0
  53. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -0
  54. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +51 -25
  55. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +20 -0
  56. package/dist/tools/figma/figma-auth.d.ts +36 -0
  57. package/dist/tools/figma/figma-auth.d.ts.map +1 -0
  58. package/dist/tools/figma/figma-auth.js +182 -0
  59. package/dist/tools/figma/figma-auth.js.map +1 -0
  60. package/dist/tools/figma/figma-cache.d.ts +45 -0
  61. package/dist/tools/figma/figma-cache.d.ts.map +1 -0
  62. package/dist/tools/figma/figma-cache.js +191 -0
  63. package/dist/tools/figma/figma-cache.js.map +1 -0
  64. package/dist/tools/figma/figma-client-types.d.ts +112 -0
  65. package/dist/tools/figma/figma-client-types.d.ts.map +1 -0
  66. package/dist/tools/figma/figma-client-types.js +7 -0
  67. package/dist/tools/figma/figma-client-types.js.map +1 -0
  68. package/dist/tools/figma/figma-errors.d.ts +49 -0
  69. package/dist/tools/figma/figma-errors.d.ts.map +1 -0
  70. package/dist/tools/figma/figma-errors.js +105 -0
  71. package/dist/tools/figma/figma-errors.js.map +1 -0
  72. package/dist/tools/figma/figma-image-downloader.d.ts +25 -0
  73. package/dist/tools/figma/figma-image-downloader.d.ts.map +1 -0
  74. package/dist/tools/figma/figma-image-downloader.js +128 -0
  75. package/dist/tools/figma/figma-image-downloader.js.map +1 -0
  76. package/dist/tools/figma/figma-node-filter.d.ts +26 -0
  77. package/dist/tools/figma/figma-node-filter.d.ts.map +1 -0
  78. package/dist/tools/figma/figma-node-filter.js +164 -0
  79. package/dist/tools/figma/figma-node-filter.js.map +1 -0
  80. package/dist/tools/figma/figma-rest-client.d.ts +24 -0
  81. package/dist/tools/figma/figma-rest-client.d.ts.map +1 -0
  82. package/dist/tools/figma/figma-rest-client.js +154 -0
  83. package/dist/tools/figma/figma-rest-client.js.map +1 -0
  84. package/dist/tools/figma/figma-url-parser.d.ts +18 -0
  85. package/dist/tools/figma/figma-url-parser.d.ts.map +1 -0
  86. package/dist/tools/figma/figma-url-parser.js +51 -0
  87. package/dist/tools/figma/figma-url-parser.js.map +1 -0
  88. package/dist/utils/exec-file-no-throw.d.ts +20 -0
  89. package/dist/utils/exec-file-no-throw.d.ts.map +1 -0
  90. package/dist/utils/exec-file-no-throw.js +36 -0
  91. package/dist/utils/exec-file-no-throw.js.map +1 -0
  92. package/package.json +1 -1
  93. package/src/cli/commands/add.ts +80 -9
  94. package/src/cli/commands/figma.ts +162 -0
  95. package/src/cli/index.ts +4 -2
  96. package/src/orchestrator/ai-rules-updater.ts +2 -0
  97. package/src/orchestrator/figma/figma-scaffolder-helpers.ts +126 -0
  98. package/src/orchestrator/figma/figma-scaffolder-types.ts +26 -0
  99. package/src/orchestrator/figma/figma-scaffolder.ts +209 -0
  100. package/src/orchestrator/figma/node-path-collapser.ts +38 -0
  101. package/src/orchestrator/figma/spec-figma-renderer.ts +80 -0
  102. package/src/orchestrator/figma/spec-figma-section-renderers.ts +46 -0
  103. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +56 -11
  104. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +30 -17
  105. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +4 -3
  106. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +33 -1
  107. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -0
  108. package/src/orchestrator/templates/ai-instructions/claude-skill-figma-source.md +151 -0
  109. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +39 -20
  110. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +2 -0
  111. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +53 -9
  112. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +21 -16
  113. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +4 -3
  114. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +33 -1
  115. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -0
  116. package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +151 -0
  117. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +151 -0
  118. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -0
  119. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +51 -25
  120. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +20 -0
  121. package/src/tools/figma/figma-auth.ts +161 -0
  122. package/src/tools/figma/figma-cache.ts +184 -0
  123. package/src/tools/figma/figma-client-types.ts +125 -0
  124. package/src/tools/figma/figma-errors.ts +127 -0
  125. package/src/tools/figma/figma-image-downloader.ts +112 -0
  126. package/src/tools/figma/figma-node-filter.ts +198 -0
  127. package/src/tools/figma/figma-rest-client.ts +183 -0
  128. package/src/tools/figma/figma-url-parser.ts +55 -0
  129. package/src/utils/exec-file-no-throw.ts +45 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Section-render helpers for spec-figma-renderer.ts.
4
+ *
5
+ * After the shift to LLM-synthesized narrative sections, the envelope only
6
+ * needs: frontmatter, Frame metadata, Screenshots, and the SYNTHESIS marker.
7
+ * All prose sections (Purpose, ASCII Layout, Regions, Actions, Form Fields,
8
+ * Data Columns, Navigation) are appended below the marker by the
9
+ * sungen-figma-source skill.
10
+ *
11
+ * Pure — no I/O.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.SYNTHESIS_MARKER = void 0;
15
+ exports.renderFrontmatter = renderFrontmatter;
16
+ exports.renderFrame = renderFrame;
17
+ exports.renderScreenshots = renderScreenshots;
18
+ /**
19
+ * Sentinel comment that separates the deterministic envelope (above) from
20
+ * the LLM-synthesized narrative (below). Re-synthesis replaces everything
21
+ * from this marker to EOF.
22
+ */
23
+ exports.SYNTHESIS_MARKER = '<!-- SYNTHESIS-BELOW -->';
24
+ function renderFrontmatter(input) {
25
+ return [
26
+ '---',
27
+ 'source: figma',
28
+ `file_key: ${input.fileKey}`,
29
+ `node_id: ${input.nodeId}`,
30
+ `figma_version_id: ${input.versionId}`,
31
+ `fetched_at: ${input.fetchedAt}`,
32
+ `generator: ${input.generatorVersion}`,
33
+ '---',
34
+ ].join('\n');
35
+ }
36
+ function renderFrame(node) {
37
+ const bb = node.boundingBox;
38
+ const dims = bb ? `${bb.w}x${bb.h}` : '—';
39
+ return ['## Frame', `- Name: ${node.name}`, `- Dimensions: ${dims}`, `- Type: ${node.type}`].join('\n');
40
+ }
41
+ function renderScreenshots(imagePaths) {
42
+ if (imagePaths.length === 0)
43
+ return '## Screenshots\n- (no images downloaded)';
44
+ const items = imagePaths.map((p, i) => `- \`${p}\` — ${i === 0 ? 'default state' : `variant ${i}`}`);
45
+ return ['## Screenshots', ...items].join('\n');
46
+ }
47
+ //# sourceMappingURL=spec-figma-section-renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-figma-section-renderers.js","sourceRoot":"","sources":["../../../src/orchestrator/figma/spec-figma-section-renderers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAYH,8CAWC;AAED,kCAIC;AAED,8CAIC;AA9BD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,0BAA0B,CAAC;AAE3D,SAAgB,iBAAiB,CAAC,KAA2B;IAC3D,OAAO;QACL,KAAK;QACL,eAAe;QACf,aAAa,KAAK,CAAC,OAAO,EAAE;QAC5B,YAAY,KAAK,CAAC,MAAM,EAAE;QAC1B,qBAAqB,KAAK,CAAC,SAAS,EAAE;QACtC,eAAe,KAAK,CAAC,SAAS,EAAE;QAChC,cAAc,KAAK,CAAC,gBAAgB,EAAE;QACtC,KAAK;KACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,WAAW,CAAC,IAAuB;IACjD,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;IAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1C,OAAO,CAAC,UAAU,EAAE,WAAW,IAAI,CAAC,IAAI,EAAE,EAAE,iBAAiB,IAAI,EAAE,EAAE,WAAW,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1G,CAAC;AAED,SAAgB,iBAAiB,CAAC,UAAoB;IACpD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,0CAA0C,CAAC;IAC/E,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;IACrG,OAAO,CAAC,gBAAgB,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: add-screen
3
3
  description: 'Add a new Sungen screen — 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]
4
+ argument-hint: [screen-name] [url-path] [--figma <url>]
5
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
6
6
  ---
7
7
 
@@ -11,37 +11,82 @@ You are adding a new Sungen screen for test generation.
11
11
 
12
12
  Parse from `$ARGUMENTS`:
13
13
  - **screen** — screen name (e.g., `login`, `dashboard`, `settings`)
14
- - **path** — URL path (e.g., `/login`, `/dashboard`, `/settings`)
14
+ - **path** — URL path (e.g., `/login`, `/dashboard`, `/settings`) - optional when `--figma` is provided
15
+ - **--figma \<url\>** — Figma share URL (optional)
16
+ - **--refresh** — bypass Figma cache and re-fetch (optional, use with `--figma`)
17
+ - **--scale \<n\>** — PNG export scale factor, default 2 (optional)
18
+ - **--hi-res** — export at 4× scale, shorthand for `--scale 4` (optional)
15
19
 
16
20
  If **screen** is missing, ask: "What is the screen name? (e.g., `login`, `dashboard`)"
17
- If **path** is missing, ask: "What is the URL path? (e.g., `/login`, `/dashboard`)"
21
+ If **path** is missing and `--figma` was NOT provided, ask: "What is the URL path? (e.g., `/login`, `/dashboard`)"
18
22
 
19
23
  ## Steps
20
24
 
21
25
  ### 1. Scaffold the screen
22
26
 
23
- Run:
27
+ **Standard path (no `--figma`):**
24
28
  ```bash
25
29
  sungen add --screen <screen> --path <path>
26
30
  ```
27
31
 
28
- ### 2. Fill spec.md
32
+ **Figma branch (when `--figma <url>` is in `$ARGUMENTS`):**
29
33
 
30
- Use `AskUserQuestion`: *"Fill `spec.md` now?"* offer **Yes, fill now (Recommended)** / **Skip, fill later**.
34
+ Invoke the `sungen-figma-source` skill by running:
35
+ ```bash
36
+ sungen add --screen <screen> --figma '<url>' [--path <path>] [--refresh] [--scale <n>]
37
+ # Single-quote the URL — Figma links contain `&` which bash otherwise treats as a background operator.
38
+ ```
39
+
40
+ This CLI command automatically:
41
+ 1. Parses the Figma URL and fetches the design node.
42
+ 2. Downloads frame + variant PNGs to `qa/screens/<screen>/requirements/ui/`.
43
+ 3. Writes `qa/screens/<screen>/requirements/spec_figma.md` (auto-generated, always overwritten on re-run).
44
+ 4. Creates `qa/screens/<screen>/requirements/spec.md` stub **only if the file does not already exist** — never overwrites existing human content.
45
+
46
+ **Important coexistence rules:**
47
+ - `--figma` and `--path` can be passed together: `--path` provides the live URL for `run-test`; `--figma` provides design context.
48
+ - `spec.md` is the human-authored source of truth. Never modify it automatically.
49
+ - `spec_figma.md` is auto-generated — always overwritten; tell the user to copy useful sections into `spec.md`.
50
+ - `--capture` (Playwright screenshot) and `--figma` can be used simultaneously; they produce different outputs.
51
+
52
+ **If Figma auth is missing**, the command will fail with a message like:
53
+ > Figma PAT is not configured. Run: sungen figma auth set
54
+
55
+ In that case, guide the user to run `sungen figma auth set` and retry.
31
56
 
32
- If yes → open `qa/screens/<screen>/requirements/spec.md` and help the user fill sections, fields, validation rules, business rules, and states. Especially prompt for the optional **Figma URL** and **Live URL** fields in Overview — those unlock auto-capture without re-asking next run.
57
+ ### 1a. Synthesize narrative sections (Figma branch only)
33
58
 
34
- ### 3. Capture visual source
59
+ After `sungen add --figma` succeeds, the envelope of `spec_figma.md` is deterministic but the narrative below the `<!-- SYNTHESIS-BELOW -->` marker is empty. Invoke the `sungen-figma-source` skill to fill it:
35
60
 
36
- Use `AskUserQuestion`: *"Capture a visual reference for this screen?"*always offer all three so pre-launch projects work:
61
+ 1. Read `qa/screens/<screen>/requirements/spec_figma.md`note `file_key`, `node_id`, `figma_version_id` from frontmatter.
62
+ 2. Read the cached raw node JSON at `.sungen/figma-cache/<file_key>/<figma_version_id>/<safe_node_id>-raw.json` (colons in node_id become underscores).
63
+ 3. Follow the skill's 7-section template (Purpose / ASCII Layout / Regions / Actions / Form Fields / Data Columns / Navigation) and **replace** everything from the marker to EOF.
64
+ 4. Preserve the envelope above the marker byte-for-byte.
37
65
 
66
+ **Review gate.** Before moving on, show the user the synthesized narrative and use `AskUserQuestion`:
67
+
68
+ - **Approve** — narrative looks right, continue to Step 2
69
+ - **Edit** — user will tweak `spec_figma.md` now; wait for confirmation before continuing
70
+ - **Cancel** — abort; advise the user that `spec.md` was NOT modified and they can re-run `sungen add --figma --refresh` later
71
+
72
+ ### 2. Capture visual source
73
+
74
+ **If Figma branch (Step 1) already downloaded PNGs** → visuals already exist. Use `AskUserQuestion` to offer:
75
+ - **Continue** — Figma visuals are enough (Recommended)
76
+ - **Also capture live page** — supplement Figma with real page scan (invoke `sungen-capture-live` skill)
77
+
78
+ **If standard path (no `--figma`)** → go straight to source selection. Use `AskUserQuestion`: *"Pick a visual source for this screen:"*
38
79
  - **Figma design** (Recommended for pre-launch) — invoke `sungen-capture-figma` skill
39
80
  - **Live page scan** (dev/staging is up) — invoke `sungen-capture-live` skill
40
- - **Skip** — user will drop images manually into `requirements/ui/` later, or rely on `/sungen:create-test` to prompt again
81
+ - **Skip** — user will drop images manually into `requirements/ui/` later
41
82
 
42
83
  Each capture skill writes outputs into `qa/screens/<screen>/requirements/ui/` and reports back a summary. Do not inline capture logic here — always delegate to the skill so behavior stays consistent with `/sungen:create-test`.
43
84
 
44
- If the user has additional UI designs (mockups, hand-drawn sketches), suggest copying them to `requirements/ui/` — `sungen-capture-local` will pick them up during `/sungen:create-test`.
85
+ ### 3. Fill spec.md
86
+
87
+ Use `AskUserQuestion`: *"Fill `spec.md` now? (You can reference the captured visuals)"* — offer **Yes, fill now (Recommended)** / **Skip, fill later**.
88
+
89
+ If yes → open `qa/screens/<screen>/requirements/spec.md` and help the user fill sections, fields, validation rules, business rules, and states. Reference the captured visuals from Step 2 to suggest field names, form elements, and UI states. Especially prompt for the optional **Figma URL** and **Live URL** fields in Overview — those unlock auto-capture without re-asking next run.
45
90
 
46
91
  ### 4. Next steps
47
92
 
@@ -1,13 +1,21 @@
1
1
  ---
2
2
  name: create-test
3
- description: 'Create or update test cases for a Sungen screen — generates feature + test-data files (20+ scenarios per viewpoint)'
3
+ description: 'Create or update test cases for a Sungen screen — generates feature + test-data files (tier-based: critical+high first, expand later)'
4
4
  argument-hint: [screen-name]
5
- allowed-tools: Read, Grep, Bash, Glob, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot, mcp__figma__get_design_context, mcp__figma__get_variable_defs, mcp__figma__get_screenshot
5
+ allowed-tools: Read, Grep, Bash, Glob, Write, AskUserQuestion, Skill, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot
6
+ ---
7
+
8
+ ## ⛔ HARD RULE — No Figma MCP when PAT data exists
9
+
10
+ If `spec_figma.md` exists OR the user provides a Figma URL for the PAT flow:
11
+ - Do NOT call any `mcp__figma__*` tool. The PAT flow uses the `sungen` CLI, not MCP.
12
+ - Run `sungen add --screen <screen> --figma '<url>'` via Bash (**single-quote the URL**) then invoke `sungen-figma-source` skill.
13
+
6
14
  ---
7
15
 
8
16
  ## Role
9
17
 
10
- You are a **Senior QA Engineer** specialized in exhaustive test case design. You structure test cases by viewpoint categories and translate UI into comprehensive Gherkin test cases following the `sungen-gherkin-syntax` and `sungen-tc-generation` skills. Your focus is on **Gherkin scenarios and test data only** — selectors are handled later during `/sungen:run-test`.
18
+ 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`.
11
19
 
12
20
  ## Parameters
13
21
 
@@ -17,27 +25,32 @@ Parse **screen** from `$ARGUMENTS`. If missing, ask the user.
17
25
 
18
26
  1. Verify `qa/screens/<screen>/` exists. If not → `/sungen:add-screen` first.
19
27
  2. Check if `.feature` file already has scenarios. If yes → use `AskUserQuestion` to ask the update mode (see `sungen-tc-generation` skill for details). If no → fresh creation.
20
- 3. **Read requirements** — check `qa/screens/<screen>/requirements/`:
28
+ 3. **Read requirements & resolve visual source** — check `qa/screens/<screen>/requirements/`:
21
29
  - If `spec.md` exists → read it as PRIMARY source (sections, fields, validation rules, business rules, states).
22
- - If `ui/` has images → read them for visual context (layout, element positions, states).
23
30
  - If `test-viewpoint.md` exists → read it. If it only contains HTML comments (scaffold template), use `AskUserQuestion` to ask:
24
31
  - **Fill test-viewpoint.md first** — I'll help you identify edge cases, known issues, and design decisions for this screen before generating tests
25
32
  - **Continue without it** — generate tests from spec and other sources only
26
- - Summarize what you found in requirements and present to the user.
27
- 4. **Screen input** (supplements requirements, or is primary source if no requirements):
28
- - Use `AskUserQuestion` to ask the user to pick a visual source always offer all three options so pre-launch projects work:
29
- - **Figma design** (Recommended for pre-launch) invoke `sungen-capture-figma` skill
30
- - **UI images** (existing screenshots/mockups in `requirements/ui/`) invoke `sungen-capture-local` skill
31
- - **Live page scan** (dev/staging is up) invoke `sungen-capture-live` skill
32
- - Each capture skill writes outputs into `qa/screens/<screen>/requirements/ui/` and reports back a summary. Do not inline capture logic here — always delegate to the skill so behavior stays consistent across commands.
33
- - After the capture skill returns, cross-check its output against `spec.md` and flag any discrepancies before moving on.
34
- 5. Follow the `sungen-tc-generation` skill for section identification, viewpoint generation, and output format. When requirements exist, use the "Requirements-Driven Generation" strategy.
35
- 6. Generate or update `.feature` + `test-data.yaml` following `sungen-gherkin-syntax` and `sungen-tc-generation` skills.
36
- 7. Show summary, then use `AskUserQuestion` to offer next steps:
33
+
34
+ **Auto-detect visual source** do NOT ask the user to pick a source. Instead, check what already exists and use it:
35
+ 1. If `spec_figma.md` exists read it as Figma supplement (PAT flow already completed during `add-screen`). Do NOT call any `mcp__figma__*` tool.
36
+ 2. If `ui/` has images (`.png`, `.jpg`, etc.) read them for visual context (layout, element positions, states).
37
+ 3. If neither exists use `AskUserQuestion` to ask: *"No visual source found. Pick one:"*
38
+ - **Figma PAT** ask for URL, run `sungen add --screen <screen> --figma '<url>'` via Bash, then invoke `sungen-figma-source` skill
39
+ - **Figma MCP** invoke `sungen-capture-figma` skill
40
+ - **Live page scan** invoke `sungen-capture-live` skill
41
+ - **Skip** generate from spec.md only
42
+
43
+ **Cross-check**: if both `spec.md` and visual sources exist, flag any discrepancies (missing fields, different labels) before moving on. When `spec_figma.md` is present, follow the Figma supplement rules in `sungen-tc-generation` skill (reading order, Text Inventory, conflict handling).
44
+
45
+ Summarize what you found in requirements and present to the user.
46
+
47
+ 4. Follow the `sungen-tc-generation` skill for section identification, viewpoint generation, and output format. When requirements exist, use the "Requirements-Driven Generation" strategy.
48
+ 5. Generate or update `.feature` + `test-data.yaml` following `sungen-gherkin-syntax` and `sungen-tc-generation` skills.
49
+ 6. Show summary, then use `AskUserQuestion` to offer next steps:
37
50
 
38
51
  - **`/sungen:review <screen>`** — Review syntax, coverage, viewpoint quality (Recommended)
39
52
  - **`/sungen:run-test <screen>`** — Skip review, generate selectors and run tests now
40
- - **`/sungen:create-test <screen>`** — Add more test cases for another section/viewpoint
53
+ - **`/sungen:create-test <screen>`** — Expand coverage: add @normal + @low scenarios
41
54
  - **Done for now** — I'll come back later
42
55
 
43
56
  **No selectors.yaml** — selectors are generated during `/sungen:run-test`.
@@ -17,9 +17,10 @@ Parse **screen** from `$ARGUMENTS`. If missing, ask the user.
17
17
 
18
18
  1. Read `qa/screens/<screen>/features/<screen>.feature` and `qa/screens/<screen>/test-data/<screen>.yaml`. If missing → `/sungen:create-test` first.
19
19
  2. Follow the `sungen-tc-review` skill — score 3 dimensions: Syntax (30pts), Coverage (40pts), Viewpoint (30pts). Use `sungen-viewpoint` for pattern checklists.
20
- 3. Output review report per `sungen-tc-review` format. **>= 60%**: PASS. **< 60%**: FAIL with recommendations.
21
- 4. If FAIL and user confirms → update test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills, then re-review.
22
- 5. After PASS (or user decides to proceed), use `AskUserQuestion` to offer next steps:
20
+ 3. **Unverified Selectors check** — if `qa/screens/<screen>/selectors/<screen>.yaml` exists, count lines matching `@needs-live-verify`. Include in the review report as a non-scoring metric (see `sungen-tc-review` skill for report format). Does NOT affect the 60% threshold.
21
+ 4. Output review report per `sungen-tc-review` format. **>= 60%**: PASS. **< 60%**: FAIL with recommendations.
22
+ 5. If FAIL and user confirms update test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills, then re-review.
23
+ 6. After PASS (or user decides to proceed), use `AskUserQuestion` to offer next steps:
23
24
 
24
25
  - **`/sungen:run-test <screen>`** — Generate selectors, compile, and run tests (Recommended)
25
26
  - **`/sungen:create-test <screen>`** — Add more test cases before running
@@ -16,7 +16,39 @@ Parse **screen** from `$ARGUMENTS`. If missing, ask the user.
16
16
  ## Pre-run (phased — per `sungen-selector-fix` skill)
17
17
 
18
18
  1. Verify `qa/screens/<screen>/` has `.feature` + `test-data.yaml`.
19
- 2. **Phase 0 — Selector Pre-gen**: if `selectors.yaml` is missing/empty or doesn't cover the feature file's `[Reference]`s, run Phase 0 from `sungen-selector-fix` — confirm with user, `browser_navigate` → one `browser_snapshot` → merge YAML entries.
19
+ 2. **Phase 0 — Selector Pre-gen**: if `selectors.yaml` is missing/empty or doesn't cover the feature file's `[Reference]`s, apply the following decision tree before running Phase 0 from `sungen-selector-fix`:
20
+
21
+ ```
22
+ Phase 0 — Selector Generation decision tree
23
+
24
+ Live page reachable? (URL provided and loads without error)
25
+ YES → existing flow: browser_navigate → one browser_snapshot → generate selectors.yaml (verified entries)
26
+ NO → spec_figma.md exists in requirements/?
27
+ YES → provisional flow (sungen-figma-source + sungen-selector-fix skills):
28
+ 1. Read filtered Figma node data from spec_figma.md (## Components + ## Text Inventory)
29
+ 2. Apply selector heuristics from sungen-figma-source skill (testid > role+name > placeholder > label > locator > text)
30
+ 3. Write selectors.yaml — every provisional entry gets this comment on the line above:
31
+ # @needs-live-verify source=figma node_id=<id>
32
+ 4. Compile: sungen generate --screen <screen> — must succeed
33
+ 5. Phase 1 smoke check runs; tests using unverified selectors may fail
34
+ → auto-fix triggers on next run-test invocation when a live page is available
35
+ NO → hard stop: print the following message and stop:
36
+ "Cannot generate selectors: no live page URL and no spec_figma.md found.
37
+ Options:
38
+ • Provide the live URL so Playwright MCP can snapshot the page, OR
39
+ • Run: sungen add --screen <screen> --figma <figma-url> to generate spec_figma.md first"
40
+ ```
41
+
42
+ **Auto-fix on subsequent runs**: when `run-test` is invoked again with a reachable live page, Phase 0 compares the DOM snapshot against existing `selectors.yaml` entries. Entries tagged `# @needs-live-verify` are treated as candidates — if the actual selector differs, the entry is replaced and the comment removed (entry becomes verified). Entries that already match are also promoted to verified (comment removed).
43
+
44
+ **`@needs-live-verify` comment format** (one comment line, directly above the YAML key):
45
+ ```yaml
46
+ # @needs-live-verify source=figma node_id=<figma-node-id>
47
+ submit-button:
48
+ type: role
49
+ value: button
50
+ name: "Submit"
51
+ ```
20
52
  3. **Phase 0.5 — Auth Persistence**: if the feature has `@auth:<role>` tags and `specs/.auth/<role>.json` is missing/expired, run Phase 0.5 from `sungen-selector-fix` — user logs in manually in MCP browser → `browser_storage_state` → `specs/.auth/<role>.json`. Offer `sungen makeauth <role>` as CLI fallback only if `browser_storage_state` isn't available in this MCP version.
21
53
  4. Compile: `sungen generate --screen <screen>` (default: runtime data loading from YAML). Use `--inline-data` only if user requests compile-time hardcoded values.
22
54
 
@@ -19,6 +19,7 @@ You generate 3 files for sungen — a Gherkin compiler that produces Playwright
19
19
  | `sungen-capture-figma` | Fetch design context + PNG from a Figma frame URL via Figma Dev Mode MCP |
20
20
  | `sungen-capture-local` | Load existing UI assets (screenshots, mockups, Figma exports) from `requirements/ui/` |
21
21
  | `sungen-capture-live` | Capture a live running page via Playwright MCP (snapshot + screenshot) |
22
+ | `sungen-figma-source` | Figma URL → spec_figma.md + ui/*.png + provisional selectors |
22
23
 
23
24
  ## Workflow (5 AI commands)
24
25
 
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: sungen-figma-source
3
+ description: 'Figma URL → spec_figma.md envelope + LLM-synthesized narrative from cached raw node JSON. Auto-loaded when --figma flag present or spec_figma.md exists.'
4
+ user-invocable: false
5
+ ---
6
+
7
+ ## When This Skill Loads
8
+
9
+ Auto-load triggers (any one is sufficient):
10
+
11
+ - Any sungen AI command invoked with `--figma` flag
12
+ - `requirements/spec_figma.md` exists in the screen directory
13
+ - User mentions a Figma URL or says "generate from Figma"
14
+
15
+ ---
16
+
17
+ ## Prerequisites
18
+
19
+ - [ ] `sungen figma auth check` succeeds — PAT is stored and valid
20
+ - [ ] Figma file URL is available (shared file or frame link)
21
+ - [ ] If auth missing → run `sungen figma auth set` and follow the walkthrough
22
+
23
+ **Never paste the PAT into any transcript, spec file, or commit.**
24
+
25
+ ---
26
+
27
+ ## Two-Layer Architecture
28
+
29
+ `spec_figma.md` has two layers separated by the `<!-- SYNTHESIS-BELOW -->` marker:
30
+
31
+ | Layer | Producer | Overwrite Rule |
32
+ |---|---|---|
33
+ | **Envelope** (above marker) | sungen CLI | Regenerated each `sungen figma` run — deterministic |
34
+ | **Narrative** (below marker) | This skill (LLM) | Replaced on re-synthesis — everything from marker to EOF |
35
+
36
+ The envelope contains: YAML frontmatter, Frame metadata, Screenshots. The narrative is synthesized by YOU from the cached raw Figma node JSON.
37
+
38
+ ---
39
+
40
+ ## Inputs You Read
41
+
42
+ The scaffolder persists a raw (unfiltered) Figma node tree to:
43
+
44
+ ```
45
+ .sungen/figma-cache/<fileKey>/<versionId>/<nodeId>-raw.json
46
+ ```
47
+
48
+ Read this file + the envelope frontmatter of `requirements/spec_figma.md` + any PNGs under `requirements/ui/`. You MUST NOT call the Figma REST API directly — the PAT is not available to you.
49
+
50
+ ---
51
+
52
+ ## Synthesis Task
53
+
54
+ Append 7 narrative sections below `<!-- SYNTHESIS-BELOW -->`. Each section is inferred from the raw node tree (names, types, `characters`, layout bounds, auto-layout direction, componentProperties):
55
+
56
+ ### 1. Purpose
57
+ One paragraph. What screen is this? Primary user goal? Infer from frame name + top-level text + dominant CTA.
58
+
59
+ ### 2. ASCII Layout
60
+ Rough spatial sketch using box characters. Reflect top-bottom / left-right ordering from absoluteBoundingBox. Keep under ~20 lines. Example:
61
+
62
+ ```
63
+ ┌──────────────────────────────────────┐
64
+ │ [Logo] [Sign In] │
65
+ ├──────────────────────────────────────┤
66
+ │ Welcome back │
67
+ │ ┌────────────────────────────────┐ │
68
+ │ │ email@example.com │ │
69
+ │ └────────────────────────────────┘ │
70
+ │ [ Continue ] │
71
+ └──────────────────────────────────────┘
72
+ ```
73
+
74
+ ### 3. Regions
75
+ Bulleted list of the major layout regions (header, sidebar, main, footer, modal, etc.) with a one-line purpose each. Use auto-layout frames as region hints.
76
+
77
+ ### 4. Actions
78
+ Every interactive element the user can trigger. Derive from nodes whose name/type suggests a button, link, icon-button, menu-item, toggle, etc. Format:
79
+
80
+ ```
81
+ - **<Action name>** — <what it does> (source: <node name>)
82
+ ```
83
+
84
+ ### 5. Form Fields
85
+ Every input the user can fill. Include label, type (text/email/password/select/checkbox/radio/textarea/date), required hint if inferable, and placeholder.
86
+
87
+ ```
88
+ | Label | Type | Required | Placeholder |
89
+ |---|---|---|---|
90
+ ```
91
+
92
+ Omit entirely (write `_none_`) if no inputs exist.
93
+
94
+ ### 6. Data Columns
95
+ If the screen shows a table, list, or card grid — enumerate the columns/fields displayed per row. Otherwise write `_none_`.
96
+
97
+ ### 7. Navigation
98
+ Outgoing links, tab bars, breadcrumbs, back buttons — anything that moves the user to another screen. Include both explicit navigation components and implicit CTAs that navigate.
99
+
100
+ ---
101
+
102
+ ## Synthesis Workflow
103
+
104
+ 1. Read `requirements/spec_figma.md` — note `file_key`, `node_id`, `figma_version_id` from frontmatter
105
+ 2. Read `.sungen/figma-cache/<file_key>/<figma_version_id>/<safe_node_id>-raw.json` (colons in node_id become underscores)
106
+ 3. Traverse the tree. Collect: names, types, `characters`, `componentProperties`, `absoluteBoundingBox`
107
+ 4. Produce the 7 sections above
108
+ 5. **Locate the insertion point** in `spec_figma.md`:
109
+ - **If `<!-- SYNTHESIS-BELOW -->` is present** → replace everything from the marker (inclusive) to EOF with: the marker line, a blank line, then the 7 sections.
110
+ - **If the marker is NOT present** (older `spec_figma.md` pre-envelope-refactor, or hand-edited file) → locate the last non-empty line of the envelope (usually the end of `## Screenshots`), append a blank line, then write the marker, another blank line, then the 7 sections. Do NOT delete any existing envelope content.
111
+ - **If the file is missing entirely** → advise the user to re-run `sungen add --screen <screen> --figma <url> --refresh` to regenerate the envelope first. Do not fabricate one.
112
+ 6. Preserve the envelope (frontmatter + Frame + Screenshots) byte-for-byte. Never touch content above the marker.
113
+
114
+ ---
115
+
116
+ ## Re-synthesis
117
+
118
+ - If the envelope's `figma_version_id` changed → envelope is fresh; re-run synthesis
119
+ - If only the narrative is stale (user wants a rewrite) → truncate from marker to EOF and regenerate
120
+ - Never edit content ABOVE the marker — that is the scaffolder's territory
121
+
122
+ ---
123
+
124
+ ## Selector Heuristics (for downstream `run-test`)
125
+
126
+ During `run-test` Phase 0, provisional selectors can be seeded from the raw JSON:
127
+
128
+ | Figma Signal | Provisional YAML Entry |
129
+ |---|---|
130
+ | Node name ends `Button`, has text | `role: button` + `name: "<text>"` |
131
+ | Node name ends `Input`/`Field` | `placeholder: "<placeholder text>"` |
132
+ | Node name ends `Link`, has text | `role: link` + `name: "<text>"` |
133
+ | componentProperties has `data-testid` | `testid: <value>` |
134
+ | Plain text leaf (outside interactive) | `text: "<content>"` |
135
+ | Node name ends `Icon` | `role: img` + `name: "<accessible name>"` |
136
+
137
+ Every provisional entry MUST carry:
138
+
139
+ ```
140
+ # @needs-live-verify source=figma node_id=<id>
141
+ ```
142
+
143
+ Provisional selectors feed `selectors.yaml` as candidates. `run-test` Phase 0 verifies them against the live page and overwrites incorrect entries.
144
+
145
+ ---
146
+
147
+ ## Security
148
+
149
+ - Never include the PAT in `spec_figma.md`, selectors, test data, or any committed file
150
+ - Never log or echo the PAT in terminal output
151
+ - Read only from `.sungen/figma-cache/` and screen directories — never from `.env`
@@ -6,14 +6,25 @@ user-invocable: false
6
6
 
7
7
  ## Goal
8
8
 
9
- Generate **focused test cases per screen section** with **20+ scenarios per viewpoint**. Output `.feature` + `test-data.yaml` only — selectors are deferred to `/sungen:run-test`.
9
+ Generate **focused test cases per screen section** using a **tier-based approach** for faster results. Output `.feature` + `test-data.yaml` only — selectors are deferred to `/sungen:run-test`.
10
+
11
+ ### Tier System
12
+
13
+ | Tier | Priority | What to generate | When |
14
+ |---|---|---|---|
15
+ | **Tier 1** (default) | `@critical` + `@high` | Happy paths, required validation, core business rules, security basics | First run of `create-test` |
16
+ | **Tier 2** (expand) | `@normal` + `@low` | UI presence, optional validation, edge cases, cosmetic checks | User runs `create-test` again with "Add viewpoints" mode |
17
+
18
+ **Round 1 (Tier 1)** targets **~10-15 scenarios per section** — enough to cover critical flows and catch real bugs. This is the default behavior.
19
+
20
+ **Round 2 (Tier 2)** expands to full coverage when the user explicitly chooses "Add viewpoints" or "Add new sections" update mode. Only then generate `@normal` + `@low` scenarios to fill coverage gaps.
10
21
 
11
22
  ## Update Mode
12
23
 
13
24
  When `.feature` already has scenarios, summarize and ask:
14
- 1. **Add new sections** — append, continue numbering
15
- 2. **Add viewpoints** — add to existing sections
16
- 3. **Replace all** — overwrite
25
+ 1. **Add new sections** — append new sections with Tier 2 (`@normal` + `@low`) scenarios, continue numbering
26
+ 2. **Add viewpoints** — expand existing sections with Tier 2 (`@normal` + `@low`) scenarios
27
+ 3. **Replace all** — overwrite with fresh Tier 1 (`@critical` + `@high`) generation
17
28
 
18
29
  For append: read highest `VP-<CAT>-<NNN>`, continue from next number. Never modify existing scenarios.
19
30
 
@@ -30,12 +41,13 @@ If also exploring live page: verify spec vs actual, flag mismatches, capture exa
30
41
 
31
42
  ## Screen Input Sources
32
43
 
33
- **Recommended** (in priority order):
34
- 1. **Figma designs** use Figma MCP to read design context, screenshots, and component metadata
35
- 2. **UI images** screenshots or mockups in `qa/screens/<screen>/requirements/ui/`
36
- 3. **`spec.md`**written specification with sections, fields, validation rules
44
+ **Auto-detect** — the parent command (`create-test`) resolves visual sources before invoking this skill. By the time generation starts, the available sources are already determined:
45
+ - `spec.md`primary, always read if present
46
+ - `spec_figma.md` Figma supplement, read if present (PAT flow already completed)
47
+ - `ui/*.png`visual context, read if present
48
+ - `test-viewpoint.md` — edge cases and known issues, read if present
37
49
 
38
- **Optional**: **Live page scan** via Playwright MCP — useful to verify specs vs actual UI, capture real data (error messages, labels). If auth needed ask user to log in manually via MCP browser.
50
+ **IMPORTANT:** If `spec_figma.md` exists, do NOT call any `mcp__figma__*` tool. The PAT flow is complete just read the file.
39
51
 
40
52
  **Single screen focus**: one URL = one screen. Don't explore sibling paths. Modals on same page = part of this screen.
41
53
 
@@ -76,7 +88,9 @@ Apply `sungen-test-design-techniques` to spec-extracted conditions:
76
88
 
77
89
  Use `sungen-viewpoint` skill for per-pattern checklists across 4 viewpoints: UI/UX, Data & Validate, Logic, Security.
78
90
 
79
- Add scenarios for generic UI coverage that spec didn't explicitly state (empty states, loading states, keyboard nav, hover effects). Skip viewpoints truly N/A.
91
+ **Tier-aware gap filling:**
92
+ - **Tier 1 (first run)**: only add `@critical` and `@high` items from the checklists — core security checks (VP-SEC), required field validation (VP-VAL), key state transitions (VP-LOGIC). Skip `@normal`/`@low` items like hover states, empty states, tooltips.
93
+ - **Tier 2 (expand run)**: add `@normal` + `@low` scenarios — UI presence, optional validation, edge cases, cosmetic checks, keyboard nav, hover effects.
80
94
 
81
95
  **Validation rule**: capture actual error messages from live page or spec.md. Use `User see {{error_var}}` — never assert just "is visible".
82
96
 
@@ -168,13 +182,14 @@ Feature: <Screen> Screen
168
182
  When User click [Create] button
169
183
  Then User see [Form] dialog
170
184
 
171
- # --- Section: Create User Form ---
185
+ # --- Section: Create User Form (Tier 1: @critical + @high) ---
172
186
 
173
- @normal @extend:open_form
174
- Scenario: VP-UI-001 Form displays all fields with correct defaults
187
+ @critical @extend:open_form
188
+ Scenario: VP-LOGIC-001 Submit form with valid data creates record
175
189
  Given User is on [Form] dialog
176
- Then User see [Name] field
177
- And User see [Submit] button is disabled
190
+ When User fill [Name] field with {{valid_name}}
191
+ And User click [Submit] button
192
+ Then User see {{success_message}} message
178
193
 
179
194
  @high @extend:open_form
180
195
  Scenario: VP-VAL-001 Submit with all empty fields shows errors
@@ -182,19 +197,23 @@ Feature: <Screen> Screen
182
197
  When User click [Submit] button
183
198
  Then User see [Name error] message with {{name_required_error}}
184
199
 
185
- # --- Section: User Table ---
186
-
187
- @normal
188
- Scenario: VP-UI-010 Table displays all columns
189
- Then User see [Name] column in [Users] table
200
+ # --- Section: User Table (Tier 1: @critical + @high) ---
190
201
 
191
202
  @high
192
203
  Scenario: VP-VAL-010 Table displays correct data
193
204
  Then User see [Users] table match data:
194
205
  | Name | Email |
195
206
  | {{name_1}} | {{email_1}} |
207
+
208
+ @critical
209
+ Scenario: VP-SEC-010 Unauthorized user cannot access page
210
+ Given User is not logged in
211
+ When User navigate to [Screen] page
212
+ Then User is on [Login] page
196
213
  ```
197
214
 
215
+ **Tier 2 (expand run)** adds `@normal` + `@low` scenarios like UI field presence, hover states, tooltips, empty states.
216
+
198
217
  ### When to use DataTable vs Row Scope
199
218
 
200
219
  | Pattern | Use when |
@@ -43,6 +43,8 @@ Score: `(dimensions_covered / 6) * 40`. Validate technique application with `sun
43
43
 
44
44
  **Classification**: UI = static/always-same appearance. VAL = input validation/errors. LOGIC = behavior/state changes (includes persisted state without When). SEC = auth/permissions.
45
45
 
46
+ **Tier-aware scoring**: If the feature file only contains `@critical` + `@high` scenarios (Tier 1), do NOT penalize for missing VP-UI viewpoint — UI scenarios are intentionally deferred to Tier 2. Score "All applicable VP present" based on Tier 1-relevant viewpoints only (VAL, LOGIC, SEC). Note in the review output: *"VP-UI deferred to Tier 2 — run `/sungen:create-test` with 'Add viewpoints' to expand."*
47
+
46
48
  ---
47
49
 
48
50
  ## Quality Rules