@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,317 +0,0 @@
1
- /**
2
- * V3 CLI Claims Command
3
- * Claims-based authorization, permissions, and access control
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 claims and permissions',
15
- options: [
16
- { name: 'user', short: 'u', type: 'string', description: 'Filter by user ID' },
17
- { name: 'role', short: 'r', type: 'string', description: 'Filter by role' },
18
- { name: 'resource', type: 'string', description: 'Filter by resource' },
19
- ],
20
- examples: [
21
- { command: 'claude-flow claims list', description: 'List all claims' },
22
- { command: 'claude-flow claims list -u user123', description: 'List user claims' },
23
- ],
24
- action: async (ctx: CommandContext): Promise<CommandResult> => {
25
- output.writeln();
26
- output.writeln(output.bold('Claims & Permissions'));
27
- output.writeln(output.dim('─'.repeat(70)));
28
-
29
- output.printTable({
30
- columns: [
31
- { key: 'claim', header: 'Claim', width: 25 },
32
- { key: 'type', header: 'Type', width: 12 },
33
- { key: 'scope', header: 'Scope', width: 15 },
34
- { key: 'value', header: 'Value', width: 20 },
35
- ],
36
- data: [
37
- { claim: 'swarm:create', type: 'Permission', scope: 'Global', value: output.success('Allowed') },
38
- { claim: 'swarm:delete', type: 'Permission', scope: 'Owned', value: output.success('Allowed') },
39
- { claim: 'agent:spawn', type: 'Permission', scope: 'Global', value: output.success('Allowed') },
40
- { claim: 'memory:read', type: 'Permission', scope: 'Namespace', value: output.success('Allowed') },
41
- { claim: 'memory:write', type: 'Permission', scope: 'Namespace', value: output.success('Allowed') },
42
- { claim: 'admin:*', type: 'Permission', scope: 'Global', value: output.error('Denied') },
43
- { claim: 'role', type: 'Identity', scope: 'System', value: 'developer' },
44
- { claim: 'tier', type: 'Identity', scope: 'System', value: 'pro' },
45
- ],
46
- });
47
-
48
- return { success: true };
49
- },
50
- };
51
-
52
- // Check subcommand
53
- const checkCommand: Command = {
54
- name: 'check',
55
- description: 'Check if a specific claim is granted',
56
- options: [
57
- { name: 'claim', short: 'c', type: 'string', description: 'Claim to check', required: true },
58
- { name: 'user', short: 'u', type: 'string', description: 'User ID to check' },
59
- { name: 'resource', short: 'r', type: 'string', description: 'Resource context' },
60
- ],
61
- examples: [
62
- { command: 'claude-flow claims check -c swarm:create', description: 'Check swarm creation permission' },
63
- { command: 'claude-flow claims check -c admin:delete -u user123', description: 'Check user permission' },
64
- ],
65
- action: async (ctx: CommandContext): Promise<CommandResult> => {
66
- const claim = ctx.flags.claim as string;
67
- const user = ctx.flags.user as string || 'current';
68
-
69
- if (!claim) {
70
- output.printError('Claim is required');
71
- return { success: false, exitCode: 1 };
72
- }
73
-
74
- output.writeln();
75
- output.writeln(output.bold('Claim Check'));
76
- output.writeln(output.dim('─'.repeat(40)));
77
-
78
- const spinner = output.createSpinner({ text: 'Evaluating claim...', spinner: 'dots' });
79
- spinner.start();
80
- await new Promise(r => setTimeout(r, 300));
81
-
82
- // Simulate claim check
83
- const isGranted = !claim.startsWith('admin:');
84
-
85
- if (isGranted) {
86
- spinner.succeed('Claim granted');
87
- } else {
88
- spinner.fail('Claim denied');
89
- }
90
-
91
- output.writeln();
92
- output.printBox([
93
- `Claim: ${claim}`,
94
- `User: ${user}`,
95
- `Result: ${isGranted ? output.success('GRANTED') : output.error('DENIED')}`,
96
- ``,
97
- `Reason: ${isGranted ? 'User has required role' : 'Requires admin role'}`,
98
- ].join('\n'), 'Result');
99
-
100
- return { success: true };
101
- },
102
- };
103
-
104
- // Grant subcommand
105
- const grantCommand: Command = {
106
- name: 'grant',
107
- description: 'Grant a claim to user or role',
108
- options: [
109
- { name: 'claim', short: 'c', type: 'string', description: 'Claim to grant', required: true },
110
- { name: 'user', short: 'u', type: 'string', description: 'User ID' },
111
- { name: 'role', short: 'r', type: 'string', description: 'Role name' },
112
- { name: 'scope', short: 's', type: 'string', description: 'Scope: global, namespace, resource', default: 'global' },
113
- { name: 'expires', short: 'e', type: 'string', description: 'Expiration time (e.g., 24h, 7d)' },
114
- ],
115
- examples: [
116
- { command: 'claude-flow claims grant -c swarm:create -u user123', description: 'Grant to user' },
117
- { command: 'claude-flow claims grant -c agent:spawn -r developer', description: 'Grant to role' },
118
- ],
119
- action: async (ctx: CommandContext): Promise<CommandResult> => {
120
- const claim = ctx.flags.claim as string;
121
- const user = ctx.flags.user as string;
122
- const role = ctx.flags.role as string;
123
- const scope = ctx.flags.scope as string || 'global';
124
-
125
- if (!claim) {
126
- output.printError('Claim is required');
127
- return { success: false, exitCode: 1 };
128
- }
129
-
130
- if (!user && !role) {
131
- output.printError('Either user or role is required');
132
- return { success: false, exitCode: 1 };
133
- }
134
-
135
- output.writeln();
136
- const spinner = output.createSpinner({ text: 'Granting claim...', spinner: 'dots' });
137
- spinner.start();
138
- await new Promise(r => setTimeout(r, 400));
139
- spinner.succeed('Claim granted');
140
-
141
- output.writeln();
142
- output.printBox([
143
- `Claim: ${claim}`,
144
- `Target: ${user ? `User: ${user}` : `Role: ${role}`}`,
145
- `Scope: ${scope}`,
146
- `Status: ${output.success('Active')}`,
147
- ].join('\n'), 'Grant Complete');
148
-
149
- return { success: true };
150
- },
151
- };
152
-
153
- // Revoke subcommand
154
- const revokeCommand: Command = {
155
- name: 'revoke',
156
- description: 'Revoke a claim from user or role',
157
- options: [
158
- { name: 'claim', short: 'c', type: 'string', description: 'Claim to revoke', required: true },
159
- { name: 'user', short: 'u', type: 'string', description: 'User ID' },
160
- { name: 'role', short: 'r', type: 'string', description: 'Role name' },
161
- ],
162
- examples: [
163
- { command: 'claude-flow claims revoke -c swarm:delete -u user123', description: 'Revoke from user' },
164
- { command: 'claude-flow claims revoke -c admin:* -r guest', description: 'Revoke from role' },
165
- ],
166
- action: async (ctx: CommandContext): Promise<CommandResult> => {
167
- const claim = ctx.flags.claim as string;
168
- const user = ctx.flags.user as string;
169
- const role = ctx.flags.role as string;
170
-
171
- if (!claim) {
172
- output.printError('Claim is required');
173
- return { success: false, exitCode: 1 };
174
- }
175
-
176
- output.writeln();
177
- const spinner = output.createSpinner({ text: 'Revoking claim...', spinner: 'dots' });
178
- spinner.start();
179
- await new Promise(r => setTimeout(r, 300));
180
- spinner.succeed('Claim revoked');
181
-
182
- return { success: true };
183
- },
184
- };
185
-
186
- // Roles subcommand
187
- const rolesCommand: Command = {
188
- name: 'roles',
189
- description: 'Manage roles and their claims',
190
- options: [
191
- { name: 'action', short: 'a', type: 'string', description: 'Action: list, create, delete, show', default: 'list' },
192
- { name: 'name', short: 'n', type: 'string', description: 'Role name' },
193
- ],
194
- examples: [
195
- { command: 'claude-flow claims roles', description: 'List all roles' },
196
- { command: 'claude-flow claims roles -a show -n admin', description: 'Show role details' },
197
- ],
198
- action: async (ctx: CommandContext): Promise<CommandResult> => {
199
- const action = ctx.flags.action as string || 'list';
200
- const name = ctx.flags.name as string;
201
-
202
- output.writeln();
203
- output.writeln(output.bold('Roles'));
204
- output.writeln(output.dim('─'.repeat(60)));
205
-
206
- if (action === 'show' && name) {
207
- output.printBox([
208
- `Role: ${name}`,
209
- `Description: Full system access`,
210
- ``,
211
- `Claims:`,
212
- ` - swarm:* (all swarm operations)`,
213
- ` - agent:* (all agent operations)`,
214
- ` - memory:* (all memory operations)`,
215
- ` - admin:* (administrative functions)`,
216
- ``,
217
- `Members: 2`,
218
- `Created: 2024-01-01`,
219
- ].join('\n'), 'Role Details');
220
- } else {
221
- output.printTable({
222
- columns: [
223
- { key: 'role', header: 'Role', width: 15 },
224
- { key: 'description', header: 'Description', width: 30 },
225
- { key: 'claims', header: 'Claims', width: 12 },
226
- { key: 'members', header: 'Members', width: 10 },
227
- ],
228
- data: [
229
- { role: output.highlight('admin'), description: 'Full system access', claims: '15', members: '2' },
230
- { role: output.highlight('developer'), description: 'Development operations', claims: '10', members: '12' },
231
- { role: output.highlight('operator'), description: 'Operational tasks', claims: '8', members: '5' },
232
- { role: output.highlight('viewer'), description: 'Read-only access', claims: '3', members: '25' },
233
- { role: output.highlight('guest'), description: 'Limited access', claims: '1', members: '100' },
234
- ],
235
- });
236
- }
237
-
238
- return { success: true };
239
- },
240
- };
241
-
242
- // Policies subcommand
243
- const policiesCommand: Command = {
244
- name: 'policies',
245
- description: 'Manage claim policies',
246
- options: [
247
- { name: 'action', short: 'a', type: 'string', description: 'Action: list, create, delete', default: 'list' },
248
- { name: 'name', short: 'n', type: 'string', description: 'Policy name' },
249
- ],
250
- examples: [
251
- { command: 'claude-flow claims policies', description: 'List policies' },
252
- { command: 'claude-flow claims policies -a create -n rate-limit', description: 'Create policy' },
253
- ],
254
- action: async (ctx: CommandContext): Promise<CommandResult> => {
255
- output.writeln();
256
- output.writeln(output.bold('Claim Policies'));
257
- output.writeln(output.dim('─'.repeat(60)));
258
-
259
- output.printTable({
260
- columns: [
261
- { key: 'policy', header: 'Policy', width: 20 },
262
- { key: 'type', header: 'Type', width: 15 },
263
- { key: 'condition', header: 'Condition', width: 30 },
264
- { key: 'status', header: 'Status', width: 12 },
265
- ],
266
- data: [
267
- { policy: 'rate-limit', type: 'Throttle', condition: 'Max 100 req/min', status: output.success('Active') },
268
- { policy: 'geo-restrict', type: 'Location', condition: 'US, EU only', status: output.success('Active') },
269
- { policy: 'time-window', type: 'Temporal', condition: 'Business hours', status: output.dim('Inactive') },
270
- { policy: 'ip-allowlist', type: 'Network', condition: '10.0.0.0/8', status: output.success('Active') },
271
- { policy: 'mfa-required', type: 'Auth', condition: 'Admin operations', status: output.success('Active') },
272
- ],
273
- });
274
-
275
- return { success: true };
276
- },
277
- };
278
-
279
- // Main claims command
280
- export const claimsCommand: Command = {
281
- name: 'claims',
282
- description: 'Claims-based authorization, permissions, and access control',
283
- subcommands: [listCommand, checkCommand, grantCommand, revokeCommand, rolesCommand, policiesCommand],
284
- examples: [
285
- { command: 'claude-flow claims list', description: 'List all claims' },
286
- { command: 'claude-flow claims check -c swarm:create', description: 'Check permission' },
287
- { command: 'claude-flow claims grant -c agent:spawn -r developer', description: 'Grant claim' },
288
- ],
289
- action: async (): Promise<CommandResult> => {
290
- output.writeln();
291
- output.writeln(output.bold('Claude Flow Claims System'));
292
- output.writeln(output.dim('Fine-grained authorization and access control'));
293
- output.writeln();
294
- output.writeln('Subcommands:');
295
- output.printList([
296
- 'list - List claims and permissions',
297
- 'check - Check if a claim is granted',
298
- 'grant - Grant a claim to user or role',
299
- 'revoke - Revoke a claim',
300
- 'roles - Manage roles and their claims',
301
- 'policies - Manage claim policies',
302
- ]);
303
- output.writeln();
304
- output.writeln('Claim Types:');
305
- output.printList([
306
- 'swarm:* - Swarm operations (create, delete, scale)',
307
- 'agent:* - Agent operations (spawn, terminate)',
308
- 'memory:* - Memory operations (read, write, delete)',
309
- 'admin:* - Administrative operations',
310
- ]);
311
- output.writeln();
312
- output.writeln(output.dim('Created with ❤️ by ruv.io'));
313
- return { success: true };
314
- },
315
- };
316
-
317
- export default claimsCommand;