@claude-flow/cli 3.0.0-alpha.2 → 3.0.0-alpha.20

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 (263) hide show
  1. package/README.md +172 -6
  2. package/bin/cli.js +0 -0
  3. package/dist/src/commands/agent.d.ts.map +1 -1
  4. package/dist/src/commands/agent.js +43 -27
  5. package/dist/src/commands/agent.js.map +1 -1
  6. package/dist/src/commands/analyze.d.ts +19 -0
  7. package/dist/src/commands/analyze.d.ts.map +1 -0
  8. package/dist/src/commands/analyze.js +1823 -0
  9. package/dist/src/commands/analyze.js.map +1 -0
  10. package/dist/src/commands/claims.d.ts +10 -0
  11. package/dist/src/commands/claims.d.ts.map +1 -0
  12. package/dist/src/commands/claims.js +288 -0
  13. package/dist/src/commands/claims.js.map +1 -0
  14. package/dist/src/commands/completions.d.ts +10 -0
  15. package/dist/src/commands/completions.d.ts.map +1 -0
  16. package/dist/src/commands/completions.js +539 -0
  17. package/dist/src/commands/completions.js.map +1 -0
  18. package/dist/src/commands/config.js +2 -2
  19. package/dist/src/commands/config.js.map +1 -1
  20. package/dist/src/commands/daemon.d.ts +8 -0
  21. package/dist/src/commands/daemon.d.ts.map +1 -0
  22. package/dist/src/commands/daemon.js +545 -0
  23. package/dist/src/commands/daemon.js.map +1 -0
  24. package/dist/src/commands/deployment.d.ts +10 -0
  25. package/dist/src/commands/deployment.d.ts.map +1 -0
  26. package/dist/src/commands/deployment.js +289 -0
  27. package/dist/src/commands/deployment.js.map +1 -0
  28. package/dist/src/commands/doctor.d.ts +10 -0
  29. package/dist/src/commands/doctor.d.ts.map +1 -0
  30. package/dist/src/commands/doctor.js +429 -0
  31. package/dist/src/commands/doctor.js.map +1 -0
  32. package/dist/src/commands/embeddings.d.ts +18 -0
  33. package/dist/src/commands/embeddings.d.ts.map +1 -0
  34. package/dist/src/commands/embeddings.js +616 -0
  35. package/dist/src/commands/embeddings.js.map +1 -0
  36. package/dist/src/commands/hive-mind.d.ts.map +1 -1
  37. package/dist/src/commands/hive-mind.js +252 -35
  38. package/dist/src/commands/hive-mind.js.map +1 -1
  39. package/dist/src/commands/hooks.d.ts.map +1 -1
  40. package/dist/src/commands/hooks.js +326 -2
  41. package/dist/src/commands/hooks.js.map +1 -1
  42. package/dist/src/commands/index.d.ts +13 -0
  43. package/dist/src/commands/index.d.ts.map +1 -1
  44. package/dist/src/commands/index.js +52 -1
  45. package/dist/src/commands/index.js.map +1 -1
  46. package/dist/src/commands/mcp.js +4 -4
  47. package/dist/src/commands/mcp.js.map +1 -1
  48. package/dist/src/commands/memory.d.ts.map +1 -1
  49. package/dist/src/commands/memory.js +236 -170
  50. package/dist/src/commands/memory.js.map +1 -1
  51. package/dist/src/commands/migrate.js +1 -1
  52. package/dist/src/commands/migrate.js.map +1 -1
  53. package/dist/src/commands/neural.d.ts +10 -0
  54. package/dist/src/commands/neural.d.ts.map +1 -0
  55. package/dist/src/commands/neural.js +224 -0
  56. package/dist/src/commands/neural.js.map +1 -0
  57. package/dist/src/commands/performance.d.ts +10 -0
  58. package/dist/src/commands/performance.d.ts.map +1 -0
  59. package/dist/src/commands/performance.js +262 -0
  60. package/dist/src/commands/performance.js.map +1 -0
  61. package/dist/src/commands/plugins.d.ts +10 -0
  62. package/dist/src/commands/plugins.d.ts.map +1 -0
  63. package/dist/src/commands/plugins.js +280 -0
  64. package/dist/src/commands/plugins.js.map +1 -0
  65. package/dist/src/commands/process.d.ts.map +1 -1
  66. package/dist/src/commands/process.js +95 -20
  67. package/dist/src/commands/process.js.map +1 -1
  68. package/dist/src/commands/providers.d.ts +10 -0
  69. package/dist/src/commands/providers.d.ts.map +1 -0
  70. package/dist/src/commands/providers.js +232 -0
  71. package/dist/src/commands/providers.js.map +1 -0
  72. package/dist/src/commands/route.d.ts +16 -0
  73. package/dist/src/commands/route.d.ts.map +1 -0
  74. package/dist/src/commands/route.js +603 -0
  75. package/dist/src/commands/route.js.map +1 -0
  76. package/dist/src/commands/security.d.ts +10 -0
  77. package/dist/src/commands/security.d.ts.map +1 -0
  78. package/dist/src/commands/security.js +261 -0
  79. package/dist/src/commands/security.js.map +1 -0
  80. package/dist/src/commands/start.js +2 -2
  81. package/dist/src/commands/start.js.map +1 -1
  82. package/dist/src/commands/status.d.ts.map +1 -1
  83. package/dist/src/commands/status.js +26 -2
  84. package/dist/src/commands/status.js.map +1 -1
  85. package/dist/src/commands/swarm.js +6 -6
  86. package/dist/src/commands/swarm.js.map +1 -1
  87. package/dist/src/index.d.ts +4 -2
  88. package/dist/src/index.d.ts.map +1 -1
  89. package/dist/src/index.js +63 -5
  90. package/dist/src/index.js.map +1 -1
  91. package/dist/src/init/claudemd-generator.d.ts.map +1 -1
  92. package/dist/src/init/claudemd-generator.js +218 -362
  93. package/dist/src/init/claudemd-generator.js.map +1 -1
  94. package/dist/src/init/executor.d.ts.map +1 -1
  95. package/dist/src/init/executor.js +5 -0
  96. package/dist/src/init/executor.js.map +1 -1
  97. package/dist/src/init/settings-generator.d.ts.map +1 -1
  98. package/dist/src/init/settings-generator.js +22 -12
  99. package/dist/src/init/settings-generator.js.map +1 -1
  100. package/dist/src/mcp-client.d.ts.map +1 -1
  101. package/dist/src/mcp-client.js +17 -1
  102. package/dist/src/mcp-client.js.map +1 -1
  103. package/dist/src/mcp-server.d.ts.map +1 -1
  104. package/dist/src/mcp-server.js +5 -0
  105. package/dist/src/mcp-server.js.map +1 -1
  106. package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
  107. package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
  108. package/dist/src/mcp-tools/agent-tools.js +350 -14
  109. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  110. package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
  111. package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
  112. package/dist/src/mcp-tools/analyze-tools.js +317 -0
  113. package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
  114. package/dist/src/mcp-tools/config-tools.d.ts +1 -1
  115. package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
  116. package/dist/src/mcp-tools/config-tools.js +262 -15
  117. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  118. package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
  119. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
  120. package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
  121. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
  122. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  123. package/dist/src/mcp-tools/hooks-tools.js +80 -15
  124. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  125. package/dist/src/mcp-tools/index.d.ts +6 -0
  126. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  127. package/dist/src/mcp-tools/index.js +6 -0
  128. package/dist/src/mcp-tools/index.js.map +1 -1
  129. package/dist/src/mcp-tools/memory-tools.d.ts +1 -1
  130. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  131. package/dist/src/mcp-tools/memory-tools.js +157 -9
  132. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  133. package/dist/src/mcp-tools/session-tools.d.ts +8 -0
  134. package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
  135. package/dist/src/mcp-tools/session-tools.js +315 -0
  136. package/dist/src/mcp-tools/session-tools.js.map +1 -0
  137. package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
  138. package/dist/src/mcp-tools/swarm-tools.js +37 -2
  139. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  140. package/dist/src/mcp-tools/task-tools.d.ts +8 -0
  141. package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
  142. package/dist/src/mcp-tools/task-tools.js +302 -0
  143. package/dist/src/mcp-tools/task-tools.js.map +1 -0
  144. package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
  145. package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
  146. package/dist/src/mcp-tools/workflow-tools.js +481 -0
  147. package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
  148. package/dist/src/output.d.ts +16 -0
  149. package/dist/src/output.d.ts.map +1 -1
  150. package/dist/src/output.js +42 -0
  151. package/dist/src/output.js.map +1 -1
  152. package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
  153. package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
  154. package/dist/src/ruvector/ast-analyzer.js +277 -0
  155. package/dist/src/ruvector/ast-analyzer.js.map +1 -0
  156. package/dist/src/ruvector/coverage-router.d.ts +145 -0
  157. package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
  158. package/dist/src/ruvector/coverage-router.js +451 -0
  159. package/dist/src/ruvector/coverage-router.js.map +1 -0
  160. package/dist/src/ruvector/coverage-tools.d.ts +33 -0
  161. package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
  162. package/dist/src/ruvector/coverage-tools.js +157 -0
  163. package/dist/src/ruvector/coverage-tools.js.map +1 -0
  164. package/dist/src/ruvector/diff-classifier.d.ts +154 -0
  165. package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
  166. package/dist/src/ruvector/diff-classifier.js +508 -0
  167. package/dist/src/ruvector/diff-classifier.js.map +1 -0
  168. package/dist/src/ruvector/graph-analyzer.d.ts +174 -0
  169. package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
  170. package/dist/src/ruvector/graph-analyzer.js +878 -0
  171. package/dist/src/ruvector/graph-analyzer.js.map +1 -0
  172. package/dist/src/ruvector/index.d.ts +27 -0
  173. package/dist/src/ruvector/index.d.ts.map +1 -0
  174. package/dist/src/ruvector/index.js +47 -0
  175. package/dist/src/ruvector/index.js.map +1 -0
  176. package/dist/src/ruvector/q-learning-router.d.ts +211 -0
  177. package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
  178. package/dist/src/ruvector/q-learning-router.js +681 -0
  179. package/dist/src/ruvector/q-learning-router.js.map +1 -0
  180. package/dist/src/ruvector/vector-db.d.ts +69 -0
  181. package/dist/src/ruvector/vector-db.d.ts.map +1 -0
  182. package/dist/src/ruvector/vector-db.js +243 -0
  183. package/dist/src/ruvector/vector-db.js.map +1 -0
  184. package/dist/src/services/index.d.ts +7 -0
  185. package/dist/src/services/index.d.ts.map +1 -0
  186. package/dist/src/services/index.js +6 -0
  187. package/dist/src/services/index.js.map +1 -0
  188. package/dist/src/services/worker-daemon.d.ts +153 -0
  189. package/dist/src/services/worker-daemon.d.ts.map +1 -0
  190. package/dist/src/services/worker-daemon.js +567 -0
  191. package/dist/src/services/worker-daemon.js.map +1 -0
  192. package/dist/src/suggest.d.ts +53 -0
  193. package/dist/src/suggest.d.ts.map +1 -0
  194. package/dist/src/suggest.js +200 -0
  195. package/dist/src/suggest.js.map +1 -0
  196. package/dist/tsconfig.tsbuildinfo +1 -1
  197. package/package.json +28 -6
  198. package/.agentic-flow/intelligence.json +0 -16
  199. package/.claude-flow/metrics/agent-metrics.json +0 -1
  200. package/.claude-flow/metrics/performance.json +0 -87
  201. package/.claude-flow/metrics/task-metrics.json +0 -10
  202. package/__tests__/README.md +0 -140
  203. package/__tests__/TEST_SUMMARY.md +0 -144
  204. package/__tests__/cli.test.ts +0 -558
  205. package/__tests__/commands.test.ts +0 -726
  206. package/__tests__/config-adapter.test.ts +0 -362
  207. package/__tests__/config-loading.test.ts +0 -106
  208. package/__tests__/coverage/.tmp/coverage-0.json +0 -1
  209. package/__tests__/coverage/.tmp/coverage-1.json +0 -1
  210. package/__tests__/coverage/.tmp/coverage-2.json +0 -1
  211. package/__tests__/coverage/.tmp/coverage-3.json +0 -1
  212. package/__tests__/coverage/.tmp/coverage-4.json +0 -1
  213. package/__tests__/coverage/.tmp/coverage-5.json +0 -1
  214. package/__tests__/mcp-client.test.ts +0 -480
  215. package/__tests__/p1-commands.test.ts +0 -1064
  216. package/docs/CONFIG_LOADING.md +0 -236
  217. package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
  218. package/docs/MCP_CLIENT_GUIDE.md +0 -620
  219. package/docs/REFACTORING_SUMMARY.md +0 -247
  220. package/src/commands/agent.ts +0 -941
  221. package/src/commands/config.ts +0 -452
  222. package/src/commands/hive-mind.ts +0 -762
  223. package/src/commands/hooks.ts +0 -2603
  224. package/src/commands/index.ts +0 -115
  225. package/src/commands/init.ts +0 -597
  226. package/src/commands/mcp.ts +0 -753
  227. package/src/commands/memory.ts +0 -1063
  228. package/src/commands/migrate.ts +0 -447
  229. package/src/commands/process.ts +0 -617
  230. package/src/commands/session.ts +0 -891
  231. package/src/commands/start.ts +0 -457
  232. package/src/commands/status.ts +0 -705
  233. package/src/commands/swarm.ts +0 -648
  234. package/src/commands/task.ts +0 -792
  235. package/src/commands/workflow.ts +0 -742
  236. package/src/config-adapter.ts +0 -210
  237. package/src/index.ts +0 -383
  238. package/src/infrastructure/in-memory-repositories.ts +0 -310
  239. package/src/init/claudemd-generator.ts +0 -631
  240. package/src/init/executor.ts +0 -756
  241. package/src/init/helpers-generator.ts +0 -628
  242. package/src/init/index.ts +0 -60
  243. package/src/init/mcp-generator.ts +0 -83
  244. package/src/init/settings-generator.ts +0 -274
  245. package/src/init/statusline-generator.ts +0 -211
  246. package/src/init/types.ts +0 -447
  247. package/src/mcp-client.ts +0 -227
  248. package/src/mcp-server.ts +0 -571
  249. package/src/mcp-tools/agent-tools.ts +0 -92
  250. package/src/mcp-tools/config-tools.ts +0 -88
  251. package/src/mcp-tools/hooks-tools.ts +0 -1819
  252. package/src/mcp-tools/index.ts +0 -12
  253. package/src/mcp-tools/memory-tools.ts +0 -89
  254. package/src/mcp-tools/swarm-tools.ts +0 -69
  255. package/src/mcp-tools/types.ts +0 -33
  256. package/src/output.ts +0 -593
  257. package/src/parser.ts +0 -417
  258. package/src/prompt.ts +0 -619
  259. package/src/types.ts +0 -287
  260. package/tmp.json +0 -0
  261. package/tsconfig.json +0 -16
  262. package/tsconfig.tsbuildinfo +0 -1
  263. package/vitest.config.ts +0 -13
