wogiflow 1.0.21 → 1.0.22

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 (121) hide show
  1. package/.claude/commands/wogi-bug.md +43 -0
  2. package/.claude/commands/wogi-bulk.md +144 -0
  3. package/.claude/commands/wogi-changelog.md +36 -0
  4. package/.claude/commands/wogi-compact.md +99 -0
  5. package/.claude/commands/wogi-config.md +50 -0
  6. package/.claude/commands/wogi-context.md +68 -0
  7. package/.claude/commands/wogi-correction.md +73 -0
  8. package/.claude/commands/wogi-debt.md +128 -0
  9. package/.claude/commands/wogi-deps.md +32 -0
  10. package/.claude/commands/wogi-epics.md +145 -0
  11. package/.claude/commands/wogi-export.md +100 -0
  12. package/.claude/commands/wogi-feature.md +149 -0
  13. package/.claude/commands/wogi-guided-edit.md +83 -0
  14. package/.claude/commands/wogi-health.md +43 -0
  15. package/.claude/commands/wogi-help.md +96 -0
  16. package/.claude/commands/wogi-hybrid-edit.md +36 -0
  17. package/.claude/commands/wogi-hybrid-off.md +24 -0
  18. package/.claude/commands/wogi-hybrid-setup.md +79 -0
  19. package/.claude/commands/wogi-hybrid-status.md +45 -0
  20. package/.claude/commands/wogi-hybrid.md +54 -0
  21. package/.claude/commands/wogi-import.md +44 -0
  22. package/.claude/commands/wogi-init.md +618 -0
  23. package/.claude/commands/wogi-log.md +38 -0
  24. package/.claude/commands/wogi-map-add.md +29 -0
  25. package/.claude/commands/wogi-map-check.md +35 -0
  26. package/.claude/commands/wogi-map-index.md +98 -0
  27. package/.claude/commands/wogi-map-scan.md +38 -0
  28. package/.claude/commands/wogi-map-sync.md +91 -0
  29. package/.claude/commands/wogi-map.md +33 -0
  30. package/.claude/commands/wogi-morning.md +65 -0
  31. package/.claude/commands/wogi-onboard.md +99 -0
  32. package/.claude/commands/wogi-plan.md +173 -0
  33. package/.claude/commands/wogi-ready.md +84 -0
  34. package/.claude/commands/wogi-resume.md +95 -0
  35. package/.claude/commands/wogi-review.md +636 -0
  36. package/.claude/commands/wogi-roadmap.md +241 -0
  37. package/.claude/commands/wogi-rules.md +104 -0
  38. package/.claude/commands/wogi-search.md +33 -0
  39. package/.claude/commands/wogi-session-end.md +49 -0
  40. package/.claude/commands/wogi-setup-stack.md +151 -0
  41. package/.claude/commands/wogi-skill-learn.md +66 -0
  42. package/.claude/commands/wogi-skills.md +87 -0
  43. package/.claude/commands/wogi-standup.md +28 -0
  44. package/.claude/commands/wogi-start.md +465 -0
  45. package/.claude/commands/wogi-status.md +41 -0
  46. package/.claude/commands/wogi-statusline-setup/skill.md +109 -0
  47. package/.claude/commands/wogi-story.md +98 -0
  48. package/.claude/commands/wogi-suspend.md +87 -0
  49. package/.claude/commands/wogi-test-browser.md +43 -0
  50. package/.claude/commands/wogi-trace.md +198 -0
  51. package/.claude/docs/architecture.md +37 -0
  52. package/.claude/docs/commands.md +343 -0
  53. package/.claude/docs/knowledge-base/01-setup-onboarding/README.md +177 -0
  54. package/.claude/docs/knowledge-base/01-setup-onboarding/component-indexing.md +341 -0
  55. package/.claude/docs/knowledge-base/01-setup-onboarding/framework-detection.md +269 -0
  56. package/.claude/docs/knowledge-base/01-setup-onboarding/installation.md +146 -0
  57. package/.claude/docs/knowledge-base/01-setup-onboarding/onboarding-existing.md +317 -0
  58. package/.claude/docs/knowledge-base/01-setup-onboarding/team-setup.md +346 -0
  59. package/.claude/docs/knowledge-base/02-task-execution/01-task-planning.md +259 -0
  60. package/.claude/docs/knowledge-base/02-task-execution/02-execution-loop.md +443 -0
  61. package/.claude/docs/knowledge-base/02-task-execution/03-verification.md +417 -0
  62. package/.claude/docs/knowledge-base/02-task-execution/04-completion.md +374 -0
  63. package/.claude/docs/knowledge-base/02-task-execution/05-session-review.md +170 -0
  64. package/.claude/docs/knowledge-base/02-task-execution/README.md +173 -0
  65. package/.claude/docs/knowledge-base/02-task-execution/external-integrations.md +133 -0
  66. package/.claude/docs/knowledge-base/02-task-execution/model-management.md +202 -0
  67. package/.claude/docs/knowledge-base/02-task-execution/specification-mode.md +292 -0
  68. package/.claude/docs/knowledge-base/02-task-execution/sync-daemon.md +96 -0
  69. package/.claude/docs/knowledge-base/02-task-execution/trade-offs.md +345 -0
  70. package/.claude/docs/knowledge-base/02-task-execution/workflow-steps.md +357 -0
  71. package/.claude/docs/knowledge-base/03-self-improvement/README.md +199 -0
  72. package/.claude/docs/knowledge-base/03-self-improvement/long-input-processing.md +160 -0
  73. package/.claude/docs/knowledge-base/03-self-improvement/model-learning.md +334 -0
  74. package/.claude/docs/knowledge-base/03-self-improvement/project-learning.md +301 -0
  75. package/.claude/docs/knowledge-base/03-self-improvement/skill-learning.md +372 -0
  76. package/.claude/docs/knowledge-base/03-self-improvement/skill-matching.md +304 -0
  77. package/.claude/docs/knowledge-base/03-self-improvement/team-learning.md +342 -0
  78. package/.claude/docs/knowledge-base/04-memory-context/README.md +189 -0
  79. package/.claude/docs/knowledge-base/04-memory-context/context-management.md +308 -0
  80. package/.claude/docs/knowledge-base/04-memory-context/memory-commands.md +176 -0
  81. package/.claude/docs/knowledge-base/04-memory-context/memory-systems.md +359 -0
  82. package/.claude/docs/knowledge-base/04-memory-context/prd-management.md +115 -0
  83. package/.claude/docs/knowledge-base/04-memory-context/session-persistence.md +359 -0
  84. package/.claude/docs/knowledge-base/04-memory-context/team-history.md +317 -0
  85. package/.claude/docs/knowledge-base/05-development-tools/README.md +84 -0
  86. package/.claude/docs/knowledge-base/05-development-tools/code-traces.md +278 -0
  87. package/.claude/docs/knowledge-base/05-development-tools/figma-analyzer.md +253 -0
  88. package/.claude/docs/knowledge-base/05-development-tools/guided-edit.md +173 -0
  89. package/.claude/docs/knowledge-base/05-development-tools/mcp-integrations.md +286 -0
  90. package/.claude/docs/knowledge-base/06-safety-guardrails/README.md +153 -0
  91. package/.claude/docs/knowledge-base/06-safety-guardrails/checkpoint-rollback.md +302 -0
  92. package/.claude/docs/knowledge-base/06-safety-guardrails/commit-gates.md +309 -0
  93. package/.claude/docs/knowledge-base/06-safety-guardrails/damage-control.md +292 -0
  94. package/.claude/docs/knowledge-base/06-safety-guardrails/security-scanning.md +291 -0
  95. package/.claude/docs/knowledge-base/README.md +92 -0
  96. package/.claude/docs/knowledge-base/configuration/README.md +228 -0
  97. package/.claude/docs/knowledge-base/configuration/all-options.md +1632 -0
  98. package/.claude/docs/knowledge-base/future-features.md +277 -0
  99. package/.claude/docs/stack.md +25 -0
  100. package/.claude/docs/testing.md +71 -0
  101. package/.claude/rules/README.md +60 -0
  102. package/.claude/rules/architecture/component-reuse.md +38 -0
  103. package/.claude/rules/architecture/document-structure.md +76 -0
  104. package/.claude/rules/architecture/feature-refactoring-cleanup.md +87 -0
  105. package/.claude/rules/architecture/model-management.md +35 -0
  106. package/.claude/rules/code-style/naming-conventions.md +55 -0
  107. package/.claude/rules/security/security-patterns.md +116 -0
  108. package/.claude/skills/.gitkeep +0 -0
  109. package/.claude/skills/README.md +131 -0
  110. package/.claude/skills/_template/commands/.gitkeep +0 -0
  111. package/.claude/skills/_template/knowledge/anti-patterns.md +49 -0
  112. package/.claude/skills/_template/knowledge/learnings.md +60 -0
  113. package/.claude/skills/_template/knowledge/patterns.md +45 -0
  114. package/.claude/skills/_template/rules/.gitkeep +0 -0
  115. package/.claude/skills/_template/skill.md +99 -0
  116. package/.claude/skills/_template/templates/.gitkeep +0 -0
  117. package/.claude/skills/figma-analyzer/knowledge/anti-patterns.md +216 -0
  118. package/.claude/skills/figma-analyzer/knowledge/patterns.md +144 -0
  119. package/.claude/skills/figma-analyzer/skill.md +236 -0
  120. package/lib/installer.js +59 -19
  121. package/package.json +5 -1
