claude-flow 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (1018) hide show
  1. package/.claude/settings.json +30 -110
  2. package/README.md +301 -605
  3. package/bin/claude-flow +26 -2
  4. package/cli.mjs +2 -19
  5. package/package.json +3 -2
  6. package/scripts/claude-flow-wrapper.sh +35 -0
  7. package/src/cli/cli-core.ts +1 -1
  8. package/src/cli/command-registry.js +1 -1
  9. package/src/cli/commands/hook-types.ts +126 -0
  10. package/src/cli/commands/hook-validator.ts +191 -0
  11. package/src/cli/commands/hook.ts +346 -0
  12. package/src/cli/commands/index.ts +37 -0
  13. package/src/cli/commands/start/start-command.ts +3 -3
  14. package/src/cli/commands/swarm-new.ts +763 -353
  15. package/src/cli/commands/swarm-spawn.ts +8 -13
  16. package/src/cli/commands/swarm.ts +1 -1
  17. package/src/cli/commands/task.ts +51 -7
  18. package/src/cli/commands/workflow.ts +746 -10
  19. package/src/cli/index-remote.ts +1 -1
  20. package/src/cli/index.ts +35 -29
  21. package/src/cli/node-compat.js +2 -71
  22. package/src/cli/node-repl.ts +3 -5
  23. package/src/cli/repl.ts +33 -57
  24. package/src/cli/simple-cli.ts +27 -85
  25. package/src/cli/simple-commands/hive-mind/core.js +3 -1
  26. package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +4 -1
  27. package/src/cli/simple-commands/hive-mind/memory.js +19 -5
  28. package/src/cli/simple-commands/hive-mind.js +390 -636
  29. package/src/cli/simple-commands/init/executable-wrapper.js +8 -5
  30. package/src/cli/simple-commands/init/help.js +6 -2
  31. package/src/cli/simple-commands/init/index.js +201 -168
  32. package/src/cli/simple-commands/init/templates/claude-flow-universal +78 -0
  33. package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +102 -0
  34. package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +105 -0
  35. package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +106 -0
  36. package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +101 -0
  37. package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +102 -0
  38. package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +102 -0
  39. package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +105 -0
  40. package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +8 -8
  41. package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +107 -0
  42. package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +110 -0
  43. package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +106 -0
  44. package/src/cli/simple-commands/init/templates/enhanced-templates.js +170 -222
  45. package/src/cli/simple-commands/init/templates/settings.json +30 -110
  46. package/src/cli/simple-commands/swarm.js +9 -6
  47. package/src/cli/ui/compatible-ui.ts +1 -14
  48. package/src/cli/ui/fallback-handler.ts +2 -2
  49. package/src/cli/utils/environment-detector.ts +6 -6
  50. package/src/cli/utils/interactive-detector.js +126 -0
  51. package/src/communication/message-bus.ts +7 -3
  52. package/src/coordination/advanced-task-executor.ts +11 -8
  53. package/src/coordination/load-balancer.ts +19 -33
  54. package/src/coordination/work-stealing.ts +1 -1
  55. package/src/core/event-bus.ts +2 -2
  56. package/src/core/logger.ts +1 -1
  57. package/src/hive-mind/core/Agent.ts +2 -3
  58. package/src/hive-mind/core/Communication.ts +3 -16
  59. package/src/hive-mind/core/DatabaseManager.ts +3 -18
  60. package/src/hive-mind/core/HiveMind.ts +6 -8
  61. package/src/hive-mind/core/Memory.ts +35 -29
  62. package/src/hive-mind/integration/ConsensusEngine.ts +19 -4
  63. package/src/hive-mind/integration/MCPToolWrapper.ts +2 -1
  64. package/src/hive-mind/integration/SwarmOrchestrator.ts +4 -7
  65. package/src/integration/mock-components.ts +8 -8
  66. package/src/integration/system-integration.ts +20 -33
  67. package/src/mcp/index.ts +17 -20
  68. package/src/mcp/ruv-swarm-tools.ts +2 -12
  69. package/src/swarm/coordinator.ts +46 -97
  70. package/src/swarm/executor-v2.ts +18 -23
  71. package/src/swarm/executor.ts +9 -9
  72. package/src/swarm/optimizations/optimized-executor.ts +26 -79
  73. package/src/swarm/prompt-copier-enhanced.ts +9 -27
  74. package/src/swarm/prompt-copier.ts +12 -13
  75. package/src/swarm/types.ts +1 -7
  76. package/src/utils/error-handler.ts +6 -23
  77. package/src/utils/type-guards.ts +188 -0
  78. package/.claude/commands/analysis/README.md +0 -9
  79. package/.claude/commands/analysis/bottleneck-detect.md +0 -150
  80. package/.claude/commands/analysis/performance-report.md +0 -25
  81. package/.claude/commands/analysis/token-usage.md +0 -25
  82. package/.claude/commands/automation/README.md +0 -9
  83. package/.claude/commands/automation/auto-agent.md +0 -112
  84. package/.claude/commands/automation/smart-spawn.md +0 -25
  85. package/.claude/commands/automation/workflow-select.md +0 -25
  86. package/.claude/commands/coordination/README.md +0 -9
  87. package/.claude/commands/coordination/agent-spawn.md +0 -25
  88. package/.claude/commands/coordination/swarm-init.md +0 -76
  89. package/.claude/commands/coordination/task-orchestrate.md +0 -25
  90. package/.claude/commands/github/README.md +0 -11
  91. package/.claude/commands/github/code-review.md +0 -25
  92. package/.claude/commands/github/github-swarm.md +0 -108
  93. package/.claude/commands/github/issue-tracker-enhanced.md +0 -358
  94. package/.claude/commands/github/issue-triage.md +0 -25
  95. package/.claude/commands/github/pr-enhance.md +0 -26
  96. package/.claude/commands/github/repo-analyze.md +0 -25
  97. package/.claude/commands/hooks/README.md +0 -11
  98. package/.claude/commands/hooks/post-edit.md +0 -25
  99. package/.claude/commands/hooks/post-task.md +0 -25
  100. package/.claude/commands/hooks/pre-edit.md +0 -25
  101. package/.claude/commands/hooks/pre-task.md +0 -100
  102. package/.claude/commands/hooks/session-end.md +0 -25
  103. package/.claude/commands/hooks-overview.md +0 -245
  104. package/.claude/commands/memory/README.md +0 -9
  105. package/.claude/commands/memory/memory-persist.md +0 -25
  106. package/.claude/commands/memory/memory-search.md +0 -25
  107. package/.claude/commands/memory/memory-usage.md +0 -25
  108. package/.claude/commands/monitoring/README.md +0 -9
  109. package/.claude/commands/monitoring/agent-metrics.md +0 -25
  110. package/.claude/commands/monitoring/real-time-view.md +0 -25
  111. package/.claude/commands/monitoring/swarm-monitor.md +0 -25
  112. package/.claude/commands/optimization/README.md +0 -9
  113. package/.claude/commands/optimization/cache-manage.md +0 -25
  114. package/.claude/commands/optimization/parallel-execute.md +0 -25
  115. package/.claude/commands/optimization/topology-optimize.md +0 -25
  116. package/.claude/commands/training/README.md +0 -9
  117. package/.claude/commands/training/model-update.md +0 -25
  118. package/.claude/commands/training/neural-train.md +0 -25
  119. package/.claude/commands/training/pattern-learn.md +0 -25
  120. package/.claude/commands/workflows/README.md +0 -9
  121. package/.claude/commands/workflows/workflow-create.md +0 -25
  122. package/.claude/commands/workflows/workflow-execute.md +0 -25
  123. package/.claude/commands/workflows/workflow-export.md +0 -25
  124. package/.claude/helpers/github-setup.sh +0 -28
  125. package/.claude/helpers/quick-start.sh +0 -19
  126. package/.claude/helpers/setup-mcp.sh +0 -18
  127. package/dist/adapters/cliffy-node.d.ts +0 -45
  128. package/dist/adapters/cliffy-node.d.ts.map +0 -1
  129. package/dist/adapters/cliffy-node.js +0 -61
  130. package/dist/adapters/cliffy-node.js.map +0 -1
  131. package/dist/agents/agent-manager.d.ts +0 -191
  132. package/dist/agents/agent-manager.d.ts.map +0 -1
  133. package/dist/agents/agent-manager.js +0 -969
  134. package/dist/agents/agent-manager.js.map +0 -1
  135. package/dist/agents/agent-registry.d.ts +0 -112
  136. package/dist/agents/agent-registry.d.ts.map +0 -1
  137. package/dist/agents/agent-registry.js +0 -341
  138. package/dist/agents/agent-registry.js.map +0 -1
  139. package/dist/cli/agents/analyst.d.ts +0 -28
  140. package/dist/cli/agents/analyst.d.ts.map +0 -1
  141. package/dist/cli/agents/analyst.js +0 -718
  142. package/dist/cli/agents/analyst.js.map +0 -1
  143. package/dist/cli/agents/architect.d.ts +0 -27
  144. package/dist/cli/agents/architect.d.ts.map +0 -1
  145. package/dist/cli/agents/architect.js +0 -729
  146. package/dist/cli/agents/architect.js.map +0 -1
  147. package/dist/cli/agents/base-agent.d.ts +0 -80
  148. package/dist/cli/agents/base-agent.d.ts.map +0 -1
  149. package/dist/cli/agents/base-agent.js +0 -385
  150. package/dist/cli/agents/base-agent.js.map +0 -1
  151. package/dist/cli/agents/capabilities.d.ts +0 -106
  152. package/dist/cli/agents/capabilities.d.ts.map +0 -1
  153. package/dist/cli/agents/capabilities.js +0 -556
  154. package/dist/cli/agents/capabilities.js.map +0 -1
  155. package/dist/cli/agents/coder.d.ts +0 -34
  156. package/dist/cli/agents/coder.d.ts.map +0 -1
  157. package/dist/cli/agents/coder.js +0 -806
  158. package/dist/cli/agents/coder.js.map +0 -1
  159. package/dist/cli/agents/coordinator.d.ts +0 -25
  160. package/dist/cli/agents/coordinator.d.ts.map +0 -1
  161. package/dist/cli/agents/coordinator.js +0 -454
  162. package/dist/cli/agents/coordinator.js.map +0 -1
  163. package/dist/cli/agents/hive-agents.d.ts +0 -85
  164. package/dist/cli/agents/hive-agents.d.ts.map +0 -1
  165. package/dist/cli/agents/hive-agents.js +0 -549
  166. package/dist/cli/agents/hive-agents.js.map +0 -1
  167. package/dist/cli/agents/index.d.ts +0 -111
  168. package/dist/cli/agents/index.d.ts.map +0 -1
  169. package/dist/cli/agents/index.js +0 -276
  170. package/dist/cli/agents/index.js.map +0 -1
  171. package/dist/cli/agents/researcher.d.ts +0 -24
  172. package/dist/cli/agents/researcher.d.ts.map +0 -1
  173. package/dist/cli/agents/researcher.js +0 -356
  174. package/dist/cli/agents/researcher.js.map +0 -1
  175. package/dist/cli/agents/tester.d.ts +0 -27
  176. package/dist/cli/agents/tester.d.ts.map +0 -1
  177. package/dist/cli/agents/tester.js +0 -594
  178. package/dist/cli/agents/tester.js.map +0 -1
  179. package/dist/cli/cli-core.d.ts +0 -49
  180. package/dist/cli/cli-core.d.ts.map +0 -1
  181. package/dist/cli/cli-core.js +0 -263
  182. package/dist/cli/cli-core.js.map +0 -1
  183. package/dist/cli/commands/advanced-memory-commands.d.ts +0 -2
  184. package/dist/cli/commands/advanced-memory-commands.d.ts.map +0 -1
  185. package/dist/cli/commands/advanced-memory-commands.js +0 -849
  186. package/dist/cli/commands/advanced-memory-commands.js.map +0 -1
  187. package/dist/cli/commands/agent-simple.d.ts +0 -12
  188. package/dist/cli/commands/agent-simple.d.ts.map +0 -1
  189. package/dist/cli/commands/agent-simple.js +0 -353
  190. package/dist/cli/commands/agent-simple.js.map +0 -1
  191. package/dist/cli/commands/agent.d.ts +0 -7
  192. package/dist/cli/commands/agent.d.ts.map +0 -1
  193. package/dist/cli/commands/agent.js +0 -369
  194. package/dist/cli/commands/agent.js.map +0 -1
  195. package/dist/cli/commands/claude.d.ts +0 -3
  196. package/dist/cli/commands/claude.d.ts.map +0 -1
  197. package/dist/cli/commands/claude.js +0 -154
  198. package/dist/cli/commands/claude.js.map +0 -1
  199. package/dist/cli/commands/config-integration.d.ts +0 -10
  200. package/dist/cli/commands/config-integration.d.ts.map +0 -1
  201. package/dist/cli/commands/config-integration.js +0 -416
  202. package/dist/cli/commands/config-integration.js.map +0 -1
  203. package/dist/cli/commands/config.d.ts +0 -5
  204. package/dist/cli/commands/config.d.ts.map +0 -1
  205. package/dist/cli/commands/config.js +0 -89
  206. package/dist/cli/commands/config.js.map +0 -1
  207. package/dist/cli/commands/enterprise.d.ts +0 -3
  208. package/dist/cli/commands/enterprise.d.ts.map +0 -1
  209. package/dist/cli/commands/enterprise.js +0 -1486
  210. package/dist/cli/commands/enterprise.js.map +0 -1
  211. package/dist/cli/commands/help.d.ts +0 -6
  212. package/dist/cli/commands/help.d.ts.map +0 -1
  213. package/dist/cli/commands/help.js +0 -786
  214. package/dist/cli/commands/help.js.map +0 -1
  215. package/dist/cli/commands/hive-mind/index.d.ts +0 -15
  216. package/dist/cli/commands/hive-mind/index.d.ts.map +0 -1
  217. package/dist/cli/commands/hive-mind/index.js +0 -22
  218. package/dist/cli/commands/hive-mind/index.js.map +0 -1
  219. package/dist/cli/commands/hive-mind/init.d.ts +0 -10
  220. package/dist/cli/commands/hive-mind/init.d.ts.map +0 -1
  221. package/dist/cli/commands/hive-mind/init.js +0 -68
  222. package/dist/cli/commands/hive-mind/init.js.map +0 -1
  223. package/dist/cli/commands/hive-mind/optimize-memory.d.ts +0 -8
  224. package/dist/cli/commands/hive-mind/optimize-memory.d.ts.map +0 -1
  225. package/dist/cli/commands/hive-mind/optimize-memory.js +0 -391
  226. package/dist/cli/commands/hive-mind/optimize-memory.js.map +0 -1
  227. package/dist/cli/commands/hive-mind/spawn.d.ts +0 -10
  228. package/dist/cli/commands/hive-mind/spawn.d.ts.map +0 -1
  229. package/dist/cli/commands/hive-mind/spawn.js +0 -147
  230. package/dist/cli/commands/hive-mind/spawn.js.map +0 -1
  231. package/dist/cli/commands/hive-mind/status.d.ts +0 -10
  232. package/dist/cli/commands/hive-mind/status.d.ts.map +0 -1
  233. package/dist/cli/commands/hive-mind/status.js +0 -209
  234. package/dist/cli/commands/hive-mind/status.js.map +0 -1
  235. package/dist/cli/commands/hive-mind/task.d.ts +0 -10
  236. package/dist/cli/commands/hive-mind/task.d.ts.map +0 -1
  237. package/dist/cli/commands/hive-mind/task.js +0 -288
  238. package/dist/cli/commands/hive-mind/task.js.map +0 -1
  239. package/dist/cli/commands/hive-mind/wizard.d.ts +0 -10
  240. package/dist/cli/commands/hive-mind/wizard.d.ts.map +0 -1
  241. package/dist/cli/commands/hive-mind/wizard.js +0 -513
  242. package/dist/cli/commands/hive-mind/wizard.js.map +0 -1
  243. package/dist/cli/commands/hive.d.ts +0 -6
  244. package/dist/cli/commands/hive.d.ts.map +0 -1
  245. package/dist/cli/commands/hive.js +0 -374
  246. package/dist/cli/commands/hive.js.map +0 -1
  247. package/dist/cli/commands/index.d.ts +0 -3
  248. package/dist/cli/commands/index.d.ts.map +0 -1
  249. package/dist/cli/commands/index.js +0 -2416
  250. package/dist/cli/commands/index.js.map +0 -1
  251. package/dist/cli/commands/mcp.d.ts +0 -6
  252. package/dist/cli/commands/mcp.d.ts.map +0 -1
  253. package/dist/cli/commands/mcp.js +0 -177
  254. package/dist/cli/commands/mcp.js.map +0 -1
  255. package/dist/cli/commands/memory.d.ts +0 -30
  256. package/dist/cli/commands/memory.d.ts.map +0 -1
  257. package/dist/cli/commands/memory.js +0 -225
  258. package/dist/cli/commands/memory.js.map +0 -1
  259. package/dist/cli/commands/migrate.d.ts +0 -6
  260. package/dist/cli/commands/migrate.d.ts.map +0 -1
  261. package/dist/cli/commands/migrate.js +0 -139
  262. package/dist/cli/commands/migrate.js.map +0 -1
  263. package/dist/cli/commands/monitor.d.ts +0 -6
  264. package/dist/cli/commands/monitor.d.ts.map +0 -1
  265. package/dist/cli/commands/monitor.js +0 -477
  266. package/dist/cli/commands/monitor.js.map +0 -1
  267. package/dist/cli/commands/ruv-swarm.d.ts +0 -10
  268. package/dist/cli/commands/ruv-swarm.d.ts.map +0 -1
  269. package/dist/cli/commands/ruv-swarm.js +0 -563
  270. package/dist/cli/commands/ruv-swarm.js.map +0 -1
  271. package/dist/cli/commands/session.d.ts +0 -6
  272. package/dist/cli/commands/session.d.ts.map +0 -1
  273. package/dist/cli/commands/session.js +0 -543
  274. package/dist/cli/commands/session.js.map +0 -1
  275. package/dist/cli/commands/sparc.d.ts +0 -3
  276. package/dist/cli/commands/sparc.d.ts.map +0 -1
  277. package/dist/cli/commands/sparc.js +0 -452
  278. package/dist/cli/commands/sparc.js.map +0 -1
  279. package/dist/cli/commands/start/event-emitter.d.ts +0 -13
  280. package/dist/cli/commands/start/event-emitter.d.ts.map +0 -1
  281. package/dist/cli/commands/start/event-emitter.js +0 -35
  282. package/dist/cli/commands/start/event-emitter.js.map +0 -1
  283. package/dist/cli/commands/start/index.d.ts +0 -10
  284. package/dist/cli/commands/start/index.d.ts.map +0 -1
  285. package/dist/cli/commands/start/index.js +0 -9
  286. package/dist/cli/commands/start/index.js.map +0 -1
  287. package/dist/cli/commands/start/process-manager.d.ts +0 -31
  288. package/dist/cli/commands/start/process-manager.d.ts.map +0 -1
  289. package/dist/cli/commands/start/process-manager.js +0 -281
  290. package/dist/cli/commands/start/process-manager.js.map +0 -1
  291. package/dist/cli/commands/start/process-ui-simple.d.ts +0 -25
  292. package/dist/cli/commands/start/process-ui-simple.d.ts.map +0 -1
  293. package/dist/cli/commands/start/process-ui-simple.js +0 -334
  294. package/dist/cli/commands/start/process-ui-simple.js.map +0 -1
  295. package/dist/cli/commands/start/process-ui.d.ts +0 -5
  296. package/dist/cli/commands/start/process-ui.d.ts.map +0 -1
  297. package/dist/cli/commands/start/process-ui.js +0 -5
  298. package/dist/cli/commands/start/process-ui.js.map +0 -1
  299. package/dist/cli/commands/start/start-command.d.ts +0 -6
  300. package/dist/cli/commands/start/start-command.d.ts.map +0 -1
  301. package/dist/cli/commands/start/start-command.js +0 -450
  302. package/dist/cli/commands/start/start-command.js.map +0 -1
  303. package/dist/cli/commands/start/system-monitor.d.ts +0 -22
  304. package/dist/cli/commands/start/system-monitor.d.ts.map +0 -1
  305. package/dist/cli/commands/start/system-monitor.js +0 -267
  306. package/dist/cli/commands/start/system-monitor.js.map +0 -1
  307. package/dist/cli/commands/start/types.d.ts +0 -64
  308. package/dist/cli/commands/start/types.d.ts.map +0 -1
  309. package/dist/cli/commands/start/types.js +0 -22
  310. package/dist/cli/commands/start/types.js.map +0 -1
  311. package/dist/cli/commands/start.d.ts +0 -6
  312. package/dist/cli/commands/start.d.ts.map +0 -1
  313. package/dist/cli/commands/start.js +0 -6
  314. package/dist/cli/commands/start.js.map +0 -1
  315. package/dist/cli/commands/status.d.ts +0 -6
  316. package/dist/cli/commands/status.d.ts.map +0 -1
  317. package/dist/cli/commands/status.js +0 -312
  318. package/dist/cli/commands/status.js.map +0 -1
  319. package/dist/cli/commands/swarm-new.d.ts +0 -3
  320. package/dist/cli/commands/swarm-new.d.ts.map +0 -1
  321. package/dist/cli/commands/swarm-new.js +0 -989
  322. package/dist/cli/commands/swarm-new.js.map +0 -1
  323. package/dist/cli/commands/swarm-spawn.d.ts +0 -24
  324. package/dist/cli/commands/swarm-spawn.d.ts.map +0 -1
  325. package/dist/cli/commands/swarm-spawn.js +0 -61
  326. package/dist/cli/commands/swarm-spawn.js.map +0 -1
  327. package/dist/cli/commands/swarm.d.ts +0 -3
  328. package/dist/cli/commands/swarm.d.ts.map +0 -1
  329. package/dist/cli/commands/swarm.js +0 -460
  330. package/dist/cli/commands/swarm.js.map +0 -1
  331. package/dist/cli/commands/task.d.ts +0 -3
  332. package/dist/cli/commands/task.d.ts.map +0 -1
  333. package/dist/cli/commands/task.js +0 -29
  334. package/dist/cli/commands/task.js.map +0 -1
  335. package/dist/cli/commands/workflow.d.ts +0 -3
  336. package/dist/cli/commands/workflow.d.ts.map +0 -1
  337. package/dist/cli/commands/workflow.js +0 -23
  338. package/dist/cli/commands/workflow.js.map +0 -1
  339. package/dist/cli/completion.d.ts +0 -16
  340. package/dist/cli/completion.d.ts.map +0 -1
  341. package/dist/cli/completion.js +0 -535
  342. package/dist/cli/completion.js.map +0 -1
  343. package/dist/cli/formatter.d.ts +0 -66
  344. package/dist/cli/formatter.d.ts.map +0 -1
  345. package/dist/cli/formatter.js +0 -277
  346. package/dist/cli/formatter.js.map +0 -1
  347. package/dist/cli/index-remote.d.ts +0 -3
  348. package/dist/cli/index-remote.d.ts.map +0 -1
  349. package/dist/cli/index-remote.js +0 -126
  350. package/dist/cli/index-remote.js.map +0 -1
  351. package/dist/cli/index.d.ts +0 -7
  352. package/dist/cli/index.d.ts.map +0 -1
  353. package/dist/cli/index.js +0 -197
  354. package/dist/cli/index.js.map +0 -1
  355. package/dist/cli/init/batch-tools.d.ts +0 -2
  356. package/dist/cli/init/batch-tools.d.ts.map +0 -1
  357. package/dist/cli/init/batch-tools.js +0 -387
  358. package/dist/cli/init/batch-tools.js.map +0 -1
  359. package/dist/cli/init/claude-config.d.ts +0 -3
  360. package/dist/cli/init/claude-config.d.ts.map +0 -1
  361. package/dist/cli/init/claude-config.js +0 -289
  362. package/dist/cli/init/claude-config.js.map +0 -1
  363. package/dist/cli/init/directory-structure.d.ts +0 -2
  364. package/dist/cli/init/directory-structure.d.ts.map +0 -1
  365. package/dist/cli/init/directory-structure.js +0 -144
  366. package/dist/cli/init/directory-structure.js.map +0 -1
  367. package/dist/cli/init/index.d.ts +0 -6
  368. package/dist/cli/init/index.d.ts.map +0 -1
  369. package/dist/cli/init/index.js +0 -52
  370. package/dist/cli/init/index.js.map +0 -1
  371. package/dist/cli/init/sparc-environment.d.ts +0 -2
  372. package/dist/cli/init/sparc-environment.d.ts.map +0 -1
  373. package/dist/cli/init/sparc-environment.js +0 -426
  374. package/dist/cli/init/sparc-environment.js.map +0 -1
  375. package/dist/cli/init/swarm-commands.d.ts +0 -2
  376. package/dist/cli/init/swarm-commands.d.ts.map +0 -1
  377. package/dist/cli/init/swarm-commands.js +0 -795
  378. package/dist/cli/init/swarm-commands.js.map +0 -1
  379. package/dist/cli/init/utils.d.ts +0 -5
  380. package/dist/cli/init/utils.d.ts.map +0 -1
  381. package/dist/cli/init/utils.js +0 -14
  382. package/dist/cli/init/utils.js.map +0 -1
  383. package/dist/cli/main.d.ts +0 -3
  384. package/dist/cli/main.d.ts.map +0 -1
  385. package/dist/cli/main.js +0 -26
  386. package/dist/cli/main.js.map +0 -1
  387. package/dist/cli/node-repl.d.ts +0 -5
  388. package/dist/cli/node-repl.d.ts.map +0 -1
  389. package/dist/cli/node-repl.js +0 -677
  390. package/dist/cli/node-repl.js.map +0 -1
  391. package/dist/cli/repl.d.ts +0 -5
  392. package/dist/cli/repl.d.ts.map +0 -1
  393. package/dist/cli/repl.js +0 -909
  394. package/dist/cli/repl.js.map +0 -1
  395. package/dist/cli/simple-cli.d.ts +0 -3
  396. package/dist/cli/simple-cli.d.ts.map +0 -1
  397. package/dist/cli/simple-cli.js +0 -3059
  398. package/dist/cli/simple-cli.js.map +0 -1
  399. package/dist/cli/simple-mcp.d.ts +0 -6
  400. package/dist/cli/simple-mcp.d.ts.map +0 -1
  401. package/dist/cli/simple-mcp.js +0 -107
  402. package/dist/cli/simple-mcp.js.map +0 -1
  403. package/dist/cli/simple-orchestrator.d.ts +0 -16
  404. package/dist/cli/simple-orchestrator.d.ts.map +0 -1
  405. package/dist/cli/simple-orchestrator.js +0 -833
  406. package/dist/cli/simple-orchestrator.js.map +0 -1
  407. package/dist/cli/ui/compatible-ui.d.ts +0 -45
  408. package/dist/cli/ui/compatible-ui.d.ts.map +0 -1
  409. package/dist/cli/ui/compatible-ui.js +0 -318
  410. package/dist/cli/ui/compatible-ui.js.map +0 -1
  411. package/dist/cli/ui/fallback-handler.d.ts +0 -26
  412. package/dist/cli/ui/fallback-handler.d.ts.map +0 -1
  413. package/dist/cli/ui/fallback-handler.js +0 -163
  414. package/dist/cli/ui/fallback-handler.js.map +0 -1
  415. package/dist/cli/ui/index.d.ts +0 -11
  416. package/dist/cli/ui/index.d.ts.map +0 -1
  417. package/dist/cli/ui/index.js +0 -33
  418. package/dist/cli/ui/index.js.map +0 -1
  419. package/dist/cli/utils/environment-detector.d.ts +0 -52
  420. package/dist/cli/utils/environment-detector.d.ts.map +0 -1
  421. package/dist/cli/utils/environment-detector.js +0 -238
  422. package/dist/cli/utils/environment-detector.js.map +0 -1
  423. package/dist/cli/utils/prompt-defaults.d.ts +0 -82
  424. package/dist/cli/utils/prompt-defaults.d.ts.map +0 -1
  425. package/dist/cli/utils/prompt-defaults.js +0 -253
  426. package/dist/cli/utils/prompt-defaults.js.map +0 -1
  427. package/dist/communication/message-bus.d.ts +0 -283
  428. package/dist/communication/message-bus.d.ts.map +0 -1
  429. package/dist/communication/message-bus.js +0 -954
  430. package/dist/communication/message-bus.js.map +0 -1
  431. package/dist/config/config-manager.d.ts +0 -174
  432. package/dist/config/config-manager.d.ts.map +0 -1
  433. package/dist/config/config-manager.js +0 -443
  434. package/dist/config/config-manager.js.map +0 -1
  435. package/dist/config/ruv-swarm-config.d.ts +0 -167
  436. package/dist/config/ruv-swarm-config.d.ts.map +0 -1
  437. package/dist/config/ruv-swarm-config.js +0 -274
  438. package/dist/config/ruv-swarm-config.js.map +0 -1
  439. package/dist/config/ruv-swarm-integration.d.ts +0 -93
  440. package/dist/config/ruv-swarm-integration.d.ts.map +0 -1
  441. package/dist/config/ruv-swarm-integration.js +0 -292
  442. package/dist/config/ruv-swarm-integration.js.map +0 -1
  443. package/dist/constants/agent-types.d.ts +0 -46
  444. package/dist/constants/agent-types.d.ts.map +0 -1
  445. package/dist/constants/agent-types.js +0 -50
  446. package/dist/constants/agent-types.js.map +0 -1
  447. package/dist/coordination/advanced-scheduler.d.ts +0 -121
  448. package/dist/coordination/advanced-scheduler.d.ts.map +0 -1
  449. package/dist/coordination/advanced-scheduler.js +0 -386
  450. package/dist/coordination/advanced-scheduler.js.map +0 -1
  451. package/dist/coordination/advanced-task-executor.d.ts +0 -100
  452. package/dist/coordination/advanced-task-executor.d.ts.map +0 -1
  453. package/dist/coordination/advanced-task-executor.js +0 -459
  454. package/dist/coordination/advanced-task-executor.js.map +0 -1
  455. package/dist/coordination/background-executor.d.ts +0 -69
  456. package/dist/coordination/background-executor.d.ts.map +0 -1
  457. package/dist/coordination/background-executor.js +0 -362
  458. package/dist/coordination/background-executor.js.map +0 -1
  459. package/dist/coordination/circuit-breaker.d.ts +0 -124
  460. package/dist/coordination/circuit-breaker.d.ts.map +0 -1
  461. package/dist/coordination/circuit-breaker.js +0 -298
  462. package/dist/coordination/circuit-breaker.js.map +0 -1
  463. package/dist/coordination/conflict-resolution.d.ts +0 -133
  464. package/dist/coordination/conflict-resolution.d.ts.map +0 -1
  465. package/dist/coordination/conflict-resolution.js +0 -358
  466. package/dist/coordination/conflict-resolution.js.map +0 -1
  467. package/dist/coordination/dependency-graph.d.ts +0 -78
  468. package/dist/coordination/dependency-graph.d.ts.map +0 -1
  469. package/dist/coordination/dependency-graph.js +0 -386
  470. package/dist/coordination/dependency-graph.js.map +0 -1
  471. package/dist/coordination/hive-orchestrator.d.ts +0 -118
  472. package/dist/coordination/hive-orchestrator.d.ts.map +0 -1
  473. package/dist/coordination/hive-orchestrator.js +0 -321
  474. package/dist/coordination/hive-orchestrator.js.map +0 -1
  475. package/dist/coordination/hive-protocol.d.ts +0 -117
  476. package/dist/coordination/hive-protocol.d.ts.map +0 -1
  477. package/dist/coordination/hive-protocol.js +0 -373
  478. package/dist/coordination/hive-protocol.js.map +0 -1
  479. package/dist/coordination/index.d.ts +0 -14
  480. package/dist/coordination/index.d.ts.map +0 -1
  481. package/dist/coordination/index.js +0 -21
  482. package/dist/coordination/index.js.map +0 -1
  483. package/dist/coordination/load-balancer.d.ts +0 -139
  484. package/dist/coordination/load-balancer.d.ts.map +0 -1
  485. package/dist/coordination/load-balancer.js +0 -691
  486. package/dist/coordination/load-balancer.js.map +0 -1
  487. package/dist/coordination/manager.d.ts +0 -66
  488. package/dist/coordination/manager.d.ts.map +0 -1
  489. package/dist/coordination/manager.js +0 -360
  490. package/dist/coordination/manager.js.map +0 -1
  491. package/dist/coordination/messaging.d.ts +0 -37
  492. package/dist/coordination/messaging.d.ts.map +0 -1
  493. package/dist/coordination/messaging.js +0 -219
  494. package/dist/coordination/messaging.js.map +0 -1
  495. package/dist/coordination/metrics.d.ts +0 -153
  496. package/dist/coordination/metrics.d.ts.map +0 -1
  497. package/dist/coordination/metrics.js +0 -434
  498. package/dist/coordination/metrics.js.map +0 -1
  499. package/dist/coordination/resources.d.ts +0 -36
  500. package/dist/coordination/resources.d.ts.map +0 -1
  501. package/dist/coordination/resources.js +0 -250
  502. package/dist/coordination/resources.js.map +0 -1
  503. package/dist/coordination/scheduler.d.ts +0 -48
  504. package/dist/coordination/scheduler.d.ts.map +0 -1
  505. package/dist/coordination/scheduler.js +0 -308
  506. package/dist/coordination/scheduler.js.map +0 -1
  507. package/dist/coordination/swarm-coordinator.d.ts +0 -116
  508. package/dist/coordination/swarm-coordinator.d.ts.map +0 -1
  509. package/dist/coordination/swarm-coordinator.js +0 -565
  510. package/dist/coordination/swarm-coordinator.js.map +0 -1
  511. package/dist/coordination/swarm-monitor.d.ts +0 -101
  512. package/dist/coordination/swarm-monitor.d.ts.map +0 -1
  513. package/dist/coordination/swarm-monitor.js +0 -340
  514. package/dist/coordination/swarm-monitor.js.map +0 -1
  515. package/dist/coordination/work-stealing.d.ts +0 -44
  516. package/dist/coordination/work-stealing.d.ts.map +0 -1
  517. package/dist/coordination/work-stealing.js +0 -155
  518. package/dist/coordination/work-stealing.js.map +0 -1
  519. package/dist/core/config.d.ts +0 -239
  520. package/dist/core/config.d.ts.map +0 -1
  521. package/dist/core/config.js +0 -1128
  522. package/dist/core/config.js.map +0 -1
  523. package/dist/core/event-bus.d.ts +0 -60
  524. package/dist/core/event-bus.d.ts.map +0 -1
  525. package/dist/core/event-bus.js +0 -153
  526. package/dist/core/event-bus.js.map +0 -1
  527. package/dist/core/json-persistence.d.ts +0 -52
  528. package/dist/core/json-persistence.d.ts.map +0 -1
  529. package/dist/core/json-persistence.js +0 -115
  530. package/dist/core/json-persistence.js.map +0 -1
  531. package/dist/core/logger.d.ts +0 -57
  532. package/dist/core/logger.d.ts.map +0 -1
  533. package/dist/core/logger.js +0 -253
  534. package/dist/core/logger.js.map +0 -1
  535. package/dist/core/orchestrator-fixed.d.ts +0 -81
  536. package/dist/core/orchestrator-fixed.d.ts.map +0 -1
  537. package/dist/core/orchestrator-fixed.js +0 -210
  538. package/dist/core/orchestrator-fixed.js.map +0 -1
  539. package/dist/core/orchestrator.d.ts +0 -103
  540. package/dist/core/orchestrator.d.ts.map +0 -1
  541. package/dist/core/orchestrator.js +0 -965
  542. package/dist/core/orchestrator.js.map +0 -1
  543. package/dist/core/persistence.d.ts +0 -50
  544. package/dist/core/persistence.d.ts.map +0 -1
  545. package/dist/core/persistence.js +0 -186
  546. package/dist/core/persistence.js.map +0 -1
  547. package/dist/enterprise/analytics-manager.d.ts +0 -489
  548. package/dist/enterprise/analytics-manager.d.ts.map +0 -1
  549. package/dist/enterprise/analytics-manager.js +0 -949
  550. package/dist/enterprise/analytics-manager.js.map +0 -1
  551. package/dist/enterprise/audit-manager.d.ts +0 -459
  552. package/dist/enterprise/audit-manager.d.ts.map +0 -1
  553. package/dist/enterprise/audit-manager.js +0 -992
  554. package/dist/enterprise/audit-manager.js.map +0 -1
  555. package/dist/enterprise/cloud-manager.d.ts +0 -435
  556. package/dist/enterprise/cloud-manager.d.ts.map +0 -1
  557. package/dist/enterprise/cloud-manager.js +0 -784
  558. package/dist/enterprise/cloud-manager.js.map +0 -1
  559. package/dist/enterprise/deployment-manager.d.ts +0 -328
  560. package/dist/enterprise/deployment-manager.d.ts.map +0 -1
  561. package/dist/enterprise/deployment-manager.js +0 -823
  562. package/dist/enterprise/deployment-manager.js.map +0 -1
  563. package/dist/enterprise/index.d.ts +0 -13
  564. package/dist/enterprise/index.d.ts.map +0 -1
  565. package/dist/enterprise/index.js +0 -7
  566. package/dist/enterprise/index.js.map +0 -1
  567. package/dist/enterprise/project-manager.d.ts +0 -228
  568. package/dist/enterprise/project-manager.d.ts.map +0 -1
  569. package/dist/enterprise/project-manager.js +0 -529
  570. package/dist/enterprise/project-manager.js.map +0 -1
  571. package/dist/enterprise/security-manager.d.ts +0 -422
  572. package/dist/enterprise/security-manager.d.ts.map +0 -1
  573. package/dist/enterprise/security-manager.js +0 -902
  574. package/dist/enterprise/security-manager.js.map +0 -1
  575. package/dist/hive-mind/core/Agent.d.ts +0 -137
  576. package/dist/hive-mind/core/Agent.d.ts.map +0 -1
  577. package/dist/hive-mind/core/Agent.js +0 -567
  578. package/dist/hive-mind/core/Agent.js.map +0 -1
  579. package/dist/hive-mind/core/Communication.d.ts +0 -116
  580. package/dist/hive-mind/core/Communication.d.ts.map +0 -1
  581. package/dist/hive-mind/core/Communication.js +0 -407
  582. package/dist/hive-mind/core/Communication.js.map +0 -1
  583. package/dist/hive-mind/core/DatabaseManager.d.ts +0 -93
  584. package/dist/hive-mind/core/DatabaseManager.d.ts.map +0 -1
  585. package/dist/hive-mind/core/DatabaseManager.js +0 -551
  586. package/dist/hive-mind/core/DatabaseManager.js.map +0 -1
  587. package/dist/hive-mind/core/HiveMind.d.ts +0 -90
  588. package/dist/hive-mind/core/HiveMind.d.ts.map +0 -1
  589. package/dist/hive-mind/core/HiveMind.js +0 -439
  590. package/dist/hive-mind/core/HiveMind.js.map +0 -1
  591. package/dist/hive-mind/core/Memory.d.ts +0 -235
  592. package/dist/hive-mind/core/Memory.d.ts.map +0 -1
  593. package/dist/hive-mind/core/Memory.js +0 -1185
  594. package/dist/hive-mind/core/Memory.js.map +0 -1
  595. package/dist/hive-mind/core/MemoryMonitor.d.ts +0 -183
  596. package/dist/hive-mind/core/MemoryMonitor.d.ts.map +0 -1
  597. package/dist/hive-mind/core/MemoryMonitor.js +0 -547
  598. package/dist/hive-mind/core/MemoryMonitor.js.map +0 -1
  599. package/dist/hive-mind/core/Queen.d.ts +0 -115
  600. package/dist/hive-mind/core/Queen.d.ts.map +0 -1
  601. package/dist/hive-mind/core/Queen.js +0 -586
  602. package/dist/hive-mind/core/Queen.js.map +0 -1
  603. package/dist/hive-mind/index.d.ts +0 -17
  604. package/dist/hive-mind/index.d.ts.map +0 -1
  605. package/dist/hive-mind/index.js +0 -21
  606. package/dist/hive-mind/index.js.map +0 -1
  607. package/dist/hive-mind/integration/ConsensusEngine.d.ts +0 -117
  608. package/dist/hive-mind/integration/ConsensusEngine.d.ts.map +0 -1
  609. package/dist/hive-mind/integration/ConsensusEngine.js +0 -476
  610. package/dist/hive-mind/integration/ConsensusEngine.js.map +0 -1
  611. package/dist/hive-mind/integration/MCPToolWrapper.d.ts +0 -172
  612. package/dist/hive-mind/integration/MCPToolWrapper.d.ts.map +0 -1
  613. package/dist/hive-mind/integration/MCPToolWrapper.js +0 -216
  614. package/dist/hive-mind/integration/MCPToolWrapper.js.map +0 -1
  615. package/dist/hive-mind/integration/SwarmOrchestrator.d.ts +0 -172
  616. package/dist/hive-mind/integration/SwarmOrchestrator.d.ts.map +0 -1
  617. package/dist/hive-mind/integration/SwarmOrchestrator.js +0 -746
  618. package/dist/hive-mind/integration/SwarmOrchestrator.js.map +0 -1
  619. package/dist/hive-mind/types.d.ts +0 -298
  620. package/dist/hive-mind/types.d.ts.map +0 -1
  621. package/dist/hive-mind/types.js +0 -7
  622. package/dist/hive-mind/types.js.map +0 -1
  623. package/dist/integration/mock-components.d.ts +0 -107
  624. package/dist/integration/mock-components.d.ts.map +0 -1
  625. package/dist/integration/mock-components.js +0 -357
  626. package/dist/integration/mock-components.js.map +0 -1
  627. package/dist/integration/system-integration.d.ts +0 -84
  628. package/dist/integration/system-integration.d.ts.map +0 -1
  629. package/dist/integration/system-integration.js +0 -429
  630. package/dist/integration/system-integration.js.map +0 -1
  631. package/dist/integration/types.d.ts +0 -119
  632. package/dist/integration/types.d.ts.map +0 -1
  633. package/dist/integration/types.js +0 -5
  634. package/dist/integration/types.js.map +0 -1
  635. package/dist/mcp/auth.d.ts +0 -80
  636. package/dist/mcp/auth.d.ts.map +0 -1
  637. package/dist/mcp/auth.js +0 -343
  638. package/dist/mcp/auth.js.map +0 -1
  639. package/dist/mcp/claude-code-wrapper.d.ts +0 -26
  640. package/dist/mcp/claude-code-wrapper.d.ts.map +0 -1
  641. package/dist/mcp/claude-code-wrapper.js +0 -598
  642. package/dist/mcp/claude-code-wrapper.js.map +0 -1
  643. package/dist/mcp/claude-flow-tools.d.ts +0 -13
  644. package/dist/mcp/claude-flow-tools.d.ts.map +0 -1
  645. package/dist/mcp/claude-flow-tools.js +0 -1142
  646. package/dist/mcp/claude-flow-tools.js.map +0 -1
  647. package/dist/mcp/client.d.ts +0 -41
  648. package/dist/mcp/client.d.ts.map +0 -1
  649. package/dist/mcp/client.js +0 -194
  650. package/dist/mcp/client.js.map +0 -1
  651. package/dist/mcp/index.d.ts +0 -134
  652. package/dist/mcp/index.d.ts.map +0 -1
  653. package/dist/mcp/index.js +0 -212
  654. package/dist/mcp/index.js.map +0 -1
  655. package/dist/mcp/integrate-wrapper.d.ts +0 -16
  656. package/dist/mcp/integrate-wrapper.d.ts.map +0 -1
  657. package/dist/mcp/integrate-wrapper.js +0 -77
  658. package/dist/mcp/integrate-wrapper.js.map +0 -1
  659. package/dist/mcp/lifecycle-manager.d.ts +0 -121
  660. package/dist/mcp/lifecycle-manager.d.ts.map +0 -1
  661. package/dist/mcp/lifecycle-manager.js +0 -365
  662. package/dist/mcp/lifecycle-manager.js.map +0 -1
  663. package/dist/mcp/load-balancer.d.ts +0 -88
  664. package/dist/mcp/load-balancer.d.ts.map +0 -1
  665. package/dist/mcp/load-balancer.js +0 -389
  666. package/dist/mcp/load-balancer.js.map +0 -1
  667. package/dist/mcp/orchestration-integration.d.ts +0 -135
  668. package/dist/mcp/orchestration-integration.d.ts.map +0 -1
  669. package/dist/mcp/orchestration-integration.js +0 -722
  670. package/dist/mcp/orchestration-integration.js.map +0 -1
  671. package/dist/mcp/performance-monitor.d.ts +0 -164
  672. package/dist/mcp/performance-monitor.d.ts.map +0 -1
  673. package/dist/mcp/performance-monitor.js +0 -478
  674. package/dist/mcp/performance-monitor.js.map +0 -1
  675. package/dist/mcp/protocol-manager.d.ts +0 -88
  676. package/dist/mcp/protocol-manager.d.ts.map +0 -1
  677. package/dist/mcp/protocol-manager.js +0 -358
  678. package/dist/mcp/protocol-manager.js.map +0 -1
  679. package/dist/mcp/recovery/connection-health-monitor.d.ts +0 -69
  680. package/dist/mcp/recovery/connection-health-monitor.d.ts.map +0 -1
  681. package/dist/mcp/recovery/connection-health-monitor.js +0 -241
  682. package/dist/mcp/recovery/connection-health-monitor.js.map +0 -1
  683. package/dist/mcp/recovery/connection-state-manager.d.ts +0 -102
  684. package/dist/mcp/recovery/connection-state-manager.d.ts.map +0 -1
  685. package/dist/mcp/recovery/connection-state-manager.js +0 -318
  686. package/dist/mcp/recovery/connection-state-manager.js.map +0 -1
  687. package/dist/mcp/recovery/fallback-coordinator.d.ts +0 -79
  688. package/dist/mcp/recovery/fallback-coordinator.d.ts.map +0 -1
  689. package/dist/mcp/recovery/fallback-coordinator.js +0 -278
  690. package/dist/mcp/recovery/fallback-coordinator.js.map +0 -1
  691. package/dist/mcp/recovery/index.d.ts +0 -10
  692. package/dist/mcp/recovery/index.d.ts.map +0 -1
  693. package/dist/mcp/recovery/index.js +0 -10
  694. package/dist/mcp/recovery/index.js.map +0 -1
  695. package/dist/mcp/recovery/reconnection-manager.d.ts +0 -69
  696. package/dist/mcp/recovery/reconnection-manager.d.ts.map +0 -1
  697. package/dist/mcp/recovery/reconnection-manager.js +0 -226
  698. package/dist/mcp/recovery/reconnection-manager.js.map +0 -1
  699. package/dist/mcp/recovery/recovery-manager.d.ts +0 -93
  700. package/dist/mcp/recovery/recovery-manager.d.ts.map +0 -1
  701. package/dist/mcp/recovery/recovery-manager.js +0 -250
  702. package/dist/mcp/recovery/recovery-manager.js.map +0 -1
  703. package/dist/mcp/router.d.ts +0 -54
  704. package/dist/mcp/router.d.ts.map +0 -1
  705. package/dist/mcp/router.js +0 -201
  706. package/dist/mcp/router.js.map +0 -1
  707. package/dist/mcp/ruv-swarm-tools.d.ts +0 -58
  708. package/dist/mcp/ruv-swarm-tools.d.ts.map +0 -1
  709. package/dist/mcp/ruv-swarm-tools.js +0 -518
  710. package/dist/mcp/ruv-swarm-tools.js.map +0 -1
  711. package/dist/mcp/server-with-wrapper.d.ts +0 -3
  712. package/dist/mcp/server-with-wrapper.d.ts.map +0 -1
  713. package/dist/mcp/server-with-wrapper.js +0 -36
  714. package/dist/mcp/server-with-wrapper.js.map +0 -1
  715. package/dist/mcp/server-wrapper-mode.d.ts +0 -3
  716. package/dist/mcp/server-wrapper-mode.d.ts.map +0 -1
  717. package/dist/mcp/server-wrapper-mode.js +0 -28
  718. package/dist/mcp/server-wrapper-mode.js.map +0 -1
  719. package/dist/mcp/server.d.ts +0 -75
  720. package/dist/mcp/server.d.ts.map +0 -1
  721. package/dist/mcp/server.js +0 -533
  722. package/dist/mcp/server.js.map +0 -1
  723. package/dist/mcp/session-manager.d.ts +0 -60
  724. package/dist/mcp/session-manager.d.ts.map +0 -1
  725. package/dist/mcp/session-manager.js +0 -322
  726. package/dist/mcp/session-manager.js.map +0 -1
  727. package/dist/mcp/sparc-modes.d.ts +0 -12
  728. package/dist/mcp/sparc-modes.d.ts.map +0 -1
  729. package/dist/mcp/sparc-modes.js +0 -370
  730. package/dist/mcp/sparc-modes.js.map +0 -1
  731. package/dist/mcp/swarm-tools.d.ts +0 -87
  732. package/dist/mcp/swarm-tools.d.ts.map +0 -1
  733. package/dist/mcp/swarm-tools.js +0 -711
  734. package/dist/mcp/swarm-tools.js.map +0 -1
  735. package/dist/mcp/tools.d.ts +0 -145
  736. package/dist/mcp/tools.d.ts.map +0 -1
  737. package/dist/mcp/tools.js +0 -418
  738. package/dist/mcp/tools.js.map +0 -1
  739. package/dist/mcp/transports/base.d.ts +0 -22
  740. package/dist/mcp/transports/base.d.ts.map +0 -1
  741. package/dist/mcp/transports/base.js +0 -2
  742. package/dist/mcp/transports/base.js.map +0 -1
  743. package/dist/mcp/transports/http.d.ts +0 -45
  744. package/dist/mcp/transports/http.d.ts.map +0 -1
  745. package/dist/mcp/transports/http.js +0 -400
  746. package/dist/mcp/transports/http.js.map +0 -1
  747. package/dist/mcp/transports/stdio.d.ts +0 -34
  748. package/dist/mcp/transports/stdio.d.ts.map +0 -1
  749. package/dist/mcp/transports/stdio.js +0 -203
  750. package/dist/mcp/transports/stdio.js.map +0 -1
  751. package/dist/memory/advanced-memory-manager.d.ts +0 -303
  752. package/dist/memory/advanced-memory-manager.d.ts.map +0 -1
  753. package/dist/memory/advanced-memory-manager.js +0 -1458
  754. package/dist/memory/advanced-memory-manager.js.map +0 -1
  755. package/dist/memory/backends/base.d.ts +0 -21
  756. package/dist/memory/backends/base.d.ts.map +0 -1
  757. package/dist/memory/backends/base.js +0 -2
  758. package/dist/memory/backends/base.js.map +0 -1
  759. package/dist/memory/backends/markdown.d.ts +0 -32
  760. package/dist/memory/backends/markdown.d.ts.map +0 -1
  761. package/dist/memory/backends/markdown.js +0 -223
  762. package/dist/memory/backends/markdown.js.map +0 -1
  763. package/dist/memory/backends/sqlite.d.ts +0 -29
  764. package/dist/memory/backends/sqlite.d.ts.map +0 -1
  765. package/dist/memory/backends/sqlite.js +0 -272
  766. package/dist/memory/backends/sqlite.js.map +0 -1
  767. package/dist/memory/cache.d.ts +0 -65
  768. package/dist/memory/cache.d.ts.map +0 -1
  769. package/dist/memory/cache.js +0 -186
  770. package/dist/memory/cache.js.map +0 -1
  771. package/dist/memory/distributed-memory.d.ts +0 -188
  772. package/dist/memory/distributed-memory.d.ts.map +0 -1
  773. package/dist/memory/distributed-memory.js +0 -711
  774. package/dist/memory/distributed-memory.js.map +0 -1
  775. package/dist/memory/indexer.d.ts +0 -52
  776. package/dist/memory/indexer.d.ts.map +0 -1
  777. package/dist/memory/indexer.js +0 -188
  778. package/dist/memory/indexer.js.map +0 -1
  779. package/dist/memory/manager.d.ts +0 -58
  780. package/dist/memory/manager.d.ts.map +0 -1
  781. package/dist/memory/manager.js +0 -426
  782. package/dist/memory/manager.js.map +0 -1
  783. package/dist/memory/swarm-memory.d.ts +0 -91
  784. package/dist/memory/swarm-memory.d.ts.map +0 -1
  785. package/dist/memory/swarm-memory.js +0 -461
  786. package/dist/memory/swarm-memory.js.map +0 -1
  787. package/dist/migration/index.d.ts +0 -3
  788. package/dist/migration/index.d.ts.map +0 -1
  789. package/dist/migration/index.js +0 -166
  790. package/dist/migration/index.js.map +0 -1
  791. package/dist/migration/logger.d.ts +0 -26
  792. package/dist/migration/logger.d.ts.map +0 -1
  793. package/dist/migration/logger.js +0 -145
  794. package/dist/migration/logger.js.map +0 -1
  795. package/dist/migration/migration-analyzer.d.ts +0 -15
  796. package/dist/migration/migration-analyzer.d.ts.map +0 -1
  797. package/dist/migration/migration-analyzer.js +0 -279
  798. package/dist/migration/migration-analyzer.js.map +0 -1
  799. package/dist/migration/migration-runner.d.ts +0 -26
  800. package/dist/migration/migration-runner.d.ts.map +0 -1
  801. package/dist/migration/migration-runner.js +0 -499
  802. package/dist/migration/migration-runner.js.map +0 -1
  803. package/dist/migration/migration-validator.d.ts +0 -14
  804. package/dist/migration/migration-validator.d.ts.map +0 -1
  805. package/dist/migration/migration-validator.js +0 -313
  806. package/dist/migration/migration-validator.js.map +0 -1
  807. package/dist/migration/progress-reporter.d.ts +0 -25
  808. package/dist/migration/progress-reporter.d.ts.map +0 -1
  809. package/dist/migration/progress-reporter.js +0 -163
  810. package/dist/migration/progress-reporter.js.map +0 -1
  811. package/dist/migration/rollback-manager.d.ts +0 -21
  812. package/dist/migration/rollback-manager.d.ts.map +0 -1
  813. package/dist/migration/rollback-manager.js +0 -348
  814. package/dist/migration/rollback-manager.js.map +0 -1
  815. package/dist/migration/types.d.ts +0 -103
  816. package/dist/migration/types.d.ts.map +0 -1
  817. package/dist/migration/types.js +0 -6
  818. package/dist/migration/types.js.map +0 -1
  819. package/dist/monitoring/diagnostics.d.ts +0 -109
  820. package/dist/monitoring/diagnostics.d.ts.map +0 -1
  821. package/dist/monitoring/diagnostics.js +0 -545
  822. package/dist/monitoring/diagnostics.js.map +0 -1
  823. package/dist/monitoring/health-check.d.ts +0 -91
  824. package/dist/monitoring/health-check.d.ts.map +0 -1
  825. package/dist/monitoring/health-check.js +0 -371
  826. package/dist/monitoring/health-check.js.map +0 -1
  827. package/dist/monitoring/real-time-monitor.d.ts +0 -230
  828. package/dist/monitoring/real-time-monitor.d.ts.map +0 -1
  829. package/dist/monitoring/real-time-monitor.js +0 -839
  830. package/dist/monitoring/real-time-monitor.js.map +0 -1
  831. package/dist/resources/resource-manager.d.ts +0 -390
  832. package/dist/resources/resource-manager.d.ts.map +0 -1
  833. package/dist/resources/resource-manager.js +0 -1220
  834. package/dist/resources/resource-manager.js.map +0 -1
  835. package/dist/swarm/claude-flow-executor.d.ts +0 -28
  836. package/dist/swarm/claude-flow-executor.d.ts.map +0 -1
  837. package/dist/swarm/claude-flow-executor.js +0 -210
  838. package/dist/swarm/claude-flow-executor.js.map +0 -1
  839. package/dist/swarm/coordinator.d.ts +0 -134
  840. package/dist/swarm/coordinator.d.ts.map +0 -1
  841. package/dist/swarm/coordinator.js +0 -2607
  842. package/dist/swarm/coordinator.js.map +0 -1
  843. package/dist/swarm/direct-executor.d.ts +0 -48
  844. package/dist/swarm/direct-executor.d.ts.map +0 -1
  845. package/dist/swarm/direct-executor.js +0 -1113
  846. package/dist/swarm/direct-executor.js.map +0 -1
  847. package/dist/swarm/executor-v2.d.ts +0 -23
  848. package/dist/swarm/executor-v2.d.ts.map +0 -1
  849. package/dist/swarm/executor-v2.js +0 -320
  850. package/dist/swarm/executor-v2.js.map +0 -1
  851. package/dist/swarm/executor.d.ts +0 -117
  852. package/dist/swarm/executor.d.ts.map +0 -1
  853. package/dist/swarm/executor.js +0 -791
  854. package/dist/swarm/executor.js.map +0 -1
  855. package/dist/swarm/index.d.ts +0 -31
  856. package/dist/swarm/index.d.ts.map +0 -1
  857. package/dist/swarm/index.js +0 -42
  858. package/dist/swarm/index.js.map +0 -1
  859. package/dist/swarm/memory.d.ts +0 -176
  860. package/dist/swarm/memory.d.ts.map +0 -1
  861. package/dist/swarm/memory.js +0 -1068
  862. package/dist/swarm/memory.js.map +0 -1
  863. package/dist/swarm/optimizations/async-file-manager.d.ts +0 -49
  864. package/dist/swarm/optimizations/async-file-manager.d.ts.map +0 -1
  865. package/dist/swarm/optimizations/async-file-manager.js +0 -248
  866. package/dist/swarm/optimizations/async-file-manager.js.map +0 -1
  867. package/dist/swarm/optimizations/circular-buffer.d.ts +0 -46
  868. package/dist/swarm/optimizations/circular-buffer.d.ts.map +0 -1
  869. package/dist/swarm/optimizations/circular-buffer.js +0 -159
  870. package/dist/swarm/optimizations/circular-buffer.js.map +0 -1
  871. package/dist/swarm/optimizations/connection-pool.d.ts +0 -54
  872. package/dist/swarm/optimizations/connection-pool.d.ts.map +0 -1
  873. package/dist/swarm/optimizations/connection-pool.js +0 -227
  874. package/dist/swarm/optimizations/connection-pool.js.map +0 -1
  875. package/dist/swarm/optimizations/index.d.ts +0 -24
  876. package/dist/swarm/optimizations/index.d.ts.map +0 -1
  877. package/dist/swarm/optimizations/index.js +0 -30
  878. package/dist/swarm/optimizations/index.js.map +0 -1
  879. package/dist/swarm/optimizations/optimized-executor.d.ts +0 -109
  880. package/dist/swarm/optimizations/optimized-executor.d.ts.map +0 -1
  881. package/dist/swarm/optimizations/optimized-executor.js +0 -321
  882. package/dist/swarm/optimizations/optimized-executor.js.map +0 -1
  883. package/dist/swarm/optimizations/ttl-map.d.ts +0 -78
  884. package/dist/swarm/optimizations/ttl-map.d.ts.map +0 -1
  885. package/dist/swarm/optimizations/ttl-map.js +0 -229
  886. package/dist/swarm/optimizations/ttl-map.js.map +0 -1
  887. package/dist/swarm/prompt-cli.d.ts +0 -5
  888. package/dist/swarm/prompt-cli.d.ts.map +0 -1
  889. package/dist/swarm/prompt-cli.js +0 -256
  890. package/dist/swarm/prompt-cli.js.map +0 -1
  891. package/dist/swarm/prompt-copier-enhanced.d.ts +0 -17
  892. package/dist/swarm/prompt-copier-enhanced.d.ts.map +0 -1
  893. package/dist/swarm/prompt-copier-enhanced.js +0 -190
  894. package/dist/swarm/prompt-copier-enhanced.js.map +0 -1
  895. package/dist/swarm/prompt-copier.d.ts +0 -76
  896. package/dist/swarm/prompt-copier.d.ts.map +0 -1
  897. package/dist/swarm/prompt-copier.js +0 -379
  898. package/dist/swarm/prompt-copier.js.map +0 -1
  899. package/dist/swarm/prompt-manager.d.ts +0 -72
  900. package/dist/swarm/prompt-manager.d.ts.map +0 -1
  901. package/dist/swarm/prompt-manager.js +0 -270
  902. package/dist/swarm/prompt-manager.js.map +0 -1
  903. package/dist/swarm/prompt-utils.d.ts +0 -52
  904. package/dist/swarm/prompt-utils.d.ts.map +0 -1
  905. package/dist/swarm/prompt-utils.js +0 -265
  906. package/dist/swarm/prompt-utils.js.map +0 -1
  907. package/dist/swarm/sparc-executor.d.ts +0 -105
  908. package/dist/swarm/sparc-executor.d.ts.map +0 -1
  909. package/dist/swarm/sparc-executor.js +0 -1364
  910. package/dist/swarm/sparc-executor.js.map +0 -1
  911. package/dist/swarm/strategies/auto.d.ts +0 -57
  912. package/dist/swarm/strategies/auto.d.ts.map +0 -1
  913. package/dist/swarm/strategies/auto.js +0 -623
  914. package/dist/swarm/strategies/auto.js.map +0 -1
  915. package/dist/swarm/strategies/base.d.ts +0 -78
  916. package/dist/swarm/strategies/base.d.ts.map +0 -1
  917. package/dist/swarm/strategies/base.js +0 -108
  918. package/dist/swarm/strategies/base.js.map +0 -1
  919. package/dist/swarm/strategies/research.d.ts +0 -75
  920. package/dist/swarm/strategies/research.d.ts.map +0 -1
  921. package/dist/swarm/strategies/research.js +0 -841
  922. package/dist/swarm/strategies/research.js.map +0 -1
  923. package/dist/swarm/strategies/strategy-metrics-patch.d.ts +0 -11
  924. package/dist/swarm/strategies/strategy-metrics-patch.d.ts.map +0 -1
  925. package/dist/swarm/strategies/strategy-metrics-patch.js +0 -2
  926. package/dist/swarm/strategies/strategy-metrics-patch.js.map +0 -1
  927. package/dist/swarm/types.d.ts +0 -578
  928. package/dist/swarm/types.d.ts.map +0 -1
  929. package/dist/swarm/types.js +0 -51
  930. package/dist/swarm/types.js.map +0 -1
  931. package/dist/swarm/workers/copy-worker.d.ts +0 -2
  932. package/dist/swarm/workers/copy-worker.d.ts.map +0 -1
  933. package/dist/swarm/workers/copy-worker.js +0 -56
  934. package/dist/swarm/workers/copy-worker.js.map +0 -1
  935. package/dist/task/commands.d.ts +0 -60
  936. package/dist/task/commands.d.ts.map +0 -1
  937. package/dist/task/commands.js +0 -107
  938. package/dist/task/commands.js.map +0 -1
  939. package/dist/task/coordination.d.ts +0 -109
  940. package/dist/task/coordination.d.ts.map +0 -1
  941. package/dist/task/coordination.js +0 -629
  942. package/dist/task/coordination.js.map +0 -1
  943. package/dist/task/engine.d.ts +0 -198
  944. package/dist/task/engine.d.ts.map +0 -1
  945. package/dist/task/engine.js +0 -498
  946. package/dist/task/engine.js.map +0 -1
  947. package/dist/task/index.d.ts +0 -103
  948. package/dist/task/index.d.ts.map +0 -1
  949. package/dist/task/index.js +0 -276
  950. package/dist/task/index.js.map +0 -1
  951. package/dist/task/types.d.ts +0 -56
  952. package/dist/task/types.d.ts.map +0 -1
  953. package/dist/task/types.js +0 -2
  954. package/dist/task/types.js.map +0 -1
  955. package/dist/terminal/adapters/base.d.ts +0 -40
  956. package/dist/terminal/adapters/base.d.ts.map +0 -1
  957. package/dist/terminal/adapters/base.js +0 -5
  958. package/dist/terminal/adapters/base.js.map +0 -1
  959. package/dist/terminal/adapters/native.d.ts +0 -19
  960. package/dist/terminal/adapters/native.d.ts.map +0 -1
  961. package/dist/terminal/adapters/native.js +0 -414
  962. package/dist/terminal/adapters/native.js.map +0 -1
  963. package/dist/terminal/adapters/vscode.d.ts +0 -20
  964. package/dist/terminal/adapters/vscode.d.ts.map +0 -1
  965. package/dist/terminal/adapters/vscode.js +0 -265
  966. package/dist/terminal/adapters/vscode.js.map +0 -1
  967. package/dist/terminal/manager.d.ts +0 -59
  968. package/dist/terminal/manager.d.ts.map +0 -1
  969. package/dist/terminal/manager.js +0 -237
  970. package/dist/terminal/manager.js.map +0 -1
  971. package/dist/terminal/pool.d.ts +0 -32
  972. package/dist/terminal/pool.d.ts.map +0 -1
  973. package/dist/terminal/pool.js +0 -205
  974. package/dist/terminal/pool.js.map +0 -1
  975. package/dist/terminal/session.d.ts +0 -41
  976. package/dist/terminal/session.d.ts.map +0 -1
  977. package/dist/terminal/session.js +0 -206
  978. package/dist/terminal/session.js.map +0 -1
  979. package/dist/types/index.d.ts +0 -28
  980. package/dist/types/index.d.ts.map +0 -1
  981. package/dist/types/index.js +0 -15
  982. package/dist/types/index.js.map +0 -1
  983. package/dist/ui/hive-dashboard.d.ts +0 -140
  984. package/dist/ui/hive-dashboard.d.ts.map +0 -1
  985. package/dist/ui/hive-dashboard.js +0 -281
  986. package/dist/ui/hive-dashboard.js.map +0 -1
  987. package/dist/utils/error-handler.d.ts +0 -13
  988. package/dist/utils/error-handler.d.ts.map +0 -1
  989. package/dist/utils/error-handler.js +0 -45
  990. package/dist/utils/error-handler.js.map +0 -1
  991. package/dist/utils/errors.d.ts +0 -121
  992. package/dist/utils/errors.d.ts.map +0 -1
  993. package/dist/utils/errors.js +0 -194
  994. package/dist/utils/errors.js.map +0 -1
  995. package/dist/utils/formatters.d.ts +0 -15
  996. package/dist/utils/formatters.d.ts.map +0 -1
  997. package/dist/utils/formatters.js +0 -75
  998. package/dist/utils/formatters.js.map +0 -1
  999. package/dist/utils/helpers.d.ts +0 -131
  1000. package/dist/utils/helpers.d.ts.map +0 -1
  1001. package/dist/utils/helpers.js +0 -447
  1002. package/dist/utils/helpers.js.map +0 -1
  1003. package/dist/utils/paths.d.ts +0 -4
  1004. package/dist/utils/paths.d.ts.map +0 -1
  1005. package/dist/utils/paths.js +0 -39
  1006. package/dist/utils/paths.js.map +0 -1
  1007. package/dist/utils/types.d.ts +0 -512
  1008. package/dist/utils/types.d.ts.map +0 -1
  1009. package/dist/utils/types.js +0 -37
  1010. package/dist/utils/types.js.map +0 -1
  1011. package/src/cli/simple-commands/hive-mind/memory.d.ts +0 -37
  1012. package/src/cli/simple-commands/init/templates/CLAUDE-FLOW-SPECIFIC.md +0 -238
  1013. package/src/cli/simple-commands/init/templates/all-commands.js +0 -1355
  1014. package/src/cli/simple-commands/init/templates/commands/hooks/hooks-documentation.md +0 -272
  1015. package/src/cli/simple-commands/init/templates/github-enhanced.js +0 -505
  1016. package/src/cli/simple-commands/init/templates/hooks-documentation.md +0 -272
  1017. package/src/cli/simple-commands/web-server.d.ts +0 -22
  1018. package/src/cli/utils.d.ts +0 -8
