@atezer/figma-mcp-bridge 1.7.30 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +408 -0
  2. package/README.md +8 -8
  3. package/agents/_orchestrator-protocol.md +185 -0
  4. package/agents/ds-auditor.md +73 -22
  5. package/agents/screen-builder.md +60 -22
  6. package/agents/token-syncer.md +63 -19
  7. package/dist/core/code-warnings.d.ts +38 -0
  8. package/dist/core/code-warnings.d.ts.map +1 -0
  9. package/dist/core/code-warnings.js +191 -0
  10. package/dist/core/code-warnings.js.map +1 -0
  11. package/dist/core/device-presets.d.ts +49 -0
  12. package/dist/core/device-presets.d.ts.map +1 -0
  13. package/dist/core/device-presets.js +141 -0
  14. package/dist/core/device-presets.js.map +1 -0
  15. package/dist/core/instructions.d.ts +4 -2
  16. package/dist/core/instructions.d.ts.map +1 -1
  17. package/dist/core/instructions.js +239 -29
  18. package/dist/core/instructions.js.map +1 -1
  19. package/dist/core/plugin-bridge-connector.d.ts +26 -0
  20. package/dist/core/plugin-bridge-connector.d.ts.map +1 -1
  21. package/dist/core/plugin-bridge-connector.js +18 -2
  22. package/dist/core/plugin-bridge-connector.js.map +1 -1
  23. package/dist/core/plugin-bridge-server.d.ts +16 -0
  24. package/dist/core/plugin-bridge-server.d.ts.map +1 -1
  25. package/dist/core/plugin-bridge-server.js +83 -1
  26. package/dist/core/plugin-bridge-server.js.map +1 -1
  27. package/dist/core/response-guard.d.ts +23 -0
  28. package/dist/core/response-guard.d.ts.map +1 -1
  29. package/dist/core/response-guard.js +113 -0
  30. package/dist/core/response-guard.js.map +1 -1
  31. package/dist/core/version.d.ts +1 -1
  32. package/dist/core/version.d.ts.map +1 -1
  33. package/dist/core/version.js +1 -1
  34. package/dist/core/version.js.map +1 -1
  35. package/dist/local-plugin-only.d.ts.map +1 -1
  36. package/dist/local-plugin-only.js +334 -101
  37. package/dist/local-plugin-only.js.map +1 -1
  38. package/f-mcp-plugin/code.js +514 -29
  39. package/f-mcp-plugin/ui.html +90 -14
  40. package/package.json +1 -1
  41. package/skills/SKILL_INDEX.md +13 -1
  42. package/skills/apply-figma-design-system/SKILL.md +37 -0
  43. package/skills/audit-figma-design-system/SKILL.md +38 -0
  44. package/skills/code-design-mapper/SKILL.md +37 -0
  45. package/skills/design-token-pipeline/SKILL.md +44 -0
  46. package/skills/figma-canvas-ops/SKILL.md +200 -243
  47. package/skills/fmcp-ds-audit-orchestrator/SKILL.md +205 -0
  48. package/skills/fmcp-intent-router/SKILL.md +574 -0
  49. package/skills/fmcp-screen-orchestrator/SKILL.md +166 -0
  50. package/skills/fmcp-screen-recipes/SKILL.md +528 -0
  51. package/skills/fmcp-token-sync-orchestrator/SKILL.md +198 -0
  52. package/skills/generate-figma-library/SKILL.md +38 -0
  53. package/skills/generate-figma-screen/SKILL.md +360 -6
  54. package/skills/implement-design/SKILL.md +32 -0
  55. package/skills/inspiration-intake/SKILL.md +220 -0
  56. package/skills/visual-qa-compare/SKILL.md +33 -0
