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

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 (102) hide show
  1. package/package.json +12 -4
  2. package/.agentic-flow/intelligence.json +0 -17
  3. package/.claude-flow/agents/store.json +0 -16
  4. package/.claude-flow/daemon-state.json +0 -123
  5. package/.claude-flow/daemon-test.log +0 -0
  6. package/.claude-flow/daemon.log +0 -0
  7. package/.claude-flow/daemon2.log +0 -0
  8. package/.claude-flow/daemon3.log +0 -0
  9. package/.claude-flow/hive-mind/state.json +0 -51
  10. package/.claude-flow/metrics/agent-metrics.json +0 -1
  11. package/.claude-flow/metrics/codebase-map.json +0 -11
  12. package/.claude-flow/metrics/consolidation.json +0 -6
  13. package/.claude-flow/metrics/performance.json +0 -87
  14. package/.claude-flow/metrics/security-audit.json +0 -10
  15. package/.claude-flow/metrics/task-metrics.json +0 -10
  16. package/.claude-flow/metrics/test-gaps.json +0 -6
  17. package/__tests__/README.md +0 -140
  18. package/__tests__/TEST_SUMMARY.md +0 -144
  19. package/__tests__/cli.test.ts +0 -558
  20. package/__tests__/commands.test.ts +0 -726
  21. package/__tests__/config-adapter.test.ts +0 -362
  22. package/__tests__/config-loading.test.ts +0 -106
  23. package/__tests__/coverage/.tmp/coverage-0.json +0 -1
  24. package/__tests__/coverage/.tmp/coverage-1.json +0 -1
  25. package/__tests__/coverage/.tmp/coverage-2.json +0 -1
  26. package/__tests__/coverage/.tmp/coverage-3.json +0 -1
  27. package/__tests__/coverage/.tmp/coverage-4.json +0 -1
  28. package/__tests__/coverage/.tmp/coverage-5.json +0 -1
  29. package/__tests__/mcp-client.test.ts +0 -480
  30. package/__tests__/p1-commands.test.ts +0 -1064
  31. package/agents/architect.yaml +0 -11
  32. package/agents/coder.yaml +0 -11
  33. package/agents/reviewer.yaml +0 -10
  34. package/agents/security-architect.yaml +0 -10
  35. package/agents/tester.yaml +0 -10
  36. package/docs/CONFIG_LOADING.md +0 -236
  37. package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
  38. package/docs/MCP_CLIENT_GUIDE.md +0 -620
  39. package/docs/REFACTORING_SUMMARY.md +0 -247
  40. package/scripts/publish.sh +0 -46
  41. package/src/commands/agent.ts +0 -955
  42. package/src/commands/claims.ts +0 -317
  43. package/src/commands/completions.ts +0 -558
  44. package/src/commands/config.ts +0 -452
  45. package/src/commands/daemon.ts +0 -621
  46. package/src/commands/deployment.ts +0 -323
  47. package/src/commands/doctor.ts +0 -382
  48. package/src/commands/embeddings.ts +0 -686
  49. package/src/commands/hive-mind.ts +0 -928
  50. package/src/commands/hooks.ts +0 -2603
  51. package/src/commands/index.ts +0 -154
  52. package/src/commands/init.ts +0 -597
  53. package/src/commands/mcp.ts +0 -753
  54. package/src/commands/memory.ts +0 -1161
  55. package/src/commands/migrate.ts +0 -447
  56. package/src/commands/neural.ts +0 -253
  57. package/src/commands/performance.ts +0 -292
  58. package/src/commands/plugins.ts +0 -316
  59. package/src/commands/process.ts +0 -695
  60. package/src/commands/providers.ts +0 -259
  61. package/src/commands/security.ts +0 -288
  62. package/src/commands/session.ts +0 -891
  63. package/src/commands/start.ts +0 -457
  64. package/src/commands/status.ts +0 -736
  65. package/src/commands/swarm.ts +0 -648
  66. package/src/commands/task.ts +0 -792
  67. package/src/commands/workflow.ts +0 -742
  68. package/src/config-adapter.ts +0 -210
  69. package/src/index.ts +0 -443
  70. package/src/infrastructure/in-memory-repositories.ts +0 -310
  71. package/src/init/claudemd-generator.ts +0 -631
  72. package/src/init/executor.ts +0 -762
  73. package/src/init/helpers-generator.ts +0 -628
  74. package/src/init/index.ts +0 -60
  75. package/src/init/mcp-generator.ts +0 -83
  76. package/src/init/settings-generator.ts +0 -284
  77. package/src/init/statusline-generator.ts +0 -211
  78. package/src/init/types.ts +0 -447
  79. package/src/mcp-client.ts +0 -241
  80. package/src/mcp-server.ts +0 -577
  81. package/src/mcp-tools/agent-tools.ts +0 -466
  82. package/src/mcp-tools/config-tools.ts +0 -370
  83. package/src/mcp-tools/hive-mind-tools.ts +0 -521
  84. package/src/mcp-tools/hooks-tools.ts +0 -1888
  85. package/src/mcp-tools/index.ts +0 -16
  86. package/src/mcp-tools/memory-tools.ts +0 -270
  87. package/src/mcp-tools/session-tools.ts +0 -359
  88. package/src/mcp-tools/swarm-tools.ts +0 -105
  89. package/src/mcp-tools/task-tools.ts +0 -347
  90. package/src/mcp-tools/types.ts +0 -33
  91. package/src/mcp-tools/workflow-tools.ts +0 -573
  92. package/src/output.ts +0 -639
  93. package/src/parser.ts +0 -417
  94. package/src/prompt.ts +0 -619
  95. package/src/services/index.ts +0 -15
  96. package/src/services/worker-daemon.ts +0 -726
  97. package/src/suggest.ts +0 -245
  98. package/src/types.ts +0 -287
  99. package/tmp.json +0 -0
  100. package/tsconfig.json +0 -16
  101. package/tsconfig.tsbuildinfo +0 -1
  102. 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
- ];