@hegemonart/get-design-done 1.13.3 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ # 21st.dev Magic MCP — Connection Specification
2
+
3
+ This file is the connection specification for the 21st.dev Magic MCP within the get-design-done pipeline. 21st.dev is a component-generator tool — it searches a marketplace of pre-built components and generates new ones via AI. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ ## Setup
8
+
9
+ ### Prerequisites
10
+ - Node.js ≥ 18
11
+ - A 21st.dev account and API key at [21st.dev](https://21st.dev)
12
+ - `TWENTY_FIRST_API_KEY` environment variable set
13
+
14
+ ### Install command (Claude Code)
15
+
16
+ ```bash
17
+ npx @21st-dev/magic@latest init
18
+ ```
19
+
20
+ This sets up the local MCP server. Add to Claude Code settings:
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "21st-magic": {
25
+ "command": "npx",
26
+ "args": ["@21st-dev/magic@latest"],
27
+ "env": { "TWENTY_FIRST_API_KEY": "${TWENTY_FIRST_API_KEY}" }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### Verification
34
+
35
+ ```
36
+ ToolSearch({ query: "mcp__21st", max_results: 5 })
37
+ ```
38
+
39
+ Expect non-empty results including `21st_magic_component_builder` or `21st_magic_component_search`. If empty, re-run `npx @21st-dev/magic@latest init` and restart Claude Code session.
40
+
41
+ ---
42
+
43
+ ## Probe Pattern
44
+
45
+ ```
46
+ ToolSearch({ query: "mcp__21st", max_results: 5 })
47
+ → Empty → 21st-dev: not_configured (skip all 21st.dev steps)
48
+ → Non-empty → 21st-dev: available
49
+ ```
50
+
51
+ Write result to STATE.md `<connections>`: `21st-dev: <status>`
52
+
53
+ Fallback: when `not_configured`, the explore stage skips the prior-art gate and proceeds with custom component generation.
54
+
55
+ ---
56
+
57
+ ## 21st.dev Magic MCP Tools
58
+
59
+ | Tool | Stage | Purpose |
60
+ |------|-------|---------|
61
+ | `21st_magic_component_search` | explore | Semantic search of marketplace; returns top N matching components with fit scores |
62
+ | `21st_magic_component_builder` | design | Generate component with multiple variations from a description |
63
+ | `21st_magic_component_get` | design | Fetch full source code for a specific marketplace component |
64
+ | `svgl_get_brand_logo` | explore + design | Fetch brand logo/icon SVG by brand name (SVGL integration) |
65
+
66
+ ---
67
+
68
+ ## Pipeline Integration
69
+
70
+ | Stage | What 21st.dev provides |
71
+ |-------|------------------------|
72
+ | explore | **Prior-art gate**: `21st_magic_component_search` before any greenfield build; top-3 in `<prior-art>` block in DESIGN.md |
73
+ | explore | **Brand assets**: `svgl_get_brand_logo` for logo/icon lookups by brand name |
74
+ | design | `21st_magic_component_builder` for component scaffolding via `design-component-generator` agent |
75
+
76
+ ### Prior-Art Gate Logic
77
+
78
+ Before building any custom component:
79
+ 1. `21st_magic_component_search(component_description, limit: 3)`
80
+ 2. Evaluate top result fit score (0–100):
81
+ - **≥ 80%**: surface as `<prior-art>` block in DESIGN.md; recommend adoption
82
+ - **< 80%**: note top candidate for reference; proceed with custom build
83
+ 3. Design-executor confirms adoption with user before calling `21st_magic_component_get`
84
+
85
+ This is a **decision gate** — the agent surfaces candidates, the user/executor decides. No automatic code insertion.
86
+
87
+ ### SVGL Brand Logo Integration
88
+
89
+ `svgl_get_brand_logo(brand_name, format: "svg")` returns SVG markup for major brands (GitHub, Vercel, Stripe, etc.). Wire into explore stage for brand asset lookups — eliminates manual SVG hunting.
90
+
91
+ ---
92
+
93
+ ## Fallback Behavior
94
+
95
+ When `21st-dev: not_configured`:
96
+ - Prior-art gate is skipped. Print: `21st.dev not configured — prior-art gate skipped.`
97
+ - Custom component generation proceeds normally.
98
+ - Brand logo lookups fall back to icon library references in `reference/iconography.md` (Phase 15).
@@ -6,20 +6,94 @@ This file is the connection specification for Claude Design (https://claude.ai/d
6
6
 
7
7
  ## What Is a Claude Design Handoff Bundle?
8
8
 
9
- Claude Design produces AI-generated designs that can be exported as **handoff bundles**. A bundle contains:
9
+ Claude Design produces AI-generated designs that can be exported in several formats or sent directly to Claude Code via a hosted URL. The pipeline supports all of them.
10
10
 
11
- | Artifact | Format | Contains |
12
- |----------|--------|---------|
13
- | Standalone HTML export | `.html` | Rendered component tree, inline CSS (design tokens as CSS custom properties), component structure, color/spacing/typography values |
14
- | Design spec (optional) | `.md` or `.json` | Design decisions as structured text, token tables, component annotations |
15
- | Assets (optional) | `assets/` dir | Icons, images referenced by the HTML export |
11
+ ### Entry Points
16
12
 
17
- **Bundle entry point:** The primary parseable artifact is the HTML export. It contains inline `<style>` blocks with CSS custom properties (e.g., `--color-primary: #3B82F6`) and class-level token usage.
13
+ | Source | How it arrives | handoff_source value |
14
+ |--------|---------------|----------------------|
15
+ | **"Send to local coding agent"** | Anthropic-hosted URL in the agent prompt | `claude-design-url` |
16
+ | **"Download zip"** | `.zip` bundle dropped into project | `claude-design-zip` |
17
+ | **"Save as standalone HTML"** | `.html` file dropped into project | `claude-design-html` |
18
+ | **"Save as PDF"** | `.pdf` file (spec text extraction only) | `claude-design-pdf` |
19
+ | **"Save as PPTX"** | `.pptx` file (spec text extraction only) | `claude-design-pptx` |
20
+ | **Bundle directory** | Unzipped directory with HTML + spec + assets | `claude-design-bundle` |
18
21
 
19
- **Bundle discovery:** The pipeline looks for the bundle in:
20
- 1. The path passed via `--from-handoff <path>` flag or `handoff <path>` sub-command
21
- 2. The value of `handoff_source` in `.design/STATE.md` (if a prior session already set it)
22
- 3. A `claude-design-handoff.html` file in the project root (convention — not required)
22
+ ### Bundle contents by format
23
+
24
+ | Format | Primary artifact | Design tokens | Spec text | Images |
25
+ |--------|-----------------|---------------|-----------|--------|
26
+ | URL (hosted) | Fetched HTML | ✅ CSS custom props | ✅ if readme present | ✅ |
27
+ | ZIP | Unzipped HTML | ✅ CSS custom props | ✅ `readme.md` inside | ✅ |
28
+ | Standalone HTML | `.html` file | ✅ CSS custom props | ✅ if `.md` alongside | ✅ inline |
29
+ | PDF | `.pdf` text | ❌ (no CSS) | ✅ extracted text | ❌ |
30
+ | PPTX | `.pptx` slides | ❌ (no CSS) | ✅ slide text only | ❌ |
31
+
32
+ **Bundle entry point:** The primary parseable artifact is always the HTML — it contains inline `<style>` blocks with CSS custom properties (e.g., `--color-primary: #3B82F6`) and class-level token usage. PDF and PPTX are text-extraction fallbacks when no HTML is available.
33
+
34
+ **Bundle discovery:** The pipeline looks for the bundle in this priority order:
35
+ 1. A `https://api.anthropic.com/v1/design/h/` URL in the agent invocation arguments
36
+ 2. The path passed via `--from-handoff <path>` flag or `handoff <path>` sub-command
37
+ 3. The value of `handoff_source` in `.design/STATE.md` (if a prior session already set it)
38
+ 4. A `claude-design-handoff.{html,zip,pdf,pptx}` file in the project root (convention — not required)
39
+
40
+ ---
41
+
42
+ ## Format-Specific Ingestion
43
+
44
+ ### URL format — `https://api.anthropic.com/v1/design/h/<hash>`
45
+
46
+ This is the native entry point when the user clicks **"Send to local coding agent"** in Claude Design. The agent prompt arrives as:
47
+
48
+ ```
49
+ Fetch this design file, read its readme, and implement the relevant aspects of the design. https://api.anthropic.com/v1/design/h/<hash>
50
+ Implement: <user description>
51
+ ```
52
+
53
+ **Detection:** grep the raw arguments/prompt for the pattern `https://api\.anthropic\.com/v1/design/h/[A-Za-z0-9_-]+`.
54
+
55
+ **Fetch sequence:**
56
+ 1. `WebFetch` the URL — the response is either an HTML bundle or a redirect to a ZIP download
57
+ 2. If `Content-Type: text/html` → treat as standalone HTML, parse normally
58
+ 3. If `Content-Type: application/zip` or redirect to `.zip` → download to `.design/handoff/claude-design-handoff.zip`, then follow ZIP ingestion below
59
+ 4. Check the response for an embedded `readme.md` link (often served alongside) — fetch it separately if present
60
+ 5. Set `handoff_source: claude-design-url` and `handoff_url: <url>` in STATE.md
61
+
62
+ **Implement description:** The text after `Implement:` in the agent prompt is the user's implementation scope — capture it as a project note, not a D-XX decision.
63
+
64
+ ### ZIP format
65
+
66
+ **Detection:** input path ends in `.zip` OR fetched from URL as zip.
67
+
68
+ **Ingestion sequence:**
69
+ 1. Extract to `.design/handoff/` (temp directory, not committed)
70
+ 2. Find the primary HTML: `index.html`, `design.html`, or any `.html` at root
71
+ 3. Find spec: `readme.md`, `spec.md`, `design.md`, or any `.md` at root
72
+ 4. Parse HTML + spec using the standard field catalogue below
73
+ 5. Clean up `.design/handoff/` after parsing (keep only extracted decisions in STATE.md)
74
+
75
+ ### PDF format
76
+
77
+ **Detection:** input path ends in `.pdf`.
78
+
79
+ **Ingestion:** PDF yields no CSS custom properties — token extraction is not possible. Instead:
80
+ 1. Extract all text content (pdftotext or equivalent)
81
+ 2. Grep for `Decision:`, `Rationale:`, `Token:`, `Color:`, `Typography:`, `Spacing:` prefixes
82
+ 3. Treat matched lines as spec text → translate to D-XX entries tagged `(source: claude-design-pdf)` + `(tentative — text-only, no CSS confirmation)`
83
+ 4. Note in STATE.md: `handoff_format: pdf` + caveat that token values were extracted from text, not CSS
84
+
85
+ **Limitation:** PDF handoffs cannot produce `(locked)` token decisions — all are `(tentative)`. Surface this explicitly to the user in the discussant step.
86
+
87
+ ### PPTX format
88
+
89
+ **Detection:** input path ends in `.pptx`.
90
+
91
+ **Ingestion:** Same as PDF — text extraction only, no CSS tokens.
92
+ 1. Extract slide text (python-pptx or unzip `.pptx` and parse `ppt/slides/*.xml`)
93
+ 2. Same grep patterns as PDF
94
+ 3. Tag all entries `(source: claude-design-pptx)` + `(tentative — text-only)`
95
+
96
+ **Limitation:** Same as PDF — all decisions are tentative. PPTX format is the weakest source; prefer HTML or ZIP if available.
23
97
 
24
98
  ---
25
99
 
@@ -114,13 +188,15 @@ Claude Design is not an MCP server — it has no tools to probe via ToolSearch.
114
188
 
115
189
  ```
116
190
  At scan stage entry:
117
- 1. Check STATE.md <position> for handoff_source field
191
+ 1. Check invocation arguments/prompt for https://api.anthropic.com/v1/design/h/ URL
118
192
  2. Check $ARGUMENTS for --from-handoff <path> flag
119
- 3. Check project root for claude-design-handoff.html
193
+ 3. Check STATE.md <position> for handoff_source / handoff_url / handoff_path field
194
+ 4. Check project root for claude-design-handoff.{html,zip,pdf,pptx}
120
195
 
121
- Bundle path found AND file exists → claude_design: available
122
- Bundle path provided but file missing/bad → claude_design: unavailable
123
- No bundle path, no file → claude_design: not_configured
196
+ URL detected (step 1) → claude_design: available (fetch at ingest time)
197
+ File path found AND file exists → claude_design: available
198
+ Path/URL provided but unreachable/bad → claude_design: unavailable
199
+ → None of the above → claude_design: not_configured
124
200
  ```
125
201
 
126
202
  Write result to STATE.md `<connections>` at scan entry.
@@ -168,17 +244,25 @@ skipped_stages: scan, discover, plan
168
244
 
169
245
  **`handoff_source` values:**
170
246
 
171
- | Value | Meaning |
172
- |-------|---------|
173
- | `claude-design-html` | Bundle is a standalone HTML export from Claude Design |
174
- | `claude-design-bundle` | Bundle is a directory with HTML + spec markdown + assets |
175
- | `manual` | User manually initialized STATE.md with design decisions (no bundle file) |
247
+ | Value | Meaning | Token quality |
248
+ |-------|---------|---------------|
249
+ | `claude-design-url` | Fetched from Anthropic-hosted URL (Send to local coding agent) | High — HTML |
250
+ | `claude-design-zip` | ZIP bundle dropped into project | High HTML inside |
251
+ | `claude-design-html` | Standalone HTML export | High CSS custom props |
252
+ | `claude-design-bundle` | Directory with HTML + spec markdown + assets | High — CSS custom props |
253
+ | `claude-design-pdf` | PDF export (text extraction only) | Low — text only, all tentative |
254
+ | `claude-design-pptx` | PPTX export (text extraction only) | Low — text only, all tentative |
255
+ | `manual` | User manually initialized STATE.md with design decisions (no bundle file) | N/A |
176
256
 
177
257
  ---
178
258
 
179
259
  ## Caveats and Pitfalls
180
260
 
181
- 1. **Handoff bundle format is undocumented by Anthropic.** The Claude Design handoff bundle format is inferred from the product announcement and common HTML export patterns. The pipeline uses defensive parsing: grep for CSS custom properties in `<style>` tags, extract component class names from `class="component-*"` patterns, and fall back to the spec markdown/JSON if CSS parsing yields no results. If the format changes in a future Claude Design release, update this spec and the synthesizer's parsing patterns.
261
+ 1. **Handoff bundle format is undocumented by Anthropic.** The Claude Design handoff bundle format is inferred from the product UI and common HTML export patterns. The pipeline uses defensive parsing: grep for CSS custom properties in `<style>` tags, extract component class names from `class="component-*"` patterns, and fall back to the spec markdown/JSON if CSS parsing yields no results. If the format changes in a future Claude Design release, update this spec and the synthesizer's parsing patterns. The URL endpoint (`/v1/design/h/<hash>`) may return different content types — always check `Content-Type` before deciding whether to parse as HTML or unzip.
262
+
263
+ 6. **PDF and PPTX handoffs produce only tentative decisions.** These formats contain no CSS — all token values must be inferred from prose. Never promote PDF/PPTX-sourced decisions to `(locked)` without explicit user confirmation. If the user provides both a PDF and an HTML export, always prefer the HTML.
264
+
265
+ 7. **ZIP extraction is ephemeral.** Extracted ZIP contents go to `.design/handoff/` and are deleted after parsing. Only the extracted D-XX decisions are persisted to STATE.md. Never commit the raw extracted files.
182
266
 
183
267
  2. **`(tentative)` decisions MUST be confirmed by the user.** The discussant `--from-handoff` mode surfaces all tentative decisions for confirmation before proceeding to verify. Do NOT skip this step — implementing against unconfirmed inferred values is the primary failure mode of handoff-sourced workflows.
184
268
 
@@ -16,6 +16,10 @@ This directory contains connection specifications for external tools and MCPs th
16
16
  | Graphify | Active | [`connections/graphify.md`](connections/graphify.md) | CLI: `graphify`; `gsd-tools graphify *` |
17
17
  | Pinterest | Active | [`connections/pinterest.md`](connections/pinterest.md) | `mcp__mcp-pinterest__*` tools (ToolSearch-only probe; headless scraping, no API key) |
18
18
  | Claude Design | Active | [`connections/claude-design.md`](connections/claude-design.md) | No MCP — bundle file probe; enables `/gdd:handoff` pipeline + bidirectional write-back via figma-writer |
19
+ | paper.design | Active | [`connections/paper-design.md`](connections/paper-design.md) | Uses `mcp__paper-design__*` tools; free tier: 100 calls/week |
20
+ | pencil.dev | Active | [`connections/pencil-dev.md`](connections/pencil-dev.md) | File-based; `.pen` YAML specs; git-tracked; no MCP |
21
+ | 21st.dev Magic MCP | Active | [`connections/21st-dev.md`](connections/21st-dev.md) | Uses `mcp__21st*` tools; `TWENTY_FIRST_API_KEY` required |
22
+ | Magic Patterns | Active | [`connections/magic-patterns.md`](connections/magic-patterns.md) | Claude connector (`mcp__magic_patterns*`) + API key fallback |
19
23
 
20
24
  ---
21
25
 
@@ -23,16 +27,20 @@ This directory contains connection specifications for external tools and MCPs th
23
27
 
24
28
  Each cell describes what the connection contributes at that pipeline stage, or `—` if it is not used.
25
29
 
26
- | Connection | scan | discover | plan | design | verify |
27
- |-----------|------|----------|------|--------|--------|
28
- | Figma | token augmentation via `get_variable_defs` (CONN-03) | decisions pre-populate via `get_variable_defs` (CONN-04) | — | write tokens/annotations/Code Connect via `use_figma` (FWR-01..04) | — |
29
- | Refero | — | reference search via `mcp__refero__search`; fallback → awesome-design-md (CONN-05) | — | — | — |
30
- | Preview | — | — | — | — | screenshots for `? VISUAL` checks (VIS-02) |
31
- | Storybook | — | component inventory (STB-01) | change-risk via story count (STB-02) | `.stories.tsx` stub (STB-03) | a11y per story (STB-02) |
32
- | Chromatic | — | — | change-risk scoping (CHR-02) | — | visual delta narration (CHR-01) |
33
- | Graphify | — | — | dependency scoping (GRF-03) | — | orphan detection (GRF-04) |
34
- | Pinterest | probe only | visual reference search via `pinterest_search`; fallback → Refero → awesome-design-md | — | — | — |
35
- | Claude Design | bundle probe → `claude_design: available` | synthesizer handoff mode — parses bundle → D-XX decisions; discussant `--from-handoff` confirms | — (skipped in handoff) | — (skipped in handoff) | Handoff Faithfulness section; bidirectional write-back via figma-writer `implementation-status` mode |
30
+ | Connection | scan | discover | plan | design | verify | canvas | generator |
31
+ |-----------|------|----------|------|--------|--------|--------|-----------|
32
+ | Figma | token augmentation via `get_variable_defs` (CONN-03) | decisions pre-populate via `get_variable_defs` (CONN-04) | — | write tokens/annotations/Code Connect via `use_figma` (FWR-01..04) | — | — | — |
33
+ | Refero | — | reference search via `mcp__refero__search`; fallback → awesome-design-md (CONN-05) | — | — | — | — | — |
34
+ | Preview | — | — | — | — | screenshots for `? VISUAL` checks (VIS-02) | — | — |
35
+ | Storybook | — | component inventory (STB-01) | change-risk via story count (STB-02) | `.stories.tsx` stub (STB-03) | a11y per story (STB-02) | — | — |
36
+ | Chromatic | — | — | change-risk scoping (CHR-02) | — | visual delta narration (CHR-01) | — | — |
37
+ | Graphify | — | — | dependency scoping (GRF-03) | — | orphan detection (GRF-04) | — | — |
38
+ | Pinterest | probe only | visual reference search via `pinterest_search`; fallback → Refero → awesome-design-md | — | — | — | — | — |
39
+ | Claude Design | bundle probe → `claude_design: available` | synthesizer handoff mode — parses bundle → D-XX decisions; discussant `--from-handoff` confirms | — (skipped in handoff) | — (skipped in handoff) | Handoff Faithfulness section; bidirectional write-back via figma-writer `implementation-status` mode | — | — |
40
+ | paper.design | — | canvas read: `get_selection`, `get_jsx`, `get_computed_styles` | — | paper-writer: annotate/tokenize/roundtrip | `get_screenshot` for `? VISUAL` | ✓ | — |
41
+ | pencil.dev | `.pen` discovery | `.pen` as canonical design source | — | pencil-writer: annotate/roundtrip | spec-vs-impl diff | ✓ | — |
42
+ | 21st.dev | — | prior-art gate: marketplace search before greenfield build | — | component-generator (21st impl) | — | — | ✓ |
43
+ | Magic Patterns | — | — | — | component-generator (magic-patterns impl) | preview_url → `? VISUAL` check | — | ✓ |
36
44
 
37
45
  **Column definitions:**
38
46
 
@@ -41,6 +49,8 @@ Each cell describes what the connection contributes at that pipeline stage, or `
41
49
  - **plan** — what the connection contributes to planning artifacts
42
50
  - **design** — what the connection provides during design execution
43
51
  - **verify** — what the connection checks or surfaces during verification
52
+ - **canvas** — whether the connection provides bidirectional canvas read+write (see `reference/ai-native-tool-interface.md`)
53
+ - **generator** — whether the connection provides AI component generation (see `reference/ai-native-tool-interface.md`)
44
54
 
45
55
  ---
46
56
 
@@ -202,4 +212,24 @@ To add a new connection to the pipeline:
202
212
 
203
213
  - `connections/` is infrastructure scaffolding introduced in Phase 1. Stage integration (wiring detection and graceful degradation into each stage) is Phase 2 work.
204
214
  - Phase 8 added five new active connections. Linear and GitHub remain planned for a future phase.
205
- - The capability matrix columns map to the five pipeline stages: `scan | discover | plan | design | verify`.
215
+ - Phase 14 added four AI-native design tool connections (paper.design, pencil.dev, 21st.dev, Magic Patterns) and the canvas/generator capability columns.
216
+ - The capability matrix columns map to the five pipeline stages: `scan | discover | plan | design | verify`, plus `canvas` and `generator` sub-categories.
217
+
218
+ ---
219
+
220
+ ## Future AI-Native Tools (Backlog)
221
+
222
+ Candidate tools to integrate using the contract in `reference/ai-native-tool-interface.md`.
223
+
224
+ | Tool | Sub-category | Priority |
225
+ |------|-------------|----------|
226
+ | Subframe | canvas | high |
227
+ | v0.dev | generator | high |
228
+ | Galileo AI | generator | medium |
229
+ | Builder.io Visual Copilot | canvas + generator | medium |
230
+ | Locofy | generator | low |
231
+ | Anima | canvas | low |
232
+ | Plasmic | generator | medium |
233
+ | TeleportHQ | generator | low |
234
+
235
+ To add any of these: follow the steps in `reference/ai-native-tool-interface.md §Extending with Future Tools`.
@@ -0,0 +1,105 @@
1
+ # Magic Patterns — Connection Specification
2
+
3
+ This file is the connection specification for Magic Patterns within the get-design-done pipeline. Magic Patterns is a component-generator tool — it generates DS-aware UI components from natural-language descriptions. It integrates via the Magic Patterns Claude connector (no manual setup when enabled) or via a direct API key. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ ## Setup
8
+
9
+ ### Prerequisites
10
+
11
+ **Path A — Claude connector (preferred):**
12
+ - Magic Patterns Claude connector enabled in your Claude environment
13
+ - No additional setup required
14
+
15
+ **Path B — API key fallback:**
16
+ - A Magic Patterns account and API key at [magicpatterns.com](https://magicpatterns.com)
17
+ - `MAGIC_PATTERNS_API_KEY` environment variable set
18
+ - MCP server install:
19
+ ```bash
20
+ claude mcp add magic-patterns --transport http https://mcp.magicpatterns.com/sse \
21
+ -e MAGIC_PATTERNS_API_KEY=$MAGIC_PATTERNS_API_KEY
22
+ ```
23
+
24
+ ### Verification
25
+
26
+ ```
27
+ ToolSearch({ query: "mcp__magic_patterns", max_results: 5 })
28
+ ```
29
+
30
+ Non-empty results including `magic_patterns_generate` → Claude connector available (Path A).
31
+ Empty → install Path B and restart Claude Code session.
32
+
33
+ ---
34
+
35
+ ## Probe Pattern
36
+
37
+ Magic Patterns uses a two-path probe. Check Claude connector first; fall back to API key path.
38
+
39
+ ```
40
+ ToolSearch({ query: "mcp__magic_patterns", max_results: 5 })
41
+ → Non-empty → magic-patterns: available (Claude connector)
42
+ → Empty → check MAGIC_PATTERNS_API_KEY env var
43
+ set → magic-patterns: available (API key path)
44
+ unset → magic-patterns: not_configured
45
+ ```
46
+
47
+ Write result to STATE.md `<connections>`: `magic-patterns: <status>`
48
+
49
+ Fallback: when `not_configured`, the design stage skips Magic Patterns and falls back to 21st.dev (if available) or manual component build.
50
+
51
+ ---
52
+
53
+ ## Magic Patterns Tools
54
+
55
+ | Tool | Stage | Purpose |
56
+ |------|-------|---------|
57
+ | `magic_patterns_generate` | design | Generate component from description; returns `{ code, preview_url, component_id }` |
58
+ | `magic_patterns_annotate` | design | Post DESIGN-DEBT findings back to a component by ID |
59
+ | `magic_patterns_regenerate` | design | Roundtrip: regenerate with updated description |
60
+
61
+ ### `magic_patterns_generate` parameters
62
+
63
+ | Parameter | Values | Notes |
64
+ |-----------|--------|-------|
65
+ | `description` | string | Natural-language component spec |
66
+ | `design_system` | `"shadcn" \| "tailwind" \| "mantine" \| "chakra"` | Auto-detected from project in explore stage |
67
+ | `quality_mode` | `"fast" \| "best"` | `fast` for explore iterations; `best` for final design stage output |
68
+
69
+ ---
70
+
71
+ ## Pipeline Integration
72
+
73
+ | Stage | What Magic Patterns provides |
74
+ |-------|------------------------------|
75
+ | explore | DS detection → STATE.md `<design_system>` block for generator targeting |
76
+ | design | `magic_patterns_generate(description, design_system, quality_mode: "best")` → component source + `preview_url` |
77
+ | verify | `preview_url` from generate response → feeds Phase 8 Preview `? VISUAL` check |
78
+ | design | `magic_patterns_annotate(component_id, feedback)` → roundtrip mode; post DESIGN-DEBT notes back |
79
+
80
+ ### Design-System Auto-Detection
81
+
82
+ Before invoking `magic_patterns_generate`, the explore stage detects the project's active design system (see `agents/design-context-builder.md` Step 0C):
83
+
84
+ 1. Check `gdd.config.json` (if present): read `designSystem` field → use directly if set.
85
+ 2. Scan `package.json` dependencies:
86
+ - `@shadcn/ui` or `shadcn` present → `"shadcn"`
87
+ - `@mantine/core` or `@mantine/hooks` present → `"mantine"`
88
+ - `@chakra-ui/react` present → `"chakra"`
89
+ - `tailwindcss` present → `"tailwind"`
90
+ 3. Default: `"tailwind"`
91
+
92
+ Write result to STATE.md `<design_system>` block.
93
+
94
+ ### Preview Integration
95
+
96
+ `magic_patterns_generate` returns `preview_url`. The design-component-generator agent writes this URL to STATE.md `<generator>` block. The verify stage's `? VISUAL` check reads `preview_url` from STATE.md and opens it in Phase 8 Preview for visual comparison.
97
+
98
+ ---
99
+
100
+ ## Fallback Behavior
101
+
102
+ When `magic-patterns: not_configured`:
103
+ - Print: `Magic Patterns not configured — component generator skipped.`
104
+ - Falls back to 21st.dev if `21st-dev: available`.
105
+ - If both not configured, design stage proceeds with manual component build.
@@ -0,0 +1,137 @@
1
+ # paper.design MCP — Connection Specification
2
+
3
+ This file is the connection specification for paper.design within the get-design-done pipeline. paper.design is a canvas tool — it treats the design canvas as both source AND destination, enabling a full canvas→code→verify→canvas round-trip. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ ## Setup
8
+
9
+ ### Prerequisites
10
+ - A paper.design account
11
+ - paper.design MCP server registered in your Claude Code session
12
+
13
+ ### Install command (Claude Code)
14
+
15
+ ```bash
16
+ claude mcp add paper-design --transport http https://mcp.paper.design/sse
17
+ ```
18
+
19
+ After running this command, restart the Claude Code session.
20
+
21
+ ### Verification
22
+
23
+ ```
24
+ ToolSearch({ query: "mcp__paper", max_results: 5 })
25
+ ```
26
+
27
+ Expect non-empty results including `mcp__paper-design__get_selection` or similar. If empty, re-run the install command above and restart the Claude Code session.
28
+
29
+ ### Budget
30
+
31
+ paper.design **free tier**: 100 MCP calls/week. Pro tier: 1M calls/week. The pipeline tracks `budget_used` in STATE.md `<connections>` and warns at 90 calls.
32
+
33
+ ---
34
+
35
+ ## Probe Pattern
36
+
37
+ ```
38
+ ToolSearch({ query: "mcp__paper", max_results: 5 })
39
+ → Empty → paper-design: not_configured (skip all paper.design steps)
40
+ → Non-empty → proceed to live call
41
+
42
+ call mcp__paper-design__get_selection
43
+ → Success → paper-design: available
44
+ → Error → paper-design: unavailable
45
+ ```
46
+
47
+ Write result to STATE.md `<connections>`: `paper-design: <status>`
48
+
49
+ Also write initial budget state:
50
+ ```xml
51
+ <connections>
52
+ paper-design: available | budget_used: 0 | budget_limit: 100
53
+ </connections>
54
+ ```
55
+
56
+ ---
57
+
58
+ ## paper.design MCP Tools
59
+
60
+ | Tool | Stage | Purpose |
61
+ |------|-------|---------|
62
+ | `mcp__paper-design__get_selection` | explore | JSON of selected canvas elements (id, type, name, bounds) |
63
+ | `mcp__paper-design__get_jsx` | explore | React JSX string of selected component tree |
64
+ | `mcp__paper-design__get_computed_styles` | explore | CSS computed styles for current selection |
65
+ | `mcp__paper-design__get_screenshot` | verify | Base64 PNG screenshot of selected canvas element |
66
+ | `mcp__paper-design__add_comment` | design | Add annotation comment to a canvas node |
67
+ | `mcp__paper-design__update_styles` | design | Update CSS properties of a canvas node |
68
+ | `mcp__paper-design__set_text_content` | design | Write text content to a canvas text layer |
69
+ | `mcp__paper-design__write_html` | design | Write HTML snippet to a canvas layer |
70
+
71
+ ---
72
+
73
+ ## Pipeline Integration
74
+
75
+ | Stage | What paper.design provides |
76
+ |-------|---------------------------|
77
+ | explore | Canvas read: `get_selection` (node list), `get_jsx` (React component tree), `get_computed_styles` (CSS values) → merged into DESIGN-CONTEXT.md |
78
+ | design | `design-paper-writer` agent: annotate / tokenize / roundtrip modes via write tools |
79
+ | verify | `get_screenshot` for components flagged `? VISUAL` — element-scoped (complements route-scoped Preview screenshots) |
80
+
81
+ ### Canvas Read (Explore Stage)
82
+
83
+ The explore stage context-builder reads the paper.design canvas via:
84
+
85
+ 1. `mcp__paper-design__get_selection` — get selected element IDs and names
86
+ 2. `mcp__paper-design__get_jsx` — get full React component tree of selection
87
+ 3. `mcp__paper-design__get_computed_styles` — get computed CSS values
88
+
89
+ Results are merged into DESIGN-CONTEXT.md as a `<canvas_sources>` block alongside Figma variables, Refero refs, and other sources.
90
+
91
+ ### Write-Back (Design Stage)
92
+
93
+ The `design-paper-writer` agent handles write-back in three modes:
94
+ - **annotate** — add design-decision comments to canvas nodes (`add_comment`)
95
+ - **tokenize** — sync CSS token values to paper.design node styles (`update_styles`)
96
+ - **roundtrip** — write implementation status back as text/HTML layers (`set_text_content`, `write_html`)
97
+
98
+ All writes require user confirmation via proposal→confirm flow. See `agents/design-paper-writer.md`.
99
+
100
+ ### Screenshot Verification (Verify Stage)
101
+
102
+ `mcp__paper-design__get_screenshot(node_id)` captures a PNG of a specific canvas element.
103
+
104
+ - Canvas-element-scoped (NOT route-scoped like Phase 8 Preview)
105
+ - Both are complementary: paper.design → canvas component view; Preview → rendered browser route
106
+ - Screenshots saved to `.design/screenshots/paper-<component>-<date>.png`
107
+
108
+ ---
109
+
110
+ ## Budget Tracking
111
+
112
+ After every write tool call, increment `budget_used` in STATE.md:
113
+
114
+ ```xml
115
+ <connections>
116
+ paper-design: available | budget_used: 12 | budget_limit: 100
117
+ </connections>
118
+ ```
119
+
120
+ Warn when `budget_used >= 90`: `Warning: paper.design budget at 90/100 calls this week.`
121
+
122
+ Read tools (`get_selection`, `get_jsx`, `get_computed_styles`, `get_screenshot`) also consume budget — track them as well.
123
+
124
+ ---
125
+
126
+ ## Fallback Behavior
127
+
128
+ When `paper-design: not_configured`:
129
+ - Skip all paper.design steps. Print: `paper.design not configured — canvas integration skipped.`
130
+ - Explore stage proceeds with code-only context (grep + Figma + Storybook if available).
131
+ - Verify stage uses Preview screenshots only (no canvas-element screenshots).
132
+ - Design stage does not offer paper-writer.
133
+
134
+ When `paper-design: unavailable`:
135
+ - Update STATE.md to `paper-design: unavailable`.
136
+ - Print: `paper.design unavailable — check MCP connection and try again.`
137
+ - Degrade as above.
@@ -0,0 +1,88 @@
1
+ # pencil.dev — Connection Specification
2
+
3
+ This file is the connection specification for pencil.dev within the get-design-done pipeline. pencil.dev uses git-tracked `.pen` files as its source of truth — no MCP server is required. See `connections/connections.md` for the full connection index and capability matrix.
4
+
5
+ ---
6
+
7
+ ## Setup
8
+
9
+ ### Prerequisites
10
+ - pencil.dev VS Code or Cursor extension installed from the marketplace
11
+ - One or more `.pen` files in the project (typically at project root or in `src/`)
12
+
13
+ ### Verification
14
+
15
+ Run in the project directory:
16
+ ```bash
17
+ find . -name "*.pen" -not -path "*/node_modules/*" | head -5
18
+ ```
19
+ One or more results = pencil.dev is in use.
20
+
21
+ No MCP server install needed — the pipeline reads and writes `.pen` files directly via standard file tools.
22
+
23
+ ---
24
+
25
+ ## Probe Pattern
26
+
27
+ pencil.dev does not use MCP tools. Probe is file-based.
28
+
29
+ ```bash
30
+ PEN_FILES=$(find . -name "*.pen" -not -path "*/node_modules/*" 2>/dev/null)
31
+ if [ -n "$PEN_FILES" ]; then
32
+ echo "pencil-dev: available"
33
+ else
34
+ echo "pencil-dev: not_configured"
35
+ fi
36
+ ```
37
+
38
+ Write result to STATE.md `<connections>`: `pencil-dev: available` or `pencil-dev: not_configured`.
39
+
40
+ ---
41
+
42
+ ## .pen File Format
43
+
44
+ `.pen` files are YAML-front-matter component specs:
45
+
46
+ ```yaml
47
+ ---
48
+ component: Button
49
+ variant: primary
50
+ state: default
51
+ design-tokens:
52
+ bg: brand-primary-500
53
+ text: white
54
+ radius: 6px
55
+ padding: "8px 16px"
56
+ ---
57
+
58
+ Notes: Primary CTA button. Use for the main action in any modal or form.
59
+ ```
60
+
61
+ - `component` — component name (must match the implementation filename)
62
+ - `variant` — variant label (matches Storybook story name where applicable)
63
+ - `state` — `default | hover | focus | disabled | error`
64
+ - `design-tokens` — key/value map of token names to values (CSS variables or literal values)
65
+ - Body prose — optional implementation notes
66
+
67
+ `.pen` files are **git-tracked source of truth**. Commits to `.pen` files must be atomic — spec and implementation changes committed together when possible.
68
+
69
+ ---
70
+
71
+ ## Pipeline Integration
72
+
73
+ | Stage | What pencil.dev provides |
74
+ |-------|--------------------------|
75
+ | explore | `.pen` file discovery; synthesizer merges `.pen` declarations with code grep results |
76
+ | verify | Spec-vs-implementation diff: `.pen` declared token values vs. actual token values in code |
77
+ | design | `design-pencil-writer` agent: annotate + roundtrip modes; atomic git commits on `.pen` writes |
78
+
79
+ **Architectural advantage:** Both the design spec (`.pen` file) and implementation (source code) are version-controlled. Pre-merge diff verification is uniquely strong compared to tools where the design lives outside git.
80
+
81
+ ---
82
+
83
+ ## Fallback Behavior
84
+
85
+ When `pencil-dev: not_configured`:
86
+ - All pencil.dev steps are skipped silently.
87
+ - A one-line diagnostic is printed: `pencil.dev not configured — no .pen files found.`
88
+ - Pipeline continues normally.