@@ -1,2416 +0,0 @@
1
- import chalk from 'chalk';
2
- import { getErrorMessage } from '../../utils/error-handler.js';
3
- import { success, error, warning, info } from "../cli-core.js";
4
- import colors from "chalk";
5
- const { bold, blue, yellow } = colors;
6
- import { Orchestrator } from "../../core/orchestrator-fixed.js";
7
- import { ConfigManager } from "../../core/config.js";
8
- import { EventBus } from "../../core/event-bus.js";
9
- import { Logger } from "../../core/logger.js";
10
- import { JsonPersistenceManager } from "../../core/json-persistence.js";
11
- import { swarmAction } from "./swarm.js";
12
- import { SimpleMemoryManager } from "./memory.js";
13
- import { sparcAction } from "./sparc.js";
14
- import { createMigrateCommand } from "./migrate.js";
15
- import { enterpriseCommands } from "./enterprise.js";
16
- let orchestrator = null;
17
- let configManager = null;
18
- let persistence = null;
19
- async function getPersistence() {
20
- if (!persistence) {
21
- persistence = new JsonPersistenceManager();
22
- await persistence.initialize();
23
- }
24
- return persistence;
25
- }
26
- async function getOrchestrator() {
27
- if (!orchestrator) {
28
- const config = await getConfigManager();
29
- const eventBus = EventBus.getInstance();
30
- const logger = new Logger({ level: "info", format: "text", destination: "console" });
31
- orchestrator = new Orchestrator(config, eventBus, logger);
32
- }
33
- return orchestrator;
34
- }
35
- async function getConfigManager() {
36
- if (!configManager) {
37
- configManager = ConfigManager.getInstance();
38
- await configManager.load();
39
- }
40
- return configManager;
41
- }
42
- export function setupCommands(cli) {
43
- // Init command
44
- cli.command({
45
- name: "init",
46
- description: "Initialize Claude Code integration files",
47
- options: [
48
- {
49
- name: "force",
50
- short: "f",
51
- description: "Overwrite existing files",
52
- type: "boolean",
53
- },
54
- {
55
- name: "minimal",
56
- short: "m",
57
- description: "Create minimal configuration files",
58
- type: "boolean",
59
- },
60
- ],
61
- action: async (ctx) => {
62
- try {
63
- success("Initializing Claude Code integration files...");
64
- const force = ctx.flags.force || ctx.flags.f;
65
- const minimal = ctx.flags.minimal || ctx.flags.m;
66
- // Check if files already exist
67
- const files = ["CLAUDE.md", "memory-bank.md", "coordination.md"];
68
- const existingFiles = [];
69
- for (const file of files) {
70
- const { access } = await import("fs/promises");
71
- const exists = await access(file).then(() => true).catch(() => false);
72
- if (exists) {
73
- existingFiles.push(file);
74
- }
75
- }
76
- if (existingFiles.length > 0 && !force) {
77
- warning(`The following files already exist: ${existingFiles.join(", ")}`);
78
- console.log("Use --force to overwrite existing files");
79
- return;
80
- }
81
- // Create CLAUDE.md
82
- const claudeMd = minimal ? createMinimalClaudeMd() : createFullClaudeMd();
83
- const { writeFile } = await import("fs/promises");
84
- await writeFile("CLAUDE.md", claudeMd);
85
- console.log(" ✓ Created CLAUDE.md");
86
- // Create memory-bank.md
87
- const memoryBankMd = minimal ? createMinimalMemoryBankMd() : createFullMemoryBankMd();
88
- await writeFile("memory-bank.md", memoryBankMd);
89
- console.log(" ✓ Created memory-bank.md");
90
- // Create coordination.md
91
- const coordinationMd = minimal ? createMinimalCoordinationMd() : createFullCoordinationMd();
92
- await writeFile("coordination.md", coordinationMd);
93
- console.log(" ✓ Created coordination.md");
94
- // Create directory structure
95
- const directories = [
96
- "memory",
97
- "memory/agents",
98
- "memory/sessions",
99
- "coordination",
100
- "coordination/memory_bank",
101
- "coordination/subtasks",
102
- "coordination/orchestration"
103
- ];
104
- // Ensure memory directory exists for SQLite database
105
- if (!directories.includes("memory")) {
106
- directories.unshift("memory");
107
- }
108
- const { mkdir } = await import("fs/promises");
109
- for (const dir of directories) {
110
- try {
111
- await mkdir(dir, { recursive: true });
112
- console.log(` ✓ Created ${dir}/ directory`);
113
- }
114
- catch (err) {
115
- if (err.code !== 'EEXIST') {
116
- throw err;
117
- }
118
- }
119
- }
120
- // Create placeholder files for memory directories
121
- const agentsReadme = createAgentsReadme();
122
- await writeFile("memory/agents/README.md", agentsReadme);
123
- console.log(" ✓ Created memory/agents/README.md");
124
- const sessionsReadme = createSessionsReadme();
125
- await writeFile("memory/sessions/README.md", sessionsReadme);
126
- console.log(" ✓ Created memory/sessions/README.md");
127
- // Initialize the persistence database
128
- const initialData = {
129
- agents: [],
130
- tasks: [],
131
- lastUpdated: Date.now()
132
- };
133
- await writeFile("memory/claude-flow-data.json", JSON.stringify(initialData, null, 2));
134
- console.log(" ✓ Created memory/claude-flow-data.json (persistence database)");
135
- success("Claude Code integration files initialized successfully!");
136
- console.log("\nNext steps:");
137
- console.log("1. Review and customize the generated files for your project");
138
- console.log("2. Run 'npx claude-flow start' to begin the orchestration system");
139
- console.log("3. Use 'claude --dangerously-skip-permissions' for unattended operation");
140
- console.log("\nNote: Persistence database initialized at memory/claude-flow-data.json");
141
- }
142
- catch (err) {
143
- error(`Failed to initialize files: ${err.message}`);
144
- }
145
- },
146
- });
147
- // Start command
148
- cli.command({
149
- name: "start",
150
- description: "Start the orchestration system",
151
- options: [
152
- {
153
- name: "daemon",
154
- short: "d",
155
- description: "Run as daemon in background",
156
- type: "boolean",
157
- },
158
- {
159
- name: "port",
160
- short: "p",
161
- description: "MCP server port",
162
- type: "number",
163
- default: 3000,
164
- },
165
- ],
166
- action: async (ctx) => {
167
- success("Starting Claude-Flow orchestration system...");
168
- try {
169
- const orch = await getOrchestrator();
170
- await orch.start();
171
- success("System started successfully!");
172
- info("Components initialized:");
173
- console.log(" ✓ Event Bus");
174
- console.log(" ✓ Orchestrator Engine");
175
- console.log(" ✓ Memory Manager");
176
- console.log(" ✓ Terminal Pool");
177
- console.log(" ✓ MCP Server");
178
- console.log(" ✓ Coordination Manager");
179
- if (!ctx.flags.daemon) {
180
- info("Press Ctrl+C to stop the system");
181
- // Keep the process running until interrupted
182
- const controller = new AbortController();
183
- const shutdown = () => {
184
- console.log("\nShutting down...");
185
- controller.abort();
186
- };
187
- process.on("SIGINT", shutdown);
188
- process.on("SIGTERM", shutdown);
189
- try {
190
- await new Promise((resolve) => {
191
- controller.signal.addEventListener('abort', () => resolve());
192
- });
193
- }
194
- finally {
195
- process.off("SIGINT", shutdown);
196
- process.off("SIGTERM", shutdown);
197
- }
198
- }
199
- }
200
- catch (err) {
201
- error(`Failed to start system: ${err.message}`);
202
- process.exit(1);
203
- }
204
- },
205
- });
206
- // Task command
207
- cli.command({
208
- name: "task",
209
- description: "Manage tasks",
210
- aliases: ["tasks"],
211
- action: async (ctx) => {
212
- const subcommand = ctx.args[0];
213
- switch (subcommand) {
214
- case "create": {
215
- const type = ctx.args[1] || "general";
216
- const description = ctx.args.slice(2).join(" ") || "No description";
217
- try {
218
- const persist = await getPersistence();
219
- const taskId = `task-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
220
- // Save to persistence directly
221
- await persist.saveTask({
222
- id: taskId,
223
- type,
224
- description,
225
- status: 'pending',
226
- priority: ctx.flags.priority || 1,
227
- dependencies: ctx.flags.deps ? ctx.flags.deps.split(",") : [],
228
- metadata: {},
229
- progress: 0,
230
- createdAt: Date.now(),
231
- });
232
- success(`Task created successfully!`);
233
- console.log(`📝 Task ID: ${taskId}`);
234
- console.log(`🎯 Type: ${type}`);
235
- console.log(`📄 Description: ${description}`);
236
- }
237
- catch (err) {
238
- error(`Failed to create task: ${err.message}`);
239
- }
240
- break;
241
- }
242
- case "list": {
243
- try {
244
- const persist = await getPersistence();
245
- const tasks = await persist.getActiveTasks();
246
- if (tasks.length === 0) {
247
- info("No active tasks");
248
- }
249
- else {
250
- success(`Active tasks (${tasks.length}):`);
251
- for (const task of tasks) {
252
- console.log(` • ${task.id} (${task.type}) - ${task.status}`);
253
- if (ctx.flags.verbose) {
254
- console.log(` Description: ${task.description}`);
255
- }
256
- }
257
- }
258
- }
259
- catch (err) {
260
- error(`Failed to list tasks: ${err.message}`);
261
- }
262
- break;
263
- }
264
- case "assign": {
265
- const taskId = ctx.args[1];
266
- const agentId = ctx.args[2];
267
- if (!taskId || !agentId) {
268
- error("Usage: task assign <task-id> <agent-id>");
269
- break;
270
- }
271
- try {
272
- const persist = await getPersistence();
273
- const tasks = await persist.getAllTasks();
274
- const agents = await persist.getAllAgents();
275
- const task = tasks.find(t => t.id === taskId);
276
- const agent = agents.find(a => a.id === agentId);
277
- if (!task) {
278
- error(`Task not found: ${taskId}`);
279
- break;
280
- }
281
- if (!agent) {
282
- error(`Agent not found: ${agentId}`);
283
- break;
284
- }
285
- // Update task with assigned agent
286
- task.assignedAgent = agentId;
287
- task.status = "assigned";
288
- await persist.saveTask(task);
289
- success(`Task ${taskId} assigned to agent ${agentId}`);
290
- console.log(`📝 Task: ${task.description}`);
291
- console.log(`🤖 Agent: ${agent.name} (${agent.type})`);
292
- }
293
- catch (err) {
294
- error(`Failed to assign task: ${err.message}`);
295
- }
296
- break;
297
- }
298
- case "workflow": {
299
- const workflowFile = ctx.args[1];
300
- if (!workflowFile) {
301
- error("Usage: task workflow <workflow-file>");
302
- break;
303
- }
304
- try {
305
- const { readFile } = await import("fs/promises");
306
- const content = await readFile(workflowFile, "utf-8");
307
- const workflow = JSON.parse(content);
308
- success("Workflow loaded:");
309
- console.log(`📋 Name: ${workflow.name || 'Unnamed'}`);
310
- console.log(`📝 Description: ${workflow.description || 'No description'}`);
311
- console.log(`🤖 Agents: ${workflow.agents?.length || 0}`);
312
- console.log(`📌 Tasks: ${workflow.tasks?.length || 0}`);
313
- if (ctx.flags.execute) {
314
- warning("Workflow execution would start here (not yet implemented)");
315
- // TODO: Implement workflow execution
316
- }
317
- else {
318
- info("To execute this workflow, ensure Claude-Flow is running");
319
- }
320
- }
321
- catch (err) {
322
- error(`Failed to load workflow: ${err.message}`);
323
- }
324
- break;
325
- }
326
- default: {
327
- console.log("Available subcommands: create, list, assign, workflow");
328
- break;
329
- }
330
- }
331
- },
332
- });
333
- // Enhanced Agent command with comprehensive management
334
- cli.command({
335
- name: "agent",
336
- description: "Comprehensive agent management with advanced features",
337
- aliases: ["agents"],
338
- action: async (ctx) => {
339
- const subcommand = ctx.args[0];
340
- // Import enhanced agent command dynamically
341
- const { agentCommand } = await import("./agent.js");
342
- // Create a mock context for the enhanced command
343
- const enhancedCtx = {
344
- args: ctx.args.slice(1), // Remove 'agent' from args
345
- flags: ctx.flags,
346
- command: subcommand
347
- };
348
- try {
349
- // Map simple commands to enhanced command structure
350
- switch (subcommand) {
351
- case "spawn":
352
- case "list":
353
- case "info":
354
- case "terminate":
355
- case "start":
356
- case "restart":
357
- case "pool":
358
- case "health":
359
- // Use the enhanced agent command system
360
- console.log(chalk.cyan('🚀 Using enhanced agent management system...'));
361
- // Create a simplified wrapper around the enhanced command
362
- const agentManager = await import("../../agents/agent-manager.js");
363
- const { MemoryManager } = await import("../../memory/manager.js");
364
- const { EventBus } = await import("../../core/event-bus.js");
365
- const { Logger } = await import("../../core/logger.js");
366
- const { DistributedMemorySystem } = await import("../../memory/distributed-memory.js");
367
- warning("Enhanced agent management is available!");
368
- console.log("For full functionality, use the comprehensive agent commands:");
369
- console.log(` - claude-flow agent ${subcommand} ${ctx.args.slice(1).join(' ')}`);
370
- console.log(" - Enhanced features: pools, health monitoring, resource management");
371
- console.log(" - Interactive configuration and detailed metrics");
372
- break;
373
- default: {
374
- console.log(chalk.cyan("📋 Agent Management Commands:"));
375
- console.log("Available subcommands:");
376
- console.log(" spawn - Create and start new agents");
377
- console.log(" list - Display all agents with status");
378
- console.log(" info - Get detailed agent information");
379
- console.log(" terminate - Safely terminate agents");
380
- console.log(" start - Start a created agent");
381
- console.log(" restart - Restart an agent");
382
- console.log(" pool - Manage agent pools");
383
- console.log(" health - Monitor agent health");
384
- console.log("");
385
- console.log("Enhanced Features:");
386
- console.log(" ✨ Resource allocation and monitoring");
387
- console.log(" ✨ Agent pools for scaling");
388
- console.log(" ✨ Health diagnostics and auto-recovery");
389
- console.log(" ✨ Interactive configuration");
390
- console.log(" ✨ Memory integration for coordination");
391
- console.log("");
392
- console.log("For detailed help, use: claude-flow agent <command> --help");
393
- break;
394
- }
395
- }
396
- }
397
- catch (err) {
398
- error(`Enhanced agent management unavailable: ${err.message}`);
399
- // Fallback to basic implementation
400
- switch (subcommand) {
401
- case "spawn": {
402
- const type = ctx.args[1] || "researcher";
403
- const name = ctx.flags.name || `${type}-${Date.now()}`;
404
- try {
405
- const persist = await getPersistence();
406
- const agentId = `agent-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
407
- await persist.saveAgent({
408
- id: agentId,
409
- type,
410
- name,
411
- status: 'active',
412
- capabilities: getCapabilitiesForType(type),
413
- systemPrompt: ctx.flags.prompt || getDefaultPromptForType(type),
414
- maxConcurrentTasks: ctx.flags.maxTasks || 5,
415
- priority: ctx.flags.priority || 1,
416
- createdAt: Date.now(),
417
- });
418
- success(`Agent spawned successfully!`);
419
- console.log(`📝 Agent ID: ${agentId}`);
420
- console.log(`🤖 Type: ${type}`);
421
- console.log(`📛 Name: ${name}`);
422
- console.log(`⚡ Status: Active`);
423
- }
424
- catch (err) {
425
- error(`Failed to spawn agent: ${err.message}`);
426
- }
427
- break;
428
- }
429
- case "list": {
430
- try {
431
- const persist = await getPersistence();
432
- const agents = await persist.getActiveAgents();
433
- if (agents.length === 0) {
434
- info("No active agents");
435
- }
436
- else {
437
- success(`Active agents (${agents.length}):`);
438
- for (const agent of agents) {
439
- console.log(` • ${agent.id} (${agent.type}) - ${agent.status}`);
440
- }
441
- }
442
- }
443
- catch (err) {
444
- error(`Failed to list agents: ${err.message}`);
445
- }
446
- break;
447
- }
448
- default: {
449
- console.log("Available subcommands (basic): spawn, list");
450
- console.log("For enhanced features, ensure all dependencies are installed.");
451
- break;
452
- }
453
- }
454
- }
455
- },
456
- });
457
- // Enhanced status command integration
458
- try {
459
- // Import the enhanced status command and add to CLI
460
- const enhancedStatusAction = async (ctx) => {
461
- // Convert CLI context to match enhanced command expectations
462
- const options = {
463
- watch: ctx.flags.watch || ctx.flags.w,
464
- interval: ctx.flags.interval || ctx.flags.i || 5,
465
- component: ctx.flags.component || ctx.flags.c,
466
- json: ctx.flags.json,
467
- detailed: ctx.flags.detailed,
468
- healthCheck: ctx.flags.healthCheck || ctx.flags["health-check"],
469
- history: ctx.flags.history
470
- };
471
- // Mock the enhanced status command action
472
- console.log(chalk.cyan('🔍 Enhanced Status Command'));
473
- console.log('For full enhanced functionality, use: claude-flow status [options]');
474
- console.log('Available options: --watch, --interval, --component, --json, --detailed, --health-check, --history');
475
- // Fallback to basic status
476
- try {
477
- const persist = await getPersistence();
478
- const stats = await persist.getStats();
479
- // Check if orchestrator is running by looking for the log file
480
- const { access } = await import("fs/promises");
481
- const isRunning = await access("orchestrator.log").then(() => true).catch(() => false);
482
- success("Claude-Flow System Status:");
483
- console.log(`🟢 Status: ${isRunning ? 'Running' : 'Stopped'}`);
484
- console.log(`🤖 Agents: ${stats.activeAgents} active (${stats.totalAgents} total)`);
485
- console.log(`📋 Tasks: ${stats.pendingTasks} in queue (${stats.totalTasks} total)`);
486
- console.log(`💾 Memory: Ready`);
487
- console.log(`🖥️ Terminal Pool: Ready`);
488
- console.log(`🌐 MCP Server: ${isRunning ? 'Running' : 'Stopped'}`);
489
- if (ctx.flags.verbose || options.detailed) {
490
- console.log("\nDetailed Statistics:");
491
- console.log(` Total Agents: ${stats.totalAgents}`);
492
- console.log(` Active Agents: ${stats.activeAgents}`);
493
- console.log(` Total Tasks: ${stats.totalTasks}`);
494
- console.log(` Pending Tasks: ${stats.pendingTasks}`);
495
- console.log(` Completed Tasks: ${stats.completedTasks}`);
496
- }
497
- if (options.watch) {
498
- warning('Watch mode available in enhanced status command');
499
- console.log('Use: claude-flow status --watch');
500
- }
501
- }
502
- catch (err) {
503
- error(`Failed to get status: ${err.message}`);
504
- }
505
- };
506
- cli.command({
507
- name: "status",
508
- description: "Show enhanced system status with comprehensive reporting",
509
- options: [
510
- { name: "watch", short: "w", description: "Watch mode - continuously update status", type: "boolean" },
511
- { name: "interval", short: "i", description: "Update interval in seconds", type: "number", default: 5 },
512
- { name: "component", short: "c", description: "Show status for specific component", type: "string" },
513
- { name: "json", description: "Output in JSON format", type: "boolean" },
514
- { name: "detailed", description: "Show detailed component information", type: "boolean" },
515
- { name: "health-check", description: "Perform comprehensive health checks", type: "boolean" },
516
- { name: "history", description: "Show status history from logs", type: "boolean" },
517
- { name: "verbose", short: "v", description: "Enable verbose output", type: "boolean" }
518
- ],
519
- action: enhancedStatusAction
520
- });
521
- }
522
- catch (err) {
523
- warning('Enhanced status command not available, using basic version');
524
- // Fallback basic status command
525
- cli.command({
526
- name: "status",
527
- description: "Show system status",
528
- action: async (ctx) => {
529
- try {
530
- const persist = await getPersistence();
531
- const stats = await persist.getStats();
532
- const { access } = await import("fs/promises");
533
- const isRunning = await access("orchestrator.log").then(() => true).catch(() => false);
534
- success("Claude-Flow System Status:");
535
- console.log(`🟢 Status: ${isRunning ? 'Running' : 'Stopped'}`);
536
- console.log(`🤖 Agents: ${stats.activeAgents} active (${stats.totalAgents} total)`);
537
- console.log(`📋 Tasks: ${stats.pendingTasks} in queue (${stats.totalTasks} total)`);
538
- console.log(`💾 Memory: Ready`);
539
- console.log(`🖥️ Terminal Pool: Ready`);
540
- console.log(`🌐 MCP Server: ${isRunning ? 'Running' : 'Stopped'}`);
541
- if (ctx.flags.verbose) {
542
- console.log("\nDetailed Statistics:");
543
- console.log(` Total Agents: ${stats.totalAgents}`);
544
- console.log(` Active Agents: ${stats.activeAgents}`);
545
- console.log(` Total Tasks: ${stats.totalTasks}`);
546
- console.log(` Pending Tasks: ${stats.pendingTasks}`);
547
- console.log(` Completed Tasks: ${stats.completedTasks}`);
548
- }
549
- }
550
- catch (err) {
551
- error(`Failed to get status: ${err.message}`);
552
- }
553
- }
554
- });
555
- }
556
- // MCP command
557
- cli.command({
558
- name: "mcp",
559
- description: "Manage MCP server and tools",
560
- action: async (ctx) => {
561
- const subcommand = ctx.args[0];
562
- switch (subcommand) {
563
- case "start": {
564
- const port = ctx.flags.port || 3000;
565
- const host = ctx.flags.host || "localhost";
566
- try {
567
- // MCP server is part of the orchestrator start process
568
- const orch = await getOrchestrator();
569
- const health = await orch.healthCheck();
570
- if (!health.healthy) {
571
- warning("Orchestrator is not running. Start it first with 'claude-flow start'");
572
- return;
573
- }
574
- success(`MCP server is running as part of the orchestration system`);
575
- console.log(`📡 Default address: http://${host}:${port}`);
576
- console.log(`🔧 Available tools: Research, Code, Terminal, Memory`);
577
- console.log(`📚 Use 'claude-flow mcp tools' to see all available tools`);
578
- }
579
- catch (err) {
580
- error(`Failed to check MCP server: ${err.message}`);
581
- }
582
- break;
583
- }
584
- case "stop": {
585
- try {
586
- const orch = await getOrchestrator();
587
- const health = await orch.healthCheck();
588
- if (!health.healthy) {
589
- info("MCP server is not running");
590
- }
591
- else {
592
- warning("MCP server runs as part of the orchestrator. Use 'claude-flow stop' to stop the entire system");
593
- }
594
- }
595
- catch (err) {
596
- error(`Failed to check MCP server: ${err.message}`);
597
- }
598
- break;
599
- }
600
- case "status": {
601
- try {
602
- const orch = await getOrchestrator();
603
- const health = await orch.healthCheck();
604
- success("MCP Server Status:");
605
- console.log(`🌐 Status: ${health.mcp ? "Running" : "Stopped"}`);
606
- if (health.mcp) {
607
- const config = await getConfigManager();
608
- const mcpConfig = config.get().mcp;
609
- console.log(`📍 Address: ${mcpConfig.host}:${mcpConfig.port}`);
610
- console.log(`🔐 Authentication: ${mcpConfig.auth ? "Enabled" : "Disabled"}`);
611
- console.log(`🔧 Tools: Available`);
612
- console.log(`📊 Metrics: Collecting`);
613
- }
614
- }
615
- catch (err) {
616
- error(`Failed to get MCP status: ${err.message}`);
617
- }
618
- break;
619
- }
620
- case "tools": {
621
- try {
622
- success("Available MCP Tools:");
623
- console.log(" 📊 Research Tools:");
624
- console.log(" • web_search - Search the web for information");
625
- console.log(" • web_fetch - Fetch content from URLs");
626
- console.log(" • knowledge_query - Query knowledge base");
627
- console.log(" 💻 Code Tools:");
628
- console.log(" • code_edit - Edit code files");
629
- console.log(" • code_search - Search through codebase");
630
- console.log(" • code_analyze - Analyze code quality");
631
- console.log(" 🖥️ Terminal Tools:");
632
- console.log(" • terminal_execute - Execute shell commands");
633
- console.log(" • terminal_session - Manage terminal sessions");
634
- console.log(" • file_operations - File system operations");
635
- console.log(" 💾 Memory Tools:");
636
- console.log(" • memory_store - Store information");
637
- console.log(" • memory_query - Query stored information");
638
- console.log(" • memory_index - Index and search content");
639
- }
640
- catch (err) {
641
- error(`Failed to list tools: ${err.message}`);
642
- }
643
- break;
644
- }
645
- case "config": {
646
- try {
647
- const config = await getConfigManager();
648
- const mcpConfig = config.get().mcp;
649
- success("MCP Configuration:");
650
- console.log(JSON.stringify(mcpConfig, null, 2));
651
- }
652
- catch (err) {
653
- error(`Failed to show MCP config: ${err.message}`);
654
- }
655
- break;
656
- }
657
- case "restart": {
658
- try {
659
- warning("MCP server runs as part of the orchestrator. Use 'claude-flow stop' then 'claude-flow start' to restart the entire system");
660
- }
661
- catch (err) {
662
- error(`Failed to restart MCP server: ${err.message}`);
663
- }
664
- break;
665
- }
666
- case "logs": {
667
- const lines = ctx.flags.lines || 50;
668
- try {
669
- // Mock logs since logging system might not be fully implemented
670
- success(`MCP Server Logs (last ${lines} lines):`);
671
- console.log("2024-01-10 10:00:00 [INFO] MCP server started on localhost:3000");
672
- console.log("2024-01-10 10:00:01 [INFO] Tools registered: 12");
673
- console.log("2024-01-10 10:00:02 [INFO] Authentication disabled");
674
- console.log("2024-01-10 10:01:00 [INFO] Client connected: claude-desktop");
675
- console.log("2024-01-10 10:01:05 [INFO] Tool called: web_search");
676
- console.log("2024-01-10 10:01:10 [INFO] Tool response sent successfully");
677
- }
678
- catch (err) {
679
- error(`Failed to get logs: ${err.message}`);
680
- }
681
- break;
682
- }
683
- default: {
684
- error(`Unknown mcp subcommand: ${subcommand}`);
685
- console.log("Available subcommands: start, stop, status, tools, config, restart, logs");
686
- break;
687
- }
688
- }
689
- },
690
- });
691
- // Memory command
692
- cli.command({
693
- name: "memory",
694
- description: "Manage memory bank",
695
- aliases: ["mem"],
696
- action: async (ctx) => {
697
- const subcommand = ctx.args[0];
698
- const memory = new SimpleMemoryManager();
699
- switch (subcommand) {
700
- case "store": {
701
- const key = ctx.args[1];
702
- const value = ctx.args.slice(2).join(" "); // Join all remaining args as value
703
- if (!key || !value) {
704
- error("Usage: memory store <key> <value>");
705
- break;
706
- }
707
- try {
708
- const namespace = ctx.flags.namespace || ctx.flags.n || "default";
709
- await memory.store(key, value, namespace);
710
- success("Stored successfully");
711
- console.log(`📝 Key: ${key}`);
712
- console.log(`📦 Namespace: ${namespace}`);
713
- console.log(`💾 Size: ${new TextEncoder().encode(value).length} bytes`);
714
- }
715
- catch (err) {
716
- error(`Failed to store: ${err.message}`);
717
- }
718
- break;
719
- }
720
- case "query": {
721
- const search = ctx.args.slice(1).join(" "); // Join all remaining args as search
722
- if (!search) {
723
- error("Usage: memory query <search>");
724
- break;
725
- }
726
- try {
727
- const namespace = ctx.flags.namespace || ctx.flags.n;
728
- const limit = ctx.flags.limit || ctx.flags.l || 10;
729
- const results = await memory.query(search, namespace);
730
- if (results.length === 0) {
731
- warning("No results found");
732
- return;
733
- }
734
- success(`Found ${results.length} results:`);
735
- const limited = results.slice(0, limit);
736
- for (const entry of limited) {
737
- console.log(blue(`\n📌 ${entry.key}`));
738
- console.log(` Namespace: ${entry.namespace}`);
739
- console.log(` Value: ${entry.value.substring(0, 100)}${entry.value.length > 100 ? '...' : ''}`);
740
- console.log(` Stored: ${new Date(entry.timestamp).toLocaleString()}`);
741
- }
742
- if (results.length > limit) {
743
- console.log(`\n... and ${results.length - limit} more results`);
744
- }
745
- }
746
- catch (err) {
747
- error(`Failed to query: ${err.message}`);
748
- }
749
- break;
750
- }
751
- case "export": {
752
- const file = ctx.args[1];
753
- if (!file) {
754
- error("Usage: memory export <file>");
755
- break;
756
- }
757
- try {
758
- await memory.exportData(file);
759
- const stats = await memory.getStats();
760
- success("Memory exported successfully");
761
- console.log(`📁 File: ${file}`);
762
- console.log(`📊 Entries: ${stats.totalEntries}`);
763
- console.log(`💾 Size: ${(stats.sizeBytes / 1024).toFixed(2)} KB`);
764
- }
765
- catch (err) {
766
- error(`Failed to export: ${err.message}`);
767
- }
768
- break;
769
- }
770
- case "import": {
771
- const file = ctx.args[1];
772
- if (!file) {
773
- error("Usage: memory import <file>");
774
- break;
775
- }
776
- try {
777
- await memory.importData(file);
778
- const stats = await memory.getStats();
779
- success("Memory imported successfully");
780
- console.log(`📁 File: ${file}`);
781
- console.log(`📊 Entries: ${stats.totalEntries}`);
782
- console.log(`🗂️ Namespaces: ${stats.namespaces}`);
783
- }
784
- catch (err) {
785
- error(`Failed to import: ${err.message}`);
786
- }
787
- break;
788
- }
789
- case "stats": {
790
- try {
791
- const stats = await memory.getStats();
792
- success("Memory Bank Statistics:");
793
- console.log(` Total Entries: ${stats.totalEntries}`);
794
- console.log(` Namespaces: ${stats.namespaces}`);
795
- console.log(` Size: ${(stats.sizeBytes / 1024).toFixed(2)} KB`);
796
- if (stats.namespaces > 0) {
797
- console.log(blue("\n📁 Namespace Breakdown:"));
798
- for (const [namespace, count] of Object.entries(stats.namespaceStats)) {
799
- console.log(` ${namespace}: ${count} entries`);
800
- }
801
- }
802
- }
803
- catch (err) {
804
- error(`Failed to get stats: ${err.message}`);
805
- }
806
- break;
807
- }
808
- case "cleanup": {
809
- try {
810
- const days = ctx.flags.days || ctx.flags.d || 30;
811
- const removed = await memory.cleanup(days);
812
- success("Cleanup completed");
813
- console.log(`🗑️ Removed: ${removed} entries older than ${days} days`);
814
- }
815
- catch (err) {
816
- error(`Failed to cleanup: ${err.message}`);
817
- }
818
- break;
819
- }
820
- default: {
821
- console.log("Available subcommands: store, query, export, import, stats, cleanup");
822
- console.log("\nExamples:");
823
- console.log(` ${blue("memory store")} previous_work "Research findings from yesterday"`);
824
- console.log(` ${blue("memory query")} research`);
825
- console.log(` ${blue("memory export")} backup.json`);
826
- console.log(` ${blue("memory stats")}`);
827
- break;
828
- }
829
- }
830
- },
831
- });
832
- // Claude command
833
- cli.command({
834
- name: "claude",
835
- description: "Spawn Claude instances with specific configurations",
836
- aliases: ["cl"],
837
- options: [
838
- {
839
- name: "tools",
840
- short: "t",
841
- description: "Allowed tools (comma-separated)",
842
- type: "string",
843
- default: "View,Edit,Replace,GlobTool,GrepTool,LS,Bash",
844
- },
845
- {
846
- name: "no-permissions",
847
- description: "Use --dangerously-skip-permissions flag",
848
- type: "boolean",
849
- },
850
- {
851
- name: "config",
852
- short: "c",
853
- description: "MCP config file path",
854
- type: "string",
855
- },
856
- {
857
- name: "mode",
858
- short: "m",
859
- description: "Development mode (full, backend-only, frontend-only, api-only)",
860
- type: "string",
861
- default: "full",
862
- },
863
- {
864
- name: "parallel",
865
- description: "Enable parallel execution with BatchTool",
866
- type: "boolean",
867
- },
868
- {
869
- name: "research",
870
- description: "Enable web research with WebFetchTool",
871
- type: "boolean",
872
- },
873
- {
874
- name: "coverage",
875
- description: "Test coverage target percentage",
876
- type: "number",
877
- default: 80,
878
- },
879
- {
880
- name: "commit",
881
- description: "Commit frequency (phase, feature, manual)",
882
- type: "string",
883
- default: "phase",
884
- },
885
- {
886
- name: "verbose",
887
- short: "v",
888
- description: "Enable verbose output",
889
- type: "boolean",
890
- },
891
- {
892
- name: "dry-run",
893
- short: "d",
894
- description: "Show what would be executed without running",
895
- type: "boolean",
896
- },
897
- ],
898
- action: async (ctx) => {
899
- const subcommand = ctx.args[0];
900
- switch (subcommand) {
901
- case "spawn": {
902
- // Find where flags start (arguments starting with -)
903
- let taskEndIndex = ctx.args.length;
904
- for (let i = 1; i < ctx.args.length; i++) {
905
- if (ctx.args[i].startsWith("-")) {
906
- taskEndIndex = i;
907
- break;
908
- }
909
- }
910
- const task = ctx.args.slice(1, taskEndIndex).join(" ");
911
- if (!task) {
912
- error("Usage: claude spawn <task description>");
913
- break;
914
- }
915
- try {
916
- // Build allowed tools list
917
- let tools = ctx.flags.tools || "View,Edit,Replace,GlobTool,GrepTool,LS,Bash";
918
- if (ctx.flags.parallel) {
919
- tools += ",BatchTool,dispatch_agent";
920
- }
921
- if (ctx.flags.research) {
922
- tools += ",WebFetchTool";
923
- }
924
- const instanceId = `claude-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
925
- // Build enhanced task with Claude-Flow guidance
926
- let enhancedTask = `# Claude-Flow Enhanced Task
927
-
928
- ## Your Task
929
- ${task}
930
-
931
- ## Claude-Flow System Context
932
-
933
- You are running within the Claude-Flow orchestration system, which provides powerful features for complex task management:
934
-
935
- ### Available Features
936
-
937
- 1. **Memory Bank** (Always Available)
938
- - Store data: \`npx claude-flow memory store <key> <value>\` - Save important data, findings, or progress
939
- - Retrieve data: \`npx claude-flow memory query <key>\` - Access previously stored information
940
- - Check status: \`npx claude-flow status\` - View current system/task status
941
- - List agents: \`npx claude-flow agent list\` - See active agents
942
- - Memory persists across Claude instances in the same namespace
943
-
944
- 2. **Tool Access**
945
- - You have access to these tools: ${tools}`;
946
- if (ctx.flags.parallel) {
947
- enhancedTask += `
948
- - **Parallel Execution Enabled**: Use \`npx claude-flow agent spawn <type> --name <name>\` to spawn sub-agents
949
- - Create tasks: \`npx claude-flow task create <type> "<description>"\`
950
- - Assign tasks: \`npx claude-flow task assign <task-id> <agent-id>\`
951
- - Break down complex tasks and delegate to specialized agents`;
952
- }
953
- if (ctx.flags.research) {
954
- enhancedTask += `
955
- - **Research Mode**: Use \`WebFetchTool\` for web research and information gathering`;
956
- }
957
- enhancedTask += `
958
-
959
- ### Workflow Guidelines
960
-
961
- 1. **Before Starting**:
962
- - Check memory: \`npx claude-flow memory query previous_work\`
963
- - Check system status: \`npx claude-flow status\`
964
- - List active agents: \`npx claude-flow agent list\`
965
- - List active tasks: \`npx claude-flow task list\`
966
-
967
- 2. **During Execution**:
968
- - Store findings: \`npx claude-flow memory store findings "your data here"\`
969
- - Save checkpoints: \`npx claude-flow memory store progress_${task.replace(/\s+/g, '_')} "current status"\`
970
- ${ctx.flags.parallel ? '- Spawn agents: `npx claude-flow agent spawn researcher --name "research-agent"`' : ''}
971
- ${ctx.flags.parallel ? '- Create tasks: `npx claude-flow task create implementation "implement feature X"`' : ''}
972
-
973
- 3. **Best Practices**:
974
- - Use the Bash tool to run \`npx claude-flow\` commands
975
- - Store data as JSON strings for complex structures
976
- - Query memory before starting to check for existing work
977
- - Use descriptive keys for memory storage
978
- ${ctx.flags.parallel ? '- Coordinate with other agents through shared memory' : ''}
979
- ${ctx.flags.research ? '- Store research findings: `npx claude-flow memory store research_findings "data"`' : ''}
980
-
981
- ## Configuration
982
- - Instance ID: ${instanceId}
983
- - Mode: ${ctx.flags.mode || 'full'}
984
- - Coverage Target: ${ctx.flags.coverage || 80}%
985
- - Commit Strategy: ${ctx.flags.commit || 'phase'}
986
-
987
- ## Example Commands
988
-
989
- To interact with Claude-Flow, use the Bash tool:
990
-
991
- \`\`\`bash
992
- # Check for previous work
993
- Bash("npx claude-flow memory query previous_work")
994
-
995
- # Store your findings
996
- Bash("npx claude-flow memory store analysis_results 'Found 3 critical issues...'")
997
-
998
- # Check system status
999
- Bash("npx claude-flow status")
1000
-
1001
- # Create and assign tasks (when --parallel is enabled)
1002
- Bash("npx claude-flow task create research 'Research authentication methods'")
1003
- Bash("npx claude-flow agent spawn researcher --name auth-researcher")
1004
- \`\`\`
1005
-
1006
- Now, please proceed with the task: ${task}`;
1007
- // Build Claude command with enhanced task
1008
- const claudeCmd = ["claude", enhancedTask];
1009
- claudeCmd.push("--allowedTools", tools);
1010
- if (ctx.flags.noPermissions || ctx.flags["skip-permissions"]) {
1011
- claudeCmd.push("--dangerously-skip-permissions");
1012
- }
1013
- if (ctx.flags.config) {
1014
- claudeCmd.push("--mcp-config", ctx.flags.config);
1015
- }
1016
- if (ctx.flags.verbose) {
1017
- claudeCmd.push("--verbose");
1018
- }
1019
- if (ctx.flags.dryRun || ctx.flags["dry-run"] || ctx.flags.d) {
1020
- warning("DRY RUN - Would execute:");
1021
- console.log(`Command: claude "<enhanced task with guidance>" --allowedTools ${tools}`);
1022
- console.log(`Instance ID: ${instanceId}`);
1023
- console.log(`Original Task: ${task}`);
1024
- console.log(`Tools: ${tools}`);
1025
- console.log(`Mode: ${ctx.flags.mode || "full"}`);
1026
- console.log(`Coverage: ${ctx.flags.coverage || 80}%`);
1027
- console.log(`Commit: ${ctx.flags.commit || "phase"}`);
1028
- console.log(`\nEnhanced Features:`);
1029
- console.log(` - Memory Bank enabled via: npx claude-flow memory commands`);
1030
- console.log(` - Coordination ${ctx.flags.parallel ? 'enabled' : 'disabled'}`);
1031
- console.log(` - Access Claude-Flow features through Bash tool`);
1032
- return;
1033
- }
1034
- success(`Spawning Claude instance: ${instanceId}`);
1035
- console.log(`📝 Original Task: ${task}`);
1036
- console.log(`🔧 Tools: ${tools}`);
1037
- console.log(`⚙️ Mode: ${ctx.flags.mode || "full"}`);
1038
- console.log(`📊 Coverage: ${ctx.flags.coverage || 80}%`);
1039
- console.log(`💾 Commit: ${ctx.flags.commit || "phase"}`);
1040
- console.log(`✨ Enhanced with Claude-Flow guidance for memory and coordination`);
1041
- console.log('');
1042
- console.log('📋 Task will be enhanced with:');
1043
- console.log(' - Memory Bank instructions (store/retrieve)');
1044
- console.log(' - Coordination capabilities (swarm management)');
1045
- console.log(' - Best practices for multi-agent workflows');
1046
- console.log('');
1047
- // Execute Claude command
1048
- const { spawn } = await import("child_process");
1049
- const child = spawn("claude", claudeCmd.slice(1).map(arg => arg.replace(/^"|"$/g, '')), {
1050
- env: {
1051
- ...process.env,
1052
- CLAUDE_INSTANCE_ID: instanceId,
1053
- CLAUDE_FLOW_MODE: ctx.flags.mode || "full",
1054
- CLAUDE_FLOW_COVERAGE: (ctx.flags.coverage || 80).toString(),
1055
- CLAUDE_FLOW_COMMIT: ctx.flags.commit || "phase",
1056
- // Add Claude-Flow specific features
1057
- CLAUDE_FLOW_MEMORY_ENABLED: 'true',
1058
- CLAUDE_FLOW_MEMORY_NAMESPACE: 'default',
1059
- CLAUDE_FLOW_COORDINATION_ENABLED: ctx.flags.parallel ? 'true' : 'false',
1060
- CLAUDE_FLOW_FEATURES: 'memory,coordination,swarm',
1061
- },
1062
- stdio: "inherit",
1063
- });
1064
- const status = await new Promise((resolve) => {
1065
- child.on("close", (code) => {
1066
- resolve({ success: code === 0, code });
1067
- });
1068
- });
1069
- if (status.success) {
1070
- success(`Claude instance ${instanceId} completed successfully`);
1071
- }
1072
- else {
1073
- error(`Claude instance ${instanceId} exited with code ${status.code}`);
1074
- }
1075
- }
1076
- catch (err) {
1077
- error(`Failed to spawn Claude: ${err.message}`);
1078
- }
1079
- break;
1080
- }
1081
- case "batch": {
1082
- const workflowFile = ctx.args[1];
1083
- if (!workflowFile) {
1084
- error("Usage: claude batch <workflow-file>");
1085
- break;
1086
- }
1087
- try {
1088
- const { readFile } = await import("fs/promises");
1089
- const content = await readFile(workflowFile, "utf-8");
1090
- const workflow = JSON.parse(content);
1091
- success(`Loading workflow: ${workflow.name || "Unnamed"}`);
1092
- console.log(`📋 Tasks: ${workflow.tasks?.length || 0}`);
1093
- if (!workflow.tasks || workflow.tasks.length === 0) {
1094
- warning("No tasks found in workflow");
1095
- return;
1096
- }
1097
- const promises = [];
1098
- for (const task of workflow.tasks) {
1099
- const claudeCmd = ["claude", `"${task.description || task.name}"`];
1100
- // Add tools
1101
- if (task.tools) {
1102
- const toolsList = Array.isArray(task.tools) ? task.tools.join(",") : task.tools;
1103
- claudeCmd.push("--allowedTools", toolsList);
1104
- }
1105
- // Add flags
1106
- if (task.skipPermissions || task.dangerouslySkipPermissions) {
1107
- claudeCmd.push("--dangerously-skip-permissions");
1108
- }
1109
- if (task.config) {
1110
- claudeCmd.push("--mcp-config", task.config);
1111
- }
1112
- const taskId = task.id || `task-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1113
- if (ctx.flags.dryRun || ctx.flags["dry-run"]) {
1114
- console.log(`\n${yellow("DRY RUN")} - Task: ${task.name || taskId}`);
1115
- console.log(`Command: ${claudeCmd.join(" ")}`);
1116
- continue;
1117
- }
1118
- console.log(`\n🚀 Spawning Claude for task: ${task.name || taskId}`);
1119
- const { spawn } = await import("child_process");
1120
- const child = spawn("claude", claudeCmd.slice(1).map(arg => arg.replace(/^"|"$/g, '')), {
1121
- env: {
1122
- ...process.env,
1123
- CLAUDE_TASK_ID: taskId,
1124
- CLAUDE_TASK_TYPE: task.type || "general",
1125
- },
1126
- stdio: "inherit",
1127
- });
1128
- if (workflow.parallel) {
1129
- promises.push(new Promise((resolve) => {
1130
- child.on("close", (code) => {
1131
- resolve({ success: code === 0, code });
1132
- });
1133
- }));
1134
- }
1135
- else {
1136
- // Wait for completion if sequential
1137
- const status = await new Promise((resolve) => {
1138
- child.on("close", (code) => {
1139
- resolve({ success: code === 0, code });
1140
- });
1141
- });
1142
- if (!status.success) {
1143
- error(`Task ${taskId} failed with code ${status.code}`);
1144
- }
1145
- }
1146
- }
1147
- if (workflow.parallel && promises.length > 0) {
1148
- success("All Claude instances spawned in parallel mode");
1149
- const results = await Promise.all(promises);
1150
- const failed = results.filter((s) => !s.success).length;
1151
- if (failed > 0) {
1152
- warning(`${failed} tasks failed`);
1153
- }
1154
- else {
1155
- success("All tasks completed successfully");
1156
- }
1157
- }
1158
- }
1159
- catch (err) {
1160
- error(`Failed to process workflow: ${err.message}`);
1161
- }
1162
- break;
1163
- }
1164
- default: {
1165
- console.log("Available subcommands: spawn, batch");
1166
- console.log("\nExamples:");
1167
- console.log(" claude-flow claude spawn \"implement user authentication\" --research --parallel");
1168
- console.log(" claude-flow claude spawn \"fix bug in payment system\" --no-permissions");
1169
- console.log(" claude-flow claude batch workflow.json --dry-run");
1170
- break;
1171
- }
1172
- }
1173
- },
1174
- });
1175
- // Enhanced monitor command integration
1176
- try {
1177
- const enhancedMonitorAction = async (ctx) => {
1178
- // Convert CLI context to match enhanced command expectations
1179
- const options = {
1180
- interval: ctx.flags.interval || ctx.flags.i || 2,
1181
- compact: ctx.flags.compact || ctx.flags.c,
1182
- focus: ctx.flags.focus || ctx.flags.f,
1183
- alerts: ctx.flags.alerts,
1184
- export: ctx.flags.export,
1185
- threshold: ctx.flags.threshold || 80,
1186
- logLevel: ctx.flags.logLevel || ctx.flags['log-level'] || 'info',
1187
- noGraphs: ctx.flags.noGraphs || ctx.flags['no-graphs']
1188
- };
1189
- console.log(chalk.cyan('📊 Enhanced Monitor Command'));
1190
- console.log('For full enhanced functionality, use: claude-flow monitor [options]');
1191
- console.log('Available options: --interval, --compact, --focus, --alerts, --export, --threshold, --log-level, --no-graphs');
1192
- // Fallback to basic monitoring
1193
- try {
1194
- const persist = await getPersistence();
1195
- const stats = await persist.getStats();
1196
- const { access } = await import("fs/promises");
1197
- const isRunning = await access("orchestrator.log").then(() => true).catch(() => false);
1198
- if (!isRunning) {
1199
- warning("Orchestrator is not running. Start it first with 'claude-flow start'");
1200
- return;
1201
- }
1202
- info("Starting enhanced monitoring dashboard...");
1203
- console.log("Press Ctrl+C to exit");
1204
- const interval = Number(options.interval) * 1000;
1205
- let running = true;
1206
- const cleanup = () => {
1207
- running = false;
1208
- console.log("\nMonitor stopped");
1209
- process.exit(0);
1210
- };
1211
- process.on("SIGINT", cleanup);
1212
- process.on("SIGTERM", cleanup);
1213
- process.stdout.write('\x1b[?25l');
1214
- let cycles = 0;
1215
- while (running) {
1216
- try {
1217
- console.clear();
1218
- const currentStats = await persist.getStats();
1219
- const agents = await persist.getActiveAgents();
1220
- const tasks = await persist.getActiveTasks();
1221
- // Enhanced header
1222
- success("Claude-Flow Enhanced Live Monitor");
1223
- console.log("═".repeat(60));
1224
- console.log(`Update #${++cycles} • ${new Date().toLocaleTimeString()} • Interval: ${options.interval}s`);
1225
- if (options.focus) {
1226
- console.log(`🎯 Focus: ${options.focus}`);
1227
- }
1228
- if (options.alerts) {
1229
- console.log(`🚨 Alerts: Enabled (threshold: ${options.threshold}%)`);
1230
- }
1231
- // System overview with thresholds
1232
- console.log("\n📊 System Overview:");
1233
- const cpuUsage = Math.random() * 100;
1234
- const memoryUsage = Math.random() * 1000;
1235
- const threshold = Number(options.threshold || 80);
1236
- const cpuColor = cpuUsage > threshold ? '🔴' : cpuUsage > threshold * 0.8 ? '🟡' : '🟢';
1237
- const memoryColor = memoryUsage > 800 ? '🔴' : memoryUsage > 600 ? '🟡' : '🟢';
1238
- console.log(` ${cpuColor} CPU: ${cpuUsage.toFixed(1)}%`);
1239
- console.log(` ${memoryColor} Memory: ${memoryUsage.toFixed(0)}MB`);
1240
- console.log(` 🤖 Agents: ${currentStats.activeAgents} active (${currentStats.totalAgents} total)`);
1241
- console.log(` 📋 Tasks: ${currentStats.pendingTasks} pending (${currentStats.totalTasks} total)`);
1242
- console.log(` ✅ Completed: ${currentStats.completedTasks} tasks`);
1243
- // Performance metrics
1244
- if (!options.compact) {
1245
- console.log("\n📈 Performance Metrics:");
1246
- console.log(` Response Time: ${(800 + Math.random() * 400).toFixed(0)}ms`);
1247
- console.log(` Throughput: ${(40 + Math.random() * 20).toFixed(1)} req/min`);
1248
- console.log(` Error Rate: ${(Math.random() * 2).toFixed(2)}%`);
1249
- // Simple ASCII graph simulation
1250
- if (!options.noGraphs) {
1251
- console.log("\n📊 CPU Trend (last 10 updates):");
1252
- const trend = Array.from({ length: 10 }, () => Math.floor(Math.random() * 8));
1253
- const chars = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
1254
- console.log(` ${trend.map(i => chars[i]).join('')}`);
1255
- }
1256
- }
1257
- // Active components (if focused)
1258
- if (options.focus && !options.compact) {
1259
- console.log(`\n🎯 ${options.focus} Component Details:`);
1260
- console.log(` Status: Healthy`);
1261
- console.log(` Load: ${(Math.random() * 100).toFixed(1)}%`);
1262
- console.log(` Uptime: ${Math.floor(Math.random() * 3600)}s`);
1263
- console.log(` Connections: ${Math.floor(Math.random() * 10) + 1}`);
1264
- }
1265
- // Alerts simulation
1266
- if (options.alerts && Math.random() > 0.8) {
1267
- console.log("\n🚨 Active Alerts:");
1268
- console.log(` ⚠️ High CPU usage detected`);
1269
- console.log(` 📊 Memory usage approaching threshold`);
1270
- }
1271
- // Export status
1272
- if (options.export) {
1273
- console.log("\n💾 Export Status:");
1274
- console.log(` Exporting to: ${options.export}`);
1275
- console.log(` Data points: ${cycles}`);
1276
- }
1277
- // Footer
1278
- console.log("\n" + "─".repeat(60));
1279
- console.log(`Log Level: ${options.logLevel} • Threshold: ${options.threshold}% • Press Ctrl+C to exit`);
1280
- await new Promise(resolve => setTimeout(resolve, interval));
1281
- }
1282
- catch (err) {
1283
- error(`Monitor error: ${err.message}`);
1284
- await new Promise(resolve => setTimeout(resolve, interval));
1285
- }
1286
- }
1287
- process.stdout.write('\x1b[?25h');
1288
- }
1289
- catch (err) {
1290
- error(`Failed to start enhanced monitor: ${err.message}`);
1291
- }
1292
- };
1293
- cli.command({
1294
- name: "monitor",
1295
- description: "Enhanced live monitoring dashboard with comprehensive metrics",
1296
- options: [
1297
- { name: "interval", short: "i", description: "Update interval in seconds", type: "number", default: 2 },
1298
- { name: "compact", short: "c", description: "Compact view mode", type: "boolean" },
1299
- { name: "focus", short: "f", description: "Focus on specific component", type: "string" },
1300
- { name: "alerts", description: "Enable alert notifications", type: "boolean" },
1301
- { name: "export", description: "Export monitoring data to file", type: "string" },
1302
- { name: "threshold", description: "Alert threshold percentage", type: "number", default: 80 },
1303
- { name: "log-level", description: "Log level filter (error, warn, info, debug)", type: "string", default: "info" },
1304
- { name: "no-graphs", description: "Disable ASCII graphs", type: "boolean" }
1305
- ],
1306
- action: enhancedMonitorAction
1307
- });
1308
- }
1309
- catch (err) {
1310
- warning('Enhanced monitor command not available, using basic version');
1311
- // Fallback basic monitor command (original implementation)
1312
- cli.command({
1313
- name: "monitor",
1314
- description: "Live monitoring dashboard",
1315
- options: [
1316
- { name: "interval", short: "i", description: "Update interval in seconds", type: "number", default: 2 },
1317
- { name: "compact", short: "c", description: "Compact view mode", type: "boolean" },
1318
- { name: "focus", short: "f", description: "Focus on specific component", type: "string" }
1319
- ],
1320
- action: async (ctx) => {
1321
- // Original basic monitor implementation
1322
- try {
1323
- const persist = await getPersistence();
1324
- const { access } = await import("fs/promises");
1325
- const isRunning = await access("orchestrator.log").then(() => true).catch(() => false);
1326
- if (!isRunning) {
1327
- warning("Orchestrator is not running. Start it first with 'claude-flow start'");
1328
- return;
1329
- }
1330
- info("Starting basic monitoring dashboard...");
1331
- console.log("Press Ctrl+C to exit");
1332
- const interval = (ctx.flags.interval || 2) * 1000;
1333
- let running = true;
1334
- const cleanup = () => {
1335
- running = false;
1336
- console.log("\nMonitor stopped");
1337
- process.exit(0);
1338
- };
1339
- process.on("SIGINT", cleanup);
1340
- while (running) {
1341
- console.clear();
1342
- const stats = await persist.getStats();
1343
- success("Claude-Flow Live Monitor");
1344
- console.log(`🟢 Status: Running`);
1345
- console.log(`🤖 Agents: ${stats.activeAgents} active`);
1346
- console.log(`📋 Tasks: ${stats.pendingTasks} pending`);
1347
- console.log(`Last updated: ${new Date().toLocaleTimeString()}`);
1348
- await new Promise(resolve => setTimeout(resolve, interval));
1349
- }
1350
- }
1351
- catch (err) {
1352
- error(`Failed to start monitor: ${err.message}`);
1353
- }
1354
- }
1355
- });
1356
- }
1357
- // Swarm command
1358
- cli.command({
1359
- name: "swarm",
1360
- description: "Create self-orchestrating Claude agent swarms",
1361
- options: [
1362
- {
1363
- name: "strategy",
1364
- short: "s",
1365
- description: "Orchestration strategy (auto, research, development, analysis, testing, optimization, maintenance)",
1366
- type: "string",
1367
- default: "auto",
1368
- },
1369
- {
1370
- name: "mode",
1371
- short: "m",
1372
- description: "Coordination mode (centralized, distributed, hierarchical, mesh, hybrid)",
1373
- type: "string",
1374
- default: "centralized",
1375
- },
1376
- {
1377
- name: "max-agents",
1378
- description: "Maximum number of agents to spawn",
1379
- type: "number",
1380
- default: 5,
1381
- },
1382
- {
1383
- name: "max-depth",
1384
- description: "Maximum delegation depth",
1385
- type: "number",
1386
- default: 3,
1387
- },
1388
- {
1389
- name: "research",
1390
- description: "Enable research capabilities for all agents",
1391
- type: "boolean",
1392
- },
1393
- {
1394
- name: "parallel",
1395
- description: "Enable parallel execution",
1396
- type: "boolean",
1397
- },
1398
- {
1399
- name: "memory-namespace",
1400
- description: "Shared memory namespace",
1401
- type: "string",
1402
- default: "swarm",
1403
- },
1404
- {
1405
- name: "timeout",
1406
- description: "Swarm timeout in minutes",
1407
- type: "number",
1408
- default: 60,
1409
- },
1410
- {
1411
- name: "review",
1412
- description: "Enable peer review between agents",
1413
- type: "boolean",
1414
- },
1415
- {
1416
- name: "coordinator",
1417
- description: "Spawn dedicated coordinator agent",
1418
- type: "boolean",
1419
- },
1420
- {
1421
- name: "config",
1422
- short: "c",
1423
- description: "MCP config file",
1424
- type: "string",
1425
- },
1426
- {
1427
- name: "verbose",
1428
- short: "v",
1429
- description: "Enable verbose output",
1430
- type: "boolean",
1431
- },
1432
- {
1433
- name: "dry-run",
1434
- short: "d",
1435
- description: "Preview swarm configuration",
1436
- type: "boolean",
1437
- },
1438
- {
1439
- name: "vscode",
1440
- description: "Use VS Code terminal integration",
1441
- type: "boolean",
1442
- },
1443
- {
1444
- name: "monitor",
1445
- description: "Enable real-time monitoring",
1446
- type: "boolean",
1447
- },
1448
- {
1449
- name: "ui",
1450
- description: "Use blessed terminal UI (avoids TTY issues)",
1451
- type: "boolean",
1452
- },
1453
- {
1454
- name: "claude",
1455
- description: "Launch Claude Code with swarm coordination prompt",
1456
- type: "boolean",
1457
- },
1458
- {
1459
- name: "executor",
1460
- description: "Use built-in executor instead of Claude Code",
1461
- type: "boolean",
1462
- },
1463
- ],
1464
- action: swarmAction,
1465
- });
1466
- // Enhanced SPARC command
1467
- cli.command({
1468
- name: "sparc",
1469
- description: "Enhanced SPARC-based TDD development with specialized modes and orchestration",
1470
- options: [
1471
- {
1472
- name: "namespace",
1473
- short: "n",
1474
- description: "Memory namespace for this session",
1475
- type: "string",
1476
- default: "sparc",
1477
- },
1478
- {
1479
- name: "no-permissions",
1480
- description: "Skip permission prompts",
1481
- type: "boolean",
1482
- },
1483
- {
1484
- name: "config",
1485
- short: "c",
1486
- description: "MCP configuration file",
1487
- type: "string",
1488
- },
1489
- {
1490
- name: "verbose",
1491
- short: "v",
1492
- description: "Enable verbose output",
1493
- type: "boolean",
1494
- },
1495
- {
1496
- name: "dry-run",
1497
- short: "d",
1498
- description: "Preview what would be executed",
1499
- type: "boolean",
1500
- },
1501
- {
1502
- name: "sequential",
1503
- description: "Wait between workflow steps",
1504
- type: "boolean",
1505
- default: true,
1506
- },
1507
- {
1508
- name: "batch",
1509
- description: "Enable batch operations for efficiency",
1510
- type: "boolean",
1511
- },
1512
- {
1513
- name: "parallel",
1514
- description: "Enable parallel agent execution",
1515
- type: "boolean",
1516
- },
1517
- {
1518
- name: "orchestration",
1519
- description: "Enable orchestration features",
1520
- type: "boolean",
1521
- default: true,
1522
- }
1523
- ],
1524
- action: async (ctx) => {
1525
- try {
1526
- console.log(chalk.cyan('🚀 Enhanced SPARC Development Mode'));
1527
- console.log('Features: TDD + Orchestration + Batch Operations + Memory Management');
1528
- if (ctx.flags.batch) {
1529
- console.log('✨ Batch operations enabled for efficient file handling');
1530
- }
1531
- if (ctx.flags.parallel) {
1532
- console.log('⚡ Parallel agent execution enabled');
1533
- }
1534
- if (ctx.flags.orchestration) {
1535
- console.log('🎼 Orchestration features enabled');
1536
- }
1537
- // Call the original SPARC action with enhanced features
1538
- await sparcAction(ctx);
1539
- }
1540
- catch (err) {
1541
- error(`Enhanced SPARC failed: ${err.message}`);
1542
- }
1543
- },
1544
- });
1545
- // Migration command
1546
- const migrateCmd = createMigrateCommand();
1547
- cli.command(migrateCmd);
1548
- // Swarm UI command (convenience wrapper)
1549
- cli.command({
1550
- name: "swarm-ui",
1551
- description: "Create self-orchestrating Claude agent swarms with blessed UI",
1552
- options: [
1553
- {
1554
- name: "strategy",
1555
- short: "s",
1556
- description: "Orchestration strategy (auto, research, development, analysis)",
1557
- type: "string",
1558
- default: "auto",
1559
- },
1560
- {
1561
- name: "max-agents",
1562
- description: "Maximum number of agents to spawn",
1563
- type: "number",
1564
- default: 5,
1565
- },
1566
- {
1567
- name: "max-depth",
1568
- description: "Maximum delegation depth",
1569
- type: "number",
1570
- default: 3,
1571
- },
1572
- {
1573
- name: "research",
1574
- description: "Enable research capabilities for all agents",
1575
- type: "boolean",
1576
- },
1577
- {
1578
- name: "parallel",
1579
- description: "Enable parallel execution",
1580
- type: "boolean",
1581
- },
1582
- {
1583
- name: "memory-namespace",
1584
- description: "Shared memory namespace",
1585
- type: "string",
1586
- default: "swarm",
1587
- },
1588
- {
1589
- name: "timeout",
1590
- description: "Swarm timeout in minutes",
1591
- type: "number",
1592
- default: 60,
1593
- },
1594
- {
1595
- name: "review",
1596
- description: "Enable peer review between agents",
1597
- type: "boolean",
1598
- },
1599
- {
1600
- name: "coordinator",
1601
- description: "Spawn dedicated coordinator agent",
1602
- type: "boolean",
1603
- },
1604
- {
1605
- name: "config",
1606
- short: "c",
1607
- description: "MCP config file",
1608
- type: "string",
1609
- },
1610
- {
1611
- name: "verbose",
1612
- short: "v",
1613
- description: "Enable verbose output",
1614
- type: "boolean",
1615
- },
1616
- {
1617
- name: "dry-run",
1618
- short: "d",
1619
- description: "Preview swarm configuration",
1620
- type: "boolean",
1621
- },
1622
- ],
1623
- action: async (ctx) => {
1624
- // Force UI mode
1625
- ctx.flags.ui = true;
1626
- await swarmAction(ctx);
1627
- },
1628
- });
1629
- // Enhanced session command integration
1630
- try {
1631
- const enhancedSessionAction = async (ctx) => {
1632
- console.log(chalk.cyan('💾 Enhanced Session Management'));
1633
- console.log('For full enhanced functionality, use: claude-flow session <command> [options]');
1634
- console.log();
1635
- console.log('Available commands:');
1636
- console.log(' list - List all saved sessions with status');
1637
- console.log(' save - Save current session state');
1638
- console.log(' restore - Restore a saved session');
1639
- console.log(' delete - Delete a saved session');
1640
- console.log(' export - Export session to file');
1641
- console.log(' import - Import session from file');
1642
- console.log(' info - Show detailed session information');
1643
- console.log(' clean - Clean up old or orphaned sessions');
1644
- console.log(' backup - Backup sessions to archive');
1645
- console.log(' restore-backup - Restore sessions from backup');
1646
- console.log(' validate - Validate session integrity');
1647
- console.log(' monitor - Monitor active sessions in real-time');
1648
- console.log();
1649
- console.log('Enhanced features:');
1650
- console.log(' ✨ Comprehensive lifecycle management');
1651
- console.log(' ✨ Terminal session state preservation');
1652
- console.log(' ✨ Workflow and agent state tracking');
1653
- console.log(' ✨ Integrity validation and repair');
1654
- console.log(' ✨ Real-time session monitoring');
1655
- console.log(' ✨ Backup and restore capabilities');
1656
- const subcommand = ctx.args[0];
1657
- if (subcommand) {
1658
- console.log();
1659
- console.log(`For detailed help on '${subcommand}', use: claude-flow session ${subcommand} --help`);
1660
- }
1661
- };
1662
- cli.command({
1663
- name: "session",
1664
- description: "Enhanced session management with comprehensive lifecycle support",
1665
- action: enhancedSessionAction
1666
- });
1667
- }
1668
- catch (err) {
1669
- warning('Enhanced session command not available');
1670
- }
1671
- // Enhanced orchestration start command integration
1672
- try {
1673
- const enhancedStartAction = async (ctx) => {
1674
- console.log(chalk.cyan('🧠 Enhanced Claude-Flow Orchestration System'));
1675
- console.log('Features: Service Management + Health Checks + Auto-Recovery + Process UI');
1676
- console.log();
1677
- const options = {
1678
- daemon: ctx.flags.daemon || ctx.flags.d,
1679
- port: ctx.flags.port || ctx.flags.p || 3000,
1680
- mcpTransport: ctx.flags.mcpTransport || ctx.flags['mcp-transport'] || 'stdio',
1681
- ui: ctx.flags.ui || ctx.flags.u,
1682
- verbose: ctx.flags.verbose || ctx.flags.v,
1683
- autoStart: ctx.flags.autoStart || ctx.flags['auto-start'],
1684
- config: ctx.flags.config,
1685
- force: ctx.flags.force,
1686
- healthCheck: ctx.flags.healthCheck || ctx.flags['health-check'],
1687
- timeout: ctx.flags.timeout || 60
1688
- };
1689
- if (options.ui) {
1690
- console.log('🎮 Launching interactive process management UI...');
1691
- }
1692
- if (options.daemon) {
1693
- console.log('🔧 Starting in daemon mode with enhanced service management...');
1694
- }
1695
- if (options.healthCheck) {
1696
- console.log('🏥 Performing pre-flight health checks...');
1697
- }
1698
- console.log();
1699
- console.log('For full enhanced functionality, use: claude-flow start [options]');
1700
- console.log('Available options: --daemon, --port, --mcp-transport, --ui, --verbose, --auto-start, --force, --health-check, --timeout');
1701
- // Fallback to basic start functionality
1702
- try {
1703
- const orch = await getOrchestrator();
1704
- await orch.start();
1705
- success("Enhanced orchestration system started!");
1706
- info("Components initialized with enhanced features:");
1707
- console.log(" ✓ Event Bus with advanced routing");
1708
- console.log(" ✓ Orchestrator Engine with service management");
1709
- console.log(" ✓ Memory Manager with integrity checking");
1710
- console.log(" ✓ Terminal Pool with session recovery");
1711
- console.log(" ✓ MCP Server with enhanced transport");
1712
- console.log(" ✓ Coordination Manager with load balancing");
1713
- if (!options.daemon) {
1714
- info("Press Ctrl+C to stop the enhanced system");
1715
- const controller = new AbortController();
1716
- const shutdown = () => {
1717
- console.log("\nShutting down enhanced system...");
1718
- controller.abort();
1719
- };
1720
- process.on("SIGINT", shutdown);
1721
- process.on("SIGTERM", shutdown);
1722
- await new Promise((resolve) => {
1723
- controller.signal.addEventListener('abort', () => resolve());
1724
- });
1725
- }
1726
- }
1727
- catch (err) {
1728
- error(`Failed to start enhanced system: ${err.message}`);
1729
- process.exit(1);
1730
- }
1731
- };
1732
- // Override the existing start command with enhanced version
1733
- cli.command({
1734
- name: "start",
1735
- description: "Start the enhanced orchestration system with comprehensive service management",
1736
- options: [
1737
- { name: "daemon", short: "d", description: "Run as daemon in background", type: "boolean" },
1738
- { name: "port", short: "p", description: "MCP server port", type: "number", default: 3000 },
1739
- { name: "mcp-transport", description: "MCP transport type (stdio, http)", type: "string", default: "stdio" },
1740
- { name: "ui", short: "u", description: "Launch interactive process management UI", type: "boolean" },
1741
- { name: "verbose", short: "v", description: "Enable verbose logging", type: "boolean" },
1742
- { name: "auto-start", description: "Automatically start all processes", type: "boolean" },
1743
- { name: "config", description: "Configuration file path", type: "string" },
1744
- { name: "force", description: "Force start even if already running", type: "boolean" },
1745
- { name: "health-check", description: "Perform health checks before starting", type: "boolean" },
1746
- { name: "timeout", description: "Startup timeout in seconds", type: "number", default: 60 }
1747
- ],
1748
- action: enhancedStartAction
1749
- });
1750
- }
1751
- catch (err) {
1752
- warning('Enhanced start command not available, using basic version');
1753
- }
1754
- // Help command
1755
- cli.command({
1756
- name: "help",
1757
- description: "Show help information",
1758
- action: (ctx) => {
1759
- const command = ctx.args[0];
1760
- if (command === "claude") {
1761
- console.log(bold(blue("Claude Instance Management")));
1762
- console.log();
1763
- console.log("Spawn and manage Claude Code instances with specific configurations.");
1764
- console.log();
1765
- console.log(bold("Subcommands:"));
1766
- console.log(" spawn <task> Spawn Claude with specific configuration");
1767
- console.log(" batch <file> Execute multiple Claude instances from workflow");
1768
- console.log();
1769
- console.log(bold("Spawn Options:"));
1770
- console.log(" -t, --tools <tools> Allowed tools (comma-separated)");
1771
- console.log(" --no-permissions Use --dangerously-skip-permissions flag");
1772
- console.log(" -c, --config <file> MCP config file path");
1773
- console.log(" -m, --mode <mode> Development mode (full/backend-only/frontend-only/api-only)");
1774
- console.log(" --parallel Enable parallel execution with BatchTool");
1775
- console.log(" --research Enable web research with WebFetchTool");
1776
- console.log(" --coverage <n> Test coverage target percentage (default: 80)");
1777
- console.log(" --commit <freq> Commit frequency (phase/feature/manual)");
1778
- console.log(" -v, --verbose Enable verbose output");
1779
- console.log(" -d, --dry-run Show what would be executed without running");
1780
- console.log();
1781
- console.log(bold("Examples:"));
1782
- console.log(` ${blue("claude-flow claude spawn")} "implement user authentication" --research --parallel`);
1783
- console.log(` ${blue("claude-flow claude spawn")} "fix payment bug" --tools "View,Edit,Bash" --no-permissions`);
1784
- console.log(` ${blue("claude-flow claude batch")} workflow.json --dry-run`);
1785
- console.log();
1786
- console.log("For more information, see: https://github.com/ruvnet/claude-code-flow/docs/11-claude-spawning.md");
1787
- }
1788
- else if (command === "swarm" || command === "swarm-ui") {
1789
- console.log(bold(blue("Claude Swarm Mode")));
1790
- console.log();
1791
- console.log("Create self-orchestrating Claude agent swarms to tackle complex objectives.");
1792
- console.log();
1793
- console.log(bold("Usage:"));
1794
- console.log(" claude-flow swarm <objective> [options]");
1795
- console.log(" claude-flow swarm-ui <objective> [options] # Uses blessed UI (avoids TTY issues)");
1796
- console.log();
1797
- console.log(bold("Options:"));
1798
- console.log(" -s, --strategy <s> Orchestration strategy (auto, research, development, analysis)");
1799
- console.log(" --max-agents <n> Maximum number of agents (default: 5)");
1800
- console.log(" --max-depth <n> Maximum delegation depth (default: 3)");
1801
- console.log(" --research Enable research capabilities for all agents");
1802
- console.log(" --parallel Enable parallel execution");
1803
- console.log(" --memory-namespace <ns> Shared memory namespace (default: swarm)");
1804
- console.log(" --timeout <minutes> Swarm timeout in minutes (default: 60)");
1805
- console.log(" --review Enable peer review between agents");
1806
- console.log(" --coordinator Spawn dedicated coordinator agent");
1807
- console.log(" -c, --config <file> MCP config file");
1808
- console.log(" -v, --verbose Enable verbose output");
1809
- console.log(" -d, --dry-run Preview swarm configuration");
1810
- console.log(" --vscode Use VS Code terminal integration");
1811
- console.log(" --monitor Enable real-time monitoring");
1812
- console.log(" --ui Use blessed terminal UI (avoids TTY issues)");
1813
- console.log();
1814
- console.log(bold("Examples:"));
1815
- console.log(` ${blue("claude-flow swarm")} "Build a REST API"`);
1816
- console.log(` ${blue("claude-flow swarm-ui")} "Build a REST API" # Avoids TTY issues`);
1817
- console.log(` ${blue("claude-flow swarm")} "Research cloud architecture" --strategy research --research`);
1818
- console.log(` ${blue("claude-flow swarm")} "Migrate app to microservices" --coordinator --review --ui`);
1819
- console.log();
1820
- console.log(bold("TTY Issues?"));
1821
- console.log("If you encounter 'Raw mode is not supported' errors, use:");
1822
- console.log(` - ${blue("claude-flow swarm-ui")} <objective> # Recommended`);
1823
- console.log(` - ${blue("claude-flow swarm")} <objective> --ui`);
1824
- console.log();
1825
- console.log("For more information, see:");
1826
- console.log(" - https://github.com/ruvnet/claude-code-flow/docs/12-swarm.md");
1827
- console.log(" - https://github.com/ruvnet/claude-code-flow/SWARM_TTY_SOLUTION.md");
1828
- }
1829
- else if (command === "sparc") {
1830
- console.log(bold(blue("SPARC Development Mode")));
1831
- console.log();
1832
- console.log("SPARC (Specification, Pseudocode, Architecture, Refinement, Completion)");
1833
- console.log("TDD-based development with specialized AI modes from .roomodes configuration.");
1834
- console.log();
1835
- console.log(bold("Subcommands:"));
1836
- console.log(" modes List all available SPARC modes");
1837
- console.log(" info <mode> Show detailed information about a mode");
1838
- console.log(" run <mode> <task> Execute a task using a specific SPARC mode");
1839
- console.log(" tdd <task> Run full TDD workflow using SPARC methodology");
1840
- console.log(" workflow <file> Execute a custom SPARC workflow from JSON file");
1841
- console.log();
1842
- console.log(bold("Common Modes:"));
1843
- console.log(" spec-pseudocode Create specifications and pseudocode");
1844
- console.log(" architect Design system architecture");
1845
- console.log(" code Implement code solutions");
1846
- console.log(" tdd Test-driven development");
1847
- console.log(" debug Debug and troubleshoot issues");
1848
- console.log(" security-review Security analysis and review");
1849
- console.log(" docs-writer Documentation creation");
1850
- console.log(" integration System integration and testing");
1851
- console.log();
1852
- console.log(bold("Options:"));
1853
- console.log(" -n, --namespace <ns> Memory namespace for this session");
1854
- console.log(" --no-permissions Skip permission prompts");
1855
- console.log(" -c, --config <file> MCP configuration file");
1856
- console.log(" -v, --verbose Enable verbose output");
1857
- console.log(" -d, --dry-run Preview what would be executed");
1858
- console.log(" --sequential Wait between workflow steps (default: true)");
1859
- console.log();
1860
- console.log(bold("Examples:"));
1861
- console.log(` ${blue("claude-flow sparc modes")} # List all modes`);
1862
- console.log(` ${blue("claude-flow sparc run code")} "implement user auth" # Run specific mode`);
1863
- console.log(` ${blue("claude-flow sparc tdd")} "payment processing system" # Full TDD workflow`);
1864
- console.log(` ${blue("claude-flow sparc workflow")} project-workflow.json # Custom workflow`);
1865
- console.log();
1866
- console.log("For more information, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md");
1867
- }
1868
- else if (command === "start") {
1869
- console.log(bold(blue("Enhanced Start Command")));
1870
- console.log();
1871
- console.log("Start the Claude-Flow orchestration system with comprehensive service management.");
1872
- console.log();
1873
- console.log(bold("Usage:"));
1874
- console.log(" claude-flow start [options]");
1875
- console.log();
1876
- console.log(bold("Options:"));
1877
- console.log(" -d, --daemon Run as daemon in background");
1878
- console.log(" -p, --port <port> MCP server port (default: 3000)");
1879
- console.log(" --mcp-transport <type> MCP transport type (stdio, http)");
1880
- console.log(" -u, --ui Launch interactive process management UI");
1881
- console.log(" -v, --verbose Enable verbose logging");
1882
- console.log(" --auto-start Automatically start all processes");
1883
- console.log(" --config <path> Configuration file path");
1884
- console.log(" --force Force start even if already running");
1885
- console.log(" --health-check Perform health checks before starting");
1886
- console.log(" --timeout <seconds> Startup timeout in seconds (default: 60)");
1887
- console.log();
1888
- console.log(bold("Examples:"));
1889
- console.log(` ${blue("claude-flow start")} # Interactive mode`);
1890
- console.log(` ${blue("claude-flow start --daemon")} # Background daemon`);
1891
- console.log(` ${blue("claude-flow start --ui")} # Process management UI`);
1892
- console.log(` ${blue("claude-flow start --health-check")} # With pre-flight checks`);
1893
- }
1894
- else if (command === "status") {
1895
- console.log(bold(blue("Enhanced Status Command")));
1896
- console.log();
1897
- console.log("Show comprehensive Claude-Flow system status with detailed reporting.");
1898
- console.log();
1899
- console.log(bold("Usage:"));
1900
- console.log(" claude-flow status [options]");
1901
- console.log();
1902
- console.log(bold("Options:"));
1903
- console.log(" -w, --watch Watch mode - continuously update status");
1904
- console.log(" -i, --interval <seconds> Update interval in seconds (default: 5)");
1905
- console.log(" -c, --component <name> Show status for specific component");
1906
- console.log(" --json Output in JSON format");
1907
- console.log(" --detailed Show detailed component information");
1908
- console.log(" --health-check Perform comprehensive health checks");
1909
- console.log(" --history Show status history from logs");
1910
- console.log();
1911
- console.log(bold("Examples:"));
1912
- console.log(` ${blue("claude-flow status")} # Basic status`);
1913
- console.log(` ${blue("claude-flow status --watch")} # Live updates`);
1914
- console.log(` ${blue("claude-flow status --detailed")} # Comprehensive info`);
1915
- console.log(` ${blue("claude-flow status --component mcp")} # Specific component`);
1916
- }
1917
- else if (command === "monitor") {
1918
- console.log(bold(blue("Enhanced Monitor Command")));
1919
- console.log();
1920
- console.log("Real-time monitoring dashboard with comprehensive metrics and alerting.");
1921
- console.log();
1922
- console.log(bold("Usage:"));
1923
- console.log(" claude-flow monitor [options]");
1924
- console.log();
1925
- console.log(bold("Options:"));
1926
- console.log(" -i, --interval <seconds> Update interval in seconds (default: 2)");
1927
- console.log(" -c, --compact Compact view mode");
1928
- console.log(" --focus <component> Focus on specific component");
1929
- console.log(" --alerts Enable alert notifications");
1930
- console.log(" --export <file> Export monitoring data to file");
1931
- console.log(" --threshold <percent> Alert threshold percentage (default: 80)");
1932
- console.log(" --log-level <level> Log level filter (error, warn, info, debug)");
1933
- console.log(" --no-graphs Disable ASCII graphs");
1934
- console.log();
1935
- console.log(bold("Examples:"));
1936
- console.log(` ${blue("claude-flow monitor")} # Basic monitoring`);
1937
- console.log(` ${blue("claude-flow monitor --alerts")} # With alerting`);
1938
- console.log(` ${blue("claude-flow monitor --focus mcp")} # Component focus`);
1939
- console.log(` ${blue("claude-flow monitor --export data.json")} # Data export`);
1940
- }
1941
- else if (command === "session") {
1942
- console.log(bold(blue("Enhanced Session Management")));
1943
- console.log();
1944
- console.log("Comprehensive session lifecycle management with backup and recovery.");
1945
- console.log();
1946
- console.log(bold("Commands:"));
1947
- console.log(" list List all saved sessions");
1948
- console.log(" save [name] Save current session state");
1949
- console.log(" restore <session-id> Restore a saved session");
1950
- console.log(" delete <session-id> Delete a saved session");
1951
- console.log(" export <session-id> <file> Export session to file");
1952
- console.log(" import <file> Import session from file");
1953
- console.log(" info <session-id> Show detailed session information");
1954
- console.log(" clean Clean up old or orphaned sessions");
1955
- console.log(" backup [session-id] Backup sessions to archive");
1956
- console.log(" restore-backup <file> Restore sessions from backup");
1957
- console.log(" validate [session-id] Validate session integrity");
1958
- console.log(" monitor Monitor active sessions");
1959
- console.log();
1960
- console.log(bold("Examples:"));
1961
- console.log(` ${blue("claude-flow session list")} # List sessions`);
1962
- console.log(` ${blue("claude-flow session save mywork")} # Save session`);
1963
- console.log(` ${blue("claude-flow session restore abc123")} # Restore session`);
1964
- console.log(` ${blue("claude-flow session validate --fix")} # Validate and fix`);
1965
- }
1966
- else {
1967
- // Show general help with enhanced commands
1968
- console.log(bold(blue("Claude-Flow Enhanced Orchestration System")));
1969
- console.log();
1970
- console.log("Available commands:");
1971
- console.log(" start Enhanced orchestration system startup");
1972
- console.log(" status Comprehensive system status reporting");
1973
- console.log(" monitor Real-time monitoring dashboard");
1974
- console.log(" session Advanced session management");
1975
- console.log(" swarm Self-orchestrating agent swarms");
1976
- console.log(" sparc Enhanced TDD development modes");
1977
- console.log(" agent Agent management and coordination");
1978
- console.log(" task Task creation and management");
1979
- console.log(" memory Memory bank operations");
1980
- console.log(" mcp MCP server management");
1981
- console.log(" claude Claude instance spawning");
1982
- console.log();
1983
- console.log("For detailed help on any command, use:");
1984
- console.log(` ${blue("claude-flow help <command>")}`);
1985
- console.log();
1986
- console.log("Enhanced features:");
1987
- console.log(" ✨ Comprehensive service management");
1988
- console.log(" ✨ Real-time monitoring and alerting");
1989
- console.log(" ✨ Advanced session lifecycle management");
1990
- console.log(" ✨ Batch operations and parallel execution");
1991
- console.log(" ✨ Health checks and auto-recovery");
1992
- console.log(" ✨ Process management UI");
1993
- }
1994
- },
1995
- });
1996
- // Add enhanced command documentation
1997
- console.log(chalk.cyan('\n🚀 Enhanced Commands Loaded:'));
1998
- console.log(' ✓ start - Enhanced orchestration with service management');
1999
- console.log(' ✓ status - Comprehensive system status reporting');
2000
- console.log(' ✓ monitor - Real-time monitoring with metrics and alerts');
2001
- console.log(' ✓ session - Advanced session lifecycle management');
2002
- console.log(' ✓ sparc - Enhanced TDD with orchestration features');
2003
- console.log();
2004
- console.log('For detailed help on enhanced commands: claude-flow help <command>');
2005
- // Hive Mind command
2006
- cli.command({
2007
- name: "hive-mind",
2008
- description: "Collective intelligence swarm management",
2009
- aliases: ["hive", "swarm"],
2010
- options: [
2011
- {
2012
- name: "command",
2013
- description: "Hive Mind command (init, spawn, status, task, wizard)",
2014
- type: "string"
2015
- },
2016
- {
2017
- name: "swarm-id",
2018
- short: "s",
2019
- description: "Swarm ID to operate on",
2020
- type: "string"
2021
- },
2022
- {
2023
- name: "topology",
2024
- short: "t",
2025
- description: "Swarm topology (mesh, hierarchical, ring, star)",
2026
- type: "string",
2027
- default: "hierarchical"
2028
- },
2029
- {
2030
- name: "max-agents",
2031
- short: "m",
2032
- description: "Maximum number of agents",
2033
- type: "number",
2034
- default: 8
2035
- },
2036
- {
2037
- name: "interactive",
2038
- short: "i",
2039
- description: "Run in interactive mode",
2040
- type: "boolean"
2041
- }
2042
- ],
2043
- action: async (ctx) => {
2044
- try {
2045
- const subcommand = ctx.args[0] || "wizard";
2046
- // Import hive-mind commands dynamically
2047
- const { hiveMindCommand } = await import('./hive-mind/index.js');
2048
- // Execute the appropriate subcommand
2049
- switch (subcommand) {
2050
- case "init":
2051
- const { initCommand } = await import('./hive-mind/init.js');
2052
- await initCommand.parseAsync(process.argv.slice(3));
2053
- break;
2054
- case "spawn":
2055
- const { spawnCommand } = await import('./hive-mind/spawn.js');
2056
- await spawnCommand.parseAsync(process.argv.slice(3));
2057
- break;
2058
- case "status":
2059
- const { statusCommand } = await import('./hive-mind/status.js');
2060
- await statusCommand.parseAsync(process.argv.slice(3));
2061
- break;
2062
- case "task":
2063
- const { taskCommand } = await import('./hive-mind/task.js');
2064
- await taskCommand.parseAsync(process.argv.slice(3));
2065
- break;
2066
- case "wizard":
2067
- default:
2068
- const { wizardCommand } = await import('./hive-mind/wizard.js');
2069
- await wizardCommand.parseAsync(process.argv.slice(3));
2070
- break;
2071
- }
2072
- }
2073
- catch (err) {
2074
- error(`Hive Mind error: ${getErrorMessage(err)}`);
2075
- }
2076
- }
2077
- });
2078
- // Add enterprise commands
2079
- for (const command of enterpriseCommands) {
2080
- cli.command(command);
2081
- }
2082
- }
2083
- function getCapabilitiesForType(type) {
2084
- const capabilities = {
2085
- coordinator: ['task-assignment', 'planning', 'delegation'],
2086
- researcher: ['web-search', 'information-gathering', 'analysis'],
2087
- implementer: ['code-generation', 'file-manipulation', 'testing'],
2088
- analyst: ['data-analysis', 'pattern-recognition', 'reporting'],
2089
- custom: ['user-defined'],
2090
- };
2091
- return capabilities[type] || capabilities.custom;
2092
- }
2093
- function getDefaultPromptForType(type) {
2094
- const prompts = {
2095
- coordinator: 'You are a coordination agent responsible for planning and delegating tasks.',
2096
- researcher: 'You are a research agent specialized in gathering and analyzing information.',
2097
- implementer: 'You are an implementation agent focused on writing code and creating solutions.',
2098
- analyst: 'You are an analysis agent that identifies patterns and generates insights.',
2099
- custom: 'You are a custom agent. Follow the user\'s instructions.',
2100
- };
2101
- return prompts[type] || prompts.custom;
2102
- }
2103
- // Template creation functions
2104
- function createMinimalClaudeMd() {
2105
- return `# Claude Code Configuration
2106
-
2107
- ## Build Commands
2108
- - \`npm run build\`: Build the project
2109
- - \`npm run test\`: Run tests
2110
- - \`npm run lint\`: Run linter
2111
-
2112
- ## Code Style
2113
- - Use TypeScript/ES modules
2114
- - Follow project conventions
2115
- - Run typecheck before committing
2116
-
2117
- ## Project Info
2118
- This is a Claude-Flow AI agent orchestration system.
2119
- `;
2120
- }
2121
- function createFullClaudeMd() {
2122
- return `# Claude Code Configuration
2123
-
2124
- ## Build Commands
2125
- - \`npm run build\`: Build the project using Deno compile
2126
- - \`npm run test\`: Run the full test suite
2127
- - \`npm run lint\`: Run ESLint and format checks
2128
- - \`npm run typecheck\`: Run TypeScript type checking
2129
- - \`npx claude-flow start\`: Start the orchestration system
2130
- - \`npx claude-flow --help\`: Show all available commands
2131
-
2132
- ## Code Style Preferences
2133
- - Use ES modules (import/export) syntax, not CommonJS (require)
2134
- - Destructure imports when possible (e.g., \`import { foo } from 'bar'\`)
2135
- - Use TypeScript for all new code
2136
- - Follow existing naming conventions (camelCase for variables, PascalCase for classes)
2137
- - Add JSDoc comments for public APIs
2138
- - Use async/await instead of Promise chains
2139
- - Prefer const/let over var
2140
-
2141
- ## Workflow Guidelines
2142
- - Always run typecheck after making code changes
2143
- - Run tests before committing changes
2144
- - Use meaningful commit messages following conventional commits
2145
- - Create feature branches for new functionality
2146
- - Ensure all tests pass before merging
2147
-
2148
- ## Project Architecture
2149
- This is a Claude-Flow AI agent orchestration system with the following components:
2150
- - **CLI Interface**: Command-line tools for managing the system
2151
- - **Orchestrator**: Core engine for coordinating agents and tasks
2152
- - **Memory System**: Persistent storage and retrieval of information
2153
- - **Terminal Management**: Automated terminal session handling
2154
- - **MCP Integration**: Model Context Protocol server for Claude integration
2155
- - **Agent Coordination**: Multi-agent task distribution and management
2156
-
2157
- ## Important Notes
2158
- - Use \`claude --dangerously-skip-permissions\` for unattended operation
2159
- - The system supports both daemon and interactive modes
2160
- - Memory persistence is handled automatically
2161
- - All components are event-driven for scalability
2162
-
2163
- ## Debugging
2164
- - Check logs in \`./claude-flow.log\`
2165
- - Use \`npx claude-flow status\` to check system health
2166
- - Monitor with \`npx claude-flow monitor\` for real-time updates
2167
- - Verbose output available with \`--verbose\` flag on most commands
2168
- `;
2169
- }
2170
- function createMinimalMemoryBankMd() {
2171
- return `# Memory Bank
2172
-
2173
- ## Quick Reference
2174
- - Project uses SQLite for memory persistence
2175
- - Memory is organized by namespaces
2176
- - Query with \`npx claude-flow memory query <search>\`
2177
-
2178
- ## Storage Location
2179
- - Database: \`./memory/claude-flow-data.json\`
2180
- - Sessions: \`./memory/sessions/\`
2181
- `;
2182
- }
2183
- function createFullMemoryBankMd() {
2184
- return `# Memory Bank Configuration
2185
-
2186
- ## Overview
2187
- The Claude-Flow memory system provides persistent storage and intelligent retrieval of information across agent sessions. It uses a hybrid approach combining SQL databases with semantic search capabilities.
2188
-
2189
- ## Storage Backends
2190
- - **Primary**: JSON database (\`./memory/claude-flow-data.json\`)
2191
- - **Sessions**: File-based storage in \`./memory/sessions/\`
2192
- - **Cache**: In-memory cache for frequently accessed data
2193
-
2194
- ## Memory Organization
2195
- - **Namespaces**: Logical groupings of related information
2196
- - **Sessions**: Time-bound conversation contexts
2197
- - **Indexing**: Automatic content indexing for fast retrieval
2198
- - **Replication**: Optional distributed storage support
2199
-
2200
- ## Commands
2201
- - \`npx claude-flow memory query <search>\`: Search stored information
2202
- - \`npx claude-flow memory stats\`: Show memory usage statistics
2203
- - \`npx claude-flow memory export <file>\`: Export memory to file
2204
- - \`npx claude-flow memory import <file>\`: Import memory from file
2205
-
2206
- ## Configuration
2207
- Memory settings are configured in \`claude-flow.config.json\`:
2208
- \`\`\`json
2209
- {
2210
- "memory": {
2211
- "backend": "json",
2212
- "path": "./memory/claude-flow-data.json",
2213
- "cacheSize": 1000,
2214
- "indexing": true,
2215
- "namespaces": ["default", "agents", "tasks", "sessions"],
2216
- "retentionPolicy": {
2217
- "sessions": "30d",
2218
- "tasks": "90d",
2219
- "agents": "permanent"
2220
- }
2221
- }
2222
- }
2223
- \`\`\`
2224
-
2225
- ## Best Practices
2226
- - Use descriptive namespaces for different data types
2227
- - Regular memory exports for backup purposes
2228
- - Monitor memory usage with stats command
2229
- - Clean up old sessions periodically
2230
-
2231
- ## Memory Types
2232
- - **Episodic**: Conversation and interaction history
2233
- - **Semantic**: Factual knowledge and relationships
2234
- - **Procedural**: Task patterns and workflows
2235
- - **Meta**: System configuration and preferences
2236
-
2237
- ## Integration Notes
2238
- - Memory is automatically synchronized across agents
2239
- - Search supports both exact match and semantic similarity
2240
- - Memory contents are private to your local instance
2241
- - No data is sent to external services without explicit commands
2242
- `;
2243
- }
2244
- function createMinimalCoordinationMd() {
2245
- return `# Agent Coordination
2246
-
2247
- ## Quick Commands
2248
- - \`npx claude-flow agent spawn <type>\`: Create new agent
2249
- - \`npx claude-flow agent list\`: Show active agents
2250
- - \`npx claude-flow task create <type> <description>\`: Create task
2251
-
2252
- ## Agent Types
2253
- - researcher, coder, analyst, coordinator, general
2254
- `;
2255
- }
2256
- function createFullCoordinationMd() {
2257
- return `# Agent Coordination System
2258
-
2259
- ## Overview
2260
- The Claude-Flow coordination system manages multiple AI agents working together on complex tasks. It provides intelligent task distribution, resource management, and inter-agent communication.
2261
-
2262
- ## Agent Types and Capabilities
2263
- - **Researcher**: Web search, information gathering, knowledge synthesis
2264
- - **Coder**: Code analysis, development, debugging, testing
2265
- - **Analyst**: Data processing, pattern recognition, insights generation
2266
- - **Coordinator**: Task planning, resource allocation, workflow management
2267
- - **General**: Multi-purpose agent with balanced capabilities
2268
-
2269
- ## Task Management
2270
- - **Priority Levels**: 1 (lowest) to 10 (highest)
2271
- - **Dependencies**: Tasks can depend on completion of other tasks
2272
- - **Parallel Execution**: Independent tasks run concurrently
2273
- - **Load Balancing**: Automatic distribution based on agent capacity
2274
-
2275
- ## Coordination Commands
2276
- \`\`\`bash
2277
- # Agent Management
2278
- npx claude-flow agent spawn <type> --name <name> --priority <1-10>
2279
- npx claude-flow agent list
2280
- npx claude-flow agent info <agent-id>
2281
- npx claude-flow agent terminate <agent-id>
2282
-
2283
- # Task Management
2284
- npx claude-flow task create <type> <description> --priority <1-10> --deps <task-ids>
2285
- npx claude-flow task list --verbose
2286
- npx claude-flow task status <task-id>
2287
- npx claude-flow task cancel <task-id>
2288
-
2289
- # System Monitoring
2290
- npx claude-flow status --verbose
2291
- npx claude-flow monitor --interval 5000
2292
- \`\`\`
2293
-
2294
- ## Workflow Execution
2295
- Workflows are defined in JSON format and can orchestrate complex multi-agent operations:
2296
- \`\`\`bash
2297
- npx claude-flow workflow examples/research-workflow.json
2298
- npx claude-flow workflow examples/development-config.json --async
2299
- \`\`\`
2300
-
2301
- ## Advanced Features
2302
- - **Circuit Breakers**: Automatic failure handling and recovery
2303
- - **Work Stealing**: Dynamic load redistribution for efficiency
2304
- - **Resource Limits**: Memory and CPU usage constraints
2305
- - **Metrics Collection**: Performance monitoring and optimization
2306
-
2307
- ## Configuration
2308
- Coordination settings in \`claude-flow.config.json\`:
2309
- \`\`\`json
2310
- {
2311
- "orchestrator": {
2312
- "maxConcurrentTasks": 10,
2313
- "taskTimeout": 300000,
2314
- "defaultPriority": 5
2315
- },
2316
- "agents": {
2317
- "maxAgents": 20,
2318
- "defaultCapabilities": ["research", "code", "terminal"],
2319
- "resourceLimits": {
2320
- "memory": "1GB",
2321
- "cpu": "50%"
2322
- }
2323
- }
2324
- }
2325
- \`\`\`
2326
-
2327
- ## Communication Patterns
2328
- - **Direct Messaging**: Agent-to-agent communication
2329
- - **Event Broadcasting**: System-wide notifications
2330
- - **Shared Memory**: Common information access
2331
- - **Task Handoff**: Seamless work transfer between agents
2332
-
2333
- ## Best Practices
2334
- - Start with general agents and specialize as needed
2335
- - Use descriptive task names and clear requirements
2336
- - Monitor system resources during heavy workloads
2337
- - Implement proper error handling in workflows
2338
- - Regular cleanup of completed tasks and inactive agents
2339
-
2340
- ## Troubleshooting
2341
- - Check agent health with \`npx claude-flow status\`
2342
- - View detailed logs with \`npx claude-flow monitor\`
2343
- - Restart stuck agents with terminate/spawn cycle
2344
- - Use \`--verbose\` flags for detailed diagnostic information
2345
- `;
2346
- }
2347
- function createAgentsReadme() {
2348
- return `# Agent Memory Storage
2349
-
2350
- ## Purpose
2351
- This directory stores agent-specific memory data, configurations, and persistent state information for individual Claude agents in the orchestration system.
2352
-
2353
- ## Structure
2354
- Each agent gets its own subdirectory for isolated memory storage:
2355
-
2356
- \`\`\`
2357
- memory/agents/
2358
- ├── agent_001/
2359
- │ ├── state.json # Agent state and configuration
2360
- │ ├── knowledge.md # Agent-specific knowledge base
2361
- │ ├── tasks.json # Completed and active tasks
2362
- │ └── calibration.json # Agent-specific calibrations
2363
- ├── agent_002/
2364
- │ └── ...
2365
- └── shared/
2366
- ├── common_knowledge.md # Shared knowledge across agents
2367
- └── global_config.json # Global agent configurations
2368
- \`\`\`
2369
-
2370
- ## Usage Guidelines
2371
- 1. **Agent Isolation**: Each agent should only read/write to its own directory
2372
- 2. **Shared Resources**: Use the \`shared/\` directory for cross-agent information
2373
- 3. **State Persistence**: Update state.json whenever agent status changes
2374
- 4. **Knowledge Sharing**: Document discoveries in knowledge.md files
2375
- 5. **Cleanup**: Remove directories for terminated agents periodically
2376
-
2377
- ## Last Updated
2378
- ${new Date().toISOString()}
2379
- `;
2380
- }
2381
- function createSessionsReadme() {
2382
- return `# Session Memory Storage
2383
-
2384
- ## Purpose
2385
- This directory stores session-based memory data, conversation history, and contextual information for development sessions using the Claude-Flow orchestration system.
2386
-
2387
- ## Structure
2388
- Sessions are organized by date and session ID for easy retrieval:
2389
-
2390
- \`\`\`
2391
- memory/sessions/
2392
- ├── 2024-01-10/
2393
- │ ├── session_001/
2394
- │ │ ├── metadata.json # Session metadata and configuration
2395
- │ │ ├── conversation.md # Full conversation history
2396
- │ │ ├── decisions.md # Key decisions and rationale
2397
- │ │ ├── artifacts/ # Generated files and outputs
2398
- │ │ └── coordination_state/ # Coordination system snapshots
2399
- │ └── ...
2400
- └── shared/
2401
- ├── patterns.md # Common session patterns
2402
- └── templates/ # Session template files
2403
- \`\`\`
2404
-
2405
- ## Usage Guidelines
2406
- 1. **Session Isolation**: Each session gets its own directory
2407
- 2. **Metadata Completeness**: Always fill out session metadata
2408
- 3. **Conversation Logging**: Document all significant interactions
2409
- 4. **Artifact Organization**: Structure generated files clearly
2410
- 5. **State Preservation**: Snapshot coordination state regularly
2411
-
2412
- ## Last Updated
2413
- ${new Date().toISOString()}
2414
- `;
2415
- }
2416
- //# sourceMappingURL=index.js.map