openclaw-node-harness 2.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 (779) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +184 -0
  3. package/bin/discord-read.js +228 -0
  4. package/bin/fleet-deploy.js +365 -0
  5. package/bin/lane-watchdog.js +232 -0
  6. package/bin/mesh-agent.js +714 -0
  7. package/bin/mesh-bridge.js +535 -0
  8. package/bin/mesh-deploy-listener.js +322 -0
  9. package/bin/mesh-deploy.js +1048 -0
  10. package/bin/mesh-health-publisher.js +247 -0
  11. package/bin/mesh-task-daemon.js +451 -0
  12. package/bin/mesh-tool-discord.js +293 -0
  13. package/bin/mesh.js +649 -0
  14. package/boot/manifest.yaml +187 -0
  15. package/cli.js +35 -0
  16. package/config/daemon.json.template +16 -0
  17. package/config/obsidian-sync.json.template +39 -0
  18. package/config/openclaw.json.template +124 -0
  19. package/config/transcript-sources.json.template +22 -0
  20. package/identity/AGENTS.md +201 -0
  21. package/identity/CLAUDE.md +64 -0
  22. package/identity/DELEGATION.md +304 -0
  23. package/identity/HEARTBEAT.md +163 -0
  24. package/identity/MEMORY_SPEC.md +368 -0
  25. package/identity/PRINCIPLES.md +81 -0
  26. package/identity/SOUL.md +48 -0
  27. package/identity/TOOLS.md +47 -0
  28. package/install.sh +895 -0
  29. package/lib/agent-activity.js +390 -0
  30. package/lib/kanban-io.js +352 -0
  31. package/lib/mesh-registry.js +194 -0
  32. package/lib/mesh-roles.js +13 -0
  33. package/lib/mesh-tasks.js +306 -0
  34. package/lib/nats-resolve.js +108 -0
  35. package/mission-control/README.md +36 -0
  36. package/mission-control/drizzle/0000_simple_silhouette.sql +62 -0
  37. package/mission-control/drizzle/meta/0000_snapshot.json +413 -0
  38. package/mission-control/drizzle/meta/_journal.json +13 -0
  39. package/mission-control/drizzle.config.ts +13 -0
  40. package/mission-control/eslint.config.mjs +18 -0
  41. package/mission-control/next.config.ts +7 -0
  42. package/mission-control/package-lock.json +10518 -0
  43. package/mission-control/package.json +49 -0
  44. package/mission-control/postcss.config.mjs +7 -0
  45. package/mission-control/public/file.svg +1 -0
  46. package/mission-control/public/globe.svg +1 -0
  47. package/mission-control/public/next.svg +1 -0
  48. package/mission-control/public/vercel.svg +1 -0
  49. package/mission-control/public/window.svg +1 -0
  50. package/mission-control/scripts/enrich-descriptions.js +193 -0
  51. package/mission-control/scripts/gen-chronology.js +102 -0
  52. package/mission-control/scripts/import-pipeline-v2.js +523 -0
  53. package/mission-control/scripts/import-pipeline.js +295 -0
  54. package/mission-control/src/app/api/activity/live/route.ts +27 -0
  55. package/mission-control/src/app/api/activity/route.ts +47 -0
  56. package/mission-control/src/app/api/burndown/route.ts +112 -0
  57. package/mission-control/src/app/api/critical-path/route.ts +159 -0
  58. package/mission-control/src/app/api/dependencies/route.ts +176 -0
  59. package/mission-control/src/app/api/memory/categories/route.ts +93 -0
  60. package/mission-control/src/app/api/memory/consolidate/route.ts +107 -0
  61. package/mission-control/src/app/api/memory/doc/route.ts +89 -0
  62. package/mission-control/src/app/api/memory/flush/route.ts +129 -0
  63. package/mission-control/src/app/api/memory/graph/route.ts +105 -0
  64. package/mission-control/src/app/api/memory/items/route.ts +86 -0
  65. package/mission-control/src/app/api/memory/list/route.ts +48 -0
  66. package/mission-control/src/app/api/memory/retrieve/route.ts +51 -0
  67. package/mission-control/src/app/api/memory/search/route.ts +143 -0
  68. package/mission-control/src/app/api/memory/sync/route.ts +23 -0
  69. package/mission-control/src/app/api/memory/wikilinks/route.ts +75 -0
  70. package/mission-control/src/app/api/mesh/events/route.ts +67 -0
  71. package/mission-control/src/app/api/mesh/nodes/route.ts +221 -0
  72. package/mission-control/src/app/api/mesh/tokens/route.ts +133 -0
  73. package/mission-control/src/app/api/projects/route.ts +102 -0
  74. package/mission-control/src/app/api/resolve-path/route.ts +92 -0
  75. package/mission-control/src/app/api/scheduler/tick/route.ts +38 -0
  76. package/mission-control/src/app/api/scheduler/waves/route.ts +54 -0
  77. package/mission-control/src/app/api/screenshot/route.ts +127 -0
  78. package/mission-control/src/app/api/settings/gateway/route.ts +92 -0
  79. package/mission-control/src/app/api/skills/[id]/health/route.ts +57 -0
  80. package/mission-control/src/app/api/skills/list/route.ts +41 -0
  81. package/mission-control/src/app/api/souls/[id]/evolution/route.ts +253 -0
  82. package/mission-control/src/app/api/souls/[id]/prompt/route.ts +205 -0
  83. package/mission-control/src/app/api/souls/[id]/propagate/route.ts +146 -0
  84. package/mission-control/src/app/api/souls/route.ts +174 -0
  85. package/mission-control/src/app/api/tasks/[id]/handoff/route.ts +115 -0
  86. package/mission-control/src/app/api/tasks/[id]/route.ts +266 -0
  87. package/mission-control/src/app/api/tasks/[id]/tree/route.ts +94 -0
  88. package/mission-control/src/app/api/tasks/route.ts +253 -0
  89. package/mission-control/src/app/api/tts/route.ts +47 -0
  90. package/mission-control/src/app/api/workspace/files/route.ts +88 -0
  91. package/mission-control/src/app/api/workspace/read/route.ts +73 -0
  92. package/mission-control/src/app/burndown/page.tsx +309 -0
  93. package/mission-control/src/app/calendar/page.tsx +839 -0
  94. package/mission-control/src/app/favicon.ico +0 -0
  95. package/mission-control/src/app/globals.css +67 -0
  96. package/mission-control/src/app/graph/page.tsx +352 -0
  97. package/mission-control/src/app/layout.tsx +35 -0
  98. package/mission-control/src/app/live/page.tsx +232 -0
  99. package/mission-control/src/app/memory/page.tsx +154 -0
  100. package/mission-control/src/app/mesh/page.tsx +457 -0
  101. package/mission-control/src/app/obsidian/page.tsx +252 -0
  102. package/mission-control/src/app/page.tsx +70 -0
  103. package/mission-control/src/app/roadmap/page.tsx +1757 -0
  104. package/mission-control/src/app/settings/page.tsx +260 -0
  105. package/mission-control/src/app/souls/page.tsx +573 -0
  106. package/mission-control/src/components/board/activity-timeline.tsx +96 -0
  107. package/mission-control/src/components/board/daily-board.tsx +373 -0
  108. package/mission-control/src/components/board/kanban-board.tsx +364 -0
  109. package/mission-control/src/components/board/kanban-column.tsx +105 -0
  110. package/mission-control/src/components/board/live-stream.tsx +116 -0
  111. package/mission-control/src/components/board/skill-health-card.tsx +128 -0
  112. package/mission-control/src/components/board/status-banner.tsx +124 -0
  113. package/mission-control/src/components/board/task-card.tsx +454 -0
  114. package/mission-control/src/components/board/unified-task-dialog.tsx +1043 -0
  115. package/mission-control/src/components/layout/resizable-layout.tsx +68 -0
  116. package/mission-control/src/components/layout/sidebar.tsx +90 -0
  117. package/mission-control/src/components/live/audio-spectrum.tsx +106 -0
  118. package/mission-control/src/components/live/chat-bubble.tsx +52 -0
  119. package/mission-control/src/components/live/chat-input.tsx +92 -0
  120. package/mission-control/src/components/memory/doc-reader.tsx +172 -0
  121. package/mission-control/src/components/memory/memory-list.tsx +169 -0
  122. package/mission-control/src/components/memory/search-bar.tsx +67 -0
  123. package/mission-control/src/components/memory/search-results.tsx +149 -0
  124. package/mission-control/src/components/obsidian/backlinks-panel.tsx +52 -0
  125. package/mission-control/src/components/obsidian/file-tree.tsx +186 -0
  126. package/mission-control/src/components/obsidian/local-graph.tsx +107 -0
  127. package/mission-control/src/components/obsidian/obsidian-graph.tsx +192 -0
  128. package/mission-control/src/components/obsidian/obsidian-reader.tsx +246 -0
  129. package/mission-control/src/lib/activity.ts +29 -0
  130. package/mission-control/src/lib/config.ts +21 -0
  131. package/mission-control/src/lib/db/index.ts +429 -0
  132. package/mission-control/src/lib/db/schema.ts +218 -0
  133. package/mission-control/src/lib/gateway-notify.ts +113 -0
  134. package/mission-control/src/lib/hooks.ts +536 -0
  135. package/mission-control/src/lib/memory/categories.ts +125 -0
  136. package/mission-control/src/lib/memory/entities.ts +482 -0
  137. package/mission-control/src/lib/memory/extract.ts +369 -0
  138. package/mission-control/src/lib/memory/retrieval.ts +281 -0
  139. package/mission-control/src/lib/memory/wikilinks.ts +147 -0
  140. package/mission-control/src/lib/nats.ts +126 -0
  141. package/mission-control/src/lib/parsers/clawvault-doc.ts +98 -0
  142. package/mission-control/src/lib/parsers/daily-log.ts +73 -0
  143. package/mission-control/src/lib/parsers/memory-md.ts +81 -0
  144. package/mission-control/src/lib/parsers/task-markdown.ts +459 -0
  145. package/mission-control/src/lib/parsers/transcript.ts +209 -0
  146. package/mission-control/src/lib/scheduler.ts +394 -0
  147. package/mission-control/src/lib/speech/use-speech-pipeline.ts +176 -0
  148. package/mission-control/src/lib/sync/memory.ts +224 -0
  149. package/mission-control/src/lib/sync/tasks.ts +271 -0
  150. package/mission-control/src/lib/tts/edge.ts +31 -0
  151. package/mission-control/src/lib/tts/google.ts +78 -0
  152. package/mission-control/src/lib/tts/index.ts +39 -0
  153. package/mission-control/src/lib/tts/types.ts +18 -0
  154. package/mission-control/tsconfig.json +42 -0
  155. package/obsidian-vault/.obsidian/app.json +10 -0
  156. package/obsidian-vault/.obsidian/community-plugins.json +8 -0
  157. package/obsidian-vault/.obsidian/graph.json +40 -0
  158. package/obsidian-vault/.obsidian/plugins/obsidian-local-rest-api/main.js +58769 -0
  159. package/obsidian-vault/.obsidian/plugins/obsidian-local-rest-api/manifest.json +10 -0
  160. package/obsidian-vault/.obsidian/plugins/obsidian-local-rest-api/styles.css +47 -0
  161. package/obsidian-vault/00-meta/.gitkeep +0 -0
  162. package/obsidian-vault/01-architecture/.gitkeep +0 -0
  163. package/obsidian-vault/02-smart-contracts/.gitkeep +0 -0
  164. package/obsidian-vault/03-backend/.gitkeep +0 -0
  165. package/obsidian-vault/04-mobile/.gitkeep +0 -0
  166. package/obsidian-vault/05-ar-mapping/.gitkeep +0 -0
  167. package/obsidian-vault/06-3d-assets/.gitkeep +0 -0
  168. package/obsidian-vault/07-sound-music/.gitkeep +0 -0
  169. package/obsidian-vault/08-lore/.gitkeep +0 -0
  170. package/obsidian-vault/09-quests-playthrough/.gitkeep +0 -0
  171. package/obsidian-vault/10-economy/.gitkeep +0 -0
  172. package/obsidian-vault/11-nft-assets/.gitkeep +0 -0
  173. package/obsidian-vault/12-nft-mechanics/.gitkeep +0 -0
  174. package/obsidian-vault/13-dao-guild-social/.gitkeep +0 -0
  175. package/obsidian-vault/14-game-progression/.gitkeep +0 -0
  176. package/obsidian-vault/15-analytics/.gitkeep +0 -0
  177. package/obsidian-vault/16-security/.gitkeep +0 -0
  178. package/obsidian-vault/17-devops/.gitkeep +0 -0
  179. package/obsidian-vault/18-marketplace/.gitkeep +0 -0
  180. package/obsidian-vault/19-decisions/.gitkeep +0 -0
  181. package/obsidian-vault/20-business-strategy/.gitkeep +0 -0
  182. package/obsidian-vault/21-legal-regulatory/.gitkeep +0 -0
  183. package/obsidian-vault/nodes/.gitkeep +0 -0
  184. package/openclaw.env.example +17 -0
  185. package/package.json +45 -0
  186. package/services/launchd/ai.openclaw.gateway.plist +59 -0
  187. package/services/launchd/ai.openclaw.lane-watchdog.plist +32 -0
  188. package/services/launchd/ai.openclaw.log-rotate.plist +28 -0
  189. package/services/launchd/ai.openclaw.memory-daemon.plist +36 -0
  190. package/services/launchd/ai.openclaw.mesh-agent.plist +38 -0
  191. package/services/launchd/ai.openclaw.mesh-bridge.plist +36 -0
  192. package/services/launchd/ai.openclaw.mesh-deploy-listener.plist +33 -0
  193. package/services/launchd/ai.openclaw.mesh-health-publisher.plist +29 -0
  194. package/services/launchd/ai.openclaw.mesh-task-daemon.plist +36 -0
  195. package/services/launchd/ai.openclaw.mesh-tool-discord.plist +36 -0
  196. package/services/launchd/ai.openclaw.mission-control.plist +41 -0
  197. package/services/service-manifest.json +13 -0
  198. package/services/systemd/openclaw-gateway.service +21 -0
  199. package/services/systemd/openclaw-lane-watchdog.service +21 -0
  200. package/services/systemd/openclaw-log-rotate.service +13 -0
  201. package/services/systemd/openclaw-log-rotate.timer +9 -0
  202. package/services/systemd/openclaw-memory-daemon.service +21 -0
  203. package/services/systemd/openclaw-mesh-agent.service +19 -0
  204. package/services/systemd/openclaw-mesh-bridge.service +21 -0
  205. package/services/systemd/openclaw-mesh-deploy-listener.service +23 -0
  206. package/services/systemd/openclaw-mesh-health-publisher.service +21 -0
  207. package/services/systemd/openclaw-mesh-task-daemon.service +21 -0
  208. package/services/systemd/openclaw-mesh-tool-discord.service +21 -0
  209. package/services/systemd/openclaw-mission-control.service +22 -0
  210. package/skills/1password/.clawhub/origin.json +7 -0
  211. package/skills/1password/SKILL.md +63 -0
  212. package/skills/1password/references/cli-examples.md +29 -0
  213. package/skills/1password/references/get-started.md +17 -0
  214. package/skills/acquisition-channel-advisor/SKILL.md +643 -0
  215. package/skills/acquisition-channel-advisor/examples/conversation-flow.md +531 -0
  216. package/skills/agent-browser/.clawhub/origin.json +7 -0
  217. package/skills/agent-browser/CONTRIBUTING.md +63 -0
  218. package/skills/agent-browser/SKILL.md +338 -0
  219. package/skills/agentic-compass/.clawhub/origin.json +7 -0
  220. package/skills/agentic-compass/README.md +96 -0
  221. package/skills/agentic-compass/SKILL.md +112 -0
  222. package/skills/agentic-compass/references/README.md +5 -0
  223. package/skills/agentic-compass/scripts/agentic-compass.py +196 -0
  224. package/skills/arcane-dev-ops/SKILL.md +61 -0
  225. package/skills/arcane-dev-ops/references/checklist.md +22 -0
  226. package/skills/arcane-dev-ops/references/validation-cases.md +11 -0
  227. package/skills/arcane-dev-ops/scripts/prepush_check.sh +41 -0
  228. package/skills/auto-updater/.clawhub/origin.json +7 -0
  229. package/skills/auto-updater/SKILL.md +158 -0
  230. package/skills/auto-updater/references/agent-guide.md +152 -0
  231. package/skills/auto-updater/references/summary-examples.md +109 -0
  232. package/skills/business-health-diagnostic/SKILL.md +782 -0
  233. package/skills/byterover/.clawhub/origin.json +7 -0
  234. package/skills/byterover/SKILL.md +105 -0
  235. package/skills/byterover/TROUBLESHOOTING.md +50 -0
  236. package/skills/byterover/WORKFLOWS.md +229 -0
  237. package/skills/capability-evolver/.clawhub/origin.json +7 -0
  238. package/skills/capability-evolver/CONTRIBUTING.md +11 -0
  239. package/skills/capability-evolver/README.md +157 -0
  240. package/skills/capability-evolver/README.zh-CN.md +112 -0
  241. package/skills/capability-evolver/SKILL.md +93 -0
  242. package/skills/capability-evolver/assets/gep/capsules.json +5 -0
  243. package/skills/capability-evolver/assets/gep/genes.json +104 -0
  244. package/skills/capability-evolver/index.js +59 -0
  245. package/skills/capability-evolver/package.json +22 -0
  246. package/skills/capability-evolver/scripts/analyze_by_skill.js +121 -0
  247. package/skills/capability-evolver/scripts/build_public.js +350 -0
  248. package/skills/capability-evolver/scripts/export_history.js +98 -0
  249. package/skills/capability-evolver/scripts/extract_log.js +85 -0
  250. package/skills/capability-evolver/scripts/generate_history.js +75 -0
  251. package/skills/capability-evolver/scripts/human_report.js +147 -0
  252. package/skills/capability-evolver/scripts/publish_public.js +516 -0
  253. package/skills/capability-evolver/scripts/suggest_version.js +89 -0
  254. package/skills/capability-evolver/src/evolve.js +594 -0
  255. package/skills/capability-evolver/src/gep/assetStore.js +204 -0
  256. package/skills/capability-evolver/src/gep/candidates.js +134 -0
  257. package/skills/capability-evolver/src/gep/paths.js +23 -0
  258. package/skills/capability-evolver/src/gep/prompt.js +254 -0
  259. package/skills/capability-evolver/src/gep/selector.js +89 -0
  260. package/skills/capability-evolver/src/gep/signals.js +27 -0
  261. package/skills/cc-godmode/.clawhub/origin.json +7 -0
  262. package/skills/cc-godmode/CHANGELOG.md +66 -0
  263. package/skills/cc-godmode/README.md +293 -0
  264. package/skills/cc-godmode/SKILL.md +242 -0
  265. package/skills/cc-godmode/docs/AGENTS.md +332 -0
  266. package/skills/cc-godmode/docs/MIGRATION.md +206 -0
  267. package/skills/cc-godmode/docs/TROUBLESHOOTING.md +357 -0
  268. package/skills/cc-godmode/docs/WORKFLOWS.md +329 -0
  269. package/skills/cc-godmode/references/agents.md +433 -0
  270. package/skills/cc-godmode/scripts/build-skill.js +232 -0
  271. package/skills/clawdbot-filesystem/.clawhub/origin.json +7 -0
  272. package/skills/clawdbot-filesystem/LICENSE.md +21 -0
  273. package/skills/clawdbot-filesystem/README.md +322 -0
  274. package/skills/clawdbot-filesystem/SKILL.md +219 -0
  275. package/skills/clawdbot-filesystem/config.json +41 -0
  276. package/skills/clawdbot-filesystem/package.json +69 -0
  277. package/skills/clawdbot-security-check/.clawhub/origin.json +7 -0
  278. package/skills/clawdbot-security-check/README.md +168 -0
  279. package/skills/clawdbot-security-check/SKILL.md +145 -0
  280. package/skills/clawdbot-security-check/references/audit-checks.md +521 -0
  281. package/skills/clawdbot-security-check/skill.json +42 -0
  282. package/skills/clawddocs/.clawhub/origin.json +7 -0
  283. package/skills/clawddocs/SKILL.md +176 -0
  284. package/skills/clawddocs/package.json +9 -0
  285. package/skills/clawddocs/scripts/build-index.sh +17 -0
  286. package/skills/clawddocs/scripts/cache.sh +13 -0
  287. package/skills/clawddocs/scripts/fetch-doc.sh +7 -0
  288. package/skills/clawddocs/scripts/recent.sh +5 -0
  289. package/skills/clawddocs/scripts/search.sh +8 -0
  290. package/skills/clawddocs/scripts/sitemap.sh +23 -0
  291. package/skills/clawddocs/scripts/track-changes.sh +16 -0
  292. package/skills/clawddocs/snippets/common-configs.md +69 -0
  293. package/skills/clawguard/.clawhub/origin.json +7 -0
  294. package/skills/clawguard/SKILL.md +137 -0
  295. package/skills/company-research/SKILL.md +393 -0
  296. package/skills/company-research/examples/sample.md +164 -0
  297. package/skills/company-research/template.md +60 -0
  298. package/skills/crypto-price/.clawhub/origin.json +7 -0
  299. package/skills/crypto-price/ARCHITECTURE.md +437 -0
  300. package/skills/crypto-price/README.md +194 -0
  301. package/skills/crypto-price/SKILL.md +61 -0
  302. package/skills/crypto-price/requirements.txt +1 -0
  303. package/skills/crypto-price/scripts/get_price_chart.py +988 -0
  304. package/skills/customer-journey-map/SKILL.md +343 -0
  305. package/skills/customer-journey-map/examples/sample.md +33 -0
  306. package/skills/customer-journey-map/template.md +28 -0
  307. package/skills/customer-journey-mapping-workshop/SKILL.md +522 -0
  308. package/skills/deep-research/.clawhub/origin.json +7 -0
  309. package/skills/deep-research/SKILL.md +93 -0
  310. package/skills/deep-research/rules/logic.md +32 -0
  311. package/skills/discord-telegram-triage/SKILL.md +59 -0
  312. package/skills/discord-telegram-triage/references/discord-runbook.md +28 -0
  313. package/skills/discord-telegram-triage/references/validation-cases.md +11 -0
  314. package/skills/discord-telegram-triage/scripts/triage_snapshot.sh +23 -0
  315. package/skills/discovery-interview-prep/SKILL.md +408 -0
  316. package/skills/discovery-process/SKILL.md +503 -0
  317. package/skills/discovery-process/examples/sample.md +60 -0
  318. package/skills/discovery-process/template.md +39 -0
  319. package/skills/dist/arcane-dev-ops.skill +0 -0
  320. package/skills/dist/discord-telegram-triage.skill +0 -0
  321. package/skills/dist/founder-brief-summarizer.skill +0 -0
  322. package/skills/epic-breakdown-advisor/SKILL.md +664 -0
  323. package/skills/epic-hypothesis/SKILL.md +285 -0
  324. package/skills/epic-hypothesis/examples/sample.md +104 -0
  325. package/skills/epic-hypothesis/template.md +30 -0
  326. package/skills/excel/.clawhub/origin.json +7 -0
  327. package/skills/excel/SKILL.md +332 -0
  328. package/skills/excel/scripts/excel.py +1120 -0
  329. package/skills/fast-browser-use/.clawhub/origin.json +7 -0
  330. package/skills/fast-browser-use/CODEBUDDY.md +142 -0
  331. package/skills/fast-browser-use/Cargo.toml +77 -0
  332. package/skills/fast-browser-use/README.md +62 -0
  333. package/skills/fast-browser-use/SKILL.md +217 -0
  334. package/skills/fast-browser-use/package-lock.json +28 -0
  335. package/skills/fast-browser-use/package.json +8 -0
  336. package/skills/fast-browser-use/rustfmt.toml +10 -0
  337. package/skills/fast-browser-use/src/bin/cli.rs +373 -0
  338. package/skills/fast-browser-use/src/bin/mcp_server.rs +203 -0
  339. package/skills/fast-browser-use/src/browser/config.rs +136 -0
  340. package/skills/fast-browser-use/src/browser/debug.rs +16 -0
  341. package/skills/fast-browser-use/src/browser/mod.rs +61 -0
  342. package/skills/fast-browser-use/src/browser/session.rs +478 -0
  343. package/skills/fast-browser-use/src/dom/element.rs +442 -0
  344. package/skills/fast-browser-use/src/dom/extract_dom.js +849 -0
  345. package/skills/fast-browser-use/src/dom/mod.rs +14 -0
  346. package/skills/fast-browser-use/src/dom/tree.rs +296 -0
  347. package/skills/fast-browser-use/src/dom/yaml.rs +149 -0
  348. package/skills/fast-browser-use/src/error.rs +115 -0
  349. package/skills/fast-browser-use/src/lib.rs +17 -0
  350. package/skills/fast-browser-use/src/mcp/handler.rs +63 -0
  351. package/skills/fast-browser-use/src/mcp/mod.rs +81 -0
  352. package/skills/fast-browser-use/src/tools/Readability.min.js +1480 -0
  353. package/skills/fast-browser-use/src/tools/annotate.rs +165 -0
  354. package/skills/fast-browser-use/src/tools/click.rs +84 -0
  355. package/skills/fast-browser-use/src/tools/close.rs +35 -0
  356. package/skills/fast-browser-use/src/tools/close_tab.rs +45 -0
  357. package/skills/fast-browser-use/src/tools/convert_to_markdown.js +117 -0
  358. package/skills/fast-browser-use/src/tools/cookies.rs +58 -0
  359. package/skills/fast-browser-use/src/tools/debug.rs +44 -0
  360. package/skills/fast-browser-use/src/tools/evaluate.rs +40 -0
  361. package/skills/fast-browser-use/src/tools/extract.rs +66 -0
  362. package/skills/fast-browser-use/src/tools/go_back.rs +35 -0
  363. package/skills/fast-browser-use/src/tools/go_forward.rs +35 -0
  364. package/skills/fast-browser-use/src/tools/hover.js +33 -0
  365. package/skills/fast-browser-use/src/tools/hover.rs +97 -0
  366. package/skills/fast-browser-use/src/tools/html_to_markdown.rs +99 -0
  367. package/skills/fast-browser-use/src/tools/input.rs +93 -0
  368. package/skills/fast-browser-use/src/tools/local_storage.rs +159 -0
  369. package/skills/fast-browser-use/src/tools/markdown.rs +181 -0
  370. package/skills/fast-browser-use/src/tools/mod.rs +326 -0
  371. package/skills/fast-browser-use/src/tools/navigate.rs +55 -0
  372. package/skills/fast-browser-use/src/tools/new_tab.rs +60 -0
  373. package/skills/fast-browser-use/src/tools/press_key.rs +78 -0
  374. package/skills/fast-browser-use/src/tools/read_links.rs +59 -0
  375. package/skills/fast-browser-use/src/tools/readability_script.rs +8 -0
  376. package/skills/fast-browser-use/src/tools/screenshot.rs +47 -0
  377. package/skills/fast-browser-use/src/tools/scroll.js +22 -0
  378. package/skills/fast-browser-use/src/tools/scroll.rs +95 -0
  379. package/skills/fast-browser-use/src/tools/select.js +23 -0
  380. package/skills/fast-browser-use/src/tools/select.rs +129 -0
  381. package/skills/fast-browser-use/src/tools/sitemap.rs +426 -0
  382. package/skills/fast-browser-use/src/tools/snapshot.rs +324 -0
  383. package/skills/fast-browser-use/src/tools/switch_tab.rs +69 -0
  384. package/skills/fast-browser-use/src/tools/tab_list.rs +76 -0
  385. package/skills/fast-browser-use/src/tools/utils.rs +92 -0
  386. package/skills/fast-browser-use/src/tools/wait.rs +53 -0
  387. package/skills/fast-browser-use/test_auth.json +3 -0
  388. package/skills/fast-browser-use/test_state.json +6 -0
  389. package/skills/fast-browser-use/tests/browser_tools_integration.rs +233 -0
  390. package/skills/fast-browser-use/tests/cli_recipes_integration.rs +112 -0
  391. package/skills/fast-browser-use/tests/cookies_integration.rs +56 -0
  392. package/skills/fast-browser-use/tests/debug_integration.rs +83 -0
  393. package/skills/fast-browser-use/tests/dom_integration.rs +170 -0
  394. package/skills/fast-browser-use/tests/local_storage_integration.rs +75 -0
  395. package/skills/fast-browser-use/tests/markdown_integration.rs +448 -0
  396. package/skills/fast-browser-use/tests/navigation_integration.rs +241 -0
  397. package/skills/fast-browser-use/tests/sitemap_integration.rs +326 -0
  398. package/skills/fast-browser-use/tests/tab_management_integration.rs +300 -0
  399. package/skills/feature-investment-advisor/SKILL.md +639 -0
  400. package/skills/feature-investment-advisor/examples/conversation-flow.md +538 -0
  401. package/skills/finance-based-pricing-advisor/SKILL.md +763 -0
  402. package/skills/finance-metrics-quickref/SKILL.md +309 -0
  403. package/skills/find-skills/.clawhub/origin.json +7 -0
  404. package/skills/find-skills/SKILL.md +143 -0
  405. package/skills/flavor-text-writer/SKILL.md +27 -0
  406. package/skills/founder-brief-summarizer/SKILL.md +52 -0
  407. package/skills/founder-brief-summarizer/references/response-templates.md +15 -0
  408. package/skills/founder-brief-summarizer/references/validation-cases.md +11 -0
  409. package/skills/founder-brief-summarizer/scripts/brief_template.sh +28 -0
  410. package/skills/frontend-design/.clawhub/origin.json +7 -0
  411. package/skills/frontend-design/LICENSE.txt +190 -0
  412. package/skills/frontend-design/SKILL.md +53 -0
  413. package/skills/gemini/.clawhub/origin.json +7 -0
  414. package/skills/gemini/SKILL.md +33 -0
  415. package/skills/gemini-deep-research/.clawhub/origin.json +7 -0
  416. package/skills/gemini-deep-research/SKILL.md +78 -0
  417. package/skills/gemini-deep-research/scripts/deep_research.py +176 -0
  418. package/skills/git-essentials/.clawhub/origin.json +7 -0
  419. package/skills/git-essentials/SKILL.md +239 -0
  420. package/skills/git-essentials/references/advanced.md +211 -0
  421. package/skills/github/.clawhub/origin.json +7 -0
  422. package/skills/github/SKILL.md +57 -0
  423. package/skills/google-drive/.clawhub/origin.json +7 -0
  424. package/skills/google-drive/LICENSE.txt +21 -0
  425. package/skills/google-drive/SKILL.md +320 -0
  426. package/skills/growth-loop/SKILL.md +270 -0
  427. package/skills/growth-loop/_meta.json +9 -0
  428. package/skills/growth-loop/references/diagnosis-framework.md +84 -0
  429. package/skills/growth-loop/references/platform-benchmarks.md +79 -0
  430. package/skills/growth-loop/scripts/init-campaign.sh +274 -0
  431. package/skills/humanize-ai-text/.clawhub/origin.json +7 -0
  432. package/skills/humanize-ai-text/SKILL.md +192 -0
  433. package/skills/humanize-ai-text/scripts/compare.py +58 -0
  434. package/skills/humanize-ai-text/scripts/detect.py +160 -0
  435. package/skills/humanize-ai-text/scripts/patterns.json +191 -0
  436. package/skills/humanize-ai-text/scripts/transform.py +127 -0
  437. package/skills/humanizer/.clawhub/origin.json +7 -0
  438. package/skills/humanizer/README.md +82 -0
  439. package/skills/humanizer/SKILL.md +443 -0
  440. package/skills/jobs-to-be-done/SKILL.md +378 -0
  441. package/skills/jobs-to-be-done/examples/sample.md +80 -0
  442. package/skills/jobs-to-be-done/template.md +65 -0
  443. package/skills/lean-ux-canvas/SKILL.md +561 -0
  444. package/skills/lean-ux-canvas/examples/sample.md +88 -0
  445. package/skills/lean-ux-canvas/template.md +32 -0
  446. package/skills/markdown-formatter/.clawhub/origin.json +7 -0
  447. package/skills/markdown-formatter/README.md +137 -0
  448. package/skills/markdown-formatter/SKILL.md +369 -0
  449. package/skills/markdown-formatter/config.json +20 -0
  450. package/skills/markdown-formatter/index.js +439 -0
  451. package/skills/markdown-formatter/package.json +23 -0
  452. package/skills/markdown-formatter/test.js +23 -0
  453. package/skills/marketing-mode/.clawhub/origin.json +7 -0
  454. package/skills/marketing-mode/README.md +49 -0
  455. package/skills/marketing-mode/SKILL.md +703 -0
  456. package/skills/marketing-mode/mode-prompt.md +39 -0
  457. package/skills/marketing-mode/skill.json +51 -0
  458. package/skills/memory-hygiene/.clawhub/origin.json +7 -0
  459. package/skills/memory-hygiene/SKILL.md +91 -0
  460. package/skills/memory-setup/.clawhub/origin.json +7 -0
  461. package/skills/memory-setup/SKILL.md +180 -0
  462. package/skills/memorylayer/.clawhub/origin.json +7 -0
  463. package/skills/memorylayer/README.md +197 -0
  464. package/skills/memorylayer/SKILL.md +227 -0
  465. package/skills/memorylayer/examples/agent-integration.js +145 -0
  466. package/skills/memorylayer/examples/basic-usage.js +87 -0
  467. package/skills/memorylayer/examples/token-savings-demo.js +183 -0
  468. package/skills/memorylayer/index.js +115 -0
  469. package/skills/memorylayer/package-lock.json +295 -0
  470. package/skills/memorylayer/package.json +27 -0
  471. package/skills/memorylayer/python/memorylayer_skill.py +230 -0
  472. package/skills/memorylayer/python/requirements.txt +7 -0
  473. package/skills/mesh/SKILL.md +184 -0
  474. package/skills/model-usage/.clawhub/origin.json +7 -0
  475. package/skills/model-usage/SKILL.md +54 -0
  476. package/skills/model-usage/references/codexbar-cli.md +28 -0
  477. package/skills/model-usage/scripts/model_usage.py +310 -0
  478. package/skills/moltbook-interact/.clawhub/origin.json +7 -0
  479. package/skills/moltbook-interact/INSTALL.md +139 -0
  480. package/skills/moltbook-interact/README.md +198 -0
  481. package/skills/moltbook-interact/SKILL.md +72 -0
  482. package/skills/moltbook-interact/references/api.md +106 -0
  483. package/skills/moltbook-interact/scripts/moltbook.sh +142 -0
  484. package/skills/moltbook-registry/.clawhub/origin.json +7 -0
  485. package/skills/moltbook-registry/README.md +26 -0
  486. package/skills/moltbook-registry/SKILL.md +82 -0
  487. package/skills/moltbook-registry/index.js +180 -0
  488. package/skills/moltbook-registry/package.json +11 -0
  489. package/skills/mythril-scanner/SKILL.md +27 -0
  490. package/skills/n8n/.clawhub/origin.json +7 -0
  491. package/skills/n8n/SKILL.md +141 -0
  492. package/skills/n8n/references/api.md +156 -0
  493. package/skills/n8n/scripts/n8n_api.py +158 -0
  494. package/skills/n8n-workflow-automation/.clawhub/origin.json +7 -0
  495. package/skills/n8n-workflow-automation/SKILL.md +103 -0
  496. package/skills/n8n-workflow-automation/assets/runbook-template.md +32 -0
  497. package/skills/narrative-designer/SKILL.md +27 -0
  498. package/skills/ontology/.clawhub/origin.json +7 -0
  499. package/skills/ontology/SKILL.md +236 -0
  500. package/skills/ontology/references/queries.md +211 -0
  501. package/skills/ontology/references/schema.md +322 -0
  502. package/skills/ontology/scripts/ontology.py +374 -0
  503. package/skills/openai-image-gen/.clawhub/origin.json +7 -0
  504. package/skills/openai-image-gen/SKILL.md +45 -0
  505. package/skills/openai-image-gen/scripts/gen.py +227 -0
  506. package/skills/openclaw-agent-optimize/.clawhub/origin.json +7 -0
  507. package/skills/openclaw-agent-optimize/SKILL.md +33 -0
  508. package/skills/openclaw-agent-optimize/references/agent-orchestration.md +20 -0
  509. package/skills/openclaw-agent-optimize/references/context-management.md +15 -0
  510. package/skills/openclaw-agent-optimize/references/continuous-learning.md +14 -0
  511. package/skills/openclaw-agent-optimize/references/cron-optimization.md +16 -0
  512. package/skills/openclaw-agent-optimize/references/memory-patterns.md +14 -0
  513. package/skills/openclaw-agent-optimize/references/model-selection.md +18 -0
  514. package/skills/openclaw-skill-scanner/.clawhub/origin.json +7 -0
  515. package/skills/openclaw-skill-scanner/SKILL.md +88 -0
  516. package/skills/openclaw-skill-scanner/install-hook.sh +294 -0
  517. package/skills/openclaw-skill-scanner/report-template.md +53 -0
  518. package/skills/openclaw-skill-scanner/scanner.py +929 -0
  519. package/skills/openclaw-skill-scanner/whitelist.json +18 -0
  520. package/skills/opportunity-solution-tree/SKILL.md +428 -0
  521. package/skills/opportunity-solution-tree/examples/sample.md +104 -0
  522. package/skills/opportunity-solution-tree/template.md +33 -0
  523. package/skills/pdf/.clawhub/origin.json +7 -0
  524. package/skills/pdf/SKILL.md +304 -0
  525. package/skills/pestel-analysis/SKILL.md +384 -0
  526. package/skills/pestel-analysis/examples/sample.md +143 -0
  527. package/skills/pestel-analysis/template.md +53 -0
  528. package/skills/pol-probe/SKILL.md +217 -0
  529. package/skills/pol-probe/examples/sample.md +136 -0
  530. package/skills/pol-probe/template.md +59 -0
  531. package/skills/pol-probe-advisor/SKILL.md +492 -0
  532. package/skills/positioning-statement/SKILL.md +229 -0
  533. package/skills/positioning-statement/examples/sample.md +51 -0
  534. package/skills/positioning-statement/template.md +25 -0
  535. package/skills/positioning-workshop/SKILL.md +424 -0
  536. package/skills/prd-development/SKILL.md +654 -0
  537. package/skills/prd-development/examples/sample.md +43 -0
  538. package/skills/prd-development/template.md +55 -0
  539. package/skills/press-release/SKILL.md +277 -0
  540. package/skills/press-release/examples/sample.md +73 -0
  541. package/skills/press-release/template.md +39 -0
  542. package/skills/prioritization-advisor/SKILL.md +451 -0
  543. package/skills/proactive-messages/.clawhub/origin.json +7 -0
  544. package/skills/proactive-messages/SKILL.md +91 -0
  545. package/skills/problem-framing-canvas/SKILL.md +466 -0
  546. package/skills/problem-framing-canvas/examples/sample.md +58 -0
  547. package/skills/problem-framing-canvas/template.md +22 -0
  548. package/skills/problem-statement/SKILL.md +255 -0
  549. package/skills/problem-statement/examples/sample.md +82 -0
  550. package/skills/problem-statement/template.md +37 -0
  551. package/skills/product-strategy-session/SKILL.md +434 -0
  552. package/skills/product-strategy-session/examples/sample.md +67 -0
  553. package/skills/product-strategy-session/template.md +38 -0
  554. package/skills/prompt-guard/.clawhub/origin.json +7 -0
  555. package/skills/prompt-guard/ARCHITECTURE.md +364 -0
  556. package/skills/prompt-guard/CHANGELOG.md +200 -0
  557. package/skills/prompt-guard/README.md +215 -0
  558. package/skills/prompt-guard/SECURITY.md +66 -0
  559. package/skills/prompt-guard/SKILL.md +174 -0
  560. package/skills/prompt-guard/blog/how-i-secured-my-ai-agent.md +185 -0
  561. package/skills/prompt-guard/config.example.yaml +56 -0
  562. package/skills/prompt-guard/references/detection-patterns.md +298 -0
  563. package/skills/prompt-guard/requirements.txt +1 -0
  564. package/skills/prompt-guard/scripts/analyze_log.py +224 -0
  565. package/skills/prompt-guard/scripts/audit.py +344 -0
  566. package/skills/prompt-guard/scripts/detect.py +1587 -0
  567. package/skills/prompt-guard/scripts/hivefence.py +345 -0
  568. package/skills/proto-persona/SKILL.md +336 -0
  569. package/skills/proto-persona/examples/sample.md +97 -0
  570. package/skills/proto-persona/template.md +45 -0
  571. package/skills/recommendation-canvas/SKILL.md +382 -0
  572. package/skills/recommendation-canvas/examples/sample.md +94 -0
  573. package/skills/recommendation-canvas/template.md +86 -0
  574. package/skills/refactor-suggest/.clawhub/origin.json +7 -0
  575. package/skills/refactor-suggest/SKILL.md +94 -0
  576. package/skills/roadmap-planning/SKILL.md +506 -0
  577. package/skills/roadmap-planning/examples/sample.md +62 -0
  578. package/skills/roadmap-planning/template.md +30 -0
  579. package/skills/saas-economics-efficiency-metrics/SKILL.md +694 -0
  580. package/skills/saas-economics-efficiency-metrics/examples/cash-trap.md +365 -0
  581. package/skills/saas-economics-efficiency-metrics/examples/healthy-unit-economics.md +279 -0
  582. package/skills/saas-economics-efficiency-metrics/template.md +263 -0
  583. package/skills/saas-revenue-growth-metrics/SKILL.md +629 -0
  584. package/skills/saas-revenue-growth-metrics/examples/healthy-saas.md +131 -0
  585. package/skills/saas-revenue-growth-metrics/examples/warning-signs.md +229 -0
  586. package/skills/saas-revenue-growth-metrics/template.md +192 -0
  587. package/skills/save-money/.clawhub/origin.json +7 -0
  588. package/skills/save-money/SKILL.md +173 -0
  589. package/skills/scripts/golden_skills_v3.sh +32 -0
  590. package/skills/search/.clawhub/origin.json +7 -0
  591. package/skills/search/SKILL.md +18 -0
  592. package/skills/search/skill.json +1 -0
  593. package/skills/second-brain/.clawhub/origin.json +7 -0
  594. package/skills/second-brain/SKILL.md +278 -0
  595. package/skills/second-brain/scripts/ensue-api.sh +37 -0
  596. package/skills/self-improving-agent/.clawhub/origin.json +7 -0
  597. package/skills/self-improving-agent/.learnings/ERRORS.md +5 -0
  598. package/skills/self-improving-agent/.learnings/FEATURE_REQUESTS.md +5 -0
  599. package/skills/self-improving-agent/.learnings/LEARNINGS.md +5 -0
  600. package/skills/self-improving-agent/SKILL.md +130 -0
  601. package/skills/self-improving-agent/assets/LEARNINGS.md +45 -0
  602. package/skills/self-improving-agent/assets/SKILL-TEMPLATE.md +177 -0
  603. package/skills/self-improving-agent/hooks/openclaw/HOOK.md +23 -0
  604. package/skills/self-improving-agent/hooks/openclaw/handler.js +56 -0
  605. package/skills/self-improving-agent/hooks/openclaw/handler.ts +62 -0
  606. package/skills/self-improving-agent/references/examples.md +374 -0
  607. package/skills/self-improving-agent/references/hooks-setup.md +223 -0
  608. package/skills/self-improving-agent/references/openclaw-integration.md +248 -0
  609. package/skills/self-improving-agent/references/templates.md +480 -0
  610. package/skills/self-improving-agent/scripts/activator.sh +20 -0
  611. package/skills/self-improving-agent/scripts/error-detector.sh +55 -0
  612. package/skills/self-improving-agent/scripts/extract-skill.sh +203 -0
  613. package/skills/self-improving-agent-1-0-2/.clawhub/origin.json +7 -0
  614. package/skills/self-improving-agent-1-0-2/SKILL.md +562 -0
  615. package/skills/self-improving-agent-1-0-2/assets/LEARNINGS.md +45 -0
  616. package/skills/self-improving-agent-1-0-2/assets/SKILL-TEMPLATE.md +182 -0
  617. package/skills/self-improving-agent-1-0-2/references/clawdbot-integration.md +311 -0
  618. package/skills/self-improving-agent-1-0-2/references/examples.md +374 -0
  619. package/skills/self-improving-agent-1-0-2/references/hooks-setup.md +223 -0
  620. package/skills/self-improving-agent-1-0-2/scripts/activator.sh +20 -0
  621. package/skills/self-improving-agent-1-0-2/scripts/error-detector.sh +55 -0
  622. package/skills/self-improving-agent-1-0-2/scripts/extract-skill.sh +203 -0
  623. package/skills/self-love-confidence/.clawhub/origin.json +7 -0
  624. package/skills/self-love-confidence/SKILL.md +79 -0
  625. package/skills/self-reflection/.clawhub/origin.json +7 -0
  626. package/skills/self-reflection/README.md +292 -0
  627. package/skills/self-reflection/SKILL.md +110 -0
  628. package/skills/self-reflection/self-reflection.example.json +6 -0
  629. package/skills/slither-analyzer/SKILL.md +27 -0
  630. package/skills/solidity-audit/SKILL.md +27 -0
  631. package/skills/soulcraft/.clawhub/origin.json +7 -0
  632. package/skills/soulcraft/README.md +123 -0
  633. package/skills/soulcraft/SKILL.md +340 -0
  634. package/skills/soulcraft/references/question-bank.md +154 -0
  635. package/skills/soulcraft/references/soul-examples.md +207 -0
  636. package/skills/soulcraft/research/RESEARCH_REPORT.md +317 -0
  637. package/skills/spotify-player/.clawhub/origin.json +7 -0
  638. package/skills/spotify-player/SKILL.md +44 -0
  639. package/skills/storyboard/SKILL.md +259 -0
  640. package/skills/storyboard/examples/sample.md +71 -0
  641. package/skills/storyboard/template.md +41 -0
  642. package/skills/summarize/.clawhub/origin.json +7 -0
  643. package/skills/summarize/SKILL.md +59 -0
  644. package/skills/superdesign/.clawhub/origin.json +7 -0
  645. package/skills/superdesign/SKILL.md +224 -0
  646. package/skills/tam-sam-som-calculator/SKILL.md +399 -0
  647. package/skills/tam-sam-som-calculator/examples/sample.md +142 -0
  648. package/skills/tam-sam-som-calculator/scripts/market-sizing.py +95 -0
  649. package/skills/tam-sam-som-calculator/template.md +35 -0
  650. package/skills/tavily-search/.clawhub/origin.json +7 -0
  651. package/skills/tavily-search/SKILL.md +49 -0
  652. package/skills/tavily-search/scripts/extract.mjs +59 -0
  653. package/skills/tavily-search/scripts/search.mjs +101 -0
  654. package/skills/twitter/SKILL.md +74 -0
  655. package/skills/twitter/_meta.json +9 -0
  656. package/skills/twitter/references/validation-cases.md +53 -0
  657. package/skills/twitter/scripts/twitter.sh +421 -0
  658. package/skills/ui-ux-pro-max/.clawhub/origin.json +7 -0
  659. package/skills/ui-ux-pro-max/SKILL.md +54 -0
  660. package/skills/ui-ux-pro-max/assets/data/charts.csv +26 -0
  661. package/skills/ui-ux-pro-max/assets/data/colors.csv +97 -0
  662. package/skills/ui-ux-pro-max/assets/data/icons.csv +101 -0
  663. package/skills/ui-ux-pro-max/assets/data/landing.csv +31 -0
  664. package/skills/ui-ux-pro-max/assets/data/products.csv +97 -0
  665. package/skills/ui-ux-pro-max/assets/data/react-performance.csv +45 -0
  666. package/skills/ui-ux-pro-max/assets/data/stacks/astro.csv +54 -0
  667. package/skills/ui-ux-pro-max/assets/data/stacks/flutter.csv +53 -0
  668. package/skills/ui-ux-pro-max/assets/data/stacks/html-tailwind.csv +56 -0
  669. package/skills/ui-ux-pro-max/assets/data/stacks/jetpack-compose.csv +53 -0
  670. package/skills/ui-ux-pro-max/assets/data/stacks/nextjs.csv +53 -0
  671. package/skills/ui-ux-pro-max/assets/data/stacks/nuxt-ui.csv +51 -0
  672. package/skills/ui-ux-pro-max/assets/data/stacks/nuxtjs.csv +59 -0
  673. package/skills/ui-ux-pro-max/assets/data/stacks/react-native.csv +52 -0
  674. package/skills/ui-ux-pro-max/assets/data/stacks/react.csv +54 -0
  675. package/skills/ui-ux-pro-max/assets/data/stacks/shadcn.csv +61 -0
  676. package/skills/ui-ux-pro-max/assets/data/stacks/svelte.csv +54 -0
  677. package/skills/ui-ux-pro-max/assets/data/stacks/swiftui.csv +51 -0
  678. package/skills/ui-ux-pro-max/assets/data/stacks/vue.csv +50 -0
  679. package/skills/ui-ux-pro-max/assets/data/styles.csv +68 -0
  680. package/skills/ui-ux-pro-max/assets/data/typography.csv +58 -0
  681. package/skills/ui-ux-pro-max/assets/data/ui-reasoning.csv +101 -0
  682. package/skills/ui-ux-pro-max/assets/data/ux-guidelines.csv +100 -0
  683. package/skills/ui-ux-pro-max/assets/data/web-interface.csv +31 -0
  684. package/skills/ui-ux-pro-max/references/upstream-README.md +488 -0
  685. package/skills/ui-ux-pro-max/references/upstream-skill-content.md +288 -0
  686. package/skills/ui-ux-pro-max/scripts/__init__.py +0 -0
  687. package/skills/ui-ux-pro-max/scripts/core.py +253 -0
  688. package/skills/ui-ux-pro-max/scripts/design_system.py +1071 -0
  689. package/skills/ui-ux-pro-max/scripts/search.py +111 -0
  690. package/skills/user-story/SKILL.md +272 -0
  691. package/skills/user-story/examples/sample.md +110 -0
  692. package/skills/user-story/scripts/user-story-template.py +65 -0
  693. package/skills/user-story/template.md +32 -0
  694. package/skills/user-story-mapping/SKILL.md +296 -0
  695. package/skills/user-story-mapping/examples/sample.md +77 -0
  696. package/skills/user-story-mapping/template.md +41 -0
  697. package/skills/user-story-mapping-workshop/SKILL.md +485 -0
  698. package/skills/user-story-mapping-workshop/template.md +28 -0
  699. package/skills/user-story-splitting/SKILL.md +313 -0
  700. package/skills/user-story-splitting/examples/sample.md +147 -0
  701. package/skills/user-story-splitting/template.md +37 -0
  702. package/skills/wacli/.clawhub/origin.json +7 -0
  703. package/skills/wacli/SKILL.md +53 -0
  704. package/skills/web-search/.clawhub/origin.json +7 -0
  705. package/skills/web-search/SKILL.md +151 -0
  706. package/skills/web-search/references/api-details.md +207 -0
  707. package/skills/web-search/scripts/search.py +576 -0
  708. package/skills/workshop-facilitation/SKILL.md +88 -0
  709. package/skills/world-builder/SKILL.md +27 -0
  710. package/souls/blockchain-auditor/PRINCIPLES.md +75 -0
  711. package/souls/blockchain-auditor/SOUL.md +56 -0
  712. package/souls/blockchain-auditor/capabilities.json +33 -0
  713. package/souls/blockchain-auditor/evolution/capsules.json +4 -0
  714. package/souls/blockchain-auditor/evolution/events.jsonl +1 -0
  715. package/souls/blockchain-auditor/evolution/genes.json +62 -0
  716. package/souls/daedalus/PRINCIPLES.md +78 -0
  717. package/souls/daedalus/SOUL.md +48 -0
  718. package/souls/daedalus/capabilities.json +46 -0
  719. package/souls/identity-architect/PRINCIPLES.md +83 -0
  720. package/souls/identity-architect/SOUL.md +66 -0
  721. package/souls/identity-architect/capabilities.json +38 -0
  722. package/souls/identity-architect/evolution/capsules.json +4 -0
  723. package/souls/identity-architect/evolution/events.jsonl +0 -0
  724. package/souls/identity-architect/evolution/genes.json +4 -0
  725. package/souls/infra-ops/PRINCIPLES.md +77 -0
  726. package/souls/infra-ops/SOUL.md +56 -0
  727. package/souls/infra-ops/capabilities.json +33 -0
  728. package/souls/infra-ops/evolution/capsules.json +4 -0
  729. package/souls/infra-ops/evolution/events.jsonl +0 -0
  730. package/souls/infra-ops/evolution/genes.json +4 -0
  731. package/souls/lore-writer/PRINCIPLES.md +74 -0
  732. package/souls/lore-writer/SOUL.md +54 -0
  733. package/souls/lore-writer/capabilities.json +37 -0
  734. package/souls/lore-writer/evolution/capsules.json +4 -0
  735. package/souls/lore-writer/evolution/events.jsonl +0 -0
  736. package/souls/lore-writer/evolution/genes.json +4 -0
  737. package/souls/qa-evidence/PRINCIPLES.md +97 -0
  738. package/souls/qa-evidence/SOUL.md +66 -0
  739. package/souls/qa-evidence/capabilities.json +32 -0
  740. package/souls/qa-evidence/evolution/capsules.json +4 -0
  741. package/souls/qa-evidence/evolution/events.jsonl +0 -0
  742. package/souls/qa-evidence/evolution/genes.json +4 -0
  743. package/souls/registry.json +211 -0
  744. package/souls/sync-registry.js +65 -0
  745. package/uninstall.sh +102 -0
  746. package/workspace-bin/auto-checkpoint +60 -0
  747. package/workspace-bin/clawvault-access-control +65 -0
  748. package/workspace-bin/clawvault-local +28 -0
  749. package/workspace-bin/compile-boot +494 -0
  750. package/workspace-bin/daily-log-writer.mjs +251 -0
  751. package/workspace-bin/evolve +540 -0
  752. package/workspace-bin/fitness_score.py +395 -0
  753. package/workspace-bin/hooks/pre-commit +80 -0
  754. package/workspace-bin/install-daemon +299 -0
  755. package/workspace-bin/lane-watchdog.js +232 -0
  756. package/workspace-bin/lib/__init__.py +0 -0
  757. package/workspace-bin/lib/frontmatter.py +114 -0
  758. package/workspace-bin/memory-daemon.mjs +879 -0
  759. package/workspace-bin/memory-maintenance.mjs +531 -0
  760. package/workspace-bin/mesh-bridge.mjs +154 -0
  761. package/workspace-bin/multi-review +130 -0
  762. package/workspace-bin/obsidian +125 -0
  763. package/workspace-bin/obsidian-sync.mjs +888 -0
  764. package/workspace-bin/openclaw-register-source +102 -0
  765. package/workspace-bin/proactive-scan +147 -0
  766. package/workspace-bin/quality-gate +175 -0
  767. package/workspace-bin/screenshot +96 -0
  768. package/workspace-bin/session-recap +453 -0
  769. package/workspace-bin/skill-audit +494 -0
  770. package/workspace-bin/skill-quality-check +134 -0
  771. package/workspace-bin/skill-routing-eval +599 -0
  772. package/workspace-bin/soul-prompt +251 -0
  773. package/workspace-bin/subagent-audit.mjs +267 -0
  774. package/workspace-bin/test-multi-soul-workflow +130 -0
  775. package/workspace-bin/trust-registry +465 -0
  776. package/workspace-docs/AGENTS.md +201 -0
  777. package/workspace-docs/CLAUDE.md +64 -0
  778. package/workspace-docs/PRINCIPLES.md +81 -0
  779. package/workspace-docs/SOUL.md +48 -0
