@claude-flow/cli 3.0.0-alpha.6 → 3.0.0-alpha.7
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.
- package/.agentic-flow/intelligence.json +4 -4
- package/.claude-flow/agents/store.json +16 -0
- package/.claude-flow/daemon-state.json +123 -0
- package/.claude-flow/hive-mind/state.json +51 -0
- package/.claude-flow/metrics/codebase-map.json +11 -0
- package/.claude-flow/metrics/consolidation.json +6 -0
- package/.claude-flow/metrics/performance.json +3 -3
- package/.claude-flow/metrics/security-audit.json +10 -0
- package/.claude-flow/metrics/task-metrics.json +3 -3
- package/.claude-flow/metrics/test-gaps.json +6 -0
- package/agents/architect.yaml +1 -1
- package/agents/coder.yaml +1 -1
- package/agents/reviewer.yaml +1 -1
- package/agents/security-architect.yaml +1 -1
- package/agents/tester.yaml +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +42 -26
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +351 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +252 -35
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/index.d.ts +1 -0
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +4 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/start.js +2 -2
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +22 -12
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +13 -1
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +350 -14
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +262 -15
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +46 -7
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +2 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +2 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +237 -22
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +219 -17
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +481 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/services/index.d.ts +7 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +6 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +126 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +464 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/commands/agent.ts +42 -28
- package/src/commands/daemon.ts +395 -0
- package/src/commands/hive-mind.ts +229 -63
- package/src/commands/index.ts +4 -1
- package/src/commands/start.ts +2 -2
- package/src/index.ts +5 -2
- package/src/init/settings-generator.ts +22 -12
- package/src/mcp-client.ts +13 -1
- package/src/mcp-tools/agent-tools.ts +388 -14
- package/src/mcp-tools/config-tools.ts +297 -15
- package/src/mcp-tools/hive-mind-tools.ts +521 -0
- package/src/mcp-tools/hooks-tools.ts +46 -7
- package/src/mcp-tools/index.ts +2 -0
- package/src/mcp-tools/session-tools.ts +280 -23
- package/src/mcp-tools/task-tools.ts +265 -20
- package/src/mcp-tools/workflow-tools.ts +573 -0
- package/src/services/index.ts +15 -0
- package/src/services/worker-daemon.ts +594 -0
|
@@ -1,11 +1,103 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Config MCP Tools for CLI
|
|
3
3
|
*
|
|
4
|
-
* Tool definitions for configuration management.
|
|
4
|
+
* Tool definitions for configuration management with file persistence.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
7
9
|
import type { MCPTool } from './types.js';
|
|
8
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
|
+
|
|
9
101
|
export const configTools: MCPTool[] = [
|
|
10
102
|
{
|
|
11
103
|
name: 'config/get',
|
|
@@ -14,16 +106,35 @@ export const configTools: MCPTool[] = [
|
|
|
14
106
|
inputSchema: {
|
|
15
107
|
type: 'object',
|
|
16
108
|
properties: {
|
|
17
|
-
key: { type: 'string', description: 'Configuration key' },
|
|
18
|
-
scope: { type: 'string', description: 'Configuration scope' },
|
|
109
|
+
key: { type: 'string', description: 'Configuration key (dot notation supported)' },
|
|
110
|
+
scope: { type: 'string', description: 'Configuration scope (project, user, system)' },
|
|
19
111
|
},
|
|
20
112
|
required: ['key'],
|
|
21
113
|
},
|
|
22
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
|
+
|
|
23
132
|
return {
|
|
24
|
-
key
|
|
25
|
-
value
|
|
26
|
-
scope
|
|
133
|
+
key,
|
|
134
|
+
value,
|
|
135
|
+
scope,
|
|
136
|
+
exists: value !== undefined,
|
|
137
|
+
source: value !== undefined ? (store.values[key] !== undefined ? 'stored' : 'default') : 'none',
|
|
27
138
|
};
|
|
28
139
|
},
|
|
29
140
|
},
|
|
@@ -34,17 +145,38 @@ export const configTools: MCPTool[] = [
|
|
|
34
145
|
inputSchema: {
|
|
35
146
|
type: 'object',
|
|
36
147
|
properties: {
|
|
37
|
-
key: { type: 'string', description: 'Configuration key' },
|
|
148
|
+
key: { type: 'string', description: 'Configuration key (dot notation supported)' },
|
|
38
149
|
value: { description: 'Configuration value' },
|
|
39
|
-
scope: { type: 'string', description: 'Configuration scope' },
|
|
150
|
+
scope: { type: 'string', description: 'Configuration scope (project, user, system)' },
|
|
40
151
|
},
|
|
41
152
|
required: ['key', 'value'],
|
|
42
153
|
},
|
|
43
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
|
+
|
|
44
173
|
return {
|
|
45
174
|
success: true,
|
|
46
|
-
key
|
|
47
|
-
|
|
175
|
+
key,
|
|
176
|
+
value,
|
|
177
|
+
previousValue,
|
|
178
|
+
scope,
|
|
179
|
+
path: getConfigPath(),
|
|
48
180
|
};
|
|
49
181
|
},
|
|
50
182
|
},
|
|
@@ -57,12 +189,48 @@ export const configTools: MCPTool[] = [
|
|
|
57
189
|
properties: {
|
|
58
190
|
scope: { type: 'string', description: 'Configuration scope' },
|
|
59
191
|
prefix: { type: 'string', description: 'Key prefix filter' },
|
|
192
|
+
includeDefaults: { type: 'boolean', description: 'Include default values' },
|
|
60
193
|
},
|
|
61
194
|
},
|
|
62
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
|
+
|
|
63
225
|
return {
|
|
64
|
-
configs: []
|
|
65
|
-
|
|
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,
|
|
66
234
|
};
|
|
67
235
|
},
|
|
68
236
|
},
|
|
@@ -74,14 +242,128 @@ export const configTools: MCPTool[] = [
|
|
|
74
242
|
type: 'object',
|
|
75
243
|
properties: {
|
|
76
244
|
scope: { type: 'string', description: 'Configuration scope' },
|
|
77
|
-
key: { type: 'string', description: 'Specific key to reset' },
|
|
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' },
|
|
78
297
|
},
|
|
79
298
|
},
|
|
80
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
|
+
|
|
81
361
|
return {
|
|
82
362
|
success: true,
|
|
83
|
-
scope
|
|
84
|
-
|
|
363
|
+
scope,
|
|
364
|
+
imported: importedKeys.length,
|
|
365
|
+
keys: importedKeys,
|
|
366
|
+
merge,
|
|
85
367
|
};
|
|
86
368
|
},
|
|
87
369
|
},
|