claude-flow-novice 2.2.4 ā 2.2.5
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/package.json +9 -8
- package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/.claude-flow/metrics/performance.json +9 -0
- package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
- package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
- package/scripts/CLEANUP_QUICK_START.md +268 -0
- package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
- package/scripts/README.md +339 -0
- package/scripts/ace-query.sh +384 -0
- package/scripts/agent-token-analysis.js +430 -0
- package/scripts/auto-setup.js +332 -0
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/build/validate-agents.js +238 -0
- package/scripts/build-index.js +43 -0
- package/scripts/build-orchestrator.js +320 -0
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/ci-validation.js +375 -0
- package/scripts/cleanup-blocking-coordination.sh +420 -0
- package/scripts/cleanup-idle-sessions.sh +59 -0
- package/scripts/collect-build-metrics.js +65 -0
- package/scripts/demo/README.md +79 -0
- package/scripts/demo/autoscaling-demo-simplified.js +963 -0
- package/scripts/demo/comprehensive-dashboard-test.js +693 -0
- package/scripts/demo/confidence-log.js +87 -0
- package/scripts/demo/confidence-report.js +82 -0
- package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
- package/scripts/demo/demo-production-deployment.js +399 -0
- package/scripts/demo/demo-visualization-system.js +149 -0
- package/scripts/demo/performance-analysis.cjs +71 -0
- package/scripts/demo/performance-analysis.js +71 -0
- package/scripts/demo/test-autoscaling-demo.js +314 -0
- package/scripts/dependency-optimizer.js +349 -0
- package/scripts/dependency-security-assessment.js +331 -0
- package/scripts/deploy-sdk.sh +176 -0
- package/scripts/deployment-readiness-report.json +179 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/ecosystem.config.cjs +90 -0
- package/scripts/fix-js-extensions.js +167 -0
- package/scripts/generate-basic-types.js +73 -0
- package/scripts/generate-changelog.js +318 -0
- package/scripts/git-hooks/pre-commit.sh +143 -0
- package/scripts/health-checks.js +634 -0
- package/scripts/hook-wrapper.sh +54 -0
- package/scripts/install/README.md +375 -0
- package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
- package/scripts/install/check-prerequisites.js +303 -0
- package/scripts/install/config-wizard.js +606 -0
- package/scripts/install/dependency-checker.js +385 -0
- package/scripts/install/health-check.js +765 -0
- package/scripts/install/install.js +256 -0
- package/scripts/install/installation-benchmark.js +461 -0
- package/scripts/install/quick-install.js +720 -0
- package/scripts/install/quick-start-wizard.js +295 -0
- package/scripts/install/redis-cli.js +289 -0
- package/scripts/install/redis-install-guides.md +407 -0
- package/scripts/install/redis-setup.js +559 -0
- package/scripts/install/redis-test.js +278 -0
- package/scripts/install/service-manager.js +672 -0
- package/scripts/install/setup.js +832 -0
- package/scripts/install/uninstall.js +526 -0
- package/scripts/install/update.js +461 -0
- package/scripts/install-pre-commit-hook.sh +127 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/memory-monitor-coordinator.js +322 -0
- package/scripts/migrate-to-sdk.sh +520 -0
- package/scripts/migration/QUICK-START.md +189 -0
- package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
- package/scripts/migration/README.md +464 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
- package/scripts/migration/UPDATE-PATHS-README.md +464 -0
- package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
- package/scripts/migration/example-patterns.json +19 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/migration/reorganize-workspace.js +504 -0
- package/scripts/migration/test-update-paths.js +359 -0
- package/scripts/migration/update-paths.js +664 -0
- package/scripts/migration/validate-migration.js +647 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor-migration.js +339 -0
- package/scripts/monitor.py +43 -0
- package/scripts/monitoring/README.md +178 -0
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/analyze-resources.sh +199 -0
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/dynamic-monitor.sh +85 -0
- package/scripts/monitoring/launch-stability-test.sh +184 -0
- package/scripts/monitoring/monitor-test.sh +93 -0
- package/scripts/monitoring/pre-test-validation.sh +208 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
- package/scripts/monitoring/resource-monitor.sh +126 -0
- package/scripts/monitoring/stability-monitor.js +429 -0
- package/scripts/monitoring/test-monitor-quick.sh +54 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/npm-metrics-collector.js +482 -0
- package/scripts/npm-package-validation.cjs +299 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/optimize-package-swarm.js +54 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-monitor.js +644 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/post-deployment-monitoring.js +350 -0
- package/scripts/post-edit-pipeline.js +2091 -0
- package/scripts/post-install-claude-md.js +78 -0
- package/scripts/postinstall.js +79 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/pre-publish-validation.js +429 -0
- package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
- package/scripts/release-announcement.js +425 -0
- package/scripts/release-notification.js +248 -0
- package/scripts/release-rollback.js +376 -0
- package/scripts/release-validation.js +460 -0
- package/scripts/rollback-sdk.sh +66 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/run-stability-validation.sh +687 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/deployment-validation.cjs +279 -0
- package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/install-git-secrets.sh +295 -0
- package/scripts/security/rotate-api-keys.js +469 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/security/security-audit.cjs +538 -0
- package/scripts/security/setup-redis-auth.sh +397 -0
- package/scripts/security/validate-envelope-encryption.cjs +340 -0
- package/scripts/security-scan.js +492 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/switch-api.sh +158 -0
- package/scripts/sync-agents.js +290 -0
- package/scripts/test/50-agent-test.js +625 -0
- package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
- package/scripts/test/STABILITY_TEST_README.md +480 -0
- package/scripts/test/agent-worker.js +309 -0
- package/scripts/test/ai-coordination-test.js +650 -0
- package/scripts/test/ai-mesh-coordination-test.js +416 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/cli-agent-coordination-test.js +313 -0
- package/scripts/test/coordinator-multilingual-test.js +396 -0
- package/scripts/test/coordinator-transparency-demo.js +585 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/mesh-coordination-zero-overlap-test.js +740 -0
- package/scripts/test/multilingual-hello-world-test.js +390 -0
- package/scripts/test/quick-multilingual-demo.js +464 -0
- package/scripts/test/real-agent-test.js +312 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/run-stability-test-examples.sh +292 -0
- package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
- package/scripts/test/stability-results/stability-test-report.json +128 -0
- package/scripts/test/stability-results/stability-test.log +1827 -0
- package/scripts/test/stability-test-50-agents.js +734 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/test-cleanup-performance.sh +416 -0
- package/scripts/test-dashboard-auth.cjs +203 -0
- package/scripts/test-docker-deployment.sh +207 -0
- package/scripts/test-npm-package.cjs +167 -0
- package/scripts/test-provider-routing.cjs +226 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-runner.cjs +154 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/validate-agent-hooks.js +506 -0
- package/scripts/validate-changelog.js +241 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/scripts/validate-docker-infrastructure.sh +502 -0
- package/scripts/validate-entry-points.js +300 -0
- package/scripts/validate-stage3-performance.ts +377 -0
- package/scripts/validate-template-bundling.js +180 -0
- package/scripts/validation/README.md +33 -0
- package/scripts/validation/acl-security-validation.cjs +214 -0
- package/scripts/validation/acl-security-validation.js +402 -0
- package/scripts/validation/byzantine-verification.js +407 -0
- package/scripts/validation/final-phase-2-consensus.cjs +219 -0
- package/scripts/validation/final-security-validation.js +791 -0
- package/scripts/validation/final-wasm-validation.cjs +840 -0
- package/scripts/validation/integration-test-analysis.js +105 -0
- package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
- package/scripts/validation/phase-0-consensus-report.js +139 -0
- package/scripts/validation/phase-0-final-report.js +112 -0
- package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
- package/scripts/validation/phase-0-validation-improved.js +490 -0
- package/scripts/validation/phase-0-validation-test.js +65 -0
- package/scripts/validation/phase-1-consensus-report.cjs +342 -0
- package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
- package/scripts/validation/phase-1-consensus-validation.js +551 -0
- package/scripts/validation/phase-2-consensus-report.cjs +186 -0
- package/scripts/validation/phase-2-validation.cjs +171 -0
- package/scripts/validation/phase-2-validation.js +171 -0
- package/scripts/validation/phase-4-consensus-report.js +181 -0
- package/scripts/validation/phase-4-final-validation.js +351 -0
- package/scripts/validation/phase-5-consensus-report.cjs +113 -0
- package/scripts/validation/phase-5-consensus-report.js +113 -0
- package/scripts/validation/security-analysis.js +49 -0
- package/scripts/validation/security-validation.js +492 -0
- package/scripts/validation/simple-security-validation.js +464 -0
- package/scripts/verify-installation.js +112 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/scripts/verify-sdk-phase1.cjs +293 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env deno run --allow-read --allow-write
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Performance Regression Checker
|
|
5
|
+
* Compares current performance metrics against baseline
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface PerformanceMetric {
|
|
9
|
+
name: string;
|
|
10
|
+
value: number;
|
|
11
|
+
unit: string;
|
|
12
|
+
threshold: number; // Maximum allowed regression percentage
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface PerformanceReport {
|
|
16
|
+
timestamp: string;
|
|
17
|
+
gitHash: string;
|
|
18
|
+
metrics: PerformanceMetric[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const BASELINE_FILE = 'performance-baseline.json';
|
|
22
|
+
const CURRENT_RESULTS_FILE = 'performance-results.json';
|
|
23
|
+
const REGRESSION_THRESHOLD = 20; // 20% regression threshold
|
|
24
|
+
|
|
25
|
+
async function loadBaseline(): Promise<PerformanceReport | null> {
|
|
26
|
+
try {
|
|
27
|
+
const baselineData = await Deno.readTextFile(BASELINE_FILE);
|
|
28
|
+
return JSON.parse(baselineData);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error instanceof Deno.errors.NotFound) {
|
|
31
|
+
console.log('No baseline found, creating initial baseline...');
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function loadCurrentResults(): Promise<PerformanceReport> {
|
|
39
|
+
try {
|
|
40
|
+
const currentData = await Deno.readTextFile(CURRENT_RESULTS_FILE);
|
|
41
|
+
return JSON.parse(currentData);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Failed to load current performance results:', error.message);
|
|
44
|
+
Deno.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function saveBaseline(report: PerformanceReport): Promise<void> {
|
|
49
|
+
await Deno.writeTextFile(BASELINE_FILE, JSON.stringify(report, null, 2));
|
|
50
|
+
console.log('Baseline updated successfully');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function calculateRegression(baseline: number, current: number): number {
|
|
54
|
+
return ((current - baseline) / baseline) * 100;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function checkRegressions(baseline: PerformanceReport, current: PerformanceReport): {
|
|
58
|
+
regressions: Array<{ metric: string; regression: number; threshold: number }>;
|
|
59
|
+
hasRegressions: boolean;
|
|
60
|
+
} {
|
|
61
|
+
const regressions: Array<{ metric: string; regression: number; threshold: number }> = [];
|
|
62
|
+
|
|
63
|
+
for (const currentMetric of current.metrics) {
|
|
64
|
+
const baselineMetric = baseline.metrics.find(m => m.name === currentMetric.name);
|
|
65
|
+
|
|
66
|
+
if (!baselineMetric) {
|
|
67
|
+
console.log(`New metric detected: ${currentMetric.name}`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const regression = calculateRegression(baselineMetric.value, currentMetric.value);
|
|
72
|
+
const threshold = currentMetric.threshold || REGRESSION_THRESHOLD;
|
|
73
|
+
|
|
74
|
+
if (regression > threshold) {
|
|
75
|
+
regressions.push({
|
|
76
|
+
metric: currentMetric.name,
|
|
77
|
+
regression,
|
|
78
|
+
threshold,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
regressions,
|
|
85
|
+
hasRegressions: regressions.length > 0,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function generateReport(
|
|
90
|
+
baseline: PerformanceReport,
|
|
91
|
+
current: PerformanceReport,
|
|
92
|
+
regressions: Array<{ metric: string; regression: number; threshold: number }>
|
|
93
|
+
): void {
|
|
94
|
+
console.log('\n=== Performance Regression Report ===\n');
|
|
95
|
+
|
|
96
|
+
console.log(`Baseline: ${baseline.timestamp} (${baseline.gitHash})`);
|
|
97
|
+
console.log(`Current: ${current.timestamp} (${current.gitHash})\n`);
|
|
98
|
+
|
|
99
|
+
if (regressions.length === 0) {
|
|
100
|
+
console.log('ā
No performance regressions detected!\n');
|
|
101
|
+
} else {
|
|
102
|
+
console.log('ā Performance regressions detected:\n');
|
|
103
|
+
|
|
104
|
+
for (const regression of regressions) {
|
|
105
|
+
const baselineMetric = baseline.metrics.find(m => m.name === regression.metric)!;
|
|
106
|
+
const currentMetric = current.metrics.find(m => m.name === regression.metric)!;
|
|
107
|
+
|
|
108
|
+
console.log(` ${regression.metric}:`);
|
|
109
|
+
console.log(` Baseline: ${baselineMetric.value} ${baselineMetric.unit}`);
|
|
110
|
+
console.log(` Current: ${currentMetric.value} ${currentMetric.unit}`);
|
|
111
|
+
console.log(` Regression: ${regression.regression.toFixed(2)}% (threshold: ${regression.threshold}%)`);
|
|
112
|
+
console.log('');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Show all metrics for reference
|
|
117
|
+
console.log('š All Performance Metrics:\n');
|
|
118
|
+
|
|
119
|
+
for (const currentMetric of current.metrics) {
|
|
120
|
+
const baselineMetric = baseline.metrics.find(m => m.name === currentMetric.name);
|
|
121
|
+
|
|
122
|
+
if (baselineMetric) {
|
|
123
|
+
const regression = calculateRegression(baselineMetric.value, currentMetric.value);
|
|
124
|
+
const status = regression > (currentMetric.threshold || REGRESSION_THRESHOLD) ? 'ā' : 'ā
';
|
|
125
|
+
|
|
126
|
+
console.log(` ${status} ${currentMetric.name}: ${currentMetric.value} ${currentMetric.unit} (${regression > 0 ? '+' : ''}${regression.toFixed(2)}%)`);
|
|
127
|
+
} else {
|
|
128
|
+
console.log(` š ${currentMetric.name}: ${currentMetric.value} ${currentMetric.unit} (new metric)`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function main(): Promise<void> {
|
|
136
|
+
console.log('Checking for performance regressions...\n');
|
|
137
|
+
|
|
138
|
+
const baseline = await loadBaseline();
|
|
139
|
+
const current = await loadCurrentResults();
|
|
140
|
+
|
|
141
|
+
if (!baseline) {
|
|
142
|
+
console.log('No baseline found, establishing current results as baseline...');
|
|
143
|
+
await saveBaseline(current);
|
|
144
|
+
console.log('Baseline established successfully');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const { regressions, hasRegressions } = checkRegressions(baseline, current);
|
|
149
|
+
|
|
150
|
+
generateReport(baseline, current, regressions);
|
|
151
|
+
|
|
152
|
+
if (hasRegressions) {
|
|
153
|
+
console.error('Performance regressions detected! Please investigate and fix before merging.');
|
|
154
|
+
Deno.exit(1);
|
|
155
|
+
} else {
|
|
156
|
+
console.log('Performance check passed! š');
|
|
157
|
+
|
|
158
|
+
// Update baseline if this is a main branch build
|
|
159
|
+
const branch = Deno.env.get('GITHUB_REF');
|
|
160
|
+
if (branch === 'refs/heads/main') {
|
|
161
|
+
await saveBaseline(current);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (import.meta.main) {
|
|
167
|
+
await main();
|
|
168
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CLI Agent Coordination Test
|
|
5
|
+
*
|
|
6
|
+
* This test demonstrates spawning real Claude Code agents using the CLI
|
|
7
|
+
* and testing their coordination capabilities through slash commands
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
|
+
import fs from 'fs/promises';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
|
|
18
|
+
class CLIAgentCoordinationTest {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.outputDir = './cli-agent-results';
|
|
21
|
+
this.testStartTime = Date.now();
|
|
22
|
+
this.agentProcesses = new Map();
|
|
23
|
+
this.coordinationResults = [];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async start() {
|
|
27
|
+
console.log('š Starting CLI Agent Coordination Test');
|
|
28
|
+
console.log(' This test spawns REAL Claude Code agents using slash commands\n');
|
|
29
|
+
|
|
30
|
+
await fs.mkdir(this.outputDir, { recursive: true });
|
|
31
|
+
|
|
32
|
+
// Step 1: Initialize swarm
|
|
33
|
+
await this.initializeSwarm();
|
|
34
|
+
|
|
35
|
+
// Step 2: Spawn agents using slash commands
|
|
36
|
+
await this.spawnAgentsWithSlashCommands();
|
|
37
|
+
|
|
38
|
+
// Step 3: Test coordination
|
|
39
|
+
await this.testAgentCoordination();
|
|
40
|
+
|
|
41
|
+
// Step 4: Generate report
|
|
42
|
+
await this.generateReport();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async initializeSwarm() {
|
|
46
|
+
console.log('š Step 1: Initializing swarm...');
|
|
47
|
+
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
const swarmInit = spawn('claude-flow-novice', ['swarm', 'init', 'mesh', '5', 'balanced'], {
|
|
50
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
51
|
+
cwd: __dirname
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
let output = '';
|
|
55
|
+
|
|
56
|
+
swarmInit.stdout.on('data', (data) => {
|
|
57
|
+
const text = data.toString();
|
|
58
|
+
output += text;
|
|
59
|
+
console.log(text.trim());
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
swarmInit.stderr.on('data', (data) => {
|
|
63
|
+
console.error('ERROR:', data.toString().trim());
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
swarmInit.on('close', (code) => {
|
|
67
|
+
console.log(`ā
Swarm initialization completed with code: ${code}\n`);
|
|
68
|
+
resolve();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Timeout after 10 seconds
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
swarmInit.kill();
|
|
74
|
+
resolve();
|
|
75
|
+
}, 10000);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async spawnAgentsWithSlashCommands() {
|
|
80
|
+
console.log('š¤ Step 2: Spawning agents with slash commands...');
|
|
81
|
+
|
|
82
|
+
const agentTypes = [
|
|
83
|
+
{ type: 'coder', name: 'Code Agent 1' },
|
|
84
|
+
{ type: 'tester', name: 'Test Agent 1' },
|
|
85
|
+
{ type: 'reviewer', name: 'Review Agent 1' },
|
|
86
|
+
{ type: 'analyst', name: 'Analysis Agent 1' },
|
|
87
|
+
{ type: 'researcher', name: 'Research Agent 1' }
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
for (const agent of agentTypes) {
|
|
91
|
+
console.log(` Spawning ${agent.type}: ${agent.name}`);
|
|
92
|
+
|
|
93
|
+
await this.spawnAgent(agent);
|
|
94
|
+
|
|
95
|
+
// Small delay between spawns
|
|
96
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
console.log(`ā
Spawned ${agentTypes.length} agents\n`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async spawnAgent(agentConfig) {
|
|
103
|
+
return new Promise((resolve) => {
|
|
104
|
+
const agentProcess = spawn('claude-flow-novice', ['swarm', 'spawn', agentConfig.type, agentConfig.name], {
|
|
105
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
106
|
+
cwd: __dirname
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const agentId = `${agentConfig.type}-${Date.now()}`;
|
|
110
|
+
let output = '';
|
|
111
|
+
|
|
112
|
+
agentProcess.stdout.on('data', (data) => {
|
|
113
|
+
const text = data.toString();
|
|
114
|
+
output += text;
|
|
115
|
+
console.log(` [${agentId}] ${text.trim()}`);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
agentProcess.stderr.on('data', (data) => {
|
|
119
|
+
console.error(` [${agentId}] ERROR: ${data.toString().trim()}`);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
agentProcess.on('close', (code) => {
|
|
123
|
+
this.agentProcesses.set(agentId, {
|
|
124
|
+
config: agentConfig,
|
|
125
|
+
output: output,
|
|
126
|
+
exitCode: code,
|
|
127
|
+
spawned: Date.now()
|
|
128
|
+
});
|
|
129
|
+
resolve();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Timeout after 15 seconds
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
agentProcess.kill();
|
|
135
|
+
resolve();
|
|
136
|
+
}, 15000);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async testAgentCoordination() {
|
|
141
|
+
console.log('š” Step 3: Testing agent coordination...');
|
|
142
|
+
|
|
143
|
+
// Test swarm status
|
|
144
|
+
await this.checkSwarmStatus();
|
|
145
|
+
|
|
146
|
+
// Test orchestration
|
|
147
|
+
await this.testTaskOrchestration();
|
|
148
|
+
|
|
149
|
+
console.log('ā
Coordination testing completed\n');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async checkSwarmStatus() {
|
|
153
|
+
console.log(' Checking swarm status...');
|
|
154
|
+
|
|
155
|
+
return new Promise((resolve) => {
|
|
156
|
+
const statusCheck = spawn('claude-flow-novice', ['swarm', 'status', 'true'], {
|
|
157
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
158
|
+
cwd: __dirname
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
let output = '';
|
|
162
|
+
|
|
163
|
+
statusCheck.stdout.on('data', (data) => {
|
|
164
|
+
const text = data.toString();
|
|
165
|
+
output += text;
|
|
166
|
+
console.log(` ${text.trim()}`);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
statusCheck.stderr.on('data', (data) => {
|
|
170
|
+
console.error(` ERROR: ${data.toString().trim()}`);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
statusCheck.on('close', (code) => {
|
|
174
|
+
this.coordinationResults.push({
|
|
175
|
+
test: 'swarm-status',
|
|
176
|
+
success: code === 0,
|
|
177
|
+
output: output,
|
|
178
|
+
timestamp: Date.now()
|
|
179
|
+
});
|
|
180
|
+
resolve();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
setTimeout(() => {
|
|
184
|
+
statusCheck.kill();
|
|
185
|
+
resolve();
|
|
186
|
+
}, 10000);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async testTaskOrchestration() {
|
|
191
|
+
console.log(' Testing task orchestration...');
|
|
192
|
+
|
|
193
|
+
const testTask = 'Create a simple coordination test between agents';
|
|
194
|
+
|
|
195
|
+
return new Promise((resolve) => {
|
|
196
|
+
const orchestration = spawn('claude-flow-novice', ['swarm', 'orchestrate', testTask], {
|
|
197
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
198
|
+
cwd: __dirname
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
let output = '';
|
|
202
|
+
|
|
203
|
+
orchestration.stdout.on('data', (data) => {
|
|
204
|
+
const text = data.toString();
|
|
205
|
+
output += text;
|
|
206
|
+
console.log(` ${text.trim()}`);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
orchestration.stderr.on('data', (data) => {
|
|
210
|
+
console.error(` ERROR: ${data.toString().trim()}`);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
orchestration.on('close', (code) => {
|
|
214
|
+
this.coordinationResults.push({
|
|
215
|
+
test: 'task-orchestration',
|
|
216
|
+
success: code === 0,
|
|
217
|
+
output: output,
|
|
218
|
+
timestamp: Date.now()
|
|
219
|
+
});
|
|
220
|
+
resolve();
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
setTimeout(() => {
|
|
224
|
+
orchestration.kill();
|
|
225
|
+
resolve();
|
|
226
|
+
}, 15000);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async generateReport() {
|
|
231
|
+
console.log('š Step 4: Generating test report...');
|
|
232
|
+
|
|
233
|
+
const testDuration = Date.now() - this.testStartTime;
|
|
234
|
+
const successfulAgents = Array.from(this.agentProcesses.values()).filter(a => a.exitCode === 0).length;
|
|
235
|
+
const successfulTests = this.coordinationResults.filter(r => r.success).length;
|
|
236
|
+
|
|
237
|
+
const report = {
|
|
238
|
+
test: {
|
|
239
|
+
type: 'cli-agent-coordination-test',
|
|
240
|
+
duration: testDuration,
|
|
241
|
+
startTime: new Date(this.testStartTime).toISOString(),
|
|
242
|
+
endTime: new Date().toISOString()
|
|
243
|
+
},
|
|
244
|
+
agents: {
|
|
245
|
+
total: this.agentProcesses.size,
|
|
246
|
+
successful: successfulAgents,
|
|
247
|
+
successRate: (successfulAgents / this.agentProcesses.size * 100).toFixed(2) + '%'
|
|
248
|
+
},
|
|
249
|
+
coordination: {
|
|
250
|
+
totalTests: this.coordinationResults.length,
|
|
251
|
+
successful: successfulTests,
|
|
252
|
+
successRate: (successfulTests / this.coordinationResults.length * 100).toFixed(2) + '%'
|
|
253
|
+
},
|
|
254
|
+
details: {
|
|
255
|
+
agents: Array.from(this.agentProcesses.entries()).map(([id, agent]) => ({
|
|
256
|
+
id,
|
|
257
|
+
type: agent.config.type,
|
|
258
|
+
name: agent.config.name,
|
|
259
|
+
success: agent.exitCode === 0,
|
|
260
|
+
spawned: new Date(agent.spawned).toISOString()
|
|
261
|
+
})),
|
|
262
|
+
tests: this.coordinationResults
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const reportFile = path.join(this.outputDir, `cli-agent-test-report-${Date.now()}.json`);
|
|
267
|
+
await fs.writeFile(reportFile, JSON.stringify(report, null, 2));
|
|
268
|
+
|
|
269
|
+
console.log('\nš CLI AGENT COORDINATION TEST RESULTS:');
|
|
270
|
+
console.log(` Test Duration: ${(testDuration / 1000).toFixed(2)} seconds`);
|
|
271
|
+
console.log(` Agents Spawned: ${this.agentProcesses.size}`);
|
|
272
|
+
console.log(` Successful Agents: ${successfulAgents} (${report.agents.successRate})`);
|
|
273
|
+
console.log(` Coordination Tests: ${this.coordinationResults.length}`);
|
|
274
|
+
console.log(` Successful Tests: ${successfulTests} (${report.coordination.successRate})`);
|
|
275
|
+
console.log(` Report saved to: ${reportFile}`);
|
|
276
|
+
|
|
277
|
+
console.log('\nšÆ SUMMARY:');
|
|
278
|
+
if (report.agents.successRate === '100.00%' && report.coordination.successRate === '100.00%') {
|
|
279
|
+
console.log(' ā
All tests passed! Real CLI agents are working correctly.');
|
|
280
|
+
} else {
|
|
281
|
+
console.log(' ā ļø Some tests failed. Check the detailed report for more information.');
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// CLI interface
|
|
287
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
288
|
+
if (process.argv.includes('--help')) {
|
|
289
|
+
console.log(`
|
|
290
|
+
CLI Agent Coordination Test
|
|
291
|
+
|
|
292
|
+
Usage: node cli-agent-coordination-test.js
|
|
293
|
+
|
|
294
|
+
This test demonstrates:
|
|
295
|
+
1. Initializing a swarm using CLI commands
|
|
296
|
+
2. Spawning real Claude Code agents
|
|
297
|
+
3. Testing agent coordination and orchestration
|
|
298
|
+
4. Generating a comprehensive test report
|
|
299
|
+
|
|
300
|
+
The agents spawned are REAL Claude Code agent processes, not simulated workers.
|
|
301
|
+
`);
|
|
302
|
+
process.exit(0);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const test = new CLIAgentCoordinationTest();
|
|
306
|
+
|
|
307
|
+
test.start().catch(error => {
|
|
308
|
+
console.error('Test failed:', error);
|
|
309
|
+
process.exit(1);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export default CLIAgentCoordinationTest;
|