vibes-plug 1.0.0

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 (141) hide show
  1. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  2. package/BLUEPRINT.md +125 -0
  3. package/CHANGELOG.md +195 -0
  4. package/CONTRIBUTING.md +199 -0
  5. package/LICENSE +21 -0
  6. package/README.md +263 -0
  7. package/SECURITY.md +21 -0
  8. package/banner.png +0 -0
  9. package/package.json +25 -0
  10. package/plugin.json +8 -0
  11. package/scripts/update_skills.js +75 -0
  12. package/skills/ai-llm-integration-expert/SKILL.md +162 -0
  13. package/skills/api-design-expert/SKILL.md +310 -0
  14. package/skills/app-analyzer-optimizer/SKILL.md +189 -0
  15. package/skills/asisten_ramah/SKILL.md +41 -0
  16. package/skills/authentication-identity-expert/SKILL.md +45 -0
  17. package/skills/auto-doc-updater/SKILL.md +204 -0
  18. package/skills/bootstrap-to-modern/SKILL.md +87 -0
  19. package/skills/brainstorming/SKILL.md +353 -0
  20. package/skills/bun-runtime-expert/SKILL.md +211 -0
  21. package/skills/ci-cd-devops-architect/SKILL.md +45 -0
  22. package/skills/cloud-hosting-expert/SKILL.md +244 -0
  23. package/skills/coderabbit/SKILL.md +192 -0
  24. package/skills/data-telemetry-expert/SKILL.md +213 -0
  25. package/skills/database-orm-expert/SKILL.md +294 -0
  26. package/skills/design-system-architect/SKILL.md +243 -0
  27. package/skills/e2e-testing-expert/SKILL.md +315 -0
  28. package/skills/event-driven-architect/SKILL.md +81 -0
  29. package/skills/firebase-security-expert/SKILL.md +195 -0
  30. package/skills/fullstack-expert/SKILL.md +202 -0
  31. package/skills/fullstack-expert/references/api_design_guide.md +466 -0
  32. package/skills/fullstack-expert/references/devops_infrastructure.md +477 -0
  33. package/skills/fullstack-expert/references/multi_language_backend.md +528 -0
  34. package/skills/fullstack-expert/references/system_design_patterns.md +358 -0
  35. package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -0
  36. package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -0
  37. package/skills/gemini-agent-booster/SKILL.md +135 -0
  38. package/skills/global-a11y-i18n-expert/SKILL.md +81 -0
  39. package/skills/go-programming-expert/SKILL.md +295 -0
  40. package/skills/hig/SKILL.md +188 -0
  41. package/skills/js-backend-expert/SKILL.md +192 -0
  42. package/skills/mcp-server-architect/SKILL.md +194 -0
  43. package/skills/mobile-expo-expert/SKILL.md +186 -0
  44. package/skills/monday-design-aesthetic/SKILL.md +67 -0
  45. package/skills/monorepo-architect/SKILL.md +227 -0
  46. package/skills/mpa-orchestrator/SKILL.md +101 -0
  47. package/skills/multi-agent-orchestration/SKILL.md +234 -0
  48. package/skills/multiple-entry-points/SKILL.md +55 -0
  49. package/skills/mvc-expert/SKILL.md +231 -0
  50. package/skills/payment-gateway-expert/SKILL.md +45 -0
  51. package/skills/performance-web-vitals/SKILL.md +332 -0
  52. package/skills/prd-architect/SKILL.md +191 -0
  53. package/skills/production-ready-hardener/SKILL.md +469 -0
  54. package/skills/production-ready-hardener/references/performance_optimization.md +441 -0
  55. package/skills/production-ready-hardener/references/production_checklist.md +161 -0
  56. package/skills/production-ready-hardener/references/security_hardening_guide.md +379 -0
  57. package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +875 -0
  58. package/skills/python-programming-expert/SKILL.md +271 -0
  59. package/skills/realtime-collaboration-expert/SKILL.md +45 -0
  60. package/skills/rust-programming-expert/SKILL.md +235 -0
  61. package/skills/saas-billing/SKILL.md +377 -0
  62. package/skills/saas-multi-tenant/SKILL.md +237 -0
  63. package/skills/saas-mvp-launcher/SKILL.md +231 -0
  64. package/skills/saas-transformer/SKILL.md +446 -0
  65. package/skills/saas-transformer/references/billing_integration_guide.md +401 -0
  66. package/skills/saas-transformer/references/feature_gating_patterns.md +137 -0
  67. package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -0
  68. package/skills/saas-transformer/scripts/saas_transformation_scanner.py +254 -0
  69. package/skills/scalability-clean-code/SKILL.md +229 -0
  70. package/skills/secure-fuzz-testing/SKILL.md +201 -0
  71. package/skills/senior-frontend/SKILL.md +161 -0
  72. package/skills/senior-frontend/references/frontend_best_practices.md +806 -0
  73. package/skills/senior-frontend/references/nextjs_optimization_guide.md +724 -0
  74. package/skills/senior-frontend/references/react_patterns.md +746 -0
  75. package/skills/senior-frontend/scripts/bundle_analyzer.py +407 -0
  76. package/skills/senior-frontend/scripts/component_generator.py +329 -0
  77. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1005 -0
  78. package/skills/senior-fullstack/SKILL.md +167 -0
  79. package/skills/senior-fullstack/references/architecture_patterns.md +160 -0
  80. package/skills/senior-fullstack/references/development_workflows.md +222 -0
  81. package/skills/senior-fullstack/references/tech_stack_guide.md +190 -0
  82. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +114 -0
  83. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +114 -0
  84. package/skills/senior-fullstack/scripts/project_scaffolder.py +114 -0
  85. package/skills/seo/SKILL.md +225 -0
  86. package/skills/seo/references/cwv-thresholds.md +108 -0
  87. package/skills/seo/references/eeat-framework.md +214 -0
  88. package/skills/seo/references/quality-gates.md +155 -0
  89. package/skills/seo/references/schema-types.md +118 -0
  90. package/skills/seo-aeo-landing-page-writer/SKILL.md +97 -0
  91. package/skills/seo-geo/SKILL.md +188 -0
  92. package/skills/session-handoff-resume/SKILL.md +158 -0
  93. package/skills/skill_baru/SKILL.md +147 -0
  94. package/skills/spa-orchestrator/SKILL.md +288 -0
  95. package/skills/state-management-expert/SKILL.md +272 -0
  96. package/skills/supabase-migration/SKILL.md +45 -0
  97. package/skills/supabase-security-expert/SKILL.md +243 -0
  98. package/skills/tailwind-expert/SKILL.md +188 -0
  99. package/skills/tanstack-query-expert/SKILL.md +199 -0
  100. package/skills/tauri-expert/SKILL.md +97 -0
  101. package/skills/token-saver/SKILL.md +111 -0
  102. package/skills/typescript-expert/SKILL.md +279 -0
  103. package/skills/ui-components-expert/SKILL.md +63 -0
  104. package/skills/ui-ux-pro-max/SKILL.md +201 -0
  105. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  106. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  107. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  108. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  109. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  110. package/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  111. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  112. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  113. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  114. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  115. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  116. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  117. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  118. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  119. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  120. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  121. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  122. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  123. package/skills/ui-ux-pro-max/data/styles.csv +59 -0
  124. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  125. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  126. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  127. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  128. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  129. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  130. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  131. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  132. package/skills/ui-ux-pro-max/scripts/core.py +257 -0
  133. package/skills/ui-ux-pro-max/scripts/design_system.py +493 -0
  134. package/skills/ui-ux-pro-max/scripts/search.py +81 -0
  135. package/skills/ui_ux_expert/SKILL.md +114 -0
  136. package/skills/vibe-code-gardener/SKILL.md +173 -0
  137. package/skills/web-scraper/SKILL.md +205 -0
  138. package/skills/web-scraper/references/data-transforms.md +397 -0
  139. package/skills/web-scraper/references/extraction-patterns.md +475 -0
  140. package/skills/web-scraper/references/output-templates.md +481 -0
  141. package/skills/zero-to-prod-orchestrator/SKILL.md +180 -0
