@tekyzinc/gsd-t 3.29.11 → 4.0.14
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 +171 -0
- package/bin/gsd-t-parallel.cjs +64 -13
- package/bin/gsd-t.js +48 -376
- package/bin/journey-coverage.cjs +6 -3
- package/bin/parallel-cli.cjs +13 -1
- package/commands/gsd-t-complete-milestone.md +6 -12
- package/commands/gsd-t-debug.md +47 -533
- package/commands/gsd-t-design-decompose.md +24 -497
- package/commands/gsd-t-doc-ripple.md +23 -139
- package/commands/gsd-t-execute.md +41 -958
- package/commands/gsd-t-feature.md +2 -6
- package/commands/gsd-t-gap-analysis.md +3 -6
- package/commands/gsd-t-help.md +2 -4
- package/commands/gsd-t-impact.md +26 -295
- package/commands/gsd-t-init-scan-setup.md +7 -7
- package/commands/gsd-t-integrate.md +44 -369
- package/commands/gsd-t-milestone.md +25 -124
- package/commands/gsd-t-partition.md +28 -539
- package/commands/gsd-t-plan.md +26 -472
- package/commands/gsd-t-prd.md +25 -311
- package/commands/gsd-t-quick.md +1 -1
- package/commands/gsd-t-resume.md +0 -33
- package/commands/gsd-t-scan.md +45 -652
- package/commands/gsd-t-verify.md +52 -569
- package/commands/gsd-t-wave.md +41 -430
- package/package.json +1 -1
- package/scripts/gsd-t-calibration-hook.js +3 -1
- package/scripts/hooks/pre-commit-journey-coverage +0 -2
- package/scripts/hooks/pre-commit-playwright-gate +0 -2
- package/templates/CLAUDE-global.md +44 -173
- package/templates/CLAUDE-project.md +118 -104
- package/templates/prompts/design-verify-subagent.md +3 -0
- package/templates/prompts/qa-subagent.md +3 -0
- package/templates/prompts/red-team-subagent.md +5 -2
- package/templates/workflows/_lib.js +176 -0
- package/templates/workflows/gsd-t-debug.workflow.js +86 -0
- package/templates/workflows/gsd-t-execute.workflow.js +206 -0
- package/templates/workflows/gsd-t-integrate.workflow.js +71 -0
- package/templates/workflows/gsd-t-phase.workflow.js +94 -0
- package/templates/workflows/gsd-t-quick.workflow.js +72 -0
- package/templates/workflows/gsd-t-scan.workflow.js +711 -0
- package/templates/workflows/gsd-t-verify.workflow.js +348 -0
- package/templates/workflows/gsd-t-wave.workflow.js +43 -0
- package/bin/check-headless-sessions.js +0 -140
- package/bin/context-budget-audit.cjs +0 -447
- package/bin/context-meter-config.cjs +0 -101
- package/bin/context-meter-config.test.cjs +0 -101
- package/bin/event-stream.cjs +0 -205
- package/bin/gsd-t-benchmark-orchestrator.js +0 -437
- package/bin/gsd-t-capture-lint.cjs +0 -440
- package/bin/gsd-t-economics.cjs +0 -315
- package/bin/gsd-t-in-session-usage.cjs +0 -213
- package/bin/gsd-t-orchestrator-config.cjs +0 -161
- package/bin/gsd-t-orchestrator-queue.cjs +0 -180
- package/bin/gsd-t-orchestrator-recover.cjs +0 -231
- package/bin/gsd-t-orchestrator-worker.cjs +0 -219
- package/bin/gsd-t-orchestrator.js +0 -535
- package/bin/gsd-t-parallel-probe.cjs +0 -132
- package/bin/gsd-t-ratelimit-probe-worker.cjs +0 -237
- package/bin/gsd-t-ratelimit-probe.cjs +0 -648
- package/bin/gsd-t-report-tokens.cjs +0 -549
- package/bin/gsd-t-stream-feed-client.cjs +0 -151
- package/bin/gsd-t-token-backfill.cjs +0 -366
- package/bin/gsd-t-token-capture.cjs +0 -321
- package/bin/gsd-t-token-dashboard.cjs +0 -353
- package/bin/gsd-t-token-regenerate-log.cjs +0 -129
- package/bin/gsd-t-tool-attribution.cjs +0 -377
- package/bin/gsd-t-tool-cost.cjs +0 -195
- package/bin/gsd-t-transcript-tee.cjs +0 -246
- package/bin/gsd-t-unattended-heartbeat.cjs +0 -188
- package/bin/gsd-t-unattended-platform.cjs +0 -551
- package/bin/gsd-t-unattended-platform.js +0 -381
- package/bin/gsd-t-unattended-safety.cjs +0 -773
- package/bin/gsd-t-unattended-safety.js +0 -788
- package/bin/gsd-t-unattended.cjs +0 -2109
- package/bin/gsd-t-unattended.js +0 -1367
- package/bin/gsd-t-worker-dispatch.cjs +0 -211
- package/bin/handoff-lock.cjs +0 -249
- package/bin/handoff-lock.js +0 -249
- package/bin/headless-auto-spawn.cjs +0 -711
- package/bin/headless-auto-spawn.js +0 -373
- package/bin/headless-exit-codes.cjs +0 -67
- package/bin/live-activity-report.cjs +0 -615
- package/bin/log-tail.cjs +0 -81
- package/bin/m44-proof-measure.cjs +0 -285
- package/bin/m46-iter-proof.cjs +0 -149
- package/bin/m46-worker-proof.cjs +0 -201
- package/bin/m55-substrate-proof.cjs +0 -134
- package/bin/metrics-rollup.js +0 -200
- package/bin/model-windows.cjs +0 -99
- package/bin/model-windows.test.cjs +0 -75
- package/bin/parallelism-report.cjs +0 -535
- package/bin/runway-estimator.cjs +0 -242
- package/bin/spawn-plan-derive.cjs +0 -163
- package/bin/spawn-plan-status-updater.cjs +0 -292
- package/bin/spawn-plan-writer.cjs +0 -204
- package/bin/supervisor-pid-fingerprint.cjs +0 -126
- package/bin/token-budget.cjs +0 -265
- package/bin/unattended-watch-format.cjs +0 -178
- package/bin/watch-progress.js +0 -155
- package/commands/gsd-t-unattended-stop.md +0 -85
- package/commands/gsd-t-unattended-watch.md +0 -465
- package/commands/gsd-t-unattended.md +0 -476
- package/commands/gsd-t-visualize.md +0 -116
- package/scripts/gsd-t-context-meter.e2e.test.js +0 -364
- package/scripts/gsd-t-context-meter.js +0 -341
- package/scripts/gsd-t-context-meter.test.js +0 -471
- package/scripts/gsd-t-dashboard-server.js +0 -1203
- package/scripts/gsd-t-post-commit-spawn-plan.sh +0 -86
- package/scripts/gsd-t-transcript.html +0 -1821
- package/scripts/hooks/gsd-t-conversation-capture.js +0 -439
- package/scripts/hooks/gsd-t-in-session-usage-hook.js +0 -84
- package/scripts/spawn-plan-fmt-tokens.cjs +0 -80
- package/templates/hooks/post-commit-spawn-plan.sh +0 -85
|
@@ -1,517 +1,44 @@
|
|
|
1
1
|
# GSD-T: Design Decompose — Hierarchical Contract Extraction
|
|
2
2
|
|
|
3
|
-
You are the lead agent
|
|
3
|
+
You are the lead agent. Decompose a design (Figma file, image, screenshot, or prototype URL) into a hierarchy of element / widget / page contracts by invoking the generic upper-stage Workflow at `templates/workflows/gsd-t-phase.workflow.js` with `phase: "design-decompose"`.
|
|
4
4
|
|
|
5
|
-
**Output**: A tree of contracts — elements at the bottom (atomic, reusable, variant-per-contract), widgets in the middle (element composition + data binding), pages at the top (widget assembly + layout + routing).
|
|
5
|
+
**Output**: A tree of contracts under `.gsd-t/contracts/design/` — elements at the bottom (atomic, reusable, variant-per-contract), widgets in the middle (element composition + data binding), pages at the top (widget assembly + layout + routing). Widgets are component *types*, not instances; sections live in the page layout, not separate contracts.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**When to use this command:**
|
|
10
|
-
- Starting a design-to-code project with multiple pages sharing components
|
|
11
|
-
- Retrofitting an existing flat `design-contract.md` into reusable parts
|
|
12
|
-
- Adding a new page that reuses existing elements/widgets
|
|
13
|
-
|
|
14
|
-
If the project is small (single page, ≤10 elements, nothing reusable), use the flat `design-contract.md` template instead and skip this command.
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Step 0: Detect Inputs + Load Taxonomy
|
|
19
|
-
|
|
20
|
-
Run these checks, log results to user inline:
|
|
21
|
-
|
|
22
|
-
1. **Figma MCP available?**
|
|
23
|
-
- If yes → log "Figma MCP detected — will extract exact tokens per element"
|
|
24
|
-
- If no → log "Figma MCP unavailable — using visual analysis (reduced precision)"
|
|
25
|
-
2. **Existing flat contract? — MANDATORY INGESTION if present**
|
|
26
|
-
- If `.gsd-t/contracts/design-contract.md` exists:
|
|
27
|
-
- **READ IT COMPLETELY** — it is the authoritative ground truth for data labels, values, and verification assertions from prior runs
|
|
28
|
-
- Extract: exact category labels, exact data values, exact center values, exact percentages
|
|
29
|
-
- Use these as **Test Fixture** data in every element contract you write (not placeholder data)
|
|
30
|
-
- If the flat contract has a `## Verification Status` section with 30+ rows, that is the GROUND TRUTH for what each element must match — port every row into the relevant element contract's Verification Checklist
|
|
31
|
-
- If not → fresh decomposition from the design source directly
|
|
32
|
-
3. **Design source provided?**
|
|
33
|
-
- Required: Figma URL, image path, or prototype URL in `$ARGUMENTS`
|
|
34
|
-
- If missing → ask user: "Provide the design source (Figma URL, image path, or prototype URL)"
|
|
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)**
|
|
43
|
-
- READ `templates/design-chart-taxonomy.md` from the GSD-T package (or `~/.claude/` if installed)
|
|
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.
|
|
45
|
-
- Keep the taxonomy in working memory while classifying — every element you identify MUST be matched against it
|
|
46
|
-
- **Filename rule**: the element contract filename MUST match the taxonomy name exactly (`chart-bar-vertical-single.contract.md`, not `bar-vertical-single.contract.md`). Shortened aliases are FORBIDDEN — they create taxonomy drift and make link-integrity checks fail. If an existing legacy contract uses a shortened name, prefer renaming it to the taxonomy name over creating a parallel file.
|
|
47
|
-
|
|
48
|
-
## Step 1: Survey the Design — Node-Level Figma Decomposition (MANDATORY)
|
|
49
|
-
|
|
50
|
-
> **⚠ This is the highest-leverage step in the entire workflow.** Most design-to-code errors originate here — the agent glances at a page screenshot, guesses chart types, and writes contracts from wrong assumptions. The fix is STRUCTURED NODE-LEVEL EXTRACTION, not "look harder."
|
|
51
|
-
|
|
52
|
-
### 1a. Map the page tree
|
|
53
|
-
|
|
54
|
-
Call `get_metadata` on the page/frame to get the full node tree. This returns the Figma component hierarchy — every group, frame, and component instance as named nodes with IDs.
|
|
55
|
-
|
|
56
|
-
### 1b. Identify widget-level nodes
|
|
57
|
-
|
|
58
|
-
From the metadata tree, identify every distinct visual group (card, widget, section). These are typically direct children of a page frame or section frame. List them:
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
Node tree for page "Analytics":
|
|
62
|
-
├── stat-card-campaign (id: 123:456)
|
|
63
|
-
├── stat-card-visitors (id: 123:457)
|
|
64
|
-
├── most-popular-tools-card (id: 123:458)
|
|
65
|
-
├── number-of-tools-card (id: 123:459)
|
|
66
|
-
├── ...
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### 1c. Call `get_design_context` on EACH widget node individually (MANDATORY)
|
|
70
|
-
|
|
71
|
-
**Do NOT skip this.** Do NOT classify from the page screenshot alone. For each widget node identified in 1b:
|
|
72
|
-
|
|
73
|
-
1. Call `get_design_context` with the specific node ID
|
|
74
|
-
2. Record the returned: component type, code hints, text content, layout properties
|
|
75
|
-
3. Extract EVERY text string visible in the node (titles, subtitles, labels, column headers, legend items, axis labels, KPI values)
|
|
76
|
-
|
|
77
|
-
> **⚠ Figma MCP size guard**: `get_design_context` on a full-page frame (e.g., a 390×3372px mobile screen) can return 250KB+ and be auto-saved to a tool-results file. **Never call it on the full page.** Call it on each leaf card/component node individually (typically < 100KB each). If you must inspect a large frame, use `excludeScreenshot: true` to halve the payload.
|
|
78
|
-
|
|
79
|
-
**Anti-pattern**: Looking at a page screenshot and writing "I see a donut chart" without calling `get_design_context` on that specific node. The MCP returns structured data about the component — use it.
|
|
80
|
-
|
|
81
|
-
> **⚠ Tool guard**: NEVER use `get_screenshot` for Figma design extraction. `get_screenshot` returns pixels — you cannot extract exact property values, spacing, colors, or text from an image with confidence. `get_design_context` returns structured code, component properties, and design tokens. Always use `get_design_context` per widget node.
|
|
82
|
-
|
|
83
|
-
### 1d. Produce the flat inventory table WITH data inventory
|
|
84
|
-
|
|
85
|
-
| # | Element on Design | Figma Node ID | Appears On Pages | Text Content Extracted | Visual Variant |
|
|
86
|
-
|---|-------------------|---------------|------------------|----------------------|----------------|
|
|
87
|
-
| 1 | Donut chart with center label | 123:458 | Overview, Analytics | Title: "Most Popular Tools", Subtitle: "Which tools members interact with most", Center: "485", Center sub: "Total Interactions", Legend: ["Steps to Stay Covered 30%", "Broker Contact 21%", ...] | chart-donut |
|
|
88
|
-
| 2 | Stacked bar with KPI header | 123:459 | Analytics | Title: "Number of Tools", Subtitle: "How many tools members interact with", KPI: "2.4", KPI sub: "Avg tools per member", Legend: ["1 Tool", "2 Tools", "3 Tools", "4+ Tools"], Labels: ["{num}%", ...] | chart-bar-stacked-horizontal-percentage |
|
|
89
|
-
| ... | | | | | |
|
|
90
|
-
|
|
91
|
-
**Rules**:
|
|
92
|
-
- Distinct visual variants = distinct rows. A horizontal stacked bar and a vertical stacked bar are TWO rows.
|
|
93
|
-
- The "Text Content Extracted" column is MANDATORY. Every text string visible in the Figma node MUST be listed. This kills hallucinated column headers and invented data models.
|
|
94
|
-
- If `get_design_context` is unavailable (no Figma MCP), extract text from the screenshot with maximum care and flag "⚠ extracted from screenshot, not MCP — verify manually".
|
|
95
|
-
|
|
96
|
-
## Step 2: Classify Each Element — Show Your Reasoning (MANDATORY)
|
|
97
|
-
|
|
98
|
-
For each row in the inventory, assign:
|
|
99
|
-
|
|
100
|
-
- **Category** — chart / legend / axis / card / table / list / control / atom / typography / layout
|
|
101
|
-
- **Element name** — **MUST come from `templates/design-chart-taxonomy.md`** (closed set). If no match found, STOP and ask user to extend the taxonomy with rationale.
|
|
102
|
-
- **Reuse count** — how many times does it appear across the entire design?
|
|
103
|
-
- **Owner layer** — element / widget-internal / page-internal
|
|
104
|
-
|
|
105
|
-
### Classification reasoning (MANDATORY — show your work)
|
|
106
|
-
|
|
107
|
-
For EACH chart/visualization element, you MUST walk the taxonomy decision tree and document your reasoning. This is not optional — skipping this step is how donut charts get classified as stacked bars and vice versa.
|
|
108
|
-
|
|
109
|
-
**Required format for each element:**
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
Element #2: node 123:459 "Number of Tools"
|
|
113
|
-
I SEE: A horizontal bar that fills full width, divided into 4 colored segments
|
|
114
|
-
with percentage labels above each segment. Legend below: "1 Tool", "2 Tools",
|
|
115
|
-
"3 Tools", "4+ Tools". Single bar, not multiple bars per category.
|
|
116
|
-
DECISION TREE:
|
|
117
|
-
- Is it a bar chart? YES — has rectangular segments
|
|
118
|
-
- Stacked or grouped? STACKED — segments touch, share one bar
|
|
119
|
-
- Horizontal or vertical? HORIZONTAL — bar extends left to right
|
|
120
|
-
- Percentage or absolute? PERCENTAGE — single bar, segments sum to 100%,
|
|
121
|
-
labels show {num}%
|
|
122
|
-
CLASSIFICATION: chart-bar-stacked-horizontal-percentage
|
|
123
|
-
CONFIDENCE: HIGH — matches taxonomy distinguisher exactly
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**If confidence is LOW or MEDIUM**, flag it for human review in Step 5.
|
|
127
|
-
|
|
128
|
-
### Visual distinguisher decision rules (consult taxonomy)
|
|
129
|
-
|
|
130
|
-
Before naming an element, apply the visual distinguisher rules from the taxonomy:
|
|
131
|
-
|
|
132
|
-
- **Bar chart?** → is it stacked/grouped, horizontal/vertical, percentage/absolute? These are ALL distinct element contracts.
|
|
133
|
-
- **Circular?** → pie vs donut (hole in center?) vs gauge (partial arc?)
|
|
134
|
-
- **Line?** → single vs multi, stepped vs smooth, with area or without
|
|
135
|
-
- **Table vs list?** → columns aligned across rows with header = table; self-contained rows = list
|
|
136
|
-
|
|
137
|
-
**Anti-pattern to avoid**: "it has bars so it's a bar chart" → WRONG. The failure mode is picking `chart-bar-grouped-vertical` when the design is `chart-bar-stacked-horizontal-percentage`. These render completely differently with completely different data bindings.
|
|
138
|
-
|
|
139
|
-
**Anti-pattern to avoid**: "it has circles so it's a donut" → WRONG. A pair of stacked vertical bar charts side-by-side is NOT two donut charts, even if the bars have rounded segments. LOOK AT THE ACTUAL SHAPE.
|
|
140
|
-
|
|
141
|
-
**Promotion rule**: an item becomes an **element contract** if:
|
|
142
|
-
- It appears ≥2 times across the design, OR
|
|
143
|
-
- It has non-trivial visual spec (≥5 distinct spec properties), OR
|
|
144
|
-
- It has states or interactions beyond "static display"
|
|
145
|
-
|
|
146
|
-
Otherwise, it stays internal to its widget or page (no contract needed).
|
|
147
|
-
|
|
148
|
-
### Atoms are NOT optional
|
|
149
|
-
|
|
150
|
-
Icons, badges, chips, dividers, avatars, status dots, spinners — every small artifact that appears in the design gets an element contract if it meets the promotion rule. These are the #1 most-missed tier and produce the "feels off" verification result.
|
|
151
|
-
|
|
152
|
-
## Step 3: Identify Widgets
|
|
153
|
-
|
|
154
|
-
A **widget** is a self-contained card with ONE headline job: one title, one body, optional header controls, optional footer/legend. Examples: "Revenue Breakdown" (donut + legend + title + filter), "Device Type" (donut + legend), "Number of Tools" (KPI + bar + legend).
|
|
155
|
-
|
|
156
|
-
A **section** is a visual grouping of MULTIPLE widgets that share a common heading or layout container. Sections live in the page contract's layout — they are NOT widgets.
|
|
157
|
-
|
|
158
|
-
### The Sub-Card Rule (MANDATORY)
|
|
159
|
-
|
|
160
|
-
**If a visual grouping contains multiple titled sub-cards (each with its own h3/header and its own body), each sub-card is its own widget. The grouping is a section handled in the page layout phase.**
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
WRONG — one widget conflating three cards:
|
|
164
|
-
device-browser-widget
|
|
165
|
-
├── sub-card "Device Type" (donut)
|
|
166
|
-
├── sub-card "Operating System" (bar)
|
|
167
|
-
└── sub-card "Browser" (bar)
|
|
168
|
-
|
|
169
|
-
RIGHT — three widgets + a page-level section:
|
|
170
|
-
device-type-widget ← widget
|
|
171
|
-
operating-system-widget ← widget
|
|
172
|
-
browser-widget ← widget
|
|
173
|
-
device-browser-section ← page-layout section grouping the 3 widgets
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Test**: Count the number of distinct titled headers (h3 / card title) inside the visual group. If > 1, it is a section, not a widget. Split it.
|
|
177
|
-
|
|
178
|
-
### Widget vs. Page-Internal Composition
|
|
179
|
-
|
|
180
|
-
For each candidate widget, determine:
|
|
181
|
-
- Does it appear on ≥2 pages, OR is it clearly a reusable unit conceptually?
|
|
182
|
-
- Yes → widget contract
|
|
183
|
-
- No → page-internal composition (no widget contract needed)
|
|
184
|
-
|
|
185
|
-
Produce a widget inventory:
|
|
186
|
-
|
|
187
|
-
| # | Widget Name | Appears On Pages | Elements Used |
|
|
188
|
-
|---|---------------------------|------------------------|-------------------------------------------------|
|
|
189
|
-
| 1 | revenue-breakdown-widget | Overview, Analytics | chart-donut, legend-vertical-right, heading-h3, select-dropdown |
|
|
190
|
-
| 2 | stat-strip-widget | Overview | stat-card-with-delta (×4) |
|
|
191
|
-
| ...
|
|
192
|
-
|
|
193
|
-
## Step 4: Identify Pages
|
|
194
|
-
|
|
195
|
-
Each page/screen in the design becomes a page contract. Document:
|
|
196
|
-
- Widgets used and grid position
|
|
197
|
-
- Global layout (header, sidebar, main)
|
|
198
|
-
- Route + auth guards
|
|
199
|
-
|
|
200
|
-
## Step 5: Confirm Decomposition With User — Contract Review Checkpoint
|
|
201
|
-
|
|
202
|
-
Present the full hierarchy summary WITH classification reasoning:
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
DECOMPOSITION SUMMARY
|
|
206
|
-
─────────────────────
|
|
207
|
-
Elements: 14 contracts
|
|
208
|
-
Charts: 4 (chart-donut, chart-bar-stacked-horizontal-percentage, chart-line-single, chart-sparkline-line)
|
|
209
|
-
Legends: 2 (legend-vertical-right, legend-horizontal-bottom)
|
|
210
|
-
Cards: 2 (stat-card, stat-card-with-delta)
|
|
211
|
-
Tables: 1 (table-dense)
|
|
212
|
-
Controls: 5 (button-primary, select-dropdown, input-search, tabs-underline, toggle)
|
|
213
|
-
|
|
214
|
-
Widgets: 6 contracts
|
|
215
|
-
stat-strip-widget, revenue-breakdown-widget, user-growth-widget,
|
|
216
|
-
recent-activity-table-widget, page-header-widget, nav-sidebar-widget
|
|
217
|
-
|
|
218
|
-
Pages: 3 contracts
|
|
219
|
-
dashboard-overview, analytics-detail, settings
|
|
220
|
-
|
|
221
|
-
Total: 23 contracts (vs. flat: ~57 elements in single file)
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
**Then present the classification reasoning table** (from Step 2) as a condensed review:
|
|
225
|
-
|
|
226
|
-
| # | Widget/Element | Classified As | Key Reasoning | Confidence |
|
|
227
|
-
|---|----------------|---------------|---------------|------------|
|
|
228
|
-
| 1 | Most Popular Tools body | chart-donut | Circle with center hole + center label "485" + 5 colored segments | HIGH |
|
|
229
|
-
| 2 | Number of Tools body | chart-bar-stacked-horizontal-percentage | Single horizontal bar, 4 segments summing to 100%, {num}% labels | HIGH |
|
|
230
|
-
| 3 | Member State chart | chart-bar-stacked-vertical | Multiple stacked vertical bars, 2 groups side-by-side, percentage labels | MEDIUM — verify |
|
|
231
|
-
| ... | | | | |
|
|
232
|
-
|
|
233
|
-
**Highlight any MEDIUM/LOW confidence entries** — these are the misclassification risks.
|
|
234
|
-
|
|
235
|
-
**Present the data inventory** for each widget — the user can quickly spot if column headers or labels were hallucinated:
|
|
236
|
-
|
|
237
|
-
| Widget | Title | Subtitle | Data Labels |
|
|
238
|
-
|--------|-------|----------|-------------|
|
|
239
|
-
| Video Playlist | "Video Playlist" | (none) | Columns: Video, Viewed, Clicked Thumbnail, Clicked CTA, Avg. Seconds Watched |
|
|
240
|
-
| Tool Engagement | "Tool Engagement" | (none) | Tabs: [Your 2026 Plan Options, ...], Stats: "487 Total members who viewed", "300 Total members who clicked CTA" |
|
|
241
|
-
|
|
242
|
-
Ask user: "Proceed with this decomposition? [y/n/edit]"
|
|
243
|
-
- **y** → Step 6
|
|
244
|
-
- **n** → abort
|
|
245
|
-
- **edit** → accept user revisions to the hierarchy, re-present
|
|
246
|
-
|
|
247
|
-
> **Why this checkpoint matters**: The 13-task validation (v2.59–v2.67) proved contracts→code is airtight. But Figma→contracts was unverified — misclassifications at this step propagate through the entire build uncaught. This 5-minute review catches: wrong chart types, hallucinated data models, missing elements, wrong labels.
|
|
248
|
-
|
|
249
|
-
## Step 6: Write Contracts
|
|
250
|
-
|
|
251
|
-
Create the directory structure:
|
|
252
|
-
|
|
253
|
-
```
|
|
254
|
-
.gsd-t/contracts/design/
|
|
255
|
-
├── elements/
|
|
256
|
-
│ ├── chart-donut.contract.md
|
|
257
|
-
│ ├── chart-bar-stacked-horizontal.contract.md
|
|
258
|
-
│ ├── legend-vertical-right.contract.md
|
|
259
|
-
│ └── ... (one file per element)
|
|
260
|
-
├── widgets/
|
|
261
|
-
│ ├── revenue-breakdown-widget.contract.md
|
|
262
|
-
│ └── ... (one file per widget)
|
|
263
|
-
├── pages/
|
|
264
|
-
│ ├── dashboard-overview.contract.md
|
|
265
|
-
│ └── ... (one file per page)
|
|
266
|
-
└── INDEX.md (hierarchy map + cross-references)
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
For each element contract:
|
|
270
|
-
1. Copy `templates/element-contract.md` as scaffold
|
|
271
|
-
2. Fill in visual spec from Figma MCP (exact values) or visual analysis (estimated values)
|
|
272
|
-
3. Fill in states, interactions, data binding, accessibility, verification checklist
|
|
273
|
-
4. If Figma MCP available → use `get_design_context` per element node to extract tokens
|
|
274
|
-
|
|
275
|
-
For each widget contract:
|
|
276
|
-
1. Copy `templates/widget-contract.md` as scaffold
|
|
277
|
-
2. Reference elements by name in the "Elements Used" table
|
|
278
|
-
3. Define layout, data binding, responsive behavior, widget-level verification
|
|
279
|
-
4. **Extract layout CSS from `get_design_context` output (MANDATORY)**:
|
|
280
|
-
The Figma MCP returns code with explicit CSS layout properties. Parse these into the
|
|
281
|
-
widget contract's "Internal Element Layout" section:
|
|
282
|
-
- `body_layout`: Look at the parent container's CSS in the Figma output.
|
|
283
|
-
`flex flex-row` or `flex gap-[16px] items-center` → `flex-row`.
|
|
284
|
-
`flex flex-col` or `flex-col gap-[16px]` → `flex-column`.
|
|
285
|
-
`grid grid-cols-2` → `grid 2-col`. Write EXACTLY what the Figma shows.
|
|
286
|
-
- `body_gap`: Extract the gap value from the Figma CSS (e.g., `gap-[16px]` → `16px`)
|
|
287
|
-
- Legend position: If legend is a SIBLING of the chart in a `flex-row` container →
|
|
288
|
-
legend is BESIDE the chart (`body_sidebar`). If legend is BELOW the chart in a
|
|
289
|
-
`flex-col` container → legend is in `footer_legend`. This distinction is CRITICAL —
|
|
290
|
-
it's the difference between a side-by-side layout and a stacked layout.
|
|
291
|
-
- `container_height`: If the Figma shows `h-[334px]` → fixed height `334px`.
|
|
292
|
-
If no explicit height → `auto`.
|
|
293
|
-
|
|
294
|
-
For each page contract:
|
|
295
|
-
1. Copy `templates/page-contract.md` as scaffold
|
|
296
|
-
2. Reference widgets in grid positions
|
|
297
|
-
3. Define route, data loading, global states, performance budget
|
|
298
|
-
4. **Extract grid structure from `get_design_context` output (MANDATORY)**:
|
|
299
|
-
The Figma MCP returns the page's layout as nested containers. Parse the structure:
|
|
300
|
-
- Count "Row" or `flex-row` containers and their children to determine grid dimensions
|
|
301
|
-
(e.g., 2 Row containers with 2 cards each → `grid 2×2`, NOT `grid 1×4`)
|
|
302
|
-
- Extract `gap` values between rows and between cards within rows
|
|
303
|
-
- Extract explicit heights on cards (e.g., `h-[334px]`)
|
|
304
|
-
- Document in the page contract's "Widgets Used" table:
|
|
305
|
-
```
|
|
306
|
-
| grid[row=1, cols=1-2] | most-popular-tools + number-of-tools | 2 per row |
|
|
307
|
-
| grid[row=2, cols=1-2] | time-on-page + number-of-visits | 2 per row |
|
|
308
|
-
```
|
|
309
|
-
- **Anti-pattern**: Seeing 4 sibling cards and writing `grid-cols-4` when the Figma
|
|
310
|
-
groups them into 2 rows of 2. ALWAYS check the parent container structure.
|
|
311
|
-
|
|
312
|
-
Write `INDEX.md` as a navigation map:
|
|
313
|
-
|
|
314
|
-
```markdown
|
|
315
|
-
# Design Contracts: {Project Name}
|
|
316
|
-
|
|
317
|
-
## Elements (14)
|
|
318
|
-
- [chart-donut](elements/chart-donut.contract.md) — used by revenue-breakdown-widget
|
|
319
|
-
- [chart-bar-stacked-horizontal](elements/chart-bar-stacked-horizontal.contract.md) — used by analytics-trend-widget
|
|
320
|
-
- ...
|
|
321
|
-
|
|
322
|
-
## Widgets (6)
|
|
323
|
-
- [revenue-breakdown-widget](widgets/revenue-breakdown-widget.contract.md) — uses chart-donut, legend-vertical-right
|
|
324
|
-
- ...
|
|
325
|
-
|
|
326
|
-
## Pages (3)
|
|
327
|
-
- [dashboard-overview](pages/dashboard-overview.contract.md) — uses stat-strip-widget, revenue-breakdown-widget, user-growth-widget, recent-activity-table-widget
|
|
328
|
-
- ...
|
|
329
|
-
|
|
330
|
-
## Precedence
|
|
331
|
-
element contract > widget contract > page contract
|
|
332
|
-
|
|
333
|
-
Widgets and pages reference elements by name. They CANNOT override element visual spec. To customize, create a new element variant.
|
|
334
|
-
|
|
335
|
-
## Figma Element Counts (MANDATORY — verification anchor)
|
|
336
|
-
|
|
337
|
-
These counts are captured from the Figma decomposition and serve as the
|
|
338
|
-
ground truth during verification. Any mismatch between these counts and
|
|
339
|
-
the built output is a CRITICAL deviation.
|
|
340
|
-
|
|
341
|
-
| Level | Count | Source |
|
|
342
|
-
|----------|-------|---------------------------------|
|
|
343
|
-
| Elements | {N} | Inventory table (Step 1d) |
|
|
344
|
-
| Widgets | {N} | Widget inventory (Step 3) |
|
|
345
|
-
| Pages | {N} | Page inventory (Step 4) |
|
|
346
|
-
| Total | {N} | Sum of all contracts |
|
|
347
|
-
|
|
348
|
-
Per-page element manifest (for verification agent):
|
|
349
|
-
| Page | Widgets | Elements (including widget-internal) |
|
|
350
|
-
|--------------------|---------|--------------------------------------|
|
|
351
|
-
| {dashboard} | {N} | {N} — {list: stat-card ×4, chart-donut ×1, ...} |
|
|
352
|
-
| {analytics} | {N} | {N} — {list} |
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
## Step 6.5: Contract-vs-Figma Verification Gate — SEPARATE AGENT (MANDATORY)
|
|
356
|
-
|
|
357
|
-
After writing all contracts but BEFORE proceeding to partition or build, spawn a **dedicated verification subagent** to independently verify every chart classification against the Figma source. This agent has FRESH context, no sunk cost in the classifications, and its sole incentive is finding mismatches.
|
|
358
|
-
|
|
359
|
-
> **Why a separate agent?** The decompose agent that classified the charts cannot objectively verify its own classifications. It has the same blind spots that caused the misclassification. This was proven repeatedly — the same agent rubber-stamps its own work. A fresh agent with only the contracts and Figma access catches what the classifier missed.
|
|
360
|
-
|
|
361
|
-
**OBSERVABILITY LOGGING (MANDATORY) — wrap the Chart Classification Verifier spawn with `captureSpawn`:** route through `bin/gsd-t-token-capture.cjs` with `{command: 'gsd-t-design-decompose', step: 'Chart Classification Verifier', model: 'opus', projectDir: '.', notes: 'verification {PASSED/FAILED}'}`. The wrapper owns banner + timing + envelope parse + row write.
|
|
362
|
-
|
|
363
|
-
⚙ [opus] gsd-t-design-decompose → Chart Classification Verifier
|
|
7
|
+
## What this command does
|
|
364
8
|
|
|
365
9
|
```
|
|
366
|
-
|
|
367
|
-
"You are the Chart Classification Verifier. Your ONLY job is to independently
|
|
368
|
-
verify that each element contract's chart type classification matches the actual
|
|
369
|
-
Figma design. You have ZERO knowledge of how the charts were classified — you
|
|
370
|
-
are seeing them fresh. Your incentive: every misclassification you catch prevents
|
|
371
|
-
a wrong chart being built. Every misclassification you miss causes a rebuild.
|
|
372
|
-
|
|
373
|
-
## Contracts to Verify
|
|
374
|
-
{list each element contract filename + its claimed chart type from INDEX.md}
|
|
375
|
-
|
|
376
|
-
## Figma Source
|
|
377
|
-
File key: {fileKey}
|
|
378
|
-
Page node: {nodeId}
|
|
379
|
-
|
|
380
|
-
## Verification Process
|
|
381
|
-
|
|
382
|
-
For EACH element contract that claims a chart/visualization type:
|
|
383
|
-
|
|
384
|
-
1. Read the element contract — note its claimed type (e.g., 'bar-vertical-grouped')
|
|
385
|
-
2. Find the Figma node ID referenced in the contract (or in the widget that uses it)
|
|
386
|
-
3. Call `get_design_context` on that specific node ID — examine the STRUCTURE:
|
|
387
|
-
- Layout mode (horizontal vs vertical arrangement of children)
|
|
388
|
-
- Child elements (are they bars? segments? slices?)
|
|
389
|
-
- How children are arranged (side by side? stacked? overlapping?)
|
|
390
|
-
- Dimensions (do bars extend horizontally or vertically?)
|
|
391
|
-
|
|
392
|
-
4. Walk the decision tree INDEPENDENTLY (do NOT read the contract's reasoning):
|
|
393
|
-
|
|
394
|
-
BAR CHART ORIENTATION PROOF:
|
|
395
|
-
a. Are the data-bearing rectangles arranged HORIZONTALLY (left to right)?
|
|
396
|
-
→ Segments share ONE ROW, each segment's WIDTH encodes its value
|
|
397
|
-
→ This is HORIZONTAL (stacked if touching, grouped if separated)
|
|
398
|
-
b. Are the data-bearing rectangles arranged VERTICALLY (bottom to top)?
|
|
399
|
-
→ Each bar is a COLUMN, each bar's HEIGHT encodes its value
|
|
400
|
-
→ This is VERTICAL (stacked if layered, grouped if side-by-side)
|
|
401
|
-
c. Is it ONE bar with colored segments? → STACKED
|
|
402
|
-
Is it MULTIPLE separate bars? → GROUPED
|
|
403
|
-
d. Do labels show percentages summing to 100%? → PERCENTAGE variant
|
|
404
|
-
|
|
405
|
-
CRITICAL DISTINCTION — the #1 misclassification:
|
|
406
|
-
A single horizontal bar divided into colored segments (each segment's WIDTH
|
|
407
|
-
represents a percentage) is chart-bar-stacked-horizontal-percentage.
|
|
408
|
-
Multiple vertical columns of different heights side-by-side is
|
|
409
|
-
chart-bar-grouped-vertical. These render COMPLETELY DIFFERENTLY.
|
|
410
|
-
If you see colored blocks in a ROW → HORIZONTAL. Period.
|
|
411
|
-
|
|
412
|
-
5. Compare YOUR classification against the contract's classification.
|
|
413
|
-
|
|
414
|
-
6. For EACH element, produce:
|
|
415
|
-
|
|
416
|
-
```
|
|
417
|
-
Element: {name}
|
|
418
|
-
Contract claims: {chart type}
|
|
419
|
-
Figma node: {id}
|
|
420
|
-
I SEE: {describe what the Figma MCP returned — layout, children, arrangement}
|
|
421
|
-
MY CLASSIFICATION: {your independent classification}
|
|
422
|
-
VERDICT: ✅ MATCH or ❌ MISMATCH
|
|
423
|
-
If MISMATCH: Contract says {X} but Figma shows {Y} because {evidence}
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
## Report
|
|
427
|
-
|
|
428
|
-
Produce the full verification table:
|
|
429
|
-
|
|
430
|
-
| # | Element | Contract Type | Verified Type | Figma Evidence | Verdict |
|
|
431
|
-
|---|---------|--------------|---------------|----------------|---------|
|
|
432
|
-
| 1 | chart-donut | chart-donut | chart-donut | circular arcs + center hole | ✅ MATCH |
|
|
433
|
-
| 2 | bar-vertical-grouped | bar-vertical-grouped | bar-stacked-horizontal-pct | 4 segments in ONE horizontal row | ❌ MISMATCH |
|
|
434
|
-
|
|
435
|
-
If ANY ❌ MISMATCH found:
|
|
436
|
-
- List each mismatch with the correct classification and evidence
|
|
437
|
-
- Report: 'VERIFICATION FAILED — {N} misclassifications found. Contracts must be fixed before build.'
|
|
438
|
-
|
|
439
|
-
If ALL ✅ MATCH:
|
|
440
|
-
- Report: 'VERIFICATION PASSED — all {N} chart classifications confirmed against Figma source.'
|
|
441
|
-
"
|
|
10
|
+
preflight → brief (kind=design-decompose) → design agent (opus, with phase protocol)
|
|
442
11
|
```
|
|
443
12
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
**If VERIFICATION FAILED**: Fix every misclassified element contract before proceeding:
|
|
447
|
-
1. Rename the contract file to match the correct chart type
|
|
448
|
-
2. Rewrite the visual spec section to match the correct chart type
|
|
449
|
-
3. Update INDEX.md references
|
|
450
|
-
4. Update any widget contracts that reference the renamed element
|
|
451
|
-
5. **Re-run the verification subagent** to confirm fixes (max 2 cycles)
|
|
13
|
+
## Step 1: Load context
|
|
452
14
|
|
|
453
|
-
|
|
15
|
+
Capture the design reference from `$ARGUMENTS` (Figma URL / image path). If Figma MCP is configured, the agent uses it to extract tokens. Read any existing `.gsd-t/contracts/design/` to avoid duplication.
|
|
454
16
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
## Step 7: Wire Into Partition
|
|
458
|
-
|
|
459
|
-
If `.gsd-t/domains/` exists (project is already partitioned), append to relevant domain's `scope.md`:
|
|
460
|
-
|
|
461
|
-
```markdown
|
|
462
|
-
## Design Contracts
|
|
463
|
-
This domain owns the following design contracts:
|
|
464
|
-
- Elements: chart-donut, legend-vertical-right
|
|
465
|
-
- Widgets: revenue-breakdown-widget
|
|
466
|
-
- Pages: (none — pages owned by page-assembly domain)
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
If `.gsd-t/domains/` does NOT exist yet, suggest the user run `/gsd-t-partition` next, with a note that design contracts should be partitioned into domains:
|
|
470
|
-
- **design-system domain** owns element contracts
|
|
471
|
-
- **widgets domain** owns widget contracts
|
|
472
|
-
- **pages domain** owns page assembly + routing
|
|
473
|
-
|
|
474
|
-
## Step 8: Update progress.md Decision Log
|
|
475
|
-
|
|
476
|
-
Append:
|
|
477
|
-
```
|
|
478
|
-
- {YYYY-MM-DD HH:MM}: gsd-t-design-decompose — created {N} element / {N} widget / {N} page contracts under .gsd-t/contracts/design/. Hierarchy: elements are single source of truth for visual spec; widgets compose elements; pages compose widgets.
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
## Step 9: Next Up Hint
|
|
482
|
-
|
|
483
|
-
Display:
|
|
17
|
+
## Step 2: Invoke the phase Workflow
|
|
484
18
|
|
|
19
|
+
```js
|
|
20
|
+
{
|
|
21
|
+
scriptPath: "templates/workflows/gsd-t-phase.workflow.js",
|
|
22
|
+
args: {
|
|
23
|
+
phase: "design-decompose",
|
|
24
|
+
projectDir: ".",
|
|
25
|
+
userInput: "$ARGUMENTS"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
485
28
|
```
|
|
486
|
-
───────────────────────────────────────────────────────────────
|
|
487
|
-
|
|
488
|
-
## ▶ Next Up
|
|
489
29
|
|
|
490
|
-
|
|
30
|
+
## Step 3: Interpret the result
|
|
491
31
|
|
|
492
|
-
|
|
32
|
+
The Workflow returns `{ status, artifacts, summary, decisions }`.
|
|
493
33
|
|
|
494
|
-
|
|
495
|
-
-
|
|
496
|
-
-
|
|
497
|
-
|
|
498
|
-
───────────────────────────────────────────────────────────────
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
---
|
|
34
|
+
- `status === "complete"`: the element → widget → page contract tree is written under `.gsd-t/contracts/design/`.
|
|
35
|
+
- `status === "partial" | "blocked"`: the agent needs the design source (e.g. Figma auth) or a stack-capability decision. Surface it.
|
|
36
|
+
- `status === "failed"`: read `summary`.
|
|
502
37
|
|
|
503
38
|
## Document Ripple
|
|
504
39
|
|
|
505
|
-
|
|
506
|
-
- `.gsd-t/progress.md` — Decision Log entry (Step 8)
|
|
507
|
-
- `docs/architecture.md` — add "Design Contract Hierarchy" section if not present
|
|
508
|
-
- If existing flat `.gsd-t/contracts/design-contract.md` was retrofitted → mark it with a DEPRECATED header pointing to `design/INDEX.md`
|
|
509
|
-
|
|
510
|
-
## Pre-Commit Gate
|
|
40
|
+
The design agent writes the contract tree and a Decision Log entry.
|
|
511
41
|
|
|
512
|
-
|
|
513
|
-
- [ ] `INDEX.md` created with full hierarchy + precedence note
|
|
514
|
-
- [ ] Decision Log updated in progress.md
|
|
515
|
-
- [ ] architecture.md updated if this is a new concept for the project
|
|
42
|
+
## Next Up
|
|
516
43
|
|
|
517
|
-
|
|
44
|
+
`/gsd-t-design-build` — deterministic design-to-code pipeline. (`/gsd-t-partition` first if domains are needed before building.)
|