claude-flow 1.0.0

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +612 -0
  3. package/bin/claude-flow +0 -0
  4. package/bin/claude-flow-simple +0 -0
  5. package/bin/claude-flow-typecheck +0 -0
  6. package/deno.json +84 -0
  7. package/package.json +45 -0
  8. package/scripts/check-links.ts +274 -0
  9. package/scripts/check-performance-regression.ts +168 -0
  10. package/scripts/claude-sparc.sh +562 -0
  11. package/scripts/coverage-report.ts +692 -0
  12. package/scripts/demo-task-system.ts +224 -0
  13. package/scripts/install.js +72 -0
  14. package/scripts/test-batch-tasks.ts +29 -0
  15. package/scripts/test-coordination-features.ts +238 -0
  16. package/scripts/test-mcp.ts +251 -0
  17. package/scripts/test-runner.ts +571 -0
  18. package/scripts/validate-examples.ts +288 -0
  19. package/src/cli/cli-core.ts +273 -0
  20. package/src/cli/commands/agent.ts +83 -0
  21. package/src/cli/commands/config.ts +442 -0
  22. package/src/cli/commands/help.ts +765 -0
  23. package/src/cli/commands/index.ts +963 -0
  24. package/src/cli/commands/mcp.ts +191 -0
  25. package/src/cli/commands/memory.ts +74 -0
  26. package/src/cli/commands/monitor.ts +403 -0
  27. package/src/cli/commands/session.ts +595 -0
  28. package/src/cli/commands/start.ts +156 -0
  29. package/src/cli/commands/status.ts +345 -0
  30. package/src/cli/commands/task.ts +79 -0
  31. package/src/cli/commands/workflow.ts +763 -0
  32. package/src/cli/completion.ts +553 -0
  33. package/src/cli/formatter.ts +310 -0
  34. package/src/cli/index.ts +211 -0
  35. package/src/cli/main.ts +23 -0
  36. package/src/cli/repl.ts +1050 -0
  37. package/src/cli/simple-cli.js +211 -0
  38. package/src/cli/simple-cli.ts +211 -0
  39. package/src/coordination/README.md +400 -0
  40. package/src/coordination/advanced-scheduler.ts +487 -0
  41. package/src/coordination/circuit-breaker.ts +366 -0
  42. package/src/coordination/conflict-resolution.ts +490 -0
  43. package/src/coordination/dependency-graph.ts +475 -0
  44. package/src/coordination/index.ts +63 -0
  45. package/src/coordination/manager.ts +460 -0
  46. package/src/coordination/messaging.ts +290 -0
  47. package/src/coordination/metrics.ts +585 -0
  48. package/src/coordination/resources.ts +322 -0
  49. package/src/coordination/scheduler.ts +390 -0
  50. package/src/coordination/work-stealing.ts +224 -0
  51. package/src/core/config.ts +627 -0
  52. package/src/core/event-bus.ts +186 -0
  53. package/src/core/json-persistence.ts +183 -0
  54. package/src/core/logger.ts +262 -0
  55. package/src/core/orchestrator-fixed.ts +312 -0
  56. package/src/core/orchestrator.ts +1234 -0
  57. package/src/core/persistence.ts +276 -0
  58. package/src/mcp/auth.ts +438 -0
  59. package/src/mcp/claude-flow-tools.ts +1280 -0
  60. package/src/mcp/load-balancer.ts +510 -0
  61. package/src/mcp/router.ts +240 -0
  62. package/src/mcp/server.ts +548 -0
  63. package/src/mcp/session-manager.ts +418 -0
  64. package/src/mcp/tools.ts +180 -0
  65. package/src/mcp/transports/base.ts +21 -0
  66. package/src/mcp/transports/http.ts +457 -0
  67. package/src/mcp/transports/stdio.ts +254 -0
  68. package/src/memory/backends/base.ts +22 -0
  69. package/src/memory/backends/markdown.ts +283 -0
  70. package/src/memory/backends/sqlite.ts +329 -0
  71. package/src/memory/cache.ts +238 -0
  72. package/src/memory/indexer.ts +238 -0
  73. package/src/memory/manager.ts +572 -0
  74. package/src/terminal/adapters/base.ts +29 -0
  75. package/src/terminal/adapters/native.ts +504 -0
  76. package/src/terminal/adapters/vscode.ts +340 -0
  77. package/src/terminal/manager.ts +308 -0
  78. package/src/terminal/pool.ts +271 -0
  79. package/src/terminal/session.ts +250 -0
  80. package/src/terminal/vscode-bridge.ts +242 -0
  81. package/src/utils/errors.ts +231 -0
  82. package/src/utils/helpers.ts +476 -0
  83. package/src/utils/types.ts +493 -0
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env -S deno run --allow-all
2
+
3
+ /**
4
+ * MCP Test Runner
5
+ * Comprehensive test suite for the MCP implementation
6
+ */
7
+
8
+ import { parseArgs } from 'https://deno.land/std@0.208.0/cli/parse_args.ts';
9
+ import { join } from 'https://deno.land/std@0.208.0/path/mod.ts';
10
+
11
+ interface TestConfig {
12
+ unit: boolean;
13
+ integration: boolean;
14
+ coverage: boolean;
15
+ watch: boolean;
16
+ filter?: string;
17
+ verbose: boolean;
18
+ }
19
+
20
+ async function runTests(config: TestConfig): Promise<void> {
21
+ const testFiles: string[] = [];
22
+
23
+ if (config.unit) {
24
+ console.log('šŸ” Discovering unit tests...');
25
+ const unitTests = await discoverTests('tests/unit', config.filter);
26
+ testFiles.push(...unitTests);
27
+ }
28
+
29
+ if (config.integration) {
30
+ console.log('šŸ” Discovering integration tests...');
31
+ const integrationTests = await discoverTests('tests/integration', config.filter);
32
+ testFiles.push(...integrationTests);
33
+ }
34
+
35
+ if (testFiles.length === 0) {
36
+ console.log('āŒ No test files found');
37
+ Deno.exit(1);
38
+ }
39
+
40
+ console.log(`šŸ“‹ Found ${testFiles.length} test files:`);
41
+ for (const file of testFiles) {
42
+ console.log(` - ${file}`);
43
+ }
44
+ console.log();
45
+
46
+ // Build Deno test command
47
+ const args = [
48
+ 'test',
49
+ '--allow-all',
50
+ '--unstable',
51
+ ...testFiles,
52
+ ];
53
+
54
+ if (config.coverage) {
55
+ args.push('--coverage=coverage');
56
+ }
57
+
58
+ if (config.watch) {
59
+ args.push('--watch');
60
+ }
61
+
62
+ if (config.verbose) {
63
+ args.push('--verbose');
64
+ }
65
+
66
+ console.log('🧪 Running tests...');
67
+ console.log(`Command: deno ${args.join(' ')}`);
68
+ console.log();
69
+
70
+ const process = new Deno.Command('deno', {
71
+ args,
72
+ stdout: 'inherit',
73
+ stderr: 'inherit',
74
+ });
75
+
76
+ const { code } = await process.output();
77
+
78
+ if (config.coverage && code === 0) {
79
+ console.log('\nšŸ“Š Generating coverage report...');
80
+
81
+ const coverageProcess = new Deno.Command('deno', {
82
+ args: ['coverage', '--html', 'coverage'],
83
+ stdout: 'inherit',
84
+ stderr: 'inherit',
85
+ });
86
+
87
+ await coverageProcess.output();
88
+ console.log('Coverage report generated in coverage/html/');
89
+ }
90
+
91
+ if (code !== 0) {
92
+ console.log('\nāŒ Tests failed');
93
+ Deno.exit(code);
94
+ }
95
+
96
+ console.log('\nāœ… All tests passed!');
97
+ }
98
+
99
+ async function discoverTests(baseDir: string, filter?: string): Promise<string[]> {
100
+ const testFiles: string[] = [];
101
+
102
+ try {
103
+ for await (const entry of Deno.readDir(baseDir)) {
104
+ if (entry.isDirectory) {
105
+ const subDirTests = await discoverTests(
106
+ join(baseDir, entry.name),
107
+ filter
108
+ );
109
+ testFiles.push(...subDirTests);
110
+ } else if (entry.name.endsWith('.test.ts')) {
111
+ const filePath = join(baseDir, entry.name);
112
+
113
+ if (!filter || filePath.includes(filter)) {
114
+ testFiles.push(filePath);
115
+ }
116
+ }
117
+ }
118
+ } catch (error) {
119
+ if (!(error instanceof Deno.errors.NotFound)) {
120
+ throw error;
121
+ }
122
+ }
123
+
124
+ return testFiles;
125
+ }
126
+
127
+ async function validateEnvironment(): Promise<void> {
128
+ console.log('šŸ”§ Validating environment...');
129
+
130
+ // Check Deno version
131
+ const { code, stdout } = await new Deno.Command('deno', {
132
+ args: ['--version'],
133
+ stdout: 'piped',
134
+ }).output();
135
+
136
+ if (code !== 0) {
137
+ console.error('āŒ Deno not found');
138
+ Deno.exit(1);
139
+ }
140
+
141
+ const versionOutput = new TextDecoder().decode(stdout);
142
+ console.log(`āœ… ${versionOutput.split('\n')[0]}`);
143
+
144
+ // Check required files exist
145
+ const requiredFiles = [
146
+ 'src/mcp/server.ts',
147
+ 'src/mcp/tools.ts',
148
+ 'src/mcp/transports/stdio.ts',
149
+ 'src/mcp/transports/http.ts',
150
+ 'src/mcp/session-manager.ts',
151
+ 'src/mcp/auth.ts',
152
+ 'src/mcp/load-balancer.ts',
153
+ ];
154
+
155
+ for (const file of requiredFiles) {
156
+ try {
157
+ await Deno.stat(file);
158
+ console.log(`āœ… ${file}`);
159
+ } catch {
160
+ console.error(`āŒ Missing required file: ${file}`);
161
+ Deno.exit(1);
162
+ }
163
+ }
164
+
165
+ console.log();
166
+ }
167
+
168
+ function printUsage(): void {
169
+ console.log(`
170
+ MCP Test Runner
171
+
172
+ Usage: deno run --allow-all scripts/test-mcp.ts [options]
173
+
174
+ Options:
175
+ --unit Run unit tests (default: true if no other type specified)
176
+ --integration Run integration tests
177
+ --all Run all tests (unit + integration)
178
+ --coverage Generate coverage report
179
+ --watch Watch files and re-run tests on changes
180
+ --filter <term> Filter test files by name
181
+ --verbose Verbose test output
182
+ --help, -h Show this help message
183
+
184
+ Examples:
185
+ deno run --allow-all scripts/test-mcp.ts
186
+ deno run --allow-all scripts/test-mcp.ts --all --coverage
187
+ deno run --allow-all scripts/test-mcp.ts --integration
188
+ deno run --allow-all scripts/test-mcp.ts --filter server
189
+ deno run --allow-all scripts/test-mcp.ts --watch --verbose
190
+ `);
191
+ }
192
+
193
+ async function main(): Promise<void> {
194
+ const args = parseArgs(Deno.args, {
195
+ boolean: [
196
+ 'unit',
197
+ 'integration',
198
+ 'all',
199
+ 'coverage',
200
+ 'watch',
201
+ 'verbose',
202
+ 'help',
203
+ 'h',
204
+ ],
205
+ string: [
206
+ 'filter',
207
+ ],
208
+ alias: {
209
+ h: 'help',
210
+ },
211
+ });
212
+
213
+ if (args.help || args.h) {
214
+ printUsage();
215
+ return;
216
+ }
217
+
218
+ await validateEnvironment();
219
+
220
+ const config: TestConfig = {
221
+ unit: args.unit || args.all || (!args.integration && !args.all),
222
+ integration: args.integration || args.all,
223
+ coverage: args.coverage,
224
+ watch: args.watch,
225
+ filter: args.filter,
226
+ verbose: args.verbose,
227
+ };
228
+
229
+ console.log('āš™ļø Test Configuration:');
230
+ console.log(` Unit tests: ${config.unit}`);
231
+ console.log(` Integration tests: ${config.integration}`);
232
+ console.log(` Coverage: ${config.coverage}`);
233
+ console.log(` Watch mode: ${config.watch}`);
234
+ console.log(` Filter: ${config.filter || 'none'}`);
235
+ console.log(` Verbose: ${config.verbose}`);
236
+ console.log();
237
+
238
+ await runTests(config);
239
+ }
240
+
241
+ // Performance monitoring
242
+ const startTime = performance.now();
243
+
244
+ process.on?.('exit', () => {
245
+ const duration = performance.now() - startTime;
246
+ console.log(`\nā±ļø Total execution time: ${(duration / 1000).toFixed(2)}s`);
247
+ });
248
+
249
+ if (import.meta.main) {
250
+ await main();
251
+ }