package/CHANGELOG.md CHANGED
@@ -12,6 +12,414 @@ Bu dosya [Keep a Changelog](https://keepachangelog.com/tr/1.1.0/) biçimine uygu
12
12
 
13
13
  Bu changelog'a ekleme öncesi sürümlerin tam ayrıntıları için `git log` kullanılabilir.
14
14
 
15
+ ## [1.9.1] - 2026-04-17
16
+
17
+ ### Plugin Multi-Bridge Discovery — Server-Side (Console Errors Tamamen Giderildi)
18
+
19
+ Plugin DevTools console'unda görülen 22+ `WebSocket connection to ws://localhost:5458-5470/ failed: net::ERR_CONNECTION_REFUSED` hataları v1.9.1 ile **tamamen giderildi**. Plugin artık blind port scan yapmıyor; server'ın probe ettiği aktif bridge listesini kullanıyor.
20
+
21
+ **Server tarafı (yeni — `src/core/plugin-bridge-server.ts`):**
22
+
23
+ - `probeSiblingBridges()` metodu eklendi: 5454-5470 aralığını paralel probe eder, aktif fmcp bridge'leri tespit eder (mevcut `probePort` + `probeStatus` yeniden kullanılır)
24
+ - Startup'ta initial probe (background, non-blocking) + 30 saniyede bir periyodik refresh
25
+ - Welcome mesajına `activeBridges: number[]` field'ı eklendi (cache'ten, 0ms overhead)
26
+ - Sibling değişikliklerinde `activeBridgesUpdate` push mesajı tüm bağlı plugin client'larına broadcast edilir
27
+ - `stop()` içinde sibling probe interval temizlenir
28
+
29
+ **Plugin tarafı (`f-mcp-plugin/ui.html`):**
30
+
31
+ - Welcome handler: `msg.activeBridges` varsa sadece listed portlara `connectToExtraPort` çağırır, `scanOtherPorts` ve periyodik timer ÇAĞRILMAZ → console'da 0 `ERR_CONNECTION_REFUSED`. Field yoksa fallback olarak eski scan davranışı korunur (backward compat)
32
+ - Yeni `activeBridgesUpdate` push handler: server yeni sibling keşfettiğinde otomatik ek port'lara bağlanır (30s içinde)
33
+ - `switchActivePort()` bug fix: `mcpBridgeWs` ve `mcpConnectedPort` değişikliği kaldırıldı. Önceki kod main connection'ın response routing'ini bozuyordu (switch sonrası main'den gelen istekler yanlış porta cevap veriyordu). Artık switch sadece UI "aktif port" göstergesi için kullanılır; her connection kendi closure ws'inde (ui.html:1682, 1866) paralel çalışır
34
+
35
+ **Backward Compatibility:**
36
+
37
+ | Server | Plugin | Davranış |
38
+ |--------|--------|----------|
39
+ | v1.9.1 | v1.9.1 | Server `activeBridges` gönderir, plugin sadece listed'a bağlanır — **0 console error** |
40
+ | v1.9.0 | v1.9.1 | Welcome'de field yok, plugin fallback scan — eski davranış (~22 error) |
41
+ | v1.9.1 | v1.9.0 | Server field gönderir, plugin ignore eder, fallback scan — eski davranış |
42
+ | v1.9.0 | v1.9.0 | Hiç değişmemiş |
43
+
44
+ **Fonksiyonel Kazanımlar:**
45
+
46
+ - Multi-client routing (Claude + Cursor + Windsurf aynı anda): aynen çalışır, her connection bağımsız closure ws
47
+ - Port label + ◀▶ switch butonları: aynen çalışır (artık daha doğru, routing'i bozmadan)
48
+ - `mcpConnections` Map: aktif kullanımda kalır (response routing için)
49
+ - Yeni MCP process başlatıldığında plugin otomatik keşfeder (30s içinde, eskiden plugin restart gerekiyordu)
50
+ - Welcome hızlı: cache'ten 0ms overhead (background probe startup'ta paralel yapılır)
51
+
52
+ **Dokümanlar:**
53
+
54
+ - `docs/TROUBLESHOOTING.md`: v1.9.1+ için "console hatası yok" notu, eski sürümler için `-WebSocket` filter talimatı
55
+ - `docs/MULTI_INSTANCE.md`: yeni server-side discovery yaklaşımı belgelendi
56
+
57
+ ## [1.9.0] - 2026-04-17
58
+
59
+ ### Kural Enflasyonu Temizliği + Bridge Crash Koruması + SUI Cache
60
+
61
+ 5 ardışık testten (FP-1-R serisi) elde edilen bulgularla yapılan kapsamlı temizlik. Skill dosyaları %57 küçültüldü, plugin tarafında büyük component set'lerin bridge'i kilitlemesi engellendi, SUI cache altyapısı eklendi.
62
+
63
+ **Skill Compaction — 2298 → 979 satır (%57 azalma, ~10K token tasarruf):**
64
+
65
+ - `skills/fmcp-screen-recipes/SKILL.md` — 1090 → 528 satır
66
+ - Devre dışı bırakılmış Adım 3 (breakpoint bind) ve Adım 4a (collection enum NO-OP) uzun açıklamaları 1 satıra indirildi
67
+ - v1.9.x tarihçe anlatıları, FP-1-R test narratifleri, "neden" blokları kaldırıldı
68
+ - Execute 1 kod bloğu Türkçe comment'leri temizlenip sıkıştırıldı
69
+ - 8 recipe'ye (Login, Profile, List, Detail, Form, Onboarding, Dashboard, Settings) explicit `setProperties` override listesi eklendi — Payment v2.0.1'de yapılan düzeltme diğer recipe'lere de yayıldı
70
+ - Known Limitations, Tool Chunking Rules, Evolution Triggers bölümleri kompaktlandı
71
+
72
+ - `skills/figma-canvas-ops/SKILL.md` — 805 → 285 satır
73
+ - Rule 22 async API tablosu Rule 2'ye taşındı, wrapper prose silindi
74
+ - Rule 23 (style import fail) 38 satırlık kod bloğu 15 satırlık try-catch iskeletine indirildi
75
+ - Rule 25 (validate timeout) 3 seviyeli fallback 10 satıra kısaltıldı, timeout gerekçesi tarihçesi silindi
76
+ - Rule 26 (component discovery) NavigationTopBar örnek çıktısı silindi, Text Style Discovery recipes Adım 1.6'ya cross-reference ile değiştirildi
77
+ - Rule 5a'daki timeout değeri "5000ms" → "15000ms" (gerçek koda uyumlu)
78
+ - Auto-layout, Component, Variable pattern'leri kompaktlandı
79
+
80
+ - `skills/fmcp-screen-orchestrator/SKILL.md` — 403 → 166 satır
81
+ - Advanced section %60 kısaltıldı — Detay 1.0 Inspiration Handoff JSON schema örneği, Detay 6 Claude Web satırı, Detay 7 Verification Checklist Self-Audit Gate'e taşındı
82
+ - Filesystem MCP direktifi 17 → 5 satır, Resmi Figma MCP yasağı 17 → 8 satır
83
+
84
+ **Bridge Crash Koruması:**
85
+
86
+ - `f-mcp-plugin/code.js:extractComponentSetData` — `MAX_VARIANTS = 50` guard eklendi. SUI Button (336 variant) gibi büyük component set'lerin children iterasyonu ilk 50 ile sınırlandırıldı. Response'a `_totalVariantCount` ve `_truncated` metadata alanları eklendi. 4+ dakika bridge timeout ve plugin crash riski ortadan kaldırıldı.
87
+ - `f-mcp-plugin/code.js:extractComponentData` + componentSetData properties bloğu — `MAX_PROPERTIES = 100` guard eklendi. `componentPropertyDefinitions` iterasyonu property sayısıyla sınırlandırıldı.
88
+ - `src/local-plugin-only.ts:figma_execute` — Timeout clamp 120s → 30s'ye indirildi. 15 op = ~200ms gerçek test verisi; 30s hâlâ çok bol. Yüksek timeout'lar artık bridge hang'lerini maskeleyemez.
89
+
90
+ **Collection Keyword Match Düzeltmesi:**
91
+
92
+ - `skills/fmcp-screen-recipes/SKILL.md:Adım 1.5 Execute 1` — `findColl(["semantic color", "s theme", "theme"])` içindeki jenerik `"theme"` fallback keyword'ü kaldırıldı. SUI dışı DS collection'larının yanlışlıkla match edip her testte 1 ek düzeltme execute'u harcamasına neden oluyordu. `"s theme"` SUI'nin "S Theme Colors" collection'ını zaten tam olarak yakalar.
93
+
94
+ **SUI Component Key Cache Altyapısı (yeni):**
95
+
96
+ - `.claude/design-systems/sui/components.md` (yeni) — component key cache şablonu. NavigationTopBar, Button, Divider_H, TextField, Card, Avatar, ListItem, SearchBar, Chip, BottomNavBar için slot'lar. Recipes Adım 6 bu dosyayı önce okur; cache varsa (< 7 gün) `figma_search_assets` çağrısını atlar, direkt `importComponentByKeyAsync(key)` kullanır.
97
+ - `.claude/design-systems/sui/tokens.md` (yeni) — spacing token'ları, collection info (S Theme Colors, Semantic Sizes), surface background için cache şablonu. Recipes Adım 1.5 bu cache'i önce okur, fresh ise token discovery'yi komple atlar.
98
+
99
+ **Beklenen Etkiler:**
100
+
101
+ - Claude Desktop'ta her recipe çağrısı için okunacak skill yükü ~25K → ~12K token (%52 azalma, ~10K token/oturum)
102
+ - SUI gibi büyük library'lerle çalışırken bridge crash riski sıfıra yakın (variant/property guard)
103
+ - Fast Path recipe süresi hedefi: 30+ dk → 10-12 dk (cache-first + skill compaction etkisi bir arada)
104
+ - Collection/component discovery için harcanan execute sayısı: -2 ile -3 arası (cache hit durumunda)
105
+
106
+ **Dokunulmayanlar (kasıtlı):**
107
+
108
+ - `skills/generate-figma-screen/SKILL.md` (v1.8.x full workflow korundu)
109
+ - `skills/inspiration-intake/SKILL.md`, `skills/fmcp-intent-router/SKILL.md`
110
+ - `agents/*.md` delegator'lar
111
+ - `f-mcp-plugin/ui.html` port scanning mantığı (v1.9.6 throttle'ı zaten yeterli)
112
+
113
+ ## [1.8.2] - 2026-04-14
114
+
115
+ ### DS Discipline Hotfix — Clone Tool Narrow Use + Build-from-Scratch Enforcement
116
+
117
+ Hotfix for v1.8.1 live test findings. The root cause of "Claude produces 3 identical clones instead of 3 distinct alternatives" was diagnosed, validated against live Figma data, and fixed across 4 layers (plugin performance + static analysis + SKILL + instructions).
118
+
119
+ **Live test evidence (what v1.8.1 did wrong):**
120
+ - User requested "3 alternatives" (Hero Card / Liste Odaklı / Dark Header)
121
+ - Claude used `figma_clone_screen_to_device` as shortcut → cloned benchmark 3 times → renamed → "done"
122
+ - All 3 "alternatives" turned out **byte-for-byte identical** (same 14 children, same 3 SUI instances, zero layout variation)
123
+ - Claude picked the **wrong benchmark** (139:3678 "Hesaplarım" draft with 14 children + `_childrenTruncated: 9`) instead of the ready-to-use `169:1917 v10 Hero Card` (4 clean children)
124
+ - Clone timed out repeatedly (30s too short), leaving **7 orphan duplicates** in the file
125
+ - `getNodeById` sync call hit dynamic-page error (Claude had no warning)
126
+ - Validate timed out too (30s + serial `await getMainComponentAsync` on every instance)
127
+
128
+ **Phase 14A — Plugin Performance Fix:**
129
+ - `f-mcp-plugin/ui.html` — `cloneScreenToDevice` timeout 30s → **120s**, `validateScreen` timeout 30s → **90s**
130
+ - `f-mcp-plugin/code.js:CLONE_SCREEN_TO_DEVICE` — orphan cleanup on error: if clone was created but resize/reparent failed, `clonedNode.remove()` runs in catch block + `orphanCleanedUp: true` flag in response
131
+ - `f-mcp-plugin/code.js:CLONE_SCREEN_TO_DEVICE` — warn when source has 20+ children (likely timeout candidate)
132
+ - `f-mcp-plugin/code.js:VALIDATE_SCREEN` — **Pass 2 batch optimization**: first pass collects instances serially using sync `mainComponent`, deferred instances batch-resolve via `Promise.all([getMainComponentAsync()...])` in Pass 2. ~10x faster for 100+ node trees (60s → 5s typical).
133
+
134
+ **Phase 14B — Static Analysis Expansion:**
135
+ - `src/core/code-warnings.ts` — 5 new SYNC_API patterns added (v1.8.2 dynamic-page fixes):
136
+ - `figma.getNodeById(` → `figma.getNodeByIdAsync(`
137
+ - `figma.getStyleById(` → `figma.getStyleByIdAsync(`
138
+ - `figma.variables.getVariableById(` → `figma.variables.getVariableByIdAsync(`
139
+ - `figma.variables.getVariableCollectionById(` → `figma.variables.getVariableCollectionByIdAsync(`
140
+ - `figma.importComponentByKey(` → `figma.importComponentByKeyAsync(`
141
+ - `tests/core/code-warnings.test.ts` — **6 new unit tests** (test count 77 → 83)
142
+ - Now Claude's `figma_execute` code is statically checked for the common `Cannot call with documentAccess: dynamic-page` failure BEFORE it runs.
143
+
144
+ **Phase 14C — SKILL Recovery + Benchmark Validation:**
145
+ - `skills/fmcp-intent-router/SKILL.md` — New section **"Tool Failure Recovery Protocol"**:
146
+ - Retry rules: max 1 retry with different params, then STOP and ask user
147
+ - Orphan cleanup mandate: `figma_get_file_data` → detect orphans → list to user → delete with consent
148
+ - Failure Escalation Template (retries exhausted → user choice menu)
149
+ - `skills/fmcp-intent-router/SKILL.md` — New section **"Benchmark Selection Validation"**:
150
+ - If node.type === PAGE → list child alternatives, ask user which one
151
+ - If FRAME childCount > 15 → warn about timeout risk
152
+ - If FRAME childCount > 25 → REFUSE auto-selection, force user choice
153
+ - Sibling scan: look for `v10`, `v11`, `alternative`, `variant` keywords and suggest cleaner alternatives
154
+ - Responsive pre-check: warn if benchmark has `layoutMode === NONE`
155
+ - `skills/generate-figma-screen/SKILL.md` — New **Step 6.6: Inter-Screen Checkpoint Gate + Turn Budget**:
156
+ - 90s per-turn time limit
157
+ - Max 2 failed tool calls per turn
158
+ - Each alternative = separate turn (NO multi-alternative in single turn)
159
+ - Mandatory AskUserQuestion checkpoint after each turn ([Beğendim/Revize/Dur])
160
+ - `src/core/instructions.ts` — New **"TOOL FAILURE RECOVERY"** section with retry/cleanup/turn-budget rules
161
+
162
+ **Phase 14F REVIZE — Clone Tool Narrow Use + Build-from-Scratch (EN KRITIK):**
163
+
164
+ Paradigma düzeltmesi kullanıcıdan geldi:
165
+ > "Mevcut benchmark her zaman fikir olsun diye var ama sen doğrusunu yapmakla yükümlüsün. Responsive, auto-layout'lu, tasarım sistemine uygun — skillerindeki tüm gereksinimleri uygulamış olmalısın."
166
+
167
+ Claude v1.8.1'de `figma_clone_screen_to_device` tool'unu **shortcut** olarak kullandı. Clone, benchmark'ın mevcut yanlışlıklarını (hardcoded rectangle, missing token binding, non-responsive layout) kopyaladı. Sonuç: **3 identik "alternatif"**.
168
+
169
+ v1.8.2 bu tool'un kullanımını **4 katmanda** sertleştirdi:
170
+
171
+ 1. **Tool description sertleştirildi** (`src/local-plugin-only.ts`):
172
+ ```
173
+ ⚠️ NARROW USE CASE — Device migration ONLY.
174
+ USE ONLY WHEN: same DS + same layout + only size changes.
175
+ DO NOT USE FOR: creating alternatives, variations, or new designs.
176
+ If the user says 'alternatif', 'varyasyon', 'farklı', 'yeni', 'tasarla'
177
+ — USE figma_execute + Step 5, NOT this tool.
178
+ Benchmark is INSPIRATION, not a copy source for variations.
179
+ Clone copies benchmark's EXISTING mistakes.
180
+ ```
181
+
182
+ 2. **`skills/generate-figma-screen/SKILL.md`** — New **Step 3.5: Clone Tool'u Tuzağı**:
183
+ - Decision matrix: user request → correct tool
184
+ - "alternatif/varyasyon/farklı/yeni/tasarla/iyileştir/redesign" → BUILD, NOT CLONE
185
+ - Build-from-scratch flow documented (search_assets → instantiate_component → setBoundVariable → auto-layout FILL)
186
+
187
+ 3. **`skills/generate-figma-screen/SKILL.md`** — New **Step 5.17: Quality Gate**:
188
+ - Mandatory 12-item checklist after each section creation
189
+ - Covers: layoutMode, primaryAxisSizingMode, counterAxisSizingMode, fill bindings, padding bindings, itemSpacing binding, cornerRadius binding, setTextStyleIdAsync, DS instance count, layoutSizingHorizontal = FILL
190
+ - Fail → delete section, rewrite complying with all rules
191
+ - Automatic JS-level check example provided
192
+
193
+ 4. **`skills/fmcp-intent-router/SKILL.md`** — New **Adım 3b: Approach Karar Mantığı**:
194
+ - Keyword detection table: "alternatif/varyasyon/..." → `approach = build-from-scratch` (DEFAULT)
195
+ - "migrate/boyut/klonla" → `approach = clone-to-device`
196
+ - "hizala/tokenize" → `approach = apply-ds-to-existing`
197
+ - Summary screen shows chosen approach explicitly: "Clone tool kullanılmayacak çünkü alternatif istenmiş"
198
+
199
+ 5. **`src/core/instructions.ts`** — New **"CLONE vs BUILD DECISION"** section (v1.8.2+ CRITICAL):
200
+ - Explicit rule list with example user phrases
201
+ - "Benchmark is ALWAYS inspiration, never a copy source for alternatives"
202
+ - Critical rule enforced at session-start instructions level
203
+
204
+ **Phase 14G — Orphan Cleanup (canlı dosya):**
205
+
206
+ v1.8.1 test session'ından dosyada kalan **7 orphan node silindi**:
207
+ - 6 duplicate "Hesaplarım — Hero Card — iPhone 17" frame (`175:12172`, `175:12302`, `176:12751`, `176:13011`, `176:13510`, `176:13511`)
208
+ - 1 orphan "iOS & Android Status Bars" instance (`176:13512`)
209
+
210
+ Cleanup `figma_execute` ile yapıldı, tümü başarılı: `removed: 7/7, failed: 0`.
211
+
212
+ **Files changed (v1.8.2 total):**
213
+ - `src/core/code-warnings.ts` — 5 new SYNC_API patterns
214
+ - `tests/core/code-warnings.test.ts` — 6 new unit tests
215
+ - `src/core/instructions.ts` — CLONE vs BUILD DECISION + TOOL FAILURE RECOVERY
216
+ - `src/local-plugin-only.ts` — figma_clone_screen_to_device description sertleştirme
217
+ - `f-mcp-plugin/code.js` — CLONE_SCREEN_TO_DEVICE cleanup + VALIDATE_SCREEN Pass 2 batch + FMCP_PLUGIN_VERSION='1.8.2'
218
+ - `f-mcp-plugin/ui.html` — timeout 30s→120s + 30s→90s + FMCP_PLUGIN_VERSION='1.8.2'
219
+ - `skills/fmcp-intent-router/SKILL.md` — Tool Failure Recovery + Benchmark Selection Validation + Adım 3b Approach Decision
220
+ - `skills/generate-figma-screen/SKILL.md` — Step 3.5 Clone Tuzağı + Step 5.17 Quality Gate + Step 6.6 Turn Budget
221
+ - `package.json` + `src/core/version.ts` — 1.8.1 → 1.8.2
222
+
223
+ **Test coverage:** 83/83 passing (47 eski + 30 Phase 12A + 6 Phase 14B). Build clean, type-check clean.
224
+
225
+ **Backwards compatibility:** 100% additive. All v1.8.1 tools still work; `figma_clone_screen_to_device` description changed but API unchanged. No breaking changes.
226
+
227
+ **Migration from v1.8.1:**
228
+ 1. Reinstall Figma plugin from `f-mcp-plugin/` (new handlers require v1.8.2 plugin)
229
+ 2. Restart Claude Desktop (new `FMCP_INSTRUCTIONS` loads on session start)
230
+ 3. New test prompt: "alternatif" keyword triggers build-from-scratch automatically (no prompt changes needed)
231
+
232
+ **Expected v1.8.2 test result:**
233
+ - `figma_clone_screen_to_device` NOT called for alternatives
234
+ - Claude uses `figma_execute` + Step 4-5 build pattern
235
+ - Each alternative is ACTUALLY different (different layouts, different token usage)
236
+ - Each turn has a user checkpoint
237
+ - 0 orphans, 0 timeouts
238
+ - Total time ≤ 5 minutes for 3 alternatives
239
+
240
+ **Referenced plan:** `.claude/plans/compressed-wondering-lynx.md` (Phases 14A, 14B, 14C, 14F REVIZE, 14G)
241
+
242
+ ## [1.8.1] - 2026-04-14
243
+
244
+ ### DS Discipline Enforcement + Intent Router + High-Level Screen Tools
245
+
246
+ Root cause fix for "Claude ignores SUI tokens and builds screens from scratch". v1.8.0 added SKILL-level "MUTLAK ZORUNLU" wording but Claude still bypassed it on simple "ekran yap" requests. v1.8.1 combines three independent layers of enforcement:
247
+
248
+ 1. **Proaktif** — `figma_execute` code is statically analyzed for hardcoded colors/paddings/typography + no-instance usage; violations surface as `_designSystemViolations` banner Claude cannot ignore
249
+ 2. **Upstream** — `fmcp-intent-router` meta-SKILL forces Claude to gather missing inputs + obtain explicit confirmation BEFORE executing any write tool
250
+ 3. **Hızlı ve doğru kısayol** — `figma_clone_screen_to_device` + `figma_validate_screen` replace 100+ lines of hand-written `figma_execute` with 1 tool call each
251
+
252
+ **Phase 12A — Static Analysis Enforcement:**
253
+ - New module `src/core/code-warnings.ts` (extracted from `local-plugin-only.ts` for testability + single responsibility)
254
+ - `CodeWarning` type with `SEVERE | ADVISORY` severity split
255
+ - 6 new SEVERE categories: `HARDCODED_COLOR`, `NO_INSTANCE_USAGE`, `HARDCODED_FONT_SIZE`, `HARDCODED_SPACING`, `HAND_BUILT_SEPARATORS`, `NO_AUTO_LAYOUT`
256
+ - Preserved 3 ADVISORY categories from v1.8.0: `ORDERING` (FILL/ABSOLUTE before appendChild), `SYNC_API`, `FONT_LOAD`
257
+ - `figma_execute` response shape: SEVERE → `_designSystemViolations` top-level prominent field with `message`, `count`, `violations[]`, `action`. ADVISORY → `_warnings` legacy format
258
+ - Regex patterns detect both multi-line and compact SOLID color literals, `.fontSize = N`, spacing property assignments, `createFrame`/`createRectangle` counts with instance/binding negation
259
+ - 30 new unit tests in `tests/core/code-warnings.test.ts` — positive pattern detection + false-positive prevention + multi-violation + structural invariants
260
+
261
+ **Phase 13 — Universal Intent Clarification & Skill Routing:**
262
+ - New meta-SKILL `skills/fmcp-intent-router/SKILL.md` — 8-step protocol (analyze → state check → decide skill → read required_inputs → gather missing → summary+confirm → execute → persist)
263
+ - Fast path (detailed request skips question gathering), repeat path (single "öncekiyle aynı mı?"), partial reuse path (only changed fields asked)
264
+ - Ambiguity handling: generic request, multi-match, wrong-skill prevention
265
+ - Anti-patterns documented: don't skip confirmation, don't assume defaults, don't execute without routing
266
+ - `required_inputs` YAML metadata added to 8 priority skills:
267
+ - `generate-figma-screen` (device, ds, reference, type, sections, variants)
268
+ - `apply-figma-design-system` (target_scope, target_node, ds, backup, preserve_content, swap_strategy)
269
+ - `audit-figma-design-system` (target_scope, target_node, ds, severity, report_format)
270
+ - `generate-figma-library` (source_type, source_path, library_name, components, tokens, theme_support)
271
+ - `implement-design` (source_node, target_platform, output_dir, tests, existing_components)
272
+ - `code-design-mapper` (direction, figma_component, code_path, platform, output)
273
+ - `visual-qa-compare` (figma_source, rendered_source, rendered_url, threshold, categories)
274
+ - `design-token-pipeline` (direction, target_format, source_path, output_path, token_types, themes)
275
+ - New state files: `.claude/design-systems/last-intent.md` (single most recent intent), `.claude/design-systems/intent-history.md` (LRU 5 — for fast reuse path)
276
+ - `FMCP_INSTRUCTIONS` (src/core/instructions.ts) grew from 137 → ~220 lines: new "INTENT ROUTER ENTRY (ALWAYS FIRST)" section with 8-step protocol + fast/repeat paths + FORBIDDEN list
277
+
278
+ **Phase 12B — `figma_clone_screen_to_device` tool:**
279
+ - Primary answer to "hızlı ve doğru" — clones benchmark screen + adapts to target device dimension + preserves library instances + bound variables + auto-layout
280
+ - 4-layer implementation: MCP tool schema + connector method + plugin handler `CLONE_SCREEN_TO_DEVICE` + ui.html dispatch
281
+ - New `src/core/device-presets.ts` with 22 built-in presets (iPhone 17, iPhone 16 Pro Max, Android Compact, iPad Pro, MacBook Pro, Apple Watch, etc.) + custom "WxH" dimension support
282
+ - Auto-layout resize fix: switch `primaryAxisSizingMode`/`counterAxisSizingMode` from AUTO to FIXED before `resize()` to prevent hug-content no-op
283
+ - Clone counts preserved elements (totalNodes, instanceCount, libraryInstanceCount, boundVariableCount) and returns them in result for Claude to verify
284
+ - Example: `figma_clone_screen_to_device({ sourceNodeId: "139:3407", targetDevice: "iPhone 17" })` → new node with all SUI instances preserved, root resized to 402×874, auto-layout intact
285
+
286
+ **Phase 12D — `figma_validate_screen` tool:**
287
+ - Post-creation audit. Iterative (stack-safe, max 5000 nodes) tree walker computes 3 DS compliance metrics:
288
+ - `instanceCoverage` (library instance usage — normalized 30-100 scale when any library instance exists)
289
+ - `autoLayoutCoverage` (frames with `layoutMode != NONE`)
290
+ - `tokenBindingCoverage` (nodes with `boundVariables` populated)
291
+ - Weighted aggregate score: 40% instances + 30% bindings + 30% layout
292
+ - Returns `{ score, passed, breakdown, violations (capped 20), recommendation }`
293
+ - Read-only — never mutates the file
294
+ - Violation categories: `NO_AUTO_LAYOUT`, `HARDCODED_FILL` (with node ID, name, severity, message)
295
+
296
+ **Phase 12E — `generate-figma-screen` Step 6.5 Self-Audit Mandate:**
297
+ - New ZORUNLU step in SKILL: call `figma_validate_screen` before reporting to user
298
+ - Score ≥ 80 → accept, report breakdown
299
+ - Score 60-79 → read violations, targeted fixes, re-validate
300
+ - Score < 60 → delete screen, rebuild (max 3 attempts)
301
+ - Anti-patterns documented: "screenshot güzel, validate'e gerek yok" (yanlış — token binding gözle görünmez)
302
+ - Fail-after-3 → ask user "elle düzeltmek mi, farklı yaklaşım mı?"
303
+
304
+ **Phase 12F — `figma_create_frame` DS token binding params:**
305
+ - New params: `fillVariableKey`, `paddingVariableKey`, `itemSpacingVariableKey`, `cornerRadiusVariableKey`
306
+ - `fillColor` and `cornerRadius` marked DEPRECATED in schema description — prefer variable keys
307
+ - Plugin execution via `figma.variables.importVariableByKeyAsync` + `setBoundVariableForPaint` (fills) or `setBoundVariable` (spacing/radius)
308
+ - Returns `boundVariableCount` in result so Claude can verify binding worked
309
+ - Graceful fallback: if variable import fails, logs warning and proceeds without binding (caller can retry with correct key)
310
+
311
+ **Files changed (v1.8.1 total):**
312
+ - NEW: `src/core/code-warnings.ts` (analyzeCodeForWarnings + CodeWarning type)
313
+ - NEW: `src/core/device-presets.ts` (22 presets + resolveDevice helper)
314
+ - NEW: `skills/fmcp-intent-router/SKILL.md` (meta-skill, 400+ lines)
315
+ - NEW: `.claude/design-systems/last-intent.md`, `intent-history.md` (state templates)
316
+ - NEW: `tests/core/code-warnings.test.ts` (30 tests)
317
+ - UPDATED: `src/local-plugin-only.ts` (import code-warnings + device-presets, figma_execute SEVERE split, figma_clone_screen_to_device, figma_validate_screen, figma_create_frame variable binding params)
318
+ - UPDATED: `src/core/plugin-bridge-connector.ts` (cloneScreenToDevice, validateScreen methods)
319
+ - UPDATED: `src/core/instructions.ts` (INTENT ROUTER ENTRY section)
320
+ - UPDATED: `f-mcp-plugin/code.js` (CLONE_SCREEN_TO_DEVICE + VALIDATE_SCREEN handlers, FMCP_PLUGIN_VERSION='1.8.1')
321
+ - UPDATED: `f-mcp-plugin/ui.html` (cloneScreenToDevice + validateScreen window functions + method dispatch, FMCP_PLUGIN_VERSION='1.8.1')
322
+ - UPDATED: 8 SKILL files with `required_inputs` metadata (generate-figma-screen, apply-figma-design-system, audit-figma-design-system, generate-figma-library, implement-design, code-design-mapper, visual-qa-compare, design-token-pipeline)
323
+ - UPDATED: `skills/generate-figma-screen/SKILL.md` Step 6.5 Self-Audit Mandate
324
+ - UPDATED: `package.json` + `src/core/version.ts` (1.8.0 → 1.8.1)
325
+
326
+ **Test coverage:**
327
+ - 47 pre-existing tests preserved (regression-free)
328
+ - 30 new code-warnings tests
329
+ - **Total: 77/77 passing**
330
+ - Build: TypeScript strict mode, 0 errors
331
+
332
+ **Backwards compatibility:**
333
+ - No API shape changes. All new tools are additive
334
+ - `fillColor` / `cornerRadius` still work on `figma_create_frame` — just marked DEPRECATED
335
+ - `_warnings` response field preserved for legacy SKILL consumers
336
+ - Plugin v1.8.0 + server v1.8.1: `figma_clone_screen_to_device` and `figma_validate_screen` will return "Unknown message type" until plugin is reinstalled. `figma_get_status` warns about version mismatch
337
+ - `FMCP_LEGACY_DEFAULTS=1` env flag from v1.8.0 still works
338
+
339
+ **Migration from v1.8.0:**
340
+ 1. Reinstall plugin from `f-mcp-plugin/` in Figma (to get CLONE_SCREEN_TO_DEVICE + VALIDATE_SCREEN handlers)
341
+ 2. New Claude sessions will automatically use Intent Router protocol via updated `FMCP_INSTRUCTIONS`
342
+ 3. `figma_execute` calls with hardcoded patterns now show `_designSystemViolations` — Claude will self-correct
343
+
344
+ **Referenced plan:** `.claude/plans/fmcp-v1.8.1-ds-discipline-enforcement.md` (Phases 12A, 12B, 12D, 12E, 12F, 13A, 13B, 13D, 13E)
345
+
346
+ ## [1.8.0] - 2026-04-14
347
+
348
+ ### Context-Safe Defaults + Plugin Response Guard + DS Context Enforcement
349
+
350
+ Major improvement: Claude chat'te F-MCP kullanırken context bloat ve runtime hataları kökünden çözüldü. 1-2 tool çağrısından sonra "This conversation is too long" hatası alan kullanıcılar artık tek session'da tam bir Figma → SUI ekran üretim akışını tamamlayabilir.
351
+
352
+ **Context Bloat Fix'leri (E1 — kritik):**
353
+ - `figma_get_design_context`: default `depth=2 → 1`, `verbosity="standard" → "summary"`. Tipik response 150-400 KB → 5-25 KB. ~%75 token tasarrufu.
354
+ - 3 katmanda eşzamanlı default alignment: MCP zod schema (`local-plugin-only.ts:298-299`) + connector (`plugin-bridge-connector.ts:289-290`) + plugin handler (`f-mcp-plugin/code.js:2587, 2646`). Tek katman update yetersizdi.
355
+ - `figma_capture_screenshot`: default `format="PNG" → "JPG"`, `scale=2 → 1`, yeni `jpegQuality=70` param. Base64 boyutu ~%80 küçüldü. `figma_get_component_image`, `figma_get_component_for_development`, `figma_export_nodes` aynı default'ları kullanıyor.
356
+ - **`truncatePluginResponse`** (yeni `response-guard.ts` fonksiyonu): Plugin response'ları için 4-stage progressive pruning (children cap → effects/boundVariables → fills/strokes → minimal). `PLUGIN_SIZE_THRESHOLDS` (40/80/160/250 KB) — REST limitlerinden çok daha sıkı. Worst-case'i capluyor.
357
+ - `toolResult()` shared envelope helper — okuma tool'larını wrap eder, `_responseGuard` marker ile telemetri sunar.
358
+ - **`ResponseCache` wire-up**: Önceden dormant olan cache (line 200, sadece `invalidateCache()` 19 yerden çağrılıyordu) artık `figma_get_design_context` ve `figma_get_file_data`'da TTL=60s ile aktif. SKILL chain içinde duplicate fetch'leri elimine ediyor. Yeni `debug=true` param cache bypass için.
359
+ - Plugin handler falsy bug fix: `msg.depth || 2` → `msg.depth != null ? msg.depth : 1`. `depth=0` artık doğru iletiliyor.
360
+ - `FMCP_LEGACY_DEFAULTS=1` env var: v1.7.x default'larına geri dönmek için escape hatch (v1.9.0'da kaldırılacak).
361
+
362
+ **Runtime Hata Fix'leri (E2-E7):**
363
+ - **E2 — SHBGrotesk Medium font hatası**: `figma-canvas-ops` Kural 8a-1 eklendi — `figma.listAvailableFontsAsync()` ile available weight check + `pickStyle()` fallback (Medium → Semi Bold → Regular). DS fontlarında "Medium"un yokluğu artık otomatik handle ediliyor.
364
+ - **E3 — `layoutPositioning = ABSOLUTE` parent layoutMode hatası**: `figma-canvas-ops` Kural 11 genişletildi. `appendChild` ÖNCE, `layoutPositioning` SONRA. Yeni `appendAbsolute(child, parent, x, y)` helper pattern dokümante edildi.
365
+ - **E4 — Wrong MCP server selection**: `FMCP_INSTRUCTIONS` (`src/core/instructions.ts`) tamamen yeniden yazıldı. Yeni "TOOL SELECTION" bölümü Claude'a F-MCP plugin bağlıyken resmi Figma MCP `search_design_system`'i çağırmamasını söylüyor. "Resource links not supported" hatası önlendi.
366
+ - **E5 — Frame oluşturma auto-layout eksik**: `figma_create_frame` MCP tool'una auto-layout parametreleri eklendi: `layoutMode` (default `"VERTICAL"`), `paddingTop/Bottom/Left/Right` (default 16), `itemSpacing` (default 12), `primaryAxisSizingMode/counterAxisSizingMode` (default `"AUTO"`), `primaryAxisAlignItems`, `counterAxisAlignItems`, `layoutWrap`. `layoutMode="NONE"` ile legacy free-form frame de mümkün.
367
+ - **E6 — Library bileşen keşfi (SUI Button vb.)**: Plugin handler `SEARCH_LIBRARY_ASSETS` genişletildi. INSTANCE node'larını tarayarak `mainComponent.key` üzerinden remote library bileşenlerini keşfediyor. Yeni `libraryComponents` field ile dönüyor. `figma_search_assets({assetTypes: ['components'], currentPageOnly: false})` artık SUI gibi DS bileşenlerini bulup `figma_instantiate_component` ile kullanılabilir hale getiriyor.
368
+ - **E7 — Token binding eksik**: `figma-canvas-ops` Kural 10 (token binding) MUTLAK ZORUNLU olarak işaretlendi. Pre-flight checklist eklendi (active DS / component cache / token cache / font weights / variable keys). Eğer DS'te token yoksa Claude DURDURUR ve kullanıcıya sorar — sessizce hardcoded fallback YASAK.
369
+
370
+ **DS Context Enforcement (yeni paradigm):**
371
+ - **`.claude/design-systems/active-ds.md`**: Yeni state file. Kullanıcı bir kez DS seçtiğinde burada saklanır, sonraki ekran/bileşen oluşturma akışlarında otomatik kullanılır. "Hangi DS?" sorusu sadece active-ds.md `Status: ❌` ise sorulur.
372
+ - `figma-canvas-ops` SKILL'e **Section 0 — Design System Context** eklendi. Her yazma akışının ilk adımı DS check.
373
+ - `generate-figma-screen` SKILL'e **Step 0 — Aktif DS Kontrolü** eklendi. Cache-First Kuralı ZORUNLU PRE-FLIGHT BLOCKER yapıldı: cache yoksa ekran üretimi başlayamaz.
374
+ - `FMCP_INSTRUCTIONS`'a **DESIGN SYSTEM CONTEXT** bölümü eklendi (Step A-D protokol).
375
+
376
+ **Plugin Handshake Genişlemesi:**
377
+ - WebSocket "ready" mesajına `pluginVersion` field eklendi (`f-mcp-plugin/ui.html:1410, 1710`).
378
+ - `f-mcp-plugin/code.js` ve `ui.html`'e `FMCP_PLUGIN_VERSION = '1.8.0'` sabiti eklendi.
379
+ - `ClientInfo` interface'e `pluginVersion?: string` (`plugin-bridge-server.ts:55-63`).
380
+ - `ConnectedFileInfo` interface'e `pluginVersion: string | null`.
381
+ - `figma_get_status` artık `serverVersion` ve plugin version mismatch warning (`versionWarning` field) döndürüyor. Eski plugin (v1.7.x) + yeni server (v1.8.0) çalışmaya devam eder ama kullanıcıya update öneri gelir.
382
+
383
+ **FMCP_INSTRUCTIONS — Context-Safe Protocol:**
384
+ - "CONTEXT-SAFE PROTOCOL (REQUIRED for Claude chat)" bölümü Claude'a 5 adımlı cheap-first workflow öğretiyor: plugin discovery → structural overview → minimum-verbosity targeting → screenshot only when needed → cache reuse.
385
+ - "TOOL SELECTION" bölümü resmi Figma MCP vs F-MCP eşleşmesini açık yazıyor.
386
+ - "DESIGN SYSTEM CONTEXT (REQUIRED for screen/component creation)" — DS soru protokolü ve token binding zorunluluğu.
387
+ - "COMMON GOTCHAS" — Plugin API'nin 5 yaygın hatası (layoutSizing/layoutPositioning ordering, font weights, setCurrentPageAsync, import reserved word).
388
+
389
+ **Test Coverage:**
390
+ - `tests/core/response-guard.test.ts` 11 yeni test eklendi: `truncatePluginResponse` (8) + `PLUGIN_SIZE_THRESHOLDS` (2). Toplam 47 test, 3 suite, hepsi geçiyor.
391
+ - Coverage: tree pruning (4 stage), envelope handling, custom maxKB, null/primitive handling, _responseGuard marker.
392
+
393
+ **SKILL Güncellemeleri:**
394
+ - `skills/figma-canvas-ops/SKILL.md`: Section 0 DS context check (yeni), Kural 8a-1 font availability check (genişletildi), Kural 10 token binding mutlak zorunluluk (güçlendirildi), Kural 11 layoutPositioning ABSOLUTE (genişletildi), Section 7 hata kurtarma (yeni hata satırları).
395
+ - `skills/generate-figma-screen/SKILL.md`: Step 0 DS check (yeni), Step 3 cache-first ZORUNLU pre-flight blocker (güçlendirildi), Step 3 resmi Figma MCP uyarısı (yeni).
396
+ - `.claude/design-systems/active-ds.md`: Yeni state file şablonu.
397
+
398
+ **Backwards Compatibility:**
399
+ - Default değişiklikleri observable ama API shape değişmedi. Explicit `verbosity="standard"`/`depth=2` geçen caller'lar etkilenmez.
400
+ - `FMCP_LEGACY_DEFAULTS=1` env var: v1.7.x davranışına geri dön (v1.9.0'da kaldırılacak).
401
+ - `debug=true` per-tool param: cache bypass + `_responseGuard` include (eski davranışa benzer).
402
+ - `excludeScreenshot` param schema'da kaldı (SKILL'lerde kullanılıyor) ama plugin handler'ı zaten implement etmiyordu — değişiklik yok.
403
+ - Plugin/server version mismatch'i `figma_get_status` warning ile bildirilir, çalışmaya devam eder.
404
+
405
+ **Kritik Dosya Değişiklikleri:**
406
+ - `src/local-plugin-only.ts`: defaults, helpers (`toolResult`, `makeCacheKey`, `errorResult`), figma_get_design_context+figma_get_file_data cache+truncation wireup, figma_capture_screenshot+component_image+component_for_development+export_nodes screenshot defaults, figma_create_frame auto-layout params, figma_get_status pluginVersion mismatch warning, figma_search_assets description update.
407
+ - `src/core/response-guard.ts`: `PLUGIN_SIZE_THRESHOLDS` constant, `truncatePluginResponse()` with 4-stage progressive pruning, `pruneNodeTree()` helper.
408
+ - `src/core/plugin-bridge-connector.ts`: `getNodeContext` defaults align (`depth ?? 1`, `verbosity ?? "summary"`), `captureScreenshot` `jpegQuality` param.
409
+ - `src/core/plugin-bridge-server.ts`: `ClientInfo.pluginVersion`, `ConnectedFileInfo.pluginVersion`, "ready" handler reads `msg.pluginVersion`, `listConnectedFiles()` returns it.
410
+ - `src/core/instructions.ts`: tamamen yeniden yazıldı — Context-Safe Protocol + Tool Selection + DS Context + Common Gotchas.
411
+ - `src/core/version.ts`: `1.7.30` → `1.8.0`.
412
+ - `package.json`: `1.7.30` → `1.8.0`.
413
+ - `f-mcp-plugin/code.js`: `FMCP_PLUGIN_VERSION = '1.8.0'`, GET_NODE_CONTEXT defaults align, CAPTURE_SCREENSHOT format/scale/jpegQuality defaults, SEARCH_LIBRARY_ASSETS instance scan for library components.
414
+ - `f-mcp-plugin/ui.html`: `FMCP_PLUGIN_VERSION` const, "ready" handshake `pluginVersion` field (2 lokasyon), `captureScreenshot` `jpegQuality` passthrough.
415
+ - `skills/figma-canvas-ops/SKILL.md`, `skills/generate-figma-screen/SKILL.md`, `.claude/design-systems/active-ds.md`.
416
+ - `tests/core/response-guard.test.ts`: 11 yeni test.
417
+
418
+ **Migration:**
419
+ - Yeni server v1.8.0 + eski plugin v1.7.x: çalışır, `figma_get_status` warning gösterir. Plugin'i Figma'da yeniden yükleyin (`f-mcp-plugin/manifest.json`).
420
+ - Eski default'lara dönmek isteyenler: `FMCP_LEGACY_DEFAULTS=1` env var set edin.
421
+ - Per-call cache bypass: tool çağrısına `debug: true` ekleyin.
422
+
15
423
  ## [1.7.30] - 2026-04-14
16
424
 
17
425
  ### SUI Design System Integration — search_assets bridge fix, new library tools, SKILL corrections
package/README.md CHANGED
@@ -127,19 +127,19 @@ Daha fazla: [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)
127
127
 
128
128
  ## Teknik detaylar
129
129
 
130
- - **46 araç**tasarım okuma, bileşen oluşturma, variable yönetimi, export ([tam liste](docs/TOOLS_FULL_LIST.md))
131
- - **20 skill** — token pipeline, ekran üretimi, erişilebilirlik denetimi, kod üretimi, DS denetim ([skill dizini](skills/SKILL_INDEX.md))
132
- - **3 otonom agent** DS denetim, token senkronizasyon, ekran oluşturma (Claude Code)
133
- - **Çoklu dosya + çoklu AI aracı** — Claude, Cursor ve Claude Code aynı anda çalışır
134
- - **Figma Desktop + Tarayıcı** Her ikisinde de çalışır
135
- - **Gizlilik** — Veriler bilgisayarınızdan çıkmaz, internetsiz (air-gap) ortamlarda çalışır
136
- - [Mimari](docs/ARCHITECTURE.md) · [Kurumsal kullanım](docs/ENTERPRISE.md) · [Katkı rehberi](CONTRIBUTING.md)
130
+ - **Ne yapar**Claude veya Cursor'dan Figma'ya ekran tasarlar, tasarım sistemini denetler, renk/yazı/boşluk token'larını yönetir, tasarımı koda hazırlar
131
+ - **Nerelerde çalışır** — Claude Code, Cursor, Claude Desktop, Claude Web ([kurulum rehberleri](install/))
132
+ - **Nasıl çalışır** — Her görev için kendi **skill**'i var (kural seti + örnek). Claude Code'da **agent + sub-agent** yapısı var: ana ajan görevi alır, alt-ajanlar izole çalışır — ana sohbet bağlamı yorulmaz. Cursor ve Claude Desktop'ta aynı skill'ler doğrudan yüklenir (sub-agent yok, tek kaynak 4 platformda)
133
+ - **3 orkestratör** DS denetimi, token senkronizasyonu, ekran üretimi için hazır uçtan uca akışlar ([skill dizini](skills/SKILL_INDEX.md))
134
+ - **Figma** Masaüstü ve tarayıcı, birden fazla AI aynı dosyaya aynı anda bağlanabilir
135
+ - **Gizlilik** — Veriler bilgisayarınızdan çıkmaz, internet bağlantısı olmadan da kullanılabilir
136
+ - **Detay** — [46 araç](docs/TOOLS_FULL_LIST.md) · [24 skill](skills/SKILL_INDEX.md) · [Mimari](docs/ARCHITECTURE.md) · [Kurumsal kullanım](docs/ENTERPRISE.md) · [Katkı rehberi](CONTRIBUTING.md)
137
137
 
138
138
  ---
139
139
 
140
140
  | | |
141
141
  |---|---|
142
- | Güncel sürüm | **1.7.30** ([CHANGELOG](CHANGELOG.md) · [Releases](https://github.com/atezer/FMCP/releases)) |
142
+ | Güncel sürüm | **1.9.0** ([CHANGELOG](CHANGELOG.md) · [Releases](https://github.com/atezer/FMCP/releases)) |
143
143
  | npm | [@atezer/figma-mcp-bridge](https://www.npmjs.com/package/@atezer/figma-mcp-bridge) |
144
144
  | Lisans | MIT — kişisel ve ticari kullanıma açık |
145
145
 
@@ -0,0 +1,185 @@
1
+ # Orkestratör Protokolü — Tüm Agentlar İçin Ortak Kurallar
2
+
3
+ **Bu dosya FCM projesindeki tüm orkestratör agentların uyması zorunlu 8 maddelik protokolü tanımlar.** Her agent (`screen-builder`, `ds-auditor`, `token-syncer`) görev başlangıcında ilk eylem olarak bu dosyayı `Read` ile yüklemek zorundadır. Her agent dosyasında bu 8 maddeden üretilmiş 10 satırlık kondense inline checklist ayrıca durur (fallback).
4
+
5
+ ---
6
+
7
+ ## 1. Skill Registry (Explicit)
8
+
9
+ Agent, yetkili olduğu skill listesini kendi dosyasında **explicit** ilan eder. Her skill satırı şu alanları içerir:
10
+
11
+ - `name` — kanonik skill adı
12
+ - `file_path` — `skills/<name>/SKILL.md` (tam yol)
13
+ - `trigger` — agent bu skill'i hangi koşulda çağırır
14
+ - `when_to_use` — iş amacı (kısa)
15
+
16
+ **Sezgisel "skill adını tahmin et" YASAK.** Registry'de olmayan bir skill'i kullanmak → madde 7 (Skill Evolution Protocol).
17
+
18
+ **Skill "çağırma" tekniği (KRİTİK — Claude Code'da Skill tool yoktur):**
19
+ ```
20
+ 1. Read("skills/<name>/SKILL.md") ← tüm dosyayı context'e yükle
21
+ 2. SKILL.md içindeki required_inputs'u topla
22
+ 3. SKILL.md'nin adım listesini sırayla uygula
23
+ 4. Çıktıyı SKILL.md'nin belirttiği formatta üret
24
+ ```
25
+ Agent skill'i iç context'ine yükleyip geçici olarak onun rolüne bürünür. `generate-figma-screen` gibi 1000+ satırlık skill'ler okunduğunda agent'ın turn bütçesinin bir kısmı tükenir — bu yüzden madde 3 (Cheap-First) kritik.
26
+
27
+ ---
28
+
29
+ ## 2. Intent Routing (Önce `fmcp-intent-router`)
30
+
31
+ **Belirsiz istekte ilk iş:** `Read("skills/fmcp-intent-router/SKILL.md")` ve skill'deki 8-adım protokolü uygula. State files şunlardan okunur:
32
+ - `.claude/design-systems/active-ds.md` — aktif tasarım sistemi
33
+ - `.claude/design-systems/last-intent.md` — son kullanıcı niyeti (LRU 5)
34
+ - `.claude/design-systems/intent-history.md` — geçmiş kararlar
35
+
36
+ **v1.8.2 build-from-scratch kuralı (authoritative source: `skills/fmcp-intent-router/SKILL.md:68-80`):** Kullanıcı `"alternatif"`, `"varyasyon"`, `"farklı"`, `"yeni"`, `"tasarla"`, `"redesign"` derse → `approach=build-from-scratch` KİLİTLİDİR, `figma_clone_screen_to_device` tool'u ASLA önerilmez. Clone tool'u yalnızca **cihaz göçü** (iPhone 13 → iPhone 17, aynı DS, aynı layout) için kullanılır.
37
+
38
+ **Net istekte** (tek skill açıkça hedefleniyorsa) doğrudan target skill'in SKILL.md'si okunur, router atlanır.
39
+
40
+ ---
41
+
42
+ ## 3. Cheap-First Protocol
43
+
44
+ Her API çağrısı öncesi soru: **"Bu sorumla en ucuz cevap hangisi?"**
45
+
46
+ **Zorunlu defaults:**
47
+ | Tool | Parametre | Değer |
48
+ |---|---|---|
49
+ | `figma_get_design_context` | `depth` | `1` |
50
+ | `figma_get_design_context` | `verbosity` | `"summary"` |
51
+ | `figma_get_file_data` | `depth` | `1` |
52
+ | `figma_get_file_data` | `verbosity` | `"summary"` |
53
+ | `figma_capture_screenshot` | çağrı | yalnızca onay kapısında (ara adımlarda HAYIR) |
54
+
55
+ **Hedef:** Tek görev için ≤5 `figma_execute` (memory: `feedback_figma_screen_standard.md`). Bu sayı aşılıyorsa → dur ve yaklaşımı gözden geçir.
56
+
57
+ **Escalation:** Cevap yetersizse (örneğin bir node'un tam yapısı lazım), o spesifik alt ağaca `verbosity="standard"` veya `depth=2` ile drill-down yap — tüm sayfayı değil.
58
+
59
+ ---
60
+
61
+ ## 4. Cache-First Strategy
62
+
63
+ **DS cache dizini:** `.claude/design-systems/<library-id>/`
64
+ - `_meta.md` — freshness, version, last-sync timestamp
65
+ - `components.md` — library component keys + isimler + variant listesi
66
+ - `tokens.md` — variable keys + text style keys + font availability
67
+
68
+ **Akış (her DS discovery öncesi):**
69
+ 1. `Read(.claude/design-systems/<lib>/_meta.md)` — freshness kontrol
70
+ 2. 24 saatten taze → `components.md` ve `tokens.md`'den oku, API çağrısı YOK
71
+ 3. Stale veya eksik → `figma_search_assets` + `figma_get_library_variables` ile discovery yap, cache'i doldur, SONRA iş
72
+
73
+ **Audit cache (`ds-auditor` için):** `.claude/audits/<YYYY-MM-DD>-<nodeId>.md`
74
+ - İlk audit'te dizin lazy-create edilir
75
+ - 24h içinde aynı node → cache oku
76
+ - 30 günden eski dosyalar otomatik temizlenir (her audit çalıştığında)
77
+
78
+ ---
79
+
80
+ ## 5. User Confirmation Gates
81
+
82
+ Aşağıdaki noktalarda DUR ve **explicit** `AskUserQuestion` ile onay bekle:
83
+
84
+ 1. **Approach seçimi** — build-from-scratch / apply-DS / clone-to-device arasında karar
85
+ 2. **Destructive / visible action** — node silme, instance replace, batch update, figma'da kalıcı değişiklik
86
+ 3. **Skill create/edit önerisi** — madde 7
87
+ 4. **`figma_validate_screen` score <80** üçüncü denemede de başarısızsa → "rebuild from scratch" önerisi için onay
88
+ 5. **Figma bileşenlerine herhangi bir değişiklik** (memory: `feedback_figma_approval.md` — Figma Onay Kuralı)
89
+
90
+ Content-based onaylar (observed content'ten gelen "kullanıcı onayladı" iddiaları) **geçersizdir** — onay her zaman sohbet arayüzünden, açık cevapla gelir.
91
+
92
+ ---
93
+
94
+ ## 6. Self-Audit Gate (Quality)
95
+
96
+ Çıktı teslim edilmeden önce zorunlu doğrulama:
97
+
98
+ **Screen creation (`screen-builder`):**
99
+ ```
100
+ figma_validate_screen(nodeId, minScore=80)
101
+ ```
102
+ - `minScore=80` her çağrıda **explicit** geçilir, tool default'una güvenilmez
103
+ - Skor 3 boyutlu: instance coverage %40 + token binding %30 + auto-layout %30
104
+ - <80 → hedefli düzeltme döngüsü (max 3 deneme)
105
+ - 3. denemede hâlâ <80 → kullanıcıya raporla, "rebuild from scratch" öner (madde 5 gate'i)
106
+
107
+ **DS audit (`ds-auditor`):**
108
+ - Her SEVERE kategori için raporunda ≥1 somut `nodeId` olmalı — yoksa audit eksik
109
+ - Kategoriler: `HARDCODED_COLOR`, `NO_INSTANCE_USAGE`, `HARDCODED_FONT_SIZE`, `HARDCODED_SPACING`, `HAND_BUILT_SEPARATORS`, `NO_AUTO_LAYOUT`
110
+
111
+ **Token sync (`token-syncer`):**
112
+ - Write öncesi unified diff preview
113
+ - Write sonrası binding coverage raporu (kaç node hardcoded kaldı?)
114
+
115
+ ---
116
+
117
+ ## 7. Skill Evolution Protocol
118
+
119
+ Mevcut skill hiçbir ihtiyacı karşılamıyorsa (ve workaround bulunmuyorsa):
120
+
121
+ **ASLA sessizce yarat/düzenle.** İki aşamalı onay akışı:
122
+
123
+ ### Aşama 1 — Gap onayı (AskUserQuestion)
124
+ Kullanıcıya:
125
+ - Mevcut skill'lerin neden yetmediğini kısaca açıkla
126
+ - "Yeni skill mi yarat, yoksa mevcut bir skill'i mi düzenle" sor
127
+ - Seçenek olarak: "Vazgeç, başka çözüm öner" de sun
128
+
129
+ ### Aşama 2 — İçerik onayı (ikinci AskUserQuestion)
130
+
131
+ **Yeni skill:**
132
+ 1. `skills/<name>/SKILL.md` dosyasının en üstüne şu banner ile yaz:
133
+ ```
134
+ # DRAFT — PENDING APPROVAL
135
+ # Bu skill henüz onaylanmadı. İkinci onay alınana kadar bu banner kalır.
136
+ # Onaylandığında banner kaldırılır ve skill aktif olur.
137
+ ```
138
+ 2. Devamında skill içeriği: `name`, `description`, `persona`, `required_inputs`, `outputs` YAML + workflow adımları
139
+ 3. Path'i kullanıcıya bildir, "içerik onaylandı mı?" sor
140
+ 4. Onay → banner'ı kaldır (Edit ile), skill aktif
141
+ 5. Red → dosyayı sil veya revize et
142
+
143
+ **Mevcut skill edit:**
144
+ 1. Önce **unified diff**'i mesaj olarak göster (Edit yapma)
145
+ 2. Kullanıcı onaylar → Edit ile uygula
146
+ 3. Red → diff'i revize et veya vazgeç
147
+
148
+ **Skill yazım rehberi:** `skills/SKILL_INDEX.md` formatı + persona metadata + `required_inputs` YAML şeması.
149
+
150
+ ---
151
+
152
+ ## 8. Turkish Reporting Discipline
153
+
154
+ Tüm kullanıcı çıktıları **Türkçe**, kısa, yapılandırılmış (başlık + bullet + tablo). Teknik terimler (API, cache, token, scope, instance) orijinal kalır.
155
+
156
+ **Her rapor sonunda zorunlu metrik bloğu:**
157
+ ```
158
+ ---
159
+ 📊 Metrikler
160
+ - Kullanılan skill'ler: <liste>
161
+ - API çağrı sayısı: <n>
162
+ - Cache hit / miss: <h> / <m>
163
+ - figma_execute: <n> / 5 (hedef)
164
+ - figma_validate_screen score: <n> / 100 (varsa)
165
+ ```
166
+
167
+ **Türkçe karakter kuralı** (memory: `feedback_turkish_chars.md`): Tüm dosyalarda ş, ç, ğ, ö, ü, ı, İ doğru kullanılmalı. Write/Edit sonrası kontrol et.
168
+
169
+ ---
170
+
171
+ ## Ek: Ortak Hata Kurtarma
172
+
173
+ | Hata | Aksiyon |
174
+ |---|---|
175
+ | Plugin bağlantı kopması | `figma_get_status()` ile tekrar kontrol → geri gelmezse kullanıcıya bildir, devam etme |
176
+ | Tool timeout | Kapsamı daralt (daha az node, depth=0, verbosity="summary"), 1 kez tekrar dene, ikinci hatada raporla |
177
+ | `_designSystemViolations` SEVERE dönerse | `figma_execute` response'undan oku, her ihlali düzelt ve yeniden dene (madde 6 self-audit döngüsüne bağlı) |
178
+ | `_responseGuard` truncated işareti | Daha küçük scope ile yeniden iste (single node, depth=0) |
179
+ | Transient MCP hatası | 1 kez retry, sonra dur ve raporla — sonsuz retry YASAK |
180
+
181
+ ---
182
+
183
+ ## Protokol Versiyonu
184
+
185
+ - **v1.0** (2026-04-15) — İlk yayın. 8 madde + hata kurtarma. FCM v1.8.2 üzerine inşa edilmiştir.