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,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create index.js file in build output
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const buildDir = '.claude-flow-novice/dist';
|
|
11
|
+
const indexPath = path.join(buildDir, 'index.js');
|
|
12
|
+
|
|
13
|
+
// Create main index.js file
|
|
14
|
+
const indexContent = `/**
|
|
15
|
+
* Claude Flow Novice - Main Entry Point
|
|
16
|
+
* AI agent orchestration framework for beginners
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// Export main modules
|
|
20
|
+
export { AgentManager } from './src/core/agent-manager.js';
|
|
21
|
+
export { SimpleAgent } from './src/agents/simple-agent.js';
|
|
22
|
+
export { AgentType } from './src/types/agent-types.js';
|
|
23
|
+
export { ProjectManager } from './src/core/project-manager.js';
|
|
24
|
+
|
|
25
|
+
// Export CLI for direct usage
|
|
26
|
+
export { default as cli } from './src/cli/main.js';
|
|
27
|
+
|
|
28
|
+
// Export MCP server
|
|
29
|
+
export { default as mcpServer } from './mcp/mcp-server-sdk.js';
|
|
30
|
+
|
|
31
|
+
// Export core functionality
|
|
32
|
+
export * from './src/core/index.js';
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
// Ensure build directory exists
|
|
36
|
+
if (!fs.existsSync(buildDir)) {
|
|
37
|
+
fs.mkdirSync(buildDir, { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Write index.js
|
|
41
|
+
fs.writeFileSync(indexPath, indexContent);
|
|
42
|
+
|
|
43
|
+
console.log('ā
Created main entry point:', indexPath);
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Build Orchestrator
|
|
4
|
+
*
|
|
5
|
+
* Comprehensive build automation with parallel execution,
|
|
6
|
+
* error recovery, and detailed reporting
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'fs/promises';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { execSync } from 'child_process';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
16
|
+
const rootDir = path.join(__dirname, '..');
|
|
17
|
+
|
|
18
|
+
class BuildOrchestrator {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.startTime = Date.now();
|
|
21
|
+
this.steps = [];
|
|
22
|
+
this.errors = [];
|
|
23
|
+
this.warnings = [];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async execute() {
|
|
27
|
+
console.log('š Build Orchestrator Started');
|
|
28
|
+
console.log('='.repeat(60));
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
await this.validateEnvironment();
|
|
32
|
+
await this.cleanPreviousBuild();
|
|
33
|
+
await this.runParallelChecks();
|
|
34
|
+
await this.compileSources();
|
|
35
|
+
await this.fixImportExtensions();
|
|
36
|
+
await this.generateTypes();
|
|
37
|
+
await this.copyAssets();
|
|
38
|
+
await this.validateBuildOutput();
|
|
39
|
+
await this.generateReport();
|
|
40
|
+
|
|
41
|
+
console.log('\nā
Build completed successfully!');
|
|
42
|
+
return 0;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(`\nā Build failed: ${error.message}`);
|
|
45
|
+
this.errors.push({ step: 'build', error: error.message });
|
|
46
|
+
await this.generateReport();
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async validateEnvironment() {
|
|
52
|
+
this.logStep('Validating environment');
|
|
53
|
+
|
|
54
|
+
const checks = [
|
|
55
|
+
{ name: 'Node.js version', command: 'node --version', minVersion: 20 },
|
|
56
|
+
{ name: 'npm version', command: 'npm --version', minVersion: 9 },
|
|
57
|
+
{ name: 'TypeScript compiler', command: 'npx tsc --version' },
|
|
58
|
+
{ name: 'SWC compiler', command: 'npx swc --version' }
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
for (const check of checks) {
|
|
62
|
+
try {
|
|
63
|
+
const output = execSync(check.command, { encoding: 'utf8', cwd: rootDir });
|
|
64
|
+
|
|
65
|
+
if (check.minVersion) {
|
|
66
|
+
const version = parseInt(output.match(/\d+/)[0]);
|
|
67
|
+
if (version < check.minVersion) {
|
|
68
|
+
throw new Error(`${check.name} version ${version} is below minimum ${check.minVersion}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.logSuccess(`${check.name}: ${output.trim()}`);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
throw new Error(`${check.name} check failed: ${error.message}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async cleanPreviousBuild() {
|
|
80
|
+
this.logStep('Cleaning previous build');
|
|
81
|
+
|
|
82
|
+
const dirsToClean = [
|
|
83
|
+
'.claude-flow-novice/dist',
|
|
84
|
+
'dist',
|
|
85
|
+
'.crdt-data',
|
|
86
|
+
'.demo-crdt-data'
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
for (const dir of dirsToClean) {
|
|
90
|
+
const fullPath = path.join(rootDir, dir);
|
|
91
|
+
try {
|
|
92
|
+
await fs.rm(fullPath, { recursive: true, force: true });
|
|
93
|
+
this.logSuccess(`Removed: ${dir}`);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
this.warnings.push(`Could not remove ${dir}: ${error.message}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async runParallelChecks() {
|
|
101
|
+
this.logStep('Running parallel validation checks');
|
|
102
|
+
|
|
103
|
+
const checks = [
|
|
104
|
+
{ name: 'Security audit', script: 'npm audit --audit-level moderate' },
|
|
105
|
+
{ name: 'Dependency check', script: 'npm outdated || true' }
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
const results = await Promise.allSettled(
|
|
109
|
+
checks.map(check =>
|
|
110
|
+
this.runCommand(check.script)
|
|
111
|
+
.then(() => this.logSuccess(check.name))
|
|
112
|
+
.catch(error => {
|
|
113
|
+
this.warnings.push(`${check.name}: ${error.message}`);
|
|
114
|
+
return null;
|
|
115
|
+
})
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const failed = results.filter(r => r.status === 'rejected').length;
|
|
120
|
+
if (failed > 0) {
|
|
121
|
+
this.warnings.push(`${failed} validation check(s) had warnings`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async compileSources() {
|
|
126
|
+
this.logStep('Compiling TypeScript sources with SWC');
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
const command = 'npm run build:swc';
|
|
130
|
+
await this.runCommand(command);
|
|
131
|
+
this.logSuccess('Source compilation completed');
|
|
132
|
+
} catch (error) {
|
|
133
|
+
throw new Error(`Source compilation failed: ${error.message}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async fixImportExtensions() {
|
|
138
|
+
this.logStep('Fixing import extensions for ES modules');
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const command = 'npm run build:fix-imports';
|
|
142
|
+
await this.runCommand(command);
|
|
143
|
+
this.logSuccess('Import extensions fixed');
|
|
144
|
+
} catch (error) {
|
|
145
|
+
throw new Error(`Import extension fix failed: ${error.message}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async generateTypes() {
|
|
150
|
+
this.logStep('Generating TypeScript type declarations');
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
const command = 'npm run build:types:reliable';
|
|
154
|
+
await this.runCommand(command);
|
|
155
|
+
this.logSuccess('Type declarations generated');
|
|
156
|
+
} catch (error) {
|
|
157
|
+
this.warnings.push(`Type generation: ${error.message}`);
|
|
158
|
+
console.log('ā ļø Using fallback type generation');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async copyAssets() {
|
|
163
|
+
this.logStep('Copying static assets');
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
const command = 'npm run copy:assets';
|
|
167
|
+
await this.runCommand(command);
|
|
168
|
+
this.logSuccess('Assets copied');
|
|
169
|
+
} catch (error) {
|
|
170
|
+
throw new Error(`Asset copying failed: ${error.message}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async validateBuildOutput() {
|
|
175
|
+
this.logStep('Validating build output');
|
|
176
|
+
|
|
177
|
+
const requiredFiles = [
|
|
178
|
+
'.claude-flow-novice/dist/src/index.js',
|
|
179
|
+
'.claude-flow-novice/dist/src/cli/main.js',
|
|
180
|
+
'.claude-flow-novice/dist/src/mcp/mcp-server-sdk.js'
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
for (const file of requiredFiles) {
|
|
184
|
+
const fullPath = path.join(rootDir, file);
|
|
185
|
+
try {
|
|
186
|
+
await fs.access(fullPath);
|
|
187
|
+
this.logSuccess(`Found: ${file}`);
|
|
188
|
+
} catch {
|
|
189
|
+
throw new Error(`Required file missing: ${file}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Check for common build issues
|
|
194
|
+
await this.checkForBuildIssues();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async checkForBuildIssues() {
|
|
198
|
+
const distDir = path.join(rootDir, '.claude-flow-novice/dist');
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
const files = await this.getAllJsFiles(distDir);
|
|
202
|
+
let issueCount = 0;
|
|
203
|
+
|
|
204
|
+
for (const file of files) {
|
|
205
|
+
const content = await fs.readFile(file, 'utf8');
|
|
206
|
+
|
|
207
|
+
// Check for missing .js extensions in imports
|
|
208
|
+
const missingExtensions = content.match(/from\s+['"]\.\.[\/\\][^'"]+(?<!\.js)['"]/g);
|
|
209
|
+
if (missingExtensions && missingExtensions.length > 0) {
|
|
210
|
+
this.warnings.push(`Missing .js extensions in ${path.relative(rootDir, file)}`);
|
|
211
|
+
issueCount++;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Check for source map references
|
|
215
|
+
if (content.includes('//# sourceMappingURL=')) {
|
|
216
|
+
const hasSourceMap = await fs.access(file + '.map').then(() => true).catch(() => false);
|
|
217
|
+
if (!hasSourceMap) {
|
|
218
|
+
this.warnings.push(`Source map missing for ${path.relative(rootDir, file)}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (issueCount === 0) {
|
|
224
|
+
this.logSuccess('Build output validation passed');
|
|
225
|
+
}
|
|
226
|
+
} catch (error) {
|
|
227
|
+
this.warnings.push(`Build validation: ${error.message}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async getAllJsFiles(dir) {
|
|
232
|
+
const files = [];
|
|
233
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
234
|
+
|
|
235
|
+
for (const entry of entries) {
|
|
236
|
+
const fullPath = path.join(dir, entry.name);
|
|
237
|
+
if (entry.isDirectory()) {
|
|
238
|
+
files.push(...await this.getAllJsFiles(fullPath));
|
|
239
|
+
} else if (entry.name.endsWith('.js')) {
|
|
240
|
+
files.push(fullPath);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return files;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
async generateReport() {
|
|
248
|
+
const duration = ((Date.now() - this.startTime) / 1000).toFixed(2);
|
|
249
|
+
|
|
250
|
+
console.log('\n' + '='.repeat(60));
|
|
251
|
+
console.log('š Build Report');
|
|
252
|
+
console.log('='.repeat(60));
|
|
253
|
+
|
|
254
|
+
console.log(`\nā±ļø Build Duration: ${duration}s`);
|
|
255
|
+
console.log(`ā
Completed Steps: ${this.steps.length}`);
|
|
256
|
+
console.log(`ā ļø Warnings: ${this.warnings.length}`);
|
|
257
|
+
console.log(`ā Errors: ${this.errors.length}`);
|
|
258
|
+
|
|
259
|
+
if (this.warnings.length > 0) {
|
|
260
|
+
console.log('\nā ļø Warnings:');
|
|
261
|
+
this.warnings.forEach(warning => console.log(` ⢠${warning}`));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (this.errors.length > 0) {
|
|
265
|
+
console.log('\nā Errors:');
|
|
266
|
+
this.errors.forEach(error => console.log(` ⢠${error.step}: ${error.error}`));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Save report to file
|
|
270
|
+
const report = {
|
|
271
|
+
timestamp: new Date().toISOString(),
|
|
272
|
+
duration: `${duration}s`,
|
|
273
|
+
steps: this.steps,
|
|
274
|
+
warnings: this.warnings,
|
|
275
|
+
errors: this.errors,
|
|
276
|
+
success: this.errors.length === 0
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const reportPath = path.join(rootDir, '.claude-flow-novice/build-report.json');
|
|
280
|
+
await fs.mkdir(path.dirname(reportPath), { recursive: true });
|
|
281
|
+
await fs.writeFile(reportPath, JSON.stringify(report, null, 2));
|
|
282
|
+
console.log(`\nš Report saved: .claude-flow-novice/build-report.json`);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
logStep(message) {
|
|
286
|
+
console.log(`\nš¹ ${message}...`);
|
|
287
|
+
this.steps.push({ step: message, timestamp: Date.now() });
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
logSuccess(message) {
|
|
291
|
+
console.log(` ā
${message}`);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async runCommand(command) {
|
|
295
|
+
return new Promise((resolve, reject) => {
|
|
296
|
+
try {
|
|
297
|
+
const output = execSync(command, {
|
|
298
|
+
encoding: 'utf8',
|
|
299
|
+
cwd: rootDir,
|
|
300
|
+
stdio: 'pipe'
|
|
301
|
+
});
|
|
302
|
+
resolve(output);
|
|
303
|
+
} catch (error) {
|
|
304
|
+
reject(error);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// CLI Interface
|
|
311
|
+
async function main() {
|
|
312
|
+
const orchestrator = new BuildOrchestrator();
|
|
313
|
+
const exitCode = await orchestrator.execute();
|
|
314
|
+
process.exit(exitCode);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
main().catch(error => {
|
|
318
|
+
console.error('ā Fatal error:', error);
|
|
319
|
+
process.exit(1);
|
|
320
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check Provider Routing Statistics
|
|
3
|
+
*
|
|
4
|
+
* Queries telemetry to show routing breakdown from recent swarm execution
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { TelemetrySystem, getGlobalTelemetry } = require('../.claude-flow-novice/dist/src/observability/telemetry.js');
|
|
8
|
+
|
|
9
|
+
async function checkRoutingStats() {
|
|
10
|
+
console.log('š Provider Routing Statistics\n');
|
|
11
|
+
console.log('=' .repeat(60));
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
// Get global telemetry instance
|
|
15
|
+
const telemetry = getGlobalTelemetry();
|
|
16
|
+
|
|
17
|
+
// Query provider request metrics
|
|
18
|
+
const providerMetrics = telemetry.getMetrics('provider.request', 300000); // Last 5 minutes
|
|
19
|
+
|
|
20
|
+
if (providerMetrics.length === 0) {
|
|
21
|
+
console.log('\nā ļø No routing metrics found in the last 5 minutes.');
|
|
22
|
+
console.log(' This may be because:');
|
|
23
|
+
console.log(' - Telemetry was initialized in a different process');
|
|
24
|
+
console.log(' - No tiered routing requests were made');
|
|
25
|
+
console.log(' - Metrics have expired (5 min window)');
|
|
26
|
+
console.log('\nTo test routing, run: node scripts/test-routing-telemetry.cjs\n');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log(`\nā
Found ${providerMetrics.length} routing metrics\n`);
|
|
31
|
+
|
|
32
|
+
// Aggregate by provider
|
|
33
|
+
const providerBreakdown = {};
|
|
34
|
+
const tierBreakdown = {};
|
|
35
|
+
const agentTypeBreakdown = {};
|
|
36
|
+
const sourceBreakdown = {};
|
|
37
|
+
|
|
38
|
+
providerMetrics.forEach(metric => {
|
|
39
|
+
const provider = metric.tags.provider || 'unknown';
|
|
40
|
+
const tier = metric.tags.tier || 'unknown';
|
|
41
|
+
const agentType = metric.tags.agentType || 'unknown';
|
|
42
|
+
const source = metric.tags.source || 'unknown';
|
|
43
|
+
|
|
44
|
+
providerBreakdown[provider] = (providerBreakdown[provider] || 0) + metric.value;
|
|
45
|
+
tierBreakdown[tier] = (tierBreakdown[tier] || 0) + metric.value;
|
|
46
|
+
agentTypeBreakdown[agentType] = (agentTypeBreakdown[agentType] || 0) + metric.value;
|
|
47
|
+
sourceBreakdown[source] = (sourceBreakdown[source] || 0) + metric.value;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Display results
|
|
51
|
+
console.log('š BY PROVIDER:');
|
|
52
|
+
console.log('-'.repeat(60));
|
|
53
|
+
Object.entries(providerBreakdown)
|
|
54
|
+
.sort((a, b) => b[1] - a[1])
|
|
55
|
+
.forEach(([provider, count]) => {
|
|
56
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
57
|
+
const providerName = provider === 'custom' ? 'Z.ai (free tier)' :
|
|
58
|
+
provider === 'anthropic' ? 'Anthropic API' : provider;
|
|
59
|
+
console.log(` ${providerName.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
console.log('\nšÆ BY TIER:');
|
|
63
|
+
console.log('-'.repeat(60));
|
|
64
|
+
Object.entries(tierBreakdown)
|
|
65
|
+
.sort((a, b) => b[1] - a[1])
|
|
66
|
+
.forEach(([tier, count]) => {
|
|
67
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
68
|
+
console.log(` ${tier.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
console.log('\nš¤ BY AGENT TYPE:');
|
|
72
|
+
console.log('-'.repeat(60));
|
|
73
|
+
Object.entries(agentTypeBreakdown)
|
|
74
|
+
.sort((a, b) => b[1] - a[1])
|
|
75
|
+
.forEach(([agentType, count]) => {
|
|
76
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
77
|
+
console.log(` ${agentType.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
console.log('\nš BY ROUTING SOURCE:');
|
|
81
|
+
console.log('-'.repeat(60));
|
|
82
|
+
Object.entries(sourceBreakdown)
|
|
83
|
+
.sort((a, b) => b[1] - a[1])
|
|
84
|
+
.forEach(([source, count]) => {
|
|
85
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
86
|
+
console.log(` ${source.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Check for subscription metrics
|
|
90
|
+
const subMetrics = telemetry.getMetrics('subscription.usage', 300000);
|
|
91
|
+
if (subMetrics.length > 0) {
|
|
92
|
+
const latestSub = subMetrics[subMetrics.length - 1];
|
|
93
|
+
console.log('\nš SUBSCRIPTION USAGE:');
|
|
94
|
+
console.log('-'.repeat(60));
|
|
95
|
+
console.log(` Used: ${latestSub.value}/${latestSub.tags.limit}`);
|
|
96
|
+
console.log(` Remaining: ${latestSub.tags.remaining}`);
|
|
97
|
+
console.log(` Status: ${latestSub.value >= parseInt(latestSub.tags.limit) ? 'ā ļø LIMIT REACHED' : 'ā
Available'}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Throughput analysis
|
|
101
|
+
const throughput = telemetry.getThroughputMetrics('provider.request', 300000);
|
|
102
|
+
console.log('\nā” THROUGHPUT ANALYSIS:');
|
|
103
|
+
console.log('-'.repeat(60));
|
|
104
|
+
console.log(` Total requests: ${throughput.totalRequests}`);
|
|
105
|
+
console.log(` Requests/sec: ${throughput.requestsPerSecond.toFixed(2)}`);
|
|
106
|
+
console.log(` Time window: Last 5 minutes`);
|
|
107
|
+
|
|
108
|
+
console.log('\n' + '='.repeat(60));
|
|
109
|
+
console.log('ā
Routing statistics retrieved successfully\n');
|
|
110
|
+
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('ā Error retrieving routing statistics:', error.message);
|
|
113
|
+
console.error('\nThis may happen if telemetry is not initialized.');
|
|
114
|
+
console.error('Try running a routing test first: node scripts/test-routing-telemetry.cjs\n');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Run stats check
|
|
119
|
+
checkRoutingStats().catch(err => {
|
|
120
|
+
console.error('Fatal error:', err);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|