claude-flow-novice 2.0.4 → 2.0.5

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 (496) hide show
  1. package/dist/src/cli/commands/guidance.js +668 -487
  2. package/dist/src/cli/commands/index-validate.js +29 -18
  3. package/dist/src/cli/commands/mcp-troubleshoot.js +282 -230
  4. package/dist/src/cli/commands/neural-goal-init.js +125 -92
  5. package/dist/src/cli/commands/swarm-exec.js +393 -317
  6. package/dist/src/cli/commands/validate-framework.js +1100 -983
  7. package/dist/src/cli/commands/validate.js +223 -144
  8. package/dist/src/cli/main.js +1 -1
  9. package/dist/src/cli/simple-commands/__tests__/agent.test.js +277 -265
  10. package/dist/src/cli/simple-commands/__tests__/memory.test.js +7 -6
  11. package/dist/src/cli/simple-commands/__tests__/swarm.test.js +356 -373
  12. package/dist/src/cli/simple-commands/__tests__/task.test.js +7 -6
  13. package/dist/src/cli/simple-commands/agent.js +193 -157
  14. package/dist/src/cli/simple-commands/analysis.js +446 -336
  15. package/dist/src/cli/simple-commands/automation-executor.js +1339 -1095
  16. package/dist/src/cli/simple-commands/automation.js +469 -481
  17. package/dist/src/cli/simple-commands/batch-manager.js +313 -261
  18. package/dist/src/cli/simple-commands/claude-telemetry.js +267 -241
  19. package/dist/src/cli/simple-commands/claude-track.js +90 -68
  20. package/dist/src/cli/simple-commands/concurrent-display.js +320 -266
  21. package/dist/src/cli/simple-commands/config.js +290 -245
  22. package/dist/src/cli/simple-commands/coordination.js +234 -182
  23. package/dist/src/cli/simple-commands/enhanced-ui-views.js +615 -812
  24. package/dist/src/cli/simple-commands/enhanced-webui-complete.js +981 -922
  25. package/dist/src/cli/simple-commands/fix-hook-variables.js +294 -274
  26. package/dist/src/cli/simple-commands/github/gh-coordinator.js +457 -378
  27. package/dist/src/cli/simple-commands/github/github-api.js +574 -535
  28. package/dist/src/cli/simple-commands/github/init.js +303 -276
  29. package/dist/src/cli/simple-commands/github.js +247 -222
  30. package/dist/src/cli/simple-commands/goal.js +63 -51
  31. package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +278 -208
  32. package/dist/src/cli/simple-commands/hive-mind/communication.js +696 -601
  33. package/dist/src/cli/simple-commands/hive-mind/core.js +979 -907
  34. package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +655 -406
  35. package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1245 -1125
  36. package/dist/src/cli/simple-commands/hive-mind/memory.js +1090 -854
  37. package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +574 -459
  38. package/dist/src/cli/simple-commands/hive-mind/performance-test.js +347 -263
  39. package/dist/src/cli/simple-commands/hive-mind/queen.js +768 -727
  40. package/dist/src/cli/simple-commands/hive-mind/session-manager.js +1049 -745
  41. package/dist/src/cli/simple-commands/hive-mind-optimize.js +283 -227
  42. package/dist/src/cli/simple-commands/hive-mind-wizard.js +217 -174
  43. package/dist/src/cli/simple-commands/hive-mind.js +2282 -1841
  44. package/dist/src/cli/simple-commands/hive.js +79 -90
  45. package/dist/src/cli/simple-commands/hook-safety.js +521 -431
  46. package/dist/src/cli/simple-commands/hooks/session-start-soul.js +254 -203
  47. package/dist/src/cli/simple-commands/hooks.js +1204 -1064
  48. package/dist/src/cli/simple-commands/init/agent-copier.js +319 -294
  49. package/dist/src/cli/simple-commands/init/batch-init.js +562 -496
  50. package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +19 -13
  51. package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +19 -13
  52. package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +88 -61
  53. package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +150 -125
  54. package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +49 -42
  55. package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +61 -43
  56. package/dist/src/cli/simple-commands/init/copy-revised-templates.js +147 -141
  57. package/dist/src/cli/simple-commands/init/executable-wrapper.js +44 -31
  58. package/dist/src/cli/simple-commands/init/gitignore-updater.js +90 -64
  59. package/dist/src/cli/simple-commands/init/help.js +107 -104
  60. package/dist/src/cli/simple-commands/init/hive-mind-init.js +528 -509
  61. package/dist/src/cli/simple-commands/init/index.js +1759 -1510
  62. package/dist/src/cli/simple-commands/init/performance-monitor.js +317 -234
  63. package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +504 -441
  64. package/dist/src/cli/simple-commands/init/rollback/index.js +364 -289
  65. package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +728 -652
  66. package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +481 -416
  67. package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +448 -369
  68. package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +2 -1
  69. package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -122
  70. package/dist/src/cli/simple-commands/init/sparc/workflows.js +37 -32
  71. package/dist/src/cli/simple-commands/init/sparc-structure.js +62 -55
  72. package/dist/src/cli/simple-commands/init/template-copier.js +533 -421
  73. package/dist/src/cli/simple-commands/init/templates/coordination-md.js +6 -3
  74. package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +318 -344
  75. package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +218 -173
  76. package/dist/src/cli/simple-commands/init/templates/github-safe.js +75 -65
  77. package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +6 -3
  78. package/dist/src/cli/simple-commands/init/templates/readme-files.js +4 -2
  79. package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +230 -187
  80. package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +80 -53
  81. package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +85 -101
  82. package/dist/src/cli/simple-commands/init/validation/config-validator.js +330 -283
  83. package/dist/src/cli/simple-commands/init/validation/health-checker.js +561 -495
  84. package/dist/src/cli/simple-commands/init/validation/index.js +358 -302
  85. package/dist/src/cli/simple-commands/init/validation/mode-validator.js +359 -308
  86. package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +366 -389
  87. package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +268 -270
  88. package/dist/src/cli/simple-commands/init/validation/test-runner.js +447 -427
  89. package/dist/src/cli/simple-commands/init.js +2 -1
  90. package/dist/src/cli/simple-commands/mcp-health.js +158 -131
  91. package/dist/src/cli/simple-commands/mcp-integration-layer.js +634 -533
  92. package/dist/src/cli/simple-commands/mcp.js +400 -345
  93. package/dist/src/cli/simple-commands/memory-consolidation.js +537 -426
  94. package/dist/src/cli/simple-commands/memory.js +311 -247
  95. package/dist/src/cli/simple-commands/migrate-hooks.js +46 -39
  96. package/dist/src/cli/simple-commands/monitor.js +363 -294
  97. package/dist/src/cli/simple-commands/neural.js +65 -51
  98. package/dist/src/cli/simple-commands/pair-autofix-only.js +662 -538
  99. package/dist/src/cli/simple-commands/pair-basic.js +656 -528
  100. package/dist/src/cli/simple-commands/pair-old.js +543 -430
  101. package/dist/src/cli/simple-commands/pair-working.js +751 -615
  102. package/dist/src/cli/simple-commands/pair.js +751 -615
  103. package/dist/src/cli/simple-commands/performance-hooks.js +111 -83
  104. package/dist/src/cli/simple-commands/performance-metrics.js +433 -348
  105. package/dist/src/cli/simple-commands/process-ui-enhanced.js +787 -708
  106. package/dist/src/cli/simple-commands/process-ui.js +254 -230
  107. package/dist/src/cli/simple-commands/realtime-update-system.js +611 -525
  108. package/dist/src/cli/simple-commands/sparc/architecture.js +1530 -1704
  109. package/dist/src/cli/simple-commands/sparc/commands.js +516 -438
  110. package/dist/src/cli/simple-commands/sparc/completion.js +1481 -1224
  111. package/dist/src/cli/simple-commands/sparc/coordinator.js +978 -913
  112. package/dist/src/cli/simple-commands/sparc/index.js +298 -241
  113. package/dist/src/cli/simple-commands/sparc/phase-base.js +390 -314
  114. package/dist/src/cli/simple-commands/sparc/pseudocode.js +869 -965
  115. package/dist/src/cli/simple-commands/sparc/refinement.js +1273 -980
  116. package/dist/src/cli/simple-commands/sparc/specification.js +645 -559
  117. package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
  118. package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
  119. package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
  120. package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
  121. package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
  122. package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
  123. package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
  124. package/dist/src/cli/simple-commands/sparc-modes/index.js +55 -47
  125. package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
  126. package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
  127. package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
  128. package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
  129. package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
  130. package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
  131. package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
  132. package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
  133. package/dist/src/cli/simple-commands/sparc-modes/swarm.js +87 -101
  134. package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
  135. package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
  136. package/dist/src/cli/simple-commands/sparc.js +493 -465
  137. package/dist/src/cli/simple-commands/start-ui.js +132 -108
  138. package/dist/src/cli/simple-commands/start-wrapper.js +268 -240
  139. package/dist/src/cli/simple-commands/start.js +1 -1
  140. package/dist/src/cli/simple-commands/status.js +275 -254
  141. package/dist/src/cli/simple-commands/stream-chain-clean.js +171 -128
  142. package/dist/src/cli/simple-commands/stream-chain-fixed.js +82 -61
  143. package/dist/src/cli/simple-commands/stream-chain-real.js +331 -267
  144. package/dist/src/cli/simple-commands/stream-chain-working.js +263 -211
  145. package/dist/src/cli/simple-commands/stream-chain.js +318 -260
  146. package/dist/src/cli/simple-commands/stream-processor.js +315 -290
  147. package/dist/src/cli/simple-commands/swarm-executor.js +222 -189
  148. package/dist/src/cli/simple-commands/swarm-metrics-integration.js +300 -208
  149. package/dist/src/cli/simple-commands/swarm-ui.js +703 -623
  150. package/dist/src/cli/simple-commands/swarm-webui-integration.js +286 -258
  151. package/dist/src/cli/simple-commands/swarm.js +1082 -887
  152. package/dist/src/cli/simple-commands/task.js +206 -161
  153. package/dist/src/cli/simple-commands/timestamp-fix.js +89 -59
  154. package/dist/src/cli/simple-commands/token-tracker.js +316 -258
  155. package/dist/src/cli/simple-commands/tool-execution-framework.js +519 -433
  156. package/dist/src/cli/simple-commands/train-and-stream.js +331 -275
  157. package/dist/src/cli/simple-commands/training-pipeline.js +725 -619
  158. package/dist/src/cli/simple-commands/training.js +227 -170
  159. package/dist/src/cli/simple-commands/verification-hooks.js +284 -261
  160. package/dist/src/cli/simple-commands/verification-integration.js +417 -389
  161. package/dist/src/cli/simple-commands/verification-training-integration.js +606 -486
  162. package/dist/src/cli/simple-commands/verification.js +513 -493
  163. package/dist/src/cli/simple-commands/web-server.js +836 -766
  164. package/dist/src/cli/simple-commands/webui-validator.js +124 -106
  165. package/dist/src/coordination/byzantine-memory-channels.js +25 -1
  166. package/dist/src/coordination/event-bus/demo-wasm-integration.js +251 -212
  167. package/dist/src/coordination/event-bus/qe-event-bus.js +748 -608
  168. package/dist/src/coordination/event-bus/qe-event-bus.test.js +454 -379
  169. package/dist/src/coordination/iteration-tracker.js +454 -363
  170. package/dist/src/index.js +384 -35
  171. package/dist/src/mcp/DEPRECATED.js +60 -46
  172. package/dist/src/mcp/fixes/mcp-error-fixes.js +134 -115
  173. package/dist/src/mcp/implementations/agent-tracker.js +128 -114
  174. package/dist/src/mcp/implementations/daa-tools.js +350 -292
  175. package/dist/src/mcp/implementations/workflow-tools.js +361 -329
  176. package/dist/src/mcp/mcp-config-manager.js +1331 -1183
  177. package/dist/src/mcp/mcp-server-novice-simplified.js +17 -11
  178. package/dist/src/mcp/mcp-server-novice.js +17 -11
  179. package/dist/src/mcp/mcp-server-sdk.js +17 -11
  180. package/dist/src/mcp/mcp-server.js +1484 -1620
  181. package/dist/src/mcp/ruv-swarm-wrapper.js +239 -209
  182. package/dist/src/memory/advanced-serializer.js +589 -609
  183. package/dist/src/memory/enhanced-examples.js +305 -220
  184. package/dist/src/memory/enhanced-memory.js +336 -295
  185. package/dist/src/memory/enhanced-session-serializer.js +492 -408
  186. package/dist/src/memory/fallback-memory-system.js +1021 -900
  187. package/dist/src/memory/fallback-store.js +131 -93
  188. package/dist/src/memory/high-performance-serialization.js +730 -592
  189. package/dist/src/memory/in-memory-store.js +213 -161
  190. package/dist/src/memory/index.js +157 -123
  191. package/dist/src/memory/lock-free-structures.js +764 -578
  192. package/dist/src/memory/memory-mapped-persistence.js +766 -585
  193. package/dist/src/memory/memory-pressure-manager.js +707 -569
  194. package/dist/src/memory/migration.js +445 -358
  195. package/dist/src/memory/shared-memory.js +768 -641
  196. package/dist/src/memory/sqlite-store.js +325 -245
  197. package/dist/src/memory/sqlite-wrapper.js +151 -122
  198. package/dist/src/memory/swarm-memory.js +603 -470
  199. package/dist/src/memory/test-example.js +134 -126
  200. package/dist/src/memory/ultra-fast-memory-store.js +821 -622
  201. package/dist/src/memory/unified-memory-manager.js +437 -356
  202. package/dist/src/swarm/CodeRefactoringSwarm.js +952 -777
  203. package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +400 -332
  204. package/dist/src/utils/error-handler.js +2 -36
  205. package/dist/src/utils/github-cli-safe.js +64 -56
  206. package/dist/src/utils/github-cli-safety-wrapper.js +546 -451
  207. package/dist/src/utils/npx-isolated-cache.js +119 -104
  208. package/dist/src/utils/preference-manager.js +652 -622
  209. package/dist/src/utils/timezone-utils.js +105 -86
  210. package/dist/src/web/api/apm-routes.js +353 -0
  211. package/dist/src/web/api/config/api-config.js +184 -0
  212. package/dist/src/web/api/middleware/auth.js +203 -0
  213. package/dist/src/web/api/middleware/cache.js +273 -0
  214. package/dist/src/web/api/middleware/error-handler.js +257 -0
  215. package/dist/src/web/api/middleware/request-logger.js +215 -0
  216. package/dist/src/web/api/middleware/validation.js +323 -0
  217. package/dist/src/web/api/routes/events.js +463 -0
  218. package/dist/src/web/api/routes/hierarchy.js +300 -0
  219. package/dist/src/web/api/routes/index.js +12 -0
  220. package/dist/src/web/api/routes/metrics.js +559 -0
  221. package/dist/src/web/api/routes/parallel-status.js +359 -0
  222. package/dist/src/web/api/routes/status.js +448 -0
  223. package/dist/src/web/api/server.js +462 -0
  224. package/dist/src/web/dashboard/hooks/useWebSocket.js +383 -0
  225. package/dist/src/web/dashboard/index.js +85 -0
  226. package/dist/src/web/dashboard/realtime/CustomSyncManager.js +439 -0
  227. package/dist/src/web/dashboard/realtime/NativeWebSocketManager.js +323 -0
  228. package/dist/src/web/dashboard/realtime/PerformanceBenchmark.js +527 -0
  229. package/dist/src/web/dashboard/realtime/RealtimeCommunicationManager.js +474 -0
  230. package/dist/src/web/dashboard/realtime/RealtimeServer.js +666 -0
  231. package/dist/src/web/dashboard/realtime/SSEManager.js +426 -0
  232. package/dist/src/web/dashboard/types.js +4 -0
  233. package/dist/src/web/messaging/agent-status-tracker.js +453 -0
  234. package/dist/src/web/messaging/human-intervention-system.js +305 -0
  235. package/dist/src/web/messaging/message-filter.js +302 -0
  236. package/dist/src/web/messaging/swarm-message-router.js +324 -0
  237. package/dist/src/web/messaging/transparency-logger.js +421 -0
  238. package/dist/src/web/portal-server.js +460 -0
  239. package/dist/src/web/server.js +322 -0
  240. package/dist/src/web/websocket/apm-websocket-handler.js +453 -0
  241. package/dist/src/web/websocket/websocket-manager.js +780 -0
  242. package/package.json +5 -3
  243. package/dist/src/cli/minimal-main.js +0 -22
  244. package/dist/src/enterprise/analytics-manager.js +0 -1135
  245. package/dist/src/enterprise/audit-manager.js +0 -1115
  246. package/dist/src/enterprise/cloud-manager.js +0 -891
  247. package/dist/src/enterprise/deployment-manager.js +0 -966
  248. package/dist/src/enterprise/index.js +0 -6
  249. package/dist/src/enterprise/project-manager.js +0 -584
  250. package/dist/src/enterprise/security-manager.js +0 -991
  251. package/dist/src/migration/index.js +0 -92
  252. package/dist/src/migration/logger.js +0 -121
  253. package/dist/src/migration/migration-analyzer.js +0 -268
  254. package/dist/src/migration/migration-runner.js +0 -522
  255. package/dist/src/migration/migration-validator.js +0 -285
  256. package/dist/src/migration/progress-reporter.js +0 -150
  257. package/dist/src/migration/rollback-manager.js +0 -321
  258. package/dist/src/migration/tests/migration-system.test.js +0 -7
  259. package/dist/src/migration/types.js +0 -3
  260. package/dist/src/swarm/__tests__/integration.test.js +0 -227
  261. package/dist/src/swarm/__tests__/prompt-copier.test.js +0 -344
  262. package/dist/src/swarm/advanced-orchestrator.js +0 -1095
  263. package/dist/src/swarm/claude-code-interface.js +0 -961
  264. package/dist/src/swarm/claude-flow-executor.js +0 -229
  265. package/dist/src/swarm/consensus-coordinator.js +0 -475
  266. package/dist/src/swarm/coordinator.js +0 -2993
  267. package/dist/src/swarm/direct-executor.js +0 -1180
  268. package/dist/src/swarm/error-recovery/advanced-error-detection.js +0 -691
  269. package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +0 -998
  270. package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +0 -1197
  271. package/dist/src/swarm/error-recovery/recovery-monitoring.js +0 -772
  272. package/dist/src/swarm/error-recovery/resilience-architecture.js +0 -714
  273. package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +0 -1319
  274. package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +0 -808
  275. package/dist/src/swarm/executor-v2.js +0 -322
  276. package/dist/src/swarm/executor.js +0 -815
  277. package/dist/src/swarm/hive-mind-integration.js +0 -703
  278. package/dist/src/swarm/index.js +0 -41
  279. package/dist/src/swarm/json-output-aggregator.js +0 -267
  280. package/dist/src/swarm/large-scale-coordinator.js +0 -542
  281. package/dist/src/swarm/mcp-integration-wrapper.js +0 -628
  282. package/dist/src/swarm/memory.js +0 -1117
  283. package/dist/src/swarm/optimizations/__tests__/optimization.test.js +0 -348
  284. package/dist/src/swarm/optimizations/async-file-manager.js +0 -285
  285. package/dist/src/swarm/optimizations/circular-buffer.js +0 -162
  286. package/dist/src/swarm/optimizations/connection-pool.js +0 -244
  287. package/dist/src/swarm/optimizations/index.js +0 -28
  288. package/dist/src/swarm/optimizations/optimized-executor.js +0 -320
  289. package/dist/src/swarm/optimizations/ttl-map.js +0 -234
  290. package/dist/src/swarm/prompt-cli.js +0 -200
  291. package/dist/src/swarm/prompt-copier-enhanced.js +0 -202
  292. package/dist/src/swarm/prompt-copier.js +0 -381
  293. package/dist/src/swarm/prompt-manager.js +0 -295
  294. package/dist/src/swarm/prompt-utils.js +0 -310
  295. package/dist/src/swarm/result-aggregator.js +0 -718
  296. package/dist/src/swarm/sparc-executor.js +0 -1568
  297. package/dist/src/swarm/strategies/auto.js +0 -758
  298. package/dist/src/swarm/strategies/base.js +0 -128
  299. package/dist/src/swarm/strategies/research.js +0 -914
  300. package/dist/src/swarm/strategies/strategy-metrics-patch.js +0 -2
  301. package/dist/src/swarm/types.js +0 -52
  302. package/dist/src/swarm/workers/copy-worker.js +0 -56
  303. package/dist/src/validators/epic-config-schema.js +0 -214
  304. package/dist/src/validators/index.js +0 -10
  305. package/dist/src/validators/swarm-init-validator.js +0 -259
  306. package/dist/src/validators/todowrite-batching-validator.js +0 -215
  307. package/dist/src/validators/todowrite-integration.js +0 -187
  308. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js +0 -23
  309. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +0 -57
  310. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +0 -401
  311. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +0 -181
  312. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js +0 -44
  313. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +0 -157
  314. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js +0 -71
  315. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/editorState/browser/editorState.js +0 -112
  316. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findController.js +0 -990
  317. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findDecorations.js +0 -296
  318. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findModel.js +0 -488
  319. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +0 -138
  320. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findState.js +0 -243
  321. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findWidget.js +0 -1177
  322. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/folding.js +0 -1093
  323. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +0 -133
  324. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingModel.js +0 -538
  325. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingRanges.js +0 -351
  326. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +0 -49
  327. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/format.js +0 -360
  328. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formatActions.js +0 -263
  329. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formattingEdit.js +0 -54
  330. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +0 -149
  331. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/hover/browser/contentHover.js +0 -874
  332. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js +0 -7
  333. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commands.js +0 -199
  334. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js +0 -70
  335. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -26
  336. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +0 -153
  337. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +0 -33
  338. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +0 -354
  339. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js +0 -146
  340. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/suggest/browser/completionModel.js +0 -224
  341. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +0 -119
  342. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/edcore.main.js +0 -14
  343. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.all.js +0 -63
  344. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.api.js +0 -55
  345. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.main.js +0 -7
  346. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.worker.js +0 -25
  347. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/standalone/browser/colorizer.js +0 -118
  348. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/css.worker.js +0 -36869
  349. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/cssMode.js +0 -2035
  350. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
  351. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
  352. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
  353. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
  354. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
  355. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
  356. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
  357. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
  358. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
  359. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
  360. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
  361. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
  362. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
  363. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
  364. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
  365. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
  366. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
  367. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
  368. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
  369. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
  370. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
  371. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
  372. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
  373. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
  374. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
  375. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
  376. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
  377. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
  378. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
  379. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
  380. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
  381. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
  382. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
  383. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
  384. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
  385. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
  386. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
  387. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
  388. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
  389. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
  390. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
  391. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
  392. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cameligo/cameligo.js +0 -10
  393. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/clojure/clojure.js +0 -10
  394. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/coffee/coffee.js +0 -10
  395. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cpp/cpp.js +0 -10
  396. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csharp/csharp.js +0 -10
  397. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csp/csp.js +0 -10
  398. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/css/css.js +0 -12
  399. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cypher/cypher.js +0 -10
  400. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dart/dart.js +0 -10
  401. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dockerfile/dockerfile.js +0 -10
  402. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/ecl/ecl.js +0 -10
  403. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/elixir/elixir.js +0 -10
  404. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/flow9/flow9.js +0 -10
  405. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.js +0 -745
  406. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.de.js +0 -31
  407. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.es.js +0 -31
  408. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.fr.js +0 -29
  409. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.it.js +0 -29
  410. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ja.js +0 -31
  411. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.js +0 -29
  412. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ko.js +0 -29
  413. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ru.js +0 -31
  414. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-cn.js +0 -31
  415. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-tw.js +0 -29
  416. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssMode.js +0 -13
  417. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssWorker.js +0 -81
  418. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/cli.js +0 -64
  419. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/example.js +0 -36
  420. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/index.js +0 -205
  421. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/test.js +0 -260
  422. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.browser.js +0 -34
  423. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.js +0 -35
  424. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.native.js +0 -26
  425. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.browser.js +0 -34
  426. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.js +0 -45
  427. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/nanoid.js +0 -1
  428. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/non-secure/index.js +0 -21
  429. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/url-alphabet/index.js +0 -3
  430. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/bin/nodemon.js +0 -16
  431. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/index.js +0 -49
  432. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/parse.js +0 -230
  433. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/command.js +0 -43
  434. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/defaults.js +0 -34
  435. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/exec.js +0 -234
  436. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/index.js +0 -93
  437. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/load.js +0 -225
  438. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/help/index.js +0 -27
  439. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/index.js +0 -1
  440. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/index.js +0 -4
  441. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/match.js +0 -287
  442. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/run.js +0 -562
  443. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/signals.js +0 -34
  444. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/watch.js +0 -244
  445. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/nodemon.js +0 -317
  446. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/add.js +0 -89
  447. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/index.js +0 -53
  448. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/parse.js +0 -43
  449. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/spawn.js +0 -74
  450. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/bus.js +0 -44
  451. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/clone.js +0 -40
  452. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/colour.js +0 -26
  453. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/index.js +0 -103
  454. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/log.js +0 -82
  455. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/merge.js +0 -47
  456. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/version.js +0 -100
  457. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/brace-expansion/index.js +0 -201
  458. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/has-flag/index.js +0 -8
  459. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/minimatch/minimatch.js +0 -947
  460. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/browser.js +0 -5
  461. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/index.js +0 -131
  462. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/bin/pidtree.js +0 -128
  463. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/index.js +0 -49
  464. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/bin.js +0 -61
  465. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/get.js +0 -45
  466. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/pidtree.js +0 -104
  467. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/ps.js +0 -47
  468. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/wmic.js +0 -49
  469. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/doc.js +0 -1270
  470. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/acorn.js +0 -15
  471. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/angular.js +0 -2
  472. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/babel.js +0 -15
  473. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/estree.js +0 -36
  474. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/flow.js +0 -19
  475. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/glimmer.js +0 -29
  476. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/graphql.js +0 -29
  477. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/html.js +0 -22
  478. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/markdown.js +0 -63
  479. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/meriyah.js +0 -4
  480. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/postcss.js +0 -54
  481. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/typescript.js +0 -20
  482. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/yaml.js +0 -160
  483. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/standalone.js +0 -34
  484. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/bin/react-scripts.js +0 -58
  485. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/env.js +0 -112
  486. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/getHttpsConfig.js +0 -74
  487. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/babelTransform.js +0 -37
  488. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/cssTransform.js +0 -22
  489. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/fileTransform.js +0 -40
  490. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/modules.js +0 -142
  491. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/paths.js +0 -153
  492. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
  493. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack.config.js +0 -796
  494. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpackDevServer.config.js +0 -135
  495. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/build.js +0 -225
  496. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/eject.js +0 -340
