@sun-asterisk/sungen 2.5.0 → 2.5.2

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 (131) 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-delivery.md +2 -2
  49. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +4 -3
  50. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +36 -4
  51. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -0
  52. package/dist/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +151 -0
  53. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +151 -0
  54. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -0
  55. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +51 -25
  56. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +20 -0
  57. package/dist/tools/figma/figma-auth.d.ts +36 -0
  58. package/dist/tools/figma/figma-auth.d.ts.map +1 -0
  59. package/dist/tools/figma/figma-auth.js +182 -0
  60. package/dist/tools/figma/figma-auth.js.map +1 -0
  61. package/dist/tools/figma/figma-cache.d.ts +45 -0
  62. package/dist/tools/figma/figma-cache.d.ts.map +1 -0
  63. package/dist/tools/figma/figma-cache.js +191 -0
  64. package/dist/tools/figma/figma-cache.js.map +1 -0
  65. package/dist/tools/figma/figma-client-types.d.ts +112 -0
  66. package/dist/tools/figma/figma-client-types.d.ts.map +1 -0
  67. package/dist/tools/figma/figma-client-types.js +7 -0
  68. package/dist/tools/figma/figma-client-types.js.map +1 -0
  69. package/dist/tools/figma/figma-errors.d.ts +49 -0
  70. package/dist/tools/figma/figma-errors.d.ts.map +1 -0
  71. package/dist/tools/figma/figma-errors.js +105 -0
  72. package/dist/tools/figma/figma-errors.js.map +1 -0
  73. package/dist/tools/figma/figma-image-downloader.d.ts +25 -0
  74. package/dist/tools/figma/figma-image-downloader.d.ts.map +1 -0
  75. package/dist/tools/figma/figma-image-downloader.js +128 -0
  76. package/dist/tools/figma/figma-image-downloader.js.map +1 -0
  77. package/dist/tools/figma/figma-node-filter.d.ts +26 -0
  78. package/dist/tools/figma/figma-node-filter.d.ts.map +1 -0
  79. package/dist/tools/figma/figma-node-filter.js +164 -0
  80. package/dist/tools/figma/figma-node-filter.js.map +1 -0
  81. package/dist/tools/figma/figma-rest-client.d.ts +24 -0
  82. package/dist/tools/figma/figma-rest-client.d.ts.map +1 -0
  83. package/dist/tools/figma/figma-rest-client.js +154 -0
  84. package/dist/tools/figma/figma-rest-client.js.map +1 -0
  85. package/dist/tools/figma/figma-url-parser.d.ts +18 -0
  86. package/dist/tools/figma/figma-url-parser.d.ts.map +1 -0
  87. package/dist/tools/figma/figma-url-parser.js +51 -0
  88. package/dist/tools/figma/figma-url-parser.js.map +1 -0
  89. package/dist/utils/exec-file-no-throw.d.ts +20 -0
  90. package/dist/utils/exec-file-no-throw.d.ts.map +1 -0
  91. package/dist/utils/exec-file-no-throw.js +36 -0
  92. package/dist/utils/exec-file-no-throw.js.map +1 -0
  93. package/package.json +1 -1
  94. package/src/cli/commands/add.ts +80 -9
  95. package/src/cli/commands/figma.ts +162 -0
  96. package/src/cli/index.ts +4 -2
  97. package/src/orchestrator/ai-rules-updater.ts +2 -0
  98. package/src/orchestrator/figma/figma-scaffolder-helpers.ts +126 -0
  99. package/src/orchestrator/figma/figma-scaffolder-types.ts +26 -0
  100. package/src/orchestrator/figma/figma-scaffolder.ts +209 -0
  101. package/src/orchestrator/figma/node-path-collapser.ts +38 -0
  102. package/src/orchestrator/figma/spec-figma-renderer.ts +80 -0
  103. package/src/orchestrator/figma/spec-figma-section-renderers.ts +46 -0
  104. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +56 -11
  105. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +30 -17
  106. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +4 -3
  107. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +33 -1
  108. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -0
  109. package/src/orchestrator/templates/ai-instructions/claude-skill-figma-source.md +151 -0
  110. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +39 -20
  111. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +2 -0
  112. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +53 -9
  113. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +21 -16
  114. package/src/orchestrator/templates/ai-instructions/copilot-cmd-delivery.md +2 -2
  115. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +4 -3
  116. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +36 -4
  117. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -0
  118. package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +151 -0
  119. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +151 -0
  120. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -0
  121. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +51 -25
  122. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +20 -0
  123. package/src/tools/figma/figma-auth.ts +161 -0
  124. package/src/tools/figma/figma-cache.ts +184 -0
  125. package/src/tools/figma/figma-client-types.ts +125 -0
  126. package/src/tools/figma/figma-errors.ts +127 -0
  127. package/src/tools/figma/figma-image-downloader.ts +112 -0
  128. package/src/tools/figma/figma-node-filter.ts +198 -0
  129. package/src/tools/figma/figma-rest-client.ts +183 -0
  130. package/src/tools/figma/figma-url-parser.ts +55 -0
  131. package/src/utils/exec-file-no-throw.ts +45 -0
