@tekyzinc/gsd-t 2.69.12 → 2.70.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to GSD-T are documented here. Updated with each release.
4
4
 
5
+ ## [2.70.10] - 2026-04-06
6
+
7
+ ### Added (design pipeline — 2 new capabilities)
8
+ - **Design System Detection** — all design pipeline commands now ask for a design system / component library URL upfront before extraction or implementation. If provided, the agent fetches the library docs, catalogs available components, and maps design elements to library primitives (use library components instead of building custom). Added to: `gsd-t-design-decompose` (Step 0.4), `gsd-t-design-audit` (Step 0), `design-to-code.md` (new Section 1 — all subsequent sections renumbered). Verification checklist updated with 2 new items.
9
+ - **SVG Structural Overlay Comparison** — new mandatory verification layer that exports the Figma frame as SVG, parses element positions/dimensions/colors from the SVG DOM, maps to built DOM bounding boxes, and compares geometry mechanically (≤2px = MATCH, 3-5px = REVIEW, >5px = DEVIATION). Catches aggregate spacing drift, alignment issues, and proportion errors that pass property-level checks but are visually wrong. Added to: `gsd-t-execute` (Step 5 inside Design Verification Agent), `gsd-t-quick` (step 7 inside Design Verification Agent), `gsd-t-design-audit` (Step 3.5), `design-to-code.md` (Target 3 + workflow step 7 + checklist item).
10
+
11
+ ### Why
12
+ - **Design system**: Building custom cards, tables, tabs, and buttons from scratch when a library like shadcn-vue already provides them wastes effort and produces inferior results (missing accessibility, focus states, interactive states). Asking upfront eliminates redundant work.
13
+ - **SVG overlay**: The property-level comparison table catches wrong values but misses aggregate visual drift — spacing rhythm, alignment, proportions that are individually correct but collectively off. SVG structural diff is mechanical and non-interpretive: geometry vs geometry, no agent reasoning required.
14
+
15
+ ## [2.69.13] - 2026-04-05
16
+
17
+ ### Fixed (design-to-code pipeline — extraction + verification)
18
+ - **Mandate `get_design_context` everywhere in the pipeline** — initial build (design-to-code.md sections 1-2), verification agent (gsd-t-execute.md Step 5.25), quick verification (gsd-t-quick.md Step 5.25), and Red Team design fidelity check all now explicitly require `get_design_context` per widget node for Figma data extraction. `get_screenshot` is prohibited for extraction and restricted to visual-only comparison of built output. This closes the gap where agents chose `get_screenshot` (pixels) over `get_design_context` (structured code/tokens) at every stage.
19
+
5
20
  ## [2.69.12] - 2026-04-05
6
21
 
7
22
  ### Fixed (gsd-t-design-audit, gsd-t-design-decompose)
@@ -17,6 +17,12 @@ Extract from `$ARGUMENTS`:
17
17
  If Figma source is missing → ask user: "Provide the Figma file key or URL"
18
18
  If built app target is missing → check if a dev server is running. If not → ask user: "Provide the route or URL of the built page to audit"
19
19
 
20
+ **Design system / component library?**
21
+ - Ask user: "Is a design system or component library being used (e.g., shadcn-vue, Vuetify, Radix, MUI)? If so, provide the URL."
22
+ - If yes → fetch the docs, note which components the library provides and their default styling (padding, radius, shadows, colors)
23
+ - Factor into Step 3 comparisons: deviations that match library defaults (not Figma) may indicate "used library default instead of design value" — flag as a distinct deviation category
24
+ - If no → proceed as normal
25
+
20
26
  ## Step 1: Map the Figma Design — Node-Level Decomposition
21
27
 
22
28
  ### 1a. Get the page tree
@@ -142,9 +148,58 @@ For each widget, produce a comparison table with **minimum 10 rows per widget**
142
148
  | **MEDIUM** | Wrong alignment, color, or order that looks incorrect but doesn't change meaning | Legend left instead of center; segment order reversed; wrong shade |
143
149
  | **LOW** | Minor sizing or spacing that's barely noticeable | 2px padding difference; slight font-size mismatch |
144
150
 