@@ -1,121 +1,150 @@
1
1
  /**
2
2
  * Swarm command wrapper for simple CLI
3
- */ import { mkdirAsync, writeTextFile, exit } from "../node-compat.js";
4
- import { spawn } from "child_process";
5
- import { existsSync, chmodSync, statSync } from "fs";
6
- import { open } from "node:fs/promises";
7
- import process from "process";
3
+ */
4
+
5
+ import { args, mkdirAsync, writeTextFile, exit, cwd } from '../node-compat.js';
6
+ import { spawn, execSync } from 'child_process';
7
+ import { existsSync, chmodSync, statSync } from 'fs';
8
+ import { open } from 'fs/promises';
9
+ import process from 'process';
10
+ import path from 'path';
11
+
8
12
  /**
9
13
  * Detects if the environment is headless (non-interactive)
10
- */ function isHeadlessEnvironment() {
11
- // Check for common CI environment variables
12
- const ciEnvironments = [
13
- 'CI',
14
- 'GITHUB_ACTIONS',
15
- 'GITLAB_CI',
16
- 'JENKINS_URL',
17
- 'CIRCLECI',
18
- 'TRAVIS',
19
- 'BUILDKITE',
20
- 'DRONE',
21
- 'DOCKER_CONTAINER'
22
- ];
23
- const isCI = ciEnvironments.some((env)=>process.env[env]);
24
- // Check if running in Docker
25
- const isDocker = existsSync('/.dockerenv') || existsSync('/proc/1/cgroup') && require('fs').readFileSync('/proc/1/cgroup', 'utf8').includes('docker');
26
- // Check TTY availability
27
- const hasTTY = process.stdin.isTTY && process.stdout.isTTY;
28
- return isCI || isDocker || !hasTTY;
14
+ */
15
+ function isHeadlessEnvironment() {
16
+ // Check for common CI environment variables
17
+ const ciEnvironments = [
18
+ 'CI',
19
+ 'GITHUB_ACTIONS',
20
+ 'GITLAB_CI',
21
+ 'JENKINS_URL',
22
+ 'CIRCLECI',
23
+ 'TRAVIS',
24
+ 'BUILDKITE',
25
+ 'DRONE',
26
+ 'DOCKER_CONTAINER',
27
+ ];
28
+
29
+ const isCI = ciEnvironments.some((env) => process.env[env]);
30
+
31
+ // Check if running in Docker
32
+ const isDocker =
33
+ existsSync('/.dockerenv') ||
34
+ (existsSync('/proc/1/cgroup') &&
35
+ require('fs').readFileSync('/proc/1/cgroup', 'utf8').includes('docker'));
36
+
37
+ // Check TTY availability
38
+ const hasTTY = process.stdin.isTTY && process.stdout.isTTY;
39
+
40
+ return isCI || isDocker || !hasTTY;
29
41
  }
42
+
30
43
  /**
31
44
  * Basic swarm implementation for fallback scenarios
32
- */ async function basicSwarmNew(args, flags) {
33
- const objective = (args || []).join(' ').trim();
34
- if (!objective) {
35
- console.error('❌ Usage: swarm <objective>');
36
- showSwarmHelp();
37
- return;
38
- }
39
- const isHeadless = isHeadlessEnvironment();
40
- // Configure for headless mode
45
+ */
46
+ async function basicSwarmNew(args, flags) {
47
+ const objective = (args || []).join(' ').trim();
48
+
49
+ if (!objective) {
50
+ console.error('❌ Usage: swarm <objective>');
51
+ showSwarmHelp();
52
+ return;
53
+ }
54
+
55
+ const isHeadless = isHeadlessEnvironment();
56
+
57
+ // Configure for headless mode
58
+ if (isHeadless) {
59
+ console.log('🤖 Headless environment detected - running in non-interactive mode');
60
+ flags = {
61
+ ...flags,
62
+ 'non-interactive': true,
63
+ 'output-format': flags['output-format'] || 'stream-json', // Use stream-json for Claude compatibility
64
+ 'no-auto-permissions': false,
65
+ };
66
+ }
67
+
68
+ // Set up graceful shutdown handlers
69
+ const cleanup = () => {
70
+ console.log('\n🛑 Shutting down swarm gracefully...');
71
+ process.exit(0);
72
+ };
73
+
74
+ process.on('SIGTERM', cleanup);
75
+ process.on('SIGINT', cleanup);
76
+
77
+ try {
78
+ // Try to use the swarm executor
79
+ const { executeSwarm } = await import('./swarm-executor.js');
80
+
81
+ console.log(`🐝 Starting basic swarm execution...`);
82
+ console.log(`📋 Objective: ${objective}`);
83
+ console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
84
+ console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
85
+ console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
86
+
41
87
  if (isHeadless) {
42
- console.log('🤖 Headless environment detected - running in non-interactive mode');
43
- flags = {
44
- ...flags,
45
- 'non-interactive': true,
46
- 'output-format': flags['output-format'] || 'stream-json',
47
- 'no-auto-permissions': false
48
- };
88
+ console.log(`🖥️ Headless Mode: Enabled`);
89
+ console.log(`📄 Output Format: ${flags['output-format']}`);
49
90
  }
50
- // Set up graceful shutdown handlers
51
- const cleanup = ()=>{
52
- console.log('\n🛑 Shutting down swarm gracefully...');
53
- process.exit(0);
54
- };
55
- process.on('SIGTERM', cleanup);
56
- process.on('SIGINT', cleanup);
57
- try {
58
- // Try to use the swarm executor
59
- const { executeSwarm } = await import("./swarm-executor.js");
60
- console.log(`🐝 Starting basic swarm execution...`);
61
- console.log(`📋 Objective: ${objective}`);
62
- console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
63
- console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
64
- console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
65
- if (isHeadless) {
66
- console.log(`🖥️ Headless Mode: Enabled`);
67
- console.log(`📄 Output Format: ${flags['output-format']}`);
68
- }
69
- const result = await executeSwarm(objective, flags);
70
- // Handle output based on format
71
- if (flags['output-format'] === 'json') {
72
- // In JSON mode, output clean JSON
73
- const output = {
74
- success: result.success,
75
- swarmId: result.summary?.swarmId,
76
- objective: objective,
77
- duration: result.summary?.duration,
78
- agents: result.summary?.totalAgents,
79
- tasks: result.summary?.totalTasks,
80
- timestamp: new Date().toISOString()
81
- };
82
- if (flags['output-file']) {
83
- const fs = await import("node:fs/promises");
84
- await fs.writeFile(flags['output-file'], JSON.stringify(output, null, 2));
85
- console.log(`✅ Output saved to: ${flags['output-file']}`);
86
- } else {
87
- console.log(JSON.stringify(output, null, 2));
88
- }
89
- } else {
90
- // Text mode output
91
- if (result.success) {
92
- console.log(`\n✅ Swarm execution completed successfully!`);
93
- if (result.summary) {
94
- console.log(` Duration: ${result.summary.duration}`);
95
- console.log(` Agents: ${result.summary.totalAgents}`);
96
- console.log(` Tasks: ${result.summary.totalTasks}`);
97
- }
98
- } else {
99
- console.error(`\n❌ Swarm execution failed: ${result.error}`);
100
- }
101
- }
102
- return result;
103
- } catch (error) {
104
- console.error(`❌ Basic swarm execution error: ${error.message}`);
105
- // In headless mode, ensure we output JSON error
106
- if (flags['output-format'] === 'json') {
107
- const errorOutput = {
108
- success: false,
109
- error: error.message,
110
- timestamp: new Date().toISOString()
111
- };
112
- console.log(JSON.stringify(errorOutput, null, 2));
91
+
92
+ const result = await executeSwarm(objective, flags);
93
+
94
+ // Handle output based on format
95
+ if (flags['output-format'] === 'json') {
96
+ // In JSON mode, output clean JSON
97
+ const output = {
98
+ success: result.success,
99
+ swarmId: result.summary?.swarmId,
100
+ objective: objective,
101
+ duration: result.summary?.duration,
102
+ agents: result.summary?.totalAgents,
103
+ tasks: result.summary?.totalTasks,
104
+ timestamp: new Date().toISOString(),
105
+ };
106
+
107
+ if (flags['output-file']) {
108
+ const fs = await import('fs/promises');
109
+ await fs.writeFile(flags['output-file'], JSON.stringify(output, null, 2));
110
+ console.log(`✅ Output saved to: ${flags['output-file']}`);
111
+ } else {
112
+ console.log(JSON.stringify(output, null, 2));
113
+ }
114
+ } else {
115
+ // Text mode output
116
+ if (result.success) {
117
+ console.log(`\n✅ Swarm execution completed successfully!`);
118
+ if (result.summary) {
119
+ console.log(` Duration: ${result.summary.duration}`);
120
+ console.log(` Agents: ${result.summary.totalAgents}`);
121
+ console.log(` Tasks: ${result.summary.totalTasks}`);
113
122
  }
114
- throw error;
123
+ } else {
124
+ console.error(`\n❌ Swarm execution failed: ${result.error}`);
125
+ }
115
126
  }
127
+
128
+ return result;
129
+ } catch (error) {
130
+ console.error(`❌ Basic swarm execution error: ${error.message}`);
131
+
132
+ // In headless mode, ensure we output JSON error
133
+ if (flags['output-format'] === 'json') {
134
+ const errorOutput = {
135
+ success: false,
136
+ error: error.message,
137
+ timestamp: new Date().toISOString(),
138
+ };
139
+ console.log(JSON.stringify(errorOutput, null, 2));
140
+ }
141
+
142
+ throw error;
143
+ }
116
144
  }
145
+
117
146
  function showSwarmHelp() {
118
- console.log(`
147
+ console.log(`
119
148
  🐝 Claude Flow Advanced Swarm System
120
149
 
121
150
  USAGE:
@@ -221,114 +250,136 @@ For complete documentation and examples:
221
250
  https://github.com/ruvnet/claude-code-flow/docs/swarm.md
222
251
  `);
223
252
  }
253
+
224
254
  export async function swarmCommand(args, flags) {
225
- // Handle headless mode early
226
- if (flags && flags.headless) {
227
- const isHeadless = isHeadlessEnvironment();
228
- // Configure for headless mode
229
- flags = {
230
- ...flags,
231
- 'non-interactive': true,
232
- 'output-format': flags['output-format'] || 'stream-json',
233
- 'no-auto-permissions': false
234
- };
235
- }
236
- // Handle health check first
237
- if (flags && flags['health-check']) {
238
- try {
239
- // Quick health check for Docker/K8s
240
- console.log(JSON.stringify({
241
- status: 'healthy',
242
- service: 'claude-flow-swarm',
243
- version: process.env.npm_package_version || '2.0.0',
244
- timestamp: new Date().toISOString()
245
- }));
246
- process.exit(0);
247
- } catch (error) {
248
- console.error(JSON.stringify({
249
- status: 'unhealthy',
250
- error: error.message,
251
- timestamp: new Date().toISOString()
252
- }));
253
- process.exit(1);
254
- }
255
- }
256
- const objective = (args || []).join(' ').trim();
257
- if (!objective) {
258
- console.error('❌ Usage: swarm <objective>');
259
- showSwarmHelp();
260
- return;
261
- }
262
- // Force headless mode if flag is set
263
- if (flags && flags.headless) {
264
- const isHeadless = isHeadlessEnvironment();
265
- if (!isHeadless) {
266
- console.log('🤖 Forcing headless mode as requested');
267
- }
268
- flags = {
269
- ...flags,
270
- 'non-interactive': true,
271
- 'output-format': flags['output-format'] || 'json',
272
- 'no-auto-permissions': false
273
- };
274
- }
275
- // Handle JSON output format
276
- const outputFormat = flags && flags['output-format'];
277
- const outputFile = flags && flags['output-file'];
278
- const isJsonOutput = outputFormat === 'json';
279
- const isNonInteractive = isJsonOutput || flags && flags['no-interactive'];
280
- const useJsonLogs = flags && flags['json-logs'];
281
- // Override console.log for JSON logs if requested
282
- if (useJsonLogs) {
283
- const originalLog = console.log;
284
- const originalError = console.error;
285
- console.log = (...args)=>{
286
- originalLog(JSON.stringify({
287
- level: 'info',
288
- message: args.join(' '),
289
- timestamp: new Date().toISOString(),
290
- service: 'claude-flow-swarm'
291
- }));
292
- };
293
- console.error = (...args)=>{
294
- originalError(JSON.stringify({
295
- level: 'error',
296
- message: args.join(' '),
297
- timestamp: new Date().toISOString(),
298
- service: 'claude-flow-swarm'
299
- }));
300
- };
255
+ // Handle headless mode early
256
+ if (flags && flags.headless) {
257
+ const isHeadless = isHeadlessEnvironment();
258
+ // Configure for headless mode
259
+ flags = {
260
+ ...flags,
261
+ 'non-interactive': true,
262
+ 'output-format': flags['output-format'] || 'stream-json',
263
+ 'no-auto-permissions': false,
264
+ };
265
+ }
266
+
267
+ // Handle health check first
268
+ if (flags && flags['health-check']) {
269
+ try {
270
+ // Quick health check for Docker/K8s
271
+ console.log(
272
+ JSON.stringify({
273
+ status: 'healthy',
274
+ service: 'claude-flow-swarm',
275
+ version: process.env.npm_package_version || '2.0.0',
276
+ timestamp: new Date().toISOString(),
277
+ }),
278
+ );
279
+ process.exit(0);
280
+ } catch (error) {
281
+ console.error(
282
+ JSON.stringify({
283
+ status: 'unhealthy',
284
+ error: error.message,
285
+ timestamp: new Date().toISOString(),
286
+ }),
287
+ );
288
+ process.exit(1);
301
289
  }
302
- // Handle analysis/read-only mode
303
- const isAnalysisMode = flags && (flags.analysis || flags['read-only']);
304
- const analysisMode = isAnalysisMode ? 'analysis' : 'standard';
305
- // For JSON output, allow using Claude with stream-json format
306
- // Only force executor mode if explicitly using 'json' format (not 'stream-json')
307
- if (flags && flags['output-format'] === 'json' && !(flags && flags.executor)) {
308
- // Keep backward compatibility - regular 'json' format uses executor
309
- flags = {
310
- ...flags || {},
311
- executor: true
312
- };
290
+ }
291
+
292
+ const objective = (args || []).join(' ').trim();
293
+
294
+ if (!objective) {
295
+ console.error('❌ Usage: swarm <objective>');
296
+ showSwarmHelp();
297
+ return;
298
+ }
299
+
300
+ // Force headless mode if flag is set
301
+ if (flags && flags.headless) {
302
+ const isHeadless = isHeadlessEnvironment();
303
+ if (!isHeadless) {
304
+ console.log('🤖 Forcing headless mode as requested');
313
305
  }
314
- // Check if we should use the old executor (opt-in with --executor flag)
315
- if (flags && flags.executor) {
306
+ flags = {
307
+ ...flags,
308
+ 'non-interactive': true,
309
+ 'output-format': flags['output-format'] || 'json',
310
+ 'no-auto-permissions': false,
311
+ };
312
+ }
313
+
314
+ // Handle JSON output format
315
+ const outputFormat = flags && flags['output-format'];
316
+ const outputFile = flags && flags['output-file'];
317
+ const isJsonOutput = outputFormat === 'json';
318
+ const isNonInteractive = isJsonOutput || (flags && flags['no-interactive']);
319
+ const useJsonLogs = flags && flags['json-logs'];
320
+
321
+ // Override console.log for JSON logs if requested
322
+ if (useJsonLogs) {
323
+ const originalLog = console.log;
324
+ const originalError = console.error;
325
+
326
+ console.log = (...args) => {
327
+ originalLog(
328
+ JSON.stringify({
329
+ level: 'info',
330
+ message: args.join(' '),
331
+ timestamp: new Date().toISOString(),
332
+ service: 'claude-flow-swarm',
333
+ }),
334
+ );
335
+ };
336
+
337
+ console.error = (...args) => {
338
+ originalError(
339
+ JSON.stringify({
340
+ level: 'error',
341
+ message: args.join(' '),
342
+ timestamp: new Date().toISOString(),
343
+ service: 'claude-flow-swarm',
344
+ }),
345
+ );
346
+ };
347
+ }
348
+
349
+ // Handle analysis/read-only mode
350
+ const isAnalysisMode = flags && (flags.analysis || flags['read-only']);
351
+ const analysisMode = isAnalysisMode ? 'analysis' : 'standard';
352
+
353
+ // For JSON output, allow using Claude with stream-json format
354
+ // Only force executor mode if explicitly using 'json' format (not 'stream-json')
355
+ if (flags && flags['output-format'] === 'json' && !(flags && flags.executor)) {
356
+ // Keep backward compatibility - regular 'json' format uses executor
357
+ flags = { ...(flags || {}), executor: true };
358
+ }
359
+
360
+ // Check if we should use the old executor (opt-in with --executor flag)
361
+ if (flags && flags.executor) {
316
362
  // Continue with the old swarm executor implementation below
317
- } else {
318
- // Default behavior: spawn Claude Code with comprehensive swarm MCP instructions
319
- try {
320
- const { execSync, spawn } = await import("child_process");
321
- // Get configuration values first
322
- const strategy = flags.strategy || 'auto';
323
- const mode = flags.mode || 'centralized';
324
- const maxAgents = flags['max-agents'] || 5;
325
- // Get strategy-specific guidance
326
- const strategyGuidance = getStrategyGuidance(strategy, objective);
327
- const modeGuidance = getModeGuidance(mode);
328
- const agentRecommendations = getAgentRecommendations(strategy, maxAgents, objective);
329
- const enableSparc = flags.sparc !== false && (strategy === 'development' || strategy === 'auto');
330
- // Build the complete swarm prompt before checking for claude
331
- const swarmPrompt = `You are orchestrating a Claude Flow Swarm using Claude Code's Task tool for agent execution.
363
+ } else {
364
+ // Default behavior: spawn Claude Code with comprehensive swarm MCP instructions
365
+ try {
366
+ const { execSync, spawn } = await import('child_process');
367
+
368
+ // Get configuration values first
369
+ const strategy = flags.strategy || 'auto';
370
+ const mode = flags.mode || 'centralized';
371
+ const maxAgents = flags['max-agents'] || 5;
372
+
373
+ // Get strategy-specific guidance
374
+ const strategyGuidance = getStrategyGuidance(strategy, objective);
375
+ const modeGuidance = getModeGuidance(mode);
376
+ const agentRecommendations = getAgentRecommendations(strategy, maxAgents, objective);
377
+
378
+ const enableSparc =
379
+ flags.sparc !== false && (strategy === 'development' || strategy === 'auto');
380
+
381
+ // Build the complete swarm prompt before checking for claude
382
+ const swarmPrompt = `You are orchestrating a Claude Flow Swarm using Claude Code's Task tool for agent execution.
332
383
 
333
384
  🚨 CRITICAL INSTRUCTION: Use Claude Code's Task Tool for ALL Agent Spawning!
334
385
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -348,7 +399,9 @@ export async function swarmCommand(args, flags) {
348
399
  - Testing Mode: ${flags.testing || false}
349
400
  - Analysis Mode: ${isAnalysisMode ? 'ENABLED (Read-Only)' : 'DISABLED'}
350
401
 
351
- ${isAnalysisMode ? `🔍 ANALYSIS MODE CONSTRAINTS:
402
+ ${
403
+ isAnalysisMode
404
+ ? `🔍 ANALYSIS MODE CONSTRAINTS:
352
405
 
353
406
  ⚠️ READ-ONLY MODE ACTIVE - NO CODE MODIFICATIONS ALLOWED
354
407
 
@@ -381,7 +434,9 @@ ALL AGENTS MUST OPERATE IN READ-ONLY MODE. Focus on:
381
434
 
382
435
  Generate comprehensive reports instead of making changes.
383
436
 
384
- ` : ''}🚨 CRITICAL: PARALLEL EXECUTION IS MANDATORY! 🚨
437
+ `
438
+ : ''
439
+ }🚨 CRITICAL: PARALLEL EXECUTION IS MANDATORY! 🚨
385
440
 
386
441
  📋 CLAUDE-FLOW SWARM BATCHTOOL INSTRUCTIONS
387
442
 
@@ -592,7 +647,9 @@ ${agentRecommendations}
592
647
  - Tools: agent_communicate, memory_store/retrieve
593
648
 
594
649
  ⚡ EXECUTION WORKFLOW - ALWAYS USE BATCHTOOL:
595
- ${enableSparc ? `
650
+ ${
651
+ enableSparc
652
+ ? `
596
653
  1. SPARC METHODOLOGY WITH PARALLEL EXECUTION:
597
654
 
598
655
  S - Specification Phase (Single BatchTool):
@@ -640,7 +697,8 @@ ${enableSparc ? `
640
697
  mcp__claude-flow__memory_retrieve { pattern: "**/*" }
641
698
  TodoWrite { todos: [{content: "Final review", status: "completed"}] }
642
699
  \`\`\`
643
- ` : `
700
+ `
701
+ : `
644
702
  1. STANDARD SWARM EXECUTION WITH PARALLEL OPERATIONS:
645
703
 
646
704
  Initial Setup (Single BatchTool):
@@ -668,7 +726,8 @@ ${enableSparc ? `
668
726
  mcp__claude-flow__agent_communicate { to: "all", message: "Status update" }
669
727
  mcp__claude-flow__memory_store { key: "progress", value: {...} }
670
728
  \`\`\`
671
- `}
729
+ `
730
+ }
672
731
 
673
732
  🤝 AGENT TYPES & THEIR MCP TOOL USAGE:
674
733
 
@@ -733,207 +792,243 @@ Use hierarchical keys for organization:
733
792
  Start by spawning a coordinator agent and creating the initial task structure. Use the MCP tools to orchestrate the swarm, coordinate agents, and track progress. Remember to store important decisions and artifacts in collective memory for other agents to access.
734
793
 
735
794
  The swarm should be self-documenting - use memory_store to save all important information, decisions, and results throughout the execution.`;
736
- // If --claude flag is used, force Claude Code even if CLI not available
737
- if (flags && flags.claude) {
738
- // --claude flag means interactive mode, so don't apply non-interactive
739
- console.log('🐝 Launching Claude Flow Swarm System...');
740
- console.log(`📋 Objective: ${objective}`);
741
- console.log(`🎯 Strategy: ${strategy}`);
742
- console.log(`🏗️ Mode: ${mode}`);
743
- console.log(`🤖 Max Agents: ${maxAgents}\n`);
744
- console.log('🚀 Launching Claude Code with Swarm Coordination');
745
- console.log('─'.repeat(60));
746
- // Build arguments properly: for interactive mode, prompt can be first
747
- const claudeArgs = [];
748
- // Add auto-permission flag first
749
- if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) {
750
- claudeArgs.push('--dangerously-skip-permissions');
751
- console.log('🔓 Using --dangerously-skip-permissions by default for seamless swarm execution');
752
- }
753
- // Add the prompt (for interactive mode, position doesn't matter as much)
754
- claudeArgs.push(swarmPrompt);
755
- // --claude flag means interactive mode, so don't add non-interactive flags
756
- // For --claude interactive mode, spawn Claude directly
757
- // Temporarily disable telemetry to avoid console output interference
758
- const claudeEnv = {
759
- ...process.env
760
- };
761
- // Remove telemetry env vars to prevent console output
762
- delete claudeEnv.CLAUDE_CODE_ENABLE_TELEMETRY;
763
- delete claudeEnv.OTEL_METRICS_EXPORTER;
764
- delete claudeEnv.OTEL_LOGS_EXPORTER;
765
- const claudeProcess = spawn('claude', claudeArgs, {
766
- stdio: 'inherit',
767
- shell: false,
768
- env: claudeEnv
769
- });
770
- console.log('\n✓ Claude Code launched with swarm coordination prompt!');
771
- console.log(' The swarm coordinator will orchestrate all agent tasks');
772
- console.log(' Use MCP tools for coordination and memory sharing');
773
- console.log('\n💡 Pro Tips:');
774
- console.log('─'.repeat(30));
775
- console.log('• Use TodoWrite to track parallel tasks');
776
- console.log('• Store results with mcp__claude-flow__memory_usage');
777
- console.log('• Monitor progress with mcp__claude-flow__swarm_monitor');
778
- console.log('• Check task status with mcp__claude-flow__task_status');
779
- // Set up clean termination
780
- const cleanup = ()=>{
781
- console.log('\n🛑 Shutting down swarm gracefully...');
782
- if (claudeProcess && !claudeProcess.killed) {
783
- claudeProcess.kill('SIGTERM');
784
- }
785
- process.exit(0);
786
- };
787
- process.on('SIGINT', cleanup);
788
- process.on('SIGTERM', cleanup);
789
- // Wait for claude to exit
790
- claudeProcess.on('exit', (code)=>{
791
- if (code === 0) {
792
- console.log('\n✓ Swarm execution completed successfully');
793
- } else if (code !== null) {
794
- console.log(`\n✗ Swarm execution exited with code ${code}`);
795
- }
796
- process.exit(code || 0);
797
- });
798
- // Handle spawn errors (e.g., claude not found)
799
- claudeProcess.on('error', (err)=>{
800
- if (err.code === 'ENOENT') {
801
- console.error('\n❌ Claude Code CLI not found. Please install Claude Code:');
802
- console.error(' https://claude.ai/download');
803
- } else {
804
- console.error('\n❌ Failed to launch Claude Code:', err.message);
805
- }
806
- process.exit(1);
807
- });
808
- return;
809
- }
810
- // Check if we're in non-interactive/headless mode FIRST (like alpha.83)
811
- const isNonInteractive = flags['no-interactive'] || flags['non-interactive'] || flags['output-format'] === 'stream-json' || isHeadlessEnvironment();
812
- // Check if claude command exists
813
- let claudeAvailable = false;
814
- try {
815
- execSync('which claude', {
816
- stdio: 'ignore'
817
- });
818
- claudeAvailable = true;
819
- } catch {
820
- if (!isNonInteractive) {
821
- console.log('⚠️ Claude Code CLI not found in PATH');
822
- console.log('Install it with: npm install -g @anthropic-ai/claude-code');
823
- console.log('Or use --claude flag to open Claude Code CLI');
824
- console.log('\nWould spawn Claude Code with swarm objective:');
825
- console.log(`📋 Objective: ${objective}`);
826
- console.log('\nOptions:');
827
- console.log(' • Use --executor flag for built-in executor: claude-flow-novice swarm "objective" --executor');
828
- console.log(' • Use --claude flag to open Claude Code CLI: claude-flow-novice swarm "objective" --claude');
829
- } else {
830
- // In non-interactive mode, output JSON error
831
- console.error(JSON.stringify({
832
- error: 'Claude Code CLI not found',
833
- message: 'Install with: npm install -g @anthropic-ai/claude-code',
834
- fallback: 'Use --executor flag for built-in executor'
835
- }));
836
- }
837
- return;
838
- }
839
- // Claude is available, use it to run swarm
840
- if (!isNonInteractive) {
841
- console.log('🐝 Launching Claude Flow Swarm System...');
842
- console.log(`📋 Objective: ${objective}`);
843
- console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
844
- console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
845
- console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
846
- if (isAnalysisMode) {
847
- console.log(`🔍 Analysis Mode: ENABLED (Read-Only - No Code Changes)`);
848
- }
849
- console.log();
850
- } else {
851
- // Non-interactive mode output
852
- console.log('🤖 Running in non-interactive mode with Claude');
853
- console.log('📋 Command: claude [prompt] -p --output-format stream-json --verbose');
854
- }
855
- // Continue with the default swarm behavior if not using --claude flag
856
- // Build arguments in correct order: flags first, then prompt
857
- const claudeArgs = [];
858
- // Add non-interactive flags FIRST if needed
859
- if (isNonInteractive) {
860
- claudeArgs.push('-p'); // Print mode
861
- claudeArgs.push('--output-format', 'stream-json'); // JSON streaming
862
- claudeArgs.push('--verbose'); // Verbose output
863
- }
864
- // Add auto-permission flag BEFORE the prompt
865
- if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) {
866
- claudeArgs.push('--dangerously-skip-permissions');
867
- if (!isNonInteractive) {
868
- console.log('🔓 Using --dangerously-skip-permissions by default for seamless swarm execution');
869
- }
870
- }
871
- // Add the prompt as the LAST argument
872
- claudeArgs.push(swarmPrompt);
873
- // Spawn claude with properly ordered arguments
874
- const claudeProcess = spawn('claude', claudeArgs, {
875
- stdio: 'inherit',
876
- shell: false
877
- });
878
- if (!isNonInteractive) {
879
- console.log('✓ Claude Code launched with swarm coordination prompt!');
880
- console.log('\n🚀 The swarm coordination instructions have been injected into Claude Code');
881
- console.log(' The prompt includes:');
882
- console.log(' • Strategy-specific guidance for', strategy);
883
- console.log(' • Coordination patterns for', mode, 'mode');
884
- console.log(' • Recommended agents and MCP tool usage');
885
- console.log(' • Complete workflow documentation\n');
886
- }
887
- // Handle process events
888
- claudeProcess.on('error', (err)=>{
889
- console.error('❌ Failed to launch Claude Code:', err.message);
890
- });
891
- // Don't wait for completion - let it run
892
- return;
893
- } catch (error) {
894
- console.error('❌ Failed to spawn Claude Code:', error.message);
895
- console.log('\nFalling back to built-in executor...');
896
- // Fall through to executor implementation
795
+
796
+ // If --claude flag is used, force Claude Code even if CLI not available
797
+ if (flags && flags.claude) {
798
+ // --claude flag means interactive mode, so don't apply non-interactive
799
+ console.log('🐝 Launching Claude Flow Swarm System...');
800
+ console.log(`📋 Objective: ${objective}`);
801
+ console.log(`🎯 Strategy: ${strategy}`);
802
+ console.log(`🏗️ Mode: ${mode}`);
803
+ console.log(`🤖 Max Agents: ${maxAgents}\n`);
804
+
805
+ console.log('🚀 Launching Claude Code with Swarm Coordination');
806
+ console.log('─'.repeat(60));
807
+
808
+ // Build arguments properly: for interactive mode, prompt can be first
809
+ const claudeArgs = [];
810
+
811
+ // Add auto-permission flag first
812
+ if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) {
813
+ claudeArgs.push('--dangerously-skip-permissions');
814
+ console.log(
815
+ '🔓 Using --dangerously-skip-permissions by default for seamless swarm execution',
816
+ );
897
817
  }
818
+
819
+ // Add the prompt (for interactive mode, position doesn't matter as much)
820
+ claudeArgs.push(swarmPrompt);
821
+
822
+ // --claude flag means interactive mode, so don't add non-interactive flags
823
+
824
+ // For --claude interactive mode, spawn Claude directly
825
+ // Temporarily disable telemetry to avoid console output interference
826
+ const claudeEnv = { ...process.env };
827
+
828
+ // Remove telemetry env vars to prevent console output
829
+ delete claudeEnv.CLAUDE_CODE_ENABLE_TELEMETRY;
830
+ delete claudeEnv.OTEL_METRICS_EXPORTER;
831
+ delete claudeEnv.OTEL_LOGS_EXPORTER;
832
+
833
+ const claudeProcess = spawn('claude', claudeArgs, {
834
+ stdio: 'inherit',
835
+ shell: false,
836
+ env: claudeEnv,
837
+ });
838
+
839
+ console.log('\n✓ Claude Code launched with swarm coordination prompt!');
840
+ console.log(' The swarm coordinator will orchestrate all agent tasks');
841
+ console.log(' Use MCP tools for coordination and memory sharing');
842
+
843
+ console.log('\n💡 Pro Tips:');
844
+ console.log('─'.repeat(30));
845
+ console.log('• Use TodoWrite to track parallel tasks');
846
+ console.log('• Store results with mcp__claude-flow__memory_usage');
847
+ console.log('• Monitor progress with mcp__claude-flow__swarm_monitor');
848
+ console.log('• Check task status with mcp__claude-flow__task_status');
849
+
850
+ // Set up clean termination
851
+ const cleanup = () => {
852
+ console.log('\n🛑 Shutting down swarm gracefully...');
853
+ if (claudeProcess && !claudeProcess.killed) {
854
+ claudeProcess.kill('SIGTERM');
855
+ }
856
+ process.exit(0);
857
+ };
858
+
859
+ process.on('SIGINT', cleanup);
860
+ process.on('SIGTERM', cleanup);
861
+
862
+ // Wait for claude to exit
863
+ claudeProcess.on('exit', (code) => {
864
+ if (code === 0) {
865
+ console.log('\n✓ Swarm execution completed successfully');
866
+ } else if (code !== null) {
867
+ console.log(`\n✗ Swarm execution exited with code ${code}`);
868
+ }
869
+ process.exit(code || 0);
870
+ });
871
+
872
+ // Handle spawn errors (e.g., claude not found)
873
+ claudeProcess.on('error', (err) => {
874
+ if (err.code === 'ENOENT') {
875
+ console.error('\n❌ Claude Code CLI not found. Please install Claude Code:');
876
+ console.error(' https://claude.ai/download');
877
+ } else {
878
+ console.error('\n❌ Failed to launch Claude Code:', err.message);
879
+ }
880
+ process.exit(1);
881
+ });
882
+
883
+ return;
884
+ }
885
+
886
+ // Check if we're in non-interactive/headless mode FIRST (like alpha.83)
887
+ const isNonInteractive =
888
+ flags['no-interactive'] ||
889
+ flags['non-interactive'] ||
890
+ flags['output-format'] === 'stream-json' ||
891
+ isHeadlessEnvironment();
892
+
893
+ // Check if claude command exists
894
+ let claudeAvailable = false;
895
+ try {
896
+ execSync('which claude', { stdio: 'ignore' });
897
+ claudeAvailable = true;
898
+ } catch {
899
+ if (!isNonInteractive) {
900
+ console.log('⚠️ Claude Code CLI not found in PATH');
901
+ console.log('Install it with: npm install -g @anthropic-ai/claude-code');
902
+ console.log('Or use --claude flag to open Claude Code CLI');
903
+ console.log('\nWould spawn Claude Code with swarm objective:');
904
+ console.log(`📋 Objective: ${objective}`);
905
+ console.log('\nOptions:');
906
+ console.log(
907
+ ' • Use --executor flag for built-in executor: claude-flow-novice swarm "objective" --executor',
908
+ );
909
+ console.log(
910
+ ' • Use --claude flag to open Claude Code CLI: claude-flow-novice swarm "objective" --claude',
911
+ );
912
+ } else {
913
+ // In non-interactive mode, output JSON error
914
+ console.error(
915
+ JSON.stringify({
916
+ error: 'Claude Code CLI not found',
917
+ message: 'Install with: npm install -g @anthropic-ai/claude-code',
918
+ fallback: 'Use --executor flag for built-in executor',
919
+ }),
920
+ );
921
+ }
922
+ return;
923
+ }
924
+
925
+ // Claude is available, use it to run swarm
926
+ if (!isNonInteractive) {
927
+ console.log('🐝 Launching Claude Flow Swarm System...');
928
+ console.log(`📋 Objective: ${objective}`);
929
+ console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
930
+ console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
931
+ console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
932
+ if (isAnalysisMode) {
933
+ console.log(`🔍 Analysis Mode: ENABLED (Read-Only - No Code Changes)`);
934
+ }
935
+ console.log();
936
+ } else {
937
+ // Non-interactive mode output
938
+ console.log('🤖 Running in non-interactive mode with Claude');
939
+ console.log('📋 Command: claude [prompt] -p --output-format stream-json --verbose');
940
+ }
941
+
942
+ // Continue with the default swarm behavior if not using --claude flag
943
+
944
+ // Build arguments in correct order: flags first, then prompt
945
+ const claudeArgs = [];
946
+
947
+ // Add non-interactive flags FIRST if needed
948
+ if (isNonInteractive) {
949
+ claudeArgs.push('-p'); // Print mode
950
+ claudeArgs.push('--output-format', 'stream-json'); // JSON streaming
951
+ claudeArgs.push('--verbose'); // Verbose output
952
+ }
953
+
954
+ // Add auto-permission flag BEFORE the prompt
955
+ if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) {
956
+ claudeArgs.push('--dangerously-skip-permissions');
957
+ if (!isNonInteractive) {
958
+ console.log(
959
+ '🔓 Using --dangerously-skip-permissions by default for seamless swarm execution',
960
+ );
961
+ }
962
+ }
963
+
964
+ // Add the prompt as the LAST argument
965
+ claudeArgs.push(swarmPrompt);
966
+
967
+ // Spawn claude with properly ordered arguments
968
+ const claudeProcess = spawn('claude', claudeArgs, {
969
+ stdio: 'inherit',
970
+ shell: false,
971
+ });
972
+
973
+ if (!isNonInteractive) {
974
+ console.log('✓ Claude Code launched with swarm coordination prompt!');
975
+ console.log('\n🚀 The swarm coordination instructions have been injected into Claude Code');
976
+ console.log(' The prompt includes:');
977
+ console.log(' • Strategy-specific guidance for', strategy);
978
+ console.log(' • Coordination patterns for', mode, 'mode');
979
+ console.log(' • Recommended agents and MCP tool usage');
980
+ console.log(' • Complete workflow documentation\n');
981
+ }
982
+
983
+ // Handle process events
984
+ claudeProcess.on('error', (err) => {
985
+ console.error('❌ Failed to launch Claude Code:', err.message);
986
+ });
987
+
988
+ // Don't wait for completion - let it run
989
+ return;
990
+ } catch (error) {
991
+ console.error('❌ Failed to spawn Claude Code:', error.message);
992
+ console.log('\nFalling back to built-in executor...');
993
+ // Fall through to executor implementation
898
994
  }
899
- // Check if we should run in background mode
900
- if (flags && flags.background && !process.env.CLAUDE_SWARM_NO_BG) {
901
- // Check if we're in Deno environment
902
- if (typeof Deno !== 'undefined') {
903
- // In Deno, spawn a new process for true background execution
904
- const objective = (args || []).join(' ').trim();
905
- const swarmId = `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
906
- const swarmRunDir = `./swarm-runs/${swarmId}`;
907
- // Create swarm directory
908
- await mkdirAsync(swarmRunDir, {
909
- recursive: true
910
- });
911
- console.log(`🐝 Launching swarm in background mode...`);
912
- console.log(`📋 Objective: ${objective}`);
913
- console.log(`🆔 Swarm ID: ${swarmId}`);
914
- console.log(`📁 Results: ${swarmRunDir}`);
915
- // Build command args without background flag (to prevent infinite loop)
916
- const commandArgs = [
917
- 'run',
918
- '--allow-all',
919
- import.meta.url,
920
- objective
921
- ];
922
- const newFlags = {
923
- ...flags
924
- };
925
- delete newFlags.background; // Remove background flag
926
- for (const [key, value] of Object.entries(newFlags)){
927
- commandArgs.push(`--${key}`);
928
- if (value !== true) {
929
- commandArgs.push(String(value));
930
- }
931
- }
932
- // Create log file
933
- const logFile = `${swarmRunDir}/swarm.log`;
934
- const logHandle = await open(logFile, 'w');
935
- // Create a script to run the swarm without background flag
936
- const scriptContent = `#!/usr/bin/env -S deno run --allow-all
995
+ }
996
+
997
+ // Check if we should run in background mode
998
+ if (flags && flags.background && !process.env.CLAUDE_SWARM_NO_BG) {
999
+ // Check if we're in Deno environment
1000
+ if (typeof Deno !== 'undefined') {
1001
+ // In Deno, spawn a new process for true background execution
1002
+ const objective = (args || []).join(' ').trim();
1003
+ const swarmId = `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
1004
+ const swarmRunDir = `./swarm-runs/${swarmId}`;
1005
+
1006
+ // Create swarm directory
1007
+ await mkdirAsync(swarmRunDir, { recursive: true });
1008
+
1009
+ console.log(`🐝 Launching swarm in background mode...`);
1010
+ console.log(`📋 Objective: ${objective}`);
1011
+ console.log(`🆔 Swarm ID: ${swarmId}`);
1012
+ console.log(`📁 Results: ${swarmRunDir}`);
1013
+
1014
+ // Build command args without background flag (to prevent infinite loop)
1015
+ const commandArgs = ['run', '--allow-all', import.meta.url, objective];
1016
+ const newFlags = { ...flags };
1017
+ delete newFlags.background; // Remove background flag
1018
+
1019
+ for (const [key, value] of Object.entries(newFlags)) {
1020
+ commandArgs.push(`--${key}`);
1021
+ if (value !== true) {
1022
+ commandArgs.push(String(value));
1023
+ }
1024
+ }
1025
+
1026
+ // Create log file
1027
+ const logFile = `${swarmRunDir}/swarm.log`;
1028
+ const logHandle = await open(logFile, 'w');
1029
+
1030
+ // Create a script to run the swarm without background flag
1031
+ const scriptContent = `#!/usr/bin/env -S deno run --allow-all
937
1032
  import { swarmCommand } from "${import.meta.url}";
938
1033
  import { cwd, exit, existsSync } from '../node-compat.js';
939
1034
  import process from 'process';
@@ -948,53 +1043,64 @@ process.env.CLAUDE_SWARM_NO_BG = 'true';
948
1043
  // Run the swarm
949
1044
  await swarmCommand(args, flags);
950
1045
  `;
951
- const scriptPath = `${swarmRunDir}/run-swarm.js`;
952
- await writeTextFile(scriptPath, scriptContent);
953
- // Save process info first
954
- await writeTextFile(`${swarmRunDir}/process.json`, JSON.stringify({
955
- swarmId: swarmId,
956
- objective: objective,
957
- startTime: new Date().toISOString(),
958
- logFile: logFile,
959
- status: 'starting'
960
- }, null, 2));
961
- // Close log handle before spawning
962
- logHandle.close();
963
- // Use the bash script for true background execution
964
- const binDir = new URL('../../../bin/', import.meta.url).pathname;
965
- const bgScriptPath = `${binDir}claude-flow-swarm-bg`;
966
- try {
967
- // Check if the background script exists
968
- statSync(bgScriptPath);
969
- // Build command args for the background script
970
- const bgArgs = [
971
- objective
972
- ];
973
- for (const [key, value] of Object.entries(newFlags)){
974
- bgArgs.push(`--${key}`);
975
- if (value !== true) {
976
- bgArgs.push(String(value));
977
- }
978
- }
979
- // Use the bash background script
980
- const bgProcess = spawn(bgScriptPath, bgArgs, {
981
- stdio: [
982
- 'ignore',
983
- 'pipe',
984
- 'pipe'
985
- ]
986
- });
987
- // Read and display output
988
- const decoder = new TextDecoder();
989
- const output = await bgProcess.output();
990
- console.log(decoder.decode(output.stdout));
991
- // Exit immediately after launching
992
- exit(0);
993
- } catch (error) {
994
- // Fallback: create a double-fork pattern using a shell script
995
- console.log(`\n⚠️ Background script not found, using fallback method`);
996
- // Create a shell script that will run the swarm
997
- const shellScript = `#!/bin/bash
1046
+
1047
+ const scriptPath = `${swarmRunDir}/run-swarm.js`;
1048
+ await writeTextFile(scriptPath, scriptContent);
1049
+
1050
+ // Save process info first
1051
+ await writeTextFile(
1052
+ `${swarmRunDir}/process.json`,
1053
+ JSON.stringify(
1054
+ {
1055
+ swarmId: swarmId,
1056
+ objective: objective,
1057
+ startTime: new Date().toISOString(),
1058
+ logFile: logFile,
1059
+ status: 'starting',
1060
+ },
1061
+ null,
1062
+ 2,
1063
+ ),
1064
+ );
1065
+
1066
+ // Close log handle before spawning
1067
+ logHandle.close();
1068
+
1069
+ // Use the bash script for true background execution
1070
+ const binDir = new URL('../../../bin/', import.meta.url).pathname;
1071
+ const bgScriptPath = `${binDir}claude-flow-swarm-bg`;
1072
+
1073
+ try {
1074
+ // Check if the background script exists
1075
+ statSync(bgScriptPath);
1076
+
1077
+ // Build command args for the background script
1078
+ const bgArgs = [objective];
1079
+ for (const [key, value] of Object.entries(newFlags)) {
1080
+ bgArgs.push(`--${key}`);
1081
+ if (value !== true) {
1082
+ bgArgs.push(String(value));
1083
+ }
1084
+ }
1085
+
1086
+ // Use the bash background script
1087
+ const bgProcess = spawn(bgScriptPath, bgArgs, {
1088
+ stdio: ['ignore', 'pipe', 'pipe'],
1089
+ });
1090
+
1091
+ // Read and display output
1092
+ const decoder = new TextDecoder();
1093
+ const output = await bgProcess.output();
1094
+ console.log(decoder.decode(output.stdout));
1095
+
1096
+ // Exit immediately after launching
1097
+ exit(0);
1098
+ } catch (error) {
1099
+ // Fallback: create a double-fork pattern using a shell script
1100
+ console.log(`\n⚠️ Background script not found, using fallback method`);
1101
+
1102
+ // Create a shell script that will run the swarm
1103
+ const shellScript = `#!/bin/bash
998
1104
  # Double fork to detach from parent
999
1105
  (
1000
1106
  (
@@ -1004,231 +1110,262 @@ await swarmCommand(args, flags);
1004
1110
  )
1005
1111
  exit 0
1006
1112
  `;
1007
- const shellScriptPath = `${swarmRunDir}/launch-background.sh`;
1008
- await writeTextFile(shellScriptPath, shellScript);
1009
- chmodSync(shellScriptPath, 0o755);
1010
- // Execute the shell script
1011
- const shellProcess = spawn('bash', [
1012
- shellScriptPath
1013
- ], {
1014
- stdio: 'ignore',
1015
- detached: true
1016
- });
1017
- shellProcess.unref();
1018
- console.log(`\n✅ Swarm launched in background!`);
1019
- console.log(`📄 Logs: tail -f ${logFile}`);
1020
- console.log(`📊 Status: claude-flow-novice swarm status ${swarmId}`);
1021
- console.log(`\nThe swarm will continue running independently.`);
1022
- // Exit immediately
1023
- exit(0);
1024
- }
1025
- }
1026
- // Node.js environment - use background script
1027
- const { execSync } = await import("child_process");
1028
- const path = await import("path");
1029
- const fs = await import("fs");
1030
- const objective = (args || []).join(' ').trim();
1031
- // Get the claude-flow-swarm-bg script path
1032
- const bgScriptPath = path.join(path.dirname(new URL(import.meta.url).pathname), '../../../bin/claude-flow-swarm-bg');
1033
- // Check if background script exists
1034
- if (fs.existsSync(bgScriptPath)) {
1035
- // Build command args
1036
- const commandArgs = [
1037
- objective
1038
- ];
1039
- for (const [key, value] of Object.entries(flags)){
1040
- if (key !== 'background') {
1041
- // Skip background flag
1042
- commandArgs.push(`--${key}`);
1043
- if (value !== true) {
1044
- commandArgs.push(String(value));
1045
- }
1046
- }
1047
- }
1048
- // Execute the background script
1049
- try {
1050
- execSync(`"${bgScriptPath}" ${commandArgs.map((arg)=>`"${arg}"`).join(' ')}`, {
1051
- stdio: 'inherit'
1052
- });
1053
- } catch (error) {
1054
- console.error('Failed to launch background swarm:', error.message);
1055
- }
1056
- } else {
1057
- // Fallback to simple message
1058
- console.log(`🐝 Background mode requested`);
1059
- console.log(`📋 Objective: ${objective}`);
1060
- console.log(`\n⚠️ Background execution requires the claude-flow-swarm-bg script.`);
1061
- console.log(`\nFor true background execution, use:`);
1062
- console.log(` nohup claude-flow-novice swarm "${objective}" ${Object.entries(flags).filter(([k, v])=>k !== 'background' && v).map(([k, v])=>`--${k}${v !== true ? ` ${v}` : ''}`).join(' ')} > swarm.log 2>&1 &`);
1113
+
1114
+ const shellScriptPath = `${swarmRunDir}/launch-background.sh`;
1115
+ await writeTextFile(shellScriptPath, shellScript);
1116
+ chmodSync(shellScriptPath, 0o755);
1117
+
1118
+ // Execute the shell script
1119
+ const shellProcess = spawn('bash', [shellScriptPath], {
1120
+ stdio: 'ignore',
1121
+ detached: true,
1122
+ });
1123
+ shellProcess.unref();
1124
+
1125
+ console.log(`\n✅ Swarm launched in background!`);
1126
+ console.log(`📄 Logs: tail -f ${logFile}`);
1127
+ console.log(`📊 Status: claude-flow-novice swarm status ${swarmId}`);
1128
+ console.log(`\nThe swarm will continue running independently.`);
1129
+
1130
+ // Exit immediately
1131
+ exit(0);
1132
+ }
1133
+ }
1134
+
1135
+ // Node.js environment - use background script
1136
+ const { execSync } = await import('child_process');
1137
+ const path = await import('path');
1138
+ const fs = await import('fs');
1139
+
1140
+ const objective = (args || []).join(' ').trim();
1141
+
1142
+ // Get the claude-flow-swarm-bg script path
1143
+ const bgScriptPath = path.join(
1144
+ path.dirname(new URL(import.meta.url).pathname),
1145
+ '../../../bin/claude-flow-swarm-bg',
1146
+ );
1147
+
1148
+ // Check if background script exists
1149
+ if (fs.existsSync(bgScriptPath)) {
1150
+ // Build command args
1151
+ const commandArgs = [objective];
1152
+ for (const [key, value] of Object.entries(flags)) {
1153
+ if (key !== 'background') {
1154
+ // Skip background flag
1155
+ commandArgs.push(`--${key}`);
1156
+ if (value !== true) {
1157
+ commandArgs.push(String(value));
1158
+ }
1063
1159
  }
1064
- return;
1160
+ }
1161
+
1162
+ // Execute the background script
1163
+ try {
1164
+ execSync(`"${bgScriptPath}" ${commandArgs.map((arg) => `"${arg}"`).join(' ')}`, {
1165
+ stdio: 'inherit',
1166
+ });
1167
+ } catch (error) {
1168
+ console.error('Failed to launch background swarm:', error.message);
1169
+ }
1170
+ } else {
1171
+ // Fallback to simple message
1172
+ console.log(`🐝 Background mode requested`);
1173
+ console.log(`📋 Objective: ${objective}`);
1174
+ console.log(`\n⚠️ Background execution requires the claude-flow-swarm-bg script.`);
1175
+ console.log(`\nFor true background execution, use:`);
1176
+ console.log(
1177
+ ` nohup claude-flow-novice swarm "${objective}" ${Object.entries(flags)
1178
+ .filter(([k, v]) => k !== 'background' && v)
1179
+ .map(([k, v]) => `--${k}${v !== true ? ` ${v}` : ''}`)
1180
+ .join(' ')} > swarm.log 2>&1 &`,
1181
+ );
1065
1182
  }
1183
+ return;
1184
+ }
1185
+
1186
+ try {
1187
+ // Try to load the compiled JavaScript module first
1188
+ let swarmAction;
1066
1189
  try {
1067
- // Try to load the compiled JavaScript module first
1068
- let swarmAction;
1190
+ // Try the compiled version first (for production/npm packages)
1191
+ const distPath = new URL('../../../dist/cli/commands/swarm-new.js', import.meta.url);
1192
+ const module = await import(distPath);
1193
+ swarmAction = module.swarmAction;
1194
+ } catch (distError) {
1195
+ // Instead of immediately falling back to basic mode,
1196
+ // continue to the Claude integration below
1197
+ console.log('📦 Compiled swarm module not found, checking for Claude CLI...');
1198
+ }
1199
+
1200
+ // Only call swarmAction if it was successfully loaded
1201
+ if (swarmAction) {
1202
+ // Create command context compatible with TypeScript version
1203
+ const ctx = {
1204
+ args: args || [],
1205
+ flags: flags || {},
1206
+ command: 'swarm',
1207
+ };
1208
+
1209
+ await swarmAction(ctx);
1210
+ return; // Exit after successful execution
1211
+ }
1212
+ } catch (error) {
1213
+ // If import fails (e.g., in node_modules), provide inline implementation
1214
+ if (
1215
+ error.code === 'ERR_MODULE_NOT_FOUND' ||
1216
+ error.code === 'ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING' ||
1217
+ error.code === 'ERR_UNKNOWN_FILE_EXTENSION'
1218
+ ) {
1219
+ // Provide a basic swarm implementation that works without TypeScript imports
1220
+ const objective = (args || []).join(' ').trim();
1221
+
1222
+ if (!objective) {
1223
+ console.error('❌ Usage: swarm <objective>');
1224
+ showSwarmHelp();
1225
+ return;
1226
+ }
1227
+
1228
+ // Try to use the swarm executor directly
1229
+ try {
1230
+ const { executeSwarm } = await import('./swarm-executor.js');
1231
+ const result = await executeSwarm(objective, flags);
1232
+
1233
+ // If execution was successful, exit
1234
+ if (result && result.success) {
1235
+ return;
1236
+ }
1237
+ } catch (execError) {
1238
+ console.log(`⚠️ Swarm executor error: ${execError.message}`);
1239
+ // If swarm executor fails, try to create files directly
1069
1240
  try {
1070
- // Try the compiled version first (for production/npm packages)
1071
- const distPath = new URL('../../../dist/cli/commands/swarm-new.js', import.meta.url);
1072
- const module = await import(distPath);
1073
- swarmAction = module.swarmAction;
1074
- } catch (distError) {
1075
- // Instead of immediately falling back to basic mode,
1076
- // continue to the Claude integration below
1077
- console.log('📦 Compiled swarm module not found, checking for Claude CLI...');
1241
+ await createSwarmFiles(objective, flags);
1242
+ return;
1243
+ } catch (createError) {
1244
+ console.log(`⚠️ Direct file creation error: ${createError.message}`);
1245
+ // Continue with fallback implementation
1078
1246
  }
1079
- // Only call swarmAction if it was successfully loaded
1080
- if (swarmAction) {
1081
- // Create command context compatible with TypeScript version
1082
- const ctx = {
1083
- args: args || [],
1084
- flags: flags || {},
1085
- command: 'swarm'
1086
- };
1087
- await swarmAction(ctx);
1088
- return; // Exit after successful execution
1247
+ }
1248
+
1249
+ // Provide a basic inline swarm implementation for npm packages
1250
+ console.log('🐝 Launching swarm system...');
1251
+ console.log(`📋 Objective: ${objective}`);
1252
+ console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
1253
+ console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
1254
+ console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
1255
+ console.log();
1256
+
1257
+ // Generate swarm ID
1258
+ const swarmId = `swarm_${Math.random().toString(36).substring(2, 11)}_${Math.random().toString(36).substring(2, 11)}`;
1259
+
1260
+ if (flags['dry-run']) {
1261
+ console.log(`🆔 Swarm ID: ${swarmId}`);
1262
+ console.log(`📊 Max Tasks: ${flags['max-tasks'] || 100}`);
1263
+ console.log(`⏰ Timeout: ${flags.timeout || 60} minutes`);
1264
+ console.log(`🔄 Parallel: ${flags.parallel || false}`);
1265
+ console.log(`🌐 Distributed: ${flags.distributed || false}`);
1266
+ console.log(`🔍 Monitoring: ${flags.monitor || false}`);
1267
+ console.log(`👥 Review Mode: ${flags.review || false}`);
1268
+ console.log(`🧪 Testing: ${flags.testing || false}`);
1269
+ console.log(`🧠 Memory Namespace: ${flags['memory-namespace'] || 'swarm'}`);
1270
+ console.log(`💾 Persistence: ${flags.persistence !== false}`);
1271
+ console.log(`🔒 Encryption: ${flags.encryption || false}`);
1272
+ console.log(`📊 Quality Threshold: ${flags['quality-threshold'] || 0.8}`);
1273
+ console.log();
1274
+ console.log('🎛️ Coordination Strategy:');
1275
+ console.log(` • Agent Selection: ${flags['agent-selection'] || 'capability-based'}`);
1276
+ console.log(` • Task Scheduling: ${flags['task-scheduling'] || 'priority'}`);
1277
+ console.log(` • Load Balancing: ${flags['load-balancing'] || 'work-stealing'}`);
1278
+ console.log(` • Fault Tolerance: ${flags['fault-tolerance'] || 'retry'}`);
1279
+ console.log(` • Communication: ${flags.communication || 'event-driven'}`);
1280
+ console.log('⚠️ DRY RUN - Advanced Swarm Configuration');
1281
+ return;
1282
+ }
1283
+
1284
+ // For actual execution in npm context, try to find and run swarm-demo.ts
1285
+ try {
1286
+ const path = await import('path');
1287
+ const { fileURLToPath } = await import('url');
1288
+ const fs = await import('fs');
1289
+ const { spawn } = await import('child_process');
1290
+
1291
+ const __filename = fileURLToPath(import.meta.url);
1292
+ const __dirname = path.dirname(__filename);
1293
+
1294
+ // Look for swarm-demo.ts in the package
1295
+ const possiblePaths = [
1296
+ path.join(__dirname, '../../../swarm-demo.ts'),
1297
+ path.join(__dirname, '../../swarm-demo.ts'),
1298
+ ];
1299
+
1300
+ let swarmDemoPath = null;
1301
+ for (const p of possiblePaths) {
1302
+ if (fs.existsSync(p)) {
1303
+ swarmDemoPath = p;
1304
+ break;
1305
+ }
1089
1306
  }
1090
- } catch (error) {
1091
- // If import fails (e.g., in node_modules), provide inline implementation
1092
- if (error.code === 'ERR_MODULE_NOT_FOUND' || error.code === 'ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING' || error.code === 'ERR_UNKNOWN_FILE_EXTENSION') {
1093
- // Provide a basic swarm implementation that works without TypeScript imports
1094
- const objective = (args || []).join(' ').trim();
1095
- if (!objective) {
1096
- console.error('❌ Usage: swarm <objective>');
1097
- showSwarmHelp();
1098
- return;
1099
- }
1100
- // Try to use the swarm executor directly
1101
- try {
1102
- const { executeSwarm } = await import("./swarm-executor.js");
1103
- const result = await executeSwarm(objective, flags);
1104
- // If execution was successful, exit
1105
- if (result && result.success) {
1106
- return;
1107
- }
1108
- } catch (execError) {
1109
- console.log(`⚠️ Swarm executor error: ${execError.message}`);
1110
- // If swarm executor fails, try to create files directly
1111
- try {
1112
- await createSwarmFiles(objective, flags);
1113
- return;
1114
- } catch (createError) {
1115
- console.log(`⚠️ Direct file creation error: ${createError.message}`);
1116
- // Continue with fallback implementation
1117
- }
1118
- }
1119
- // Provide a basic inline swarm implementation for npm packages
1120
- console.log('🐝 Launching swarm system...');
1121
- console.log(`📋 Objective: ${objective}`);
1122
- console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
1123
- console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
1124
- console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
1125
- console.log();
1126
- // Generate swarm ID
1127
- const swarmId = `swarm_${Math.random().toString(36).substring(2, 11)}_${Math.random().toString(36).substring(2, 11)}`;
1128
- if (flags['dry-run']) {
1129
- console.log(`🆔 Swarm ID: ${swarmId}`);
1130
- console.log(`📊 Max Tasks: ${flags['max-tasks'] || 100}`);
1131
- console.log(`⏰ Timeout: ${flags.timeout || 60} minutes`);
1132
- console.log(`🔄 Parallel: ${flags.parallel || false}`);
1133
- console.log(`🌐 Distributed: ${flags.distributed || false}`);
1134
- console.log(`🔍 Monitoring: ${flags.monitor || false}`);
1135
- console.log(`👥 Review Mode: ${flags.review || false}`);
1136
- console.log(`🧪 Testing: ${flags.testing || false}`);
1137
- console.log(`🧠 Memory Namespace: ${flags['memory-namespace'] || 'swarm'}`);
1138
- console.log(`💾 Persistence: ${flags.persistence !== false}`);
1139
- console.log(`🔒 Encryption: ${flags.encryption || false}`);
1140
- console.log(`📊 Quality Threshold: ${flags['quality-threshold'] || 0.8}`);
1141
- console.log();
1142
- console.log('🎛️ Coordination Strategy:');
1143
- console.log(` • Agent Selection: ${flags['agent-selection'] || 'capability-based'}`);
1144
- console.log(` • Task Scheduling: ${flags['task-scheduling'] || 'priority'}`);
1145
- console.log(` • Load Balancing: ${flags['load-balancing'] || 'work-stealing'}`);
1146
- console.log(` • Fault Tolerance: ${flags['fault-tolerance'] || 'retry'}`);
1147
- console.log(` • Communication: ${flags.communication || 'event-driven'}`);
1148
- console.log('⚠️ DRY RUN - Advanced Swarm Configuration');
1149
- return;
1307
+
1308
+ if (swarmDemoPath && Deno) {
1309
+ // Run swarm-demo.ts directly with Deno
1310
+ const swarmArgs = [objective];
1311
+ for (const [key, value] of Object.entries(flags || {})) {
1312
+ swarmArgs.push(`--${key}`);
1313
+ if (value !== true) {
1314
+ swarmArgs.push(String(value));
1150
1315
  }
1151
- // For actual execution in npm context, try to find and run swarm-demo.ts
1152
- try {
1153
- const path = await import("path");
1154
- const { fileURLToPath } = await import("url");
1155
- const fs = await import("fs");
1156
- const { spawn } = await import("child_process");
1157
- const __filename = fileURLToPath(import.meta.url);
1158
- const __dirname = path.dirname(__filename);
1159
- // Look for swarm-demo.ts in the package
1160
- const possiblePaths = [
1161
- path.join(__dirname, '../../../swarm-demo.ts'),
1162
- path.join(__dirname, '../../swarm-demo.ts')
1163
- ];
1164
- let swarmDemoPath = null;
1165
- for (const p of possiblePaths){
1166
- if (fs.existsSync(p)) {
1167
- swarmDemoPath = p;
1168
- break;
1169
- }
1170
- }
1171
- if (swarmDemoPath && Deno) {
1172
- // Run swarm-demo.ts directly with Deno
1173
- const swarmArgs = [
1174
- objective
1175
- ];
1176
- for (const [key, value] of Object.entries(flags || {})){
1177
- swarmArgs.push(`--${key}`);
1178
- if (value !== true) {
1179
- swarmArgs.push(String(value));
1180
- }
1181
- }
1182
- console.log('🚀 Starting advanced swarm execution...');
1183
- const swarmProcess = spawn('node', [
1184
- swarmDemoPath,
1185
- ...swarmArgs
1186
- ], {
1187
- stdio: 'inherit'
1188
- });
1189
- swarmProcess.on('error', (err)=>{
1190
- console.error('❌ Failed to launch swarm:', err.message);
1191
- });
1192
- swarmProcess.on('exit', (code)=>{
1193
- if (code !== 0) {
1194
- console.error(`❌ Swarm exited with code ${code}`);
1195
- }
1196
- });
1197
- return;
1198
- }
1199
- } catch (e) {
1200
- // Fallback to basic message if can't run swarm-demo.ts
1316
+ }
1317
+
1318
+ console.log('🚀 Starting advanced swarm execution...');
1319
+ const swarmProcess = spawn('node', [swarmDemoPath, ...swarmArgs], {
1320
+ stdio: 'inherit',
1321
+ });
1322
+
1323
+ swarmProcess.on('error', (err) => {
1324
+ console.error('❌ Failed to launch swarm:', err.message);
1325
+ });
1326
+
1327
+ swarmProcess.on('exit', (code) => {
1328
+ if (code !== 0) {
1329
+ console.error(`❌ Swarm exited with code ${code}`);
1201
1330
  }
1202
- // Try to use Claude wrapper approach like SPARC does
1203
- try {
1204
- const { execSync } = await import("child_process");
1205
- // Check if claude command exists
1206
- try {
1207
- execSync('which claude', {
1208
- stdio: 'ignore'
1209
- });
1210
- } catch (e) {
1211
- // Claude not found, show fallback message
1212
- console.log(`✅ Swarm initialized with ID: ${swarmId}`);
1213
- console.log('\n⚠️ Note: Advanced swarm features require Claude or local installation.');
1214
- console.log('Install Claude: https://claude.ai/code');
1215
- console.log('Or install locally: npm install -g claude-flow@latest');
1216
- console.log('\nThe swarm system would coordinate the following:');
1217
- console.log('1. Agent spawning and task distribution');
1218
- console.log('2. Parallel execution of subtasks');
1219
- console.log('3. Memory sharing between agents');
1220
- console.log('4. Progress monitoring and reporting');
1221
- console.log('5. Result aggregation and quality checks');
1222
- return;
1223
- }
1224
- // Claude is available, use it to run swarm
1225
- console.log('🚀 Launching swarm via Claude wrapper...');
1226
- if (flags.sparc !== false) {
1227
- console.log('🧪 SPARC methodology enabled - using full TDD workflow');
1228
- }
1229
- // Build the prompt for Claude using SPARC methodology
1230
- const enableSparc = flags.sparc !== false;
1231
- const swarmPrompt = `Execute a swarm coordination task using ${enableSparc ? 'the full SPARC methodology' : 'standard approach'}:
1331
+ });
1332
+ return;
1333
+ }
1334
+ } catch (e) {
1335
+ // Fallback to basic message if can't run swarm-demo.ts
1336
+ }
1337
+
1338
+ // Try to use Claude wrapper approach like SPARC does
1339
+ try {
1340
+ const { execSync } = await import('child_process');
1341
+
1342
+ // Check if claude command exists
1343
+ try {
1344
+ execSync('which claude', { stdio: 'ignore' });
1345
+ } catch (e) {
1346
+ // Claude not found, show fallback message
1347
+ console.log(`✅ Swarm initialized with ID: ${swarmId}`);
1348
+ console.log('\n⚠️ Note: Advanced swarm features require Claude or local installation.');
1349
+ console.log('Install Claude: https://claude.ai/code');
1350
+ console.log('Or install locally: npm install -g claude-flow@latest');
1351
+ console.log('\nThe swarm system would coordinate the following:');
1352
+ console.log('1. Agent spawning and task distribution');
1353
+ console.log('2. Parallel execution of subtasks');
1354
+ console.log('3. Memory sharing between agents');
1355
+ console.log('4. Progress monitoring and reporting');
1356
+ console.log('5. Result aggregation and quality checks');
1357
+ return;
1358
+ }
1359
+
1360
+ // Claude is available, use it to run swarm
1361
+ console.log('🚀 Launching swarm via Claude wrapper...');
1362
+ if (flags.sparc !== false) {
1363
+ console.log('🧪 SPARC methodology enabled - using full TDD workflow');
1364
+ }
1365
+
1366
+ // Build the prompt for Claude using SPARC methodology
1367
+ const enableSparc = flags.sparc !== false;
1368
+ const swarmPrompt = `Execute a swarm coordination task using ${enableSparc ? 'the full SPARC methodology' : 'standard approach'}:
1232
1369
 
1233
1370
  OBJECTIVE: ${objective}
1234
1371
 
@@ -1240,7 +1377,9 @@ CONFIGURATION:
1240
1377
  - Quality Threshold: ${flags['quality-threshold'] || 0.8}
1241
1378
  ${enableSparc ? '- SPARC Enabled: YES - Use full Specification, Pseudocode, Architecture, Refinement (TDD), Completion methodology' : ''}
1242
1379
 
1243
- ${enableSparc ? `
1380
+ ${
1381
+ enableSparc
1382
+ ? `
1244
1383
  SPARC METHODOLOGY REQUIREMENTS:
1245
1384
 
1246
1385
  1. SPECIFICATION PHASE:
@@ -1272,7 +1411,9 @@ SPARC METHODOLOGY REQUIREMENTS:
1272
1411
  - Create comprehensive documentation
1273
1412
  - Perform end-to-end testing
1274
1413
  - Validate against original requirements
1275
- ` : ''}
1414
+ `
1415
+ : ''
1416
+ }
1276
1417
 
1277
1418
  EXECUTION APPROACH:
1278
1419
  1. Analyze the objective and break it down into specific tasks
@@ -1295,56 +1436,62 @@ IMPORTANT:
1295
1436
  - Make the code production-ready, not just examples
1296
1437
 
1297
1438
  Begin execution now. Create all necessary files and provide a complete, working solution.`;
1298
- // Execute Claude non-interactively by piping the prompt
1299
- const { spawn } = await import("child_process");
1300
- const claudeArgs = [];
1301
- // Add auto-permission flag by default for swarm mode (unless explicitly disabled)
1302
- if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) {
1303
- claudeArgs.push('--dangerously-skip-permissions');
1304
- }
1305
- // Spawn claude process
1306
- const claudeProcess = spawn('claude', claudeArgs, {
1307
- stdio: [
1308
- 'pipe',
1309
- 'inherit',
1310
- 'inherit'
1311
- ],
1312
- shell: false
1313
- });
1314
- // Write the prompt to stdin and close it
1315
- claudeProcess.stdin.write(swarmPrompt);
1316
- claudeProcess.stdin.end();
1317
- // Wait for the process to complete
1318
- await new Promise((resolve, reject)=>{
1319
- claudeProcess.on('close', (code)=>{
1320
- if (code === 0) {
1321
- resolve();
1322
- } else {
1323
- reject(new Error(`Claude process exited with code ${code}`));
1324
- }
1325
- });
1326
- claudeProcess.on('error', (err)=>{
1327
- reject(err);
1328
- });
1329
- });
1330
- } catch (error) {
1331
- // Fallback if Claude execution fails
1332
- console.log(`✅ Swarm initialized with ID: ${swarmId}`);
1333
- console.log('\n⚠️ Note: Advanced swarm features require Claude or local installation.');
1334
- console.log('Install Claude: https://claude.ai/code');
1335
- console.log('Or install locally: npm install -g claude-flow@latest');
1336
- console.log('\nThe swarm system would coordinate the following:');
1337
- console.log('1. Agent spawning and task distribution');
1338
- console.log('2. Parallel execution of subtasks');
1339
- console.log('3. Memory sharing between agents');
1340
- console.log('4. Progress monitoring and reporting');
1341
- console.log('5. Result aggregation and quality checks');
1342
- }
1343
- return;
1439
+
1440
+ // Execute Claude non-interactively by piping the prompt
1441
+ const { spawn } = await import('child_process');
1442
+
1443
+ const claudeArgs = [];
1444
+
1445
+ // Add auto-permission flag by default for swarm mode (unless explicitly disabled)
1446
+ if (flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions']) {
1447
+ claudeArgs.push('--dangerously-skip-permissions');
1344
1448
  }
1345
- console.error('Swarm command error:', error);
1346
- // Fallback to comprehensive help if there's an import error
1347
- console.log(`
1449
+
1450
+ // Spawn claude process
1451
+ const claudeProcess = spawn('claude', claudeArgs, {
1452
+ stdio: ['pipe', 'inherit', 'inherit'],
1453
+ shell: false,
1454
+ });
1455
+
1456
+ // Write the prompt to stdin and close it
1457
+ claudeProcess.stdin.write(swarmPrompt);
1458
+ claudeProcess.stdin.end();
1459
+
1460
+ // Wait for the process to complete
1461
+ await new Promise((resolve, reject) => {
1462
+ claudeProcess.on('close', (code) => {
1463
+ if (code === 0) {
1464
+ resolve();
1465
+ } else {
1466
+ reject(new Error(`Claude process exited with code ${code}`));
1467
+ }
1468
+ });
1469
+
1470
+ claudeProcess.on('error', (err) => {
1471
+ reject(err);
1472
+ });
1473
+ });
1474
+ } catch (error) {
1475
+ // Fallback if Claude execution fails
1476
+ console.log(`✅ Swarm initialized with ID: ${swarmId}`);
1477
+ console.log('\n⚠️ Note: Advanced swarm features require Claude or local installation.');
1478
+ console.log('Install Claude: https://claude.ai/code');
1479
+ console.log('Or install locally: npm install -g claude-flow@latest');
1480
+ console.log('\nThe swarm system would coordinate the following:');
1481
+ console.log('1. Agent spawning and task distribution');
1482
+ console.log('2. Parallel execution of subtasks');
1483
+ console.log('3. Memory sharing between agents');
1484
+ console.log('4. Progress monitoring and reporting');
1485
+ console.log('5. Result aggregation and quality checks');
1486
+ }
1487
+
1488
+ return;
1489
+ }
1490
+
1491
+ console.error('Swarm command error:', error);
1492
+
1493
+ // Fallback to comprehensive help if there's an import error
1494
+ console.log(`
1348
1495
  🐝 Claude Flow Advanced Swarm System
1349
1496
 
1350
1497
  USAGE:
@@ -1421,40 +1568,48 @@ ADVANCED OPTIONS:
1421
1568
  For complete documentation and examples:
1422
1569
  https://github.com/ruvnet/claude-code-flow/docs/swarm.md
1423
1570
  `);
1424
- }
1571
+ }
1425
1572
  }
1573
+
1426
1574
  // Function to create swarm files directly
1427
1575
  async function createSwarmFiles(objective, flags) {
1428
- const fs = await import("fs");
1429
- const path = await import("path");
1430
- const swarmId = `swarm_${Math.random().toString(36).substring(2, 11)}_${Math.random().toString(36).substring(2, 11)}`;
1431
- console.log(`🐝 Swarm Execution Started: ${swarmId}`);
1432
- console.log(`📋 Objective: ${objective}`);
1433
- console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
1434
- // Extract target directory from objective
1435
- const targetMatch = objective.match(/in\s+([^\s]+)\/?$/i);
1436
- let targetDir = targetMatch ? targetMatch[1] : 'output';
1437
- // Resolve relative paths
1438
- if (!targetDir.startsWith('/')) {
1439
- targetDir = path.join(process.cwd(), targetDir);
1440
- }
1441
- console.log(`📁 Target directory: ${targetDir}`);
1442
- // Ensure target directory exists
1443
- await fs.promises.mkdir(targetDir, {
1444
- recursive: true
1445
- });
1446
- // Determine what to build based on objective
1447
- const isRestAPI = objective.toLowerCase().includes('rest api') || objective.toLowerCase().includes('api');
1448
- if (isRestAPI) {
1449
- // Create REST API
1450
- const apiDir = path.join(targetDir, 'rest-api');
1451
- await fs.promises.mkdir(apiDir, {
1452
- recursive: true
1453
- });
1454
- console.log(`\n🏗️ Creating REST API...`);
1455
- console.log(` 🤖 Agent developer-1: Creating server implementation`);
1456
- // Create server.js
1457
- const serverCode = `const express = require('express');
1576
+ const fs = await import('fs');
1577
+ const path = await import('path');
1578
+
1579
+ const swarmId = `swarm_${Math.random().toString(36).substring(2, 11)}_${Math.random().toString(36).substring(2, 11)}`;
1580
+
1581
+ console.log(`🐝 Swarm Execution Started: ${swarmId}`);
1582
+ console.log(`📋 Objective: ${objective}`);
1583
+ console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
1584
+
1585
+ // Extract target directory from objective
1586
+ const targetMatch = objective.match(/in\s+([^\s]+)\/?$/i);
1587
+ let targetDir = targetMatch ? targetMatch[1] : 'output';
1588
+
1589
+ // Resolve relative paths
1590
+ if (!targetDir.startsWith('/')) {
1591
+ targetDir = path.join(process.cwd(), targetDir);
1592
+ }
1593
+
1594
+ console.log(`📁 Target directory: ${targetDir}`);
1595
+
1596
+ // Ensure target directory exists
1597
+ await fs.promises.mkdir(targetDir, { recursive: true });
1598
+
1599
+ // Determine what to build based on objective
1600
+ const isRestAPI =
1601
+ objective.toLowerCase().includes('rest api') || objective.toLowerCase().includes('api');
1602
+
1603
+ if (isRestAPI) {
1604
+ // Create REST API
1605
+ const apiDir = path.join(targetDir, 'rest-api');
1606
+ await fs.promises.mkdir(apiDir, { recursive: true });
1607
+
1608
+ console.log(`\n🏗️ Creating REST API...`);
1609
+ console.log(` 🤖 Agent developer-1: Creating server implementation`);
1610
+
1611
+ // Create server.js
1612
+ const serverCode = `const express = require('express');
1458
1613
  const app = express();
1459
1614
  const port = process.env.PORT || 3000;
1460
1615
 
@@ -1509,45 +1664,47 @@ app.listen(port, () => {
1509
1664
 
1510
1665
  module.exports = app;
1511
1666
  `;
1512
- await fs.promises.writeFile(path.join(apiDir, 'server.js'), serverCode);
1513
- console.log(` ✅ Created: server.js`);
1514
- // Create package.json
1515
- const packageJson = {
1516
- name: 'rest-api',
1517
- version: '1.0.0',
1518
- description: 'REST API created by Claude Flow Swarm',
1519
- main: 'server.js',
1520
- scripts: {
1521
- start: 'node server.js',
1522
- dev: 'nodemon server.js',
1523
- test: 'jest'
1524
- },
1525
- keywords: [
1526
- 'rest',
1527
- 'api',
1528
- 'swarm',
1529
- 'claude-flow'
1530
- ],
1531
- author: 'Claude Flow Swarm',
1532
- license: 'MIT',
1533
- dependencies: {
1534
- express: '^4.18.2'
1535
- },
1536
- devDependencies: {
1537
- nodemon: '^3.0.1',
1538
- jest: '^29.7.0',
1539
- supertest: '^6.3.3'
1540
- },
1541
- swarmMetadata: {
1542
- swarmId,
1543
- strategy: flags.strategy || 'development',
1544
- created: new Date().toISOString()
1545
- }
1546
- };
1547
- await fs.promises.writeFile(path.join(apiDir, 'package.json'), JSON.stringify(packageJson, null, 2));
1548
- console.log(` ✅ Created: package.json`);
1549
- // Create README
1550
- const readme = `# REST API
1667
+
1668
+ await fs.promises.writeFile(path.join(apiDir, 'server.js'), serverCode);
1669
+ console.log(` ✅ Created: server.js`);
1670
+
1671
+ // Create package.json
1672
+ const packageJson = {
1673
+ name: 'rest-api',
1674
+ version: '1.0.0',
1675
+ description: 'REST API created by Claude Flow Swarm',
1676
+ main: 'server.js',
1677
+ scripts: {
1678
+ start: 'node server.js',
1679
+ dev: 'nodemon server.js',
1680
+ test: 'jest',
1681
+ },
1682
+ keywords: ['rest', 'api', 'swarm', 'claude-flow'],
1683
+ author: 'Claude Flow Swarm',
1684
+ license: 'MIT',
1685
+ dependencies: {
1686
+ express: '^4.18.2',
1687
+ },
1688
+ devDependencies: {
1689
+ nodemon: '^3.0.1',
1690
+ jest: '^29.7.0',
1691
+ supertest: '^6.3.3',
1692
+ },
1693
+ swarmMetadata: {
1694
+ swarmId,
1695
+ strategy: flags.strategy || 'development',
1696
+ created: new Date().toISOString(),
1697
+ },
1698
+ };
1699
+
1700
+ await fs.promises.writeFile(
1701
+ path.join(apiDir, 'package.json'),
1702
+ JSON.stringify(packageJson, null, 2),
1703
+ );
1704
+ console.log(` ✅ Created: package.json`);
1705
+
1706
+ // Create README
1707
+ const readme = `# REST API
1551
1708
 
1552
1709
  This REST API was created by the Claude Flow Swarm system.
1553
1710
 
@@ -1579,15 +1736,18 @@ npm start
1579
1736
  ---
1580
1737
  Created by Claude Flow Swarm
1581
1738
  `;
1582
- await fs.promises.writeFile(path.join(apiDir, 'README.md'), readme);
1583
- console.log(` ✅ Created: README.md`);
1584
- console.log(`\nSwarm completed successfully!`);
1585
- console.log(`📁 Files created in: ${apiDir}`);
1586
- console.log(`🆔 Swarm ID: ${swarmId}`);
1587
- } else {
1588
- // Create generic application
1589
- console.log(`\n🏗️ Creating application...`);
1590
- const appCode = `// Application created by Claude Flow Swarm
1739
+
1740
+ await fs.promises.writeFile(path.join(apiDir, 'README.md'), readme);
1741
+ console.log(` Created: README.md`);
1742
+
1743
+ console.log(`\n✅ Swarm completed successfully!`);
1744
+ console.log(`📁 Files created in: ${apiDir}`);
1745
+ console.log(`🆔 Swarm ID: ${swarmId}`);
1746
+ } else {
1747
+ // Create generic application
1748
+ console.log(`\n🏗️ Creating application...`);
1749
+
1750
+ const appCode = `// Application created by Claude Flow Swarm
1591
1751
  // Objective: ${objective}
1592
1752
  // Swarm ID: ${swarmId}
1593
1753
 
@@ -1598,34 +1758,43 @@ function main() {
1598
1758
 
1599
1759
  main();
1600
1760
  `;
1601
- await fs.promises.writeFile(path.join(targetDir, 'app.js'), appCode);
1602
- console.log(` ✅ Created: app.js`);
1603
- const packageJson = {
1604
- name: 'swarm-app',
1605
- version: '1.0.0',
1606
- description: `Application created by Claude Flow Swarm: ${objective}`,
1607
- main: 'app.js',
1608
- scripts: {
1609
- start: 'node app.js'
1610
- },
1611
- swarmMetadata: {
1612
- swarmId,
1613
- objective,
1614
- created: new Date().toISOString()
1615
- }
1616
- };
1617
- await fs.promises.writeFile(path.join(targetDir, 'package.json'), JSON.stringify(packageJson, null, 2));
1618
- console.log(` ✅ Created: package.json`);
1619
- console.log(`\n✅ Swarm completed successfully!`);
1620
- console.log(`📁 Files created in: ${targetDir}`);
1621
- console.log(`🆔 Swarm ID: ${swarmId}`);
1622
- }
1761
+
1762
+ await fs.promises.writeFile(path.join(targetDir, 'app.js'), appCode);
1763
+ console.log(` ✅ Created: app.js`);
1764
+
1765
+ const packageJson = {
1766
+ name: 'swarm-app',
1767
+ version: '1.0.0',
1768
+ description: `Application created by Claude Flow Swarm: ${objective}`,
1769
+ main: 'app.js',
1770
+ scripts: {
1771
+ start: 'node app.js',
1772
+ },
1773
+ swarmMetadata: {
1774
+ swarmId,
1775
+ objective,
1776
+ created: new Date().toISOString(),
1777
+ },
1778
+ };
1779
+
1780
+ await fs.promises.writeFile(
1781
+ path.join(targetDir, 'package.json'),
1782
+ JSON.stringify(packageJson, null, 2),
1783
+ );
1784
+ console.log(` ✅ Created: package.json`);
1785
+
1786
+ console.log(`\n✅ Swarm completed successfully!`);
1787
+ console.log(`📁 Files created in: ${targetDir}`);
1788
+ console.log(`🆔 Swarm ID: ${swarmId}`);
1789
+ }
1623
1790
  }
1791
+
1624
1792
  /**
1625
1793
  * Get strategy-specific guidance for swarm execution
1626
- */ function getStrategyGuidance(strategy, objective) {
1627
- const guidanceMap = {
1628
- auto: `🤖 AUTO STRATEGY - INTELLIGENT TASK ANALYSIS:
1794
+ */
1795
+ function getStrategyGuidance(strategy, objective) {
1796
+ const guidanceMap = {
1797
+ auto: `🤖 AUTO STRATEGY - INTELLIGENT TASK ANALYSIS:
1629
1798
  The swarm will analyze "${objective}" and automatically determine the best approach.
1630
1799
 
1631
1800
  ANALYSIS APPROACH:
@@ -1639,7 +1808,8 @@ MCP TOOL PATTERN:
1639
1808
  - Use task_create to build a hierarchical task structure
1640
1809
  - Spawn agents with agent_spawn based on detected requirements
1641
1810
  - Monitor with swarm_monitor and adjust strategy as needed`,
1642
- research: `🔬 RESEARCH STRATEGY - INFORMATION GATHERING & ANALYSIS:
1811
+
1812
+ research: `🔬 RESEARCH STRATEGY - INFORMATION GATHERING & ANALYSIS:
1643
1813
  Optimized for: "${objective}"
1644
1814
 
1645
1815
  RESEARCH PHASES:
@@ -1659,7 +1829,8 @@ MCP TOOL USAGE:
1659
1829
  - memory_search: Find related information across research
1660
1830
  - agent_communicate: Share discoveries between researchers
1661
1831
  - task_create: Break research into focused sub-investigations`,
1662
- development: `💻 DEVELOPMENT STRATEGY - SOFTWARE CREATION:
1832
+
1833
+ development: `💻 DEVELOPMENT STRATEGY - SOFTWARE CREATION:
1663
1834
  Building: "${objective}"
1664
1835
 
1665
1836
  DEVELOPMENT WORKFLOW:
@@ -1681,7 +1852,8 @@ MCP TOOL USAGE:
1681
1852
  - task_create: Create implementation tasks with dependencies
1682
1853
  - agent_assign: Assign specific components to developers
1683
1854
  - swarm_monitor: Track build progress and blockers`,
1684
- analysis: `📊 ANALYSIS STRATEGY - DATA EXAMINATION:
1855
+
1856
+ analysis: `📊 ANALYSIS STRATEGY - DATA EXAMINATION:
1685
1857
  Analyzing: "${objective}"
1686
1858
 
1687
1859
  ANALYSIS FRAMEWORK:
@@ -1703,7 +1875,8 @@ MCP TOOL USAGE:
1703
1875
  - memory_retrieve: Access historical analysis
1704
1876
  - task_create: Define analysis pipelines
1705
1877
  - agent_coordinate: Sync analysis phases`,
1706
- testing: `🧪 TESTING STRATEGY - QUALITY ASSURANCE:
1878
+
1879
+ testing: `🧪 TESTING STRATEGY - QUALITY ASSURANCE:
1707
1880
  Testing: "${objective}"
1708
1881
 
1709
1882
  TESTING PHASES:
@@ -1725,7 +1898,8 @@ MCP TOOL USAGE:
1725
1898
  - memory_store: Save test results and bug reports
1726
1899
  - agent_communicate: Report bugs to developers
1727
1900
  - swarm_monitor: Track testing coverage and progress`,
1728
- optimization: `⚡ OPTIMIZATION STRATEGY - PERFORMANCE IMPROVEMENT:
1901
+
1902
+ optimization: `⚡ OPTIMIZATION STRATEGY - PERFORMANCE IMPROVEMENT:
1729
1903
  Optimizing: "${objective}"
1730
1904
 
1731
1905
  OPTIMIZATION PROCESS:
@@ -1747,7 +1921,8 @@ MCP TOOL USAGE:
1747
1921
  - task_create: Create optimization tasks by priority
1748
1922
  - swarm_monitor: Track performance improvements
1749
1923
  - agent_communicate: Coordinate optimization efforts`,
1750
- maintenance: `🔧 MAINTENANCE STRATEGY - SYSTEM UPKEEP:
1924
+
1925
+ maintenance: `🔧 MAINTENANCE STRATEGY - SYSTEM UPKEEP:
1751
1926
  Maintaining: "${objective}"
1752
1927
 
1753
1928
  MAINTENANCE WORKFLOW:
@@ -1768,15 +1943,18 @@ MCP TOOL USAGE:
1768
1943
  - memory_retrieve: Access system history
1769
1944
  - task_create: Schedule maintenance tasks
1770
1945
  - agent_assign: Delegate specific updates
1771
- - memory_store: Document all changes`
1772
- };
1773
- return guidanceMap[strategy] || guidanceMap['auto'];
1946
+ - memory_store: Document all changes`,
1947
+ };
1948
+
1949
+ return guidanceMap[strategy] || guidanceMap['auto'];
1774
1950
  }
1951
+
1775
1952
  /**
1776
1953
  * Get mode-specific guidance for coordination
1777
- */ function getModeGuidance(mode) {
1778
- const modeMap = {
1779
- centralized: `🎯 CENTRALIZED MODE - SINGLE COORDINATOR:
1954
+ */
1955
+ function getModeGuidance(mode) {
1956
+ const modeMap = {
1957
+ centralized: `🎯 CENTRALIZED MODE - SINGLE COORDINATOR:
1780
1958
  All decisions flow through one coordinator agent.
1781
1959
 
1782
1960
  COORDINATION PATTERN:
@@ -1796,7 +1974,8 @@ BEST FOR:
1796
1974
  - Small to medium projects
1797
1975
  - Well-defined objectives
1798
1976
  - Clear task dependencies`,
1799
- distributed: `🌐 DISTRIBUTED MODE - MULTIPLE COORDINATORS:
1977
+
1978
+ distributed: `🌐 DISTRIBUTED MODE - MULTIPLE COORDINATORS:
1800
1979
  Multiple coordinators share responsibility by domain.
1801
1980
 
1802
1981
  COORDINATION PATTERN:
@@ -1817,7 +1996,8 @@ BEST FOR:
1817
1996
  - Multiple workstreams
1818
1997
  - Complex systems
1819
1998
  - High availability needs`,
1820
- hierarchical: `🏗️ HIERARCHICAL MODE - TREE STRUCTURE:
1999
+
2000
+ hierarchical: `🏗️ HIERARCHICAL MODE - TREE STRUCTURE:
1821
2001
  Agents organized in management layers.
1822
2002
 
1823
2003
  COORDINATION PATTERN:
@@ -1838,7 +2018,8 @@ BEST FOR:
1838
2018
  - Multi-team efforts
1839
2019
  - Complex hierarchies
1840
2020
  - Phased deliveries`,
1841
- mesh: `🔗 MESH MODE - PEER-TO-PEER:
2021
+
2022
+ mesh: `🔗 MESH MODE - PEER-TO-PEER:
1842
2023
  Agents coordinate directly without central authority.
1843
2024
 
1844
2025
  COORDINATION PATTERN:
@@ -1859,7 +2040,8 @@ BEST FOR:
1859
2040
  - Exploratory work
1860
2041
  - Innovation tasks
1861
2042
  - Small expert teams`,
1862
- hybrid: `🎨 HYBRID MODE - MIXED STRATEGIES:
2043
+
2044
+ hybrid: `🎨 HYBRID MODE - MIXED STRATEGIES:
1863
2045
  Combine different coordination patterns as needed.
1864
2046
 
1865
2047
  COORDINATION PATTERN:
@@ -1878,15 +2060,18 @@ BEST FOR:
1878
2060
  - Complex projects
1879
2061
  - Uncertain requirements
1880
2062
  - Long-term efforts
1881
- - Diverse objectives`
1882
- };
1883
- return modeMap[mode] || modeMap['centralized'];
2063
+ - Diverse objectives`,
2064
+ };
2065
+
2066
+ return modeMap[mode] || modeMap['centralized'];
1884
2067
  }
2068
+
1885
2069
  /**
1886
2070
  * Get agent recommendations based on strategy
1887
- */ function getAgentRecommendations(strategy, maxAgents, objective) {
1888
- const recommendations = {
1889
- auto: `
2071
+ */
2072
+ function getAgentRecommendations(strategy, maxAgents, objective) {
2073
+ const recommendations = {
2074
+ auto: `
1890
2075
  🤖 RECOMMENDED AGENT COMPOSITION (Auto-detected):
1891
2076
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
1892
2077
 
@@ -1905,7 +2090,8 @@ BEST FOR:
1905
2090
  {"id": "4", "content": "Spawn additional agents as needed", "status": "pending", "priority": "medium"}
1906
2091
  ]}
1907
2092
  \`\`\``,
1908
- research: `
2093
+
2094
+ research: `
1909
2095
  🔬 RECOMMENDED RESEARCH AGENTS:
1910
2096
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
1911
2097
 
@@ -1929,7 +2115,8 @@ BEST FOR:
1929
2115
  {"id": "5", "content": "Compile and synthesize insights", "status": "pending", "priority": "medium"}
1930
2116
  ]}
1931
2117
  \`\`\``,
1932
- development: `
2118
+
2119
+ development: `
1933
2120
  💻 RECOMMENDED DEVELOPMENT AGENTS:
1934
2121
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
1935
2122
 
@@ -1953,7 +2140,8 @@ BEST FOR:
1953
2140
  {"id": "5", "content": "Create comprehensive tests", "status": "pending", "priority": "medium"}
1954
2141
  ]}
1955
2142
  \`\`\``,
1956
- analysis: `
2143
+
2144
+ analysis: `
1957
2145
  📊 RECOMMENDED ANALYSIS AGENTS:
1958
2146
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
1959
2147
 
@@ -1977,7 +2165,8 @@ BEST FOR:
1977
2165
  {"id": "5", "content": "Generate business insights", "status": "pending", "priority": "medium"}
1978
2166
  ]}
1979
2167
  \`\`\``,
1980
- testing: `
2168
+
2169
+ testing: `
1981
2170
  🧪 RECOMMENDED TESTING AGENTS:
1982
2171
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
1983
2172
 
@@ -2001,7 +2190,8 @@ BEST FOR:
2001
2190
  {"id": "5", "content": "Execute security audit", "status": "pending", "priority": "high"}
2002
2191
  ]}
2003
2192
  \`\`\``,
2004
- optimization: `
2193
+
2194
+ optimization: `
2005
2195
  ⚡ RECOMMENDED OPTIMIZATION AGENTS:
2006
2196
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
2007
2197
 
@@ -2025,7 +2215,8 @@ BEST FOR:
2025
2215
  {"id": "5", "content": "Tune system parameters", "status": "pending", "priority": "medium"}
2026
2216
  ]}
2027
2217
  \`\`\``,
2028
- maintenance: `
2218
+
2219
+ maintenance: `
2029
2220
  🔧 RECOMMENDED MAINTENANCE AGENTS:
2030
2221
  ⚡ SPAWN ALL AGENTS IN ONE BATCH - Copy this entire block:
2031
2222
 
@@ -2048,35 +2239,39 @@ BEST FOR:
2048
2239
  {"id": "4", "content": "Run regression tests", "status": "pending", "priority": "high"},
2049
2240
  {"id": "5", "content": "Update documentation", "status": "pending", "priority": "medium"}
2050
2241
  ]}
2051
- \`\`\``
2052
- };
2053
- return recommendations[strategy] || recommendations['auto'];
2242
+ \`\`\``,
2243
+ };
2244
+
2245
+ return recommendations[strategy] || recommendations['auto'];
2054
2246
  }
2247
+
2055
2248
  // Allow direct execution
2056
2249
  if (import.meta.main) {
2057
- // When called directly as a script, parse all arguments
2058
- const args = [];
2059
- const flags = {};
2060
- // Parse arguments and flags
2061
- for(let i = 0; i < args.length; i++){
2062
- const arg = args[i];
2063
- if (arg.startsWith('--')) {
2064
- const flagName = arg.substring(2);
2065
- const nextArg = args[i + 1];
2066
- if (nextArg && !nextArg.startsWith('--')) {
2067
- flags[flagName] = nextArg;
2068
- i++; // Skip the next argument
2069
- } else {
2070
- flags[flagName] = true;
2071
- }
2072
- } else {
2073
- args.push(arg);
2074
- }
2250
+ // When called directly as a script, parse all arguments
2251
+ const args = [];
2252
+ const flags = {};
2253
+
2254
+ // Parse arguments and flags
2255
+ for (let i = 0; i < args.length; i++) {
2256
+ const arg = args[i];
2257
+ if (arg.startsWith('--')) {
2258
+ const flagName = arg.substring(2);
2259
+ const nextArg = args[i + 1];
2260
+
2261
+ if (nextArg && !nextArg.startsWith('--')) {
2262
+ flags[flagName] = nextArg;
2263
+ i++; // Skip the next argument
2264
+ } else {
2265
+ flags[flagName] = true;
2266
+ }
2267
+ } else {
2268
+ args.push(arg);
2075
2269
  }
2076
- // The objective is all non-flag arguments joined
2077
- const objective = args.join(' ');
2078
- // Execute the swarm command
2079
- await swarmCommand([
2080
- objective
2081
- ], flags);
2270
+ }
2271
+
2272
+ // The objective is all non-flag arguments joined
2273
+ const objective = args.join(' ');
2274
+
2275
+ // Execute the swarm command
2276
+ await swarmCommand([objective], flags);
2082
2277
  }