@@ -1,46 +1,90 @@
1
1
  ---
2
2
  name: sungen-add-screen
3
3
  description: 'Add a new Sungen screen — scaffolds directories, helps fill spec.md, and can auto-capture a live-page screenshot via Playwright MCP'
4
- argument-hint: '[screen-name] [url-path]'
4
+ argument-hint: '[screen-name] [url-path] [--figma <url>]'
5
5
  agent: 'agent'
6
6
  tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*']
7
7
  ---
8
8
 
9
9
  **Input**: Screen name and URL path (e.g., `/sungen-add-screen login /login`).
10
+ Optionally include a Figma URL: `/sungen-add-screen login /login --figma https://www.figma.com/design/...`.
10
11
 
11
12
  You are adding a new Sungen screen for test generation.
12
13
 
13
14
  ## Parameters
14
15
 
15
16
  - **screen** — ${input:screen:screen name (e.g., login, dashboard)}
16
- - **path** — ${input:path:URL path (e.g., /login, /dashboard)}
17
+ - **path** — ${input:path:URL path (e.g., /login, /dashboard)} — optional when --figma is provided
18
+ - **--figma \<url\>** — Figma share URL (optional)
19
+ - **--refresh** — bypass Figma cache and re-fetch (optional, use with --figma)
20
+ - **--scale \<n\>** — PNG export scale factor, default 2 (optional)
21
+ - **--hi-res** — export at 4× scale, shorthand for --scale 4 (optional)
17
22
 
18
23
  ## Steps
19
24
 
20
25
  ### 1. Scaffold the screen
21
26
 
27
+ **Standard path (no --figma):**
28
+
22
29
  Run with #tool:terminal:
23
30
  ```bash
24
31
  sungen add --screen ${input:screen} --path ${input:path}
25
32
  ```
26
33
 
27
- ### 2. Fill spec.md
34
+ **Figma branch (when --figma \<url\> is provided):**
35
+
36
+ Run with #tool:terminal:
37
+ ```bash
38
+ sungen add --screen ${input:screen} --figma <figma-url> [--path ${input:path}] [--refresh] [--scale <n>]
39
+ ```
40
+
41
+ This CLI command automatically:
42
+ 1. Parses the Figma URL and fetches the design node.
43
+ 2. Downloads frame + variant PNGs to `qa/screens/${input:screen}/requirements/ui/`.
44
+ 3. Writes `qa/screens/${input:screen}/requirements/spec_figma.md` (auto-generated, always overwritten on re-run).
45
+ 4. Creates `qa/screens/${input:screen}/requirements/spec.md` stub **only if the file does not already exist** — never overwrites existing human content.
46
+
47
+ **Important coexistence rules:**
48
+ - `--figma` and `--path` can be passed together.
49
+ - `spec.md` is the human-authored source of truth — never modify it automatically.
50
+ - `spec_figma.md` is auto-generated — tell the user to copy useful sections into `spec.md`.
51
+ - `--capture` (Playwright screenshot) and `--figma` can be used simultaneously.
28
52
 