151
+ ## Step 3.5: SVG Structural Overlay Comparison (MANDATORY)
152
+
153
+ After the per-widget property comparison, run a mechanical SVG-based diff to catch aggregate visual drift that individual property checks miss.
154
+
155
+ 1. **Export the Figma frame as SVG**:
156
+ - Use the Figma REST API or MCP to export the page/frame as SVG
157
+ - If export is unavailable, ask the user to export and provide the SVG path
158
+ - Store the SVG at `.gsd-t/design-verify/{page-name}-figma.svg`
159
+
160
+ 2. **Parse the SVG DOM**: extract every `<rect>`, `<text>`, `<circle>`, `<path>`, `<g>` with their positions (x, y), dimensions (width, height), fills, strokes, and text content
161
+
162
+ 3. **Screenshot the built page** at the same viewport width via Playwright
163
+
164
+ 4. **Map SVG elements → built DOM elements** by:
165
+ - Text content matching (highest confidence)
166
+ - Position proximity (x,y within 10px tolerance)
167
+ - Dimensional similarity (width/height within 10% tolerance)
168
+
169
+ 5. **Compare each mapped pair**:
170
+
171
+ | Check | SVG Value | Built Value | Threshold |
172
+ |-------|-----------|-------------|-----------|
173
+ | Position (x,y) | SVG coordinates | DOM bounding box | ≤2px = MATCH, 3-5px = REVIEW, >5px = DEVIATION |
174
+ | Dimensions (w,h) | SVG width/height | DOM width/height | ≤2px = MATCH, 3-5px = REVIEW, >5px = DEVIATION |
175
+ | Colors | SVG fill/stroke hex | Computed CSS color | Exact hex = MATCH |
176
+ | Text content | SVG `<text>` | DOM textContent | Exact = MATCH |
177
+
178
+ 6. **Produce SVG structural diff table**:
179
+
180
+ ```markdown
181
+ ### SVG Structural Diff
182
+
183
+ | # | SVG Element | SVG Position | Built Position | Δ px | Verdict |
184
+ |---|-------------|-------------|----------------|------|---------|
185
+ | 1 | stat-card-1 rect | (24, 120) 320×200 | (24, 118) 320×204 | 2/4 | ⚠ REVIEW |
186
+ | 2 | chart-title text | (40, 140) | (40, 140) | 0 | ✅ MATCH |
187
+ ```
188
+
189
+ 7. **Unmapped elements**:
190
+ - SVG elements with no DOM match → flag as "MISSING IN BUILD"
191
+ - DOM elements with no SVG match → flag as "EXTRA — not in design"
192
+
193
+ 8. **Visual overlay** (optional but recommended):
194
+ - Render SVG in browser at target viewport size
195
+ - Overlay on built page screenshot with 50% opacity or difference blend mode
196
+ - Save to `.gsd-t/design-verify/{page-name}-overlay.png`
197
+
198
+ This step catches spacing rhythm, alignment drift, and proportion issues that pass the per-widget property check but are visually wrong in aggregate.
199
+
145
200
  ## Step 4: Summary Report
146
201
 
147
- After all widgets are audited, produce a summary:
202
+ After all widgets are audited (property tables + SVG structural diff), produce a summary:
148
203
 