@@ -1,362 +0,0 @@
1
- /**
2
- * Config Adapter Tests
3
- */
4
-
5
- import { describe, it, expect } from 'vitest';
6
- import { systemConfigToV3Config, v3ConfigToSystemConfig } from '../src/config-adapter.js';
7
- import type { SystemConfig } from '@claude-flow/shared';
8
- import type { V3Config } from '../src/types.js';
9
-
10
- describe('ConfigAdapter', () => {
11
- describe('systemConfigToV3Config', () => {
12
- it('should convert minimal SystemConfig to V3Config', () => {
13
- const systemConfig: SystemConfig = {
14
- orchestrator: {
15
- lifecycle: {
16
- autoStart: true,
17
- maxConcurrentAgents: 10,
18
- shutdownTimeoutMs: 30000,
19
- cleanupOrphanedAgents: true,
20
- },
21
- session: {
22
- dataDir: '/test/data',
23
- persistState: true,
24
- stateFile: 'session.json',
25
- },
26
- monitoring: {
27
- enabled: true,
28
- metricsIntervalMs: 5000,
29
- healthCheckIntervalMs: 10000,
30
- },
31
- },
32
- swarm: {
33
- topology: 'hierarchical-mesh',
34
- maxAgents: 15,
35
- },
36
- memory: {
37
- type: 'hybrid',
38
- },
39
- mcp: {
40
- enabled: true,
41
- transport: {
42
- type: 'stdio',
43
- host: 'localhost',
44
- port: 3000,
45
- },
46
- enabledTools: ['agent/*', 'swarm/*'],
47
- security: {
48
- requireAuth: false,
49
- allowedOrigins: ['*'],
50
- rateLimiting: {
51
- enabled: true,
52
- maxRequestsPerMinute: 100,
53
- },
54
- },
55
- },
56
- logging: {
57
- level: 'info',
58
- pretty: true,
59
- destination: 'console',
60
- format: 'text',
61
- },
62
- hooks: {
63
- enabled: true,
64
- autoExecute: true,
65
- definitions: [],
66
- },
67
- };
68
-
69
- const v3Config = systemConfigToV3Config(systemConfig);
70
-
71
- expect(v3Config.version).toBe('3.0.0');
72
- expect(v3Config.projectRoot).toBe('/test/data');
73
- expect(v3Config.agents.maxConcurrent).toBe(10);
74
- expect(v3Config.agents.autoSpawn).toBe(false); // Default is false for safety
75
- expect(v3Config.swarm.topology).toBe('hybrid'); // 'hierarchical-mesh' normalizes to 'hybrid'
76
- expect(v3Config.swarm.maxAgents).toBe(15);
77
- expect(v3Config.memory.backend).toBe('hybrid');
78
- expect(v3Config.mcp.serverHost).toBe('localhost');
79
- expect(v3Config.mcp.serverPort).toBe(3000);
80
- expect(v3Config.mcp.autoStart).toBe(false); // Default is false for safety
81
- expect(v3Config.cli.colorOutput).toBe(true);
82
- expect(v3Config.cli.verbosity).toBe('normal'); // Default verbosity level
83
- expect(v3Config.hooks.enabled).toBe(false); // Default is false
84
- expect(v3Config.hooks.autoExecute).toBe(false); // Default is false
85
- });
86
-
87
- it('should handle missing optional fields', () => {
88
- const minimalConfig: SystemConfig = {
89
- orchestrator: {
90
- lifecycle: {
91
- autoStart: false,
92
- maxConcurrentAgents: 5,
93
- shutdownTimeoutMs: 30000,
94
- cleanupOrphanedAgents: true,
95
- },
96
- session: {
97
- dataDir: '/data',
98
- persistState: true,
99
- stateFile: 'session.json',
100
- },
101
- monitoring: {
102
- enabled: true,
103
- metricsIntervalMs: 5000,
104
- healthCheckIntervalMs: 10000,
105
- },
106
- },
107
- swarm: {
108
- topology: 'mesh',
109
- maxAgents: 10,
110
- },
111
- memory: {
112
- type: 'sqlite',
113
- },
114
- mcp: {
115
- enabled: false,
116
- transport: {
117
- type: 'http',
118
- host: '127.0.0.1',
119
- port: 8080,
120
- },
121
- enabledTools: [],
122
- security: {
123
- requireAuth: false,
124
- allowedOrigins: ['*'],
125
- rateLimiting: {
126
- enabled: true,
127
- maxRequestsPerMinute: 100,
128
- },
129
- },
130
- },
131
- logging: {
132
- level: 'debug',
133
- pretty: false,
134
- destination: 'file',
135
- format: 'json',
136
- },
137
- hooks: {
138
- enabled: false,
139
- autoExecute: false,
140
- definitions: [],
141
- },
142
- };
143
-
144
- const v3Config = systemConfigToV3Config(minimalConfig);
145
-
146
- expect(v3Config.agents.maxConcurrent).toBe(5);
147
- expect(v3Config.agents.autoSpawn).toBe(false);
148
- expect(v3Config.memory.backend).toBe('sqlite');
149
- expect(v3Config.mcp.autoStart).toBe(false);
150
- expect(v3Config.cli.colorOutput).toBe(true); // Default is always true
151
- });
152
- });
153
-
154
- describe('v3ConfigToSystemConfig', () => {
155
- it('should convert V3Config to SystemConfig', () => {
156
- const v3Config: V3Config = {
157
- version: '3.0.0',
158
- projectRoot: '/test/project',
159
- agents: {
160
- defaultType: 'coder',
161
- autoSpawn: true,
162
- maxConcurrent: 20,
163
- timeout: 60000,
164
- providers: [],
165
- },
166
- swarm: {
167
- topology: 'hierarchical',
168
- maxAgents: 20,
169
- autoScale: true,
170
- coordinationStrategy: 'consensus',
171
- healthCheckInterval: 15000,
172
- },
173
- memory: {
174
- backend: 'agentdb',
175
- persistPath: '/test/memory',
176
- cacheSize: 500000,
177
- enableHNSW: true,
178
- vectorDimension: 768,
179
- },
180
- mcp: {
181
- serverHost: '0.0.0.0',
182
- serverPort: 4000,
183
- autoStart: true,
184
- transportType: 'websocket',
185
- tools: ['memory/*'],
186
- },
187
- cli: {
188
- colorOutput: true,
189
- interactive: true,
190
- verbosity: 'verbose',
191
- outputFormat: 'json',
192
- progressStyle: 'bar',
193
- },
194
- hooks: {
195
- enabled: true,
196
- autoExecute: false,
197
- hooks: [
198
- {
199
- name: 'test-hook',
200
- event: 'pre-task',
201
- handler: '/path/to/handler.js',
202
- priority: 10,
203
- enabled: true,
204
- },
205
- ],
206
- },
207
- };
208
-
209
- const systemConfig = v3ConfigToSystemConfig(v3Config);
210
-
211
- // Core orchestrator conversion (autoStart not mapped)
212
- expect(systemConfig.orchestrator?.lifecycle?.maxConcurrentAgents).toBe(20);
213
- expect(systemConfig.orchestrator?.session?.dataDir).toBe('/test/project');
214
- expect(systemConfig.swarm?.topology).toBe('hierarchical');
215
- expect(systemConfig.swarm?.maxAgents).toBe(20);
216
- expect(systemConfig.swarm?.autoScale?.enabled).toBe(true);
217
- expect(systemConfig.swarm?.coordination?.consensusRequired).toBe(true);
218
- expect(systemConfig.memory?.type).toBe('agentdb');
219
- expect(systemConfig.memory?.path).toBe('/test/memory');
220
- expect(systemConfig.memory?.agentdb?.dimensions).toBe(768);
221
- expect(systemConfig.memory?.agentdb?.indexType).toBe('hnsw');
222
- // MCP enabled not mapped, just transport
223
- expect(systemConfig.mcp?.transport?.type).toBe('websocket');
224
- expect(systemConfig.mcp?.transport?.host).toBe('0.0.0.0');
225
- expect(systemConfig.mcp?.transport?.port).toBe(4000);
226
- // logging and hooks not included in v3ConfigToSystemConfig conversion
227
- });
228
-
229
- it('should handle different coordination strategies', () => {
230
- const leaderConfig: V3Config = {
231
- version: '3.0.0',
232
- projectRoot: '/test',
233
- agents: {
234
- defaultType: 'coder',
235
- autoSpawn: false,
236
- maxConcurrent: 10,
237
- timeout: 30000,
238
- providers: [],
239
- },
240
- swarm: {
241
- topology: 'star',
242
- maxAgents: 10,
243
- autoScale: false,
244
- coordinationStrategy: 'leader',
245
- healthCheckInterval: 5000,
246
- },
247
- memory: {
248
- backend: 'memory',
249
- persistPath: '/data',
250
- cacheSize: 100000,
251
- enableHNSW: false,
252
- vectorDimension: 1536,
253
- },
254
- mcp: {
255
- serverHost: 'localhost',
256
- serverPort: 3000,
257
- autoStart: false,
258
- transportType: 'stdio',
259
- tools: [],
260
- },
261
- cli: {
262
- colorOutput: true,
263
- interactive: true,
264
- verbosity: 'normal',
265
- outputFormat: 'text',
266
- progressStyle: 'spinner',
267
- },
268
- hooks: {
269
- enabled: false,
270
- autoExecute: false,
271
- hooks: [],
272
- },
273
- };
274
-
275
- const systemConfig = v3ConfigToSystemConfig(leaderConfig);
276
-
277
- expect(systemConfig.swarm?.coordination?.consensusRequired).toBe(false);
278
- expect(systemConfig.memory?.agentdb?.indexType).toBe('flat');
279
- });
280
- });
281
-
282
- describe('round-trip conversion', () => {
283
- it('should preserve key config values through round-trip', () => {
284
- const originalSystemConfig: SystemConfig = {
285
- orchestrator: {
286
- lifecycle: {
287
- autoStart: true,
288
- maxConcurrentAgents: 12,
289
- shutdownTimeoutMs: 30000,
290
- cleanupOrphanedAgents: true,
291
- },
292
- session: {
293
- dataDir: '/test/roundtrip',
294
- persistState: true,
295
- stateFile: 'session.json',
296
- },
297
- monitoring: {
298
- enabled: true,
299
- metricsIntervalMs: 5000,
300
- healthCheckIntervalMs: 8000,
301
- },
302
- },
303
- swarm: {
304
- topology: 'hierarchical-mesh',
305
- maxAgents: 12,
306
- },
307
- memory: {
308
- type: 'hybrid',
309
- path: '/test/memory',
310
- agentdb: {
311
- dimensions: 1536,
312
- indexType: 'hnsw',
313
- efConstruction: 200,
314
- m: 16,
315
- quantization: 'none',
316
- },
317
- },
318
- mcp: {
319
- enabled: true,
320
- transport: {
321
- type: 'http',
322
- host: '127.0.0.1',
323
- port: 5000,
324
- },
325
- enabledTools: ['test/*'],
326
- security: {
327
- requireAuth: false,
328
- allowedOrigins: ['*'],
329
- rateLimiting: {
330
- enabled: true,
331
- maxRequestsPerMinute: 100,
332
- },
333
- },
334
- },
335
- logging: {
336
- level: 'warn',
337
- pretty: true,
338
- destination: 'console',
339
- format: 'text',
340
- },
341
- hooks: {
342
- enabled: true,
343
- autoExecute: true,
344
- definitions: [],
345
- },
346
- };
347
-
348
- const v3Config = systemConfigToV3Config(originalSystemConfig);
349
- const roundTripConfig = v3ConfigToSystemConfig(v3Config);
350
-
351
- // Core values preserved through round-trip
352
- expect(roundTripConfig.orchestrator?.lifecycle?.maxConcurrentAgents).toBe(12);
353
- expect(roundTripConfig.swarm?.topology).toBe('hierarchical-mesh');
354
- expect(roundTripConfig.swarm?.maxAgents).toBe(12);
355
- expect(roundTripConfig.memory?.type).toBe('hybrid');
356
- expect(roundTripConfig.memory?.path).toBe('/test/memory');
357
- expect(roundTripConfig.mcp?.transport?.type).toBe('http');
358
- expect(roundTripConfig.mcp?.transport?.port).toBe(5000);
359
- // Note: logging is not included in v3ConfigToSystemConfig
360
- });
361
- });
362
- });
@@ -1,106 +0,0 @@
1
- /**
2
- * Config Loading Integration Tests
3
- */
4
-
5
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
6
- import { mkdtemp, rm, writeFile } from 'fs/promises';
7
- import { join } from 'path';
8
- import { tmpdir } from 'os';
9
- import { CLI } from '../src/index.js';
10
-
11
- describe('Config Loading', () => {
12
- let tempDir: string;
13
-
14
- beforeEach(async () => {
15
- tempDir = await mkdtemp(join(tmpdir(), 'cli-config-test-'));
16
- });
17
-
18
- afterEach(async () => {
19
- await rm(tempDir, { recursive: true, force: true });
20
- });
21
-
22
- it('should load config from file when specified', async () => {
23
- const configPath = join(tempDir, 'claude-flow.config.json');
24
- const config = {
25
- orchestrator: {
26
- lifecycle: {
27
- autoStart: true,
28
- maxConcurrentAgents: 10,
29
- shutdownTimeoutMs: 30000,
30
- cleanupOrphanedAgents: true,
31
- },
32
- session: {
33
- dataDir: tempDir,
34
- persistState: true,
35
- stateFile: 'session.json',
36
- },
37
- monitoring: {
38
- enabled: true,
39
- metricsIntervalMs: 5000,
40
- healthCheckIntervalMs: 10000,
41
- },
42
- },
43
- swarm: {
44
- topology: 'hierarchical-mesh',
45
- maxAgents: 15,
46
- },
47
- memory: {
48
- type: 'hybrid',
49
- },
50
- mcp: {
51
- enabled: true,
52
- transport: {
53
- type: 'stdio',
54
- host: 'localhost',
55
- port: 3000,
56
- },
57
- enabledTools: [],
58
- security: {
59
- requireAuth: false,
60
- allowedOrigins: ['*'],
61
- rateLimiting: {
62
- enabled: true,
63
- maxRequestsPerMinute: 100,
64
- },
65
- },
66
- },
67
- logging: {
68
- level: 'info',
69
- pretty: true,
70
- destination: 'console',
71
- format: 'text',
72
- },
73
- hooks: {
74
- enabled: true,
75
- autoExecute: false,
76
- definitions: [],
77
- },
78
- };
79
-
80
- await writeFile(configPath, JSON.stringify(config, null, 2));
81
-
82
- // Create CLI instance and verify config loading works
83
- const cli = new CLI();
84
-
85
- // The config loading is tested indirectly through the CLI's run method
86
- // but we've already tested the adapter functions in config-adapter.test.ts
87
- expect(cli).toBeDefined();
88
- });
89
-
90
- it('should handle missing config file gracefully', async () => {
91
- const cli = new CLI();
92
-
93
- // Should not throw when config file doesn't exist
94
- expect(cli).toBeDefined();
95
- });
96
-
97
- it('should handle invalid config file gracefully', async () => {
98
- const configPath = join(tempDir, 'claude-flow.config.json');
99
- await writeFile(configPath, '{ invalid json }');
100
-
101
- const cli = new CLI();
102
-
103
- // Should not throw when config file is invalid
104
- expect(cli).toBeDefined();
105
- });
106
- });
@@ -1 +0,0 @@
1
- {"result":[]}
@@ -1 +0,0 @@
1
- {"result":[]}
@@ -1 +0,0 @@
1
- {"result":[]}
@@ -1 +0,0 @@
1
- {"result":[]}
@@ -1 +0,0 @@
1
- {"result":[]}
@@ -1 +0,0 @@
1
- {"result":[]}