29
- Ask: *"Fill `spec.md` now?"* offer **1) Yes, fill now (Recommended)** / **2) Skip, fill later**.
53
+ **If Figma auth is missing**, guide the user to run `sungen figma auth set` and retry.
30
54
 
31
- If yes → open `qa/screens/${input: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.
55
+ ### 1a. Synthesize narrative sections (Figma branch only)
32
56
 
33
- ### 3. Capture visual source
57
+ 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:
34
58
 
35
- Ask the user to pick a visual source. Always offer all three so pre-launch projects work:
59
+ 1. Read `qa/screens/${input:screen}/requirements/spec_figma.md` frontmatter for `file_key`, `node_id`, `figma_version_id`.
60
+ 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).
61
+ 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.
62
+ 4. Preserve the envelope above the marker byte-for-byte.
36
63
 
64
+ **Review gate.** Before moving on, show the user the synthesized narrative and ask:
65
+
66
+ - **1) Approve** — narrative looks right, continue to Step 2
67
+ - **2) Edit** — user will tweak `spec_figma.md` now; wait for confirmation before continuing
68
+ - **3) Cancel** — abort; advise the user that `spec.md` was NOT modified and they can re-run `sungen add --figma --refresh` later
69
+
70
+ ### 2. Capture visual source
71
+
72
+ **If Figma branch (Step 1) already downloaded PNGs** → visuals already exist. Offer:
73
+ - **1) Continue** — Figma visuals are enough (Recommended)
74
+ - **2) Also capture live page** — supplement Figma with real page scan (invoke `sungen-capture-live` skill)
75
+
76
+ **If standard path (no --figma)** → go straight to source selection:
37
77
  - **1) Figma design** (Recommended for pre-launch) — invoke `sungen-capture-figma` skill
38
78
  - **2) Live page scan** (dev/staging is up) — invoke `sungen-capture-live` skill
39
- - **3) Skip** — user will drop images manually into `requirements/ui/` later, or rely on `/sungen-create-test` to prompt again
79
+ - **3) Skip** — user will drop images manually into `requirements/ui/` later
40
80
 
41
81
  Each capture skill writes outputs into `qa/screens/${input:screen}/requirements/ui/` and reports back. Do not inline capture logic here — delegate to the skill so behavior stays consistent with `/sungen-create-test`.
42
82
 
43
- 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`.
83
+ ### 3. Fill spec.md
84
+
85
+ Ask: *"Fill `spec.md` now? (You can reference the captured visuals)"* — offer **1) Yes, fill now (Recommended)** / **2) Skip, fill later**.
86
+
87
+ If yes → open `qa/screens/${input: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.
44
88
 
45
89
  ### 4. Next steps
46
90
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sungen-create-test
3
- description: 'Create or update test cases for a Sungen screen — generates feature + test-data files (20+ scenarios per viewpoint). Uses sungen-gherkin-syntax and sungen-tc-generation skills.'
3
+ description: 'Create or update test cases for a Sungen screen — generates feature + test-data files (tier-based: critical+high first, expand later). Uses sungen-gherkin-syntax and sungen-tc-generation skills.'
4
4
  argument-hint: '[screen-name]'
5
5
  agent: 'agent'
6
6
  tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*']
@@ -10,7 +10,7 @@ tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwri
10
10
 
11
11
  ## Role
12
12
 
13
- You are a **Senior QA Engineer**. You structure test cases by viewpoint categories and translate UI into Gherkin test cases following the `sungen-gherkin-syntax` and `sungen-tc-generation` skills. **Gherkin scenarios and test data only** — selectors are handled during `/sungen-run-test`.
13
+ You are a **Senior QA Engineer**. You structure test cases by viewpoint categories and translate UI into Gherkin test cases following the `sungen-gherkin-syntax` and `sungen-tc-generation` skills. **Tier 1 (critical+high) first** — expand coverage later. **Gherkin scenarios and test data only** — selectors are handled during `/sungen-run-test`.
14
14
 
15
15
  ## Parameters
16
16
 
@@ -20,27 +20,32 @@ You are a **Senior QA Engineer**. You structure test cases by viewpoint categori
20
20
 
21
21
  1. Verify `qa/screens/${input:screen}/` exists. If not → run `/sungen-add-screen` first.
22
22
  2. Check if `.feature` already has scenarios. If yes → summarize existing coverage and ask: **1) Add new sections**, **2) Add viewpoints to existing sections**, or **3) Replace all**. See `sungen-tc-generation` skill for update mode details.
23
- 3. **Read requirements** — check `qa/screens/${input:screen}/requirements/`:
23
+ 3. **Read requirements & resolve visual source** — check `qa/screens/${input:screen}/requirements/`:
24
24
  - If `spec.md` exists → read it as PRIMARY source (sections, fields, validation rules, business rules, states).
25
- - If `ui/` has images → read them for visual context (layout, element positions, states).
26
25
  - If `test-viewpoint.md` exists → read it. If it only contains HTML comments (scaffold template), ask:
27
26
  - **1) Fill test-viewpoint.md first** — identify edge cases, known issues, and design decisions before generating tests
28
27
  - **2) Continue without it** — generate tests from spec and other sources only
29
- - Summarize what you found in requirements and present to the user.
30
- 4. **Screen input** (supplements requirements, or is primary source if no requirements):
31
- - Ask the user to pick a visual source. Always offer all three so pre-launch projects work:
32
- - **1) Figma design** (Recommended for pre-launch) invoke `sungen-capture-figma` skill
33
- - **2) UI images** (existing screenshots/mockups in `requirements/ui/`) invoke `sungen-capture-local` skill
34
- - **3) Live page scan** (dev/staging is up) invoke `sungen-capture-live` skill
35
- - Each capture skill writes outputs into `qa/screens/${input:screen}/requirements/ui/` and reports back. Do not inline capture logic here — delegate to the skill so behavior stays consistent.
36
- - After the capture skill returns, cross-check its output against `spec.md` and flag any discrepancies before moving on.
37
- 5. Identify screen sections → ask user which to focus on (per `sungen-tc-generation` skill). When requirements exist, use the "Requirements-Driven Generation" strategy. Present sections as a numbered list and let user pick.
38
- 6. Generate or update `.feature` + `test-data.yaml` following `sungen-gherkin-syntax` and `sungen-tc-generation` skills.
39
- 7. Show summary and offer next steps:
28
+
29
+ **Auto-detect visual source** do NOT ask the user to pick a source. Instead, check what already exists and use it:
30
+ 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.
31
+ 2. If `ui/` has images (`.png`, `.jpg`, etc.) read them for visual context (layout, element positions, states).
32
+ 3. If neither exists ask: *"No visual source found. Pick one:"*
33
+ - **1) Figma PAT** ask for URL, run `sungen add --screen ${input:screen} --figma '<url>'`, then invoke `sungen-figma-source` skill
34
+ - **2) Figma MCP** invoke `sungen-capture-figma` skill
35
+ - **3) Live page scan** invoke `sungen-capture-live` skill
36
+ - **4) Skip** generate from spec.md only
37
+
38
+ **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).
39
+
40
+ Summarize what you found in requirements and present to the user.
41
+
42
+ 4. Identify screen sections → ask user which to focus on (per `sungen-tc-generation` skill). When requirements exist, use the "Requirements-Driven Generation" strategy. Present sections as a numbered list and let user pick.
43
+ 5. Generate or update `.feature` + `test-data.yaml` following `sungen-gherkin-syntax` and `sungen-tc-generation` skills.
44
+ 6. Show summary and offer next steps:
40
45
 
41
46
  - **`/sungen-review ${input:screen}`** — Review syntax, coverage, viewpoint quality (Recommended)
42
47
  - **`/sungen-run-test ${input:screen}`** — Skip review, generate selectors and run tests now
43
- - **`/sungen-create-test ${input:screen}`** — Add more test cases for another section/viewpoint
48
+ - **`/sungen-create-test ${input:screen}`** — Expand coverage: add @normal + @low scenarios
44
49
  - **Done for now** — I'll come back later
45
50
 
46
51
  **No selectors.yaml** — selectors are generated during `/sungen-run-test`.
@@ -1,8 +1,8 @@
1
1
  ---
2
- name: delivery
2
+ name: sungen-delivery
3
3
  description: 'Export Gherkin scenarios + Playwright results to CSV test case file for QA delivery.'
4
4
  argument-hint: "[screen-name...] (omit for all screens)"
5
- allowed-tools: Bash, Read, AskUserQuestion
5
+ tools: [read, execute, edit, vscode/askQuestions]
6
6
  ---
7
7
 
8
8
  ## Role
@@ -20,9 +20,10 @@ You are a **Senior QA Reviewer**. You evaluate Gherkin test cases using the `sun
20
20
 