149
204
  ```markdown
150
205
  ## Design Audit Summary
@@ -32,7 +32,14 @@ Run these checks, log results to user inline:
32
32
  3. **Design source provided?**
33
33
  - Required: Figma URL, image path, or prototype URL in `$ARGUMENTS`
34
34
  - If missing → ask user: "Provide the design source (Figma URL, image path, or prototype URL)"
35
- 4. **Load the chart taxonomy (MANDATORY)**
35
+ 4. **Design system / component library?**
36
+ - Ask user: "Is a design system or component library being used (e.g., shadcn-vue, Vuetify, Radix, MUI, Ant Design)? If so, provide the URL."
37
+ - If yes → fetch the docs landing page, catalog available components (cards, tables, tabs, charts, buttons, etc.)
38
+ - Record in working memory: which design elements can be mapped to library primitives vs. built custom
39
+ - Factor into Step 2 classification: if the library provides a component (e.g., `Card`, `Table`, `Tabs`), the element contract should reference it as the implementation target
40
+ - Factor into Step 3 widget composition: library layout primitives (e.g., `Grid`, `Flex`, `Sheet`) inform widget structure
41
+ - If no → proceed as normal (all components built custom)
42
+ 5. **Load the chart taxonomy (MANDATORY)**
36
43
  - READ `templates/design-chart-taxonomy.md` from the GSD-T package (or `~/.claude/` if installed)
37
44
  - This is the **CLOSED SET** of valid element names. You MUST pick from this list. Inventing new element names is FORBIDDEN without user approval to extend the taxonomy.
38
45
  - Keep the taxonomy in working memory while classifying — every element you identify MUST be matched against it
@@ -662,10 +662,16 @@ wrong.
662
662
  ## Step 1: Get the Design Reference
663
663
 
664
664
  Read .gsd-t/contracts/design-contract.md for the source reference.
665
- - If Figma MCP available → call get_screenshot with nodeId + fileKey from the contract
665
+ - If Figma MCP available → call `get_metadata` to enumerate widget/component nodes,
666
+ then call `get_design_context` per widget node to extract structured data
667
+ (code, component properties, design tokens, text content, layout values).
668
+ ⚠ Do NOT use `get_screenshot` for Figma data extraction — it returns pixels
669
+ you cannot extract exact values from. `get_design_context` returns structured
670
+ code and tokens. Use `get_design_context` for extraction, `get_screenshot`
671
+ ONLY if you need a visual reference image for side-by-side comparison.
666
672
  - If design image files → locate them from the contract's Source Reference field
667
673
  - If no MCP and no images → log CRITICAL blocker to .gsd-t/qa-issues.md and STOP
668
- You MUST have a reference image before proceeding.
674
+ You MUST have structured design data (or reference images) before proceeding.
669
675
 
670
676
  ## Step 2: Build the Element Inventory
671
677
 
@@ -697,22 +703,27 @@ VIEW 1 — BUILT FRONTEND:
697
703
  Navigate to the exact route/component being verified.
698
704
  You MUST see real rendered output — not just read the code.
699
705
 
700
- VIEW 2 — ORIGINAL DESIGN REFERENCE:
701
- If Figma URL available → open the Figma page in a browser tab/window.
702
- Use the Figma URL from the design contract Source Reference field.
703
- Navigate to the specific frame/component being compared.
706
+ VIEW 2 — ORIGINAL DESIGN REFERENCE (structured data, not just images):
707
+ If Figma MCP available → you already have `get_design_context` data from Step 1.
708
+ Use the STRUCTURED DATA (component properties, text content, layout values,
709
+ colors, spacing) as the authoritative design reference — not screenshots.
710
+ Optionally open the Figma URL in a browser for visual context, but extract
711
+ values from `get_design_context` responses, not from visual inspection.
704
712
  If design image file → open the image in a browser tab/window.
705
713
  Use: file://{absolute-path-to-image} or render in an HTML page.
706
- If Figma MCP screenshot was captured open that screenshot image.
714
+ If no Figma MCP use reference images from the design contract.
707
715
 
708
716
  COMPARISON APPROACH:
709
- With both views open, walk through each component/section:
710
- - Position views side-by-side (or switch between tabs)
711
- - Compare each element visually at the same zoom level
712
- - Screenshot BOTH views at matching viewport sizes
717
+ For each widget/component, compare the BUILT DOM/styles against the
718
+ STRUCTURED values from `get_design_context`:
719
+ - Chart type: does the built component match the Figma node's structure?
720
+ - Text content: do titles, labels, legends match `get_design_context` text?
721
+ - Layout: do spacing, alignment, sizing match the structured properties?
722
+ - Colors: do fills, strokes, text colors match the exact hex values?
713
723
  Capture implementation screenshots at each target breakpoint:
714
724
  Mobile (375px), Tablet (768px), Desktop (1280px) minimum.
715
- Each breakpoint is a separate screenshot pair (design + implementation).
725
+ Compare screenshots against Figma for overall visual impression,
726
+ but use `get_design_context` data for the authoritative value comparison.
716
727
 
717
728
  If Claude Preview, Chrome MCP, and Playwright are ALL unavailable:
718
729
  This is a CRITICAL blocker. Log to .gsd-t/qa-issues.md:
@@ -730,25 +741,64 @@ the inventory gets its own row. No summarizing, no grouping, no prose.
730
741
  | 2 | Summary | Chart colors | #4285F4, #34A853, #FBBC04 | #4285F4, #34A853, #FBBC04 | ✅ MATCH |
731
742
 
732
743
  Rules:
733
- - 'Design' column: SPECIFIC values (chart type name, hex color, px size, font weight)
734
- - 'Implementation' column: SPECIFIC observed values from the SCREENSHOT not code assumptions
744
+ - 'Design' column: SPECIFIC values from `get_design_context` structured data
745
+ (chart type name, hex color, px size, font weight, text content)
746
+ - 'Implementation' column: SPECIFIC observed values from the built page DOM/styles
735
747
  - Verdict: only ✅ MATCH or ❌ DEVIATION — never 'appears to match' or 'need to verify'
736
748
  - NEVER write 'Appears to match' or 'Looks correct' — measure and verify
737
749
  - If the table has fewer than 30 rows for a full-page comparison, you skipped elements
738
750
 
739
- ## Step 5: Report Deviations
751
+ ## Step 5: SVG Structural Overlay Comparison (MANDATORY)
752
+
753
+ After the property-level comparison, run a mechanical SVG-based diff to catch
754
+ aggregate visual drift that individual property checks miss.
755
+
756
+ 1. Export the Figma frame as SVG:
757
+ - Use the Figma REST API or MCP to export the page/frame as SVG
758
+ - If export is unavailable, ask the user to export and provide the SVG path
759
+ - Store the SVG at .gsd-t/design-verify/{page-name}-figma.svg
760
+ 2. Parse the SVG DOM: extract every <rect>, <text>, <circle>, <path>, <g>
761
+ with their positions (x, y), dimensions (width, height), fills, strokes,
762
+ and text content
763
+ 3. Screenshot the built page at the same viewport width via Playwright
764
+ 4. Inspect the built page DOM: extract element bounding boxes, computed
765
+ styles (colors, dimensions), and text content
766
+ 5. Map SVG elements → built DOM elements by:
767
+ - Text content matching (highest confidence)
768
+ - Position proximity (x,y within 10px tolerance)
769
+ - Dimensional similarity (width/height within 10% tolerance)
770
+ 6. For each mapped pair, compare:
771
+ - Position: SVG (x,y) vs DOM bounding box (x,y). Within 2px = MATCH
772
+ - Dimensions: SVG (w,h) vs DOM (w,h). Within 2px = MATCH
773
+ - Colors: SVG fill/stroke vs computed CSS color. Exact hex = MATCH
774
+ - Text: SVG <text> content vs DOM textContent. Exact = MATCH
775
+ 7. Produce an SVG structural diff table:
776
+ | # | SVG Element | SVG Position | Built Position | Δ px | Verdict |
777
+ Threshold: ≤2px = ✅ MATCH, 3-5px = ⚠ REVIEW, >5px = ❌ DEVIATION
778
+ 8. Unmapped SVG elements (no DOM match) → flag as MISSING IN BUILD
779
+ Unmapped DOM elements (no SVG match) → flag as EXTRA IN BUILD
780
+ 9. Generate a visual overlay image (optional but recommended):
781
+ - Render SVG in browser at target viewport size
782
+ - Overlay on built page screenshot with 50% opacity or difference blend
783
+ - Save to .gsd-t/design-verify/{page-name}-overlay.png
784
+
785
+ This step catches spacing rhythm, alignment drift, and proportion issues
786
+ that pass the property-level check but are visually wrong in aggregate.
787
+
788
+ ## Step 6: Report Deviations
740
789
 
741
790
  For each ❌ DEVIATION, write a specific finding:
742
791
  'Design: {exact value}. Implementation: {exact value}. File: {path}:{line}'
743
792
 
744
- Write the FULL comparison table to .gsd-t/contracts/design-contract.md
745
- under a '## Verification Status' section.
793
+ Write the FULL comparison table (property-level from Step 4 + SVG structural
794
+ from Step 5) to .gsd-t/contracts/design-contract.md under a
795
+ '## Verification Status' section.
746
796
 
747
797
  Any ❌ DEVIATION → also append to .gsd-t/qa-issues.md with severity HIGH
748
798
  and tag [VISUAL]:
749
799
  | {date} | gsd-t-execute | Step 5.25 | opus | {duration} | HIGH | [VISUAL] {description} |
750
800
 
751
- ## Step 6: Verdict
801
+ ## Step 7: Verdict
752
802
 
753
803
  Count results: '{MATCH_COUNT}/{TOTAL} elements match at {breakpoints} breakpoints'
754
804
 
@@ -837,7 +887,7 @@ Rules:
837
887
  FAIL-BY-DEFAULT: assume NOTHING matches. Prove each element individually.
838
888
  a. Open every implemented screen in a real browser. Screenshot at mobile
839
889
  (375px), tablet (768px), desktop (1280px). Get Figma reference via
840
- Figma MCP get_screenshot (or design contract images).
890
+ `get_design_context` per widget node (structured data NOT `get_screenshot`).
841
891
  b. Build an element inventory: enumerate every distinct visual element
842
892
  in the design top-to-bottom. Every chart, label, icon, heading, card,
843
893
  spacing boundary, and color. Data visualizations expand: chart type,
@@ -266,17 +266,32 @@ rendered UI. If any is missing → CRITICAL DEVIATION (wrong data). Wrong data
266
266
  cannot be redeemed by visual polish.
267
267
 
268
268
  1. Read .gsd-t/contracts/design-contract.md (flat) OR .gsd-t/contracts/design/ (hierarchical) for design source reference + Test Fixtures
269
- 2. Get design reference (Figma MCP screenshot, or design images from contract)
269
+ 2. Get Figma structured data via `get_metadata` (enumerate nodes) then `get_design_context`
270
+ per widget node. ⚠ Do NOT use `get_screenshot` for Figma extraction — it returns pixels,
271
+ not properties. `get_design_context` returns structured code and tokens.
272
+ If no Figma MCP → use design images from contract as fallback.
270
273
  3. Start dev server, open the built frontend in browser (Claude Preview/Chrome MCP/Playwright)
271
- 4. Open the original design reference in a second browser view
274
+ 4. Compare built page values against `get_design_context` structured data
272
275
  5. Build element inventory (30+ elements for a full page): every chart, label,
273
276
  icon, heading, card, button, spacing, color — each a separate row
274
277
  6. Produce structured comparison table:
275
278
  | # | Section | Element | Design (specific) | Implementation (specific) | Verdict |
276
279
  Only valid verdicts: ✅ MATCH or ❌ DEVIATION (never 'appears to match')
277
- 7. Write results to .gsd-t/contracts/design-contract.md under '## Verification Status'
278
- 8. Any append to .gsd-t/qa-issues.md with [VISUAL] tag
279
- 9. Report: DESIGN VERIFIED | DESIGN DEVIATIONS FOUND ({count})"
280
+ 7. SVG Structural Overlay Comparison:
281
+ a. Export Figma frame as SVG (or ask user for SVG path if export unavailable)
282
+ b. Parse SVG DOM: extract positions, dimensions, fills, text for every element
283
+ c. Screenshot built page at same viewport width via Playwright
284
+ d. Map SVG elements → built DOM elements by text content + position proximity
285
+ e. Compare: position (≤2px=MATCH, 3-5px=REVIEW, >5px=DEVIATION),
286
+ dimensions, colors (exact hex), text (exact match)
287
+ f. Produce SVG structural diff table:
288
+ | # | SVG Element | SVG Position | Built Position | Δ px | Verdict |
289
+ g. Flag unmapped SVG elements as MISSING, unmapped DOM elements as EXTRA
290
+ This catches aggregate visual drift that property-level checks miss.
291
+ 8. Write results (property table + SVG diff) to .gsd-t/contracts/design-contract.md
292
+ under '## Verification Status'
293
+ 9. Any ❌ → append to .gsd-t/qa-issues.md with [VISUAL] tag
294
+ 10. Report: DESIGN VERIFIED | DESIGN DEVIATIONS FOUND ({count})"
280
295
  ```
