@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.
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +75 -2
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -4
- package/.agentic-flow/intelligence.json +0 -17
- package/.claude-flow/agents/store.json +0 -16
- package/.claude-flow/daemon-state.json +0 -123
- package/.claude-flow/daemon-test.log +0 -0
- package/.claude-flow/daemon.log +0 -0
- package/.claude-flow/daemon2.log +0 -0
- package/.claude-flow/daemon3.log +0 -0
- package/.claude-flow/hive-mind/state.json +0 -51
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/codebase-map.json +0 -11
- package/.claude-flow/metrics/consolidation.json +0 -6
- package/.claude-flow/metrics/performance.json +0 -87
- package/.claude-flow/metrics/security-audit.json +0 -10
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.claude-flow/metrics/test-gaps.json +0 -6
- package/__tests__/README.md +0 -140
- package/__tests__/TEST_SUMMARY.md +0 -144
- package/__tests__/cli.test.ts +0 -558
- package/__tests__/commands.test.ts +0 -726
- package/__tests__/config-adapter.test.ts +0 -362
- package/__tests__/config-loading.test.ts +0 -106
- package/__tests__/coverage/.tmp/coverage-0.json +0 -1
- package/__tests__/coverage/.tmp/coverage-1.json +0 -1
- package/__tests__/coverage/.tmp/coverage-2.json +0 -1
- package/__tests__/coverage/.tmp/coverage-3.json +0 -1
- package/__tests__/coverage/.tmp/coverage-4.json +0 -1
- package/__tests__/coverage/.tmp/coverage-5.json +0 -1
- package/__tests__/mcp-client.test.ts +0 -480
- package/__tests__/p1-commands.test.ts +0 -1064
- package/agents/architect.yaml +0 -11
- package/agents/coder.yaml +0 -11
- package/agents/reviewer.yaml +0 -10
- package/agents/security-architect.yaml +0 -10
- package/agents/tester.yaml +0 -10
- package/docs/CONFIG_LOADING.md +0 -236
- package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
- package/docs/MCP_CLIENT_GUIDE.md +0 -620
- package/docs/REFACTORING_SUMMARY.md +0 -247
- package/scripts/publish.sh +0 -46
- package/src/commands/agent.ts +0 -955
- package/src/commands/claims.ts +0 -317
- package/src/commands/completions.ts +0 -558
- package/src/commands/config.ts +0 -452
- package/src/commands/daemon.ts +0 -621
- package/src/commands/deployment.ts +0 -323
- package/src/commands/doctor.ts +0 -382
- package/src/commands/embeddings.ts +0 -686
- package/src/commands/hive-mind.ts +0 -928
- package/src/commands/hooks.ts +0 -2603
- package/src/commands/index.ts +0 -154
- package/src/commands/init.ts +0 -597
- package/src/commands/mcp.ts +0 -753
- package/src/commands/memory.ts +0 -1161
- package/src/commands/migrate.ts +0 -447
- package/src/commands/neural.ts +0 -253
- package/src/commands/performance.ts +0 -292
- package/src/commands/plugins.ts +0 -316
- package/src/commands/process.ts +0 -695
- package/src/commands/providers.ts +0 -259
- package/src/commands/security.ts +0 -288
- package/src/commands/session.ts +0 -891
- package/src/commands/start.ts +0 -457
- package/src/commands/status.ts +0 -736
- package/src/commands/swarm.ts +0 -648
- package/src/commands/task.ts +0 -792
- package/src/commands/workflow.ts +0 -742
- package/src/config-adapter.ts +0 -210
- package/src/index.ts +0 -443
- package/src/infrastructure/in-memory-repositories.ts +0 -310
- package/src/init/claudemd-generator.ts +0 -631
- package/src/init/executor.ts +0 -762
- package/src/init/helpers-generator.ts +0 -628
- package/src/init/index.ts +0 -60
- package/src/init/mcp-generator.ts +0 -83
- package/src/init/settings-generator.ts +0 -284
- package/src/init/statusline-generator.ts +0 -211
- package/src/init/types.ts +0 -447
- package/src/mcp-client.ts +0 -241
- package/src/mcp-server.ts +0 -577
- package/src/mcp-tools/agent-tools.ts +0 -466
- package/src/mcp-tools/config-tools.ts +0 -370
- package/src/mcp-tools/hive-mind-tools.ts +0 -521
- package/src/mcp-tools/hooks-tools.ts +0 -1888
- package/src/mcp-tools/index.ts +0 -16
- package/src/mcp-tools/memory-tools.ts +0 -270
- package/src/mcp-tools/session-tools.ts +0 -359
- package/src/mcp-tools/swarm-tools.ts +0 -105
- package/src/mcp-tools/task-tools.ts +0 -347
- package/src/mcp-tools/types.ts +0 -33
- package/src/mcp-tools/workflow-tools.ts +0 -573
- package/src/output.ts +0 -639
- package/src/parser.ts +0 -417
- package/src/prompt.ts +0 -619
- package/src/services/index.ts +0 -15
- package/src/services/worker-daemon.ts +0 -726
- package/src/suggest.ts +0 -245
- package/src/types.ts +0 -287
- package/tmp.json +0 -0
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -13
package/src/commands/doctor.ts
DELETED
|
@@ -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;
|