claude-flow 1.0.0 → 1.0.2
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/README.md +9 -19
- package/bin/claude-flow +0 -0
- package/package.json +4 -4
- package/src/cli/cli-core.ts +1 -1
- package/bin/claude-flow-simple +0 -0
- package/bin/claude-flow-typecheck +0 -0
- package/scripts/check-links.ts +0 -274
- package/scripts/check-performance-regression.ts +0 -168
- package/scripts/claude-sparc.sh +0 -562
- package/scripts/coverage-report.ts +0 -692
- package/scripts/demo-task-system.ts +0 -224
- package/scripts/test-batch-tasks.ts +0 -29
- package/scripts/test-coordination-features.ts +0 -238
- package/scripts/test-mcp.ts +0 -251
- package/scripts/test-runner.ts +0 -571
- package/scripts/validate-examples.ts +0 -288
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env deno run --allow-read
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Example Configuration Validator
|
|
5
|
-
* Validates all example configuration files for correctness
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { walk } from "https://deno.land/std@0.220.0/fs/mod.ts";
|
|
9
|
-
|
|
10
|
-
interface ValidationResult {
|
|
11
|
-
file: string;
|
|
12
|
-
valid: boolean;
|
|
13
|
-
errors: string[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface ConfigSchema {
|
|
17
|
-
[key: string]: {
|
|
18
|
-
type: string;
|
|
19
|
-
required?: boolean;
|
|
20
|
-
properties?: ConfigSchema;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const CLAUDE_FLOW_CONFIG_SCHEMA: ConfigSchema = {
|
|
25
|
-
orchestrator: {
|
|
26
|
-
type: 'object',
|
|
27
|
-
required: true,
|
|
28
|
-
properties: {
|
|
29
|
-
maxConcurrentAgents: { type: 'number' },
|
|
30
|
-
taskQueueSize: { type: 'number' },
|
|
31
|
-
healthCheckInterval: { type: 'number' },
|
|
32
|
-
shutdownTimeout: { type: 'number' },
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
terminal: {
|
|
36
|
-
type: 'object',
|
|
37
|
-
properties: {
|
|
38
|
-
type: { type: 'string' },
|
|
39
|
-
poolSize: { type: 'number' },
|
|
40
|
-
recycleAfter: { type: 'number' },
|
|
41
|
-
healthCheckInterval: { type: 'number' },
|
|
42
|
-
commandTimeout: { type: 'number' },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
memory: {
|
|
46
|
-
type: 'object',
|
|
47
|
-
properties: {
|
|
48
|
-
backend: { type: 'string' },
|
|
49
|
-
cacheSizeMB: { type: 'number' },
|
|
50
|
-
syncInterval: { type: 'number' },
|
|
51
|
-
conflictResolution: { type: 'string' },
|
|
52
|
-
retentionDays: { type: 'number' },
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
coordination: {
|
|
56
|
-
type: 'object',
|
|
57
|
-
properties: {
|
|
58
|
-
maxRetries: { type: 'number' },
|
|
59
|
-
retryDelay: { type: 'number' },
|
|
60
|
-
deadlockDetection: { type: 'boolean' },
|
|
61
|
-
resourceTimeout: { type: 'number' },
|
|
62
|
-
messageTimeout: { type: 'number' },
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
mcp: {
|
|
66
|
-
type: 'object',
|
|
67
|
-
properties: {
|
|
68
|
-
transport: { type: 'string' },
|
|
69
|
-
port: { type: 'number' },
|
|
70
|
-
tlsEnabled: { type: 'boolean' },
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
logging: {
|
|
74
|
-
type: 'object',
|
|
75
|
-
properties: {
|
|
76
|
-
level: { type: 'string' },
|
|
77
|
-
format: { type: 'string' },
|
|
78
|
-
destination: { type: 'string' },
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const WORKFLOW_SCHEMA: ConfigSchema = {
|
|
84
|
-
name: { type: 'string', required: true },
|
|
85
|
-
description: { type: 'string' },
|
|
86
|
-
tasks: {
|
|
87
|
-
type: 'array',
|
|
88
|
-
required: true,
|
|
89
|
-
properties: {
|
|
90
|
-
id: { type: 'string', required: true },
|
|
91
|
-
type: { type: 'string', required: true },
|
|
92
|
-
description: { type: 'string', required: true },
|
|
93
|
-
dependencies: { type: 'array' },
|
|
94
|
-
assignTo: { type: 'string' },
|
|
95
|
-
priority: { type: 'string' },
|
|
96
|
-
timeout: { type: 'number' },
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
function validateType(value: any, expectedType: string): boolean {
|
|
102
|
-
switch (expectedType) {
|
|
103
|
-
case 'string':
|
|
104
|
-
return typeof value === 'string';
|
|
105
|
-
case 'number':
|
|
106
|
-
return typeof value === 'number';
|
|
107
|
-
case 'boolean':
|
|
108
|
-
return typeof value === 'boolean';
|
|
109
|
-
case 'array':
|
|
110
|
-
return Array.isArray(value);
|
|
111
|
-
case 'object':
|
|
112
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
113
|
-
default:
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function validateObject(obj: any, schema: ConfigSchema, path = ''): string[] {
|
|
119
|
-
const errors: string[] = [];
|
|
120
|
-
|
|
121
|
-
// Check required fields
|
|
122
|
-
for (const [key, spec] of Object.entries(schema)) {
|
|
123
|
-
if (spec.required && !(key in obj)) {
|
|
124
|
-
errors.push(`${path}${key} is required but missing`);
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (key in obj) {
|
|
129
|
-
const value = obj[key];
|
|
130
|
-
const currentPath = path ? `${path}${key}.` : `${key}.`;
|
|
131
|
-
|
|
132
|
-
if (!validateType(value, spec.type)) {
|
|
133
|
-
errors.push(`${path}${key} should be of type ${spec.type}, got ${typeof value}`);
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Validate nested objects
|
|
138
|
-
if (spec.type === 'object' && spec.properties) {
|
|
139
|
-
errors.push(...validateObject(value, spec.properties, currentPath));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Validate array items
|
|
143
|
-
if (spec.type === 'array' && spec.properties && Array.isArray(value)) {
|
|
144
|
-
value.forEach((item, index) => {
|
|
145
|
-
if (typeof item === 'object') {
|
|
146
|
-
errors.push(...validateObject(item, spec.properties!, `${currentPath}[${index}].`));
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return errors;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function validateClaudeFlowConfig(config: any): string[] {
|
|
157
|
-
return validateObject(config, CLAUDE_FLOW_CONFIG_SCHEMA);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function validateWorkflow(workflow: any): string[] {
|
|
161
|
-
const errors = validateObject(workflow, WORKFLOW_SCHEMA);
|
|
162
|
-
|
|
163
|
-
// Additional workflow-specific validations
|
|
164
|
-
if (workflow.tasks && Array.isArray(workflow.tasks)) {
|
|
165
|
-
const taskIds = new Set<string>();
|
|
166
|
-
|
|
167
|
-
for (const [index, task] of workflow.tasks.entries()) {
|
|
168
|
-
// Check for duplicate task IDs
|
|
169
|
-
if (taskIds.has(task.id)) {
|
|
170
|
-
errors.push(`Duplicate task ID "${task.id}" found at index ${index}`);
|
|
171
|
-
} else {
|
|
172
|
-
taskIds.add(task.id);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Validate dependencies reference existing tasks
|
|
176
|
-
if (task.dependencies && Array.isArray(task.dependencies)) {
|
|
177
|
-
for (const dep of task.dependencies) {
|
|
178
|
-
if (!taskIds.has(dep) && !workflow.tasks.slice(0, index).some((t: any) => t.id === dep)) {
|
|
179
|
-
errors.push(`Task "${task.id}" depends on non-existent task "${dep}"`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Validate priority values
|
|
185
|
-
if (task.priority && !['low', 'medium', 'high', 'critical'].includes(task.priority)) {
|
|
186
|
-
errors.push(`Task "${task.id}" has invalid priority "${task.priority}"`);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Validate timeout is positive
|
|
190
|
-
if (task.timeout && task.timeout <= 0) {
|
|
191
|
-
errors.push(`Task "${task.id}" has invalid timeout ${task.timeout}`);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return errors;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async function validateFile(filePath: string): Promise<ValidationResult> {
|
|
200
|
-
const result: ValidationResult = {
|
|
201
|
-
file: filePath,
|
|
202
|
-
valid: false,
|
|
203
|
-
errors: [],
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
try {
|
|
207
|
-
const content = await Deno.readTextFile(filePath);
|
|
208
|
-
const config = JSON.parse(content);
|
|
209
|
-
|
|
210
|
-
// Determine validation type based on file name/content
|
|
211
|
-
if (filePath.includes('workflow') || config.tasks) {
|
|
212
|
-
result.errors = validateWorkflow(config);
|
|
213
|
-
} else if (filePath.includes('config') || config.orchestrator) {
|
|
214
|
-
result.errors = validateClaudeFlowConfig(config);
|
|
215
|
-
} else {
|
|
216
|
-
result.errors.push('Unknown configuration file type');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
result.valid = result.errors.length === 0;
|
|
220
|
-
} catch (error) {
|
|
221
|
-
if (error instanceof SyntaxError) {
|
|
222
|
-
result.errors.push(`Invalid JSON: ${error.message}`);
|
|
223
|
-
} else {
|
|
224
|
-
result.errors.push(`Failed to read file: ${error.message}`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async function main(): Promise<void> {
|
|
232
|
-
console.log('Validating example configurations...\n');
|
|
233
|
-
|
|
234
|
-
const results: ValidationResult[] = [];
|
|
235
|
-
|
|
236
|
-
// Find all JSON files in examples directory
|
|
237
|
-
for await (const entry of walk('./examples', { exts: ['.json'] })) {
|
|
238
|
-
if (entry.isFile) {
|
|
239
|
-
const result = await validateFile(entry.path);
|
|
240
|
-
results.push(result);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Also check any config files in the root
|
|
245
|
-
const rootConfigFiles = ['claude-flow.config.json', 'config.json'];
|
|
246
|
-
for (const filename of rootConfigFiles) {
|
|
247
|
-
try {
|
|
248
|
-
await Deno.stat(filename);
|
|
249
|
-
const result = await validateFile(filename);
|
|
250
|
-
results.push(result);
|
|
251
|
-
} catch {
|
|
252
|
-
// File doesn't exist, skip
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (results.length === 0) {
|
|
257
|
-
console.log('No configuration files found to validate.');
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Report results
|
|
262
|
-
let hasErrors = false;
|
|
263
|
-
|
|
264
|
-
for (const result of results) {
|
|
265
|
-
if (result.valid) {
|
|
266
|
-
console.log(`✅ ${result.file}: Valid`);
|
|
267
|
-
} else {
|
|
268
|
-
console.log(`❌ ${result.file}: Invalid`);
|
|
269
|
-
for (const error of result.errors) {
|
|
270
|
-
console.log(` - ${error}`);
|
|
271
|
-
}
|
|
272
|
-
hasErrors = true;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
console.log(`\nValidated ${results.length} configuration files.`);
|
|
277
|
-
|
|
278
|
-
if (hasErrors) {
|
|
279
|
-
console.error('❌ Some configuration files have errors!');
|
|
280
|
-
Deno.exit(1);
|
|
281
|
-
} else {
|
|
282
|
-
console.log('✅ All configuration files are valid!');
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (import.meta.main) {
|
|
287
|
-
await main();
|
|
288
|
-
}
|