@@ -0,0 +1,493 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Design System Generator - Aggregates search results and applies reasoning
5
+ to generate comprehensive design system recommendations.
6
+
7
+ Usage:
8
+ from design_system import generate_design_system
9
+ result = generate_design_system("SaaS dashboard", "My Project")
10
+ """
11
+
12
+ import csv
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ if hasattr(sys.stdout, 'reconfigure'):
18
+ sys.stdout.reconfigure(encoding='utf-8')
19
+
20
+ from core import search, DATA_DIR
21
+
22
+
23
+ # ============ CONFIGURATION ============
24
+ REASONING_FILE = "ui-reasoning.csv"
25
+
26
+ SEARCH_CONFIG = {
27
+ "product": {"max_results": 1},
28
+ "style": {"max_results": 3},
29
+ "color": {"max_results": 2},
30
+ "landing": {"max_results": 2},
31
+ "typography": {"max_results": 2}
32
+ }
33
+
34
+
35
+ # ============ DESIGN SYSTEM GENERATOR ============
36
+ class DesignSystemGenerator:
37
+ """Generates design system recommendations from aggregated searches."""
38
+
39
+ def __init__(self):
40
+ self.reasoning_data = self._load_reasoning()
41
+
42
+ def _load_reasoning(self) -> list:
43
+ """Load reasoning rules from CSV."""
44
+ filepath = DATA_DIR / REASONING_FILE
45
+ if not filepath.exists():
46
+ return []
47
+ with open(filepath, 'r', encoding='utf-8') as f:
48
+ return list(csv.DictReader(f))
49
+
50
+ def _multi_domain_search(self, query: str, style_priority: list = None) -> dict:
51
+ """Execute searches across multiple domains."""
52
+ results = {}
53
+ for domain, config in SEARCH_CONFIG.items():
54
+ if domain == "style" and style_priority:
55
+ # For style, also search with priority keywords
56
+ priority_query = " ".join(style_priority[:2]) if style_priority else query
57
+ combined_query = f"{query} {priority_query}"
58
+ results[domain] = search(combined_query, domain, config["max_results"])
59
+ else:
60
+ results[domain] = search(query, domain, config["max_results"])
61
+ return results
62
+
63
+ def _find_reasoning_rule(self, category: str) -> dict:
64
+ """Find matching reasoning rule for a category."""
65
+ category_lower = category.lower()
66
+
67
+ # Try exact match first
68
+ for rule in self.reasoning_data:
69
+ if rule.get("UI_Category", "").lower() == category_lower:
70
+ return rule
71
+
72
+ # Try partial match
73
+ for rule in self.reasoning_data:
74
+ ui_cat = rule.get("UI_Category", "").lower()
75
+ if ui_cat in category_lower or category_lower in ui_cat:
76
+ return rule
77
+
78
+ # Try keyword match
79
+ for rule in self.reasoning_data:
80
+ ui_cat = rule.get("UI_Category", "").lower()
81
+ keywords = ui_cat.replace("/", " ").replace("-", " ").split()
82
+ if any(kw in category_lower for kw in keywords):
83
+ return rule
84
+
85
+ return {}
86
+
87
+ def _apply_reasoning(self, category: str, search_results: dict) -> dict:
88
+ """Apply reasoning rules to search results."""
89
+ rule = self._find_reasoning_rule(category)
90
+
91
+ if not rule:
92
+ return {
93
+ "pattern": "Hero + Features + CTA",
94
+ "style_priority": ["Minimalism", "Flat Design"],
95
+ "color_mood": "Professional",
96
+ "typography_mood": "Clean",
97
+ "key_effects": "Subtle hover transitions",
98
+ "anti_patterns": "",
99
+ "decision_rules": {},
100
+ "severity": "MEDIUM"
101
+ }
102
+
103
+ # Parse decision rules JSON
104
+ decision_rules = {}
105
+ try:
106
+ decision_rules = json.loads(rule.get("Decision_Rules", "{}"))
107
+ except json.JSONDecodeError:
108
+ pass
109
+
110
+ return {
111
+ "pattern": rule.get("Recommended_Pattern", ""),
112
+ "style_priority": [s.strip() for s in rule.get("Style_Priority", "").split("+")],
113
+ "color_mood": rule.get("Color_Mood", ""),
114
+ "typography_mood": rule.get("Typography_Mood", ""),
115
+ "key_effects": rule.get("Key_Effects", ""),
116
+ "anti_patterns": rule.get("Anti_Patterns", ""),
117
+ "decision_rules": decision_rules,
118
+ "severity": rule.get("Severity", "MEDIUM")
119
+ }
120
+
121
+ def _select_best_match(self, results: list, priority_keywords: list) -> dict:
122
+ """Select best matching result based on priority keywords."""
123
+ if not results:
124
+ return {}
125
+
126
+ if not priority_keywords:
127
+ return results[0]
128
+
129
+ # First: try exact style name match
130
+ for priority in priority_keywords:
131
+ priority_lower = priority.lower().strip()
132
+ for result in results:
133
+ style_name = result.get("Style Category", "").lower()
134
+ if priority_lower in style_name or style_name in priority_lower:
135
+ return result
136
+
137
+ # Second: score by keyword match in all fields
138
+ scored = []
139
+ for result in results:
140
+ result_str = str(result).lower()
141
+ score = 0
142
+ for kw in priority_keywords:
143
+ kw_lower = kw.lower().strip()
144
+ # Higher score for style name match
145
+ if kw_lower in result.get("Style Category", "").lower():
146
+ score += 10
147
+ # Lower score for keyword field match
148
+ elif kw_lower in result.get("Keywords", "").lower():
149
+ score += 3
150
+ # Even lower for other field matches
151
+ elif kw_lower in result_str:
152
+ score += 1
153
+ scored.append((score, result))
154
+
155
+ scored.sort(key=lambda x: x[0], reverse=True)
156
+ return scored[0][1] if scored and scored[0][0] > 0 else results[0]
157
+
158
+ def _extract_results(self, search_result: dict) -> list:
159
+ """Extract results list from search result dict."""
160
+ return search_result.get("results", [])
161
+
162
+ def generate(self, query: str, project_name: str = None) -> dict:
163
+ """Generate complete design system recommendation."""
164
+ # Step 1: First search product to get category
165
+ product_result = search(query, "product", 1)
166
+ product_results = product_result.get("results", [])
167
+ category = "General"
168
+ if product_results:
169
+ category = product_results[0].get("Product Type", "General")
170
+
171
+ # Step 2: Get reasoning rules for this category
172
+ reasoning = self._apply_reasoning(category, {})
173
+ style_priority = reasoning.get("style_priority", [])
174
+
175
+ # Step 3: Multi-domain search with style priority hints
176
+ search_results = self._multi_domain_search(query, style_priority)
177
+ search_results["product"] = product_result # Reuse product search
178
+
179
+ # Step 4: Select best matches from each domain using priority
180
+ style_results = self._extract_results(search_results.get("style", {}))
181
+ color_results = self._extract_results(search_results.get("color", {}))
182
+ typography_results = self._extract_results(search_results.get("typography", {}))
183
+ landing_results = self._extract_results(search_results.get("landing", {}))
184
+
185
+ best_style = self._select_best_match(style_results, reasoning.get("style_priority", []))
186
+ best_color = color_results[0] if color_results else {}
187
+ best_typography = typography_results[0] if typography_results else {}
188
+ best_landing = landing_results[0] if landing_results else {}
189
+
190
+ # Step 5: Build final recommendation
191
+ # Combine effects from both reasoning and style search
192
+ style_effects = best_style.get("Effects & Animation", "")
193
+ reasoning_effects = reasoning.get("key_effects", "")
194
+ combined_effects = style_effects if style_effects else reasoning_effects
195
+
196
+ return {
197
+ "project_name": project_name or query.upper(),
198
+ "category": category,
199
+ "pattern": {
200
+ "name": best_landing.get("Pattern Name", reasoning.get("pattern", "Hero + Features + CTA")),
201
+ "sections": best_landing.get("Section Order", "Hero > Features > CTA"),
202
+ "cta_placement": best_landing.get("Primary CTA Placement", "Above fold"),
203
+ "color_strategy": best_landing.get("Color Strategy", ""),
204
+ "conversion": best_landing.get("Conversion Optimization", "")
205
+ },
206
+ "style": {
207
+ "name": best_style.get("Style Category", "Minimalism"),
208
+ "type": best_style.get("Type", "General"),
209
+ "effects": style_effects,
210
+ "keywords": best_style.get("Keywords", ""),
211
+ "best_for": best_style.get("Best For", ""),
212
+ "performance": best_style.get("Performance", ""),
213
+ "accessibility": best_style.get("Accessibility", "")
214
+ },
215
+ "colors": {
216
+ "primary": best_color.get("Primary (Hex)", "#2563EB"),
217
+ "secondary": best_color.get("Secondary (Hex)", "#3B82F6"),
218
+ "cta": best_color.get("CTA (Hex)", "#F97316"),
219
+ "background": best_color.get("Background (Hex)", "#F8FAFC"),
220
+ "text": best_color.get("Text (Hex)", "#1E293B"),
221
+ "notes": best_color.get("Notes", "")
222
+ },
223
+ "typography": {
224
+ "heading": best_typography.get("Heading Font", "Inter"),
225
+ "body": best_typography.get("Body Font", "Inter"),
226
+ "mood": best_typography.get("Mood/Style Keywords", reasoning.get("typography_mood", "")),
227
+ "best_for": best_typography.get("Best For", ""),
228
+ "google_fonts_url": best_typography.get("Google Fonts URL", ""),
229
+ "css_import": best_typography.get("CSS Import", "")
230
+ },
231
+ "key_effects": combined_effects,
232
+ "anti_patterns": reasoning.get("anti_patterns", ""),
233
+ "decision_rules": reasoning.get("decision_rules", {}),
234
+ "severity": reasoning.get("severity", "MEDIUM")
235
+ }
236
+
237
+
238
+ # ============ OUTPUT FORMATTERS ============
239
+ BOX_WIDTH = 90 # Wider box for more content
240
+
241
+ def format_ascii_box(design_system: dict) -> str:
242
+ """Format design system as ASCII box with emojis (MCP-style)."""
243
+ project = design_system.get("project_name", "PROJECT")
244
+ pattern = design_system.get("pattern", {})
245
+ style = design_system.get("style", {})
246
+ colors = design_system.get("colors", {})
247
+ typography = design_system.get("typography", {})
248
+ effects = design_system.get("key_effects", "")
249
+ anti_patterns = design_system.get("anti_patterns", "")
250
+
251
+ def wrap_text(text: str, prefix: str, width: int) -> list:
252
+ """Wrap long text into multiple lines."""
253
+ if not text:
254
+ return []
255
+ words = text.split()
256
+ lines = []
257
+ current_line = prefix
258
+ for word in words:
259
+ if len(current_line) + len(word) + 1 <= width - 2:
260
+ current_line += (" " if current_line != prefix else "") + word
261
+ else:
262
+ if current_line != prefix:
263
+ lines.append(current_line)
264
+ current_line = prefix + word
265
+ if current_line != prefix:
266
+ lines.append(current_line)
267
+ return lines
268
+
269
+ # Build sections from pattern
270
+ sections = pattern.get("sections", "").split(">")
271
+ sections = [s.strip() for s in sections if s.strip()]
272
+
273
+ # Build output lines
274
+ lines = []
275
+ w = BOX_WIDTH - 1
276
+
277
+ lines.append("+" + "-" * w + "+")
278
+ lines.append(f"| TARGET: {project} - RECOMMENDED DESIGN SYSTEM".ljust(BOX_WIDTH) + "|")
279
+ lines.append("+" + "-" * w + "+")
280
+ lines.append("|" + " " * BOX_WIDTH + "|")
281
+
282
+ # Pattern section
283
+ lines.append(f"| PATTERN: {pattern.get('name', '')}".ljust(BOX_WIDTH) + "|")
284
+ if pattern.get('conversion'):
285
+ lines.append(f"| Conversion: {pattern.get('conversion', '')}".ljust(BOX_WIDTH) + "|")
286
+ if pattern.get('cta_placement'):
287
+ lines.append(f"| CTA: {pattern.get('cta_placement', '')}".ljust(BOX_WIDTH) + "|")
288
+ lines.append("| Sections:".ljust(BOX_WIDTH) + "|")
289
+ for i, section in enumerate(sections, 1):
290
+ lines.append(f"| {i}. {section}".ljust(BOX_WIDTH) + "|")
291
+ lines.append("|" + " " * BOX_WIDTH + "|")
292
+
293
+ # Style section
294
+ lines.append(f"| STYLE: {style.get('name', '')}".ljust(BOX_WIDTH) + "|")
295
+ if style.get("keywords"):
296
+ for line in wrap_text(f"Keywords: {style.get('keywords', '')}", "| ", BOX_WIDTH):
297
+ lines.append(line.ljust(BOX_WIDTH) + "|")
298
+ if style.get("best_for"):
299
+ for line in wrap_text(f"Best For: {style.get('best_for', '')}", "| ", BOX_WIDTH):
300
+ lines.append(line.ljust(BOX_WIDTH) + "|")
301
+ if style.get("performance") or style.get("accessibility"):
302
+ perf_a11y = f"Performance: {style.get('performance', '')} | Accessibility: {style.get('accessibility', '')}"
303
+ lines.append(f"| {perf_a11y}".ljust(BOX_WIDTH) + "|")
304
+ lines.append("|" + " " * BOX_WIDTH + "|")
305
+
306
+ # Colors section
307
+ lines.append("| COLORS:".ljust(BOX_WIDTH) + "|")
308
+ lines.append(f"| Primary: {colors.get('primary', '')}".ljust(BOX_WIDTH) + "|")
309
+ lines.append(f"| Secondary: {colors.get('secondary', '')}".ljust(BOX_WIDTH) + "|")
310
+ lines.append(f"| CTA: {colors.get('cta', '')}".ljust(BOX_WIDTH) + "|")
311
+ lines.append(f"| Background: {colors.get('background', '')}".ljust(BOX_WIDTH) + "|")
312
+ lines.append(f"| Text: {colors.get('text', '')}".ljust(BOX_WIDTH) + "|")
313
+ if colors.get("notes"):
314
+ for line in wrap_text(f"Notes: {colors.get('notes', '')}", "| ", BOX_WIDTH):
315
+ lines.append(line.ljust(BOX_WIDTH) + "|")
316
+ lines.append("|" + " " * BOX_WIDTH + "|")
317
+
318
+ # Typography section
319
+ lines.append(f"| TYPOGRAPHY: {typography.get('heading', '')} / {typography.get('body', '')}".ljust(BOX_WIDTH) + "|")
320
+ if typography.get("mood"):
321
+ for line in wrap_text(f"Mood: {typography.get('mood', '')}", "| ", BOX_WIDTH):
322
+ lines.append(line.ljust(BOX_WIDTH) + "|")
323
+ if typography.get("best_for"):
324
+ for line in wrap_text(f"Best For: {typography.get('best_for', '')}", "| ", BOX_WIDTH):
325
+ lines.append(line.ljust(BOX_WIDTH) + "|")
326
+ if typography.get("google_fonts_url"):
327
+ lines.append(f"| Google Fonts: {typography.get('google_fonts_url', '')}".ljust(BOX_WIDTH) + "|")
328
+ if typography.get("css_import"):
329
+ lines.append(f"| CSS Import: {typography.get('css_import', '')[:70]}...".ljust(BOX_WIDTH) + "|")
330
+ lines.append("|" + " " * BOX_WIDTH + "|")
331
+
332
+ # Key Effects section
333
+ if effects:
334
+ lines.append("| KEY EFFECTS:".ljust(BOX_WIDTH) + "|")
335
+ for line in wrap_text(effects, "| ", BOX_WIDTH):
336
+ lines.append(line.ljust(BOX_WIDTH) + "|")
337
+ lines.append("|" + " " * BOX_WIDTH + "|")
338
+
339
+ # Anti-patterns section
340
+ if anti_patterns:
341
+ lines.append("| AVOID (Anti-patterns):".ljust(BOX_WIDTH) + "|")
342
+ for line in wrap_text(anti_patterns, "| ", BOX_WIDTH):
343
+ lines.append(line.ljust(BOX_WIDTH) + "|")
344
+ lines.append("|" + " " * BOX_WIDTH + "|")
345
+
346
+ # Pre-Delivery Checklist section
347
+ lines.append("| PRE-DELIVERY CHECKLIST:".ljust(BOX_WIDTH) + "|")
348
+ checklist_items = [
349
+ "[ ] No emojis as icons (use SVG: Heroicons/Lucide)",
350
+ "[ ] cursor-pointer on all clickable elements",
351
+ "[ ] Hover states with smooth transitions (150-300ms)",
352
+ "[ ] Light mode: text contrast 4.5:1 minimum",
353
+ "[ ] Focus states visible for keyboard nav",
354
+ "[ ] prefers-reduced-motion respected",
355
+ "[ ] Responsive: 375px, 768px, 1024px, 1440px"
356
+ ]
357
+ for item in checklist_items:
358
+ lines.append(f"| {item}".ljust(BOX_WIDTH) + "|")
359
+ lines.append("|" + " " * BOX_WIDTH + "|")
360
+
361
+ lines.append("+" + "-" * w + "+")
362
+
363
+ return "\n".join(lines)
364
+
365
+
366
+ def format_markdown(design_system: dict) -> str:
367
+ """Format design system as markdown."""
368
+ project = design_system.get("project_name", "PROJECT")
369
+ pattern = design_system.get("pattern", {})
370
+ style = design_system.get("style", {})
371
+ colors = design_system.get("colors", {})
372
+ typography = design_system.get("typography", {})
373
+ effects = design_system.get("key_effects", "")
374
+ anti_patterns = design_system.get("anti_patterns", "")
375
+
376
+ lines = []
377
+ lines.append(f"## Design System: {project}")
378
+ lines.append("")
379
+
380
+ # Pattern section
381
+ lines.append("### Pattern")
382
+ lines.append(f"- **Name:** {pattern.get('name', '')}")
383
+ if pattern.get('conversion'):
384
+ lines.append(f"- **Conversion Focus:** {pattern.get('conversion', '')}")
385
+ if pattern.get('cta_placement'):
386
+ lines.append(f"- **CTA Placement:** {pattern.get('cta_placement', '')}")
387
+ if pattern.get('color_strategy'):
388
+ lines.append(f"- **Color Strategy:** {pattern.get('color_strategy', '')}")
389
+ lines.append(f"- **Sections:** {pattern.get('sections', '')}")
390
+ lines.append("")
391
+
392
+ # Style section
393
+ lines.append("### Style")
394
+ lines.append(f"- **Name:** {style.get('name', '')}")
395
+ if style.get('keywords'):
396
+ lines.append(f"- **Keywords:** {style.get('keywords', '')}")
397
+ if style.get('best_for'):
398
+ lines.append(f"- **Best For:** {style.get('best_for', '')}")
399
+ if style.get('performance') or style.get('accessibility'):
400
+ lines.append(f"- **Performance:** {style.get('performance', '')} | **Accessibility:** {style.get('accessibility', '')}")
401
+ lines.append("")
402
+
403
+ # Colors section
404
+ lines.append("### Colors")
405
+ lines.append(f"| Role | Hex |")
406
+ lines.append(f"|------|-----|")
407
+ lines.append(f"| Primary | {colors.get('primary', '')} |")
408
+ lines.append(f"| Secondary | {colors.get('secondary', '')} |")
409
+ lines.append(f"| CTA | {colors.get('cta', '')} |")
410
+ lines.append(f"| Background | {colors.get('background', '')} |")
411
+ lines.append(f"| Text | {colors.get('text', '')} |")
412
+ if colors.get("notes"):
413
+ lines.append(f"\n*Notes: {colors.get('notes', '')}*")
414
+ lines.append("")
415
+
416
+ # Typography section
417
+ lines.append("### Typography")
418
+ lines.append(f"- **Heading:** {typography.get('heading', '')}")
419
+ lines.append(f"- **Body:** {typography.get('body', '')}")
420
+ if typography.get("mood"):
421
+ lines.append(f"- **Mood:** {typography.get('mood', '')}")
422
+ if typography.get("best_for"):
423
+ lines.append(f"- **Best For:** {typography.get('best_for', '')}")
424
+ if typography.get("google_fonts_url"):
425
+ lines.append(f"- **Google Fonts:** {typography.get('google_fonts_url', '')}")
426
+ if typography.get("css_import"):
427
+ lines.append(f"- **CSS Import:**")
428
+ lines.append(f"```css")
429
+ lines.append(f"{typography.get('css_import', '')}")
430
+ lines.append(f"```")
431
+ lines.append("")
432
+
433
+ # Key Effects section
434
+ if effects:
435
+ lines.append("### Key Effects")
436
+ lines.append(f"{effects}")
437
+ lines.append("")
438
+
439
+ # Anti-patterns section
440
+ if anti_patterns:
441
+ lines.append("### Avoid (Anti-patterns)")
442
+ formatted_anti_patterns = anti_patterns.replace(' + ', '\n- ')
443
+ lines.append(f"- {formatted_anti_patterns}")
444
+ lines.append("")
445
+
446
+ # Pre-Delivery Checklist section
447
+ lines.append("### Pre-Delivery Checklist")
448
+ lines.append("- [ ] No emojis as icons (use SVG: Heroicons/Lucide)")
449
+ lines.append("- [ ] cursor-pointer on all clickable elements")
450
+ lines.append("- [ ] Hover states with smooth transitions (150-300ms)")
451
+ lines.append("- [ ] Light mode: text contrast 4.5:1 minimum")
452
+ lines.append("- [ ] Focus states visible for keyboard nav")
453
+ lines.append("- [ ] prefers-reduced-motion respected")
454
+ lines.append("- [ ] Responsive: 375px, 768px, 1024px, 1440px")
455
+ lines.append("")
456
+
457
+ return "\n".join(lines)
458
+
459
+
460
+ # ============ MAIN ENTRY POINT ============
461
+ def generate_design_system(query: str, project_name: str = None, output_format: str = "ascii") -> str:
462
+ """
463
+ Main entry point for design system generation.
464
+
465
+ Args:
466
+ query: Search query (e.g., "SaaS dashboard", "e-commerce luxury")
467
+ project_name: Optional project name for output header
468
+ output_format: "ascii" (default) or "markdown"
469
+
470
+ Returns:
471
+ Formatted design system string
472
+ """
473
+ generator = DesignSystemGenerator()
474
+ design_system = generator.generate(query, project_name)
475
+
476
+ if output_format == "markdown":
477
+ return format_markdown(design_system)
478
+ return format_ascii_box(design_system)
479
+
480
+
481
+ # ============ CLI SUPPORT ============
482
+ if __name__ == "__main__":
483
+ import argparse
484
+
485
+ parser = argparse.ArgumentParser(description="Generate Design System")
486
+ parser.add_argument("query", help="Search query (e.g., 'SaaS dashboard')")
487
+ parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name")
488
+ parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format")
489
+
490
+ args = parser.parse_args()
491
+
492
+ result = generate_design_system(args.query, args.project_name, args.format)
493
+ print(result)
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ UI/UX Pro Max Search - BM25 search engine for UI/UX style guides
5
+ Usage: python search.py "<query>" [--domain <domain>] [--stack <stack>] [--max-results 3]
6
+ python search.py "<query>" --design-system [-p "Project Name"]
7
+
8
+ Domains: style, prompt, color, chart, landing, product, ux, typography
9
+ Stacks: html-tailwind, react, nextjs
10
+ """
11
+
12
+ import argparse
13
+ import sys
14
+
15
+ if hasattr(sys.stdout, 'reconfigure'):
16
+ sys.stdout.reconfigure(encoding='utf-8')
17
+
18
+ from core import CSV_CONFIG, AVAILABLE_STACKS, MAX_RESULTS, search, search_stack
19
+ from design_system import generate_design_system
20
+
21
+
22
+ def format_output(result):
23
+ """Format results for Claude consumption (token-optimized)"""
24
+ if "error" in result:
25
+ return f"Error: {result['error']}"
26
+
27
+ output = []
28
+ if result.get("stack"):
29
+ output.append(f"## UI Pro Max Stack Guidelines")
30
+ output.append(f"**Stack:** {result['stack']} | **Query:** {result['query']}")
31
+ else:
32
+ output.append(f"## UI Pro Max Search Results")
33
+ output.append(f"**Domain:** {result['domain']} | **Query:** {result['query']}")
34
+ output.append(f"**Source:** {result['file']} | **Found:** {result['count']} results\n")
35
+
36
+ for i, row in enumerate(result['results'], 1):
37
+ output.append(f"### Result {i}")
38
+ for key, value in row.items():
39
+ value_str = str(value)
40
+ if len(value_str) > 300:
41
+ value_str = value_str[:300] + "..."
42
+ output.append(f"- **{key}:** {value_str}")
43
+ output.append("")
44
+
45
+ return "\n".join(output)
46
+
47
+
48
+ if __name__ == "__main__":
49
+ parser = argparse.ArgumentParser(description="UI Pro Max Search")
50
+ parser.add_argument("query", help="Search query")
51
+ parser.add_argument("--domain", "-d", choices=list(CSV_CONFIG.keys()), help="Search domain")
52
+ parser.add_argument("--stack", "-s", choices=AVAILABLE_STACKS, help="Stack-specific search (html-tailwind, react, nextjs)")
53
+ parser.add_argument("--max-results", "-n", type=int, default=MAX_RESULTS, help="Max results (default: 3)")
54
+ parser.add_argument("--json", action="store_true", help="Output as JSON")
55
+ # Design system generation
56
+ parser.add_argument("--design-system", "-ds", action="store_true", help="Generate complete design system recommendation")
57
+ parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name for design system output")
58
+ parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format for design system")
59
+
60
+ args = parser.parse_args()
61
+
62
+ # Design system takes priority
63
+ if args.design_system:
64
+ result = generate_design_system(args.query, args.project_name, args.format)
65
+ print(result)
66
+ # Stack search
67
+ elif args.stack:
68
+ result = search_stack(args.query, args.stack, args.max_results)
69
+ if args.json:
70
+ import json
71
+ print(json.dumps(result, indent=2, ensure_ascii=False))
72
+ else:
73
+ print(format_output(result))
74
+ # Domain search
75
+ else:
76
+ result = search(args.query, args.domain, args.max_results)
77
+ if args.json:
78
+ import json
79
+ print(json.dumps(result, indent=2, ensure_ascii=False))
80
+ else:
81
+ print(format_output(result))