@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.
- package/README.md +1 -1
- package/dist/cli/commands/add.js +3 -3
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/audit.d.ts +3 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +134 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/blindspot.d.ts +3 -0
- package/dist/cli/commands/blindspot.d.ts.map +1 -0
- package/dist/cli/commands/blindspot.js +58 -0
- package/dist/cli/commands/blindspot.js.map +1 -0
- package/dist/cli/commands/challenge.d.ts +3 -0
- package/dist/cli/commands/challenge.d.ts.map +1 -0
- package/dist/cli/commands/challenge.js +102 -0
- package/dist/cli/commands/challenge.js.map +1 -0
- package/dist/cli/commands/feedback.d.ts +3 -0
- package/dist/cli/commands/feedback.d.ts.map +1 -0
- package/dist/cli/commands/feedback.js +72 -0
- package/dist/cli/commands/feedback.js.map +1 -0
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +22 -0
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/ledger.d.ts +3 -0
- package/dist/cli/commands/ledger.d.ts.map +1 -0
- package/dist/cli/commands/ledger.js +71 -0
- package/dist/cli/commands/ledger.js.map +1 -0
- package/dist/cli/commands/manifest.d.ts +3 -0
- package/dist/cli/commands/manifest.d.ts.map +1 -0
- package/dist/cli/commands/manifest.js +101 -0
- package/dist/cli/commands/manifest.js.map +1 -0
- package/dist/cli/commands/script-check.d.ts +3 -0
- package/dist/cli/commands/script-check.d.ts.map +1 -0
- package/dist/cli/commands/script-check.js +97 -0
- package/dist/cli/commands/script-check.js.map +1 -0
- package/dist/cli/commands/trace.d.ts +3 -0
- package/dist/cli/commands/trace.d.ts.map +1 -0
- package/dist/cli/commands/trace.js +110 -0
- package/dist/cli/commands/trace.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +22 -9
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +16 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
- package/dist/generators/test-generator/patterns/capture-patterns.d.ts +16 -0
- package/dist/generators/test-generator/patterns/capture-patterns.d.ts.map +1 -0
- package/dist/generators/test-generator/patterns/capture-patterns.js +54 -0
- package/dist/generators/test-generator/patterns/capture-patterns.js.map +1 -0
- package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/index.js +2 -0
- package/dist/generators/test-generator/patterns/index.js.map +1 -1
- package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
- package/dist/generators/test-generator/step-mapper.js +1 -0
- package/dist/generators/test-generator/step-mapper.js.map +1 -1
- package/dist/generators/test-generator/utils/data-resolver.d.ts +5 -0
- package/dist/generators/test-generator/utils/data-resolver.d.ts.map +1 -1
- package/dist/generators/test-generator/utils/data-resolver.js +17 -0
- package/dist/generators/test-generator/utils/data-resolver.js.map +1 -1
- package/dist/harness/audit.d.ts +24 -0
- package/dist/harness/audit.d.ts.map +1 -0
- package/dist/harness/audit.js +115 -0
- package/dist/harness/audit.js.map +1 -0
- package/dist/harness/blindspot.d.ts +15 -0
- package/dist/harness/blindspot.d.ts.map +1 -0
- package/dist/harness/blindspot.js +85 -0
- package/dist/harness/blindspot.js.map +1 -0
- package/dist/harness/catalog/universal-viewpoints.yaml +114 -0
- package/dist/harness/challenge.d.ts +21 -0
- package/dist/harness/challenge.d.ts.map +1 -0
- package/dist/harness/challenge.js +151 -0
- package/dist/harness/challenge.js.map +1 -0
- package/dist/harness/feedback.d.ts +29 -0
- package/dist/harness/feedback.d.ts.map +1 -0
- package/dist/harness/feedback.js +106 -0
- package/dist/harness/feedback.js.map +1 -0
- package/dist/harness/intent.d.ts +11 -0
- package/dist/harness/intent.d.ts.map +1 -0
- package/dist/harness/intent.js +86 -0
- package/dist/harness/intent.js.map +1 -0
- package/dist/harness/ledger.d.ts +42 -0
- package/dist/harness/ledger.d.ts.map +1 -0
- package/dist/harness/ledger.js +171 -0
- package/dist/harness/ledger.js.map +1 -0
- package/dist/harness/manifest.d.ts +42 -0
- package/dist/harness/manifest.d.ts.map +1 -0
- package/dist/harness/manifest.js +209 -0
- package/dist/harness/manifest.js.map +1 -0
- package/dist/harness/parse.d.ts +22 -0
- package/dist/harness/parse.d.ts.map +1 -0
- package/dist/harness/parse.js +163 -0
- package/dist/harness/parse.js.map +1 -0
- package/dist/harness/script-check.d.ts +16 -0
- package/dist/harness/script-check.d.ts.map +1 -0
- package/dist/harness/script-check.js +169 -0
- package/dist/harness/script-check.js.map +1 -0
- package/dist/harness/secret-scan.d.ts +8 -0
- package/dist/harness/secret-scan.d.ts.map +1 -0
- package/dist/harness/secret-scan.js +88 -0
- package/dist/harness/secret-scan.js.map +1 -0
- package/dist/harness/sensors.d.ts +88 -0
- package/dist/harness/sensors.d.ts.map +1 -0
- package/dist/harness/sensors.js +232 -0
- package/dist/harness/sensors.js.map +1 -0
- package/dist/harness/trace.d.ts +31 -0
- package/dist/harness/trace.d.ts.map +1 -0
- package/dist/harness/trace.js +173 -0
- package/dist/harness/trace.js.map +1 -0
- package/dist/orchestrator/ai-rules-updater.d.ts +1 -0
- package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
- package/dist/orchestrator/ai-rules-updater.js +55 -11
- package/dist/orchestrator/ai-rules-updater.js.map +1 -1
- package/dist/orchestrator/figma/spec-figma-renderer.d.ts +2 -2
- package/dist/orchestrator/figma/spec-figma-renderer.js +2 -2
- package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts +1 -1
- package/dist/orchestrator/figma/spec-figma-section-renderers.js +1 -1
- package/dist/orchestrator/project-initializer.d.ts.map +1 -1
- package/dist/orchestrator/project-initializer.js +10 -6
- package/dist/orchestrator/project-initializer.js.map +1 -1
- package/dist/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
- package/dist/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
- package/dist/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
- package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -4
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
- package/dist/orchestrator/templates/ai-instructions/{github-skill-sungen-figma-source.md → claude-skill-capture-mode-figma-pat.md} +14 -48
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
- package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
- 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
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
- package/dist/orchestrator/templates/specs-test-data.ts +9 -0
- package/dist/tools/figma/figma-auth.d.ts +5 -2
- package/dist/tools/figma/figma-auth.d.ts.map +1 -1
- package/dist/tools/figma/figma-auth.js +19 -9
- package/dist/tools/figma/figma-auth.js.map +1 -1
- package/docs/orchestration-spec.md +267 -0
- package/package.json +10 -6
- package/src/cli/commands/add.ts +3 -3
- package/src/cli/commands/audit.ts +92 -0
- package/src/cli/commands/blindspot.ts +48 -0
- package/src/cli/commands/challenge.ts +55 -0
- package/src/cli/commands/feedback.ts +65 -0
- package/src/cli/commands/generate.ts +19 -0
- package/src/cli/commands/ledger.ts +61 -0
- package/src/cli/commands/manifest.ts +55 -0
- package/src/cli/commands/script-check.ts +50 -0
- package/src/cli/commands/trace.ts +60 -0
- package/src/cli/commands/update.ts +30 -10
- package/src/cli/index.ts +16 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
- package/src/generators/test-generator/patterns/capture-patterns.ts +59 -0
- package/src/generators/test-generator/patterns/index.ts +2 -0
- package/src/generators/test-generator/step-mapper.ts +1 -0
- package/src/generators/test-generator/utils/data-resolver.ts +20 -0
- package/src/harness/audit.ts +112 -0
- package/src/harness/blindspot.ts +51 -0
- package/src/harness/catalog/universal-viewpoints.yaml +114 -0
- package/src/harness/challenge.ts +131 -0
- package/src/harness/feedback.ts +84 -0
- package/src/harness/intent.ts +58 -0
- package/src/harness/ledger.ts +155 -0
- package/src/harness/manifest.ts +173 -0
- package/src/harness/parse.ts +145 -0
- package/src/harness/script-check.ts +149 -0
- package/src/harness/secret-scan.ts +51 -0
- package/src/harness/sensors.ts +279 -0
- package/src/harness/trace.ts +138 -0
- package/src/orchestrator/ai-rules-updater.ts +57 -10
- package/src/orchestrator/figma/spec-figma-renderer.ts +2 -2
- package/src/orchestrator/figma/spec-figma-section-renderers.ts +1 -1
- package/src/orchestrator/project-initializer.ts +10 -7
- package/src/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
- package/src/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
- package/src/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
- package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
- package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
- package/src/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
- package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
- package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -4
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
- 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
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
- package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
- 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
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
- package/src/orchestrator/templates/specs-test-data.ts +9 -0
- package/src/tools/figma/figma-auth.ts +20 -9
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
- package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +0 -151
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
- 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,151 +0,0 @@
|
|
|
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`
|
|
@@ -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)
|