@@ -0,0 +1,216 @@
1
+ # Figma Analyzer Anti-Patterns
2
+
3
+ Patterns to avoid when analyzing Figma designs and generating code.
4
+
5
+ ---
6
+
7
+ ## Analysis Anti-Patterns
8
+
9
+ ### Anti-Pattern: Regenerating Existing Components
10
+
11
+ **Bad**:
12
+ ```
13
+ Figma shows a "Button" → Generate new Button.tsx
14
+ ```
15
+
16
+ **Good**:
17
+ ```
18
+ Figma shows a "Button" → Check registry → Match to existing Button.tsx → Reuse or add variant
19
+ ```
20
+
21
+ **Why it's bad**: Creates duplicate components, fragments design system, increases maintenance burden
22
+
23
+ ---
24
+
25
+ ### Anti-Pattern: Top-Down Monolithic Analysis
26
+
27
+ **Bad**:
28
+ ```
29
+ Analyze entire screen as one component → Generate single ScreenComponent.tsx
30
+ ```
31
+
32
+ **Good**:
33
+ ```
34
+ Break down: Screen → Organisms → Molecules → Atoms
35
+ Match each level independently
36
+ ```
37
+
38
+ **Why it's bad**: Misses reuse opportunities, creates unmaintainable code, violates atomic design principles
39
+
40
+ ---
41
+
42
+ ### Anti-Pattern: Ignoring Match Scores
43
+
44
+ **Bad**:
45
+ ```
46
+ Component has 85% match score → Create new component anyway
47
+ ```
48
+
49
+ **Good**:
50
+ ```
51
+ 85% match → Use existing with minor adjustments
52
+ 68% match → Consider as variant
53
+ 45% match → Create new component
54
+ ```
55
+
56
+ **Why it's bad**: Wastes development effort, creates unnecessary component proliferation
57
+
58
+ ---
59
+
60
+ ## Code Generation Anti-Patterns
61
+
62
+ ### Anti-Pattern: Hardcoding Figma Values
63
+
64
+ **Bad**:
65
+ ```tsx
66
+ const Button = styled.button`
67
+ background: #3B82F6; /* Hardcoded Figma hex */
68
+ padding: 12px 24px; /* Hardcoded Figma values */
69
+ `;
70
+ ```
71
+
72
+ **Good**:
73
+ ```tsx
74
+ const Button = styled.button`
75
+ background: ${theme.colors.primary};
76
+ padding: ${theme.space[3]} ${theme.space[6]};
77
+ `;
78
+ ```
79
+
80
+ **Why it's bad**: Breaks design system consistency, makes theme changes impossible
81
+
82
+ ---
83
+
84
+ ### Anti-Pattern: Skipping Confirmation Step
85
+
86
+ **Bad**:
87
+ ```
88
+ Analyze → Generate code immediately
89
+ ```
90
+
91
+ **Good**:
92
+ ```
93
+ Analyze → Show matches → Get developer confirmation → Generate code
94
+ ```
95
+
96
+ **Why it's bad**: Developers lose control, wrong decisions get implemented, requires rework
97
+
98
+ ---
99
+
100
+ ### Anti-Pattern: Flat Component Output
101
+
102
+ **Bad**:
103
+ ```tsx
104
+ // All components in one file
105
+ export const Button = () => ...
106
+ export const Card = () => ...
107
+ export const Header = () => ...
108
+ ```
109
+
110
+ **Good**:
111
+ ```
112
+ // Structured output
113
+ atoms/Button.tsx (import existing)
114
+ molecules/Card.tsx (new variant)
115
+ organisms/Header.tsx (adjustment)
116
+ ```
117
+
118
+ **Why it's bad**: Doesn't integrate with existing codebase structure
119
+
120
+ ---
121
+
122
+ ## Matching Anti-Patterns
123
+
124
+ ### Anti-Pattern: Name-Only Matching
125
+
126
+ **Bad**:
127
+ ```
128
+ Figma "PrimaryButton" → Search for "PrimaryButton" → No match → Create new
129
+ ```
130
+
131
+ **Good**:
132
+ ```
133
+ Figma "PrimaryButton" → Search semantically:
134
+ - "Button" with variant "primary"
135
+ - "PrimaryButton"
136
+ - Components with similar props
137
+ → Found Button.tsx with primary variant
138
+ ```
139
+
140
+ **Why it's bad**: Misses existing components due to naming differences
141
+
142
+ ---
143
+
144
+ ### Anti-Pattern: Ignoring Component Hierarchy
145
+
146
+ **Bad**:
147
+ ```
148
+ Match: Card component
149
+ Skip: What's inside the Card (icons, text, buttons)
150
+ ```
151
+
152
+ **Good**:
153
+ ```
154
+ Match: Card component
155
+ Also match: All nested components (Icon, Typography, Button)
156
+ ```
157
+
158
+ **Why it's bad**: Nested components get regenerated, losing reuse opportunities
159
+
160
+ ---
161
+
162
+ ### Anti-Pattern: Binary Match Decisions
163
+
164
+ **Bad**:
165
+ ```
166
+ Match score < 100% → Create new component
167
+ ```
168
+
169
+ **Good**:
170
+ ```
171
+ 95%+ → Use directly
172
+ 80-95% → Minor adjustments
173
+ 60-80% → Add as variant
174
+ <60% → Create new
175
+ ```
176
+
177
+ **Why it's bad**: Creates unnecessary components for minor differences
178
+
179
+ ---
180
+
181
+ ## Workflow Anti-Patterns
182
+
183
+ ### Anti-Pattern: Skipping Registry Scan
184
+
185
+ **Bad**:
186
+ ```
187
+ Receive Figma data → Start matching immediately
188
+ ```
189
+
190
+ **Good**:
191
+ ```
192
+ Receive Figma data → Ensure registry is current → Then match
193
+ ```
194
+
195
+ **Why it's bad**: Matches against stale component data, misses recent additions
196
+
197
+ ---
198
+
199
+ ### Anti-Pattern: No Decision Persistence
200
+
201
+ **Bad**:
202
+ ```
203
+ Developer makes decisions → Generate code → Decisions lost
204
+ ```
205
+
206
+ **Good**:
207
+ ```
208
+ Developer makes decisions → Save to figma-decisions.json → Generate code
209
+ Decisions available for future reference and audit
210
+ ```
211
+
212
+ **Why it's bad**: No audit trail, can't review or adjust decisions later
213
+
214
+ ---
215
+
216
+ _More anti-patterns will be added as they are discovered._
@@ -0,0 +1,144 @@
1
+ # Figma Analyzer Patterns
2
+
3
+ Patterns for analyzing Figma designs and matching against existing codebases.
4
+
5
+ ---
6
+
7
+ ## Matching Patterns
8
+
9
+ ### Pattern: Atomic Component Priority
10
+
11
+ **Context**: When analyzing a Figma screen
12
+ **Approach**:
13
+ 1. First identify atoms (buttons, inputs, icons, text)
14
+ 2. Then molecules (search bars, cards, nav items)
15
+ 3. Then organisms (headers, sidebars, forms)
16
+ 4. Finally templates/pages
17
+
18
+ **Why it works**: Bottom-up analysis ensures foundational components are matched first
19
+
20
+ ---
21
+
22
+ ### Pattern: Match Score Thresholds
23
+
24
+ | Score | Action | Example |
25
+ |-------|--------|---------|
26
+ | 95%+ | Use directly | Icon with same name and size |
27
+ | 80-95% | Use with minor adjustments | Button with different padding |
28
+ | 60-80% | Consider as variant | Card with new layout option |
29
+ | <60% | Create new component | Novel component design |
30
+
31
+ **Why it works**: Clear decision boundaries reduce developer cognitive load
32
+
33
+ ---
34
+
35
+ ### Pattern: Property-Based Matching
36
+
37
+ **Context**: Calculating match scores
38
+ **Approach**:
39
+ ```
40
+ Score = (
41
+ nameMatch * 0.3 +
42
+ typeMatch * 0.2 +
43
+ propsMatch * 0.3 +
44
+ visualMatch * 0.2
45
+ )
46
+ ```
47
+
48
+ Components to compare:
49
+ - Name similarity (case-insensitive, handle synonyms)
50
+ - Component type (button, input, card)
51
+ - Props overlap (size, variant, color)
52
+ - Visual characteristics (dimensions, colors)
53
+
54
+ ---
55
+
56
+ ## Decision Patterns
57
+
58
+ ### Pattern: Variant vs New Component
59
+
60
+ **When to add variant**:
61
+ - Same base functionality
62
+ - Similar props/API
63
+ - Fits existing component architecture
64
+ - Score 60-80%
65
+
66
+ **When to create new**:
67
+ - Different behavior/purpose
68
+ - Would require breaking changes
69
+ - Doesn't fit existing component patterns
70
+ - Score <60%
71
+
72
+ ---
73
+
74
+ ### Pattern: Design Token Preservation
75
+
76
+ **Context**: Maintaining design system consistency
77
+ **Approach**:
78
+ 1. Map Figma colors to existing tokens first
79
+ 2. Only create new tokens if truly novel
80
+ 3. Prefer closest existing size/spacing tokens
81
+ 4. Document any new tokens needed
82
+
83
+ Example mapping:
84
+ ```
85
+ Figma #1F2937 → token: gray-800
86
+ Figma 16px → token: text-base
87
+ Figma 24px spacing → token: space-6
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Output Patterns
93
+
94
+ ### Pattern: Structured Decision Format
95
+
96
+ **Context**: Storing developer decisions
97
+ **Format**:
98
+ ```json
99
+ {
100
+ "figmaComponent": "Button/Primary",
101
+ "decision": "use" | "variant" | "new" | "skip",
102
+ "matchedTo": "Button.tsx",
103
+ "confidence": 0.92,
104
+ "differences": ["color", "size"],
105
+ "variantName": "large",
106
+ "notes": "Developer chose to add as variant"
107
+ }
108
+ ```
109
+
110
+ ---
111
+
112
+ ### Pattern: Generated Code Structure
113
+
114
+ **Context**: Code generation output
115
+ **Include**:
116
+ 1. Import statements for existing components
117
+ 2. Variant definitions (what to add)
118
+ 3. New component skeletons
119
+ 4. Composition code showing assembly
120
+
121
+ **Order**: Atoms → Molecules → Organisms → Page composition
122
+
123
+ ---
124
+
125
+ ## Anti-Patterns to Avoid
126
+
127
+ ### Anti-Pattern: Regenerating Existing Components
128
+
129
+ **Bad**: Creating new Button.tsx when one exists
130
+ **Good**: Identify match, offer variant or adjustment
131
+
132
+ ### Anti-Pattern: Missing Atomic Analysis
133
+
134
+ **Bad**: Creating monolithic screen component
135
+ **Good**: Break into reusable atoms/molecules first
136
+
137
+ ### Anti-Pattern: Ignoring Design Tokens
138
+
139
+ **Bad**: Hardcoding Figma hex values
140
+ **Good**: Map to existing token system
141
+
142
+ ---
143
+
144
+ _More patterns will be added as they are discovered._
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: figma-analyzer
3
+ version: 1.0.0
4
+ description: Analyze Figma designs and match components against existing codebase
5
+ scope: project
6
+ user-invocable: true
7
+ context: inline
8
+ agent: developer
9
+ allowed-tools:
10
+ - Read
11
+ - Glob
12
+ - Grep
13
+ - Edit
14
+ - Write
15
+ - Bash(./scripts/flow figma *)
16
+ - mcp__figma__*
17
+ lastUpdated: 2026-01-11
18
+ learningCount: 0
19
+ successRate: 0
20
+ ---
21
+
22
+ # Figma Component Analyzer Skill
23
+
24
+ ## Overview
25
+
26
+ This skill helps you analyze Figma designs and match components against the existing codebase. Instead of generating all new code, it identifies what can be reused and guides developers through an interactive confirmation process.
27
+
28
+ ## When to Use
29
+
30
+ Use this skill when:
31
+ - A developer shares a Figma link and asks to implement a screen
32
+ - Converting Figma designs to code
33
+ - Adding new screens/features from Figma designs
34
+ - Working with Figma MCP to generate code
35
+
36
+ ## Triggers
37
+
38
+ - keywords: ["figma", "figma-link", "design-file", "design-system", "design-tokens", "mockup", "wireframe", "figma-mcp", "frame", "artboard"]
39
+ - filePatterns: []
40
+ - taskTypes: ["feature"]
41
+ - categories: ["design", "design-to-code"]
42
+
43
+ ## Workflow
44
+
45
+ ### Step 1: Index the Codebase (First Time)
46
+
47
+ Before analyzing Figma designs, index the codebase:
48
+
49
+ ```bash
50
+ ./scripts/flow figma scan
51
+ ```
52
+
53
+ This creates `.workflow/state/component-registry.json` with all existing components.
54
+
55
+ ### Step 2: Get Figma Data via MCP
56
+
57
+ When the developer provides a Figma link, use the Figma MCP to get design data:
58
+
59
+ ```
60
+ # Use Figma MCP to get design context
61
+ figma.get_file_nodes(file_key="...", node_ids=["..."])
62
+ ```
63
+
64
+ ### Step 3: Analyze and Match
65
+
66
+ Use the Wogi Figma tools to analyze:
67
+
68
+ ```bash
69
+ # Extract components from Figma data
70
+ echo '<figma_mcp_response>' | ./scripts/flow-figma-extract.js --stdin > /tmp/figma-components.json
71
+
72
+ # Match against registry
73
+ ./scripts/flow-figma-match.js /tmp/figma-components.json > /tmp/figma-matches.json
74
+ ```
75
+
76
+ Or use the MCP server tools directly:
77
+ - `wogi_figma_analyze` - Full analysis pipeline
78
+ - `wogi_figma_match` - Match single component
79
+
80
+ ### Step 4: Present Results to Developer
81
+
82
+ Display the analysis results in a clear format:
83
+
84
+ ```
85
+ ═══════════════════════════════════════════════════════════════════
86
+ FIGMA COMPONENT ANALYSIS
87
+ ═══════════════════════════════════════════════════════════════════
88
+
89
+ 📊 Found 12 components, 8 potential matches
90
+
91
+ ATOMS (5):
92
+ ├─ Icon (settings) → 95% match → Icon.tsx ✅ USE
93
+ ├─ Text (heading) → 100% match → Typography.tsx ✅ USE
94
+ ├─ Button (primary) → 88% match → Button.tsx ⚠️ ADJUST
95
+ ├─ Input (outlined) → 72% match → Input.tsx ➕ VARIANT?
96
+ └─ Avatar (new) → 45% match → Avatar.tsx 🆕 NEW
97
+
98
+ MOLECULES (4):
99
+ ├─ SearchBar → 92% match → SearchBar.tsx ✅ USE
100
+ ├─ Card (stats) → 85% match → Card.tsx ⚠️ ADJUST
101
+ ├─ NavItem → 78% match → NavItem.tsx ➕ VARIANT?
102
+ └─ UserMenu → 35% match → (none) 🆕 NEW
103
+
104
+ ORGANISMS (3):
105
+ ├─ Header → 82% match → Header.tsx ⚠️ ADJUST
106
+ ├─ Sidebar → 68% match → Sidebar.tsx ➕ VARIANT?
107
+ └─ Dashboard → 0% match → (none) 🆕 NEW
108
+ ```
109
+
110
+ ### Step 5: Interactive Confirmation
111
+
112
+ For each component, ask the developer to confirm:
113
+
114
+ ```
115
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
116
+
117
+ 📦 Sidebar (nav) - 68% match to Sidebar.tsx
118
+
119
+ Differences:
120
+ • Width: 280px (existing: 240px)
121
+ • Background: #1F2937 (existing: #111827)
122
+ • Has collapse button (existing: doesn't)
123
+
124
+ Options:
125
+ [1] ✅ Use existing Sidebar.tsx (ignore differences)
126
+ [2] ➕ Add as variant "collapsible" to Sidebar.tsx
127
+ [3] 🆕 Create new component: CollapsibleSidebar.tsx
128
+ [4] ⏭️ Skip - I'll handle manually
129
+
130
+ Developer choice:
131
+ ```
132
+
133
+ ### Step 6: Generate Code
134
+
135
+ After all confirmations, generate the appropriate code:
136
+
137
+ ```bash
138
+ ./scripts/flow figma generate
139
+ ```
140
+
141
+ Output includes:
142
+ - Import statements for existing components
143
+ - Variant additions (what to add to existing components)
144
+ - New component prompts for Claude to generate
145
+ - Composition code showing how everything fits together
146
+
147
+ ## Key Principles
148
+
149
+ 1. **Never regenerate existing components** - Always check registry first
150
+ 2. **Break screens into atoms first** - Work bottom-up
151
+ 3. **80% threshold for reuse** - Below 80% match, consider creating new
152
+ 4. **Confirm before creating** - Let developer decide use/variant/new
153
+ 5. **Preserve design system** - Match existing patterns and tokens
154
+
155
+ ## Thresholds
156
+
157
+ | Score | Suggestion |
158
+ |-------|------------|
159
+ | 95%+ | Use directly |
160
+ | 80-95% | Use with minor adjustments |
161
+ | 60-80% | Consider as variant |
162
+ | <60% | Create new component |
163
+
164
+ ## Files Created
165
+
166
+ - `.workflow/state/component-registry.json` - Codebase component index
167
+ - `.workflow/state/figma-decisions.json` - Developer decisions
168
+ - `.workflow/state/figma-output.json` - Generated output
169
+
170
+ ## CLI Commands
171
+
172
+ ```bash
173
+ ./scripts/flow figma scan # Scan codebase for components
174
+ ./scripts/flow figma show [name] # Show component details
175
+ ./scripts/flow figma extract <file> # Extract from Figma data
176
+ ./scripts/flow figma match <file> # Match against registry
177
+ ./scripts/flow figma confirm <file> # Interactive confirmation
178
+ ./scripts/flow figma generate # Generate code from decisions
179
+ ./scripts/flow figma server # Start MCP server
180
+ ```
181
+
182
+ ## MCP Server
183
+
184
+ Start the MCP server for use with Claude Desktop or other MCP clients:
185
+
186
+ ```bash
187
+ ./scripts/flow figma server
188
+ ```
189
+
190
+ Add to Claude Desktop config:
191
+ ```json
192
+ {
193
+ "mcpServers": {
194
+ "wogi-figma": {
195
+ "command": "node",
196
+ "args": ["/path/to/wogi-flow/scripts/flow-figma-mcp-server.js"]
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ ## Example Prompt
203
+
204
+ When a developer says "implement this Figma screen", respond:
205
+
206
+ "I'll analyze this design and match it against your existing components. Let me:
207
+
208
+ 1. First, check your component registry (or scan if needed)
209
+ 2. Extract all components from the Figma design
210
+ 3. Match each against your codebase
211
+ 4. Walk you through what to reuse vs. create new
212
+
213
+ This ensures we maintain your design system and don't duplicate components."
214
+
215
+ ## Setting Up Figma MCP
216
+
217
+ To use Figma designs with Claude:
218
+
219
+ 1. Get a Figma Personal Access Token from https://www.figma.com/developers/api#access-tokens
220
+ 2. Add the Figma MCP server to your Claude config:
221
+
222
+ ```json
223
+ {
224
+ "mcpServers": {
225
+ "figma": {
226
+ "command": "npx",
227
+ "args": ["-y", "@anthropic/mcp-server-figma"],
228
+ "env": {
229
+ "FIGMA_PERSONAL_ACCESS_TOKEN": "your-token-here"
230
+ }
231
+ }
232
+ }
233
+ }
234
+ ```
235
+
236
+ 3. Now you can use `figma.get_file_nodes()` to fetch design data
package/lib/installer.js CHANGED
@@ -338,11 +338,47 @@ function createCLIConfig(projectRoot, cliKey, config) {
338
338
  const cliDir = path.join(projectRoot, cli.dir);
339
339
  fs.mkdirSync(cliDir, { recursive: true });
340
340
 
341
- // Create CLI-specific config file
341
+ // Create CLI-specific config file and copy resources
342
342
  if (cliKey === 'claude') {
343
- const claudeMd = `# Project Instructions
343
+ // Copy commands from package
344
+ const packageCommands = path.join(PACKAGE_ROOT, '.claude', 'commands');
345
+ const projectCommands = path.join(cliDir, 'commands');
346
+ if (fs.existsSync(packageCommands)) {
347
+ copyDir(packageCommands, projectCommands);
348
+ console.log(' Copied .claude/commands/ (slash commands)');
349
+ }
350
+
351
+ // Copy docs from package
352
+ const packageDocs = path.join(PACKAGE_ROOT, '.claude', 'docs');
353
+ const projectDocs = path.join(cliDir, 'docs');
354
+ if (fs.existsSync(packageDocs)) {
355
+ copyDir(packageDocs, projectDocs);
356
+ console.log(' Copied .claude/docs/ (documentation)');
357
+ }
358
+
359
+ // Copy rules from package
360
+ const packageRules = path.join(PACKAGE_ROOT, '.claude', 'rules');
361
+ const projectRules = path.join(cliDir, 'rules');
362
+ if (fs.existsSync(packageRules)) {
363
+ copyDir(packageRules, projectRules);
364
+ console.log(' Copied .claude/rules/ (coding rules)');
365
+ }
366
+
367
+ // Copy skills from package (base skills only)
368
+ const packageSkills = path.join(PACKAGE_ROOT, '.claude', 'skills');
369
+ const projectSkills = path.join(cliDir, 'skills');
370
+ if (fs.existsSync(packageSkills)) {
371
+ copyDir(packageSkills, projectSkills);
372
+ console.log(' Copied .claude/skills/ (base skills)');
373
+ }
344
374
 
345
- You are an AI development assistant using the Wogi Flow methodology.
375
+ // Generate CLAUDE.md from template
376
+ const claudeMdTemplate = path.join(PACKAGE_ROOT, '.workflow', 'templates', 'claude-md.hbs');
377
+ if (fs.existsSync(claudeMdTemplate)) {
378
+ // For now, create a simple CLAUDE.md - the bridge will regenerate with full template
379
+ const claudeMd = `# Project Instructions
380
+
381
+ You are an AI development assistant using the WogiFlow methodology v1.0.
346
382
 
347
383
  ## Quick Start
348
384
 
@@ -356,22 +392,16 @@ cat .workflow/state/ready.json # Check tasks
356
392
  - \`/wogi-ready\` - Show available tasks
357
393
  - \`/wogi-start TASK-X\` - Start a task
358
394
  - \`/wogi-status\` - Project overview
395
+ - \`/wogi-health\` - Check workflow health
359
396
 
360
397
  Generated by Wogi Flow v${config.version}
361
398
  `;
362
- fs.writeFileSync(path.join(cliDir, 'CLAUDE.md'), claudeMd);
363
-
364
- // Create skills directory
365
- fs.mkdirSync(path.join(cliDir, 'skills'), { recursive: true });
366
-
367
- // Create docs directory
368
- fs.mkdirSync(path.join(cliDir, 'docs'), { recursive: true });
369
-
370
- // Create rules directory
371
- fs.mkdirSync(path.join(cliDir, 'rules'), { recursive: true });
399
+ fs.writeFileSync(path.join(projectRoot, 'CLAUDE.md'), claudeMd);
400
+ console.log(' Created CLAUDE.md');
401
+ }
372
402
  }
373
403
 
374
- console.log(` Created ${cli.dir}/ for ${cli.name}`);
404
+ console.log(` Configured ${cli.name}`);
375
405
  }
376
406
 
377
407
  /**
@@ -458,7 +488,9 @@ async function init(args) {
458
488
  console.log('');
459
489
  } catch (err) {
460
490
  rl.close();
461
- throw err;
491
+ console.error(`\nSetup prompt failed: ${err.message}`);
492
+ console.log('Run "flow init --basic" to skip the AI recommendation.\n');
493
+ process.exit(1);
462
494
  }
463
495
  }
464
496
 
@@ -468,13 +500,20 @@ async function init(args) {
468
500
 
469
501
  // Detect project name from package.json or directory name
470
502
  const packageJsonPath = path.join(projectRoot, 'package.json');
471
- const pkg = safeReadJson(packageJsonPath);
472
- if (pkg && pkg.name) {
473
- config.projectName = pkg.name;
503
+ const projectPkg = safeReadJson(packageJsonPath);
504
+ if (projectPkg && projectPkg.name) {
505
+ config.projectName = projectPkg.name;
474
506
  } else {
475
507
  config.projectName = path.basename(projectRoot);
476
508
  }
477
509
 
510
+ // Validate CLI option early (before interactive mode)
511
+ if (options.cli && !SUPPORTED_CLIS[options.cli]) {
512
+ console.error(`Unknown CLI: ${options.cli}`);
513
+ console.log(`Supported CLIs: ${Object.keys(SUPPORTED_CLIS).join(', ')}`);
514
+ process.exit(1);
515
+ }
516
+
478
517
  // Interactive or quick mode
479
518
  if (options.yes) {
480
519
  // Use defaults and CLI option if provided
@@ -519,7 +558,8 @@ async function init(args) {
519
558
  rl.close();
520
559
  } catch (err) {
521
560
  rl.close();
522
- throw err;
561
+ console.error(`\nSetup failed: ${err.message}`);
562
+ process.exit(1);
523
563
  }
524
564
  }
525
565