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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/package.json +12 -4
  2. package/.agentic-flow/intelligence.json +0 -17
  3. package/.claude-flow/agents/store.json +0 -16
  4. package/.claude-flow/daemon-state.json +0 -123
  5. package/.claude-flow/daemon-test.log +0 -0
  6. package/.claude-flow/daemon.log +0 -0
  7. package/.claude-flow/daemon2.log +0 -0
  8. package/.claude-flow/daemon3.log +0 -0
  9. package/.claude-flow/hive-mind/state.json +0 -51
  10. package/.claude-flow/metrics/agent-metrics.json +0 -1
  11. package/.claude-flow/metrics/codebase-map.json +0 -11
  12. package/.claude-flow/metrics/consolidation.json +0 -6
  13. package/.claude-flow/metrics/performance.json +0 -87
  14. package/.claude-flow/metrics/security-audit.json +0 -10
  15. package/.claude-flow/metrics/task-metrics.json +0 -10
  16. package/.claude-flow/metrics/test-gaps.json +0 -6
  17. package/__tests__/README.md +0 -140
  18. package/__tests__/TEST_SUMMARY.md +0 -144
  19. package/__tests__/cli.test.ts +0 -558
  20. package/__tests__/commands.test.ts +0 -726
  21. package/__tests__/config-adapter.test.ts +0 -362
  22. package/__tests__/config-loading.test.ts +0 -106
  23. package/__tests__/coverage/.tmp/coverage-0.json +0 -1
  24. package/__tests__/coverage/.tmp/coverage-1.json +0 -1
  25. package/__tests__/coverage/.tmp/coverage-2.json +0 -1
  26. package/__tests__/coverage/.tmp/coverage-3.json +0 -1
  27. package/__tests__/coverage/.tmp/coverage-4.json +0 -1
  28. package/__tests__/coverage/.tmp/coverage-5.json +0 -1
  29. package/__tests__/mcp-client.test.ts +0 -480
  30. package/__tests__/p1-commands.test.ts +0 -1064
  31. package/agents/architect.yaml +0 -11
  32. package/agents/coder.yaml +0 -11
  33. package/agents/reviewer.yaml +0 -10
  34. package/agents/security-architect.yaml +0 -10
  35. package/agents/tester.yaml +0 -10
  36. package/docs/CONFIG_LOADING.md +0 -236
  37. package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
  38. package/docs/MCP_CLIENT_GUIDE.md +0 -620
  39. package/docs/REFACTORING_SUMMARY.md +0 -247
  40. package/scripts/publish.sh +0 -46
  41. package/src/commands/agent.ts +0 -955
  42. package/src/commands/claims.ts +0 -317
  43. package/src/commands/completions.ts +0 -558
  44. package/src/commands/config.ts +0 -452
  45. package/src/commands/daemon.ts +0 -621
  46. package/src/commands/deployment.ts +0 -323
  47. package/src/commands/doctor.ts +0 -382
  48. package/src/commands/embeddings.ts +0 -686
  49. package/src/commands/hive-mind.ts +0 -928
  50. package/src/commands/hooks.ts +0 -2603
  51. package/src/commands/index.ts +0 -154
  52. package/src/commands/init.ts +0 -597
  53. package/src/commands/mcp.ts +0 -753
  54. package/src/commands/memory.ts +0 -1161
  55. package/src/commands/migrate.ts +0 -447
  56. package/src/commands/neural.ts +0 -253
  57. package/src/commands/performance.ts +0 -292
  58. package/src/commands/plugins.ts +0 -316
  59. package/src/commands/process.ts +0 -695
  60. package/src/commands/providers.ts +0 -259
  61. package/src/commands/security.ts +0 -288
  62. package/src/commands/session.ts +0 -891
  63. package/src/commands/start.ts +0 -457
  64. package/src/commands/status.ts +0 -736
  65. package/src/commands/swarm.ts +0 -648
  66. package/src/commands/task.ts +0 -792
  67. package/src/commands/workflow.ts +0 -742
  68. package/src/config-adapter.ts +0 -210
  69. package/src/index.ts +0 -443
  70. package/src/infrastructure/in-memory-repositories.ts +0 -310
  71. package/src/init/claudemd-generator.ts +0 -631
  72. package/src/init/executor.ts +0 -762
  73. package/src/init/helpers-generator.ts +0 -628
  74. package/src/init/index.ts +0 -60
  75. package/src/init/mcp-generator.ts +0 -83
  76. package/src/init/settings-generator.ts +0 -284
  77. package/src/init/statusline-generator.ts +0 -211
  78. package/src/init/types.ts +0 -447
  79. package/src/mcp-client.ts +0 -241
  80. package/src/mcp-server.ts +0 -577
  81. package/src/mcp-tools/agent-tools.ts +0 -466
  82. package/src/mcp-tools/config-tools.ts +0 -370
  83. package/src/mcp-tools/hive-mind-tools.ts +0 -521
  84. package/src/mcp-tools/hooks-tools.ts +0 -1888
  85. package/src/mcp-tools/index.ts +0 -16
  86. package/src/mcp-tools/memory-tools.ts +0 -270
  87. package/src/mcp-tools/session-tools.ts +0 -359
  88. package/src/mcp-tools/swarm-tools.ts +0 -105
  89. package/src/mcp-tools/task-tools.ts +0 -347
  90. package/src/mcp-tools/types.ts +0 -33
  91. package/src/mcp-tools/workflow-tools.ts +0 -573
  92. package/src/output.ts +0 -639
  93. package/src/parser.ts +0 -417
  94. package/src/prompt.ts +0 -619
  95. package/src/services/index.ts +0 -15
  96. package/src/services/worker-daemon.ts +0 -726
  97. package/src/suggest.ts +0 -245
  98. package/src/types.ts +0 -287
  99. package/tmp.json +0 -0
  100. package/tsconfig.json +0 -16
  101. package/tsconfig.tsbuildinfo +0 -1
  102. package/vitest.config.ts +0 -13