281
296
 
282
297
  After subagent returns — run observability Bash and append to token-log.md.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekyzinc/gsd-t",
3
- "version": "2.69.12",
3
+ "version": "2.70.10",
4
4
  "description": "GSD-T: Contract-Driven Development for Claude Code — 54 slash commands with headless CI/CD mode, graph-powered code analysis, real-time agent dashboard, execution intelligence, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
5
5
  "author": "Tekyz, Inc.",
6
6
  "license": "MIT",
@@ -35,14 +35,56 @@ A widget that uses `chart-donut` cannot change `chart-donut`'s bar-gap, colors,
35
35
 
36
36
  ---
37
37
 
38
- ## 1. Design Source Setup
38
+ ## 1. Design System Detection
39
+
40
+ ```
41
+ MANDATORY:
42
+ ├── BEFORE any extraction or implementation, check for a design system:
43
+ │ Ask user: "Is a design system or component library being used
44
+ │ (e.g., shadcn-vue, Vuetify, Radix, MUI, Ant Design, Chakra)?
45
+ │ If so, provide the URL."
46
+ ├── If YES:
47
+ │ Fetch the library's docs landing page
48
+ │ Catalog available components (cards, tables, tabs, charts, buttons,
49
+ │ inputs, dialogs, dropdowns, etc.)
50
+ │ Identify the theming system (CSS variables, Tailwind config, theme object)
51
+ │ Determine customization model:
52
+ │ Copy-paste (shadcn) → full control, edit component source directly
53
+ │ Config-based (MUI theme) → customize via theme overrides
54
+ │ Utility-first (Tailwind + headless) → style via utility classes
55
+ │ Map design elements to library primitives — use library components
56
+ │ instead of building custom whenever a match exists
57
+ │ Record in the design contract: library name, URL, version,
58
+ │ components used, theming approach
59
+ ├── If NO:
60
+ │ Proceed with fully custom implementation
61
+ │ Note in design contract: "No design system — all components custom"
62
+ └── WHY: Design system components provide battle-tested accessibility,
63
+ interactive states, and responsive behavior out of the box.
64
+ Building custom when a library component exists wastes effort
65
+ and produces inferior results (missing focus states, ARIA, etc.)
66
+ ```
67
+
68
+ **BAD** — Building a custom card component, dropdown, and table from scratch when shadcn-vue already provides them with full accessibility and Tailwind theming.
69
+
70
+ **GOOD** — Detecting shadcn-vue, mapping 60% of the design's UI elements to library components, customizing via Tailwind theme tokens, and only building custom for elements the library doesn't cover (specialized charts, domain-specific widgets).
71
+
72
+ ---
73
+
74
+ ## 2. Design Source Setup
39
75
 
