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.
Files changed (288) hide show
  1. package/package.json +9 -8
  2. package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
  3. package/scripts/.claude-flow/metrics/performance.json +9 -0
  4. package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
  5. package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
  6. package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
  7. package/scripts/CLEANUP_QUICK_START.md +268 -0
  8. package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
  9. package/scripts/README.md +339 -0
  10. package/scripts/ace-query.sh +384 -0
  11. package/scripts/agent-token-analysis.js +430 -0
  12. package/scripts/auto-setup.js +332 -0
  13. package/scripts/build/README.md +167 -0
  14. package/scripts/build/build-config.js +27 -0
  15. package/scripts/build/build-prompt-copier.sh +30 -0
  16. package/scripts/build/performance-monitor.js +869 -0
  17. package/scripts/build/prepare-publish.js +150 -0
  18. package/scripts/build/typescript-fixer.js +621 -0
  19. package/scripts/build/unified-builder.sh +428 -0
  20. package/scripts/build/update-bin-version.js +32 -0
  21. package/scripts/build/validate-agents.js +238 -0
  22. package/scripts/build-index.js +43 -0
  23. package/scripts/build-orchestrator.js +320 -0
  24. package/scripts/check-routing-stats.cjs +122 -0
  25. package/scripts/ci-validation.js +375 -0
  26. package/scripts/cleanup-blocking-coordination.sh +420 -0
  27. package/scripts/cleanup-idle-sessions.sh +59 -0
  28. package/scripts/collect-build-metrics.js +65 -0
  29. package/scripts/demo/README.md +79 -0
  30. package/scripts/demo/autoscaling-demo-simplified.js +963 -0
  31. package/scripts/demo/comprehensive-dashboard-test.js +693 -0
  32. package/scripts/demo/confidence-log.js +87 -0
  33. package/scripts/demo/confidence-report.js +82 -0
  34. package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
  35. package/scripts/demo/demo-production-deployment.js +399 -0
  36. package/scripts/demo/demo-visualization-system.js +149 -0
  37. package/scripts/demo/performance-analysis.cjs +71 -0
  38. package/scripts/demo/performance-analysis.js +71 -0
  39. package/scripts/demo/test-autoscaling-demo.js +314 -0
  40. package/scripts/dependency-optimizer.js +349 -0
  41. package/scripts/dependency-security-assessment.js +331 -0
  42. package/scripts/deploy-sdk.sh +176 -0
  43. package/scripts/deployment-readiness-report.json +179 -0
  44. package/scripts/dev/README.md +264 -0
  45. package/scripts/dev/claude-flow-wrapper.sh +35 -0
  46. package/scripts/dev/claude-monitor.py +419 -0
  47. package/scripts/dev/claude-sparc.sh +562 -0
  48. package/scripts/dev/claude-wrapper.sh +17 -0
  49. package/scripts/dev/demo-phase3-compliance.js +172 -0
  50. package/scripts/dev/demo-task-system.ts +224 -0
  51. package/scripts/dev/deployment-validator.js +315 -0
  52. package/scripts/dev/spawn-claude-terminal.sh +32 -0
  53. package/scripts/dev/start-portal.sh +506 -0
  54. package/scripts/dev/start-web-ui.js +15 -0
  55. package/scripts/dev/stop-portal.sh +311 -0
  56. package/scripts/dev/validate-examples.ts +288 -0
  57. package/scripts/dev/validate-phase2.cjs +451 -0
  58. package/scripts/dev/validate-phase2.js +785 -0
  59. package/scripts/dev/validate-phase3.cjs +208 -0
  60. package/scripts/dev/validate-security-remediation.js +1 -0
  61. package/scripts/ecosystem.config.cjs +90 -0
  62. package/scripts/fix-js-extensions.js +167 -0
  63. package/scripts/generate-basic-types.js +73 -0
  64. package/scripts/generate-changelog.js +318 -0
  65. package/scripts/git-hooks/pre-commit.sh +143 -0
  66. package/scripts/health-checks.js +634 -0
  67. package/scripts/hook-wrapper.sh +54 -0
  68. package/scripts/install/README.md +375 -0
  69. package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
  70. package/scripts/install/check-prerequisites.js +303 -0
  71. package/scripts/install/config-wizard.js +606 -0
  72. package/scripts/install/dependency-checker.js +385 -0
  73. package/scripts/install/health-check.js +765 -0
  74. package/scripts/install/install.js +256 -0
  75. package/scripts/install/installation-benchmark.js +461 -0
  76. package/scripts/install/quick-install.js +720 -0
  77. package/scripts/install/quick-start-wizard.js +295 -0
  78. package/scripts/install/redis-cli.js +289 -0
  79. package/scripts/install/redis-install-guides.md +407 -0
  80. package/scripts/install/redis-setup.js +559 -0
  81. package/scripts/install/redis-test.js +278 -0
  82. package/scripts/install/service-manager.js +672 -0
  83. package/scripts/install/setup.js +832 -0
  84. package/scripts/install/uninstall.js +526 -0
  85. package/scripts/install/update.js +461 -0
  86. package/scripts/install-pre-commit-hook.sh +127 -0
  87. package/scripts/legacy/README.md +272 -0
  88. package/scripts/legacy/batch-fix-ts.sh +54 -0
  89. package/scripts/legacy/build-migration.sh +105 -0
  90. package/scripts/legacy/build-monitor.js +209 -0
  91. package/scripts/legacy/build-with-filter.sh +84 -0
  92. package/scripts/legacy/build-workaround.sh +71 -0
  93. package/scripts/legacy/fix-ts-advanced.js +358 -0
  94. package/scripts/legacy/fix-ts-final.sh +50 -0
  95. package/scripts/legacy/fix-ts-targeted.sh +49 -0
  96. package/scripts/legacy/fix-typescript-errors.js +305 -0
  97. package/scripts/legacy/force-build.sh +63 -0
  98. package/scripts/legacy/optimize-performance.js +400 -0
  99. package/scripts/legacy/performance-monitor.js +263 -0
  100. package/scripts/legacy/performance-monitoring.js +532 -0
  101. package/scripts/legacy/performance-test-runner.js +645 -0
  102. package/scripts/legacy/quick-fix-ts.js +281 -0
  103. package/scripts/legacy/safe-build.sh +63 -0
  104. package/scripts/memory-monitor-coordinator.js +322 -0
  105. package/scripts/migrate-to-sdk.sh +520 -0
  106. package/scripts/migration/QUICK-START.md +189 -0
  107. package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
  108. package/scripts/migration/README.md +464 -0
  109. package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
  110. package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
  111. package/scripts/migration/UPDATE-PATHS-README.md +464 -0
  112. package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
  113. package/scripts/migration/example-patterns.json +19 -0
  114. package/scripts/migration/install-arm64.js +78 -0
  115. package/scripts/migration/install.js +83 -0
  116. package/scripts/migration/migrate-hooks.js +173 -0
  117. package/scripts/migration/migration-examples.ts +318 -0
  118. package/scripts/migration/reorganize-workspace.js +504 -0
  119. package/scripts/migration/test-update-paths.js +359 -0
  120. package/scripts/migration/update-paths.js +664 -0
  121. package/scripts/migration/validate-migration.js +647 -0
  122. package/scripts/monitor-loop.sh +65 -0
  123. package/scripts/monitor-memory.sh +47 -0
  124. package/scripts/monitor-migration.js +339 -0
  125. package/scripts/monitor.py +43 -0
  126. package/scripts/monitoring/README.md +178 -0
  127. package/scripts/monitoring/alert-monitor.sh +220 -0
  128. package/scripts/monitoring/analyze-resources.sh +199 -0
  129. package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
  130. package/scripts/monitoring/dynamic-monitor.sh +85 -0
  131. package/scripts/monitoring/launch-stability-test.sh +184 -0
  132. package/scripts/monitoring/monitor-test.sh +93 -0
  133. package/scripts/monitoring/pre-test-validation.sh +208 -0
  134. package/scripts/monitoring/quick-test-alerting.sh +118 -0
  135. package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
  136. package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
  137. package/scripts/monitoring/resource-monitor.sh +126 -0
  138. package/scripts/monitoring/stability-monitor.js +429 -0
  139. package/scripts/monitoring/test-monitor-quick.sh +54 -0
  140. package/scripts/monitoring/view-alerts.sh +307 -0
  141. package/scripts/npm-metrics-collector.js +482 -0
  142. package/scripts/npm-package-validation.cjs +299 -0
  143. package/scripts/optimization/build-optimizer.js +438 -0
  144. package/scripts/optimization/config-validator.js +761 -0
  145. package/scripts/optimization/test-optimization.js +432 -0
  146. package/scripts/optimization/unified-activation.js +839 -0
  147. package/scripts/optimize-package-swarm.js +54 -0
  148. package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
  149. package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
  150. package/scripts/performance/test-enhanced-backend.sh +504 -0
  151. package/scripts/performance-monitor.js +644 -0
  152. package/scripts/performance-test-runner.js +698 -0
  153. package/scripts/post-deployment-monitoring.js +350 -0
  154. package/scripts/post-edit-pipeline.js +2091 -0
  155. package/scripts/post-install-claude-md.js +78 -0
  156. package/scripts/postinstall.js +79 -0
  157. package/scripts/pre-publish-validation.cjs +212 -0
  158. package/scripts/pre-publish-validation.js +429 -0
  159. package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
  160. package/scripts/release-announcement.js +425 -0
  161. package/scripts/release-notification.js +248 -0
  162. package/scripts/release-rollback.js +376 -0
  163. package/scripts/release-validation.js +460 -0
  164. package/scripts/rollback-sdk.sh +66 -0
  165. package/scripts/run-production-validation.ts +590 -0
  166. package/scripts/run-stability-validation.sh +687 -0
  167. package/scripts/security/README.md +339 -0
  168. package/scripts/security/deployment-validation.cjs +279 -0
  169. package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
  170. package/scripts/security/install-git-hooks.sh +132 -0
  171. package/scripts/security/install-git-secrets.sh +295 -0
  172. package/scripts/security/rotate-api-keys.js +469 -0
  173. package/scripts/security/ruv-swarm-safe.js +74 -0
  174. package/scripts/security/security-audit.cjs +538 -0
  175. package/scripts/security/setup-redis-auth.sh +397 -0
  176. package/scripts/security/validate-envelope-encryption.cjs +340 -0
  177. package/scripts/security-scan.js +492 -0
  178. package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
  179. package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
  180. package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
  181. package/scripts/switch-api.sh +158 -0
  182. package/scripts/sync-agents.js +290 -0
  183. package/scripts/test/50-agent-test.js +625 -0
  184. package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
  185. package/scripts/test/README.md +236 -0
  186. package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
  187. package/scripts/test/STABILITY_TEST_README.md +480 -0
  188. package/scripts/test/agent-worker.js +309 -0
  189. package/scripts/test/ai-coordination-test.js +650 -0
  190. package/scripts/test/ai-mesh-coordination-test.js +416 -0
  191. package/scripts/test/check-links.ts +274 -0
  192. package/scripts/test/check-performance-regression.ts +168 -0
  193. package/scripts/test/cli-agent-coordination-test.js +313 -0
  194. package/scripts/test/coordinator-multilingual-test.js +396 -0
  195. package/scripts/test/coordinator-transparency-demo.js +585 -0
  196. package/scripts/test/coverage-report.ts +692 -0
  197. package/scripts/test/generate-swarm-tests.js +633 -0
  198. package/scripts/test/integration-test-validation.cjs +253 -0
  199. package/scripts/test/load-test-swarm.js +576 -0
  200. package/scripts/test/mesh-coordination-zero-overlap-test.js +740 -0
  201. package/scripts/test/multilingual-hello-world-test.js +390 -0
  202. package/scripts/test/quick-multilingual-demo.js +464 -0
  203. package/scripts/test/real-agent-test.js +312 -0
  204. package/scripts/test/run-phase3-compliance-tests.js +427 -0
  205. package/scripts/test/run-stability-test-examples.sh +292 -0
  206. package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
  207. package/scripts/test/stability-results/stability-test-report.json +128 -0
  208. package/scripts/test/stability-results/stability-test.log +1827 -0
  209. package/scripts/test/stability-test-50-agents.js +734 -0
  210. package/scripts/test/test-batch-tasks.ts +29 -0
  211. package/scripts/test/test-byzantine-resolution.js +246 -0
  212. package/scripts/test/test-claude-spawn-options.sh +63 -0
  213. package/scripts/test/test-cli-wizard.js +331 -0
  214. package/scripts/test/test-comprehensive.js +401 -0
  215. package/scripts/test/test-coordination-features.ts +238 -0
  216. package/scripts/test/test-fallback-systems.js +276 -0
  217. package/scripts/test/test-init-command.ts +302 -0
  218. package/scripts/test/test-mcp.ts +251 -0
  219. package/scripts/test/test-runner.ts +568 -0
  220. package/scripts/test/test-swarm-integration.sh +92 -0
  221. package/scripts/test/test-swarm.ts +142 -0
  222. package/scripts/test/validation-summary.ts +408 -0
  223. package/scripts/test-cleanup-performance.sh +416 -0
  224. package/scripts/test-dashboard-auth.cjs +203 -0
  225. package/scripts/test-docker-deployment.sh +207 -0
  226. package/scripts/test-npm-package.cjs +167 -0
  227. package/scripts/test-provider-routing.cjs +226 -0
  228. package/scripts/test-routing-telemetry.cjs +147 -0
  229. package/scripts/test-runner.cjs +154 -0
  230. package/scripts/test-zai-10k.cjs +81 -0
  231. package/scripts/test-zai-api.cjs +191 -0
  232. package/scripts/test-zai-diagnostic.cjs +151 -0
  233. package/scripts/test-zai-final.cjs +128 -0
  234. package/scripts/test-zai-with-env.cjs +85 -0
  235. package/scripts/utils/README.md +261 -0
  236. package/scripts/utils/clean-build-artifacts.sh +94 -0
  237. package/scripts/utils/cleanup-root.sh +69 -0
  238. package/scripts/utils/fix-cliffy-imports.js +307 -0
  239. package/scripts/utils/fix-duplicate-imports.js +114 -0
  240. package/scripts/utils/fix-error-handling.cjs +70 -0
  241. package/scripts/utils/fix-import-paths.js +104 -0
  242. package/scripts/utils/fix-imports.js +116 -0
  243. package/scripts/utils/fix-shebang.js +78 -0
  244. package/scripts/utils/fix-test-modules.js +27 -0
  245. package/scripts/utils/fix-timezone-issue-246.js +200 -0
  246. package/scripts/utils/fix-ts-comprehensive.py +182 -0
  247. package/scripts/utils/fix-ts-targeted-batch.js +250 -0
  248. package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
  249. package/scripts/utils/simple-test-fixer.js +190 -0
  250. package/scripts/utils/validate-metrics-structure.cjs +144 -0
  251. package/scripts/validate-agent-hooks.js +506 -0
  252. package/scripts/validate-changelog.js +241 -0
  253. package/scripts/validate-coordination-cli.js +69 -0
  254. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  255. package/scripts/validate-docker-infrastructure.sh +502 -0
  256. package/scripts/validate-entry-points.js +300 -0
  257. package/scripts/validate-stage3-performance.ts +377 -0
  258. package/scripts/validate-template-bundling.js +180 -0
  259. package/scripts/validation/README.md +33 -0
  260. package/scripts/validation/acl-security-validation.cjs +214 -0
  261. package/scripts/validation/acl-security-validation.js +402 -0
  262. package/scripts/validation/byzantine-verification.js +407 -0
  263. package/scripts/validation/final-phase-2-consensus.cjs +219 -0
  264. package/scripts/validation/final-security-validation.js +791 -0
  265. package/scripts/validation/final-wasm-validation.cjs +840 -0
  266. package/scripts/validation/integration-test-analysis.js +105 -0
  267. package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
  268. package/scripts/validation/phase-0-consensus-report.js +139 -0
  269. package/scripts/validation/phase-0-final-report.js +112 -0
  270. package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
  271. package/scripts/validation/phase-0-validation-improved.js +490 -0
  272. package/scripts/validation/phase-0-validation-test.js +65 -0
  273. package/scripts/validation/phase-1-consensus-report.cjs +342 -0
  274. package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
  275. package/scripts/validation/phase-1-consensus-validation.js +551 -0
  276. package/scripts/validation/phase-2-consensus-report.cjs +186 -0
  277. package/scripts/validation/phase-2-validation.cjs +171 -0
  278. package/scripts/validation/phase-2-validation.js +171 -0
  279. package/scripts/validation/phase-4-consensus-report.js +181 -0
  280. package/scripts/validation/phase-4-final-validation.js +351 -0
  281. package/scripts/validation/phase-5-consensus-report.cjs +113 -0
  282. package/scripts/validation/phase-5-consensus-report.js +113 -0
  283. package/scripts/validation/security-analysis.js +49 -0
  284. package/scripts/validation/security-validation.js +492 -0
  285. package/scripts/validation/simple-security-validation.js +464 -0
  286. package/scripts/verify-installation.js +112 -0
  287. package/scripts/verify-mcp-server.js +86 -0
  288. package/scripts/verify-sdk-phase1.cjs +293 -0
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Entry Point Validation Script
4
+ * Validates all package.json entry points work correctly after build
5
+ */
6
+
7
+ import fs from 'fs/promises';
8
+ import path from 'path';
9
+ import { fileURLToPath } from 'url';
10
+ import { pathToFileURL } from 'url';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+ const rootDir = path.join(__dirname, '..');
15
+
16
+ // ANSI colors for output
17
+ const colors = {
18
+ reset: '\x1b[0m',
19
+ green: '\x1b[32m',
20
+ red: '\x1b[31m',
21
+ yellow: '\x1b[33m',
22
+ blue: '\x1b[34m',
23
+ gray: '\x1b[90m'
24
+ };
25
+
26
+ class EntryPointValidator {
27
+ constructor() {
28
+ this.results = {
29
+ passed: [],
30
+ failed: [],
31
+ warnings: []
32
+ };
33
+ }
34
+
35
+ log(message, color = 'reset') {
36
+ console.log(colors[color] + message + colors.reset);
37
+ }
38
+
39
+ async validatePackageJson() {
40
+ this.log('\n🔍 Reading package.json...', 'blue');
41
+
42
+ const pkgPath = path.join(rootDir, 'package.json');
43
+ const pkgContent = await fs.readFile(pkgPath, 'utf8');
44
+ const pkg = JSON.parse(pkgContent);
45
+
46
+ return {
47
+ main: pkg.main,
48
+ types: pkg.types,
49
+ bin: pkg.bin,
50
+ exports: pkg.exports
51
+ };
52
+ }
53
+
54
+ async checkFileExists(filePath, description) {
55
+ const fullPath = path.join(rootDir, filePath);
56
+
57
+ try {
58
+ await fs.access(fullPath);
59
+ this.log(` ✓ ${description}: ${filePath}`, 'green');
60
+ this.results.passed.push({ type: 'file-exists', description, path: filePath });
61
+ return true;
62
+ } catch {
63
+ this.log(` ✗ ${description}: ${filePath}`, 'red');
64
+ this.results.failed.push({ type: 'file-missing', description, path: filePath });
65
+ return false;
66
+ }
67
+ }
68
+
69
+ async testImport(filePath, description) {
70
+ const fullPath = path.join(rootDir, filePath);
71
+
72
+ try {
73
+ // Convert to file URL for dynamic import
74
+ const fileUrl = pathToFileURL(fullPath).href;
75
+ await import(fileUrl);
76
+ this.log(` ✓ ${description}: imports successfully`, 'green');
77
+ this.results.passed.push({ type: 'import', description, path: filePath });
78
+ return true;
79
+ } catch (error) {
80
+ this.log(` ✗ ${description}: ${error.message}`, 'red');
81
+ this.results.failed.push({
82
+ type: 'import-failed',
83
+ description,
84
+ path: filePath,
85
+ error: error.message
86
+ });
87
+ return false;
88
+ }
89
+ }
90
+
91
+ async validateMainEntry(pkg) {
92
+ this.log('\n📦 Validating main entry point...', 'blue');
93
+
94
+ if (!pkg.main) {
95
+ this.results.warnings.push('No main entry point defined');
96
+ this.log(' ⚠ No main entry point defined', 'yellow');
97
+ return;
98
+ }
99
+
100
+ await this.checkFileExists(pkg.main, 'main');
101
+ await this.testImport(pkg.main, 'main');
102
+ }
103
+
104
+ async validateTypesEntry(pkg) {
105
+ this.log('\n📘 Validating TypeScript types...', 'blue');
106
+
107
+ if (!pkg.types) {
108
+ this.results.warnings.push('No types entry point defined');
109
+ this.log(' ⚠ No types entry point defined', 'yellow');
110
+ return;
111
+ }
112
+
113
+ await this.checkFileExists(pkg.types, 'types');
114
+ }
115
+
116
+ async validateBinEntries(pkg) {
117
+ this.log('\n🔧 Validating bin entries...', 'blue');
118
+
119
+ if (!pkg.bin) {
120
+ this.results.warnings.push('No bin entries defined');
121
+ this.log(' ⚠ No bin entries defined', 'yellow');
122
+ return;
123
+ }
124
+
125
+ for (const [name, binPath] of Object.entries(pkg.bin)) {
126
+ await this.checkFileExists(binPath, `bin/${name}`);
127
+
128
+ // Check if bin file has shebang
129
+ try {
130
+ const fullPath = path.join(rootDir, binPath);
131
+ const content = await fs.readFile(fullPath, 'utf8');
132
+ const firstLine = content.split('\n')[0];
133
+
134
+ if (!firstLine.startsWith('#!')) {
135
+ this.results.warnings.push(`bin/${name} missing shebang: ${binPath}`);
136
+ this.log(` ⚠ ${name}: missing shebang`, 'yellow');
137
+ } else {
138
+ this.log(` ✓ ${name}: has shebang`, 'gray');
139
+ }
140
+ } catch {
141
+ // File doesn't exist, already reported above
142
+ }
143
+ }
144
+ }
145
+
146
+ async validateExports(pkg) {
147
+ this.log('\n📤 Validating exports...', 'blue');
148
+
149
+ if (!pkg.exports) {
150
+ this.results.warnings.push('No exports defined');
151
+ this.log(' ⚠ No exports defined', 'yellow');
152
+ return;
153
+ }
154
+
155
+ for (const [exportName, exportPath] of Object.entries(pkg.exports)) {
156
+ const description = exportName === '.' ? 'exports (default)' : `exports (${exportName})`;
157
+ await this.checkFileExists(exportPath, description);
158
+ }
159
+ }
160
+
161
+ async validateImportable(pkg) {
162
+ this.log('\n🧪 Testing module imports...', 'blue');
163
+
164
+ // Test main entry
165
+ if (pkg.main) {
166
+ await this.testImport(pkg.main, 'main entry');
167
+ }
168
+
169
+ // Test key exports
170
+ const criticalExports = [
171
+ { key: '.', name: 'default export' },
172
+ { key: './cli', name: 'CLI export' },
173
+ { key: './mcp', name: 'MCP export' }
174
+ ];
175
+
176
+ for (const { key, name } of criticalExports) {
177
+ if (pkg.exports && pkg.exports[key]) {
178
+ await this.testImport(pkg.exports[key], name);
179
+ }
180
+ }
181
+ }
182
+
183
+ async validateBuildStructure() {
184
+ this.log('\n🏗️ Validating build structure...', 'blue');
185
+
186
+ const criticalPaths = [
187
+ '.claude-flow-novice/dist/src',
188
+ '.claude-flow-novice/dist/src/cli',
189
+ '.claude-flow-novice/dist/src/core',
190
+ '.claude-flow-novice/dist/src/agents'
191
+ ];
192
+
193
+ for (const dirPath of criticalPaths) {
194
+ await this.checkFileExists(dirPath, `directory: ${dirPath}`);
195
+ }
196
+ }
197
+
198
+ printSummary() {
199
+ this.log('\n' + '='.repeat(60), 'blue');
200
+ this.log('📊 VALIDATION SUMMARY', 'blue');
201
+ this.log('='.repeat(60), 'blue');
202
+
203
+ this.log(`\n✓ Passed: ${this.results.passed.length}`, 'green');
204
+ this.log(`✗ Failed: ${this.results.failed.length}`, this.results.failed.length > 0 ? 'red' : 'green');
205
+ this.log(`⚠ Warnings: ${this.results.warnings.length}`, this.results.warnings.length > 0 ? 'yellow' : 'gray');
206
+
207
+ if (this.results.failed.length > 0) {
208
+ this.log('\n❌ FAILURES:', 'red');
209
+ this.results.failed.forEach(failure => {
210
+ this.log(` • ${failure.description}: ${failure.path}`, 'red');
211
+ if (failure.error) {
212
+ this.log(` ${failure.error}`, 'gray');
213
+ }
214
+ });
215
+ }
216
+
217
+ if (this.results.warnings.length > 0) {
218
+ this.log('\n⚠️ WARNINGS:', 'yellow');
219
+ this.results.warnings.forEach(warning => {
220
+ this.log(` • ${warning}`, 'yellow');
221
+ });
222
+ }
223
+
224
+ const confidence = this.calculateConfidence();
225
+ this.log(`\n🎯 Confidence Score: ${(confidence * 100).toFixed(1)}%`,
226
+ confidence >= 0.75 ? 'green' : 'red');
227
+
228
+ return {
229
+ passed: this.results.passed.length,
230
+ failed: this.results.failed.length,
231
+ warnings: this.results.warnings.length,
232
+ confidence,
233
+ success: this.results.failed.length === 0
234
+ };
235
+ }
236
+
237
+ calculateConfidence() {
238
+ const total = this.results.passed.length + this.results.failed.length;
239
+ if (total === 0) return 0;
240
+
241
+ const passRate = this.results.passed.length / total;
242
+ const warningPenalty = Math.min(this.results.warnings.length * 0.02, 0.1);
243
+
244
+ return Math.max(0, Math.min(1, passRate - warningPenalty));
245
+ }
246
+
247
+ async exportReport() {
248
+ const reportPath = path.join(rootDir, 'entry-points-validation-report.json');
249
+ const report = {
250
+ timestamp: new Date().toISOString(),
251
+ summary: {
252
+ passed: this.results.passed.length,
253
+ failed: this.results.failed.length,
254
+ warnings: this.results.warnings.length,
255
+ confidence: this.calculateConfidence()
256
+ },
257
+ results: this.results
258
+ };
259
+
260
+ await fs.writeFile(reportPath, JSON.stringify(report, null, 2));
261
+ this.log(`\n📄 Report exported to: ${reportPath}`, 'blue');
262
+ }
263
+
264
+ async run() {
265
+ this.log('🚀 Entry Point Validation Starting...', 'blue');
266
+
267
+ try {
268
+ const pkg = await this.validatePackageJson();
269
+
270
+ await this.validateBuildStructure();
271
+ await this.validateMainEntry(pkg);
272
+ await this.validateTypesEntry(pkg);
273
+ await this.validateBinEntries(pkg);
274
+ await this.validateExports(pkg);
275
+ await this.validateImportable(pkg);
276
+
277
+ const summary = this.printSummary();
278
+ await this.exportReport();
279
+
280
+ // Exit with error code if validation failed
281
+ if (!summary.success) {
282
+ process.exit(1);
283
+ }
284
+
285
+ this.log('\n✅ All entry points validated successfully!', 'green');
286
+
287
+ } catch (error) {
288
+ this.log(`\n❌ Fatal validation error: ${error.message}`, 'red');
289
+ console.error(error);
290
+ process.exit(1);
291
+ }
292
+ }
293
+ }
294
+
295
+ // Run validation
296
+ const validator = new EntryPointValidator();
297
+ validator.run().catch(error => {
298
+ console.error('Fatal error:', error);
299
+ process.exit(1);
300
+ });
@@ -0,0 +1,377 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * Stage 3 Performance Validation Script
4
+ * CLI tool to validate unified system performance targets
5
+ */
6
+
7
+ import { performance } from 'perf_hooks';
8
+ import { stage3Validator } from '../src/agents/stage3-integration-validator.js';
9
+
10
+ interface CliOptions {
11
+ scenario?: string;
12
+ verbose?: boolean;
13
+ output?: 'console' | 'json' | 'csv';
14
+ timeout?: number;
15
+ help?: boolean;
16
+ }
17
+
18
+ class Stage3PerformanceCLI {
19
+ private options: CliOptions = {};
20
+
21
+ constructor() {
22
+ this.parseArguments();
23
+ }
24
+
25
+ private parseArguments(): void {
26
+ const args = process.argv.slice(2);
27
+
28
+ for (let i = 0; i < args.length; i++) {
29
+ const arg = args[i];
30
+
31
+ switch (arg) {
32
+ case '--help':
33
+ case '-h':
34
+ this.options.help = true;
35
+ break;
36
+
37
+ case '--verbose':
38
+ case '-v':
39
+ this.options.verbose = true;
40
+ break;
41
+
42
+ case '--scenario':
43
+ case '-s':
44
+ this.options.scenario = args[++i];
45
+ break;
46
+
47
+ case '--output':
48
+ case '-o':
49
+ this.options.output = args[++i] as 'console' | 'json' | 'csv';
50
+ break;
51
+
52
+ case '--timeout':
53
+ case '-t':
54
+ this.options.timeout = parseInt(args[++i], 10);
55
+ break;
56
+
57
+ default:
58
+ console.warn(`Unknown option: ${arg}`);
59
+ }
60
+ }
61
+ }
62
+
63
+ private showHelp(): void {
64
+ console.log(`
65
+ 🎯 Stage 3 Performance Validation Tool
66
+
67
+ Usage: tsx scripts/validate-stage3-performance.ts [options]
68
+
69
+ Options:
70
+ -h, --help Show this help message
71
+ -v, --verbose Enable verbose output
72
+ -s, --scenario NAME Run specific scenario only
73
+ -o, --output FORMAT Output format: console, json, csv (default: console)
74
+ -t, --timeout MS Set timeout in milliseconds (default: 300000)
75
+
76
+ Scenarios:
77
+ - Baseline Performance (100 agents, 500 messages, 200 tasks)
78
+ - High Concurrency (1000 agents, 5000 messages, 2000 tasks)
79
+ - Peak Load (5000 agents, 25000 messages, 10000 tasks)
80
+ - Ultra High Load (10000 agents, 50000 messages, 20000 tasks)
81
+ - Sustained Load (2000 agents + 60s duration)
82
+ - Communication Intensive (500 agents, 50000 messages)
83
+ - Task Execution Heavy (1000 agents, 25000 tasks)
84
+
85
+ Performance Targets:
86
+ ✅ Agent spawn time: <100ms P95
87
+ ✅ Communication latency: <5ms P95
88
+ ✅ Concurrent agents: Up to 10,000
89
+ ✅ Memory usage: <2GB peak
90
+ ✅ Success rate: >80%
91
+
92
+ Examples:
93
+ tsx scripts/validate-stage3-performance.ts --verbose
94
+ tsx scripts/validate-stage3-performance.ts --scenario "High Concurrency"
95
+ tsx scripts/validate-stage3-performance.ts --output json > results.json
96
+ `);
97
+ }
98
+
99
+ async run(): Promise<void> {
100
+ if (this.options.help) {
101
+ this.showHelp();
102
+ return;
103
+ }
104
+
105
+ console.log('🚀 Starting Stage 3 Performance Validation');
106
+ console.log('==========================================');
107
+
108
+ if (this.options.verbose) {
109
+ console.log('Configuration:');
110
+ console.log(` Scenario filter: ${this.options.scenario || 'all'}`);
111
+ console.log(` Output format: ${this.options.output || 'console'}`);
112
+ console.log(` Timeout: ${this.options.timeout || 300000}ms`);
113
+ console.log('');
114
+ }
115
+
116
+ try {
117
+ const startTime = performance.now();
118
+
119
+ if (this.options.scenario) {
120
+ await this.runSpecificScenario(this.options.scenario);
121
+ } else {
122
+ await this.runFullValidation();
123
+ }
124
+
125
+ const totalTime = performance.now() - startTime;
126
+
127
+ if (this.options.verbose) {
128
+ console.log(`\n⏱️ Total validation time: ${(totalTime / 1000).toFixed(2)}s`);
129
+ }
130
+
131
+ } catch (error) {
132
+ console.error('❌ Validation failed:', error instanceof Error ? error.message : String(error));
133
+ process.exit(1);
134
+ }
135
+ }
136
+
137
+ private async runFullValidation(): Promise<void> {
138
+ const result = await stage3Validator.validateStage3();
139
+
140
+ this.outputResults(result.results);
141
+
142
+ if (result.passed) {
143
+ console.log('\n🎉 STAGE 3 VALIDATION: PASSED');
144
+ console.log('All performance targets met!');
145
+ process.exit(0);
146
+ } else {
147
+ console.log('\n❌ STAGE 3 VALIDATION: FAILED');
148
+ console.log('Some performance targets not met.');
149
+ process.exit(1);
150
+ }
151
+ }
152
+
153
+ private async runSpecificScenario(scenarioName: string): Promise<void> {
154
+ // Create a test scenario based on the name
155
+ const scenarios = {
156
+ 'Baseline Performance': {
157
+ name: 'Baseline Performance',
158
+ description: 'Basic system functionality validation',
159
+ agentCount: 100,
160
+ messageCount: 500,
161
+ taskCount: 200,
162
+ targets: {
163
+ spawnTimeP95Ms: 80,
164
+ communicationP95Ms: 3,
165
+ concurrentAgents: 100,
166
+ memoryLimitMB: 200,
167
+ successRate: 0.95
168
+ }
169
+ },
170
+ 'High Concurrency': {
171
+ name: 'High Concurrency',
172
+ description: 'Test system with 1000+ concurrent agents',
173
+ agentCount: 1000,
174
+ messageCount: 5000,
175
+ taskCount: 2000,
176
+ targets: {
177
+ spawnTimeP95Ms: 100,
178
+ communicationP95Ms: 5,
179
+ concurrentAgents: 1000,
180
+ memoryLimitMB: 500,
181
+ successRate: 0.90
182
+ }
183
+ },
184
+ 'Peak Load': {
185
+ name: 'Peak Load',
186
+ description: 'Maximum system capacity test',
187
+ agentCount: 5000,
188
+ messageCount: 25000,
189
+ taskCount: 10000,
190
+ targets: {
191
+ spawnTimeP95Ms: 150,
192
+ communicationP95Ms: 8,
193
+ concurrentAgents: 5000,
194
+ memoryLimitMB: 1000,
195
+ successRate: 0.85
196
+ }
197
+ },
198
+ 'Ultra High Load': {
199
+ name: 'Ultra High Load',
200
+ description: 'Stress test with 10k+ agents',
201
+ agentCount: 10000,
202
+ messageCount: 50000,
203
+ taskCount: 20000,
204
+ targets: {
205
+ spawnTimeP95Ms: 200,
206
+ communicationP95Ms: 10,
207
+ concurrentAgents: 10000,
208
+ memoryLimitMB: 2000,
209
+ successRate: 0.80
210
+ }
211
+ }
212
+ };
213
+
214
+ const scenario = scenarios[scenarioName as keyof typeof scenarios];
215
+ if (!scenario) {
216
+ console.error(`❌ Unknown scenario: ${scenarioName}`);
217
+ console.log('Available scenarios:', Object.keys(scenarios).join(', '));
218
+ process.exit(1);
219
+ }
220
+
221
+ console.log(`🎯 Running scenario: ${scenario.name}`);
222
+ console.log(`📝 ${scenario.description}`);
223
+ console.log(`📊 ${scenario.agentCount} agents, ${scenario.messageCount} messages, ${scenario.taskCount} tasks\n`);
224
+
225
+ // Initialize validator and run scenario
226
+ const validator = stage3Validator;
227
+ await (validator as any).agentManager.initialize();
228
+
229
+ try {
230
+ const result = await (validator as any).executeValidationScenario(scenario);
231
+ this.outputResults([result]);
232
+
233
+ if (result.passed) {
234
+ console.log(`\n✅ Scenario "${scenarioName}": PASSED`);
235
+ process.exit(0);
236
+ } else {
237
+ console.log(`\n❌ Scenario "${scenarioName}": FAILED`);
238
+ process.exit(1);
239
+ }
240
+ } finally {
241
+ await (validator as any).agentManager.shutdown();
242
+ }
243
+ }
244
+
245
+ private outputResults(results: any[]): void {
246
+ switch (this.options.output) {
247
+ case 'json':
248
+ this.outputJSON(results);
249
+ break;
250
+ case 'csv':
251
+ this.outputCSV(results);
252
+ break;
253
+ default:
254
+ this.outputConsole(results);
255
+ }
256
+ }
257
+
258
+ private outputConsole(results: any[]): void {
259
+ console.log('\n📊 Performance Validation Results');
260
+ console.log('================================');
261
+
262
+ results.forEach((result, index) => {
263
+ const status = result.passed ? '✅ PASS' : '❌ FAIL';
264
+ const statusIcon = result.passed ? '🟢' : '🔴';
265
+
266
+ console.log(`\n${statusIcon} ${index + 1}. ${result.scenario}: ${status}`);
267
+
268
+ if (this.options.verbose) {
269
+ console.log(` Description: ${result.scenario}`);
270
+ console.log(` Duration: ${(result.details.totalTime / 1000).toFixed(2)}s`);
271
+ }
272
+
273
+ // Performance metrics
274
+ console.log(` 📈 Performance Metrics:`);
275
+ console.log(` Spawn Time P95: ${result.metrics.spawnTimeP95.toFixed(2)}ms`);
276
+ console.log(` Communication P95: ${result.metrics.communicationP95.toFixed(2)}ms`);
277
+ console.log(` Concurrent Agents: ${result.metrics.concurrentAgents.toLocaleString()}`);
278
+ console.log(` Memory Usage: ${result.metrics.memoryUsage.toFixed(2)}MB`);
279
+ console.log(` Success Rate: ${(result.metrics.successRate * 100).toFixed(1)}%`);
280
+ console.log(` Throughput: ${result.metrics.throughput.toFixed(0)} ops/sec`);
281
+
282
+ // Operation details
283
+ if (this.options.verbose) {
284
+ console.log(` 🔧 Operation Details:`);
285
+ console.log(` Agents Spawned: ${result.details.agentsSpawned.toLocaleString()}`);
286
+ console.log(` Messages Sent: ${result.details.messagesSent.toLocaleString()}`);
287
+ console.log(` Tasks Executed: ${result.details.tasksExecuted.toLocaleString()}`);
288
+ console.log(` Errors: ${result.details.errors}`);
289
+ }
290
+ });
291
+
292
+ // Summary
293
+ const passedCount = results.filter(r => r.passed).length;
294
+ const totalCount = results.length;
295
+ const overallSuccessRate = (passedCount / totalCount) * 100;
296
+
297
+ console.log('\n📋 Summary');
298
+ console.log('==========');
299
+ console.log(`Overall Result: ${passedCount}/${totalCount} scenarios passed`);
300
+ console.log(`Success Rate: ${overallSuccessRate.toFixed(1)}%`);
301
+
302
+ if (passedCount === totalCount) {
303
+ console.log('🎉 All performance targets met!');
304
+ } else {
305
+ console.log('⚠️ Some performance targets not met.');
306
+ }
307
+ }
308
+
309
+ private outputJSON(results: any[]): void {
310
+ const output = {
311
+ timestamp: new Date().toISOString(),
312
+ validation: 'Stage 3 Performance',
313
+ summary: {
314
+ total: results.length,
315
+ passed: results.filter(r => r.passed).length,
316
+ failed: results.filter(r => !r.passed).length,
317
+ successRate: (results.filter(r => r.passed).length / results.length) * 100
318
+ },
319
+ results
320
+ };
321
+
322
+ console.log(JSON.stringify(output, null, 2));
323
+ }
324
+
325
+ private outputCSV(results: any[]): void {
326
+ // CSV header
327
+ const headers = [
328
+ 'Scenario',
329
+ 'Status',
330
+ 'Spawn Time P95 (ms)',
331
+ 'Communication P95 (ms)',
332
+ 'Concurrent Agents',
333
+ 'Memory Usage (MB)',
334
+ 'Success Rate (%)',
335
+ 'Throughput (ops/sec)',
336
+ 'Total Time (s)',
337
+ 'Agents Spawned',
338
+ 'Messages Sent',
339
+ 'Tasks Executed',
340
+ 'Errors'
341
+ ];
342
+
343
+ console.log(headers.join(','));
344
+
345
+ // CSV data
346
+ results.forEach(result => {
347
+ const row = [
348
+ `"${result.scenario}"`,
349
+ result.passed ? 'PASS' : 'FAIL',
350
+ result.metrics.spawnTimeP95.toFixed(2),
351
+ result.metrics.communicationP95.toFixed(2),
352
+ result.metrics.concurrentAgents,
353
+ result.metrics.memoryUsage.toFixed(2),
354
+ (result.metrics.successRate * 100).toFixed(1),
355
+ result.metrics.throughput.toFixed(0),
356
+ (result.details.totalTime / 1000).toFixed(2),
357
+ result.details.agentsSpawned,
358
+ result.details.messagesSent,
359
+ result.details.tasksExecuted,
360
+ result.details.errors
361
+ ];
362
+
363
+ console.log(row.join(','));
364
+ });
365
+ }
366
+ }
367
+
368
+ // Run CLI if called directly
369
+ if (import.meta.url === `file://${process.argv[1]}`) {
370
+ const cli = new Stage3PerformanceCLI();
371
+ cli.run().catch(error => {
372
+ console.error('Fatal error:', error);
373
+ process.exit(1);
374
+ });
375
+ }
376
+
377
+ export { Stage3PerformanceCLI };