@claude-flow/cli 3.0.0-alpha.13 → 3.0.0-alpha.15

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 (106) hide show
  1. package/dist/src/commands/doctor.d.ts.map +1 -1
  2. package/dist/src/commands/doctor.js +75 -2
  3. package/dist/src/commands/doctor.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +12 -4
  6. package/.agentic-flow/intelligence.json +0 -17
  7. package/.claude-flow/agents/store.json +0 -16
  8. package/.claude-flow/daemon-state.json +0 -123
  9. package/.claude-flow/daemon-test.log +0 -0
  10. package/.claude-flow/daemon.log +0 -0
  11. package/.claude-flow/daemon2.log +0 -0
  12. package/.claude-flow/daemon3.log +0 -0
  13. package/.claude-flow/hive-mind/state.json +0 -51
  14. package/.claude-flow/metrics/agent-metrics.json +0 -1
  15. package/.claude-flow/metrics/codebase-map.json +0 -11
  16. package/.claude-flow/metrics/consolidation.json +0 -6
  17. package/.claude-flow/metrics/performance.json +0 -87
  18. package/.claude-flow/metrics/security-audit.json +0 -10
  19. package/.claude-flow/metrics/task-metrics.json +0 -10
  20. package/.claude-flow/metrics/test-gaps.json +0 -6
  21. package/__tests__/README.md +0 -140
  22. package/__tests__/TEST_SUMMARY.md +0 -144
  23. package/__tests__/cli.test.ts +0 -558
  24. package/__tests__/commands.test.ts +0 -726
  25. package/__tests__/config-adapter.test.ts +0 -362
  26. package/__tests__/config-loading.test.ts +0 -106
  27. package/__tests__/coverage/.tmp/coverage-0.json +0 -1
  28. package/__tests__/coverage/.tmp/coverage-1.json +0 -1
  29. package/__tests__/coverage/.tmp/coverage-2.json +0 -1
  30. package/__tests__/coverage/.tmp/coverage-3.json +0 -1
  31. package/__tests__/coverage/.tmp/coverage-4.json +0 -1
  32. package/__tests__/coverage/.tmp/coverage-5.json +0 -1
  33. package/__tests__/mcp-client.test.ts +0 -480
  34. package/__tests__/p1-commands.test.ts +0 -1064
  35. package/agents/architect.yaml +0 -11
  36. package/agents/coder.yaml +0 -11
  37. package/agents/reviewer.yaml +0 -10
  38. package/agents/security-architect.yaml +0 -10
  39. package/agents/tester.yaml +0 -10
  40. package/docs/CONFIG_LOADING.md +0 -236
  41. package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
  42. package/docs/MCP_CLIENT_GUIDE.md +0 -620
  43. package/docs/REFACTORING_SUMMARY.md +0 -247
  44. package/scripts/publish.sh +0 -46
  45. package/src/commands/agent.ts +0 -955
  46. package/src/commands/claims.ts +0 -317
  47. package/src/commands/completions.ts +0 -558
  48. package/src/commands/config.ts +0 -452
  49. package/src/commands/daemon.ts +0 -621
  50. package/src/commands/deployment.ts +0 -323
  51. package/src/commands/doctor.ts +0 -382
  52. package/src/commands/embeddings.ts +0 -686
  53. package/src/commands/hive-mind.ts +0 -928
  54. package/src/commands/hooks.ts +0 -2603
  55. package/src/commands/index.ts +0 -154
  56. package/src/commands/init.ts +0 -597
  57. package/src/commands/mcp.ts +0 -753
  58. package/src/commands/memory.ts +0 -1161
  59. package/src/commands/migrate.ts +0 -447
  60. package/src/commands/neural.ts +0 -253
  61. package/src/commands/performance.ts +0 -292
  62. package/src/commands/plugins.ts +0 -316
  63. package/src/commands/process.ts +0 -695
  64. package/src/commands/providers.ts +0 -259
  65. package/src/commands/security.ts +0 -288
  66. package/src/commands/session.ts +0 -891
  67. package/src/commands/start.ts +0 -457
  68. package/src/commands/status.ts +0 -736
  69. package/src/commands/swarm.ts +0 -648
  70. package/src/commands/task.ts +0 -792
  71. package/src/commands/workflow.ts +0 -742
  72. package/src/config-adapter.ts +0 -210
  73. package/src/index.ts +0 -443
  74. package/src/infrastructure/in-memory-repositories.ts +0 -310
  75. package/src/init/claudemd-generator.ts +0 -631
  76. package/src/init/executor.ts +0 -762
  77. package/src/init/helpers-generator.ts +0 -628
  78. package/src/init/index.ts +0 -60
  79. package/src/init/mcp-generator.ts +0 -83
  80. package/src/init/settings-generator.ts +0 -284
  81. package/src/init/statusline-generator.ts +0 -211
  82. package/src/init/types.ts +0 -447
  83. package/src/mcp-client.ts +0 -241
  84. package/src/mcp-server.ts +0 -577
  85. package/src/mcp-tools/agent-tools.ts +0 -466
  86. package/src/mcp-tools/config-tools.ts +0 -370
  87. package/src/mcp-tools/hive-mind-tools.ts +0 -521
  88. package/src/mcp-tools/hooks-tools.ts +0 -1888
  89. package/src/mcp-tools/index.ts +0 -16
  90. package/src/mcp-tools/memory-tools.ts +0 -270
  91. package/src/mcp-tools/session-tools.ts +0 -359
  92. package/src/mcp-tools/swarm-tools.ts +0 -105
  93. package/src/mcp-tools/task-tools.ts +0 -347
  94. package/src/mcp-tools/types.ts +0 -33
  95. package/src/mcp-tools/workflow-tools.ts +0 -573
  96. package/src/output.ts +0 -639
  97. package/src/parser.ts +0 -417
  98. package/src/prompt.ts +0 -619
  99. package/src/services/index.ts +0 -15
  100. package/src/services/worker-daemon.ts +0 -726
  101. package/src/suggest.ts +0 -245
  102. package/src/types.ts +0 -287
  103. package/tmp.json +0 -0
  104. package/tsconfig.json +0 -16
  105. package/tsconfig.tsbuildinfo +0 -1
  106. package/vitest.config.ts +0 -13