@@ -1,558 +0,0 @@
1
- /**
2
- * V3 CLI Completions Command
3
- * Shell completions for bash, zsh, fish, powershell
4
- *
5
- * Created with ruv.io
6
- */
7
-
8
- import type { Command, CommandContext, CommandResult } from '../types.js';
9
- import { output } from '../output.js';
10
-
11
- // Get all top-level commands for completions
12
- const TOP_LEVEL_COMMANDS = [
13
- 'swarm', 'agent', 'task', 'session', 'config', 'memory', 'workflow',
14
- 'hive-mind', 'hooks', 'daemon', 'neural', 'security', 'performance',
15
- 'providers', 'plugins', 'deployment', 'claims', 'embeddings',
16
- 'doctor', 'completions', 'help', 'version'
17
- ];
18
-
19
- // Swarm subcommands
20
- const SWARM_SUBCOMMANDS = ['init', 'status', 'scale', 'destroy', 'monitor', 'optimize'];
21
-
22
- // Agent subcommands
23
- const AGENT_SUBCOMMANDS = ['spawn', 'terminate', 'status', 'list', 'pool', 'health', 'update'];
24
-
25
- // Task subcommands
26
- const TASK_SUBCOMMANDS = ['create', 'status', 'list', 'complete', 'cancel'];
27
-
28
- // Memory subcommands
29
- const MEMORY_SUBCOMMANDS = ['store', 'retrieve', 'search', 'list', 'delete', 'stats', 'configure', 'cleanup', 'compress', 'export', 'import'];
30
-
31
- // Hive-mind subcommands
32
- const HIVE_MIND_SUBCOMMANDS = ['init', 'spawn', 'status', 'task', 'join', 'leave', 'consensus', 'broadcast', 'memory', 'optimize-memory', 'shutdown'];
33
-
34
- // Hooks subcommands
35
- const HOOKS_SUBCOMMANDS = ['pre-edit', 'post-edit', 'pre-command', 'post-command', 'pre-task', 'post-task', 'route', 'explain', 'pretrain', 'build-agents', 'metrics', 'transfer', 'list', 'intelligence'];
36
-
37
- // Generate bash completion script
38
- function generateBashCompletion(): string {
39
- return `# claude-flow bash completion
40
- # Generated by claude-flow completions bash
41
- # Add this to ~/.bashrc or ~/.bash_completion
42
-
43
- _claude_flow_completions() {
44
- local cur prev words cword
45
- _init_completion -n : || return
46
-
47
- local commands="${TOP_LEVEL_COMMANDS.join(' ')}"
48
-
49
- # Subcommand completions
50
- local swarm_commands="${SWARM_SUBCOMMANDS.join(' ')}"
51
- local agent_commands="${AGENT_SUBCOMMANDS.join(' ')}"
52
- local task_commands="${TASK_SUBCOMMANDS.join(' ')}"
53
- local memory_commands="${MEMORY_SUBCOMMANDS.join(' ')}"
54
- local hive_mind_commands="${HIVE_MIND_SUBCOMMANDS.join(' ')}"
55
- local hooks_commands="${HOOKS_SUBCOMMANDS.join(' ')}"
56
-
57
- case "\${words[1]}" in
58
- swarm)
59
- COMPREPLY=( $(compgen -W "\${swarm_commands}" -- "\${cur}") )
60
- return 0
61
- ;;
62
- agent)
63
- COMPREPLY=( $(compgen -W "\${agent_commands}" -- "\${cur}") )
64
- return 0
65
- ;;
66
- task)
67
- COMPREPLY=( $(compgen -W "\${task_commands}" -- "\${cur}") )
68
- return 0
69
- ;;
70
- memory)
71
- COMPREPLY=( $(compgen -W "\${memory_commands}" -- "\${cur}") )
72
- return 0
73
- ;;
74
- hive-mind|hive)
75
- COMPREPLY=( $(compgen -W "\${hive_mind_commands}" -- "\${cur}") )
76
- return 0
77
- ;;
78
- hooks)
79
- COMPREPLY=( $(compgen -W "\${hooks_commands}" -- "\${cur}") )
80
- return 0
81
- ;;
82
- neural)
83
- COMPREPLY=( $(compgen -W "train status patterns predict optimize" -- "\${cur}") )
84
- return 0
85
- ;;
86
- security)
87
- COMPREPLY=( $(compgen -W "scan cve threats audit secrets" -- "\${cur}") )
88
- return 0
89
- ;;
90
- performance)
91
- COMPREPLY=( $(compgen -W "benchmark profile metrics optimize bottleneck" -- "\${cur}") )
92
- return 0
93
- ;;
94
- plugins)
95
- COMPREPLY=( $(compgen -W "list install uninstall toggle info create" -- "\${cur}") )
96
- return 0
97
- ;;
98
- deployment|deploy)
99
- COMPREPLY=( $(compgen -W "deploy status rollback history environments logs" -- "\${cur}") )
100
- return 0
101
- ;;
102
- claims)
103
- COMPREPLY=( $(compgen -W "list check grant revoke roles policies" -- "\${cur}") )
104
- return 0
105
- ;;
106
- embeddings)
107
- COMPREPLY=( $(compgen -W "generate search compare collections index providers" -- "\${cur}") )
108
- return 0
109
- ;;
110
- daemon)
111
- COMPREPLY=( $(compgen -W "start stop status trigger enable" -- "\${cur}") )
112
- return 0
113
- ;;
114
- providers)
115
- COMPREPLY=( $(compgen -W "list configure test models usage" -- "\${cur}") )
116
- return 0
117
- ;;
118
- doctor)
119
- COMPREPLY=( $(compgen -W "--fix --component --verbose" -- "\${cur}") )
120
- return 0
121
- ;;
122
- esac
123
-
124
- if [[ \${cword} -eq 1 ]]; then
125
- COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
126
- return 0
127
- fi
128
- }
129
-
130
- complete -F _claude_flow_completions claude-flow
131
- complete -F _claude_flow_completions npx\\ @claude-flow/cli@v3alpha
132
- `;
133
- }
134
-
135
- // Generate zsh completion script
136
- function generateZshCompletion(): string {
137
- return `#compdef claude-flow
138
- # claude-flow zsh completion
139
- # Generated by claude-flow completions zsh
140
- # Add to ~/.zfunc/_claude-flow or ~/.zsh/completions/_claude-flow
141
-
142
- _claude_flow() {
143
- local -a commands
144
- local -a subcommands
145
-
146
- commands=(
147
- 'swarm:Multi-agent swarm orchestration'
148
- 'agent:Agent lifecycle management'
149
- 'task:Task creation and management'
150
- 'session:Session management'
151
- 'config:Configuration management'
152
- 'memory:Memory operations with AgentDB'
153
- 'workflow:Workflow automation'
154
- 'hive-mind:Queen-led consensus coordination'
155
- 'hooks:Self-learning automation hooks'
156
- 'daemon:Background service management'
157
- 'neural:Neural pattern training'
158
- 'security:Security scanning and CVE detection'
159
- 'performance:Performance profiling'
160
- 'providers:AI provider management'
161
- 'plugins:Plugin management'
162
- 'deployment:Deployment management'
163
- 'claims:Claims-based authorization'
164
- 'embeddings:Vector embeddings'
165
- 'doctor:System diagnostics'
166
- 'completions:Shell completion scripts'
167
- 'help:Show help'
168
- 'version:Show version'
169
- )
170
-
171
- _arguments -C \\
172
- '1: :->command' \\
173
- '2: :->subcommand' \\
174
- '*:: :->args' && return
175
-
176
- case $state in
177
- command)
178
- _describe -t commands 'claude-flow commands' commands
179
- ;;
180
- subcommand)
181
- case $words[2] in
182
- swarm)
183
- subcommands=(
184
- 'init:Initialize swarm'
185
- 'status:Show swarm status'
186
- 'scale:Scale agent count'
187
- 'destroy:Shutdown swarm'
188
- 'monitor:Real-time monitoring'
189
- 'optimize:Optimize topology'
190
- )
191
- ;;
192
- agent)
193
- subcommands=(
194
- 'spawn:Create new agent'
195
- 'terminate:Stop agent'
196
- 'status:Check agent status'
197
- 'list:List all agents'
198
- 'pool:Manage agent pool'
199
- 'health:Health check'
200
- 'update:Update agent config'
201
- )
202
- ;;
203
- task)
204
- subcommands=(
205
- 'create:Create new task'
206
- 'status:Check task status'
207
- 'list:List all tasks'
208
- 'complete:Mark task complete'
209
- 'cancel:Cancel task'
210
- )
211
- ;;
212
- memory)
213
- subcommands=(
214
- 'store:Store data'
215
- 'retrieve:Retrieve data'
216
- 'search:Semantic search'
217
- 'list:List entries'
218
- 'delete:Delete entry'
219
- 'stats:Show statistics'
220
- 'configure:Configure backend'
221
- 'cleanup:Clean stale data'
222
- 'compress:Compress storage'
223
- 'export:Export to file'
224
- 'import:Import from file'
225
- )
226
- ;;
227
- hive-mind|hive)
228
- subcommands=(
229
- 'init:Initialize hive mind'
230
- 'spawn:Spawn worker agents'
231
- 'status:Show hive status'
232
- 'task:Submit task'
233
- 'join:Join agent to hive'
234
- 'leave:Remove agent'
235
- 'consensus:Consensus management'
236
- 'broadcast:Broadcast message'
237
- 'memory:Shared memory'
238
- 'optimize-memory:Optimize patterns'
239
- 'shutdown:Shutdown hive'
240
- )
241
- ;;
242
- hooks)
243
- subcommands=(
244
- 'pre-edit:Before file editing'
245
- 'post-edit:After file editing'
246
- 'pre-command:Before command execution'
247
- 'post-command:After command execution'
248
- 'pre-task:Before task start'
249
- 'post-task:After task completion'
250
- 'route:Route task to agent'
251
- 'explain:Explain routing'
252
- 'pretrain:Bootstrap intelligence'
253
- 'build-agents:Generate agent configs'
254
- 'metrics:Show metrics'
255
- 'transfer:Transfer learning'
256
- 'list:List hooks'
257
- 'intelligence:Neural intelligence commands'
258
- )
259
- ;;
260
- neural)
261
- subcommands=(
262
- 'train:Train neural patterns'
263
- 'status:Check neural status'
264
- 'patterns:Manage patterns'
265
- 'predict:Make predictions'
266
- 'optimize:Optimize models'
267
- )
268
- ;;
269
- security)
270
- subcommands=(
271
- 'scan:Security scan'
272
- 'cve:CVE detection'
273
- 'threats:Threat modeling'
274
- 'audit:Security audit'
275
- 'secrets:Secrets scanning'
276
- )
277
- ;;
278
- performance)
279
- subcommands=(
280
- 'benchmark:Run benchmarks'
281
- 'profile:Profile code'
282
- 'metrics:Show metrics'
283
- 'optimize:Optimize performance'
284
- 'bottleneck:Find bottlenecks'
285
- )
286
- ;;
287
- plugins)
288
- subcommands=(
289
- 'list:List plugins'
290
- 'install:Install plugin'
291
- 'uninstall:Remove plugin'
292
- 'toggle:Enable/disable'
293
- 'info:Plugin details'
294
- 'create:Scaffold plugin'
295
- )
296
- ;;
297
- deployment|deploy)
298
- subcommands=(
299
- 'deploy:Deploy to environment'
300
- 'status:Deployment status'
301
- 'rollback:Rollback version'
302
- 'history:Deployment history'
303
- 'environments:List environments'
304
- 'logs:View logs'
305
- )
306
- ;;
307
- claims)
308
- subcommands=(
309
- 'list:List claims'
310
- 'check:Check permission'
311
- 'grant:Grant claim'
312
- 'revoke:Revoke claim'
313
- 'roles:Manage roles'
314
- 'policies:Manage policies'
315
- )
316
- ;;
317
- embeddings)
318
- subcommands=(
319
- 'generate:Generate embeddings'
320
- 'search:Semantic search'
321
- 'compare:Compare vectors'
322
- 'collections:Manage collections'
323
- 'index:Index operations'
324
- 'providers:Embedding providers'
325
- )
326
- ;;
327
- daemon)
328
- subcommands=(
329
- 'start:Start daemon'
330
- 'stop:Stop daemon'
331
- 'status:Daemon status'
332
- 'trigger:Trigger event'
333
- 'enable:Enable feature'
334
- )
335
- ;;
336
- providers)
337
- subcommands=(
338
- 'list:List providers'
339
- 'configure:Configure provider'
340
- 'test:Test connection'
341
- 'models:Available models'
342
- 'usage:Usage statistics'
343
- )
344
- ;;
345
- esac
346
- _describe -t subcommands 'subcommands' subcommands
347
- ;;
348
- esac
349
- }
350
-
351
- _claude_flow "$@"
352
- `;
353
- }
354
-
355
- // Generate fish completion script
356
- function generateFishCompletion(): string {
357
- return `# claude-flow fish completion
358
- # Generated by claude-flow completions fish
359
- # Save to ~/.config/fish/completions/claude-flow.fish
360
-
361
- # Disable file completion by default
362
- complete -c claude-flow -f
363
-
364
- # Top-level commands
365
- ${TOP_LEVEL_COMMANDS.map(cmd => `complete -c claude-flow -n "__fish_use_subcommand" -a "${cmd}"`).join('\n')}
366
-
367
- # Swarm subcommands
368
- ${SWARM_SUBCOMMANDS.map(sub => `complete -c claude-flow -n "__fish_seen_subcommand_from swarm" -a "${sub}"`).join('\n')}
369
-
370
- # Agent subcommands
371
- ${AGENT_SUBCOMMANDS.map(sub => `complete -c claude-flow -n "__fish_seen_subcommand_from agent" -a "${sub}"`).join('\n')}
372
-
373
- # Task subcommands
374
- ${TASK_SUBCOMMANDS.map(sub => `complete -c claude-flow -n "__fish_seen_subcommand_from task" -a "${sub}"`).join('\n')}
375
-
376
- # Memory subcommands
377
- ${MEMORY_SUBCOMMANDS.map(sub => `complete -c claude-flow -n "__fish_seen_subcommand_from memory" -a "${sub}"`).join('\n')}
378
-
379
- # Hive-mind subcommands
380
- ${HIVE_MIND_SUBCOMMANDS.map(sub => `complete -c claude-flow -n "__fish_seen_subcommand_from hive-mind hive" -a "${sub}"`).join('\n')}
381
-
382
- # Hooks subcommands
383
- ${HOOKS_SUBCOMMANDS.map(sub => `complete -c claude-flow -n "__fish_seen_subcommand_from hooks" -a "${sub}"`).join('\n')}
384
-
385
- # Neural subcommands
386
- complete -c claude-flow -n "__fish_seen_subcommand_from neural" -a "train status patterns predict optimize"
387
-
388
- # Security subcommands
389
- complete -c claude-flow -n "__fish_seen_subcommand_from security" -a "scan cve threats audit secrets"
390
-
391
- # Performance subcommands
392
- complete -c claude-flow -n "__fish_seen_subcommand_from performance" -a "benchmark profile metrics optimize bottleneck"
393
-
394
- # Plugins subcommands
395
- complete -c claude-flow -n "__fish_seen_subcommand_from plugins" -a "list install uninstall toggle info create"
396
-
397
- # Deployment subcommands
398
- complete -c claude-flow -n "__fish_seen_subcommand_from deployment deploy" -a "deploy status rollback history environments logs"
399
-
400
- # Claims subcommands
401
- complete -c claude-flow -n "__fish_seen_subcommand_from claims" -a "list check grant revoke roles policies"
402
-
403
- # Embeddings subcommands
404
- complete -c claude-flow -n "__fish_seen_subcommand_from embeddings" -a "generate search compare collections index providers"
405
-
406
- # Daemon subcommands
407
- complete -c claude-flow -n "__fish_seen_subcommand_from daemon" -a "start stop status trigger enable"
408
-
409
- # Providers subcommands
410
- complete -c claude-flow -n "__fish_seen_subcommand_from providers" -a "list configure test models usage"
411
- `;
412
- }
413
-
414
- // Generate PowerShell completion script
415
- function generatePowerShellCompletion(): string {
416
- return `# claude-flow PowerShell completion
417
- # Generated by claude-flow completions powershell
418
- # Add to $PROFILE or save to a separate file and dot-source it
419
-
420
- $script:ClaudeFlowCommands = @(
421
- '${TOP_LEVEL_COMMANDS.join("',\n '")}'
422
- )
423
-
424
- $script:SubCommands = @{
425
- 'swarm' = @('${SWARM_SUBCOMMANDS.join("', '")}')
426
- 'agent' = @('${AGENT_SUBCOMMANDS.join("', '")}')
427
- 'task' = @('${TASK_SUBCOMMANDS.join("', '")}')
428
- 'memory' = @('${MEMORY_SUBCOMMANDS.join("', '")}')
429
- 'hive-mind' = @('${HIVE_MIND_SUBCOMMANDS.join("', '")}')
430
- 'hive' = @('${HIVE_MIND_SUBCOMMANDS.join("', '")}')
431
- 'hooks' = @('${HOOKS_SUBCOMMANDS.join("', '")}')
432
- 'neural' = @('train', 'status', 'patterns', 'predict', 'optimize')
433
- 'security' = @('scan', 'cve', 'threats', 'audit', 'secrets')
434
- 'performance' = @('benchmark', 'profile', 'metrics', 'optimize', 'bottleneck')
435
- 'plugins' = @('list', 'install', 'uninstall', 'toggle', 'info', 'create')
436
- 'deployment' = @('deploy', 'status', 'rollback', 'history', 'environments', 'logs')
437
- 'deploy' = @('deploy', 'status', 'rollback', 'history', 'environments', 'logs')
438
- 'claims' = @('list', 'check', 'grant', 'revoke', 'roles', 'policies')
439
- 'embeddings' = @('generate', 'search', 'compare', 'collections', 'index', 'providers')
440
- 'daemon' = @('start', 'stop', 'status', 'trigger', 'enable')
441
- 'providers' = @('list', 'configure', 'test', 'models', 'usage')
442
- }
443
-
444
- Register-ArgumentCompleter -Native -CommandName claude-flow -ScriptBlock {
445
- param($wordToComplete, $commandAst, $cursorPosition)
446
-
447
- $tokens = $commandAst.ToString().Split(' ')
448
- $command = $tokens[1]
449
-
450
- if ($tokens.Count -eq 2) {
451
- # Complete top-level commands
452
- $script:ClaudeFlowCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
453
- [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
454
- }
455
- }
456
- elseif ($tokens.Count -eq 3 -and $script:SubCommands.ContainsKey($command)) {
457
- # Complete subcommands
458
- $script:SubCommands[$command] | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
459
- [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
460
- }
461
- }
462
- }
463
- `;
464
- }
465
-
466
- // Bash subcommand
467
- const bashCommand: Command = {
468
- name: 'bash',
469
- description: 'Generate bash completion script',
470
- action: async (ctx: CommandContext): Promise<CommandResult> => {
471
- const script = generateBashCompletion();
472
- output.writeln(script);
473
- return { success: true };
474
- }
475
- };
476
-
477
- // Zsh subcommand
478
- const zshCommand: Command = {
479
- name: 'zsh',
480
- description: 'Generate zsh completion script',
481
- action: async (ctx: CommandContext): Promise<CommandResult> => {
482
- const script = generateZshCompletion();
483
- output.writeln(script);
484
- return { success: true };
485
- }
486
- };
487
-
488
- // Fish subcommand
489
- const fishCommand: Command = {
490
- name: 'fish',
491
- description: 'Generate fish completion script',
492
- action: async (ctx: CommandContext): Promise<CommandResult> => {
493
- const script = generateFishCompletion();
494
- output.writeln(script);
495
- return { success: true };
496
- }
497
- };
498
-
499
- // PowerShell subcommand
500
- const powershellCommand: Command = {
501
- name: 'powershell',
502
- aliases: ['pwsh'],
503
- description: 'Generate PowerShell completion script',
504
- action: async (ctx: CommandContext): Promise<CommandResult> => {
505
- const script = generatePowerShellCompletion();
506
- output.writeln(script);
507
- return { success: true };
508
- }
509
- };
510
-
511
- // Main completions command
512
- export const completionsCommand: Command = {
513
- name: 'completions',
514
- description: 'Generate shell completion scripts',
515
- subcommands: [bashCommand, zshCommand, fishCommand, powershellCommand],
516
- options: [],
517
- examples: [
518
- { command: 'claude-flow completions bash > ~/.bash_completion.d/claude-flow', description: 'Install bash completions' },
519
- { command: 'claude-flow completions zsh > ~/.zfunc/_claude-flow', description: 'Install zsh completions' },
520
- { command: 'claude-flow completions fish > ~/.config/fish/completions/claude-flow.fish', description: 'Install fish completions' },
521
- { command: 'claude-flow completions powershell >> $PROFILE', description: 'Install PowerShell completions' }
522
- ],
523
- action: async (): Promise<CommandResult> => {
524
- output.writeln();
525
- output.writeln(output.bold('Shell Completions'));
526
- output.writeln();
527
- output.writeln('Generate shell completion scripts for tab completion support.');
528
- output.writeln();
529
- output.writeln('Supported shells:');
530
- output.printList([
531
- `${output.highlight('bash')} - Bash completion`,
532
- `${output.highlight('zsh')} - Zsh completion`,
533
- `${output.highlight('fish')} - Fish completion`,
534
- `${output.highlight('powershell')} - PowerShell completion`
535
- ]);
536
- output.writeln();
537
- output.writeln('Installation:');
538
- output.writeln();
539
- output.writeln(output.bold('Bash:'));
540
- output.writeln(output.dim(' claude-flow completions bash > ~/.bash_completion.d/claude-flow'));
541
- output.writeln(output.dim(' source ~/.bash_completion.d/claude-flow'));
542
- output.writeln();
543
- output.writeln(output.bold('Zsh:'));
544
- output.writeln(output.dim(' mkdir -p ~/.zfunc'));
545
- output.writeln(output.dim(' claude-flow completions zsh > ~/.zfunc/_claude-flow'));
546
- output.writeln(output.dim(' # Add to ~/.zshrc: fpath=(~/.zfunc $fpath); autoload -Uz compinit && compinit'));
547
- output.writeln();
548
- output.writeln(output.bold('Fish:'));
549
- output.writeln(output.dim(' claude-flow completions fish > ~/.config/fish/completions/claude-flow.fish'));
550
- output.writeln();
551
- output.writeln(output.bold('PowerShell:'));
552
- output.writeln(output.dim(' claude-flow completions powershell >> $PROFILE'));
553
-
554
- return { success: true };
555
- }
556
- };
557
-
558
- export default completionsCommand;