@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,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;