40
76
  ```
41
77
  MANDATORY:
42
78
  ├── NEVER write CSS or layout code without a design reference
43
79
  ├── Identify the source type: Figma file, image, screenshot, prototype URL
44
80
  ├── If source is a Figma URL/file → check if Figma MCP is available
45
- │ YES → Use Figma MCP to extract component data, styles, and layout
81
+ │ YES → Use Figma MCP `get_design_context` per widget/component node
82
+ │ `get_design_context` returns structured code, component properties,
83
+ │ and design tokens — this is what you extract values from.
84
+ │ ⚠ NEVER use `get_screenshot` for extraction — it returns pixels,
85
+ │ not properties. You cannot reliably extract exact spacing, colors,
86
+ │ or text from an image. `get_screenshot` is only for verification
87
+ │ (comparing built output to design visually).
46
88
  │ NO → Inform user: "Figma MCP recommended for precise extraction"
47
89
  │ Fallback: use image analysis (Claude's multimodal vision)
48
90
  ├── If source is an image/screenshot → use visual analysis to extract values
@@ -56,17 +98,23 @@ MANDATORY:
56
98
 
57
99
  ---
58
100
 
59
- ## 2. MCP & Tool Detection
101
+ ## 3. MCP & Tool Detection
60
102
 
61
103
  ```
