@sun-asterisk/sungen 2.7.0-beta.1 → 3.0.0-beta.71

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 (245) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/commands/add.js +3 -3
  3. package/dist/cli/commands/add.js.map +1 -1
  4. package/dist/cli/commands/audit.d.ts +3 -0
  5. package/dist/cli/commands/audit.d.ts.map +1 -0
  6. package/dist/cli/commands/audit.js +134 -0
  7. package/dist/cli/commands/audit.js.map +1 -0
  8. package/dist/cli/commands/blindspot.d.ts +3 -0
  9. package/dist/cli/commands/blindspot.d.ts.map +1 -0
  10. package/dist/cli/commands/blindspot.js +58 -0
  11. package/dist/cli/commands/blindspot.js.map +1 -0
  12. package/dist/cli/commands/challenge.d.ts +3 -0
  13. package/dist/cli/commands/challenge.d.ts.map +1 -0
  14. package/dist/cli/commands/challenge.js +102 -0
  15. package/dist/cli/commands/challenge.js.map +1 -0
  16. package/dist/cli/commands/feedback.d.ts +3 -0
  17. package/dist/cli/commands/feedback.d.ts.map +1 -0
  18. package/dist/cli/commands/feedback.js +72 -0
  19. package/dist/cli/commands/feedback.js.map +1 -0
  20. package/dist/cli/commands/generate.d.ts.map +1 -1
  21. package/dist/cli/commands/generate.js +22 -0
  22. package/dist/cli/commands/generate.js.map +1 -1
  23. package/dist/cli/commands/ledger.d.ts +3 -0
  24. package/dist/cli/commands/ledger.d.ts.map +1 -0
  25. package/dist/cli/commands/ledger.js +71 -0
  26. package/dist/cli/commands/ledger.js.map +1 -0
  27. package/dist/cli/commands/manifest.d.ts +3 -0
  28. package/dist/cli/commands/manifest.d.ts.map +1 -0
  29. package/dist/cli/commands/manifest.js +101 -0
  30. package/dist/cli/commands/manifest.js.map +1 -0
  31. package/dist/cli/commands/script-check.d.ts +3 -0
  32. package/dist/cli/commands/script-check.d.ts.map +1 -0
  33. package/dist/cli/commands/script-check.js +97 -0
  34. package/dist/cli/commands/script-check.js.map +1 -0
  35. package/dist/cli/commands/trace.d.ts +3 -0
  36. package/dist/cli/commands/trace.d.ts.map +1 -0
  37. package/dist/cli/commands/trace.js +110 -0
  38. package/dist/cli/commands/trace.js.map +1 -0
  39. package/dist/cli/commands/update.d.ts.map +1 -1
  40. package/dist/cli/commands/update.js +22 -9
  41. package/dist/cli/commands/update.js.map +1 -1
  42. package/dist/cli/index.js +16 -0
  43. package/dist/cli/index.js.map +1 -1
  44. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
  45. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
  46. package/dist/generators/test-generator/patterns/capture-patterns.d.ts +16 -0
  47. package/dist/generators/test-generator/patterns/capture-patterns.d.ts.map +1 -0
  48. package/dist/generators/test-generator/patterns/capture-patterns.js +54 -0
  49. package/dist/generators/test-generator/patterns/capture-patterns.js.map +1 -0
  50. package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
  51. package/dist/generators/test-generator/patterns/index.js +2 -0
  52. package/dist/generators/test-generator/patterns/index.js.map +1 -1
  53. package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
  54. package/dist/generators/test-generator/step-mapper.js +1 -0
  55. package/dist/generators/test-generator/step-mapper.js.map +1 -1
  56. package/dist/generators/test-generator/utils/data-resolver.d.ts +5 -0
  57. package/dist/generators/test-generator/utils/data-resolver.d.ts.map +1 -1
  58. package/dist/generators/test-generator/utils/data-resolver.js +17 -0
  59. package/dist/generators/test-generator/utils/data-resolver.js.map +1 -1
  60. package/dist/harness/audit.d.ts +24 -0
  61. package/dist/harness/audit.d.ts.map +1 -0
  62. package/dist/harness/audit.js +115 -0
  63. package/dist/harness/audit.js.map +1 -0
  64. package/dist/harness/blindspot.d.ts +15 -0
  65. package/dist/harness/blindspot.d.ts.map +1 -0
  66. package/dist/harness/blindspot.js +85 -0
  67. package/dist/harness/blindspot.js.map +1 -0
  68. package/dist/harness/catalog/universal-viewpoints.yaml +114 -0
  69. package/dist/harness/challenge.d.ts +21 -0
  70. package/dist/harness/challenge.d.ts.map +1 -0
  71. package/dist/harness/challenge.js +151 -0
  72. package/dist/harness/challenge.js.map +1 -0
  73. package/dist/harness/feedback.d.ts +29 -0
  74. package/dist/harness/feedback.d.ts.map +1 -0
  75. package/dist/harness/feedback.js +106 -0
  76. package/dist/harness/feedback.js.map +1 -0
  77. package/dist/harness/intent.d.ts +11 -0
  78. package/dist/harness/intent.d.ts.map +1 -0
  79. package/dist/harness/intent.js +86 -0
  80. package/dist/harness/intent.js.map +1 -0
  81. package/dist/harness/ledger.d.ts +42 -0
  82. package/dist/harness/ledger.d.ts.map +1 -0
  83. package/dist/harness/ledger.js +171 -0
  84. package/dist/harness/ledger.js.map +1 -0
  85. package/dist/harness/manifest.d.ts +42 -0
  86. package/dist/harness/manifest.d.ts.map +1 -0
  87. package/dist/harness/manifest.js +209 -0
  88. package/dist/harness/manifest.js.map +1 -0
  89. package/dist/harness/parse.d.ts +22 -0
  90. package/dist/harness/parse.d.ts.map +1 -0
  91. package/dist/harness/parse.js +163 -0
  92. package/dist/harness/parse.js.map +1 -0
  93. package/dist/harness/script-check.d.ts +16 -0
  94. package/dist/harness/script-check.d.ts.map +1 -0
  95. package/dist/harness/script-check.js +169 -0
  96. package/dist/harness/script-check.js.map +1 -0
  97. package/dist/harness/secret-scan.d.ts +8 -0
  98. package/dist/harness/secret-scan.d.ts.map +1 -0
  99. package/dist/harness/secret-scan.js +88 -0
  100. package/dist/harness/secret-scan.js.map +1 -0
  101. package/dist/harness/sensors.d.ts +88 -0
  102. package/dist/harness/sensors.d.ts.map +1 -0
  103. package/dist/harness/sensors.js +232 -0
  104. package/dist/harness/sensors.js.map +1 -0
  105. package/dist/harness/trace.d.ts +31 -0
  106. package/dist/harness/trace.d.ts.map +1 -0
  107. package/dist/harness/trace.js +173 -0
  108. package/dist/harness/trace.js.map +1 -0
  109. package/dist/orchestrator/ai-rules-updater.d.ts +1 -0
  110. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  111. package/dist/orchestrator/ai-rules-updater.js +55 -11
  112. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  113. package/dist/orchestrator/figma/spec-figma-renderer.d.ts +2 -2
  114. package/dist/orchestrator/figma/spec-figma-renderer.js +2 -2
  115. package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts +1 -1
  116. package/dist/orchestrator/figma/spec-figma-section-renderers.js +1 -1
  117. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  118. package/dist/orchestrator/project-initializer.js +10 -6
  119. package/dist/orchestrator/project-initializer.js.map +1 -1
  120. package/dist/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
  121. package/dist/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
  122. package/dist/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
  123. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
  124. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
  125. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
  126. package/dist/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
  127. package/dist/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
  128. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
  129. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
  130. package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -4
  131. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
  132. package/dist/orchestrator/templates/ai-instructions/{github-skill-sungen-figma-source.md → claude-skill-capture-mode-figma-pat.md} +14 -48
  133. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
  134. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
  135. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
  136. package/dist/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
  137. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
  138. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
  139. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
  140. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
  141. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
  142. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
  143. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
  144. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
  145. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
  146. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
  147. package/{src/orchestrator/templates/ai-instructions/claude-skill-figma-source.md → dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-pat.md} +14 -48
  148. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
  149. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
  150. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
  151. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
  152. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
  153. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
  154. package/dist/orchestrator/templates/specs-test-data.ts +9 -0
  155. package/dist/tools/figma/figma-auth.d.ts +5 -2
  156. package/dist/tools/figma/figma-auth.d.ts.map +1 -1
  157. package/dist/tools/figma/figma-auth.js +19 -9
  158. package/dist/tools/figma/figma-auth.js.map +1 -1
  159. package/docs/orchestration-spec.md +267 -0
  160. package/package.json +10 -6
  161. package/src/cli/commands/add.ts +3 -3
  162. package/src/cli/commands/audit.ts +92 -0
  163. package/src/cli/commands/blindspot.ts +48 -0
  164. package/src/cli/commands/challenge.ts +55 -0
  165. package/src/cli/commands/feedback.ts +65 -0
  166. package/src/cli/commands/generate.ts +19 -0
  167. package/src/cli/commands/ledger.ts +61 -0
  168. package/src/cli/commands/manifest.ts +55 -0
  169. package/src/cli/commands/script-check.ts +50 -0
  170. package/src/cli/commands/trace.ts +60 -0
  171. package/src/cli/commands/update.ts +30 -10
  172. package/src/cli/index.ts +16 -0
  173. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
  174. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
  175. package/src/generators/test-generator/patterns/capture-patterns.ts +59 -0
  176. package/src/generators/test-generator/patterns/index.ts +2 -0
  177. package/src/generators/test-generator/step-mapper.ts +1 -0
  178. package/src/generators/test-generator/utils/data-resolver.ts +20 -0
  179. package/src/harness/audit.ts +112 -0
  180. package/src/harness/blindspot.ts +51 -0
  181. package/src/harness/catalog/universal-viewpoints.yaml +114 -0
  182. package/src/harness/challenge.ts +131 -0
  183. package/src/harness/feedback.ts +84 -0
  184. package/src/harness/intent.ts +58 -0
  185. package/src/harness/ledger.ts +155 -0
  186. package/src/harness/manifest.ts +173 -0
  187. package/src/harness/parse.ts +145 -0
  188. package/src/harness/script-check.ts +149 -0
  189. package/src/harness/secret-scan.ts +51 -0
  190. package/src/harness/sensors.ts +279 -0
  191. package/src/harness/trace.ts +138 -0
  192. package/src/orchestrator/ai-rules-updater.ts +57 -10
  193. package/src/orchestrator/figma/spec-figma-renderer.ts +2 -2
  194. package/src/orchestrator/figma/spec-figma-section-renderers.ts +1 -1
  195. package/src/orchestrator/project-initializer.ts +10 -7
  196. package/src/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
  197. package/src/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
  198. package/src/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
  199. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
  200. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
  201. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
  202. package/src/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
  203. package/src/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
  204. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
  205. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
  206. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -4
  207. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
  208. package/{dist/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md → src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-pat.md} +14 -48
  209. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
  210. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
  211. package/src/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
  212. package/src/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
  213. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
  214. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
  215. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
  216. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
  217. package/src/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
  218. package/src/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
  219. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
  220. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
  221. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
  222. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
  223. package/{dist/orchestrator/templates/ai-instructions/claude-skill-figma-source.md → src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-pat.md} +14 -48
  224. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
  225. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
  226. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
  227. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
  228. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
  229. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
  230. package/src/orchestrator/templates/specs-test-data.ts +9 -0
  231. package/src/tools/figma/figma-auth.ts +20 -9
  232. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
  233. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
  234. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
  235. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
  236. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
  237. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
  238. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
  239. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
  240. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
  241. package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +0 -151
  242. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
  243. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
  244. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
  245. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +0 -151
