@musashishao/agent-kit 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.
Potentially problematic release.
This version of @musashishao/agent-kit might be problematic. Click here for more details.
- package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +487 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +76 -0
- package/.agent/ARCHITECTURE.md +225 -0
- package/.agent/CONTEXT.md +229 -0
- package/.agent/FEATURE_ROADMAP.md +435 -0
- package/.agent/PROMPT_TEMPLATES.md +261 -0
- package/.agent/agents/backend-specialist.md +263 -0
- package/.agent/agents/database-architect.md +226 -0
- package/.agent/agents/debugger.md +225 -0
- package/.agent/agents/devops-engineer.md +242 -0
- package/.agent/agents/documentation-writer.md +104 -0
- package/.agent/agents/explorer-agent.md +73 -0
- package/.agent/agents/frontend-specialist.md +556 -0
- package/.agent/agents/game-developer.md +162 -0
- package/.agent/agents/mobile-developer.md +377 -0
- package/.agent/agents/orchestrator.md +416 -0
- package/.agent/agents/penetration-tester.md +188 -0
- package/.agent/agents/performance-optimizer.md +187 -0
- package/.agent/agents/project-planner.md +403 -0
- package/.agent/agents/security-auditor.md +170 -0
- package/.agent/agents/seo-specialist.md +111 -0
- package/.agent/agents/test-engineer.md +158 -0
- package/.agent/rules/GEMINI.md +251 -0
- package/.agent/skills/api-patterns/SKILL.md +81 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +71 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +40 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
- package/.agent/skills/architecture/SKILL.md +55 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/bash-linux/SKILL.md +199 -0
- package/.agent/skills/behavioral-modes/SKILL.md +242 -0
- package/.agent/skills/brainstorming/SKILL.md +163 -0
- package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
- package/.agent/skills/clean-code/SKILL.md +201 -0
- package/.agent/skills/code-review-checklist/SKILL.md +109 -0
- package/.agent/skills/database-design/SKILL.md +52 -0
- package/.agent/skills/database-design/database-selection.md +43 -0
- package/.agent/skills/database-design/indexing.md +39 -0
- package/.agent/skills/database-design/migrations.md +48 -0
- package/.agent/skills/database-design/optimization.md +36 -0
- package/.agent/skills/database-design/orm-selection.md +30 -0
- package/.agent/skills/database-design/schema-design.md +56 -0
- package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
- package/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/docker-expert/SKILL.md +409 -0
- package/.agent/skills/documentation-templates/SKILL.md +194 -0
- package/.agent/skills/frontend-design/SKILL.md +396 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +311 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +541 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
- package/.agent/skills/game-development/SKILL.md +167 -0
- package/.agent/skills/game-development/game-art/SKILL.md +185 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
- package/.agent/skills/game-development/game-design/SKILL.md +129 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.agent/skills/game-development/web-games/SKILL.md +150 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
- package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/lint-and-validate/SKILL.md +45 -0
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +172 -0
- package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/mobile-design/SKILL.md +394 -0
- package/.agent/skills/mobile-design/decision-trees.md +516 -0
- package/.agent/skills/mobile-design/mobile-backend.md +491 -0
- package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
- package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
- package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
- package/.agent/skills/mobile-design/mobile-performance.md +767 -0
- package/.agent/skills/mobile-design/mobile-testing.md +356 -0
- package/.agent/skills/mobile-design/mobile-typography.md +433 -0
- package/.agent/skills/mobile-design/platform-android.md +666 -0
- package/.agent/skills/mobile-design/platform-ios.md +561 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/.agent/skills/mobile-design/touch-psychology.md +537 -0
- package/.agent/skills/nestjs-expert/SKILL.md +552 -0
- package/.agent/skills/nextjs-best-practices/SKILL.md +203 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
- package/.agent/skills/parallel-agents/SKILL.md +175 -0
- package/.agent/skills/performance-profiling/SKILL.md +143 -0
- package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/.agent/skills/plan-writing/SKILL.md +152 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -0
- package/.agent/skills/prisma-expert/SKILL.md +355 -0
- package/.agent/skills/python-patterns/SKILL.md +441 -0
- package/.agent/skills/react-patterns/SKILL.md +198 -0
- package/.agent/skills/red-team-tactics/SKILL.md +199 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
- package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/.agent/skills/server-management/SKILL.md +161 -0
- package/.agent/skills/systematic-debugging/SKILL.md +109 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
- package/.agent/skills/tdd-workflow/SKILL.md +149 -0
- package/.agent/skills/testing-patterns/SKILL.md +178 -0
- package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/.agent/skills/typescript-expert/SKILL.md +429 -0
- package/.agent/skills/typescript-expert/references/tsconfig-strict.json +92 -0
- package/.agent/skills/typescript-expert/references/typescript-cheatsheet.md +383 -0
- package/.agent/skills/typescript-expert/references/utility-types.ts +335 -0
- package/.agent/skills/typescript-expert/scripts/ts_diagnostic.py +203 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +351 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +257 -0
- package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +487 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +76 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
- package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
- package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/.agent/skills/webapp-testing/SKILL.md +187 -0
- package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/orchestrate.md +237 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +80 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +231 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/bin/cli.js +235 -0
- package/index.js +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,487 @@
|
|
|
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
|
+
from pathlib import Path
|
|
15
|
+
from core import search, DATA_DIR
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# ============ CONFIGURATION ============
|
|
19
|
+
REASONING_FILE = "ui-reasoning.csv"
|
|
20
|
+
|
|
21
|
+
SEARCH_CONFIG = {
|
|
22
|
+
"product": {"max_results": 1},
|
|
23
|
+
"style": {"max_results": 3},
|
|
24
|
+
"color": {"max_results": 2},
|
|
25
|
+
"landing": {"max_results": 2},
|
|
26
|
+
"typography": {"max_results": 2}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# ============ DESIGN SYSTEM GENERATOR ============
|
|
31
|
+
class DesignSystemGenerator:
|
|
32
|
+
"""Generates design system recommendations from aggregated searches."""
|
|
33
|
+
|
|
34
|
+
def __init__(self):
|
|
35
|
+
self.reasoning_data = self._load_reasoning()
|
|
36
|
+
|
|
37
|
+
def _load_reasoning(self) -> list:
|
|
38
|
+
"""Load reasoning rules from CSV."""
|
|
39
|
+
filepath = DATA_DIR / REASONING_FILE
|
|
40
|
+
if not filepath.exists():
|
|
41
|
+
return []
|
|
42
|
+
with open(filepath, 'r', encoding='utf-8') as f:
|
|
43
|
+
return list(csv.DictReader(f))
|
|
44
|
+
|
|
45
|
+
def _multi_domain_search(self, query: str, style_priority: list = None) -> dict:
|
|
46
|
+
"""Execute searches across multiple domains."""
|
|
47
|
+
results = {}
|
|
48
|
+
for domain, config in SEARCH_CONFIG.items():
|
|
49
|
+
if domain == "style" and style_priority:
|
|
50
|
+
# For style, also search with priority keywords
|
|
51
|
+
priority_query = " ".join(style_priority[:2]) if style_priority else query
|
|
52
|
+
combined_query = f"{query} {priority_query}"
|
|
53
|
+
results[domain] = search(combined_query, domain, config["max_results"])
|
|
54
|
+
else:
|
|
55
|
+
results[domain] = search(query, domain, config["max_results"])
|
|
56
|
+
return results
|
|
57
|
+
|
|
58
|
+
def _find_reasoning_rule(self, category: str) -> dict:
|
|
59
|
+
"""Find matching reasoning rule for a category."""
|
|
60
|
+
category_lower = category.lower()
|
|
61
|
+
|
|
62
|
+
# Try exact match first
|
|
63
|
+
for rule in self.reasoning_data:
|
|
64
|
+
if rule.get("UI_Category", "").lower() == category_lower:
|
|
65
|
+
return rule
|
|
66
|
+
|
|
67
|
+
# Try partial match
|
|
68
|
+
for rule in self.reasoning_data:
|
|
69
|
+
ui_cat = rule.get("UI_Category", "").lower()
|
|
70
|
+
if ui_cat in category_lower or category_lower in ui_cat:
|
|
71
|
+
return rule
|
|
72
|
+
|
|
73
|
+
# Try keyword match
|
|
74
|
+
for rule in self.reasoning_data:
|
|
75
|
+
ui_cat = rule.get("UI_Category", "").lower()
|
|
76
|
+
keywords = ui_cat.replace("/", " ").replace("-", " ").split()
|
|
77
|
+
if any(kw in category_lower for kw in keywords):
|
|
78
|
+
return rule
|
|
79
|
+
|
|
80
|
+
return {}
|
|
81
|
+
|
|
82
|
+
def _apply_reasoning(self, category: str, search_results: dict) -> dict:
|
|
83
|
+
"""Apply reasoning rules to search results."""
|
|
84
|
+
rule = self._find_reasoning_rule(category)
|
|
85
|
+
|
|
86
|
+
if not rule:
|
|
87
|
+
return {
|
|
88
|
+
"pattern": "Hero + Features + CTA",
|
|
89
|
+
"style_priority": ["Minimalism", "Flat Design"],
|
|
90
|
+
"color_mood": "Professional",
|
|
91
|
+
"typography_mood": "Clean",
|
|
92
|
+
"key_effects": "Subtle hover transitions",
|
|
93
|
+
"anti_patterns": "",
|
|
94
|
+
"decision_rules": {},
|
|
95
|
+
"severity": "MEDIUM"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Parse decision rules JSON
|
|
99
|
+
decision_rules = {}
|
|
100
|
+
try:
|
|
101
|
+
decision_rules = json.loads(rule.get("Decision_Rules", "{}"))
|
|
102
|
+
except json.JSONDecodeError:
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
"pattern": rule.get("Recommended_Pattern", ""),
|
|
107
|
+
"style_priority": [s.strip() for s in rule.get("Style_Priority", "").split("+")],
|
|
108
|
+
"color_mood": rule.get("Color_Mood", ""),
|
|
109
|
+
"typography_mood": rule.get("Typography_Mood", ""),
|
|
110
|
+
"key_effects": rule.get("Key_Effects", ""),
|
|
111
|
+
"anti_patterns": rule.get("Anti_Patterns", ""),
|
|
112
|
+
"decision_rules": decision_rules,
|
|
113
|
+
"severity": rule.get("Severity", "MEDIUM")
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
def _select_best_match(self, results: list, priority_keywords: list) -> dict:
|
|
117
|
+
"""Select best matching result based on priority keywords."""
|
|
118
|
+
if not results:
|
|
119
|
+
return {}
|
|
120
|
+
|
|
121
|
+
if not priority_keywords:
|
|
122
|
+
return results[0]
|
|
123
|
+
|
|
124
|
+
# First: try exact style name match
|
|
125
|
+
for priority in priority_keywords:
|
|
126
|
+
priority_lower = priority.lower().strip()
|
|
127
|
+
for result in results:
|
|
128
|
+
style_name = result.get("Style Category", "").lower()
|
|
129
|
+
if priority_lower in style_name or style_name in priority_lower:
|
|
130
|
+
return result
|
|
131
|
+
|
|
132
|
+
# Second: score by keyword match in all fields
|
|
133
|
+
scored = []
|
|
134
|
+
for result in results:
|
|
135
|
+
result_str = str(result).lower()
|
|
136
|
+
score = 0
|
|
137
|
+
for kw in priority_keywords:
|
|
138
|
+
kw_lower = kw.lower().strip()
|
|
139
|
+
# Higher score for style name match
|
|
140
|
+
if kw_lower in result.get("Style Category", "").lower():
|
|
141
|
+
score += 10
|
|
142
|
+
# Lower score for keyword field match
|
|
143
|
+
elif kw_lower in result.get("Keywords", "").lower():
|
|
144
|
+
score += 3
|
|
145
|
+
# Even lower for other field matches
|
|
146
|
+
elif kw_lower in result_str:
|
|
147
|
+
score += 1
|
|
148
|
+
scored.append((score, result))
|
|
149
|
+
|
|
150
|
+
scored.sort(key=lambda x: x[0], reverse=True)
|
|
151
|
+
return scored[0][1] if scored and scored[0][0] > 0 else results[0]
|
|
152
|
+
|
|
153
|
+
def _extract_results(self, search_result: dict) -> list:
|
|
154
|
+
"""Extract results list from search result dict."""
|
|
155
|
+
return search_result.get("results", [])
|
|
156
|
+
|
|
157
|
+
def generate(self, query: str, project_name: str = None) -> dict:
|
|
158
|
+
"""Generate complete design system recommendation."""
|
|
159
|
+
# Step 1: First search product to get category
|
|
160
|
+
product_result = search(query, "product", 1)
|
|
161
|
+
product_results = product_result.get("results", [])
|
|
162
|
+
category = "General"
|
|
163
|
+
if product_results:
|
|
164
|
+
category = product_results[0].get("Product Type", "General")
|
|
165
|
+
|
|
166
|
+
# Step 2: Get reasoning rules for this category
|
|
167
|
+
reasoning = self._apply_reasoning(category, {})
|
|
168
|
+
style_priority = reasoning.get("style_priority", [])
|
|
169
|
+
|
|
170
|
+
# Step 3: Multi-domain search with style priority hints
|
|
171
|
+
search_results = self._multi_domain_search(query, style_priority)
|
|
172
|
+
search_results["product"] = product_result # Reuse product search
|
|
173
|
+
|
|
174
|
+
# Step 4: Select best matches from each domain using priority
|
|
175
|
+
style_results = self._extract_results(search_results.get("style", {}))
|
|
176
|
+
color_results = self._extract_results(search_results.get("color", {}))
|
|
177
|
+
typography_results = self._extract_results(search_results.get("typography", {}))
|
|
178
|
+
landing_results = self._extract_results(search_results.get("landing", {}))
|
|
179
|
+
|
|
180
|
+
best_style = self._select_best_match(style_results, reasoning.get("style_priority", []))
|
|
181
|
+
best_color = color_results[0] if color_results else {}
|
|
182
|
+
best_typography = typography_results[0] if typography_results else {}
|
|
183
|
+
best_landing = landing_results[0] if landing_results else {}
|
|
184
|
+
|
|
185
|
+
# Step 5: Build final recommendation
|
|
186
|
+
# Combine effects from both reasoning and style search
|
|
187
|
+
style_effects = best_style.get("Effects & Animation", "")
|
|
188
|
+
reasoning_effects = reasoning.get("key_effects", "")
|
|
189
|
+
combined_effects = style_effects if style_effects else reasoning_effects
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
"project_name": project_name or query.upper(),
|
|
193
|
+
"category": category,
|
|
194
|
+
"pattern": {
|
|
195
|
+
"name": best_landing.get("Pattern Name", reasoning.get("pattern", "Hero + Features + CTA")),
|
|
196
|
+
"sections": best_landing.get("Section Order", "Hero > Features > CTA"),
|
|
197
|
+
"cta_placement": best_landing.get("Primary CTA Placement", "Above fold"),
|
|
198
|
+
"color_strategy": best_landing.get("Color Strategy", ""),
|
|
199
|
+
"conversion": best_landing.get("Conversion Optimization", "")
|
|
200
|
+
},
|
|
201
|
+
"style": {
|
|
202
|
+
"name": best_style.get("Style Category", "Minimalism"),
|
|
203
|
+
"type": best_style.get("Type", "General"),
|
|
204
|
+
"effects": style_effects,
|
|
205
|
+
"keywords": best_style.get("Keywords", ""),
|
|
206
|
+
"best_for": best_style.get("Best For", ""),
|
|
207
|
+
"performance": best_style.get("Performance", ""),
|
|
208
|
+
"accessibility": best_style.get("Accessibility", "")
|
|
209
|
+
},
|
|
210
|
+
"colors": {
|
|
211
|
+
"primary": best_color.get("Primary (Hex)", "#2563EB"),
|
|
212
|
+
"secondary": best_color.get("Secondary (Hex)", "#3B82F6"),
|
|
213
|
+
"cta": best_color.get("CTA (Hex)", "#F97316"),
|
|
214
|
+
"background": best_color.get("Background (Hex)", "#F8FAFC"),
|
|
215
|
+
"text": best_color.get("Text (Hex)", "#1E293B"),
|
|
216
|
+
"notes": best_color.get("Notes", "")
|
|
217
|
+
},
|
|
218
|
+
"typography": {
|
|
219
|
+
"heading": best_typography.get("Heading Font", "Inter"),
|
|
220
|
+
"body": best_typography.get("Body Font", "Inter"),
|
|
221
|
+
"mood": best_typography.get("Mood/Style Keywords", reasoning.get("typography_mood", "")),
|
|
222
|
+
"best_for": best_typography.get("Best For", ""),
|
|
223
|
+
"google_fonts_url": best_typography.get("Google Fonts URL", ""),
|
|
224
|
+
"css_import": best_typography.get("CSS Import", "")
|
|
225
|
+
},
|
|
226
|
+
"key_effects": combined_effects,
|
|
227
|
+
"anti_patterns": reasoning.get("anti_patterns", ""),
|
|
228
|
+
"decision_rules": reasoning.get("decision_rules", {}),
|
|
229
|
+
"severity": reasoning.get("severity", "MEDIUM")
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# ============ OUTPUT FORMATTERS ============
|
|
234
|
+
BOX_WIDTH = 90 # Wider box for more content
|
|
235
|
+
|
|
236
|
+
def format_ascii_box(design_system: dict) -> str:
|
|
237
|
+
"""Format design system as ASCII box with emojis (MCP-style)."""
|
|
238
|
+
project = design_system.get("project_name", "PROJECT")
|
|
239
|
+
pattern = design_system.get("pattern", {})
|
|
240
|
+
style = design_system.get("style", {})
|
|
241
|
+
colors = design_system.get("colors", {})
|
|
242
|
+
typography = design_system.get("typography", {})
|
|
243
|
+
effects = design_system.get("key_effects", "")
|
|
244
|
+
anti_patterns = design_system.get("anti_patterns", "")
|
|
245
|
+
|
|
246
|
+
def wrap_text(text: str, prefix: str, width: int) -> list:
|
|
247
|
+
"""Wrap long text into multiple lines."""
|
|
248
|
+
if not text:
|
|
249
|
+
return []
|
|
250
|
+
words = text.split()
|
|
251
|
+
lines = []
|
|
252
|
+
current_line = prefix
|
|
253
|
+
for word in words:
|
|
254
|
+
if len(current_line) + len(word) + 1 <= width - 2:
|
|
255
|
+
current_line += (" " if current_line != prefix else "") + word
|
|
256
|
+
else:
|
|
257
|
+
if current_line != prefix:
|
|
258
|
+
lines.append(current_line)
|
|
259
|
+
current_line = prefix + word
|
|
260
|
+
if current_line != prefix:
|
|
261
|
+
lines.append(current_line)
|
|
262
|
+
return lines
|
|
263
|
+
|
|
264
|
+
# Build sections from pattern
|
|
265
|
+
sections = pattern.get("sections", "").split(">")
|
|
266
|
+
sections = [s.strip() for s in sections if s.strip()]
|
|
267
|
+
|
|
268
|
+
# Build output lines
|
|
269
|
+
lines = []
|
|
270
|
+
w = BOX_WIDTH - 1
|
|
271
|
+
|
|
272
|
+
lines.append("+" + "-" * w + "+")
|
|
273
|
+
lines.append(f"| TARGET: {project} - RECOMMENDED DESIGN SYSTEM".ljust(BOX_WIDTH) + "|")
|
|
274
|
+
lines.append("+" + "-" * w + "+")
|
|
275
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
276
|
+
|
|
277
|
+
# Pattern section
|
|
278
|
+
lines.append(f"| PATTERN: {pattern.get('name', '')}".ljust(BOX_WIDTH) + "|")
|
|
279
|
+
if pattern.get('conversion'):
|
|
280
|
+
lines.append(f"| Conversion: {pattern.get('conversion', '')}".ljust(BOX_WIDTH) + "|")
|
|
281
|
+
if pattern.get('cta_placement'):
|
|
282
|
+
lines.append(f"| CTA: {pattern.get('cta_placement', '')}".ljust(BOX_WIDTH) + "|")
|
|
283
|
+
lines.append("| Sections:".ljust(BOX_WIDTH) + "|")
|
|
284
|
+
for i, section in enumerate(sections, 1):
|
|
285
|
+
lines.append(f"| {i}. {section}".ljust(BOX_WIDTH) + "|")
|
|
286
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
287
|
+
|
|
288
|
+
# Style section
|
|
289
|
+
lines.append(f"| STYLE: {style.get('name', '')}".ljust(BOX_WIDTH) + "|")
|
|
290
|
+
if style.get("keywords"):
|
|
291
|
+
for line in wrap_text(f"Keywords: {style.get('keywords', '')}", "| ", BOX_WIDTH):
|
|
292
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
293
|
+
if style.get("best_for"):
|
|
294
|
+
for line in wrap_text(f"Best For: {style.get('best_for', '')}", "| ", BOX_WIDTH):
|
|
295
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
296
|
+
if style.get("performance") or style.get("accessibility"):
|
|
297
|
+
perf_a11y = f"Performance: {style.get('performance', '')} | Accessibility: {style.get('accessibility', '')}"
|
|
298
|
+
lines.append(f"| {perf_a11y}".ljust(BOX_WIDTH) + "|")
|
|
299
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
300
|
+
|
|
301
|
+
# Colors section
|
|
302
|
+
lines.append("| COLORS:".ljust(BOX_WIDTH) + "|")
|
|
303
|
+
lines.append(f"| Primary: {colors.get('primary', '')}".ljust(BOX_WIDTH) + "|")
|
|
304
|
+
lines.append(f"| Secondary: {colors.get('secondary', '')}".ljust(BOX_WIDTH) + "|")
|
|
305
|
+
lines.append(f"| CTA: {colors.get('cta', '')}".ljust(BOX_WIDTH) + "|")
|
|
306
|
+
lines.append(f"| Background: {colors.get('background', '')}".ljust(BOX_WIDTH) + "|")
|
|
307
|
+
lines.append(f"| Text: {colors.get('text', '')}".ljust(BOX_WIDTH) + "|")
|
|
308
|
+
if colors.get("notes"):
|
|
309
|
+
for line in wrap_text(f"Notes: {colors.get('notes', '')}", "| ", BOX_WIDTH):
|
|
310
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
311
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
312
|
+
|
|
313
|
+
# Typography section
|
|
314
|
+
lines.append(f"| TYPOGRAPHY: {typography.get('heading', '')} / {typography.get('body', '')}".ljust(BOX_WIDTH) + "|")
|
|
315
|
+
if typography.get("mood"):
|
|
316
|
+
for line in wrap_text(f"Mood: {typography.get('mood', '')}", "| ", BOX_WIDTH):
|
|
317
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
318
|
+
if typography.get("best_for"):
|
|
319
|
+
for line in wrap_text(f"Best For: {typography.get('best_for', '')}", "| ", BOX_WIDTH):
|
|
320
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
321
|
+
if typography.get("google_fonts_url"):
|
|
322
|
+
lines.append(f"| Google Fonts: {typography.get('google_fonts_url', '')}".ljust(BOX_WIDTH) + "|")
|
|
323
|
+
if typography.get("css_import"):
|
|
324
|
+
lines.append(f"| CSS Import: {typography.get('css_import', '')[:70]}...".ljust(BOX_WIDTH) + "|")
|
|
325
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
326
|
+
|
|
327
|
+
# Key Effects section
|
|
328
|
+
if effects:
|
|
329
|
+
lines.append("| KEY EFFECTS:".ljust(BOX_WIDTH) + "|")
|
|
330
|
+
for line in wrap_text(effects, "| ", BOX_WIDTH):
|
|
331
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
332
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
333
|
+
|
|
334
|
+
# Anti-patterns section
|
|
335
|
+
if anti_patterns:
|
|
336
|
+
lines.append("| AVOID (Anti-patterns):".ljust(BOX_WIDTH) + "|")
|
|
337
|
+
for line in wrap_text(anti_patterns, "| ", BOX_WIDTH):
|
|
338
|
+
lines.append(line.ljust(BOX_WIDTH) + "|")
|
|
339
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
340
|
+
|
|
341
|
+
# Pre-Delivery Checklist section
|
|
342
|
+
lines.append("| PRE-DELIVERY CHECKLIST:".ljust(BOX_WIDTH) + "|")
|
|
343
|
+
checklist_items = [
|
|
344
|
+
"[ ] No emojis as icons (use SVG: Heroicons/Lucide)",
|
|
345
|
+
"[ ] cursor-pointer on all clickable elements",
|
|
346
|
+
"[ ] Hover states with smooth transitions (150-300ms)",
|
|
347
|
+
"[ ] Light mode: text contrast 4.5:1 minimum",
|
|
348
|
+
"[ ] Focus states visible for keyboard nav",
|
|
349
|
+
"[ ] prefers-reduced-motion respected",
|
|
350
|
+
"[ ] Responsive: 375px, 768px, 1024px, 1440px"
|
|
351
|
+
]
|
|
352
|
+
for item in checklist_items:
|
|
353
|
+
lines.append(f"| {item}".ljust(BOX_WIDTH) + "|")
|
|
354
|
+
lines.append("|" + " " * BOX_WIDTH + "|")
|
|
355
|
+
|
|
356
|
+
lines.append("+" + "-" * w + "+")
|
|
357
|
+
|
|
358
|
+
return "\n".join(lines)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def format_markdown(design_system: dict) -> str:
|
|
362
|
+
"""Format design system as markdown."""
|
|
363
|
+
project = design_system.get("project_name", "PROJECT")
|
|
364
|
+
pattern = design_system.get("pattern", {})
|
|
365
|
+
style = design_system.get("style", {})
|
|
366
|
+
colors = design_system.get("colors", {})
|
|
367
|
+
typography = design_system.get("typography", {})
|
|
368
|
+
effects = design_system.get("key_effects", "")
|
|
369
|
+
anti_patterns = design_system.get("anti_patterns", "")
|
|
370
|
+
|
|
371
|
+
lines = []
|
|
372
|
+
lines.append(f"## Design System: {project}")
|
|
373
|
+
lines.append("")
|
|
374
|
+
|
|
375
|
+
# Pattern section
|
|
376
|
+
lines.append("### Pattern")
|
|
377
|
+
lines.append(f"- **Name:** {pattern.get('name', '')}")
|
|
378
|
+
if pattern.get('conversion'):
|
|
379
|
+
lines.append(f"- **Conversion Focus:** {pattern.get('conversion', '')}")
|
|
380
|
+
if pattern.get('cta_placement'):
|
|
381
|
+
lines.append(f"- **CTA Placement:** {pattern.get('cta_placement', '')}")
|
|
382
|
+
if pattern.get('color_strategy'):
|
|
383
|
+
lines.append(f"- **Color Strategy:** {pattern.get('color_strategy', '')}")
|
|
384
|
+
lines.append(f"- **Sections:** {pattern.get('sections', '')}")
|
|
385
|
+
lines.append("")
|
|
386
|
+
|
|
387
|
+
# Style section
|
|
388
|
+
lines.append("### Style")
|
|
389
|
+
lines.append(f"- **Name:** {style.get('name', '')}")
|
|
390
|
+
if style.get('keywords'):
|
|
391
|
+
lines.append(f"- **Keywords:** {style.get('keywords', '')}")
|
|
392
|
+
if style.get('best_for'):
|
|
393
|
+
lines.append(f"- **Best For:** {style.get('best_for', '')}")
|
|
394
|
+
if style.get('performance') or style.get('accessibility'):
|
|
395
|
+
lines.append(f"- **Performance:** {style.get('performance', '')} | **Accessibility:** {style.get('accessibility', '')}")
|
|
396
|
+
lines.append("")
|
|
397
|
+
|
|
398
|
+
# Colors section
|
|
399
|
+
lines.append("### Colors")
|
|
400
|
+
lines.append(f"| Role | Hex |")
|
|
401
|
+
lines.append(f"|------|-----|")
|
|
402
|
+
lines.append(f"| Primary | {colors.get('primary', '')} |")
|
|
403
|
+
lines.append(f"| Secondary | {colors.get('secondary', '')} |")
|
|
404
|
+
lines.append(f"| CTA | {colors.get('cta', '')} |")
|
|
405
|
+
lines.append(f"| Background | {colors.get('background', '')} |")
|
|
406
|
+
lines.append(f"| Text | {colors.get('text', '')} |")
|
|
407
|
+
if colors.get("notes"):
|
|
408
|
+
lines.append(f"\n*Notes: {colors.get('notes', '')}*")
|
|
409
|
+
lines.append("")
|
|
410
|
+
|
|
411
|
+
# Typography section
|
|
412
|
+
lines.append("### Typography")
|
|
413
|
+
lines.append(f"- **Heading:** {typography.get('heading', '')}")
|
|
414
|
+
lines.append(f"- **Body:** {typography.get('body', '')}")
|
|
415
|
+
if typography.get("mood"):
|
|
416
|
+
lines.append(f"- **Mood:** {typography.get('mood', '')}")
|
|
417
|
+
if typography.get("best_for"):
|
|
418
|
+
lines.append(f"- **Best For:** {typography.get('best_for', '')}")
|
|
419
|
+
if typography.get("google_fonts_url"):
|
|
420
|
+
lines.append(f"- **Google Fonts:** {typography.get('google_fonts_url', '')}")
|
|
421
|
+
if typography.get("css_import"):
|
|
422
|
+
lines.append(f"- **CSS Import:**")
|
|
423
|
+
lines.append(f"```css")
|
|
424
|
+
lines.append(f"{typography.get('css_import', '')}")
|
|
425
|
+
lines.append(f"```")
|
|
426
|
+
lines.append("")
|
|
427
|
+
|
|
428
|
+
# Key Effects section
|
|
429
|
+
if effects:
|
|
430
|
+
lines.append("### Key Effects")
|
|
431
|
+
lines.append(f"{effects}")
|
|
432
|
+
lines.append("")
|
|
433
|
+
|
|
434
|
+
# Anti-patterns section
|
|
435
|
+
if anti_patterns:
|
|
436
|
+
lines.append("### Avoid (Anti-patterns)")
|
|
437
|
+
lines.append(f"- {anti_patterns.replace(' + ', '\n- ')}")
|
|
438
|
+
lines.append("")
|
|
439
|
+
|
|
440
|
+
# Pre-Delivery Checklist section
|
|
441
|
+
lines.append("### Pre-Delivery Checklist")
|
|
442
|
+
lines.append("- [ ] No emojis as icons (use SVG: Heroicons/Lucide)")
|
|
443
|
+
lines.append("- [ ] cursor-pointer on all clickable elements")
|
|
444
|
+
lines.append("- [ ] Hover states with smooth transitions (150-300ms)")
|
|
445
|
+
lines.append("- [ ] Light mode: text contrast 4.5:1 minimum")
|
|
446
|
+
lines.append("- [ ] Focus states visible for keyboard nav")
|
|
447
|
+
lines.append("- [ ] prefers-reduced-motion respected")
|
|
448
|
+
lines.append("- [ ] Responsive: 375px, 768px, 1024px, 1440px")
|
|
449
|
+
lines.append("")
|
|
450
|
+
|
|
451
|
+
return "\n".join(lines)
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
# ============ MAIN ENTRY POINT ============
|
|
455
|
+
def generate_design_system(query: str, project_name: str = None, output_format: str = "ascii") -> str:
|
|
456
|
+
"""
|
|
457
|
+
Main entry point for design system generation.
|
|
458
|
+
|
|
459
|
+
Args:
|
|
460
|
+
query: Search query (e.g., "SaaS dashboard", "e-commerce luxury")
|
|
461
|
+
project_name: Optional project name for output header
|
|
462
|
+
output_format: "ascii" (default) or "markdown"
|
|
463
|
+
|
|
464
|
+
Returns:
|
|
465
|
+
Formatted design system string
|
|
466
|
+
"""
|
|
467
|
+
generator = DesignSystemGenerator()
|
|
468
|
+
design_system = generator.generate(query, project_name)
|
|
469
|
+
|
|
470
|
+
if output_format == "markdown":
|
|
471
|
+
return format_markdown(design_system)
|
|
472
|
+
return format_ascii_box(design_system)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
# ============ CLI SUPPORT ============
|
|
476
|
+
if __name__ == "__main__":
|
|
477
|
+
import argparse
|
|
478
|
+
|
|
479
|
+
parser = argparse.ArgumentParser(description="Generate Design System")
|
|
480
|
+
parser.add_argument("query", help="Search query (e.g., 'SaaS dashboard')")
|
|
481
|
+
parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name")
|
|
482
|
+
parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format")
|
|
483
|
+
|
|
484
|
+
args = parser.parse_args()
|
|
485
|
+
|
|
486
|
+
result = generate_design_system(args.query, args.project_name, args.format)
|
|
487
|
+
print(result)
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
from core import CSV_CONFIG, AVAILABLE_STACKS, MAX_RESULTS, search, search_stack
|
|
14
|
+
from design_system import generate_design_system
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def format_output(result):
|
|
18
|
+
"""Format results for Claude consumption (token-optimized)"""
|
|
19
|
+
if "error" in result:
|
|
20
|
+
return f"Error: {result['error']}"
|
|
21
|
+
|
|
22
|
+
output = []
|
|
23
|
+
if result.get("stack"):
|
|
24
|
+
output.append(f"## UI Pro Max Stack Guidelines")
|
|
25
|
+
output.append(f"**Stack:** {result['stack']} | **Query:** {result['query']}")
|
|
26
|
+
else:
|
|
27
|
+
output.append(f"## UI Pro Max Search Results")
|
|
28
|
+
output.append(f"**Domain:** {result['domain']} | **Query:** {result['query']}")
|
|
29
|
+
output.append(f"**Source:** {result['file']} | **Found:** {result['count']} results\n")
|
|
30
|
+
|
|
31
|
+
for i, row in enumerate(result['results'], 1):
|
|
32
|
+
output.append(f"### Result {i}")
|
|
33
|
+
for key, value in row.items():
|
|
34
|
+
value_str = str(value)
|
|
35
|
+
if len(value_str) > 300:
|
|
36
|
+
value_str = value_str[:300] + "..."
|
|
37
|
+
output.append(f"- **{key}:** {value_str}")
|
|
38
|
+
output.append("")
|
|
39
|
+
|
|
40
|
+
return "\n".join(output)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if __name__ == "__main__":
|
|
44
|
+
parser = argparse.ArgumentParser(description="UI Pro Max Search")
|
|
45
|
+
parser.add_argument("query", help="Search query")
|
|
46
|
+
parser.add_argument("--domain", "-d", choices=list(CSV_CONFIG.keys()), help="Search domain")
|
|
47
|
+
parser.add_argument("--stack", "-s", choices=AVAILABLE_STACKS, help="Stack-specific search (html-tailwind, react, nextjs)")
|
|
48
|
+
parser.add_argument("--max-results", "-n", type=int, default=MAX_RESULTS, help="Max results (default: 3)")
|
|
49
|
+
parser.add_argument("--json", action="store_true", help="Output as JSON")
|
|
50
|
+
# Design system generation
|
|
51
|
+
parser.add_argument("--design-system", "-ds", action="store_true", help="Generate complete design system recommendation")
|
|
52
|
+
parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name for design system output")
|
|
53
|
+
parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format for design system")
|
|
54
|
+
|
|
55
|
+
args = parser.parse_args()
|
|
56
|
+
|
|
57
|
+
# Design system takes priority
|
|
58
|
+
if args.design_system:
|
|
59
|
+
result = generate_design_system(args.query, args.project_name, args.format)
|
|
60
|
+
print(result)
|
|
61
|
+
# Stack search
|
|
62
|
+
elif args.stack:
|
|
63
|
+
result = search_stack(args.query, args.stack, args.max_results)
|
|
64
|
+
if args.json:
|
|
65
|
+
import json
|
|
66
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
67
|
+
else:
|
|
68
|
+
print(format_output(result))
|
|
69
|
+
# Domain search
|
|
70
|
+
else:
|
|
71
|
+
result = search(args.query, args.domain, args.max_results)
|
|
72
|
+
if args.json:
|
|
73
|
+
import json
|
|
74
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
75
|
+
else:
|
|
76
|
+
print(format_output(result))
|