62
104
  MANDATORY:
63
105
  ├── Before extraction, detect available tools:
64
106
  │ Figma MCP → precise token extraction from Figma files
107
+ │ `get_design_context` → structured code + tokens (USE THIS for extraction)
108
+ │ `get_metadata` → node tree enumeration (USE THIS to find widget nodes)
109
+ │ `get_screenshot` → visual image only (NEVER use for extraction —
110
+ │ only for post-build verification comparisons)
65
111
  │ Claude Preview → render + screenshot for verification loop
66
112
  │ Chrome MCP → alternative render + screenshot for verification
67
113
  ├── If Figma MCP is available and source is Figma:
68
- Use MCP to get exact colors, spacing, typography, component structure
69
- MCP values are authoritative override visual estimates
114
+ Call `get_metadata` to enumerate the page's widget/component nodes
115
+ Call `get_design_context` per widget node to extract structured data
116
+ │ Extract exact colors, spacing, typography, component structure from the response
117
+ │ MCP `get_design_context` values are authoritative — override visual estimates
70
118
  ├── If no Figma MCP but source is Figma:
71
119
  │ Recommend setup: "For precise extraction, install the Figma MCP server.
72
120
  │ Remote (recommended): https://mcp.figma.com/mcp
@@ -83,7 +131,7 @@ MANDATORY:
83
131
 
84
132
  ---
85
133
 
86
- ## 3. Stack Capability Evaluation
134
+ ## 4. Stack Capability Evaluation
87
135
 
88
136
  ```
89
137
  MANDATORY:
@@ -135,7 +183,7 @@ MANDATORY:
135
183
 
136
184
  ---
137
185
 
138
- ## 4. Design Token Extraction Protocol
186
+ ## 5. Design Token Extraction Protocol
139
187
 
140
188
  ```
141
189
  MANDATORY:
@@ -160,7 +208,7 @@ MANDATORY:
160
208
 
161
209
  ---
162
210
 
163
- ## 5. Design Contract Generation
211
+ ## 6. Design Contract Generation
164
212
 
165
213
  ```
166
214
  MANDATORY:
@@ -176,7 +224,7 @@ The design contract serves the same purpose as API contracts in GSD-T: it define
176
224
 
177
225
  ---
178
226
 
179
- ## 6. Component Decomposition
227
+ ## 7. Component Decomposition
180
228
 
181
229
  ```
182
230
  MANDATORY:
@@ -214,7 +262,7 @@ Page
214
262
 
215
263
  ---
216
264
 
217
- ## 7. Layout Analysis
265
+ ## 8. Layout Analysis
218
266
 
