@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.
- 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
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 CLI Performance Command
|
|
3
|
-
* Performance profiling, benchmarking, optimization, metrics
|
|
4
|
-
*
|
|
5
|
-
* Created with ❤️ by ruv.io
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Command, CommandContext, CommandResult } from '../types.js';
|
|
9
|
-
import { output } from '../output.js';
|
|
10
|
-
|
|
11
|
-
// Benchmark subcommand
|
|
12
|
-
const benchmarkCommand: Command = {
|
|
13
|
-
name: 'benchmark',
|
|
14
|
-
description: 'Run performance benchmarks',
|
|
15
|
-
options: [
|
|
16
|
-
{ name: 'suite', short: 's', type: 'string', description: 'Benchmark suite: all, wasm, neural, memory, search', default: 'all' },
|
|
17
|
-
{ name: 'iterations', short: 'i', type: 'number', description: 'Number of iterations', default: '100' },
|
|
18
|
-
{ name: 'warmup', short: 'w', type: 'number', description: 'Warmup iterations', default: '10' },
|
|
19
|
-
{ name: 'output', short: 'o', type: 'string', description: 'Output format: text, json, csv', default: 'text' },
|
|
20
|
-
],
|
|
21
|
-
examples: [
|
|
22
|
-
{ command: 'claude-flow performance benchmark -s neural', description: 'Benchmark neural operations' },
|
|
23
|
-
{ command: 'claude-flow performance benchmark -i 1000', description: 'Run with 1000 iterations' },
|
|
24
|
-
],
|
|
25
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
26
|
-
const suite = ctx.flags.suite as string || 'all';
|
|
27
|
-
const iterations = parseInt(ctx.flags.iterations as string || '100', 10);
|
|
28
|
-
|
|
29
|
-
output.writeln();
|
|
30
|
-
output.writeln(output.bold('Performance Benchmark'));
|
|
31
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
32
|
-
|
|
33
|
-
const spinner = output.createSpinner({ text: `Running ${suite} benchmarks...`, spinner: 'dots' });
|
|
34
|
-
spinner.start();
|
|
35
|
-
|
|
36
|
-
const benchmarks = ['WASM SIMD', 'Flash Attention', 'HNSW Search', 'Memory Ops', 'Neural Inference'];
|
|
37
|
-
for (const bench of benchmarks) {
|
|
38
|
-
spinner.setText(`Benchmarking ${bench}...`);
|
|
39
|
-
await new Promise(r => setTimeout(r, 300));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
spinner.succeed(`Completed ${iterations} iterations`);
|
|
43
|
-
|
|
44
|
-
output.writeln();
|
|
45
|
-
output.printTable({
|
|
46
|
-
columns: [
|
|
47
|
-
{ key: 'operation', header: 'Operation', width: 20 },
|
|
48
|
-
{ key: 'mean', header: 'Mean', width: 12 },
|
|
49
|
-
{ key: 'p95', header: 'P95', width: 12 },
|
|
50
|
-
{ key: 'p99', header: 'P99', width: 12 },
|
|
51
|
-
{ key: 'improvement', header: 'vs Baseline', width: 15 },
|
|
52
|
-
],
|
|
53
|
-
data: [
|
|
54
|
-
{ operation: 'WASM SIMD MatMul', mean: '0.42ms', p95: '0.58ms', p99: '0.71ms', improvement: output.success('+4.2x') },
|
|
55
|
-
{ operation: 'Flash Attention', mean: '1.23ms', p95: '1.45ms', p99: '1.67ms', improvement: output.success('+2.49x') },
|
|
56
|
-
{ operation: 'HNSW Search', mean: '0.08ms', p95: '0.12ms', p99: '0.15ms', improvement: output.success('+150x') },
|
|
57
|
-
{ operation: 'Memory Store', mean: '0.15ms', p95: '0.22ms', p99: '0.28ms', improvement: output.success('+3.1x') },
|
|
58
|
-
{ operation: 'Neural Inference', mean: '12.4ms', p95: '15.2ms', p99: '18.1ms', improvement: output.success('+2.8x') },
|
|
59
|
-
],
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
output.writeln();
|
|
63
|
-
output.printBox([
|
|
64
|
-
`Suite: ${suite}`,
|
|
65
|
-
`Iterations: ${iterations}`,
|
|
66
|
-
`Total Time: 2.34s`,
|
|
67
|
-
``,
|
|
68
|
-
`Overall Performance: ${output.success('Excellent')}`,
|
|
69
|
-
`All targets met or exceeded`,
|
|
70
|
-
].join('\n'), 'Benchmark Summary');
|
|
71
|
-
|
|
72
|
-
return { success: true };
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// Profile subcommand
|
|
77
|
-
const profileCommand: Command = {
|
|
78
|
-
name: 'profile',
|
|
79
|
-
description: 'Profile application performance',
|
|
80
|
-
options: [
|
|
81
|
-
{ name: 'type', short: 't', type: 'string', description: 'Profile type: cpu, memory, io, all', default: 'all' },
|
|
82
|
-
{ name: 'duration', short: 'd', type: 'number', description: 'Duration in seconds', default: '30' },
|
|
83
|
-
{ name: 'output', short: 'o', type: 'string', description: 'Output file for profile data' },
|
|
84
|
-
],
|
|
85
|
-
examples: [
|
|
86
|
-
{ command: 'claude-flow performance profile -t cpu', description: 'Profile CPU usage' },
|
|
87
|
-
{ command: 'claude-flow performance profile -d 60', description: 'Profile for 60 seconds' },
|
|
88
|
-
],
|
|
89
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
90
|
-
const type = ctx.flags.type as string || 'all';
|
|
91
|
-
const duration = parseInt(ctx.flags.duration as string || '30', 10);
|
|
92
|
-
|
|
93
|
-
output.writeln();
|
|
94
|
-
output.writeln(output.bold('Performance Profiler'));
|
|
95
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
96
|
-
|
|
97
|
-
const spinner = output.createSpinner({ text: 'Collecting profile data...', spinner: 'dots' });
|
|
98
|
-
spinner.start();
|
|
99
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
100
|
-
spinner.succeed('Profile complete');
|
|
101
|
-
|
|
102
|
-
output.writeln();
|
|
103
|
-
output.printTable({
|
|
104
|
-
columns: [
|
|
105
|
-
{ key: 'metric', header: 'Metric', width: 25 },
|
|
106
|
-
{ key: 'current', header: 'Current', width: 15 },
|
|
107
|
-
{ key: 'peak', header: 'Peak', width: 15 },
|
|
108
|
-
{ key: 'status', header: 'Status', width: 15 },
|
|
109
|
-
],
|
|
110
|
-
data: [
|
|
111
|
-
{ metric: 'CPU Usage', current: '23%', peak: '67%', status: output.success('Normal') },
|
|
112
|
-
{ metric: 'Memory (Heap)', current: '145 MB', peak: '312 MB', status: output.success('Normal') },
|
|
113
|
-
{ metric: 'Memory (RSS)', current: '287 MB', peak: '456 MB', status: output.success('Normal') },
|
|
114
|
-
{ metric: 'Event Loop Lag', current: '1.2ms', peak: '8.4ms', status: output.success('Normal') },
|
|
115
|
-
{ metric: 'Active Handles', current: '24', peak: '89', status: output.success('Normal') },
|
|
116
|
-
{ metric: 'GC Pause Time', current: '2.1ms', peak: '12.3ms', status: output.warning('Elevated') },
|
|
117
|
-
],
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
return { success: true };
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// Metrics subcommand
|
|
125
|
-
const metricsCommand: Command = {
|
|
126
|
-
name: 'metrics',
|
|
127
|
-
description: 'View and export performance metrics',
|
|
128
|
-
options: [
|
|
129
|
-
{ name: 'timeframe', short: 't', type: 'string', description: 'Timeframe: 1h, 24h, 7d, 30d', default: '24h' },
|
|
130
|
-
{ name: 'format', short: 'f', type: 'string', description: 'Output format: text, json, prometheus', default: 'text' },
|
|
131
|
-
{ name: 'component', short: 'c', type: 'string', description: 'Component to filter' },
|
|
132
|
-
],
|
|
133
|
-
examples: [
|
|
134
|
-
{ command: 'claude-flow performance metrics -t 7d', description: 'Show 7-day metrics' },
|
|
135
|
-
{ command: 'claude-flow performance metrics -f prometheus', description: 'Export as Prometheus format' },
|
|
136
|
-
],
|
|
137
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
138
|
-
const timeframe = ctx.flags.timeframe as string || '24h';
|
|
139
|
-
|
|
140
|
-
output.writeln();
|
|
141
|
-
output.writeln(output.bold(`Performance Metrics (${timeframe})`));
|
|
142
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
143
|
-
|
|
144
|
-
output.printTable({
|
|
145
|
-
columns: [
|
|
146
|
-
{ key: 'metric', header: 'Metric', width: 25 },
|
|
147
|
-
{ key: 'avg', header: 'Avg', width: 12 },
|
|
148
|
-
{ key: 'min', header: 'Min', width: 12 },
|
|
149
|
-
{ key: 'max', header: 'Max', width: 12 },
|
|
150
|
-
{ key: 'trend', header: 'Trend', width: 12 },
|
|
151
|
-
],
|
|
152
|
-
data: [
|
|
153
|
-
{ metric: 'Request Latency', avg: '45ms', min: '12ms', max: '234ms', trend: output.success('↓ 12%') },
|
|
154
|
-
{ metric: 'Throughput', avg: '1,247/s', min: '892/s', max: '2,103/s', trend: output.success('↑ 8%') },
|
|
155
|
-
{ metric: 'Error Rate', avg: '0.12%', min: '0%', max: '0.89%', trend: output.success('↓ 45%') },
|
|
156
|
-
{ metric: 'Cache Hit Rate', avg: '94.2%', min: '87.1%', max: '98.7%', trend: output.success('↑ 3%') },
|
|
157
|
-
{ metric: 'Token Usage', avg: '45K/h', min: '12K/h', max: '89K/h', trend: output.warning('↑ 15%') },
|
|
158
|
-
],
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
return { success: true };
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// Optimize subcommand
|
|
166
|
-
const optimizeCommand: Command = {
|
|
167
|
-
name: 'optimize',
|
|
168
|
-
description: 'Run performance optimization recommendations',
|
|
169
|
-
options: [
|
|
170
|
-
{ name: 'target', short: 't', type: 'string', description: 'Target: memory, cpu, latency, all', default: 'all' },
|
|
171
|
-
{ name: 'apply', short: 'a', type: 'boolean', description: 'Apply recommended optimizations' },
|
|
172
|
-
{ name: 'dry-run', short: 'd', type: 'boolean', description: 'Show changes without applying' },
|
|
173
|
-
],
|
|
174
|
-
examples: [
|
|
175
|
-
{ command: 'claude-flow performance optimize -t memory', description: 'Optimize memory usage' },
|
|
176
|
-
{ command: 'claude-flow performance optimize --apply', description: 'Apply all optimizations' },
|
|
177
|
-
],
|
|
178
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
179
|
-
const target = ctx.flags.target as string || 'all';
|
|
180
|
-
|
|
181
|
-
output.writeln();
|
|
182
|
-
output.writeln(output.bold('Performance Optimization'));
|
|
183
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
184
|
-
|
|
185
|
-
const spinner = output.createSpinner({ text: 'Analyzing performance...', spinner: 'dots' });
|
|
186
|
-
spinner.start();
|
|
187
|
-
await new Promise(r => setTimeout(r, 800));
|
|
188
|
-
spinner.succeed('Analysis complete');
|
|
189
|
-
|
|
190
|
-
output.writeln();
|
|
191
|
-
output.writeln(output.bold('Recommendations:'));
|
|
192
|
-
output.writeln();
|
|
193
|
-
|
|
194
|
-
output.printTable({
|
|
195
|
-
columns: [
|
|
196
|
-
{ key: 'priority', header: 'Priority', width: 10 },
|
|
197
|
-
{ key: 'area', header: 'Area', width: 15 },
|
|
198
|
-
{ key: 'recommendation', header: 'Recommendation', width: 40 },
|
|
199
|
-
{ key: 'impact', header: 'Impact', width: 15 },
|
|
200
|
-
],
|
|
201
|
-
data: [
|
|
202
|
-
{ priority: output.error('P0'), area: 'Memory', recommendation: 'Enable HNSW index quantization', impact: '+50% reduction' },
|
|
203
|
-
{ priority: output.warning('P1'), area: 'CPU', recommendation: 'Enable WASM SIMD acceleration', impact: '+4x speedup' },
|
|
204
|
-
{ priority: output.warning('P1'), area: 'Latency', recommendation: 'Enable Flash Attention', impact: '+2.49x speedup' },
|
|
205
|
-
{ priority: output.info('P2'), area: 'Cache', recommendation: 'Increase pattern cache size', impact: '+15% hit rate' },
|
|
206
|
-
{ priority: output.info('P2'), area: 'Network', recommendation: 'Enable request batching', impact: '-30% latency' },
|
|
207
|
-
],
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
return { success: true };
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// Bottleneck subcommand
|
|
215
|
-
const bottleneckCommand: Command = {
|
|
216
|
-
name: 'bottleneck',
|
|
217
|
-
description: 'Identify performance bottlenecks',
|
|
218
|
-
options: [
|
|
219
|
-
{ name: 'component', short: 'c', type: 'string', description: 'Component to analyze' },
|
|
220
|
-
{ name: 'depth', short: 'd', type: 'string', description: 'Analysis depth: quick, full', default: 'quick' },
|
|
221
|
-
],
|
|
222
|
-
examples: [
|
|
223
|
-
{ command: 'claude-flow performance bottleneck', description: 'Find bottlenecks' },
|
|
224
|
-
{ command: 'claude-flow performance bottleneck -d full', description: 'Full analysis' },
|
|
225
|
-
],
|
|
226
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
227
|
-
output.writeln();
|
|
228
|
-
output.writeln(output.bold('Bottleneck Analysis'));
|
|
229
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
230
|
-
|
|
231
|
-
const spinner = output.createSpinner({ text: 'Analyzing system...', spinner: 'dots' });
|
|
232
|
-
spinner.start();
|
|
233
|
-
await new Promise(r => setTimeout(r, 600));
|
|
234
|
-
spinner.succeed('Analysis complete');
|
|
235
|
-
|
|
236
|
-
output.writeln();
|
|
237
|
-
output.printTable({
|
|
238
|
-
columns: [
|
|
239
|
-
{ key: 'component', header: 'Component', width: 20 },
|
|
240
|
-
{ key: 'bottleneck', header: 'Bottleneck', width: 25 },
|
|
241
|
-
{ key: 'severity', header: 'Severity', width: 12 },
|
|
242
|
-
{ key: 'solution', header: 'Solution', width: 30 },
|
|
243
|
-
],
|
|
244
|
-
data: [
|
|
245
|
-
{ component: 'Vector Search', bottleneck: 'Linear scan O(n)', severity: output.error('High'), solution: 'Enable HNSW indexing' },
|
|
246
|
-
{ component: 'Neural Inference', bottleneck: 'Sequential attention', severity: output.warning('Medium'), solution: 'Enable Flash Attention' },
|
|
247
|
-
{ component: 'Memory Store', bottleneck: 'Lock contention', severity: output.info('Low'), solution: 'Use sharded storage' },
|
|
248
|
-
],
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
return { success: true };
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
// Main performance command
|
|
256
|
-
export const performanceCommand: Command = {
|
|
257
|
-
name: 'performance',
|
|
258
|
-
description: 'Performance profiling, benchmarking, optimization, metrics',
|
|
259
|
-
aliases: ['perf'],
|
|
260
|
-
subcommands: [benchmarkCommand, profileCommand, metricsCommand, optimizeCommand, bottleneckCommand],
|
|
261
|
-
examples: [
|
|
262
|
-
{ command: 'claude-flow performance benchmark', description: 'Run benchmarks' },
|
|
263
|
-
{ command: 'claude-flow performance profile', description: 'Profile application' },
|
|
264
|
-
{ command: 'claude-flow perf metrics', description: 'View metrics (alias)' },
|
|
265
|
-
],
|
|
266
|
-
action: async (): Promise<CommandResult> => {
|
|
267
|
-
output.writeln();
|
|
268
|
-
output.writeln(output.bold('Claude Flow Performance Suite'));
|
|
269
|
-
output.writeln(output.dim('Advanced performance profiling and optimization'));
|
|
270
|
-
output.writeln();
|
|
271
|
-
output.writeln('Subcommands:');
|
|
272
|
-
output.printList([
|
|
273
|
-
'benchmark - Run performance benchmarks (WASM, neural, search)',
|
|
274
|
-
'profile - Profile CPU, memory, I/O usage',
|
|
275
|
-
'metrics - View and export performance metrics',
|
|
276
|
-
'optimize - Get optimization recommendations',
|
|
277
|
-
'bottleneck - Identify performance bottlenecks',
|
|
278
|
-
]);
|
|
279
|
-
output.writeln();
|
|
280
|
-
output.writeln('Performance Targets:');
|
|
281
|
-
output.printList([
|
|
282
|
-
'HNSW Search: 150x-12,500x faster than brute force',
|
|
283
|
-
'Flash Attention: 2.49x-7.47x speedup',
|
|
284
|
-
'Memory: 50-75% reduction with quantization',
|
|
285
|
-
]);
|
|
286
|
-
output.writeln();
|
|
287
|
-
output.writeln(output.dim('Created with ❤️ by ruv.io'));
|
|
288
|
-
return { success: true };
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
export default performanceCommand;
|
package/src/commands/plugins.ts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 CLI Plugins Command
|
|
3
|
-
* Plugin management, installation, and lifecycle
|
|
4
|
-
*
|
|
5
|
-
* Created with ❤️ by ruv.io
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Command, CommandContext, CommandResult } from '../types.js';
|
|
9
|
-
import { output } from '../output.js';
|
|
10
|
-
|
|
11
|
-
// List subcommand
|
|
12
|
-
const listCommand: Command = {
|
|
13
|
-
name: 'list',
|
|
14
|
-
description: 'List installed and available plugins',
|
|
15
|
-
options: [
|
|
16
|
-
{ name: 'installed', short: 'i', type: 'boolean', description: 'Show only installed plugins' },
|
|
17
|
-
{ name: 'available', short: 'a', type: 'boolean', description: 'Show available plugins from registry' },
|
|
18
|
-
{ name: 'category', short: 'c', type: 'string', description: 'Filter by category' },
|
|
19
|
-
],
|
|
20
|
-
examples: [
|
|
21
|
-
{ command: 'claude-flow plugins list', description: 'List all plugins' },
|
|
22
|
-
{ command: 'claude-flow plugins list --installed', description: 'List installed only' },
|
|
23
|
-
],
|
|
24
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
25
|
-
const installedOnly = ctx.flags.installed as boolean;
|
|
26
|
-
|
|
27
|
-
output.writeln();
|
|
28
|
-
output.writeln(output.bold(installedOnly ? 'Installed Plugins' : 'All Plugins'));
|
|
29
|
-
output.writeln(output.dim('─'.repeat(60)));
|
|
30
|
-
|
|
31
|
-
output.printTable({
|
|
32
|
-
columns: [
|
|
33
|
-
{ key: 'name', header: 'Plugin', width: 22 },
|
|
34
|
-
{ key: 'version', header: 'Version', width: 10 },
|
|
35
|
-
{ key: 'category', header: 'Category', width: 15 },
|
|
36
|
-
{ key: 'status', header: 'Status', width: 12 },
|
|
37
|
-
],
|
|
38
|
-
data: [
|
|
39
|
-
{ name: '@claude-flow/neural', version: '3.0.0', category: 'AI/ML', status: output.success('Active') },
|
|
40
|
-
{ name: '@claude-flow/security', version: '3.0.0', category: 'Security', status: output.success('Active') },
|
|
41
|
-
{ name: '@claude-flow/performance', version: '3.0.0', category: 'DevOps', status: output.success('Active') },
|
|
42
|
-
{ name: '@claude-flow/embeddings', version: '3.0.0', category: 'AI/ML', status: output.success('Active') },
|
|
43
|
-
{ name: '@claude-flow/claims', version: '3.0.0', category: 'Auth', status: output.success('Active') },
|
|
44
|
-
{ name: 'community-analytics', version: '1.2.0', category: 'Analytics', status: output.dim('Available') },
|
|
45
|
-
{ name: 'custom-agents', version: '2.0.1', category: 'Agents', status: output.dim('Available') },
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return { success: true };
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Install subcommand
|
|
54
|
-
const installCommand: Command = {
|
|
55
|
-
name: 'install',
|
|
56
|
-
description: 'Install a plugin from registry or local path',
|
|
57
|
-
options: [
|
|
58
|
-
{ name: 'name', short: 'n', type: 'string', description: 'Plugin name or path', required: true },
|
|
59
|
-
{ name: 'version', short: 'v', type: 'string', description: 'Specific version to install' },
|
|
60
|
-
{ name: 'global', short: 'g', type: 'boolean', description: 'Install globally' },
|
|
61
|
-
{ name: 'dev', short: 'd', type: 'boolean', description: 'Install as dev dependency' },
|
|
62
|
-
],
|
|
63
|
-
examples: [
|
|
64
|
-
{ command: 'claude-flow plugins install -n community-analytics', description: 'Install plugin' },
|
|
65
|
-
{ command: 'claude-flow plugins install -n ./my-plugin --dev', description: 'Install local plugin' },
|
|
66
|
-
],
|
|
67
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
68
|
-
const name = ctx.flags.name as string;
|
|
69
|
-
const version = ctx.flags.version as string || 'latest';
|
|
70
|
-
|
|
71
|
-
if (!name) {
|
|
72
|
-
output.printError('Plugin name is required');
|
|
73
|
-
return { success: false, exitCode: 1 };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
output.writeln();
|
|
77
|
-
output.writeln(output.bold('Installing Plugin'));
|
|
78
|
-
output.writeln(output.dim('─'.repeat(40)));
|
|
79
|
-
|
|
80
|
-
const spinner = output.createSpinner({ text: `Resolving ${name}@${version}...`, spinner: 'dots' });
|
|
81
|
-
spinner.start();
|
|
82
|
-
|
|
83
|
-
const steps = ['Downloading package', 'Verifying integrity', 'Installing dependencies', 'Registering hooks'];
|
|
84
|
-
for (const step of steps) {
|
|
85
|
-
spinner.setText(step + '...');
|
|
86
|
-
await new Promise(r => setTimeout(r, 300));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
spinner.succeed(`Installed ${name}@${version}`);
|
|
90
|
-
|
|
91
|
-
output.writeln();
|
|
92
|
-
output.printBox([
|
|
93
|
-
`Plugin: ${name}`,
|
|
94
|
-
`Version: ${version}`,
|
|
95
|
-
`Location: node_modules/${name}`,
|
|
96
|
-
``,
|
|
97
|
-
`Hooks registered: 3`,
|
|
98
|
-
`Commands added: 2`,
|
|
99
|
-
].join('\n'), 'Installation Complete');
|
|
100
|
-
|
|
101
|
-
return { success: true };
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// Uninstall subcommand
|
|
106
|
-
const uninstallCommand: Command = {
|
|
107
|
-
name: 'uninstall',
|
|
108
|
-
description: 'Uninstall a plugin',
|
|
109
|
-
options: [
|
|
110
|
-
{ name: 'name', short: 'n', type: 'string', description: 'Plugin name', required: true },
|
|
111
|
-
{ name: 'force', short: 'f', type: 'boolean', description: 'Force uninstall without confirmation' },
|
|
112
|
-
],
|
|
113
|
-
examples: [
|
|
114
|
-
{ command: 'claude-flow plugins uninstall -n community-analytics', description: 'Uninstall plugin' },
|
|
115
|
-
],
|
|
116
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
117
|
-
const name = ctx.flags.name as string;
|
|
118
|
-
|
|
119
|
-
if (!name) {
|
|
120
|
-
output.printError('Plugin name is required');
|
|
121
|
-
return { success: false, exitCode: 1 };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
output.writeln();
|
|
125
|
-
const spinner = output.createSpinner({ text: `Uninstalling ${name}...`, spinner: 'dots' });
|
|
126
|
-
spinner.start();
|
|
127
|
-
await new Promise(r => setTimeout(r, 500));
|
|
128
|
-
spinner.succeed(`Uninstalled ${name}`);
|
|
129
|
-
|
|
130
|
-
return { success: true };
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// Enable/Disable subcommand
|
|
135
|
-
const toggleCommand: Command = {
|
|
136
|
-
name: 'toggle',
|
|
137
|
-
description: 'Enable or disable a plugin',
|
|
138
|
-
options: [
|
|
139
|
-
{ name: 'name', short: 'n', type: 'string', description: 'Plugin name', required: true },
|
|
140
|
-
{ name: 'enable', short: 'e', type: 'boolean', description: 'Enable the plugin' },
|
|
141
|
-
{ name: 'disable', short: 'd', type: 'boolean', description: 'Disable the plugin' },
|
|
142
|
-
],
|
|
143
|
-
examples: [
|
|
144
|
-
{ command: 'claude-flow plugins toggle -n analytics --enable', description: 'Enable plugin' },
|
|
145
|
-
{ command: 'claude-flow plugins toggle -n analytics --disable', description: 'Disable plugin' },
|
|
146
|
-
],
|
|
147
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
148
|
-
const name = ctx.flags.name as string;
|
|
149
|
-
const enable = ctx.flags.enable as boolean;
|
|
150
|
-
|
|
151
|
-
if (!name) {
|
|
152
|
-
output.printError('Plugin name is required');
|
|
153
|
-
return { success: false, exitCode: 1 };
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const action = enable ? 'Enabling' : 'Disabling';
|
|
157
|
-
const spinner = output.createSpinner({ text: `${action} ${name}...`, spinner: 'dots' });
|
|
158
|
-
spinner.start();
|
|
159
|
-
await new Promise(r => setTimeout(r, 300));
|
|
160
|
-
spinner.succeed(`${name} ${enable ? 'enabled' : 'disabled'}`);
|
|
161
|
-
|
|
162
|
-
return { success: true };
|
|
163
|
-
},
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// Info subcommand
|
|
167
|
-
const infoCommand: Command = {
|
|
168
|
-
name: 'info',
|
|
169
|
-
description: 'Show detailed plugin information',
|
|
170
|
-
options: [
|
|
171
|
-
{ name: 'name', short: 'n', type: 'string', description: 'Plugin name', required: true },
|
|
172
|
-
],
|
|
173
|
-
examples: [
|
|
174
|
-
{ command: 'claude-flow plugins info -n @claude-flow/neural', description: 'Show plugin info' },
|
|
175
|
-
],
|
|
176
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
177
|
-
const name = ctx.flags.name as string;
|
|
178
|
-
|
|
179
|
-
if (!name) {
|
|
180
|
-
output.printError('Plugin name is required');
|
|
181
|
-
return { success: false, exitCode: 1 };
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
output.writeln();
|
|
185
|
-
output.writeln(output.bold(`Plugin: ${name}`));
|
|
186
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
187
|
-
|
|
188
|
-
output.printBox([
|
|
189
|
-
`Name: ${name}`,
|
|
190
|
-
`Version: 3.0.0`,
|
|
191
|
-
`Author: ruv.io`,
|
|
192
|
-
`License: MIT`,
|
|
193
|
-
``,
|
|
194
|
-
`Description:`,
|
|
195
|
-
` Neural pattern training and inference with`,
|
|
196
|
-
` WASM SIMD acceleration, MoE routing, and`,
|
|
197
|
-
` Flash Attention optimization.`,
|
|
198
|
-
``,
|
|
199
|
-
`Dependencies:`,
|
|
200
|
-
` - @claude-flow/core ^3.0.0`,
|
|
201
|
-
` - onnxruntime-web ^1.17.0`,
|
|
202
|
-
``,
|
|
203
|
-
`Hooks:`,
|
|
204
|
-
` - neural:train (pre, post)`,
|
|
205
|
-
` - neural:inference (pre, post)`,
|
|
206
|
-
` - pattern:learn`,
|
|
207
|
-
``,
|
|
208
|
-
`Commands:`,
|
|
209
|
-
` - neural train`,
|
|
210
|
-
` - neural predict`,
|
|
211
|
-
` - neural patterns`,
|
|
212
|
-
].join('\n'), 'Plugin Details');
|
|
213
|
-
|
|
214
|
-
return { success: true };
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// Create subcommand
|
|
219
|
-
const createCommand: Command = {
|
|
220
|
-
name: 'create',
|
|
221
|
-
description: 'Scaffold a new plugin project',
|
|
222
|
-
options: [
|
|
223
|
-
{ name: 'name', short: 'n', type: 'string', description: 'Plugin name', required: true },
|
|
224
|
-
{ name: 'template', short: 't', type: 'string', description: 'Template: basic, advanced, hooks', default: 'basic' },
|
|
225
|
-
{ name: 'path', short: 'p', type: 'string', description: 'Output path', default: '.' },
|
|
226
|
-
],
|
|
227
|
-
examples: [
|
|
228
|
-
{ command: 'claude-flow plugins create -n my-plugin', description: 'Create basic plugin' },
|
|
229
|
-
{ command: 'claude-flow plugins create -n my-plugin -t hooks', description: 'Create hooks plugin' },
|
|
230
|
-
],
|
|
231
|
-
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
232
|
-
const name = ctx.flags.name as string;
|
|
233
|
-
const template = ctx.flags.template as string || 'basic';
|
|
234
|
-
|
|
235
|
-
if (!name) {
|
|
236
|
-
output.printError('Plugin name is required');
|
|
237
|
-
return { success: false, exitCode: 1 };
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
output.writeln();
|
|
241
|
-
output.writeln(output.bold('Creating Plugin'));
|
|
242
|
-
output.writeln(output.dim('─'.repeat(40)));
|
|
243
|
-
|
|
244
|
-
const spinner = output.createSpinner({ text: 'Scaffolding project...', spinner: 'dots' });
|
|
245
|
-
spinner.start();
|
|
246
|
-
|
|
247
|
-
const files = ['package.json', 'src/index.ts', 'src/hooks.ts', 'README.md', 'tsconfig.json'];
|
|
248
|
-
for (const file of files) {
|
|
249
|
-
spinner.setText(`Creating ${file}...`);
|
|
250
|
-
await new Promise(r => setTimeout(r, 150));
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
spinner.succeed('Plugin scaffolded');
|
|
254
|
-
|
|
255
|
-
output.writeln();
|
|
256
|
-
output.printBox([
|
|
257
|
-
`Plugin: ${name}`,
|
|
258
|
-
`Template: ${template}`,
|
|
259
|
-
`Location: ./${name}/`,
|
|
260
|
-
``,
|
|
261
|
-
`Files created:`,
|
|
262
|
-
` - package.json`,
|
|
263
|
-
` - src/index.ts`,
|
|
264
|
-
` - src/hooks.ts`,
|
|
265
|
-
` - README.md`,
|
|
266
|
-
` - tsconfig.json`,
|
|
267
|
-
``,
|
|
268
|
-
`Next steps:`,
|
|
269
|
-
` cd ${name}`,
|
|
270
|
-
` npm install`,
|
|
271
|
-
` npm run build`,
|
|
272
|
-
].join('\n'), 'Success');
|
|
273
|
-
|
|
274
|
-
return { success: true };
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
// Main plugins command
|
|
279
|
-
export const pluginsCommand: Command = {
|
|
280
|
-
name: 'plugins',
|
|
281
|
-
description: 'Plugin management, installation, and lifecycle',
|
|
282
|
-
subcommands: [listCommand, installCommand, uninstallCommand, toggleCommand, infoCommand, createCommand],
|
|
283
|
-
examples: [
|
|
284
|
-
{ command: 'claude-flow plugins list', description: 'List all plugins' },
|
|
285
|
-
{ command: 'claude-flow plugins install -n my-plugin', description: 'Install a plugin' },
|
|
286
|
-
{ command: 'claude-flow plugins create -n my-plugin', description: 'Create new plugin' },
|
|
287
|
-
],
|
|
288
|
-
action: async (): Promise<CommandResult> => {
|
|
289
|
-
output.writeln();
|
|
290
|
-
output.writeln(output.bold('Claude Flow Plugin System'));
|
|
291
|
-
output.writeln(output.dim('Extensible plugin architecture'));
|
|
292
|
-
output.writeln();
|
|
293
|
-
output.writeln('Subcommands:');
|
|
294
|
-
output.printList([
|
|
295
|
-
'list - List installed and available plugins',
|
|
296
|
-
'install - Install a plugin from registry or local path',
|
|
297
|
-
'uninstall - Remove an installed plugin',
|
|
298
|
-
'toggle - Enable or disable a plugin',
|
|
299
|
-
'info - Show detailed plugin information',
|
|
300
|
-
'create - Scaffold a new plugin project',
|
|
301
|
-
]);
|
|
302
|
-
output.writeln();
|
|
303
|
-
output.writeln('Core Plugins:');
|
|
304
|
-
output.printList([
|
|
305
|
-
'@claude-flow/neural - Neural patterns and inference',
|
|
306
|
-
'@claude-flow/security - Security scanning and CVE detection',
|
|
307
|
-
'@claude-flow/embeddings - Vector embeddings service',
|
|
308
|
-
'@claude-flow/claims - Claims-based authorization',
|
|
309
|
-
]);
|
|
310
|
-
output.writeln();
|
|
311
|
-
output.writeln(output.dim('Created with ❤️ by ruv.io'));
|
|
312
|
-
return { success: true };
|
|
313
|
-
},
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
export default pluginsCommand;
|