@@ -1,142 +0,0 @@
1
- ---
2
- name: sungen-capture-figma
3
- description: 'Fetch design context + PNG from a Figma frame URL via Figma Dev Mode MCP. Auto-loaded by create-test when user picks Figma as the visual source.'
4
- user-invocable: false
5
- ---
6
-
7
- ## Purpose
8
-
9
- Pull **structured design data** (layout, typography, colors, component tree, design tokens) and a **PNG screenshot** from a Figma frame URL, so `sungen-tc-generation` can author Gherkin + test-data before a live domain exists.
10
-
11
- Use this when the project is pre-launch, or when Figma is the source of truth and the live build lags the design.
12
-
13
- ---
14
-
15
- ## Prerequisites
16
-
17
- - **Figma MCP server** (`https://mcp.figma.com/mcp`, HTTP transport) connected in the user's `.mcp.json` — `sungen init` scaffolds this automatically. On first use, Claude Code opens a browser for Figma OAuth. Official tools: `get_design_context`, `get_variable_defs`, `get_screenshot`.
18
- - Figma account signed in with access to the file. **Dev/Full seats** get per-minute rate limits; **Starter/View seats** get monthly tool-call limits.
19
- - A Figma URL with both **fileKey** and **nodeId** in it.
20
-
21
- If the MCP is not connected, **do not fail silently** — tell the user:
22
- > "Figma MCP not detected. Run `sungen init` to scaffold the config, or manually add `figma` with `url: https://mcp.figma.com/mcp` to `.mcp.json`. Then sign in when Claude Code prompts."
23
-
24
- Then stop.
25
-
26
- ---
27
-
28
- ## Steps
29
-
30
- ### 1. Resolve Figma URL
31
-
32
- Prefer in this order:
33
-
34
- 1. `Figma URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
35
- 2. If empty or missing → `AskUserQuestion`: *"Paste the Figma frame URL"* (free text)
36
-
37
- Accept any of these URL shapes:
38
-
39
- ```
40
- https://www.figma.com/file/<fileKey>/<title>?node-id=<nodeId>
41
- https://www.figma.com/design/<fileKey>/<title>?node-id=<nodeId>
42
- https://www.figma.com/proto/<fileKey>/<title>?node-id=<nodeId>
43
- ```
44
-
45
- Parse:
46
- - `fileKey` = the segment after `/file/`, `/design/`, or `/proto/`
47
- - `nodeId` = the `node-id` query param (may use `-` or `:` — pass through as-is; MCP accepts both)
48
-
49
- If `node-id` is missing, ask the user to select a frame in Figma and copy the **frame URL** specifically (not the file root URL).
50
-
51
- ### 2. Fetch design context
52
-
53
- Call **both** in parallel:
54
-
55
- ```
56
- get_design_context({ fileKey, nodeId })
57
- get_variable_defs({ fileKey, nodeId })
58
- ```
59
-
60
- `get_design_context` returns layout, typography, color values, component structure, spacing.
61
- `get_variable_defs` returns named design tokens (color/spacing/typography variables).
62
-
63
- ### 3. Fetch screenshot
64
-
65
- ```
66
- get_screenshot({ fileKey, nodeId })
67
- ```
68
-
69
- Save the returned PNG to:
70
-
71
- ```
72
- qa/screens/<screen>/requirements/ui/figma-<sanitized-nodeId>.png
73
- ```
74
-
75
- Sanitize `nodeId` for filesystem: replace `:` and `-` with `_`. Example: `42-15` → `figma-42_15.png`.
76
-
77
- ### 4. Write metadata dump
78
-
79
- Combine the design context + variables into a Markdown summary at:
80
-
81
- ```
82
- qa/screens/<screen>/requirements/ui/figma-meta.md
83
- ```
84
-
85
- Format:
86
-
87
- ```markdown
88
- # Figma Capture — <nodeId>
89
-
90
- **Source:** <full Figma URL>
91
- **Captured:** <ISO date>
92
-
93
- ## Components
94
- <hierarchical list of component names + variants from get_design_context>
95
-
96
- ## Typography
97
- <font families, sizes, weights, line heights>
98
-
99
- ## Colors
100
- <color tokens + raw hex values>
101
-
102
- ## Spacing & Layout
103
- <spacing tokens, auto-layout specs>
104
-
105
- ## Text Content
106
- <visible text strings from the frame — used by tc-generation to populate test-data>
107
- ```
108
-
109
- This file is consumed by `sungen-tc-generation` as a secondary source alongside `spec.md`.
110
-
111
- ### 5. Report back
112
-
113
- Output a short summary to the user:
114
-
115
- > Captured Figma frame `<nodeId>`:
116
- > - Components: N
117
- > - Text strings: M
118
- > - Design tokens: K
119
- > - Screenshot: `qa/screens/<screen>/requirements/ui/figma-<nodeId>.png`
120
- > - Metadata: `requirements/ui/figma-meta.md`
121
-
122
- Then hand back to the calling command.
123
-
124
- ---
125
-
126
- ## Error handling
127
-
128
- | Error | Action |
129
- |---|---|
130
- | MCP tool not available | Print setup instructions, stop, do not fall back silently |
131
- | `fileKey` missing from URL | Ask user to paste a valid frame URL |
132
- | `nodeId` missing from URL | Ask user to right-click a frame in Figma → *Copy link to selection* |
133
- | `get_design_context` 403 | Ask user to check Dev Mode seat on that file |
134
- | `get_screenshot` returns no image | Continue with metadata only; warn user no PNG was captured |
135
-
136
- ---
137
-
138
- ## What this skill does NOT do
139
-
140
- - Does not generate Gherkin (that's `sungen-tc-generation`)
141
- - Does not write `selectors.yaml` (that's `/sungen:run-test`)
142
- - Does not validate the design against live UI (future skill: `sungen-capture-live` can be run afterwards for cross-check)
@@ -1,112 +0,0 @@
1
- ---
2
- name: sungen-capture-live
3
- description: 'Capture a live running page via Playwright MCP — snapshot + screenshot for visual context. Auto-loaded by create-test when user picks Live page scan.'
4
- user-invocable: false
5
- ---
6
-
7
- ## Purpose
8
-
9
- Navigate a running application, take **one accessibility snapshot** and **one screenshot**, and save them as visual context for test generation. Use when the app is live (dev, staging, or production with read-only access) and you want the tests grounded in the actual rendered UI.
10
-
11
- This skill handles auth gracefully: if the page redirects to login, it asks the user to sign in manually rather than injecting cookies.
12
-
13
- ---
14
-
15
- ## Prerequisites
16
-
17
- - Playwright MCP connected.
18
- - Dev/staging server reachable (or a public URL).
19
- - `playwright.config.ts` exists at the project root (for `baseURL` fallback).
20
-
21
- ---
22
-
23
- ## Steps
24
-
25
- ### 1. Resolve target URL
26
-
27
- Resolve in this order:
28
-
29
- 1. `Live URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
30
- 2. `baseURL` from `playwright.config.ts` + `URL Path` from `spec.md`
31
- 3. If neither works → `AskUserQuestion`: *"Paste the full URL for the page to scan"*
32
-
33
- ### 2. Navigate
34
-
35
- `browser_navigate` to the resolved URL.
36
-
37
- ### 3. Handle auth redirect
38
-
39
- If the page redirects to a login route (URL contains `/login`, `/signin`, `/auth`, or the page title/content indicates a login screen):
40
-
41
- 1. Tell the user which login URL they landed on.
42
- 2. `AskUserQuestion`:
43
- - **I'll log in manually** — wait for user confirmation, then re-navigate to the target URL
44
- - **Skip live scan** — tell caller to invoke `sungen-capture-local` instead
45
- - **Cancel**
46
- 3. **Never** inject cookies or localStorage via `browser_evaluate` or `browser_run_code`. Auth belongs to the user.
47
-
48
- ### 4. Snapshot
49
-
50
- Take **ONE** `browser_snapshot`. This accessibility tree is the primary AI context — it contains roles, names, text, and structure that the tc-generation skill uses to identify sections and fields.
51
-
52
- ### 5. Screenshot (optional but recommended)
53
-
54
- Take **ONE** `browser_take_screenshot` with `fullPage: true`. Save to:
55
-
56
- ```
57
- qa/screens/<screen>/requirements/ui/live-<timestamp>.png
58
- ```
59
-
60
- Where `<timestamp>` is `YYYYMMDD-HHMM` in local time (e.g. `live-20260421-1430.png`).
61
-
62
- This gives users a visual record they can reference later without re-scanning.
63
-
64
- ### 6a. Verify unauthenticated redirect target (flow capture only)
65
-
66
- When capturing for a **flow** that includes security scenarios (e.g., "unauthenticated user cannot access X"):
67
-
68
- 1. Open a **fresh incognito/unauthenticated** browser context (no storage state).
69
- 2. `browser_navigate` to the protected route (e.g., `/dashboard`).
70
- 3. Record the **actual redirect URL** — do NOT assume it goes to `/login`. The app may redirect to `/register`, `/`, or any other route.
71
- 4. Report the redirect target to the caller: *"Unauthenticated access to `/dashboard` redirects to `/register`"*.
72
- 5. The caller must use the **actual redirect URL** in Gherkin assertions (e.g., `Then User is on [Register] page`), never an assumed one.
73
-
74
- Skip this step if the flow has no security scenarios or the user explicitly says to skip.
75
-
76
- ### 6. Detect discrepancies vs spec
77
-
78
- If `spec.md` exists, briefly cross-check the snapshot against spec sections:
79
-
80
- - Fields listed in spec but not in snapshot → flag as *missing in UI*
81
- - Elements visible in snapshot but not in spec → flag as *missing in spec*
82
-
83
- Report findings but **do not** auto-edit `spec.md` — let the user decide.
84
-
85
- ### 7. Report back
86
-
87
- > Captured live page `<URL>`:
88
- > - Snapshot: <N> interactive elements detected
89
- > - Screenshot: `requirements/ui/live-<timestamp>.png`
90
- > - Discrepancies vs spec: <count, or "none">
91
-
92
- Hand back to the calling command.
93
-
94
- ---
95
-
96
- ## What this skill does NOT do
97
-
98
- - Does not run tests
99
- - Does not generate `selectors.yaml` (that's `/sungen:run-test`)
100
- - Does not inject auth state (user logs in manually)
101
- - Does not crawl — scans **exactly one** page per invocation
102
- - Does not generate Gherkin — that's `sungen-tc-generation`
103
-
104
- ---
105
-
106
- ## Relationship to other capture skills
107
-
108
- - `sungen-capture-figma` — design source of truth (pre-launch)
109
- - `sungen-capture-local` — any image the user dropped in `requirements/ui/`
110
- - `sungen-capture-live` — this skill, verifies/supplements against the running app
111
-
112
- All three write to `requirements/ui/` and report back to the caller. They are mutually exclusive per create-test run, but a user can run create-test multiple times with different sources to layer context.
@@ -1,73 +0,0 @@
1
- ---
2
- name: sungen-capture-local
3
- description: 'Load existing UI assets (screenshots, Figma exports, hand-drawn mockups) from requirements/ui/. Auto-loaded by create-test when user picks UI images as the visual source.'
4
- user-invocable: false
5
- ---
6
-
7
- ## Purpose
8
-
9
- Use **pre-existing images** in `qa/screens/<screen>/requirements/ui/` as visual context for test generation. No network, no MCP, no live site required — works for any design tool (Figma export, Sketch, Penpot, Zeplin, hand-drawn, screenshots of a staging env).
10
-
11
- This is the **baseline fallback**: if live domain is down and Figma MCP isn't configured, this always works as long as the user drops images in the folder.
12
-
13
- ---
14
-
15
- ## Steps
16
-
17
- ### 1. List available images
18
-
19
- Glob `qa/screens/<screen>/requirements/ui/*.{png,jpg,jpeg,webp,gif}` and report count + filenames.
20
-
21
- Filter out metadata files (e.g. `figma-meta.md` written by `sungen-capture-figma`) — those are read by `tc-generation` separately, not treated as images here.
22
-
23
- ### 2. Handle empty folder
24
-
25
- If no images found:
26
-
27
- 1. Tell the user the folder is empty, with the full path so they can navigate there in Finder.
28
- 2. `AskUserQuestion`:
29
- - **I'll drop images now** — wait for user to confirm, then re-glob
30
- - **Switch to Figma URL** — tell caller to invoke `sungen-capture-figma` instead
31
- - **Switch to live page scan** — tell caller to invoke `sungen-capture-live` instead
32
- - **Cancel** — abort create-test
33
- 3. If user picks "drop images now", wait for their confirmation message (e.g. "done") then re-run step 1.
34
-
35
- ### 3. Read images for context
36
-
37
- Use the `Read` tool on each image file — Claude Code can read PNG/JPG/WebP directly as visual context.
38
-
39
- For large sets (>10 images), ask the user which are primary and which are states/variants, to avoid loading too much visual context at once.
40
-
41
- ### 4. Summarize
42
-
43
- Output a short summary:
44
-
45
- > Loaded N image(s) from `qa/screens/<screen>/requirements/ui/`:
46
- > - `<filename-1>` — <one-line description of what's visible>
47
- > - `<filename-2>` — <one-line description>
48
- > ...
49
-
50
- Hand back to the calling command.
51
-
52
- ---
53
-
54
- ## File naming hints for users
55
-
56
- When this skill reports back, nudge users toward consistent filenames so future runs are self-documenting:
57
-
58
- - `<section>-default.png` — baseline state of a section
59
- - `<section>-error.png` — error state
60
- - `<section>-loading.png` — loading state
61
- - `<section>-empty.png` — empty state
62
- - `full-page.png` / `viewport.png` — whole screen (auto-generated by `sungen add --capture`)
63
-
64
- Don't enforce — just suggest if filenames are ambiguous.
65
-
66
- ---
67
-
68
- ## What this skill does NOT do
69
-
70
- - Does not download images from external URLs
71
- - Does not generate images (no AI image generation)
72
- - Does not modify existing images (no crop/resize)
73
- - Does not generate Gherkin — that's `sungen-tc-generation`
@@ -1,142 +0,0 @@
1
- ---
2
- name: sungen-capture-figma
3
- description: 'Fetch design context + PNG from a Figma frame URL via Figma Dev Mode MCP. Auto-loaded by create-test when user picks Figma as the visual source.'
4
- user-invocable: false
5
- ---
6
-
7
- ## Purpose
8
-
9
- Pull **structured design data** (layout, typography, colors, component tree, design tokens) and a **PNG screenshot** from a Figma frame URL, so `sungen-tc-generation` can author Gherkin + test-data before a live domain exists.
10
-
11
- Use this when the project is pre-launch, or when Figma is the source of truth and the live build lags the design.
12
-
13
- ---
14
-
15
- ## Prerequisites
16
-
17
- - **Figma MCP server** (`https://mcp.figma.com/mcp`, HTTP transport) connected in `.vscode/mcp.json` — `sungen init` scaffolds this automatically. On first use, VS Code / Copilot opens a browser for Figma OAuth. Official tools: `get_design_context`, `get_variable_defs`, `get_screenshot`.
18
- - Figma account signed in with access to the file. **Dev/Full seats** get per-minute rate limits; **Starter/View seats** get monthly tool-call limits.
19
- - A Figma URL with both **fileKey** and **nodeId** in it.
20
-
21
- If the MCP is not connected, **do not fail silently** — tell the user:
22
- > "Figma MCP not detected. Run `sungen init` to scaffold the config, or manually add `figma` with `url: https://mcp.figma.com/mcp` to `.vscode/mcp.json`. Then sign in when VS Code prompts."
23
-
24
- Then stop.
25
-
26
- ---
27
-
28
- ## Steps
29
-
30
- ### 1. Resolve Figma URL
31
-
32
- Prefer in this order:
33
-
34
- 1. `Figma URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
35
- 2. If empty or missing → ask the user: *"Paste the Figma frame URL"*
36
-
37
- Accept any of these URL shapes:
38
-
39
- ```
40
- https://www.figma.com/file/<fileKey>/<title>?node-id=<nodeId>
41
- https://www.figma.com/design/<fileKey>/<title>?node-id=<nodeId>
42
- https://www.figma.com/proto/<fileKey>/<title>?node-id=<nodeId>
43
- ```
44
-
45
- Parse:
46
- - `fileKey` = the segment after `/file/`, `/design/`, or `/proto/`
47
- - `nodeId` = the `node-id` query param (may use `-` or `:` — pass through as-is; MCP accepts both)
48
-
49
- If `node-id` is missing, ask the user to select a frame in Figma and copy the **frame URL** specifically (not the file root URL).
50
-
51
- ### 2. Fetch design context
52
-
53
- Call **both** in parallel:
54
-
55
- ```
56
- get_design_context({ fileKey, nodeId })
57
- get_variable_defs({ fileKey, nodeId })
58
- ```
59
-
60
- `get_design_context` returns layout, typography, color values, component structure, spacing.
61
- `get_variable_defs` returns named design tokens (color/spacing/typography variables).
62
-
63
- ### 3. Fetch screenshot
64
-
65
- ```
66
- get_screenshot({ fileKey, nodeId })
67
- ```
68
-
69
- Save the returned PNG to:
70
-
71
- ```
72
- qa/screens/<screen>/requirements/ui/figma-<sanitized-nodeId>.png
73
- ```
74
-
75
- Sanitize `nodeId` for filesystem: replace `:` and `-` with `_`. Example: `42-15` → `figma-42_15.png`.
76
-
77
- ### 4. Write metadata dump
78
-
79
- Combine the design context + variables into a Markdown summary at:
80
-
81
- ```
82
- qa/screens/<screen>/requirements/ui/figma-meta.md
83
- ```
84
-
85
- Format:
86
-
87
- ```markdown
88
- # Figma Capture — <nodeId>
89
-
90
- **Source:** <full Figma URL>
91
- **Captured:** <ISO date>
92
-
93
- ## Components
94
- <hierarchical list of component names + variants from get_design_context>
95
-
96
- ## Typography
97
- <font families, sizes, weights, line heights>
98
-
99
- ## Colors
100
- <color tokens + raw hex values>
101
-
102
- ## Spacing & Layout
103
- <spacing tokens, auto-layout specs>
104
-
105
- ## Text Content
106
- <visible text strings from the frame — used by tc-generation to populate test-data>
107
- ```
108
-
109
- This file is consumed by `sungen-tc-generation` as a secondary source alongside `spec.md`.
110
-
111
- ### 5. Report back
112
-
113
- Output a short summary to the user:
114
-
115
- > Captured Figma frame `<nodeId>`:
116
- > - Components: N
117
- > - Text strings: M
118
- > - Design tokens: K
119
- > - Screenshot: `qa/screens/<screen>/requirements/ui/figma-<nodeId>.png`
120
- > - Metadata: `requirements/ui/figma-meta.md`
121
-
122
- Then hand back to the calling command.
123
-
124
- ---
125
-
126
- ## Error handling
127
-
128
- | Error | Action |
129
- |---|---|
130
- | MCP tool not available | Print setup instructions, stop, do not fall back silently |
131
- | `fileKey` missing from URL | Ask user to paste a valid frame URL |
132
- | `nodeId` missing from URL | Ask user to right-click a frame in Figma → *Copy link to selection* |
133
- | `get_design_context` 403 | Ask user to check Dev Mode seat on that file |
134
- | `get_screenshot` returns no image | Continue with metadata only; warn user no PNG was captured |
135
-
136
- ---
137
-
138
- ## What this skill does NOT do
139
-
140
- - Does not generate Gherkin (that's `sungen-tc-generation`)
141
- - Does not write `selectors.yaml` (that's `/sungen-run-test`)
142
- - Does not validate the design against live UI (future skill: `sungen-capture-live` can be run afterwards for cross-check)
@@ -1,112 +0,0 @@
1
- ---
2
- name: sungen-capture-live
3
- description: 'Capture a live running page via Playwright MCP — snapshot + screenshot for visual context. Auto-loaded by create-test when user picks Live page scan.'
4
- user-invocable: false
5
- ---
6
-
7
- ## Purpose
8
-
9
- Navigate a running application, take **one accessibility snapshot** and **one screenshot**, and save them as visual context for test generation. Use when the app is live (dev, staging, or production with read-only access) and you want the tests grounded in the actual rendered UI.
10
-
11
- This skill handles auth gracefully: if the page redirects to login, it asks the user to sign in manually rather than injecting cookies.
12
-
13
- ---
14
-
15
- ## Prerequisites
16
-
17
- - Playwright MCP connected.
18
- - Dev/staging server reachable (or a public URL).
19
- - `playwright.config.ts` exists at the project root (for `baseURL` fallback).
20
-
21
- ---
22
-
23
- ## Steps
24
-
25
- ### 1. Resolve target URL
26
-
27
- Resolve in this order:
28
-
29
- 1. `Live URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
30
- 2. `baseURL` from `playwright.config.ts` + `URL Path` from `spec.md`
31
- 3. If neither works → ask the user: *"Paste the full URL for the page to scan"*
32
-
33
- ### 2. Navigate
34
-
35
- `browser_navigate` to the resolved URL.
36
-
37
- ### 3. Handle auth redirect
38
-
39
- If the page redirects to a login route (URL contains `/login`, `/signin`, `/auth`, or the page title/content indicates a login screen):
40
-
41
- 1. Tell the user which login URL they landed on.
42
- 2. Ask the user:
43
- - **1) I'll log in manually** — wait for user confirmation, then re-navigate to the target URL
44
- - **2) Skip live scan** — tell caller to invoke `sungen-capture-local` instead
45
- - **3) Cancel**
46
- 3. **Never** inject cookies or localStorage via `browser_evaluate` or `browser_run_code`. Auth belongs to the user.
47
-
48
- ### 4. Snapshot
49
-
50
- Take **ONE** `browser_snapshot`. This accessibility tree is the primary AI context — it contains roles, names, text, and structure that the tc-generation skill uses to identify sections and fields.
51
-
52
- ### 5. Screenshot (optional but recommended)
53
-
54
- Take **ONE** `browser_take_screenshot` with `fullPage: true`. Save to:
55
-
56
- ```
57
- qa/screens/<screen>/requirements/ui/live-<timestamp>.png
58
- ```
59
-
60
- Where `<timestamp>` is `YYYYMMDD-HHMM` in local time (e.g. `live-20260421-1430.png`).
61
-
62
- This gives users a visual record they can reference later without re-scanning.
63
-
64
- ### 6a. Verify unauthenticated redirect target (flow capture only)
65
-
66
- When capturing for a **flow** that includes security scenarios (e.g., "unauthenticated user cannot access X"):
67
-
68
- 1. Open a **fresh incognito/unauthenticated** browser context (no storage state).
69
- 2. `browser_navigate` to the protected route (e.g., `/dashboard`).
70
- 3. Record the **actual redirect URL** — do NOT assume it goes to `/login`. The app may redirect to `/register`, `/`, or any other route.
71
- 4. Report the redirect target to the caller: *"Unauthenticated access to `/dashboard` redirects to `/register`"*.
72
- 5. The caller must use the **actual redirect URL** in Gherkin assertions (e.g., `Then User is on [Register] page`), never an assumed one.
73
-
74
- Skip this step if the flow has no security scenarios or the user explicitly says to skip.
75
-
76
- ### 6. Detect discrepancies vs spec
77
-
78
- If `spec.md` exists, briefly cross-check the snapshot against spec sections:
79
-
80
- - Fields listed in spec but not in snapshot → flag as *missing in UI*
81
- - Elements visible in snapshot but not in spec → flag as *missing in spec*
82
-
83
- Report findings but **do not** auto-edit `spec.md` — let the user decide.
84
-
85
- ### 7. Report back
86
-
87
- > Captured live page `<URL>`:
88
- > - Snapshot: <N> interactive elements detected
89
- > - Screenshot: `requirements/ui/live-<timestamp>.png`
90
- > - Discrepancies vs spec: <count, or "none">
91
-
92
- Hand back to the calling command.
93
-
94
- ---
95
-
96
- ## What this skill does NOT do
97
-
98
- - Does not run tests
99
- - Does not generate `selectors.yaml` (that's `/sungen-run-test`)
100
- - Does not inject auth state (user logs in manually)
101
- - Does not crawl — scans **exactly one** page per invocation
102
- - Does not generate Gherkin — that's `sungen-tc-generation`
103
-
104
- ---
105
-
106
- ## Relationship to other capture skills
107
-
108
- - `sungen-capture-figma` — design source of truth (pre-launch)
109
- - `sungen-capture-local` — any image the user dropped in `requirements/ui/`
110
- - `sungen-capture-live` — this skill, verifies/supplements against the running app
111
-
112
- All three write to `requirements/ui/` and report back to the caller. They are mutually exclusive per create-test run, but a user can run create-test multiple times with different sources to layer context.
@@ -1,73 +0,0 @@
1
- ---
2
- name: sungen-capture-local
3
- description: 'Load existing UI assets (screenshots, Figma exports, hand-drawn mockups) from requirements/ui/. Auto-loaded by create-test when user picks UI images as the visual source.'
4
- user-invocable: false
5
- ---
6
-
7
- ## Purpose
8
-
9
- Use **pre-existing images** in `qa/screens/<screen>/requirements/ui/` as visual context for test generation. No network, no MCP, no live site required — works for any design tool (Figma export, Sketch, Penpot, Zeplin, hand-drawn, screenshots of a staging env).
10
-
11
- This is the **baseline fallback**: if live domain is down and Figma MCP isn't configured, this always works as long as the user drops images in the folder.
12
-
13
- ---
14
-
15
- ## Steps
16
-
17
- ### 1. List available images
18
-
19
- Glob `qa/screens/<screen>/requirements/ui/*.{png,jpg,jpeg,webp,gif}` and report count + filenames.
20
-
21
- Filter out metadata files (e.g. `figma-meta.md` written by `sungen-capture-figma`) — those are read by `tc-generation` separately, not treated as images here.
22
-
23
- ### 2. Handle empty folder
24
-
25
- If no images found:
26
-
27
- 1. Tell the user the folder is empty, with the full path so they can navigate there in their file manager.
28
- 2. Ask the user to pick:
29
- - **1) I'll drop images now** — wait for user to confirm, then re-glob
30
- - **2) Switch to Figma URL** — tell caller to invoke `sungen-capture-figma` instead
31
- - **3) Switch to live page scan** — tell caller to invoke `sungen-capture-live` instead
32
- - **4) Cancel** — abort create-test
33
- 3. If user picks "drop images now", wait for their confirmation message (e.g. "done") then re-run step 1.
34
-
35
- ### 3. Read images for context
36
-
37
- Use the `read` tool on each image file — the assistant can read PNG/JPG/WebP directly as visual context.
38
-
39
- For large sets (>10 images), ask the user which are primary and which are states/variants, to avoid loading too much visual context at once.
40
-
41
- ### 4. Summarize
42
-
43
- Output a short summary:
44
-
45
- > Loaded N image(s) from `qa/screens/<screen>/requirements/ui/`:
46
- > - `<filename-1>` — <one-line description of what's visible>
47
- > - `<filename-2>` — <one-line description>
48
- > ...
49
-
50
- Hand back to the calling command.
51
-
52
- ---
53
-
54
- ## File naming hints for users
55
-
56
- When this skill reports back, nudge users toward consistent filenames so future runs are self-documenting:
57
-
58
- - `<section>-default.png` — baseline state of a section
59
- - `<section>-error.png` — error state
60
- - `<section>-loading.png` — loading state
61
- - `<section>-empty.png` — empty state
62
- - `full-page.png` / `viewport.png` — whole screen (auto-generated by `sungen add --capture`)
63
-
64
- Don't enforce — just suggest if filenames are ambiguous.
65
-
66
- ---
67
-
68
- ## What this skill does NOT do
69
-
70
- - Does not download images from external URLs
71
- - Does not generate images (no AI image generation)
72
- - Does not modify existing images (no crop/resize)
73
- - Does not generate Gherkin — that's `sungen-tc-generation`