219
267
  ```
220
268
  MANDATORY:
@@ -235,7 +283,7 @@ MANDATORY:
235
283
 
236
284
  ---
237
285
 
238
- ## 8. Responsive Breakpoint Strategy
286
+ ## 9. Responsive Breakpoint Strategy
239
287
 
240
288
  ```
241
289
  MANDATORY:
@@ -268,7 +316,7 @@ MANDATORY:
268
316
 
269
317
  ---
270
318
 
271
- ## 9. Semantic HTML Structure
319
+ ## 10. Semantic HTML Structure
272
320
 
273
321
  ```
274
322
  MANDATORY:
@@ -288,7 +336,7 @@ MANDATORY:
288
336
 
289
337
  ---
290
338
 
291
- ## 10. Naming Conventions (Classes, IDs, Data Attributes)
339
+ ## 11. Naming Conventions (Classes, IDs, Data Attributes)
292
340
 
293
341
  ```
294
342
  MANDATORY:
@@ -327,7 +375,7 @@ MANDATORY:
327
375
 
328
376
  ---
329
377
 
330
- ## 11. CSS Precision Rules
378
+ ## 12. CSS Precision Rules
331
379
 
332
380
  ```
333
381
  MANDATORY:
@@ -358,7 +406,7 @@ MANDATORY:
358
406
 
359
407
  ---
360
408
 
361
- ## 12. Typography Rendering
409
+ ## 13. Typography Rendering
362
410
 
363
411
  ```
364
412
  MANDATORY:
@@ -391,7 +439,7 @@ MANDATORY:
391
439
 
392
440
  ---
393
441
 
394
- ## 13. Color Accuracy
442
+ ## 14. Color Accuracy
395
443
 
396
444
  ```
397
445
  MANDATORY:
@@ -425,7 +473,7 @@ MANDATORY:
425
473
 
426
474
  ---
427
475
 
428
- ## 14. Interactive States
476
+ ## 15. Interactive States
429
477
 
430
478
  ```
431
479
  MANDATORY:
@@ -462,7 +510,7 @@ MANDATORY:
462
510
 
463
511
  ---
464
512
 
465
- ## 15. Visual Verification — Against FIGMA, Not Just Contracts
513
+ ## 16. Visual Verification — Against FIGMA, Not Just Contracts
466
514
 
467
515
  **Visual verification is handled by a dedicated Design Verification Agent**, spawned automatically by `gsd-t-execute` (Step 5.25) after all domain tasks complete.
468
516
 
@@ -476,36 +524,58 @@ VERIFICATION TARGETS:
476
524
  │ Does the code match the contract's claimed values?
477
525
  │ (This is what the 13-task validation proved works — airtight.)
478
526
 
479
- └── TARGET 2: Built screen vs FIGMA DESIGN (MANDATORY — this is new)
480
- Does the BUILT SCREEN match the ORIGINAL FIGMA SCREENSHOT?
481
- This catches: contracts that were wrong to begin with,
482
- chart type misclassification, hallucinated data, missing elements.
483
- (This is what was missing — and what caused the BDS failures.)
527
+ ├── TARGET 2: Built screen vs FIGMA DESIGN (MANDATORY)
528
+ Does the BUILT SCREEN match the ORIGINAL FIGMA STRUCTURED DATA?
529
+ This catches: contracts that were wrong to begin with,
530
+ chart type misclassification, hallucinated data, missing elements.
531
+
532
+ └── TARGET 3: SVG STRUCTURAL OVERLAY (MANDATORY)
533
+ Export Figma frame as SVG → parse element positions/dimensions/colors
534
+ → compare geometrically against built DOM bounding boxes.
535
+ This catches: aggregate spacing drift, alignment issues, proportion
536
+ errors that pass property-level checks but look wrong visually.
537
+ Mechanical, non-interpretive — no agent reasoning, just geometry.
484
538
  ```
485
539
 
486
- **Target 2 is the critical addition.** Verifying code-vs-contract is necessary but not sufficient. If the contract said "donut" when Figma showed a stacked bar, the code will faithfully build a donut, the contract verification will say MATCH, and the screen will be WRONG.
540
+ **Targets 2 and 3 are complementary.** Target 2 catches wrong values (property-level). Target 3 catches wrong placement (geometry-level). Together they cover both "is each value correct?" and "does the whole page look right?"
487
541
 
488
542
  ### Verification agent workflow
489
543
 
490
544
  ```
491
545
  SEPARATION OF CONCERNS:
492
- ├── CODING AGENT (you — Sections 1-14 above):
546
+ ├── CODING AGENT (you — Sections 1-15 above):
493
547
  │ Extract tokens → write precise CSS → trace every value to design contract