21
21
  1. Read `qa/screens/${input:screen}/features/${input:screen}.feature` and `qa/screens/${input:screen}/test-data/${input:screen}.yaml`. If missing → `/sungen-create-test` first.
22
22
  2. Follow the `sungen-tc-review` skill — score 3 dimensions: Syntax (30pts), Coverage (40pts), Viewpoint (30pts). Use `sungen-viewpoint` for pattern checklists.
23
- 3. Output review report per `sungen-tc-review` format. **>= 60%**: PASS. **< 60%**: FAIL with recommendations.
24
- 4. If FAIL and user confirms → update test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills, then re-review.
25
- 5. After PASS (or user decides to proceed), offer next steps:
23
+ 3. **Unverified Selectors check** — if `qa/screens/${input:screen}/selectors/${input: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.
24
+ 4. Output review report per `sungen-tc-review` format. **>= 60%**: PASS. **< 60%**: FAIL with recommendations.
25
+ 5. If FAIL and user confirms update test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills, then re-review.
26
+ 6. After PASS (or user decides to proceed), offer next steps:
26
27
 
27
28
  - **`/sungen-run-test ${input:screen}`** — Generate selectors, compile, and run tests (Recommended)
28
29
  - **`/sungen-create-test ${input:screen}`** — Add more test cases before running
@@ -1,8 +1,8 @@
1
1
  ---
2
- name: run-test
2
+ name: sungen-run-test
3
3
  description: 'Generate selectors + auth state via Playwright MCP, compile, and run Playwright tests — auto-fixes selectors on failure'
4
- argument-hint: [screen-name]
5
- 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_run_code, mcp__playwright__browser_storage_state, mcp__playwright__browser_set_storage_state
4
+ argument-hint: '[screen-name]'
5
+ tools: [read, execute, edit, vscode/askQuestions, playwright/*]
6
6
  ---
7
7
 
8
8
  ## Role
@@ -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`
@@ -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`
@@ -52,6 +52,67 @@ If existing selectors already cover the feature file, **skip Phase 0** and go st
52
52
 
53
53
  ---
54
54
 
55
+ ## Phase 0 (Provisional): Figma-Only Selector Generation (no live page)
56
+
57
+ **Trigger**: Phase 0 decision tree (in `run-test` command) determined the live page is not reachable AND `requirements/spec_figma.md` exists.
58
+
59
+ **Goal**: produce a compilable `selectors.yaml` seeded from Figma node data so that `sungen generate` succeeds and the test suite can run. Every entry is provisional — it must be verified against a real DOM when the page becomes available.
60
+
61
+ ### Inputs
62
+
63
+ - `requirements/spec_figma.md` — specifically:
64
+ - `## Components` table (Name, Type, Role, Text, Variants columns)
65
+ - `## Text Inventory` list (node_id → label text pairs)
66
+
67
+ ### Steps
68
+
69
+ 1. **Parse references**: collect every `[Reference]` element from the `.feature` file (same as live Phase 0 step 2).
70
+ 2. **Match to Figma nodes**: for each `[Reference]`, find the best matching entry in `spec_figma.md` by comparing the reference name against component names and text labels (case-insensitive, partial match allowed).
71
+ 3. **Apply heuristic priority** (same order as live Phase 0 — use first applicable):
72
+
73
+ | Priority | Type | Figma Signal |
74
+ |---|---|---|
75
+ | 1 | `testid` | Dev annotation `data-testid=X` in component metadata |
76
+ | 2 | `role` + name | Component type is Button/Link + has text label |
77
+ | 3 | `placeholder` | Component type is Input/Field + has placeholder text |
78
+ | 4 | `label` | Component has associated label text (not placeholder) |
79
+ | 5 | `locator` (CSS) | No accessible name derivable from Figma data |
80
+ | 6 | `text` | Plain text node (not inside interactive component) |
81
+
82
+ See `sungen-figma-source` skill for the authoritative heuristics table mapping Figma signals to YAML entry types.
83
+
84
+ 4. **Write entries**: add each entry to `selectors.yaml`, prefixed with the required comment:
85
+ ```yaml
86
+ # @needs-live-verify source=figma node_id=<figma-node-id>
87
+ submit-button:
88
+ type: role
89
+ value: button
90
+ name: "Submit"
91
+ ```
92
+ - Key naming follows `sungen-selector-keys` conventions (lowercase, Unicode preserved, `--type` / `--N` suffixes).
93
+ - Copy text character-for-character from `## Text Inventory`. Never infer from the Gherkin label.
94
+ - Merge, don't overwrite — preserve the page selector and any user-authored entries.
95
+
96
+ 5. **Compile**: `sungen generate --screen <screen>` — must succeed before Phase 1.
97
+
98
+ ### Auto-fix on live page (subsequent run-test invocations)
99
+
100
+ When `run-test` is called again and the live page is now reachable:
101
+ - Phase 0 takes ONE `browser_snapshot`.
102
+ - For each entry tagged `# @needs-live-verify` in `selectors.yaml`:
103
+ - Compare the provisional selector against the actual DOM element found in the snapshot.
104
+ - If match → remove the comment line (entry promoted to verified).
105
+ - If mismatch → replace the YAML value with the snapshot-derived selector, then remove the comment (entry corrected and verified).
106
+ - Entries with no corresponding DOM element → log as unresolved, leave comment in place for manual inspection.
107
+
108
+ ### Pitfalls
109
+
110
+ - Inferring selector names from Gherkin labels instead of Figma `## Text Inventory` → mismatch on live verification.
111
+ - Omitting `# @needs-live-verify` comment → reviewer has no way to count unverified selectors.
112
+ - Overwriting user-authored selectors during merge → always check for existing keys before adding.
113
+
114
+ ---
115
+
55
116
  ## Phase 0.5: Auth Persistence (MCP alternative to `sungen makeauth`)
56
117
 
57
118
  Capture an authenticated session from the MCP browser into `specs/.auth/<role>.json` — the same path `sungen makeauth` writes to, which compiled tests already reference via `test.use({ storageState })` based on `@auth:<role>` tags. No `playwright.config.ts` edits needed. Run once per auth lifetime, not on every selector fix.