@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,382 +0,0 @@
1
- /**
2
- * V3 CLI Doctor Command
3
- * System diagnostics, dependency checks, config validation
4
- *
5
- * Created with ruv.io
6
- */
7
-
8
- import type { Command, CommandContext, CommandResult } from '../types.js';
9
- import { output } from '../output.js';
10
- import { existsSync, readFileSync } from 'fs';
11
- import { join } from 'path';
12
- import { execSync } from 'child_process';
13
-
14
- interface HealthCheck {
15
- name: string;
16
- status: 'pass' | 'warn' | 'fail';
17
- message: string;
18
- fix?: string;
19
- }
20
-
21
- // Check Node.js version
22
- async function checkNodeVersion(): Promise<HealthCheck> {
23
- const requiredMajor = 20;
24
- const version = process.version;
25
- const major = parseInt(version.slice(1).split('.')[0], 10);
26
-
27
- if (major >= requiredMajor) {
28
- return { name: 'Node.js Version', status: 'pass', message: `${version} (>= ${requiredMajor} required)` };
29
- } else if (major >= 18) {
30
- return { name: 'Node.js Version', status: 'warn', message: `${version} (>= ${requiredMajor} recommended)`, fix: 'nvm install 20 && nvm use 20' };
31
- } else {
32
- return { name: 'Node.js Version', status: 'fail', message: `${version} (>= ${requiredMajor} required)`, fix: 'nvm install 20 && nvm use 20' };
33
- }
34
- }
35
-
36
- // Check npm version
37
- async function checkNpmVersion(): Promise<HealthCheck> {
38
- try {
39
- const version = execSync('npm --version', { encoding: 'utf8' }).trim();
40
- const major = parseInt(version.split('.')[0], 10);
41
- if (major >= 9) {
42
- return { name: 'npm Version', status: 'pass', message: `v${version}` };
43
- } else {
44
- return { name: 'npm Version', status: 'warn', message: `v${version} (>= 9 recommended)`, fix: 'npm install -g npm@latest' };
45
- }
46
- } catch {
47
- return { name: 'npm Version', status: 'fail', message: 'npm not found', fix: 'Install Node.js from https://nodejs.org' };
48
- }
49
- }
50
-
51
- // Check config file
52
- async function checkConfigFile(): Promise<HealthCheck> {
53
- const configPaths = [
54
- '.claude-flow/config.json',
55
- 'claude-flow.config.json',
56
- '.claude-flow.json'
57
- ];
58
-
59
- for (const configPath of configPaths) {
60
- if (existsSync(configPath)) {
61
- try {
62
- const content = readFileSync(configPath, 'utf8');
63
- JSON.parse(content);
64
- return { name: 'Config File', status: 'pass', message: `Found: ${configPath}` };
65
- } catch (e) {
66
- return { name: 'Config File', status: 'fail', message: `Invalid JSON: ${configPath}`, fix: 'Fix JSON syntax in config file' };
67
- }
68
- }
69
- }
70
-
71
- return { name: 'Config File', status: 'warn', message: 'No config file (using defaults)', fix: 'claude-flow config init' };
72
- }
73
-
74
- // Check daemon status
75
- async function checkDaemonStatus(): Promise<HealthCheck> {
76
- try {
77
- const pidFile = '.claude-flow/daemon.pid';
78
- if (existsSync(pidFile)) {
79
- const pid = readFileSync(pidFile, 'utf8').trim();
80
- try {
81
- process.kill(parseInt(pid, 10), 0); // Check if process exists
82
- return { name: 'Daemon Status', status: 'pass', message: `Running (PID: ${pid})` };
83
- } catch {
84
- return { name: 'Daemon Status', status: 'warn', message: 'Stale PID file', fix: 'rm .claude-flow/daemon.pid && claude-flow daemon start' };
85
- }
86
- }
87
- return { name: 'Daemon Status', status: 'warn', message: 'Not running', fix: 'claude-flow daemon start' };
88
- } catch {
89
- return { name: 'Daemon Status', status: 'warn', message: 'Unable to check', fix: 'claude-flow daemon status' };
90
- }
91
- }
92
-
93
- // Check memory database
94
- async function checkMemoryDatabase(): Promise<HealthCheck> {
95
- const dbPaths = [
96
- '.claude-flow/memory.db',
97
- '.swarm/memory.db',
98
- 'data/memory.db'
99
- ];
100
-
101
- for (const dbPath of dbPaths) {
102
- if (existsSync(dbPath)) {
103
- try {
104
- const stats = require('fs').statSync(dbPath);
105
- const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
106
- return { name: 'Memory Database', status: 'pass', message: `${dbPath} (${sizeMB} MB)` };
107
- } catch {
108
- return { name: 'Memory Database', status: 'warn', message: `${dbPath} (unable to stat)` };
109
- }
110
- }
111
- }
112
-
113
- return { name: 'Memory Database', status: 'warn', message: 'Not initialized', fix: 'claude-flow memory configure --backend hybrid' };
114
- }
115
-
116
- // Check API keys
117
- async function checkApiKeys(): Promise<HealthCheck> {
118
- const keys = ['ANTHROPIC_API_KEY', 'CLAUDE_API_KEY', 'OPENAI_API_KEY'];
119
- const found: string[] = [];
120
-
121
- for (const key of keys) {
122
- if (process.env[key]) {
123
- found.push(key);
124
- }
125
- }
126
-
127
- if (found.includes('ANTHROPIC_API_KEY') || found.includes('CLAUDE_API_KEY')) {
128
- return { name: 'API Keys', status: 'pass', message: `Found: ${found.join(', ')}` };
129
- } else if (found.length > 0) {
130
- return { name: 'API Keys', status: 'warn', message: `Found: ${found.join(', ')} (no Claude key)`, fix: 'export ANTHROPIC_API_KEY=your_key' };
131
- } else {
132
- return { name: 'API Keys', status: 'warn', message: 'No API keys found', fix: 'export ANTHROPIC_API_KEY=your_key' };
133
- }
134
- }
135
-
136
- // Check git
137
- async function checkGit(): Promise<HealthCheck> {
138
- try {
139
- const version = execSync('git --version', { encoding: 'utf8' }).trim();
140
- return { name: 'Git', status: 'pass', message: version.replace('git version ', 'v') };
141
- } catch {
142
- return { name: 'Git', status: 'warn', message: 'Not installed', fix: 'Install git from https://git-scm.com' };
143
- }
144
- }
145
-
146
- // Check if in git repo
147
- async function checkGitRepo(): Promise<HealthCheck> {
148
- try {
149
- execSync('git rev-parse --git-dir', { encoding: 'utf8', stdio: 'pipe' });
150
- return { name: 'Git Repository', status: 'pass', message: 'In a git repository' };
151
- } catch {
152
- return { name: 'Git Repository', status: 'warn', message: 'Not a git repository', fix: 'git init' };
153
- }
154
- }
155
-
156
- // Check MCP servers
157
- async function checkMcpServers(): Promise<HealthCheck> {
158
- const mcpConfigPaths = [
159
- join(process.env.HOME || '', '.claude/claude_desktop_config.json'),
160
- join(process.env.HOME || '', '.config/claude/mcp.json'),
161
- '.mcp.json'
162
- ];
163
-
164
- for (const configPath of mcpConfigPaths) {
165
- if (existsSync(configPath)) {
166
- try {
167
- const content = JSON.parse(readFileSync(configPath, 'utf8'));
168
- const servers = content.mcpServers || content.servers || {};
169
- const count = Object.keys(servers).length;
170
- const hasClaudeFlow = 'claude-flow' in servers || 'claude-flow_alpha' in servers;
171
- if (hasClaudeFlow) {
172
- return { name: 'MCP Servers', status: 'pass', message: `${count} servers (claude-flow configured)` };
173
- } else {
174
- return { name: 'MCP Servers', status: 'warn', message: `${count} servers (claude-flow not found)`, fix: 'claude mcp add claude-flow npx @claude-flow/cli@v3alpha mcp start' };
175
- }
176
- } catch {
177
- // continue to next path
178
- }
179
- }
180
- }
181
-
182
- return { name: 'MCP Servers', status: 'warn', message: 'No MCP config found', fix: 'claude mcp add claude-flow npx @claude-flow/cli@v3alpha mcp start' };
183
- }
184
-
185
- // Check disk space
186
- async function checkDiskSpace(): Promise<HealthCheck> {
187
- try {
188
- if (process.platform === 'win32') {
189
- return { name: 'Disk Space', status: 'pass', message: 'Check skipped on Windows' };
190
- }
191
- const output_str = execSync('df -h . | tail -1', { encoding: 'utf8' });
192
- const parts = output_str.split(/\s+/);
193
- const available = parts[3];
194
- const usePercent = parseInt(parts[4]?.replace('%', '') || '0', 10);
195
-
196
- if (usePercent > 90) {
197
- return { name: 'Disk Space', status: 'fail', message: `${available} available (${usePercent}% used)`, fix: 'Free up disk space' };
198
- } else if (usePercent > 80) {
199
- return { name: 'Disk Space', status: 'warn', message: `${available} available (${usePercent}% used)` };
200
- }
201
- return { name: 'Disk Space', status: 'pass', message: `${available} available` };
202
- } catch {
203
- return { name: 'Disk Space', status: 'warn', message: 'Unable to check' };
204
- }
205
- }
206
-
207
- // Check TypeScript/build
208
- async function checkBuildTools(): Promise<HealthCheck> {
209
- try {
210
- // Use stdio: 'pipe' for cross-platform stderr suppression (works on Windows)
211
- const tscVersion = execSync('npx tsc --version', {
212
- encoding: 'utf8',
213
- stdio: ['pipe', 'pipe', 'pipe'] // Suppress stderr on all platforms
214
- }).trim();
215
- if (!tscVersion || tscVersion.includes('not found')) {
216
- return { name: 'TypeScript', status: 'warn', message: 'Not installed locally', fix: 'npm install -D typescript' };
217
- }
218
- return { name: 'TypeScript', status: 'pass', message: tscVersion.replace('Version ', 'v') };
219
- } catch {
220
- return { name: 'TypeScript', status: 'warn', message: 'Not installed locally', fix: 'npm install -D typescript' };
221
- }
222
- }
223
-
224
- // Format health check result
225
- function formatCheck(check: HealthCheck): string {
226
- const icon = check.status === 'pass' ? output.success('✓') :
227
- check.status === 'warn' ? output.warning('⚠') :
228
- output.error('✗');
229
- return `${icon} ${check.name}: ${check.message}`;
230
- }
231
-
232
- // Main doctor command
233
- export const doctorCommand: Command = {
234
- name: 'doctor',
235
- description: 'System diagnostics and health checks',
236
- options: [
237
- {
238
- name: 'fix',
239
- short: 'f',
240
- description: 'Show fix commands for issues',
241
- type: 'boolean',
242
- default: false
243
- },
244
- {
245
- name: 'component',
246
- short: 'c',
247
- description: 'Check specific component (node, config, daemon, memory, api, git, mcp)',
248
- type: 'string'
249
- },
250
- {
251
- name: 'verbose',
252
- short: 'v',
253
- description: 'Verbose output',
254
- type: 'boolean',
255
- default: false
256
- }
257
- ],
258
- examples: [
259
- { command: 'claude-flow doctor', description: 'Run full health check' },
260
- { command: 'claude-flow doctor --fix', description: 'Show fixes for issues' },
261
- { command: 'claude-flow doctor -c daemon', description: 'Check specific component' }
262
- ],
263
- action: async (ctx: CommandContext): Promise<CommandResult> => {
264
- const showFix = ctx.flags.fix as boolean;
265
- const component = ctx.flags.component as string;
266
- const verbose = ctx.flags.verbose as boolean;
267
-
268
- output.writeln();
269
- output.writeln(output.bold('Claude Flow Doctor'));
270
- output.writeln(output.dim('System diagnostics and health check'));
271
- output.writeln(output.dim('─'.repeat(50)));
272
- output.writeln();
273
-
274
- const allChecks: (() => Promise<HealthCheck>)[] = [
275
- checkNodeVersion,
276
- checkNpmVersion,
277
- checkGit,
278
- checkGitRepo,
279
- checkConfigFile,
280
- checkDaemonStatus,
281
- checkMemoryDatabase,
282
- checkApiKeys,
283
- checkMcpServers,
284
- checkDiskSpace,
285
- checkBuildTools
286
- ];
287
-
288
- const componentMap: Record<string, () => Promise<HealthCheck>> = {
289
- 'node': checkNodeVersion,
290
- 'npm': checkNpmVersion,
291
- 'config': checkConfigFile,
292
- 'daemon': checkDaemonStatus,
293
- 'memory': checkMemoryDatabase,
294
- 'api': checkApiKeys,
295
- 'git': checkGit,
296
- 'mcp': checkMcpServers,
297
- 'disk': checkDiskSpace,
298
- 'typescript': checkBuildTools
299
- };
300
-
301
- let checksToRun = allChecks;
302
- if (component && componentMap[component]) {
303
- checksToRun = [componentMap[component]];
304
- }
305
-
306
- const results: HealthCheck[] = [];
307
- const fixes: string[] = [];
308
-
309
- for (const check of checksToRun) {
310
- const spinner = output.createSpinner({ text: 'Checking...', spinner: 'dots' });
311
- spinner.start();
312
-
313
- try {
314
- const result = await check();
315
- results.push(result);
316
-
317
- spinner.stop();
318
- output.writeln(formatCheck(result));
319
-
320
- if (result.fix && (result.status === 'fail' || result.status === 'warn')) {
321
- fixes.push(`${result.name}: ${result.fix}`);
322
- }
323
- } catch (error) {
324
- spinner.stop();
325
- const errorResult: HealthCheck = {
326
- name: 'Check',
327
- status: 'fail',
328
- message: error instanceof Error ? error.message : 'Unknown error'
329
- };
330
- results.push(errorResult);
331
- output.writeln(formatCheck(errorResult));
332
- }
333
- }
334
-
335
- // Summary
336
- const passed = results.filter(r => r.status === 'pass').length;
337
- const warnings = results.filter(r => r.status === 'warn').length;
338
- const failed = results.filter(r => r.status === 'fail').length;
339
-
340
- output.writeln();
341
- output.writeln(output.dim('─'.repeat(50)));
342
- output.writeln();
343
-
344
- const summaryParts = [
345
- output.success(`${passed} passed`),
346
- warnings > 0 ? output.warning(`${warnings} warnings`) : null,
347
- failed > 0 ? output.error(`${failed} failed`) : null
348
- ].filter(Boolean);
349
-
350
- output.writeln(`Summary: ${summaryParts.join(', ')}`);
351
-
352
- // Show fixes
353
- if (showFix && fixes.length > 0) {
354
- output.writeln();
355
- output.writeln(output.bold('Suggested Fixes:'));
356
- output.writeln();
357
- for (const fix of fixes) {
358
- output.writeln(output.dim(` ${fix}`));
359
- }
360
- } else if (fixes.length > 0 && !showFix) {
361
- output.writeln();
362
- output.writeln(output.dim(`Run with --fix to see ${fixes.length} suggested fix${fixes.length > 1 ? 'es' : ''}`));
363
- }
364
-
365
- // Overall result
366
- if (failed > 0) {
367
- output.writeln();
368
- output.writeln(output.error('Some checks failed. Please address the issues above.'));
369
- return { success: false, exitCode: 1, data: { passed, warnings, failed, results } };
370
- } else if (warnings > 0) {
371
- output.writeln();
372
- output.writeln(output.warning('All checks passed with some warnings.'));
373
- return { success: true, data: { passed, warnings, failed, results } };
374
- } else {
375
- output.writeln();
376
- output.writeln(output.success('All checks passed! System is healthy.'));
377
- return { success: true, data: { passed, warnings, failed, results } };
378
- }
379
- }
380
- };
381
-
382
- export default doctorCommand;