@@ -1,370 +0,0 @@
1
- /**
2
- * Config MCP Tools for CLI
3
- *
4
- * Tool definitions for configuration management with file persistence.
5
- */
6
-
7
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
8
- import { join } from 'node:path';
9
- import type { MCPTool } from './types.js';
10
-
11
- // Storage paths
12
- const STORAGE_DIR = '.claude-flow';
13
- const CONFIG_FILE = 'config.json';
14
-
15
- interface ConfigStore {
16
- values: Record<string, unknown>;
17
- scopes: Record<string, Record<string, unknown>>;
18
- version: string;
19
- updatedAt: string;
20
- }
21
-
22
- const DEFAULT_CONFIG: Record<string, unknown> = {
23
- 'swarm.topology': 'mesh',
24
- 'swarm.maxAgents': 10,
25
- 'swarm.autoScale': true,
26
- 'memory.persistInterval': 60000,
27
- 'memory.maxEntries': 10000,
28
- 'session.autoSave': true,
29
- 'session.saveInterval': 300000,
30
- 'logging.level': 'info',
31
- 'logging.format': 'json',
32
- 'security.sandboxEnabled': true,
33
- 'security.pathValidation': true,
34
- };
35
-
36
- function getConfigDir(): string {
37
- return join(process.cwd(), STORAGE_DIR);
38
- }
39
-
40
- function getConfigPath(): string {
41
- return join(getConfigDir(), CONFIG_FILE);
42
- }
43
-
44
- function ensureConfigDir(): void {
45
- const dir = getConfigDir();
46
- if (!existsSync(dir)) {
47
- mkdirSync(dir, { recursive: true });
48
- }
49
- }
50
-
51
- function loadConfigStore(): ConfigStore {
52
- try {
53
- const path = getConfigPath();
54
- if (existsSync(path)) {
55
- const data = readFileSync(path, 'utf-8');
56
- return JSON.parse(data);
57
- }
58
- } catch {
59
- // Return default store on error
60
- }
61
- return {
62
- values: { ...DEFAULT_CONFIG },
63
- scopes: {},
64
- version: '3.0.0',
65
- updatedAt: new Date().toISOString(),
66
- };
67
- }
68
-
69
- function saveConfigStore(store: ConfigStore): void {
70
- ensureConfigDir();
71
- store.updatedAt = new Date().toISOString();
72
- writeFileSync(getConfigPath(), JSON.stringify(store, null, 2), 'utf-8');
73
- }
74
-
75
- function getNestedValue(obj: Record<string, unknown>, key: string): unknown {
76
- const parts = key.split('.');
77
- let current: unknown = obj;
78
- for (const part of parts) {
79
- if (current && typeof current === 'object' && part in (current as Record<string, unknown>)) {
80
- current = (current as Record<string, unknown>)[part];
81
- } else {
82
- return undefined;
83
- }
84
- }
85
- return current;
86
- }
87
-
88
- function setNestedValue(obj: Record<string, unknown>, key: string, value: unknown): void {
89
- const parts = key.split('.');
90
- let current = obj;
91
- for (let i = 0; i < parts.length - 1; i++) {
92
- const part = parts[i];
93
- if (!(part in current) || typeof current[part] !== 'object') {
94
- current[part] = {};
95
- }
96
- current = current[part] as Record<string, unknown>;
97
- }
98
- current[parts[parts.length - 1]] = value;
99
- }
100
-
101
- export const configTools: MCPTool[] = [
102
- {
103
- name: 'config/get',
104
- description: 'Get configuration value',
105
- category: 'config',
106
- inputSchema: {
107
- type: 'object',
108
- properties: {
109
- key: { type: 'string', description: 'Configuration key (dot notation supported)' },
110
- scope: { type: 'string', description: 'Configuration scope (project, user, system)' },
111
- },
112
- required: ['key'],
113
- },
114
- handler: async (input) => {
115
- const store = loadConfigStore();
116
- const key = input.key as string;
117
- const scope = (input.scope as string) || 'default';
118
-
119
- let value: unknown;
120
-
121
- // Check scope first, then default values
122
- if (scope !== 'default' && store.scopes[scope]) {
123
- value = store.scopes[scope][key];
124
- }
125
- if (value === undefined) {
126
- value = store.values[key];
127
- }
128
- if (value === undefined) {
129
- value = DEFAULT_CONFIG[key];
130
- }
131
-
132
- return {
133
- key,
134
- value,
135
- scope,
136
- exists: value !== undefined,
137
- source: value !== undefined ? (store.values[key] !== undefined ? 'stored' : 'default') : 'none',
138
- };
139
- },
140
- },
141
- {
142
- name: 'config/set',
143
- description: 'Set configuration value',
144
- category: 'config',
145
- inputSchema: {
146
- type: 'object',
147
- properties: {
148
- key: { type: 'string', description: 'Configuration key (dot notation supported)' },
149
- value: { description: 'Configuration value' },
150
- scope: { type: 'string', description: 'Configuration scope (project, user, system)' },
151
- },
152
- required: ['key', 'value'],
153
- },
154
- handler: async (input) => {
155
- const store = loadConfigStore();
156
- const key = input.key as string;
157
- const value = input.value;
158
- const scope = (input.scope as string) || 'default';
159
-
160
- const previousValue = store.values[key];
161
-
162
- if (scope === 'default') {
163
- store.values[key] = value;
164
- } else {
165
- if (!store.scopes[scope]) {
166
- store.scopes[scope] = {};
167
- }
168
- store.scopes[scope][key] = value;
169
- }
170
-
171
- saveConfigStore(store);
172
-
173
- return {
174
- success: true,
175
- key,
176
- value,
177
- previousValue,
178
- scope,
179
- path: getConfigPath(),
180
- };
181
- },
182
- },
183
- {
184
- name: 'config/list',
185
- description: 'List configuration values',
186
- category: 'config',
187
- inputSchema: {
188
- type: 'object',
189
- properties: {
190
- scope: { type: 'string', description: 'Configuration scope' },
191
- prefix: { type: 'string', description: 'Key prefix filter' },
192
- includeDefaults: { type: 'boolean', description: 'Include default values' },
193
- },
194
- },
195
- handler: async (input) => {
196
- const store = loadConfigStore();
197
- const scope = (input.scope as string) || 'default';
198
- const prefix = input.prefix as string;
199
- const includeDefaults = input.includeDefaults !== false;
200
-
201
- // Merge stored values with defaults
202
- let configs: Record<string, unknown> = {};
203
-
204
- if (includeDefaults) {
205
- configs = { ...DEFAULT_CONFIG };
206
- }
207
-
208
- // Add stored values
209
- Object.assign(configs, store.values);
210
-
211
- // Add scope-specific values
212
- if (scope !== 'default' && store.scopes[scope]) {
213
- Object.assign(configs, store.scopes[scope]);
214
- }
215
-
216
- // Filter by prefix
217
- let entries = Object.entries(configs);
218
- if (prefix) {
219
- entries = entries.filter(([key]) => key.startsWith(prefix));
220
- }
221
-
222
- // Sort by key
223
- entries.sort(([a], [b]) => a.localeCompare(b));
224
-
225
- return {
226
- configs: entries.map(([key, value]) => ({
227
- key,
228
- value,
229
- source: store.values[key] !== undefined ? 'stored' : 'default',
230
- })),
231
- total: entries.length,
232
- scope,
233
- updatedAt: store.updatedAt,
234
- };
235
- },
236
- },
237
- {
238
- name: 'config/reset',
239
- description: 'Reset configuration to defaults',
240
- category: 'config',
241
- inputSchema: {
242
- type: 'object',
243
- properties: {
244
- scope: { type: 'string', description: 'Configuration scope' },
245
- key: { type: 'string', description: 'Specific key to reset (omit to reset all)' },
246
- },
247
- },
248
- handler: async (input) => {
249
- const store = loadConfigStore();
250
- const scope = (input.scope as string) || 'default';
251
- const key = input.key as string;
252
-
253
- let resetKeys: string[] = [];
254
-
255
- if (key) {
256
- // Reset specific key
257
- if (scope === 'default') {
258
- if (key in store.values) {
259
- delete store.values[key];
260
- resetKeys.push(key);
261
- }
262
- } else if (store.scopes[scope] && key in store.scopes[scope]) {
263
- delete store.scopes[scope][key];
264
- resetKeys.push(key);
265
- }
266
- } else {
267
- // Reset all keys in scope
268
- if (scope === 'default') {
269
- resetKeys = Object.keys(store.values);
270
- store.values = { ...DEFAULT_CONFIG };
271
- } else if (store.scopes[scope]) {
272
- resetKeys = Object.keys(store.scopes[scope]);
273
- delete store.scopes[scope];
274
- }
275
- }
276
-
277
- saveConfigStore(store);
278
-
279
- return {
280
- success: true,
281
- scope,
282
- reset: key || 'all',
283
- resetKeys,
284
- count: resetKeys.length,
285
- };
286
- },
287
- },
288
- {
289
- name: 'config/export',
290
- description: 'Export configuration to JSON',
291
- category: 'config',
292
- inputSchema: {
293
- type: 'object',
294
- properties: {
295
- scope: { type: 'string', description: 'Configuration scope' },
296
- includeDefaults: { type: 'boolean', description: 'Include default values' },
297
- },
298
- },
299
- handler: async (input) => {
300
- const store = loadConfigStore();
301
- const scope = (input.scope as string) || 'default';
302
- const includeDefaults = input.includeDefaults !== false;
303
-
304
- let exportData: Record<string, unknown> = {};
305
-
306
- if (includeDefaults) {
307
- exportData = { ...DEFAULT_CONFIG };
308
- }
309
-
310
- Object.assign(exportData, store.values);
311
-
312
- if (scope !== 'default' && store.scopes[scope]) {
313
- Object.assign(exportData, store.scopes[scope]);
314
- }
315
-
316
- return {
317
- config: exportData,
318
- scope,
319
- version: store.version,
320
- exportedAt: new Date().toISOString(),
321
- count: Object.keys(exportData).length,
322
- };
323
- },
324
- },
325
- {
326
- name: 'config/import',
327
- description: 'Import configuration from JSON',
328
- category: 'config',
329
- inputSchema: {
330
- type: 'object',
331
- properties: {
332
- config: { type: 'object', description: 'Configuration object to import' },
333
- scope: { type: 'string', description: 'Configuration scope' },
334
- merge: { type: 'boolean', description: 'Merge with existing (true) or replace (false)' },
335
- },
336
- required: ['config'],
337
- },
338
- handler: async (input) => {
339
- const store = loadConfigStore();
340
- const config = input.config as Record<string, unknown>;
341
- const scope = (input.scope as string) || 'default';
342
- const merge = input.merge !== false;
343
-
344
- const importedKeys: string[] = Object.keys(config);
345
-
346
- if (scope === 'default') {
347
- if (merge) {
348
- Object.assign(store.values, config);
349
- } else {
350
- store.values = { ...DEFAULT_CONFIG, ...config };
351
- }
352
- } else {
353
- if (!store.scopes[scope] || !merge) {
354
- store.scopes[scope] = {};
355
- }
356
- Object.assign(store.scopes[scope], config);
357
- }
358
-
359
- saveConfigStore(store);
360
-
361
- return {
362
- success: true,
363
- scope,
364
- imported: importedKeys.length,
365
- keys: importedKeys,
366
- merge,
367
- };
368
- },
369
- },
370
- ];