@@ -0,0 +1,1071 @@
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
+ # With persistence (Master + Overrides pattern)
12
+ result = generate_design_system("SaaS dashboard", "My Project", persist=True)
13
+ result = generate_design_system("SaaS dashboard", "My Project", persist=True, page="dashboard")
14
+ """
15
+
16
+ import csv
17
+ import json
18
+ import os
19
+ from datetime import datetime
20
+ from pathlib import Path
21
+ # Allow both `python design_system.py ...` and `python -m ...` execution.
22
+ try:
23
+ from core import search, DATA_DIR
24
+ except ImportError: # pragma: no cover
25
+ from .core import search, DATA_DIR
26
+
27
+
28
+ # ============ CONFIGURATION ============
29
+ REASONING_FILE = "ui-reasoning.csv"
30
+
31
+ SEARCH_CONFIG = {
32
+ "product": {"max_results": 1},
33
+ "style": {"max_results": 3},
34
+ "color": {"max_results": 2},
35
+ "landing": {"max_results": 2},
36
+ "typography": {"max_results": 2}
37
+ }
38
+
39
+
40
+ # ============ DESIGN SYSTEM GENERATOR ============
41
+ class DesignSystemGenerator:
42
+ """Generates design system recommendations from aggregated searches."""
43
+
44
+ def __init__(self):
45
+ self.reasoning_data = self._load_reasoning()
46
+
47
+ def _load_reasoning(self) -> list:
48
+ """Load reasoning rules from CSV."""
49
+ filepath = DATA_DIR / REASONING_FILE
50
+ if not filepath.exists():
51
+ return []
52
+ with open(filepath, 'r', encoding='utf-8') as f:
53
+ return list(csv.DictReader(f))
54
+
55
+ def _multi_domain_search(self, query: str, style_priority: list = None) -> dict:
56
+ """Execute searches across multiple domains."""
57
+ results = {}
58
+ for domain, config in SEARCH_CONFIG.items():
59
+ if domain == "style" and style_priority:
60
+ # For style, also search with priority keywords
61
+ priority_query = " ".join(style_priority[:2]) if style_priority else query
62
+ combined_query = f"{query} {priority_query}"
63
+ results[domain] = search(combined_query, domain, config["max_results"])
64
+ else:
65
+ results[domain] = search(query, domain, config["max_results"])
66
+ return results
67
+
68
+ def _find_reasoning_rule(self, category: str) -> dict:
69
+ """Find matching reasoning rule for a category."""
70
+ category_lower = category.lower()
71
+
72
+ # Try exact match first
73
+ for rule in self.reasoning_data:
74
+ if rule.get("UI_Category", "").lower() == category_lower:
75
+ return rule
76
+
77
+ # Try partial match
78
+ for rule in self.reasoning_data:
79
+ ui_cat = rule.get("UI_Category", "").lower()
80
+ if ui_cat in category_lower or category_lower in ui_cat:
81
+ return rule
82
+
83
+ # Try keyword match
84
+ for rule in self.reasoning_data:
85
+ ui_cat = rule.get("UI_Category", "").lower()
86
+ keywords = ui_cat.replace("/", " ").replace("-", " ").split()
87
+ if any(kw in category_lower for kw in keywords):
88
+ return rule
89
+
90
+ return {}
91
+
92
+ def _apply_reasoning(self, category: str, search_results: dict) -> dict:
93
+ """Apply reasoning rules to search results."""
94
+ rule = self._find_reasoning_rule(category)
95
+
96
+ if not rule:
97
+ return {
98
+ "pattern": "Hero + Features + CTA",
99
+ "style_priority": ["Minimalism", "Flat Design"],
100
+ "color_mood": "Professional",
101
+ "typography_mood": "Clean",
102
+ "key_effects": "Subtle hover transitions",
103
+ "anti_patterns": "",
104
+ "decision_rules": {},
105
+ "severity": "MEDIUM"
106
+ }
107
+
108
+ # Parse decision rules JSON
109
+ decision_rules = {}
110
+ try:
111
+ decision_rules = json.loads(rule.get("Decision_Rules", "{}"))
112
+ except json.JSONDecodeError:
113
+ pass
114
+
115
+ return {
116
+ "pattern": rule.get("Recommended_Pattern", ""),
117
+ "style_priority": [s.strip() for s in rule.get("Style_Priority", "").split("+")],
118
+ "color_mood": rule.get("Color_Mood", ""),
119
+ "typography_mood": rule.get("Typography_Mood", ""),
120
+ "key_effects": rule.get("Key_Effects", ""),
121
+ "anti_patterns": rule.get("Anti_Patterns", ""),
122
+ "decision_rules": decision_rules,
123
+ "severity": rule.get("Severity", "MEDIUM")
124
+ }
125
+
126
+ def _select_best_match(self, results: list, priority_keywords: list) -> dict:
127
+ """Select best matching result based on priority keywords."""
128
+ if not results:
129
+ return {}
130
+
131
+ if not priority_keywords:
132
+ return results[0]
133
+
134
+ # First: try exact style name match
135
+ for priority in priority_keywords:
136
+ priority_lower = priority.lower().strip()
137
+ for result in results:
138
+ style_name = result.get("Style Category", "").lower()
139
+ if priority_lower in style_name or style_name in priority_lower:
140
+ return result
141
+
142
+ # Second: score by keyword match in all fields
143
+ scored = []
144
+ for result in results:
145
+ result_str = str(result).lower()
146
+ score = 0
147
+ for kw in priority_keywords:
148
+ kw_lower = kw.lower().strip()
149
+ # Higher score for style name match
150
+ if kw_lower in result.get("Style Category", "").lower():
151
+ score += 10
152
+ # Lower score for keyword field match
153
+ elif kw_lower in result.get("Keywords", "").lower():
154
+ score += 3
155
+ # Even lower for other field matches
156
+ elif kw_lower in result_str:
157
+ score += 1
158
+ scored.append((score, result))
159
+
160
+ scored.sort(key=lambda x: x[0], reverse=True)
161
+ return scored[0][1] if scored and scored[0][0] > 0 else results[0]
162
+
163
+ def _extract_results(self, search_result: dict) -> list:
164
+ """Extract results list from search result dict."""
165
+ return search_result.get("results", [])
166
+
167
+ def generate(self, query: str, project_name: str = None) -> dict:
168
+ """Generate complete design system recommendation."""
169
+ # Step 1: First search product to get category
170
+ product_result = search(query, "product", 1)
171
+ product_results = product_result.get("results", [])
172
+ category = "General"
173
+ if product_results:
174
+ category = product_results[0].get("Product Type", "General")
175
+
176
+ # Step 2: Get reasoning rules for this category
177
+ reasoning = self._apply_reasoning(category, {})
178
+ style_priority = reasoning.get("style_priority", [])
179
+
180
+ # Step 3: Multi-domain search with style priority hints
181
+ search_results = self._multi_domain_search(query, style_priority)
182
+ search_results["product"] = product_result # Reuse product search
183
+
184
+ # Step 4: Select best matches from each domain using priority
185
+ style_results = self._extract_results(search_results.get("style", {}))
186
+ color_results = self._extract_results(search_results.get("color", {}))
187
+ typography_results = self._extract_results(search_results.get("typography", {}))
188
+ landing_results = self._extract_results(search_results.get("landing", {}))
189
+
190
+ best_style = self._select_best_match(style_results, reasoning.get("style_priority", []))
191
+ best_color = color_results[0] if color_results else {}
192
+ best_typography = typography_results[0] if typography_results else {}
193
+ best_landing = landing_results[0] if landing_results else {}
194
+
195
+ # Step 5: Build final recommendation
196
+ # Combine effects from both reasoning and style search
197
+ style_effects = best_style.get("Effects & Animation", "")
198
+ reasoning_effects = reasoning.get("key_effects", "")
199
+ combined_effects = style_effects if style_effects else reasoning_effects
200
+
201
+ return {
202
+ "project_name": project_name or query.upper(),
203
+ "category": category,
204
+ "pattern": {
205
+ "name": best_landing.get("Pattern Name", reasoning.get("pattern", "Hero + Features + CTA")),
206
+ "sections": best_landing.get("Section Order", "Hero > Features > CTA"),
207
+ "cta_placement": best_landing.get("Primary CTA Placement", "Above fold"),
208
+ "color_strategy": best_landing.get("Color Strategy", ""),
209
+ "conversion": best_landing.get("Conversion Optimization", "")
210
+ },
211
+ "style": {
212
+ "name": best_style.get("Style Category", "Minimalism"),
213
+ "type": best_style.get("Type", "General"),
214
+ "effects": style_effects,
215
+ "keywords": best_style.get("Keywords", ""),
216
+ "best_for": best_style.get("Best For", ""),
217
+ "performance": best_style.get("Performance", ""),
218
+ "accessibility": best_style.get("Accessibility", "")
219
+ },
220
+ "colors": {
221
+ "primary": best_color.get("Primary (Hex)", "#2563EB"),
222
+ "secondary": best_color.get("Secondary (Hex)", "#3B82F6"),
223
+ "cta": best_color.get("CTA (Hex)", "#F97316"),
224
+ "background": best_color.get("Background (Hex)", "#F8FAFC"),
225
+ "text": best_color.get("Text (Hex)", "#1E293B"),
226
+ "notes": best_color.get("Notes", "")
227
+ },
228
+ "typography": {
229
+ "heading": best_typography.get("Heading Font", "Inter"),
230
+ "body": best_typography.get("Body Font", "Inter"),
231
+ "mood": best_typography.get("Mood/Style Keywords", reasoning.get("typography_mood", "")),
232
+ "best_for": best_typography.get("Best For", ""),
233
+ "google_fonts_url": best_typography.get("Google Fonts URL", ""),
234
+ "css_import": best_typography.get("CSS Import", "")
235
+ },
236
+ "key_effects": combined_effects,
237
+ "anti_patterns": reasoning.get("anti_patterns", ""),
238
+ "decision_rules": reasoning.get("decision_rules", {}),
239
+ "severity": reasoning.get("severity", "MEDIUM")
240
+ }
241
+
242
+
243
+ # ============ OUTPUT FORMATTERS ============
244
+ BOX_WIDTH = 90 # Wider box for more content
245
+
246
+ def format_ascii_box(design_system: dict) -> str:
247
+ """Format design system as ASCII box with emojis (MCP-style)."""
248
+ project = design_system.get("project_name", "PROJECT")
249
+ pattern = design_system.get("pattern", {})
250
+ style = design_system.get("style", {})
251
+ colors = design_system.get("colors", {})
252
+ typography = design_system.get("typography", {})
253
+ effects = design_system.get("key_effects", "")
254
+ anti_patterns = design_system.get("anti_patterns", "")
255
+
256
+ def wrap_text(text: str, prefix: str, width: int) -> list:
257
+ """Wrap long text into multiple lines."""
258
+ if not text:
259
+ return []
260
+ words = text.split()
261
+ lines = []
262
+ current_line = prefix
263
+ for word in words:
264
+ if len(current_line) + len(word) + 1 <= width - 2:
265
+ current_line += (" " if current_line != prefix else "") + word
266
+ else:
267
+ if current_line != prefix:
268
+ lines.append(current_line)
269
+ current_line = prefix + word
270
+ if current_line != prefix:
271
+ lines.append(current_line)
272
+ return lines
273
+
274
+ # Build sections from pattern
275
+ sections = pattern.get("sections", "").split(">")
276
+ sections = [s.strip() for s in sections if s.strip()]
277
+
278
+ # Build output lines
279
+ lines = []
280
+ w = BOX_WIDTH - 1
281
+
282
+ lines.append("+" + "-" * w + "+")
283
+ lines.append(f"| TARGET: {project} - RECOMMENDED DESIGN SYSTEM".ljust(BOX_WIDTH) + "|")
284
+ lines.append("+" + "-" * w + "+")
285
+ lines.append("|" + " " * BOX_WIDTH + "|")
286
+
287
+ # Pattern section
288
+ lines.append(f"| PATTERN: {pattern.get('name', '')}".ljust(BOX_WIDTH) + "|")
289
+ if pattern.get('conversion'):
290
+ lines.append(f"| Conversion: {pattern.get('conversion', '')}".ljust(BOX_WIDTH) + "|")
291
+ if pattern.get('cta_placement'):
292
+ lines.append(f"| CTA: {pattern.get('cta_placement', '')}".ljust(BOX_WIDTH) + "|")
293
+ lines.append("| Sections:".ljust(BOX_WIDTH) + "|")
294
+ for i, section in enumerate(sections, 1):
295
+ lines.append(f"| {i}. {section}".ljust(BOX_WIDTH) + "|")
296
+ lines.append("|" + " " * BOX_WIDTH + "|")
297
+
298
+ # Style section
299
+ lines.append(f"| STYLE: {style.get('name', '')}".ljust(BOX_WIDTH) + "|")
300
+ if style.get("keywords"):
301
+ for line in wrap_text(f"Keywords: {style.get('keywords', '')}", "| ", BOX_WIDTH):
302
+ lines.append(line.ljust(BOX_WIDTH) + "|")
303
+ if style.get("best_for"):
304
+ for line in wrap_text(f"Best For: {style.get('best_for', '')}", "| ", BOX_WIDTH):
305
+ lines.append(line.ljust(BOX_WIDTH) + "|")
306
+ if style.get("performance") or style.get("accessibility"):
307
+ perf_a11y = f"Performance: {style.get('performance', '')} | Accessibility: {style.get('accessibility', '')}"
308
+ lines.append(f"| {perf_a11y}".ljust(BOX_WIDTH) + "|")
309
+ lines.append("|" + " " * BOX_WIDTH + "|")
310
+
311
+ # Colors section
312
+ lines.append("| COLORS:".ljust(BOX_WIDTH) + "|")
313
+ lines.append(f"| Primary: {colors.get('primary', '')}".ljust(BOX_WIDTH) + "|")
314
+ lines.append(f"| Secondary: {colors.get('secondary', '')}".ljust(BOX_WIDTH) + "|")
315
+ lines.append(f"| CTA: {colors.get('cta', '')}".ljust(BOX_WIDTH) + "|")
316
+ lines.append(f"| Background: {colors.get('background', '')}".ljust(BOX_WIDTH) + "|")
317
+ lines.append(f"| Text: {colors.get('text', '')}".ljust(BOX_WIDTH) + "|")
318
+ if colors.get("notes"):
319
+ for line in wrap_text(f"Notes: {colors.get('notes', '')}", "| ", BOX_WIDTH):
320
+ lines.append(line.ljust(BOX_WIDTH) + "|")
321
+ lines.append("|" + " " * BOX_WIDTH + "|")
322
+
323
+ # Typography section
324
+ lines.append(f"| TYPOGRAPHY: {typography.get('heading', '')} / {typography.get('body', '')}".ljust(BOX_WIDTH) + "|")
325
+ if typography.get("mood"):
326
+ for line in wrap_text(f"Mood: {typography.get('mood', '')}", "| ", BOX_WIDTH):
327
+ lines.append(line.ljust(BOX_WIDTH) + "|")
328
+ if typography.get("best_for"):
329
+ for line in wrap_text(f"Best For: {typography.get('best_for', '')}", "| ", BOX_WIDTH):
330
+ lines.append(line.ljust(BOX_WIDTH) + "|")
331
+ if typography.get("google_fonts_url"):
332
+ lines.append(f"| Google Fonts: {typography.get('google_fonts_url', '')}".ljust(BOX_WIDTH) + "|")
333
+ if typography.get("css_import"):
334
+ lines.append(f"| CSS Import: {typography.get('css_import', '')[:70]}...".ljust(BOX_WIDTH) + "|")
335
+ lines.append("|" + " " * BOX_WIDTH + "|")
336
+
337
+ # Key Effects section
338
+ if effects:
339
+ lines.append("| KEY EFFECTS:".ljust(BOX_WIDTH) + "|")
340
+ for line in wrap_text(effects, "| ", BOX_WIDTH):
341
+ lines.append(line.ljust(BOX_WIDTH) + "|")
342
+ lines.append("|" + " " * BOX_WIDTH + "|")
343
+
344
+ # Anti-patterns section
345
+ if anti_patterns:
346
+ lines.append("| AVOID (Anti-patterns):".ljust(BOX_WIDTH) + "|")
347
+ for line in wrap_text(anti_patterns, "| ", BOX_WIDTH):
348
+ lines.append(line.ljust(BOX_WIDTH) + "|")
349
+ lines.append("|" + " " * BOX_WIDTH + "|")
350
+
351
+ # Pre-Delivery Checklist section
352
+ lines.append("| PRE-DELIVERY CHECKLIST:".ljust(BOX_WIDTH) + "|")
353
+ checklist_items = [
354
+ "[ ] No emojis as icons (use SVG: Heroicons/Lucide)",
355
+ "[ ] cursor-pointer on all clickable elements",
356
+ "[ ] Hover states with smooth transitions (150-300ms)",
357
+ "[ ] Light mode: text contrast 4.5:1 minimum",
358
+ "[ ] Focus states visible for keyboard nav",
359
+ "[ ] prefers-reduced-motion respected",
360
+ "[ ] Responsive: 375px, 768px, 1024px, 1440px"
361
+ ]
362
+ for item in checklist_items:
363
+ lines.append(f"| {item}".ljust(BOX_WIDTH) + "|")
364
+ lines.append("|" + " " * BOX_WIDTH + "|")
365
+
366
+ lines.append("+" + "-" * w + "+")
367
+
368
+ return "\n".join(lines)
369
+
370
+
371
+ def format_markdown(design_system: dict) -> str:
372
+ """Format design system as markdown."""
373
+ project = design_system.get("project_name", "PROJECT")
374
+ pattern = design_system.get("pattern", {})
375
+ style = design_system.get("style", {})
376
+ colors = design_system.get("colors", {})
377
+ typography = design_system.get("typography", {})
378
+ effects = design_system.get("key_effects", "")
379
+ anti_patterns = design_system.get("anti_patterns", "")
380
+
381
+ lines = []
382
+ lines.append(f"## Design System: {project}")
383
+ lines.append("")
384
+
385
+ # Pattern section
386
+ lines.append("### Pattern")
387
+ lines.append(f"- **Name:** {pattern.get('name', '')}")
388
+ if pattern.get('conversion'):
389
+ lines.append(f"- **Conversion Focus:** {pattern.get('conversion', '')}")
390
+ if pattern.get('cta_placement'):
391
+ lines.append(f"- **CTA Placement:** {pattern.get('cta_placement', '')}")
392
+ if pattern.get('color_strategy'):
393
+ lines.append(f"- **Color Strategy:** {pattern.get('color_strategy', '')}")
394
+ lines.append(f"- **Sections:** {pattern.get('sections', '')}")
395
+ lines.append("")
396
+
397
+ # Style section
398
+ lines.append("### Style")
399
+ lines.append(f"- **Name:** {style.get('name', '')}")
400
+ if style.get('keywords'):
401
+ lines.append(f"- **Keywords:** {style.get('keywords', '')}")
402
+ if style.get('best_for'):
403
+ lines.append(f"- **Best For:** {style.get('best_for', '')}")
404
+ if style.get('performance') or style.get('accessibility'):
405
+ lines.append(f"- **Performance:** {style.get('performance', '')} | **Accessibility:** {style.get('accessibility', '')}")
406
+ lines.append("")
407
+
408
+ # Colors section
409
+ lines.append("### Colors")
410
+ lines.append(f"| Role | Hex |")
411
+ lines.append(f"|------|-----|")
412
+ lines.append(f"| Primary | {colors.get('primary', '')} |")
413
+ lines.append(f"| Secondary | {colors.get('secondary', '')} |")
414
+ lines.append(f"| CTA | {colors.get('cta', '')} |")
415
+ lines.append(f"| Background | {colors.get('background', '')} |")
416
+ lines.append(f"| Text | {colors.get('text', '')} |")
417
+ if colors.get("notes"):
418
+ lines.append(f"\n*Notes: {colors.get('notes', '')}*")
419
+ lines.append("")
420
+
421
+ # Typography section
422
+ lines.append("### Typography")
423
+ lines.append(f"- **Heading:** {typography.get('heading', '')}")
424
+ lines.append(f"- **Body:** {typography.get('body', '')}")
425
+ if typography.get("mood"):
426
+ lines.append(f"- **Mood:** {typography.get('mood', '')}")
427
+ if typography.get("best_for"):
428
+ lines.append(f"- **Best For:** {typography.get('best_for', '')}")
429
+ if typography.get("google_fonts_url"):
430
+ lines.append(f"- **Google Fonts:** {typography.get('google_fonts_url', '')}")
431
+ if typography.get("css_import"):
432
+ lines.append(f"- **CSS Import:**")
433
+ lines.append(f"```css")
434
+ lines.append(f"{typography.get('css_import', '')}")
435
+ lines.append(f"```")
436
+ lines.append("")
437
+
438
+ # Key Effects section
439
+ if effects:
440
+ lines.append("### Key Effects")
441
+ lines.append(f"{effects}")
442
+ lines.append("")
443
+
444
+ # Anti-patterns section
445
+ if anti_patterns:
446
+ lines.append("### Avoid (Anti-patterns)")
447
+ newline_bullet = '\n- '
448
+ lines.append(f"- {anti_patterns.replace(' + ', newline_bullet)}")
449
+ lines.append("")
450
+
451
+ # Pre-Delivery Checklist section
452
+ lines.append("### Pre-Delivery Checklist")
453
+ lines.append("- [ ] No emojis as icons (use SVG: Heroicons/Lucide)")
454
+ lines.append("- [ ] cursor-pointer on all clickable elements")
455
+ lines.append("- [ ] Hover states with smooth transitions (150-300ms)")
456
+ lines.append("- [ ] Light mode: text contrast 4.5:1 minimum")
457
+ lines.append("- [ ] Focus states visible for keyboard nav")
458
+ lines.append("- [ ] prefers-reduced-motion respected")
459
+ lines.append("- [ ] Responsive: 375px, 768px, 1024px, 1440px")
460
+ lines.append("")
461
+
462
+ return "\n".join(lines)
463
+
464
+
465
+ # ============ MAIN ENTRY POINT ============
466
+ def generate_design_system(query: str, project_name: str = None, output_format: str = "ascii",
467
+ persist: bool = False, page: str = None, output_dir: str = None) -> str:
468
+ """
469
+ Main entry point for design system generation.
470
+
471
+ Args:
472
+ query: Search query (e.g., "SaaS dashboard", "e-commerce luxury")
473
+ project_name: Optional project name for output header
474
+ output_format: "ascii" (default) or "markdown"
475
+ persist: If True, save design system to design-system/ folder
476
+ page: Optional page name for page-specific override file
477
+ output_dir: Optional output directory (defaults to current working directory)
478
+
479
+ Returns:
480
+ Formatted design system string
481
+ """
482
+ generator = DesignSystemGenerator()
483
+ design_system = generator.generate(query, project_name)
484
+
485
+ # Persist to files if requested
486
+ if persist:
487
+ persist_design_system(design_system, page, output_dir, query)
488
+
489
+ if output_format == "markdown":
490
+ return format_markdown(design_system)
491
+ return format_ascii_box(design_system)
492
+
493
+
494
+ # ============ PERSISTENCE FUNCTIONS ============
495
+ def persist_design_system(design_system: dict, page: str = None, output_dir: str = None, page_query: str = None) -> dict:
496
+ """
497
+ Persist design system to design-system/<project>/ folder using Master + Overrides pattern.
498
+
499
+ Args:
500
+ design_system: The generated design system dictionary
501
+ page: Optional page name for page-specific override file
502
+ output_dir: Optional output directory (defaults to current working directory)
503
+ page_query: Optional query string for intelligent page override generation
504
+
505
+ Returns:
506
+ dict with created file paths and status
507
+ """
508
+ base_dir = Path(output_dir) if output_dir else Path.cwd()
509
+
510
+ # Use project name for project-specific folder
511
+ project_name = design_system.get("project_name", "default")
512
+ project_slug = project_name.lower().replace(' ', '-')
513
+
514
+ design_system_dir = base_dir / "design-system" / project_slug
515
+ pages_dir = design_system_dir / "pages"
516
+
517
+ created_files = []
518
+
519
+ # Create directories
520
+ design_system_dir.mkdir(parents=True, exist_ok=True)
521
+ pages_dir.mkdir(parents=True, exist_ok=True)
522
+
523
+ master_file = design_system_dir / "MASTER.md"
524
+
525
+ # Generate and write MASTER.md
526
+ master_content = format_master_md(design_system)
527
+ with open(master_file, 'w', encoding='utf-8') as f:
528
+ f.write(master_content)
529
+ created_files.append(str(master_file))
530
+
531
+ # If page is specified, create page override file with intelligent content
532
+ if page:
533
+ page_file = pages_dir / f"{page.lower().replace(' ', '-')}.md"
534
+ page_content = format_page_override_md(design_system, page, page_query)
535
+ with open(page_file, 'w', encoding='utf-8') as f:
536
+ f.write(page_content)
537
+ created_files.append(str(page_file))
538
+
539
+ return {
540
+ "status": "success",
541
+ "design_system_dir": str(design_system_dir),
542
+ "created_files": created_files
543
+ }
544
+
545
+
546
+ def format_master_md(design_system: dict) -> str:
547
+ """Format design system as MASTER.md with hierarchical override logic."""
548
+ project = design_system.get("project_name", "PROJECT")
549
+ pattern = design_system.get("pattern", {})
550
+ style = design_system.get("style", {})
551
+ colors = design_system.get("colors", {})
552
+ typography = design_system.get("typography", {})
553
+ effects = design_system.get("key_effects", "")
554
+ anti_patterns = design_system.get("anti_patterns", "")
555
+
556
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
557
+
558
+ lines = []
559
+
560
+ # Logic header
561
+ lines.append("# Design System Master File")
562
+ lines.append("")
563
+ lines.append("> **LOGIC:** When building a specific page, first check `design-system/pages/[page-name].md`.")
564
+ lines.append("> If that file exists, its rules **override** this Master file.")
565
+ lines.append("> If not, strictly follow the rules below.")
566
+ lines.append("")
567
+ lines.append("---")
568
+ lines.append("")
569
+ lines.append(f"**Project:** {project}")
570
+ lines.append(f"**Generated:** {timestamp}")
571
+ lines.append(f"**Category:** {design_system.get('category', 'General')}")
572
+ lines.append("")
573
+ lines.append("---")
574
+ lines.append("")
575
+
576
+ # Global Rules section
577
+ lines.append("## Global Rules")
578
+ lines.append("")
579
+
580
+ # Color Palette
581
+ lines.append("### Color Palette")
582
+ lines.append("")
583
+ lines.append("| Role | Hex | CSS Variable |")
584
+ lines.append("|------|-----|--------------|")
585
+ lines.append(f"| Primary | `{colors.get('primary', '#2563EB')}` | `--color-primary` |")
586
+ lines.append(f"| Secondary | `{colors.get('secondary', '#3B82F6')}` | `--color-secondary` |")
587
+ lines.append(f"| CTA/Accent | `{colors.get('cta', '#F97316')}` | `--color-cta` |")
588
+ lines.append(f"| Background | `{colors.get('background', '#F8FAFC')}` | `--color-background` |")
589
+ lines.append(f"| Text | `{colors.get('text', '#1E293B')}` | `--color-text` |")
590
+ lines.append("")
591
+ if colors.get("notes"):
592
+ lines.append(f"**Color Notes:** {colors.get('notes', '')}")
593
+ lines.append("")
594
+
595
+ # Typography
596
+ lines.append("### Typography")
597
+ lines.append("")
598
+ lines.append(f"- **Heading Font:** {typography.get('heading', 'Inter')}")
599
+ lines.append(f"- **Body Font:** {typography.get('body', 'Inter')}")
600
+ if typography.get("mood"):
601
+ lines.append(f"- **Mood:** {typography.get('mood', '')}")
602
+ if typography.get("google_fonts_url"):
603
+ lines.append(f"- **Google Fonts:** [{typography.get('heading', '')} + {typography.get('body', '')}]({typography.get('google_fonts_url', '')})")
604
+ lines.append("")
605
+ if typography.get("css_import"):
606
+ lines.append("**CSS Import:**")
607
+ lines.append("```css")
608
+ lines.append(typography.get("css_import", ""))
609
+ lines.append("```")
610
+ lines.append("")
611
+
612
+ # Spacing Variables
613
+ lines.append("### Spacing Variables")
614
+ lines.append("")
615
+ lines.append("| Token | Value | Usage |")
616
+ lines.append("|-------|-------|-------|")
617
+ lines.append("| `--space-xs` | `4px` / `0.25rem` | Tight gaps |")
618
+ lines.append("| `--space-sm` | `8px` / `0.5rem` | Icon gaps, inline spacing |")
619
+ lines.append("| `--space-md` | `16px` / `1rem` | Standard padding |")
620
+ lines.append("| `--space-lg` | `24px` / `1.5rem` | Section padding |")
621
+ lines.append("| `--space-xl` | `32px` / `2rem` | Large gaps |")
622
+ lines.append("| `--space-2xl` | `48px` / `3rem` | Section margins |")
623
+ lines.append("| `--space-3xl` | `64px` / `4rem` | Hero padding |")
624
+ lines.append("")
625
+
626
+ # Shadow Depths
627
+ lines.append("### Shadow Depths")
628
+ lines.append("")
629
+ lines.append("| Level | Value | Usage |")
630
+ lines.append("|-------|-------|-------|")
631
+ lines.append("| `--shadow-sm` | `0 1px 2px rgba(0,0,0,0.05)` | Subtle lift |")
632
+ lines.append("| `--shadow-md` | `0 4px 6px rgba(0,0,0,0.1)` | Cards, buttons |")
633
+ lines.append("| `--shadow-lg` | `0 10px 15px rgba(0,0,0,0.1)` | Modals, dropdowns |")
634
+ lines.append("| `--shadow-xl` | `0 20px 25px rgba(0,0,0,0.15)` | Hero images, featured cards |")
635
+ lines.append("")
636
+
637
+ # Component Specs section
638
+ lines.append("---")
639
+ lines.append("")
640
+ lines.append("## Component Specs")
641
+ lines.append("")
642
+
643
+ # Buttons
644
+ lines.append("### Buttons")
645
+ lines.append("")
646
+ lines.append("```css")
647
+ lines.append("/* Primary Button */")
648
+ lines.append(".btn-primary {")
649
+ lines.append(f" background: {colors.get('cta', '#F97316')};")
650
+ lines.append(" color: white;")
651
+ lines.append(" padding: 12px 24px;")
652
+ lines.append(" border-radius: 8px;")
653
+ lines.append(" font-weight: 600;")
654
+ lines.append(" transition: all 200ms ease;")
655
+ lines.append(" cursor: pointer;")
656
+ lines.append("}")
657
+ lines.append("")
658
+ lines.append(".btn-primary:hover {")
659
+ lines.append(" opacity: 0.9;")
660
+ lines.append(" transform: translateY(-1px);")
661
+ lines.append("}")
662
+ lines.append("")
663
+ lines.append("/* Secondary Button */")
664
+ lines.append(".btn-secondary {")
665
+ lines.append(f" background: transparent;")
666
+ lines.append(f" color: {colors.get('primary', '#2563EB')};")
667
+ lines.append(f" border: 2px solid {colors.get('primary', '#2563EB')};")
668
+ lines.append(" padding: 12px 24px;")
669
+ lines.append(" border-radius: 8px;")
670
+ lines.append(" font-weight: 600;")
671
+ lines.append(" transition: all 200ms ease;")
672
+ lines.append(" cursor: pointer;")
673
+ lines.append("}")
674
+ lines.append("```")
675
+ lines.append("")
676
+
677
+ # Cards
678
+ lines.append("### Cards")
679
+ lines.append("")
680
+ lines.append("```css")
681
+ lines.append(".card {")
682
+ lines.append(f" background: {colors.get('background', '#FFFFFF')};")
683
+ lines.append(" border-radius: 12px;")
684
+ lines.append(" padding: 24px;")
685
+ lines.append(" box-shadow: var(--shadow-md);")
686
+ lines.append(" transition: all 200ms ease;")
687
+ lines.append(" cursor: pointer;")
688
+ lines.append("}")
689
+ lines.append("")
690
+ lines.append(".card:hover {")
691
+ lines.append(" box-shadow: var(--shadow-lg);")
692
+ lines.append(" transform: translateY(-2px);")
693
+ lines.append("}")
694
+ lines.append("```")
695
+ lines.append("")
696
+
697
+ # Inputs
698
+ lines.append("### Inputs")
699
+ lines.append("")
700
+ lines.append("```css")
701
+ lines.append(".input {")
702
+ lines.append(" padding: 12px 16px;")
703
+ lines.append(" border: 1px solid #E2E8F0;")
704
+ lines.append(" border-radius: 8px;")
705
+ lines.append(" font-size: 16px;")
706
+ lines.append(" transition: border-color 200ms ease;")
707
+ lines.append("}")
708
+ lines.append("")
709
+ lines.append(".input:focus {")
710
+ lines.append(f" border-color: {colors.get('primary', '#2563EB')};")
711
+ lines.append(" outline: none;")
712
+ lines.append(f" box-shadow: 0 0 0 3px {colors.get('primary', '#2563EB')}20;")
713
+ lines.append("}")
714
+ lines.append("```")
715
+ lines.append("")
716
+
717
+ # Modals
718
+ lines.append("### Modals")
719
+ lines.append("")
720
+ lines.append("```css")
721
+ lines.append(".modal-overlay {")
722
+ lines.append(" background: rgba(0, 0, 0, 0.5);")
723
+ lines.append(" backdrop-filter: blur(4px);")
724
+ lines.append("}")
725
+ lines.append("")
726
+ lines.append(".modal {")
727
+ lines.append(" background: white;")
728
+ lines.append(" border-radius: 16px;")
729
+ lines.append(" padding: 32px;")
730
+ lines.append(" box-shadow: var(--shadow-xl);")
731
+ lines.append(" max-width: 500px;")
732
+ lines.append(" width: 90%;")
733
+ lines.append("}")
734
+ lines.append("```")
735
+ lines.append("")
736
+
737
+ # Style section
738
+ lines.append("---")
739
+ lines.append("")
740
+ lines.append("## Style Guidelines")
741
+ lines.append("")
742
+ lines.append(f"**Style:** {style.get('name', 'Minimalism')}")
743
+ lines.append("")
744
+ if style.get("keywords"):
745
+ lines.append(f"**Keywords:** {style.get('keywords', '')}")
746
+ lines.append("")
747
+ if style.get("best_for"):
748
+ lines.append(f"**Best For:** {style.get('best_for', '')}")
749
+ lines.append("")
750
+ if effects:
751
+ lines.append(f"**Key Effects:** {effects}")
752
+ lines.append("")
753
+
754
+ # Layout Pattern
755
+ lines.append("### Page Pattern")
756
+ lines.append("")
757
+ lines.append(f"**Pattern Name:** {pattern.get('name', '')}")
758
+ lines.append("")
759
+ if pattern.get('conversion'):
760
+ lines.append(f"- **Conversion Strategy:** {pattern.get('conversion', '')}")
761
+ if pattern.get('cta_placement'):
762
+ lines.append(f"- **CTA Placement:** {pattern.get('cta_placement', '')}")
763
+ lines.append(f"- **Section Order:** {pattern.get('sections', '')}")
764
+ lines.append("")
765
+
766
+ # Anti-Patterns section
767
+ lines.append("---")
768
+ lines.append("")
769
+ lines.append("## Anti-Patterns (Do NOT Use)")
770
+ lines.append("")
771
+ if anti_patterns:
772
+ anti_list = [a.strip() for a in anti_patterns.split("+")]
773
+ for anti in anti_list:
774
+ if anti:
775
+ lines.append(f"- ❌ {anti}")
776
+ lines.append("")
777
+ lines.append("### Additional Forbidden Patterns")
778
+ lines.append("")
779
+ lines.append("- ❌ **Emojis as icons** — Use SVG icons (Heroicons, Lucide, Simple Icons)")
780
+ lines.append("- ❌ **Missing cursor:pointer** — All clickable elements must have cursor:pointer")
781
+ lines.append("- ❌ **Layout-shifting hovers** — Avoid scale transforms that shift layout")
782
+ lines.append("- ❌ **Low contrast text** — Maintain 4.5:1 minimum contrast ratio")
783
+ lines.append("- ❌ **Instant state changes** — Always use transitions (150-300ms)")
784
+ lines.append("- ❌ **Invisible focus states** — Focus states must be visible for a11y")
785
+ lines.append("")
786
+
787
+ # Pre-Delivery Checklist
788
+ lines.append("---")
789
+ lines.append("")
790
+ lines.append("## Pre-Delivery Checklist")
791
+ lines.append("")
792
+ lines.append("Before delivering any UI code, verify:")
793
+ lines.append("")
794
+ lines.append("- [ ] No emojis used as icons (use SVG instead)")
795
+ lines.append("- [ ] All icons from consistent icon set (Heroicons/Lucide)")
796
+ lines.append("- [ ] `cursor-pointer` on all clickable elements")
797
+ lines.append("- [ ] Hover states with smooth transitions (150-300ms)")
798
+ lines.append("- [ ] Light mode: text contrast 4.5:1 minimum")
799
+ lines.append("- [ ] Focus states visible for keyboard navigation")
800
+ lines.append("- [ ] `prefers-reduced-motion` respected")
801
+ lines.append("- [ ] Responsive: 375px, 768px, 1024px, 1440px")
802
+ lines.append("- [ ] No content hidden behind fixed navbars")
803
+ lines.append("- [ ] No horizontal scroll on mobile")
804
+ lines.append("")
805
+
806
+ return "\n".join(lines)
807
+
808
+
809
+ def format_page_override_md(design_system: dict, page_name: str, page_query: str = None) -> str:
810
+ """Format a page-specific override file with intelligent AI-generated content."""
811
+ project = design_system.get("project_name", "PROJECT")
812
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
813
+ page_title = page_name.replace("-", " ").replace("_", " ").title()
814
+
815
+ # Detect page type and generate intelligent overrides
816
+ page_overrides = _generate_intelligent_overrides(page_name, page_query, design_system)
817
+
818
+ lines = []
819
+
820
+ lines.append(f"# {page_title} Page Overrides")
821
+ lines.append("")
822
+ lines.append(f"> **PROJECT:** {project}")
823
+ lines.append(f"> **Generated:** {timestamp}")
824
+ lines.append(f"> **Page Type:** {page_overrides.get('page_type', 'General')}")
825
+ lines.append("")
826
+ lines.append("> ⚠️ **IMPORTANT:** Rules in this file **override** the Master file (`design-system/MASTER.md`).")
827
+ lines.append("> Only deviations from the Master are documented here. For all other rules, refer to the Master.")
828
+ lines.append("")
829
+ lines.append("---")
830
+ lines.append("")
831
+
832
+ # Page-specific rules with actual content
833
+ lines.append("## Page-Specific Rules")
834
+ lines.append("")
835
+
836
+ # Layout Overrides
837
+ lines.append("### Layout Overrides")
838
+ lines.append("")
839
+ layout = page_overrides.get("layout", {})
840
+ if layout:
841
+ for key, value in layout.items():
842
+ lines.append(f"- **{key}:** {value}")
843
+ else:
844
+ lines.append("- No overrides — use Master layout")
845
+ lines.append("")
846
+
847
+ # Spacing Overrides
848
+ lines.append("### Spacing Overrides")
849
+ lines.append("")
850
+ spacing = page_overrides.get("spacing", {})
851
+ if spacing:
852
+ for key, value in spacing.items():
853
+ lines.append(f"- **{key}:** {value}")
854
+ else:
855
+ lines.append("- No overrides — use Master spacing")
856
+ lines.append("")
857
+
858
+ # Typography Overrides
859
+ lines.append("### Typography Overrides")
860
+ lines.append("")
861
+ typography = page_overrides.get("typography", {})
862
+ if typography:
863
+ for key, value in typography.items():
864
+ lines.append(f"- **{key}:** {value}")
865
+ else:
866
+ lines.append("- No overrides — use Master typography")
867
+ lines.append("")
868
+
869
+ # Color Overrides
870
+ lines.append("### Color Overrides")
871
+ lines.append("")
872
+ colors = page_overrides.get("colors", {})
873
+ if colors:
874
+ for key, value in colors.items():
875
+ lines.append(f"- **{key}:** {value}")
876
+ else:
877
+ lines.append("- No overrides — use Master colors")
878
+ lines.append("")
879
+
880
+ # Component Overrides
881
+ lines.append("### Component Overrides")
882
+ lines.append("")
883
+ components = page_overrides.get("components", [])
884
+ if components:
885
+ for comp in components:
886
+ lines.append(f"- {comp}")
887
+ else:
888
+ lines.append("- No overrides — use Master component specs")
889
+ lines.append("")
890
+
891
+ # Page-Specific Components
892
+ lines.append("---")
893
+ lines.append("")
894
+ lines.append("## Page-Specific Components")
895
+ lines.append("")
896
+ unique_components = page_overrides.get("unique_components", [])
897
+ if unique_components:
898
+ for comp in unique_components:
899
+ lines.append(f"- {comp}")
900
+ else:
901
+ lines.append("- No unique components for this page")
902
+ lines.append("")
903
+
904
+ # Recommendations
905
+ lines.append("---")
906
+ lines.append("")
907
+ lines.append("## Recommendations")
908
+ lines.append("")
909
+ recommendations = page_overrides.get("recommendations", [])
910
+ if recommendations:
911
+ for rec in recommendations:
912
+ lines.append(f"- {rec}")
913
+ lines.append("")
914
+
915
+ return "\n".join(lines)
916
+
917
+
918
+ def _generate_intelligent_overrides(page_name: str, page_query: str, design_system: dict) -> dict:
919
+ """
920
+ Generate intelligent overrides based on page type using layered search.
921
+
922
+ Uses the existing search infrastructure to find relevant style, UX, and layout
923
+ data instead of hardcoded page types.
924
+ """
925
+ from .core import search
926
+
927
+ page_lower = page_name.lower()
928
+ query_lower = (page_query or "").lower()
929
+ combined_context = f"{page_lower} {query_lower}"
930
+
931
+ # Search across multiple domains for page-specific guidance
932
+ style_search = search(combined_context, "style", max_results=1)
933
+ ux_search = search(combined_context, "ux", max_results=3)
934
+ landing_search = search(combined_context, "landing", max_results=1)
935
+
936
+ # Extract results from search response
937
+ style_results = style_search.get("results", [])
938
+ ux_results = ux_search.get("results", [])
939
+ landing_results = landing_search.get("results", [])
940
+
941
+ # Detect page type from search results or context
942
+ page_type = _detect_page_type(combined_context, style_results)
943
+
944
+ # Build overrides from search results
945
+ layout = {}
946
+ spacing = {}
947
+ typography = {}
948
+ colors = {}
949
+ components = []
950
+ unique_components = []
951
+ recommendations = []
952
+
953
+ # Extract style-based overrides
954
+ if style_results:
955
+ style = style_results[0]
956
+ style_name = style.get("Style Category", "")
957
+ keywords = style.get("Keywords", "")
958
+ best_for = style.get("Best For", "")
959
+ effects = style.get("Effects & Animation", "")
960
+
961
+ # Infer layout from style keywords
962
+ if any(kw in keywords.lower() for kw in ["data", "dense", "dashboard", "grid"]):
963
+ layout["Max Width"] = "1400px or full-width"
964
+ layout["Grid"] = "12-column grid for data flexibility"
965
+ spacing["Content Density"] = "High — optimize for information display"
966
+ elif any(kw in keywords.lower() for kw in ["minimal", "simple", "clean", "single"]):
967
+ layout["Max Width"] = "800px (narrow, focused)"
968
+ layout["Layout"] = "Single column, centered"
969
+ spacing["Content Density"] = "Low — focus on clarity"
970
+ else:
971
+ layout["Max Width"] = "1200px (standard)"
972
+ layout["Layout"] = "Full-width sections, centered content"
973
+
974
+ if effects:
975
+ recommendations.append(f"Effects: {effects}")
976
+
977
+ # Extract UX guidelines as recommendations
978
+ for ux in ux_results:
979
+ category = ux.get("Category", "")
980
+ do_text = ux.get("Do", "")
981
+ dont_text = ux.get("Don't", "")
982
+ if do_text:
983
+ recommendations.append(f"{category}: {do_text}")
984
+ if dont_text:
985
+ components.append(f"Avoid: {dont_text}")
986
+
987
+ # Extract landing pattern info for section structure
988
+ if landing_results:
989
+ landing = landing_results[0]
990
+ sections = landing.get("Section Order", "")
991
+ cta_placement = landing.get("Primary CTA Placement", "")
992
+ color_strategy = landing.get("Color Strategy", "")
993
+
994
+ if sections:
995
+ layout["Sections"] = sections
996
+ if cta_placement:
997
+ recommendations.append(f"CTA Placement: {cta_placement}")
998
+ if color_strategy:
999
+ colors["Strategy"] = color_strategy
1000
+
1001
+ # Add page-type specific defaults if no search results
1002
+ if not layout:
1003
+ layout["Max Width"] = "1200px"
1004
+ layout["Layout"] = "Responsive grid"
1005
+
1006
+ if not recommendations:
1007
+ recommendations = [
1008
+ "Refer to MASTER.md for all design rules",
1009
+ "Add specific overrides as needed for this page"
1010
+ ]
1011
+
1012
+ return {
1013
+ "page_type": page_type,
1014
+ "layout": layout,
1015
+ "spacing": spacing,
1016
+ "typography": typography,
1017
+ "colors": colors,
1018
+ "components": components,
1019
+ "unique_components": unique_components,
1020
+ "recommendations": recommendations
1021
+ }
1022
+
1023
+
1024
+ def _detect_page_type(context: str, style_results: list) -> str:
1025
+ """Detect page type from context and search results."""
1026
+ context_lower = context.lower()
1027
+
1028
+ # Check for common page type patterns
1029
+ page_patterns = [
1030
+ (["dashboard", "admin", "analytics", "data", "metrics", "stats", "monitor", "overview"], "Dashboard / Data View"),
1031
+ (["checkout", "payment", "cart", "purchase", "order", "billing"], "Checkout / Payment"),
1032
+ (["settings", "profile", "account", "preferences", "config"], "Settings / Profile"),
1033
+ (["landing", "marketing", "homepage", "hero", "home", "promo"], "Landing / Marketing"),
1034
+ (["login", "signin", "signup", "register", "auth", "password"], "Authentication"),
1035
+ (["pricing", "plans", "subscription", "tiers", "packages"], "Pricing / Plans"),
1036
+ (["blog", "article", "post", "news", "content", "story"], "Blog / Article"),
1037
+ (["product", "item", "detail", "pdp", "shop", "store"], "Product Detail"),
1038
+ (["search", "results", "browse", "filter", "catalog", "list"], "Search Results"),
1039
+ (["empty", "404", "error", "not found", "zero"], "Empty State"),
1040
+ ]
1041
+
1042
+ for keywords, page_type in page_patterns:
1043
+ if any(kw in context_lower for kw in keywords):
1044
+ return page_type
1045
+
1046
+ # Fallback: try to infer from style results
1047
+ if style_results:
1048
+ style_name = style_results[0].get("Style Category", "").lower()
1049
+ best_for = style_results[0].get("Best For", "").lower()
1050
+
1051
+ if "dashboard" in best_for or "data" in best_for:
1052
+ return "Dashboard / Data View"
1053
+ elif "landing" in best_for or "marketing" in best_for:
1054
+ return "Landing / Marketing"
1055
+
1056
+ return "General"
1057
+
1058
+
1059
+ # ============ CLI SUPPORT ============
1060
+ if __name__ == "__main__":
1061
+ import argparse
1062
+
1063
+ parser = argparse.ArgumentParser(description="Generate Design System")
1064
+ parser.add_argument("query", help="Search query (e.g., 'SaaS dashboard')")
1065
+ parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name")
1066
+ parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format")
1067
+
1068
+ args = parser.parse_args()
1069
+
1070
+ result = generate_design_system(args.query, args.project_name, args.format)
1071
+ print(result)