494
548
  │ Do NOT open a browser or attempt visual comparison yourself
495
549
 
496
550
  └── DESIGN VERIFICATION AGENT (Step 5.25 of gsd-t-execute):
497
551
  1. Open browser → screenshot built page at each breakpoint
498
- 2. Get Figma screenshot (via MCP get_screenshot or saved reference image)
499
- 3. SIDE-BY-SIDE comparison: built screenshot vs Figma screenshot
552
+ 2. Get Figma STRUCTURED DATA via `get_design_context` per widget node
553
+ Do NOT use `get_screenshot` for Figma data — it returns pixels
554
+ you can't extract exact values from. `get_design_context` returns
555
+ structured code, component properties, and design tokens.
556
+ Use `get_metadata` first to enumerate widget nodes, then
557
+ `get_design_context` on each widget node individually.
558
+ 3. STRUCTURED comparison: built page values vs Figma `get_design_context` values
500
559
  4. For EACH widget/section on the page:
501
- a. What chart type does the FIGMA show? (look at the Figma screenshot)
502
- b. What chart type did the CODE build? (look at the built screenshot)
560
+ a. What does `get_design_context` say this Figma node contains?
561
+ (chart type, text content, layout properties, colors)
562
+ b. What did the CODE actually build? (inspect built page DOM/styles)
503
563
  c. Do they match? Not "does code match contract" — does CODE match FIGMA?
504
564
  5. Check every text label: does the built screen show the same titles,
505
- subtitles, column headers, legend items, KPI values as the Figma?
565
+ subtitles, column headers, legend items, KPI values as the Figma
566
+ `get_design_context` response?
506
567
  6. Produce structured comparison table (30+ rows):
507
- | Element | Figma Shows | Built Shows | MATCH/DEVIATION |
508
- 7. Fix deviations re-verify artifact gate enforces completion
568
+ | Element | Figma (get_design_context) | Built | MATCH/DEVIATION |
569
+ 7. SVG STRUCTURAL OVERLAY mechanical geometry comparison:
570
+ a. Export Figma frame as SVG (API/MCP or user-provided)
571
+ b. Parse SVG DOM: positions, dimensions, fills, text per element
572
+ c. Map SVG elements → built DOM elements by text + position proximity
573
+ d. Compare geometry: position (≤2px=MATCH), dimensions, colors, text
574
+ e. Produce SVG diff table:
575
+ | SVG Element | SVG Position | Built Position | Δ px | Verdict |
576
+ f. Flag unmapped elements (MISSING IN BUILD / EXTRA IN BUILD)
577
+ This catches aggregate spacing/alignment drift the property table misses.
578
+ 8. Fix deviations → re-verify → artifact gate enforces completion
509
579
  ```
510
580
 
511
581
  The verification agent enforces the **FAIL-BY-DEFAULT** rule: every visual element starts as UNVERIFIED. The only valid verdicts are MATCH (with proof) or DEVIATION (with specifics). "Looks close" and "appears to match" are not verdicts. An artifact gate in the orchestrator blocks completion if the comparison table is missing or empty.
@@ -514,7 +584,7 @@ The verification agent enforces the **FAIL-BY-DEFAULT** rule: every visual eleme
514
584
 
515
585
  ---
516
586
 
517
- ## 16. Anti-Patterns
587
+ ## 17. Anti-Patterns
518
588
 
519
589
  ```
520
590
  NEVER DO THESE:
@@ -534,10 +604,12 @@ NEVER DO THESE:
534
604
 
535
605
  ---
536
606
 
537
- ## 17. Design-to-Code Verification Checklist
607
+ ## 18. Design-to-Code Verification Checklist
538
608
 
539
609
  Before marking any design implementation task as complete:
540
610
 
611
+ - [ ] Design system / component library identified (or confirmed none) and documented in design contract
612
+ - [ ] Library components mapped to design elements — custom build only where no library match exists
541
613
  - [ ] Design source identified and documented in design contract
542
614
  - [ ] Stack capability evaluated — all design requirements achievable (or alternatives approved)
543
615
  - [ ] All design tokens extracted (colors, typography, spacing, borders, shadows)
@@ -555,4 +627,5 @@ Before marking any design implementation task as complete:
555
627
  - [ ] Spacing exact: every padding, margin, gap matches design values
556
628
  - [ ] Accessibility: focus indicators, alt text, ARIA where needed, 44px touch targets
557
629
  - [ ] No magic numbers — every value is documented or uses a design token
630
+ - [ ] SVG structural overlay comparison completed — geometry diff ≤2px per element
558
631
  - [ ] Verification results logged in design contract Verification Status table