claude-flow-novice 2.3.5 → 2.3.6

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 (347) hide show
  1. package/dist/src/booster/performance-benchmark.js +1 -1
  2. package/dist/src/booster/wasm-demo.js +1 -1
  3. package/dist/src/cli/command-registry.js +2 -2
  4. package/dist/src/cli/help-formatter.js +137 -109
  5. package/dist/src/cli/simple-cli.js +2528 -2121
  6. package/dist/src/cli/simple-commands/sparc/refinement.js +3 -3
  7. package/dist/src/cli/validation-helper.js +98 -49
  8. package/dist/src/commands/suggest-templates.js +4 -4
  9. package/dist/src/core/version.js +23 -15
  10. package/dist/src/memory/swarm-memory.js +603 -470
  11. package/dist/src/slash-commands/fullstack.js +2 -2
  12. package/dist/src/slash-commands/parse-epic.js +1 -1
  13. package/package.json +1 -1
  14. package/scripts/postinstall.js +40 -6
  15. package/dist/scripts/.claude-flow/metrics/agent-metrics.json +0 -1
  16. package/dist/scripts/.claude-flow/metrics/performance.json +0 -9
  17. package/dist/scripts/.claude-flow/metrics/task-metrics.json +0 -10
  18. package/dist/scripts/CLEANUP_OPTIMIZATION_REPORT.json +0 -312
  19. package/dist/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +0 -387
  20. package/dist/scripts/CLEANUP_QUICK_START.md +0 -268
  21. package/dist/scripts/CLEANUP_TEST_RESULTS.md +0 -205
  22. package/dist/scripts/README.md +0 -339
  23. package/dist/scripts/ace-query.sh +0 -384
  24. package/dist/scripts/agent-token-analysis.js +0 -430
  25. package/dist/scripts/auto-setup.js +0 -332
  26. package/dist/scripts/build/README.md +0 -167
  27. package/dist/scripts/build/build-config.js +0 -27
  28. package/dist/scripts/build/build-prompt-copier.sh +0 -30
  29. package/dist/scripts/build/performance-monitor.js +0 -869
  30. package/dist/scripts/build/prepare-publish.js +0 -150
  31. package/dist/scripts/build/typescript-fixer.js +0 -621
  32. package/dist/scripts/build/unified-builder.sh +0 -428
  33. package/dist/scripts/build/update-bin-version.js +0 -32
  34. package/dist/scripts/build/validate-agents.js +0 -238
  35. package/dist/scripts/build-index.js +0 -43
  36. package/dist/scripts/build-orchestrator.js +0 -320
  37. package/dist/scripts/check-routing-stats.cjs +0 -122
  38. package/dist/scripts/ci-validation.js +0 -375
  39. package/dist/scripts/cleanup-blocking-coordination.sh +0 -420
  40. package/dist/scripts/cleanup-idle-sessions.sh +0 -118
  41. package/dist/scripts/collect-build-metrics.js +0 -65
  42. package/dist/scripts/demo/README.md +0 -79
  43. package/dist/scripts/demo/autoscaling-demo-simplified.js +0 -963
  44. package/dist/scripts/demo/comprehensive-dashboard-test.js +0 -693
  45. package/dist/scripts/demo/confidence-log.js +0 -87
  46. package/dist/scripts/demo/confidence-report.js +0 -82
  47. package/dist/scripts/demo/demo-multi-swarm-coordination.js +0 -325
  48. package/dist/scripts/demo/demo-production-deployment.js +0 -399
  49. package/dist/scripts/demo/demo-visualization-system.js +0 -149
  50. package/dist/scripts/demo/performance-analysis.cjs +0 -71
  51. package/dist/scripts/demo/performance-analysis.js +0 -71
  52. package/dist/scripts/demo/test-autoscaling-demo.js +0 -314
  53. package/dist/scripts/dependency-optimizer.js +0 -349
  54. package/dist/scripts/dependency-security-assessment.js +0 -331
  55. package/dist/scripts/deploy-sdk.sh +0 -176
  56. package/dist/scripts/deployment-readiness-report.json +0 -179
  57. package/dist/scripts/dev/README.md +0 -264
  58. package/dist/scripts/dev/claude-flow-wrapper.sh +0 -35
  59. package/dist/scripts/dev/claude-monitor.py +0 -419
  60. package/dist/scripts/dev/claude-sparc.sh +0 -562
  61. package/dist/scripts/dev/claude-wrapper.sh +0 -17
  62. package/dist/scripts/dev/demo-phase3-compliance.js +0 -172
  63. package/dist/scripts/dev/demo-task-system.ts +0 -224
  64. package/dist/scripts/dev/deployment-validator.js +0 -315
  65. package/dist/scripts/dev/spawn-claude-terminal.sh +0 -32
  66. package/dist/scripts/dev/start-portal.sh +0 -506
  67. package/dist/scripts/dev/start-web-ui.js +0 -15
  68. package/dist/scripts/dev/stop-portal.sh +0 -311
  69. package/dist/scripts/dev/validate-examples.ts +0 -288
  70. package/dist/scripts/dev/validate-phase2.cjs +0 -451
  71. package/dist/scripts/dev/validate-phase2.js +0 -785
  72. package/dist/scripts/dev/validate-phase3.cjs +0 -208
  73. package/dist/scripts/dev/validate-security-remediation.js +0 -1
  74. package/dist/scripts/ecosystem.config.cjs +0 -90
  75. package/dist/scripts/enhanced-memory-spiral-killer.sh +0 -221
  76. package/dist/scripts/fix-js-extensions.js +0 -167
  77. package/dist/scripts/generate-basic-types.js +0 -73
  78. package/dist/scripts/generate-changelog.js +0 -318
  79. package/dist/scripts/git-hooks/pre-commit.sh +0 -143
  80. package/dist/scripts/health-checks.js +0 -634
  81. package/dist/scripts/hook-wrapper.sh +0 -54
  82. package/dist/scripts/install/README.md +0 -375
  83. package/dist/scripts/install/REDIS_SETUP_VALIDATION.json +0 -245
  84. package/dist/scripts/install/check-prerequisites.js +0 -303
  85. package/dist/scripts/install/config-wizard.js +0 -606
  86. package/dist/scripts/install/dependency-checker.js +0 -385
  87. package/dist/scripts/install/health-check.js +0 -765
  88. package/dist/scripts/install/install.js +0 -256
  89. package/dist/scripts/install/installation-benchmark.js +0 -461
  90. package/dist/scripts/install/quick-install.js +0 -720
  91. package/dist/scripts/install/quick-start-wizard.js +0 -295
  92. package/dist/scripts/install/redis-cli.js +0 -289
  93. package/dist/scripts/install/redis-install-guides.md +0 -407
  94. package/dist/scripts/install/redis-setup.js +0 -559
  95. package/dist/scripts/install/redis-test.js +0 -278
  96. package/dist/scripts/install/service-manager.js +0 -672
  97. package/dist/scripts/install/setup.js +0 -832
  98. package/dist/scripts/install/uninstall.js +0 -526
  99. package/dist/scripts/install/update.js +0 -461
  100. package/dist/scripts/install-pre-commit-hook.sh +0 -127
  101. package/dist/scripts/legacy/README.md +0 -272
  102. package/dist/scripts/legacy/batch-fix-ts.sh +0 -54
  103. package/dist/scripts/legacy/build-migration.sh +0 -105
  104. package/dist/scripts/legacy/build-monitor.js +0 -209
  105. package/dist/scripts/legacy/build-with-filter.sh +0 -84
  106. package/dist/scripts/legacy/build-workaround.sh +0 -71
  107. package/dist/scripts/legacy/fix-ts-advanced.js +0 -358
  108. package/dist/scripts/legacy/fix-ts-final.sh +0 -50
  109. package/dist/scripts/legacy/fix-ts-targeted.sh +0 -49
  110. package/dist/scripts/legacy/fix-typescript-errors.js +0 -305
  111. package/dist/scripts/legacy/force-build.sh +0 -63
  112. package/dist/scripts/legacy/optimize-performance.js +0 -400
  113. package/dist/scripts/legacy/performance-monitor.js +0 -263
  114. package/dist/scripts/legacy/performance-monitoring.js +0 -532
  115. package/dist/scripts/legacy/performance-test-runner.js +0 -645
  116. package/dist/scripts/legacy/quick-fix-ts.js +0 -281
  117. package/dist/scripts/legacy/safe-build.sh +0 -63
  118. package/dist/scripts/memory-monitor-coordinator.js +0 -451
  119. package/dist/scripts/migrate-to-sdk.sh +0 -520
  120. package/dist/scripts/migration/QUICK-START.md +0 -189
  121. package/dist/scripts/migration/QUICK-START.md.backup-1760135091363 +0 -189
  122. package/dist/scripts/migration/README.md +0 -464
  123. package/dist/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +0 -500
  124. package/dist/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +0 -500
  125. package/dist/scripts/migration/UPDATE-PATHS-README.md +0 -464
  126. package/dist/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +0 -464
  127. package/dist/scripts/migration/example-patterns.json +0 -19
  128. package/dist/scripts/migration/install-arm64.js +0 -78
  129. package/dist/scripts/migration/install.js +0 -83
  130. package/dist/scripts/migration/migrate-hooks.js +0 -173
  131. package/dist/scripts/migration/migration-examples.ts +0 -318
  132. package/dist/scripts/migration/reorganize-workspace.js +0 -504
  133. package/dist/scripts/migration/test-update-paths.js +0 -359
  134. package/dist/scripts/migration/update-paths.js +0 -664
  135. package/dist/scripts/migration/validate-migration.js +0 -647
  136. package/dist/scripts/monitor-loop.sh +0 -65
  137. package/dist/scripts/monitor-memory.sh +0 -47
  138. package/dist/scripts/monitor-migration.js +0 -339
  139. package/dist/scripts/monitor.py +0 -43
  140. package/dist/scripts/monitoring/README.md +0 -178
  141. package/dist/scripts/monitoring/alert-monitor.sh +0 -220
  142. package/dist/scripts/monitoring/analyze-resources.sh +0 -199
  143. package/dist/scripts/monitoring/dashboards/rate-limiting-dashboard.json +0 -211
  144. package/dist/scripts/monitoring/dynamic-monitor.sh +0 -85
  145. package/dist/scripts/monitoring/launch-stability-test.sh +0 -184
  146. package/dist/scripts/monitoring/monitor-test.sh +0 -93
  147. package/dist/scripts/monitoring/pre-test-validation.sh +0 -208
  148. package/dist/scripts/monitoring/quick-test-alerting.sh +0 -118
  149. package/dist/scripts/monitoring/quick-test-rate-limiting.sh +0 -206
  150. package/dist/scripts/monitoring/rate-limiting-monitor.sh +0 -380
  151. package/dist/scripts/monitoring/resource-monitor.sh +0 -126
  152. package/dist/scripts/monitoring/stability-monitor.js +0 -429
  153. package/dist/scripts/monitoring/test-monitor-quick.sh +0 -54
  154. package/dist/scripts/monitoring/view-alerts.sh +0 -307
  155. package/dist/scripts/npm-metrics-collector.js +0 -482
  156. package/dist/scripts/npm-package-validation.cjs +0 -299
  157. package/dist/scripts/optimization/build-optimizer.js +0 -438
  158. package/dist/scripts/optimization/config-validator.js +0 -761
  159. package/dist/scripts/optimization/test-optimization.js +0 -432
  160. package/dist/scripts/optimization/unified-activation.js +0 -839
  161. package/dist/scripts/optimize-package-swarm.js +0 -54
  162. package/dist/scripts/performance/ACTIVATION_COMMANDS.md +0 -292
  163. package/dist/scripts/performance/sqlite-enhanced-activation.sh +0 -583
  164. package/dist/scripts/performance/test-enhanced-backend.sh +0 -504
  165. package/dist/scripts/performance-monitor.js +0 -644
  166. package/dist/scripts/performance-test-runner.js +0 -698
  167. package/dist/scripts/post-deployment-monitoring.js +0 -350
  168. package/dist/scripts/post-edit-pipeline.js +0 -2091
  169. package/dist/scripts/post-install-claude-md.js +0 -78
  170. package/dist/scripts/postinstall.js +0 -60
  171. package/dist/scripts/pre-publish-validation.cjs +0 -212
  172. package/dist/scripts/pre-publish-validation.js +0 -429
  173. package/dist/scripts/redis-lua/cleanup-blocking-coordination.lua +0 -198
  174. package/dist/scripts/release-announcement.js +0 -425
  175. package/dist/scripts/release-notification.js +0 -248
  176. package/dist/scripts/release-rollback.js +0 -376
  177. package/dist/scripts/release-validation.js +0 -460
  178. package/dist/scripts/rollback-sdk.sh +0 -66
  179. package/dist/scripts/run-production-validation.ts +0 -590
  180. package/dist/scripts/run-stability-validation.sh +0 -687
  181. package/dist/scripts/security/README.md +0 -339
  182. package/dist/scripts/security/deployment-validation.cjs +0 -279
  183. package/dist/scripts/security/envelope-encryption-confidence-report.cjs +0 -422
  184. package/dist/scripts/security/install-git-hooks.sh +0 -132
  185. package/dist/scripts/security/install-git-secrets.sh +0 -295
  186. package/dist/scripts/security/rotate-api-keys.js +0 -469
  187. package/dist/scripts/security/ruv-swarm-safe.js +0 -74
  188. package/dist/scripts/security/security-audit.cjs +0 -538
  189. package/dist/scripts/security/setup-redis-auth.sh +0 -397
  190. package/dist/scripts/security/validate-envelope-encryption.cjs +0 -340
  191. package/dist/scripts/security-scan.js +0 -492
  192. package/dist/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +0 -1
  193. package/dist/scripts/src/web/frontend/.claude-flow/metrics/performance.json +0 -9
  194. package/dist/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +0 -10
  195. package/dist/scripts/switch-api.sh +0 -159
  196. package/dist/scripts/sync-agents.js +0 -290
  197. package/dist/scripts/test/50-agent-test.js +0 -625
  198. package/dist/scripts/test/NEW_STABILITY_TEST_GUIDE.md +0 -407
  199. package/dist/scripts/test/README.md +0 -236
  200. package/dist/scripts/test/STABILITY_TEST_EXAMPLE.md +0 -347
  201. package/dist/scripts/test/STABILITY_TEST_README.md +0 -480
  202. package/dist/scripts/test/agent-worker.js +0 -309
  203. package/dist/scripts/test/ai-coordination-test.js +0 -650
  204. package/dist/scripts/test/ai-mesh-coordination-test.js +0 -416
  205. package/dist/scripts/test/check-links.ts +0 -274
  206. package/dist/scripts/test/check-performance-regression.ts +0 -168
  207. package/dist/scripts/test/cli-agent-coordination-test.js +0 -313
  208. package/dist/scripts/test/coordinator-multilingual-test.js +0 -396
  209. package/dist/scripts/test/coordinator-transparency-demo.js +0 -585
  210. package/dist/scripts/test/coverage-report.ts +0 -692
  211. package/dist/scripts/test/generate-swarm-tests.js +0 -633
  212. package/dist/scripts/test/integration-test-validation.cjs +0 -253
  213. package/dist/scripts/test/load-test-swarm.js +0 -576
  214. package/dist/scripts/test/mesh-coordination-zero-overlap-test.js +0 -740
  215. package/dist/scripts/test/multilingual-hello-world-test.js +0 -390
  216. package/dist/scripts/test/quick-multilingual-demo.js +0 -464
  217. package/dist/scripts/test/real-agent-test.js +0 -312
  218. package/dist/scripts/test/run-phase3-compliance-tests.js +0 -427
  219. package/dist/scripts/test/run-stability-test-examples.sh +0 -292
  220. package/dist/scripts/test/stability-results/stability-metrics.jsonl +0 -83
  221. package/dist/scripts/test/stability-results/stability-test-report.json +0 -128
  222. package/dist/scripts/test/stability-results/stability-test.log +0 -1827
  223. package/dist/scripts/test/stability-test-50-agents.js +0 -734
  224. package/dist/scripts/test/test-batch-tasks.ts +0 -29
  225. package/dist/scripts/test/test-byzantine-resolution.js +0 -246
  226. package/dist/scripts/test/test-claude-spawn-options.sh +0 -63
  227. package/dist/scripts/test/test-cli-wizard.js +0 -331
  228. package/dist/scripts/test/test-comprehensive.js +0 -401
  229. package/dist/scripts/test/test-coordination-features.ts +0 -238
  230. package/dist/scripts/test/test-fallback-systems.js +0 -276
  231. package/dist/scripts/test/test-init-command.ts +0 -302
  232. package/dist/scripts/test/test-mcp.ts +0 -251
  233. package/dist/scripts/test/test-runner.ts +0 -568
  234. package/dist/scripts/test/test-swarm-integration.sh +0 -92
  235. package/dist/scripts/test/test-swarm.ts +0 -142
  236. package/dist/scripts/test/validation-summary.ts +0 -408
  237. package/dist/scripts/test-cleanup-performance.sh +0 -416
  238. package/dist/scripts/test-dashboard-auth.cjs +0 -203
  239. package/dist/scripts/test-docker-deployment.sh +0 -207
  240. package/dist/scripts/test-npm-package.cjs +0 -167
  241. package/dist/scripts/test-provider-routing.cjs +0 -226
  242. package/dist/scripts/test-routing-telemetry.cjs +0 -147
  243. package/dist/scripts/test-runner.cjs +0 -154
  244. package/dist/scripts/test-zai-10k.cjs +0 -81
  245. package/dist/scripts/test-zai-api.cjs +0 -191
  246. package/dist/scripts/test-zai-diagnostic.cjs +0 -151
  247. package/dist/scripts/test-zai-final.cjs +0 -128
  248. package/dist/scripts/test-zai-with-env.cjs +0 -85
  249. package/dist/scripts/toggle-cost-savings.cjs +0 -302
  250. package/dist/scripts/unified-memory-monitor.js +0 -526
  251. package/dist/scripts/utils/README.md +0 -261
  252. package/dist/scripts/utils/clean-build-artifacts.sh +0 -94
  253. package/dist/scripts/utils/cleanup-root.sh +0 -69
  254. package/dist/scripts/utils/fix-cliffy-imports.js +0 -307
  255. package/dist/scripts/utils/fix-duplicate-imports.js +0 -114
  256. package/dist/scripts/utils/fix-error-handling.cjs +0 -70
  257. package/dist/scripts/utils/fix-import-paths.js +0 -104
  258. package/dist/scripts/utils/fix-imports.js +0 -116
  259. package/dist/scripts/utils/fix-shebang.js +0 -78
  260. package/dist/scripts/utils/fix-test-modules.js +0 -27
  261. package/dist/scripts/utils/fix-timezone-issue-246.js +0 -200
  262. package/dist/scripts/utils/fix-ts-comprehensive.py +0 -182
  263. package/dist/scripts/utils/fix-ts-targeted-batch.js +0 -250
  264. package/dist/scripts/utils/remove-benchmark-conflicts.sh +0 -140
  265. package/dist/scripts/utils/simple-test-fixer.js +0 -190
  266. package/dist/scripts/utils/validate-metrics-structure.cjs +0 -144
  267. package/dist/scripts/validate-agent-hooks.js +0 -506
  268. package/dist/scripts/validate-changelog.js +0 -241
  269. package/dist/scripts/validate-coordination-cli.js +0 -69
  270. package/dist/scripts/validate-coordination-toggle-integration.cjs +0 -501
  271. package/dist/scripts/validate-docker-infrastructure.sh +0 -502
  272. package/dist/scripts/validate-entry-points.js +0 -300
  273. package/dist/scripts/validate-memory-monitoring.sh +0 -225
  274. package/dist/scripts/validate-stage3-performance.ts +0 -377
  275. package/dist/scripts/validate-template-bundling.js +0 -180
  276. package/dist/scripts/validation/README.md +0 -33
  277. package/dist/scripts/validation/acl-security-validation.cjs +0 -214
  278. package/dist/scripts/validation/acl-security-validation.js +0 -402
  279. package/dist/scripts/validation/byzantine-verification.js +0 -407
  280. package/dist/scripts/validation/final-phase-2-consensus.cjs +0 -219
  281. package/dist/scripts/validation/final-security-validation.js +0 -791
  282. package/dist/scripts/validation/final-wasm-validation.cjs +0 -840
  283. package/dist/scripts/validation/integration-test-analysis.js +0 -105
  284. package/dist/scripts/validation/phase-0-comprehensive-validation.js +0 -474
  285. package/dist/scripts/validation/phase-0-consensus-report.js +0 -139
  286. package/dist/scripts/validation/phase-0-final-report.js +0 -112
  287. package/dist/scripts/validation/phase-0-redis-consensus-report.js +0 -129
  288. package/dist/scripts/validation/phase-0-validation-improved.js +0 -490
  289. package/dist/scripts/validation/phase-0-validation-test.js +0 -65
  290. package/dist/scripts/validation/phase-1-consensus-report.cjs +0 -342
  291. package/dist/scripts/validation/phase-1-consensus-validation.cjs +0 -551
  292. package/dist/scripts/validation/phase-1-consensus-validation.js +0 -551
  293. package/dist/scripts/validation/phase-2-consensus-report.cjs +0 -186
  294. package/dist/scripts/validation/phase-2-validation.cjs +0 -171
  295. package/dist/scripts/validation/phase-2-validation.js +0 -171
  296. package/dist/scripts/validation/phase-4-consensus-report.js +0 -181
  297. package/dist/scripts/validation/phase-4-final-validation.js +0 -351
  298. package/dist/scripts/validation/phase-5-consensus-report.cjs +0 -113
  299. package/dist/scripts/validation/phase-5-consensus-report.js +0 -113
  300. package/dist/scripts/validation/security-analysis.js +0 -49
  301. package/dist/scripts/validation/security-validation.js +0 -492
  302. package/dist/scripts/validation/simple-security-validation.js +0 -464
  303. package/dist/scripts/verify-installation.js +0 -112
  304. package/dist/scripts/verify-mcp-server.js +0 -86
  305. package/dist/scripts/verify-sdk-phase1.cjs +0 -293
  306. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
  307. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
  308. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
  309. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
  310. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
  311. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
  312. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
  313. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
  314. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
  315. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
  316. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
  317. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
  318. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
  319. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
  320. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
  321. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
  322. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
  323. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
  324. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
  325. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
  326. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
  327. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
  328. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
  329. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
  330. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
  331. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
  332. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
  333. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
  334. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
  335. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
  336. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
  337. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
  338. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
  339. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
  340. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
  341. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
  342. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
  343. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
  344. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
  345. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
  346. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
  347. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
@@ -1,869 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Unified Performance Monitor - Consolidates 4+ performance scripts
5
- * Phase 12: Script Consolidation - Performance Testing & Monitoring
6
- *
7
- * Consolidates:
8
- * - performance-test-runner.js
9
- * - performance-monitor.js
10
- * - performance-monitoring.js
11
- * - build-monitor.js
12
- * - optimize-performance.js
13
- */
14
-
15
- import { promises as fs } from 'fs';
16
- import { exec } from 'child_process';
17
- import { promisify } from 'util';
18
- import path from 'path';
19
- import { EventEmitter } from 'events';
20
-
21
- const execAsync = promisify(exec);
22
-
23
- class UnifiedPerformanceMonitor extends EventEmitter {
24
- constructor() {
25
- super();
26
- this.version = '1.0.0';
27
- this.monitoring = false;
28
- this.startTime = Date.now();
29
- this.metrics = {
30
- build: { attempts: 0, successes: 0, failures: 0, avgTime: 0 },
31
- performance: { tests: 0, passed: 0, failed: 0, avgDuration: 0 },
32
- system: { cpu: [], memory: [], load: [] },
33
- errors: { total: 0, byType: {}, recent: [] }
34
- };
35
- this.thresholds = {
36
- buildTime: 300000, // 5 minutes
37
- memoryUsage: 1024, // MB
38
- cpuUsage: 80, // percentage
39
- errorRate: 0.1 // 10%
40
- };
41
- this.reportFile = null;
42
- this.logFile = null;
43
- this.setupLogging();
44
- }
45
-
46
- setupLogging() {
47
- const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
48
- this.reportFile = `reports/performance-${timestamp}.json`;
49
- this.logFile = `logs/performance-${timestamp}.log`;
50
-
51
- // Ensure directories exist
52
- this.ensureDirectories();
53
- }
54
-
55
- async ensureDirectories() {
56
- await fs.mkdir('reports', { recursive: true });
57
- await fs.mkdir('logs', { recursive: true });
58
- await fs.mkdir('.tmp-performance', { recursive: true });
59
- }
60
-
61
- log(message, level = 'info') {
62
- const timestamp = new Date().toISOString();
63
- const logEntry = `[${timestamp}] [${level.toUpperCase()}] ${message}`;
64
-
65
- console.log(logEntry);
66
-
67
- if (this.logFile) {
68
- fs.appendFile(this.logFile, logEntry + '\n').catch(() => {});
69
- }
70
- }
71
-
72
- // Performance Test Runner (from performance-test-runner.js)
73
- async runPerformanceTests(type = 'basic', options = {}) {
74
- this.log(`🚀 Starting performance tests: ${type}`);
75
-
76
- const testConfigs = {
77
- basic: {
78
- name: 'basic-cli-operations',
79
- description: 'Basic CLI command performance',
80
- duration: 30000,
81
- concurrency: 5,
82
- targetThroughput: 10,
83
- maxLatency: 1000
84
- },
85
- load: {
86
- name: 'load-test-swarm',
87
- description: 'Load test for swarm operations',
88
- duration: 300000,
89
- concurrency: parseInt(process.env.LOAD_TEST_CONCURRENCY || '50'),
90
- targetThroughput: 100,
91
- maxLatency: 2000
92
- },
93
- stress: {
94
- name: 'stress-test-agents',
95
- description: 'Stress test for agent spawning',
96
- duration: 600000,
97
- concurrency: parseInt(process.env.STRESS_TEST_MAX_CONCURRENCY || '200'),
98
- targetThroughput: 50,
99
- maxLatency: 5000
100
- },
101
- endurance: {
102
- name: 'endurance-test-memory',
103
- description: 'Endurance test for memory stability',
104
- duration: parseInt(process.env.ENDURANCE_TEST_DURATION || '3600000'),
105
- concurrency: parseInt(process.env.ENDURANCE_TEST_CONCURRENCY || '25'),
106
- targetThroughput: 20,
107
- maxLatency: 3000
108
- }
109
- };
110
-
111
- const config = testConfigs[type];
112
- if (!config) {
113
- throw new Error(`Unknown test type: ${type}`);
114
- }
115
-
116
- const startTime = Date.now();
117
- const results = {
118
- config,
119
- startTime,
120
- endTime: null,
121
- duration: null,
122
- metrics: {
123
- operations: 0,
124
- successful: 0,
125
- failed: 0,
126
- avgLatency: 0,
127
- maxLatency: 0,
128
- throughput: 0,
129
- errors: []
130
- },
131
- systemMetrics: {
132
- cpu: { avg: 0, max: 0, samples: [] },
133
- memory: { avg: 0, max: 0, samples: [] },
134
- network: { in: 0, out: 0 }
135
- }
136
- };
137
-
138
- try {
139
- // Warmup phase
140
- this.log('🔥 Warmup phase...');
141
- await this.runWarmup(config);
142
-
143
- // Main test phase
144
- this.log(`🏃 Running ${type} performance test...`);
145
- const testResult = await this.executePerformanceTest(config);
146
-
147
- results.endTime = Date.now();
148
- results.duration = results.endTime - startTime;
149
- results.metrics = testResult;
150
-
151
- // Collect system metrics
152
- const systemMetrics = await this.collectSystemMetrics();
153
- results.systemMetrics = systemMetrics;
154
-
155
- // Validate against thresholds
156
- const validation = this.validateResults(results);
157
- results.validation = validation;
158
-
159
- this.log(`✅ Performance test completed: ${type}`);
160
- this.log(`📊 Operations: ${results.metrics.operations}`);
161
- this.log(`📊 Success rate: ${((results.metrics.successful / results.metrics.operations) * 100).toFixed(2)}%`);
162
- this.log(`📊 Avg latency: ${results.metrics.avgLatency.toFixed(2)}ms`);
163
-
164
- // Update internal metrics
165
- this.metrics.performance.tests++;
166
- if (validation.passed) {
167
- this.metrics.performance.passed++;
168
- } else {
169
- this.metrics.performance.failed++;
170
- }
171
-
172
- // Save results
173
- await this.saveResults(results);
174
-
175
- return results;
176
-
177
- } catch (error) {
178
- this.log(`❌ Performance test failed: ${error.message}`, 'error');
179
- this.metrics.performance.failed++;
180
- throw error;
181
- }
182
- }
183
-
184
- async runWarmup(config) {
185
- const warmupDuration = Math.min(config.duration * 0.1, 30000); // 10% of test duration, max 30s
186
- const warmupOps = Math.ceil(config.concurrency * 2);
187
-
188
- for (let i = 0; i < warmupOps; i++) {
189
- try {
190
- await this.simulateOperation('warmup');
191
- } catch (err) {
192
- // Ignore warmup errors
193
- }
194
- }
195
-
196
- await new Promise(resolve => setTimeout(resolve, 1000));
197
- }
198
-
199
- async executePerformanceTest(config) {
200
- const operations = [];
201
- const startTime = Date.now();
202
- const endTime = startTime + config.duration;
203
- let operationCount = 0;
204
-
205
- const metrics = {
206
- operations: 0,
207
- successful: 0,
208
- failed: 0,
209
- latencies: [],
210
- errors: []
211
- };
212
-
213
- // Start monitoring
214
- const monitorInterval = setInterval(async () => {
215
- const sysMetrics = await this.getSystemSnapshot();
216
- this.metrics.system.cpu.push(sysMetrics.cpu);
217
- this.metrics.system.memory.push(sysMetrics.memory);
218
- }, 5000);
219
-
220
- try {
221
- while (Date.now() < endTime) {
222
- const batchPromises = [];
223
-
224
- // Create batch of concurrent operations
225
- for (let i = 0; i < config.concurrency && Date.now() < endTime; i++) {
226
- batchPromises.push(this.executeOperation(operationCount++));
227
- }
228
-
229
- // Wait for batch completion
230
- const batchResults = await Promise.allSettled(batchPromises);
231
-
232
- // Process results
233
- for (const result of batchResults) {
234
- metrics.operations++;
235
-
236
- if (result.status === 'fulfilled') {
237
- metrics.successful++;
238
- metrics.latencies.push(result.value.latency);
239
- } else {
240
- metrics.failed++;
241
- metrics.errors.push(result.reason.message);
242
- }
243
- }
244
-
245
- // Throttle based on target throughput
246
- const expectedOperations = ((Date.now() - startTime) / 1000) * config.targetThroughput;
247
- if (metrics.operations > expectedOperations) {
248
- await new Promise(resolve => setTimeout(resolve, 100));
249
- }
250
- }
251
-
252
- } finally {
253
- clearInterval(monitorInterval);
254
- }
255
-
256
- // Calculate final metrics
257
- metrics.avgLatency = metrics.latencies.length > 0 ?
258
- metrics.latencies.reduce((a, b) => a + b, 0) / metrics.latencies.length : 0;
259
-
260
- metrics.maxLatency = metrics.latencies.length > 0 ?
261
- Math.max(...metrics.latencies) : 0;
262
-
263
- metrics.throughput = metrics.operations / ((Date.now() - startTime) / 1000);
264
-
265
- return metrics;
266
- }
267
-
268
- async executeOperation(operationId) {
269
- const startTime = Date.now();
270
-
271
- try {
272
- // Simulate different types of operations
273
- const operationType = this.selectOperationType();
274
- await this.simulateOperation(operationType);
275
-
276
- const latency = Date.now() - startTime;
277
- return { operationId, latency, success: true };
278
-
279
- } catch (error) {
280
- const latency = Date.now() - startTime;
281
- throw { operationId, latency, success: false, error: error.message };
282
- }
283
- }
284
-
285
- selectOperationType() {
286
- const operations = ['cli-command', 'swarm-spawn', 'agent-task', 'file-operation', 'memory-operation'];
287
- return operations[Math.floor(Math.random() * operations.length)];
288
- }
289
-
290
- async simulateOperation(type) {
291
- switch (type) {
292
- case 'cli-command':
293
- return this.simulateCLICommand();
294
- case 'swarm-spawn':
295
- return this.simulateSwarmSpawn();
296
- case 'agent-task':
297
- return this.simulateAgentTask();
298
- case 'file-operation':
299
- return this.simulateFileOperation();
300
- case 'memory-operation':
301
- return this.simulateMemoryOperation();
302
- case 'warmup':
303
- return new Promise(resolve => setTimeout(resolve, Math.random() * 100));
304
- default:
305
- throw new Error(`Unknown operation type: ${type}`);
306
- }
307
- }
308
-
309
- async simulateCLICommand() {
310
- // Simulate CLI command execution
311
- const delay = 50 + Math.random() * 200; // 50-250ms
312
- await new Promise(resolve => setTimeout(resolve, delay));
313
-
314
- if (Math.random() < 0.05) { // 5% failure rate
315
- throw new Error('CLI command failed');
316
- }
317
-
318
- return { type: 'cli-command', duration: delay };
319
- }
320
-
321
- async simulateSwarmSpawn() {
322
- // Simulate swarm spawning operation
323
- const delay = 100 + Math.random() * 500; // 100-600ms
324
- await new Promise(resolve => setTimeout(resolve, delay));
325
-
326
- if (Math.random() < 0.02) { // 2% failure rate
327
- throw new Error('Swarm spawn failed');
328
- }
329
-
330
- return { type: 'swarm-spawn', duration: delay };
331
- }
332
-
333
- async simulateAgentTask() {
334
- // Simulate agent task execution
335
- const delay = 200 + Math.random() * 800; // 200-1000ms
336
- await new Promise(resolve => setTimeout(resolve, delay));
337
-
338
- if (Math.random() < 0.03) { // 3% failure rate
339
- throw new Error('Agent task failed');
340
- }
341
-
342
- return { type: 'agent-task', duration: delay };
343
- }
344
-
345
- async simulateFileOperation() {
346
- // Simulate file I/O operation
347
- try {
348
- const tempFile = `.tmp-performance/test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}.tmp`;
349
- const data = 'x'.repeat(1000 + Math.random() * 10000); // 1-11KB
350
-
351
- await fs.writeFile(tempFile, data);
352
- await fs.readFile(tempFile);
353
- await fs.unlink(tempFile);
354
-
355
- return { type: 'file-operation', size: data.length };
356
-
357
- } catch (error) {
358
- throw new Error(`File operation failed: ${error.message}`);
359
- }
360
- }
361
-
362
- async simulateMemoryOperation() {
363
- // Simulate memory-intensive operation
364
- const arraySize = 1000 + Math.random() * 10000;
365
- const data = new Array(arraySize).fill(0).map(() => Math.random());
366
-
367
- // Perform some operations
368
- data.sort();
369
- const sum = data.reduce((a, b) => a + b, 0);
370
-
371
- return { type: 'memory-operation', arraySize, sum };
372
- }
373
-
374
- // Build Monitor (from build-monitor.js)
375
- async startBuildMonitoring(options = {}) {
376
- this.log('🐝 Starting build monitoring...');
377
-
378
- const { interval = 30000, continuous = false } = options;
379
- this.monitoring = true;
380
-
381
- while (this.monitoring) {
382
- try {
383
- const buildResult = await this.checkBuildStatus();
384
- this.processBuildResult(buildResult);
385
-
386
- if (!continuous) {
387
- break;
388
- }
389
-
390
- await new Promise(resolve => setTimeout(resolve, interval));
391
-
392
- } catch (error) {
393
- this.log(`❌ Build monitoring error: ${error.message}`, 'error');
394
- this.metrics.errors.total++;
395
- }
396
- }
397
- }
398
-
399
- async checkBuildStatus() {
400
- const startTime = Date.now();
401
-
402
- try {
403
- const { stdout, stderr } = await execAsync('npm run build 2>&1');
404
- const buildOutput = stderr || stdout;
405
- const errors = this.parseBuildErrors(buildOutput);
406
-
407
- const buildTime = Date.now() - startTime;
408
-
409
- this.metrics.build.attempts++;
410
-
411
- const result = {
412
- timestamp: new Date().toISOString(),
413
- buildTime,
414
- errorCount: errors.length,
415
- errors,
416
- success: errors.length === 0,
417
- output: buildOutput
418
- };
419
-
420
- if (result.success) {
421
- this.metrics.build.successes++;
422
- } else {
423
- this.metrics.build.failures++;
424
- }
425
-
426
- this.metrics.build.avgTime =
427
- ((this.metrics.build.avgTime * (this.metrics.build.attempts - 1)) + buildTime) /
428
- this.metrics.build.attempts;
429
-
430
- return result;
431
-
432
- } catch (error) {
433
- this.metrics.build.failures++;
434
- throw error;
435
- }
436
- }
437
-
438
- parseBuildErrors(output) {
439
- if (!output) return [];
440
-
441
- const errorLines = output.split('\n').filter(line =>
442
- line.includes('error TS') ||
443
- line.includes('Error:') ||
444
- line.includes('✘ [ERROR]')
445
- );
446
-
447
- return errorLines.map(line => {
448
- const tsMatch = line.match(/([^:]+):\s*error\s+TS(\d+):\s*(.+)/);
449
- if (tsMatch) {
450
- return {
451
- type: 'typescript',
452
- file: tsMatch[1],
453
- code: tsMatch[2],
454
- message: tsMatch[3]
455
- };
456
- }
457
-
458
- return {
459
- type: 'general',
460
- message: line.trim()
461
- };
462
- });
463
- }
464
-
465
- processBuildResult(result) {
466
- if (result.success) {
467
- this.log(`✅ Build successful (${result.buildTime}ms)`);
468
- } else {
469
- this.log(`❌ Build failed with ${result.errorCount} errors`, 'error');
470
-
471
- // Track error types
472
- for (const error of result.errors) {
473
- const errorType = error.code || error.type || 'unknown';
474
- this.metrics.errors.byType[errorType] =
475
- (this.metrics.errors.byType[errorType] || 0) + 1;
476
- }
477
-
478
- this.metrics.errors.recent = result.errors.slice(-10); // Keep last 10 errors
479
- }
480
-
481
- // Emit events for external handlers
482
- this.emit('buildResult', result);
483
-
484
- if (result.buildTime > this.thresholds.buildTime) {
485
- this.emit('buildSlow', result);
486
- }
487
- }
488
-
489
- // System Metrics Collection
490
- async collectSystemMetrics() {
491
- try {
492
- const metrics = {
493
- timestamp: Date.now(),
494
- cpu: await this.getCPUUsage(),
495
- memory: await this.getMemoryUsage(),
496
- disk: await this.getDiskUsage(),
497
- network: await this.getNetworkUsage(),
498
- processes: await this.getProcessInfo()
499
- };
500
-
501
- return metrics;
502
-
503
- } catch (error) {
504
- this.log(`Warning: Could not collect system metrics: ${error.message}`, 'warn');
505
- return null;
506
- }
507
- }
508
-
509
- async getSystemSnapshot() {
510
- try {
511
- return {
512
- cpu: await this.getCPUUsage(),
513
- memory: await this.getMemoryUsage(),
514
- timestamp: Date.now()
515
- };
516
- } catch (error) {
517
- return { cpu: 0, memory: 0, timestamp: Date.now() };
518
- }
519
- }
520
-
521
- async getCPUUsage() {
522
- try {
523
- if (process.platform === 'linux') {
524
- const { stdout } = await execAsync("top -bn1 | grep 'Cpu(s)' | awk '{print $2}' | cut -d'%' -f1");
525
- return parseFloat(stdout.trim()) || 0;
526
- } else if (process.platform === 'darwin') {
527
- const { stdout } = await execAsync("top -l 1 -n 0 | grep 'CPU usage' | awk '{print $3}' | cut -d'%' -f1");
528
- return parseFloat(stdout.trim()) || 0;
529
- } else {
530
- // Windows or fallback
531
- return 0;
532
- }
533
- } catch (error) {
534
- return 0;
535
- }
536
- }
537
-
538
- async getMemoryUsage() {
539
- try {
540
- const usage = process.memoryUsage();
541
- return {
542
- rss: Math.round(usage.rss / 1024 / 1024), // MB
543
- heapTotal: Math.round(usage.heapTotal / 1024 / 1024),
544
- heapUsed: Math.round(usage.heapUsed / 1024 / 1024),
545
- external: Math.round(usage.external / 1024 / 1024)
546
- };
547
- } catch (error) {
548
- return { rss: 0, heapTotal: 0, heapUsed: 0, external: 0 };
549
- }
550
- }
551
-
552
- async getDiskUsage() {
553
- try {
554
- if (process.platform !== 'win32') {
555
- const { stdout } = await execAsync("df -h . | tail -1 | awk '{print $5}' | cut -d'%' -f1");
556
- return parseInt(stdout.trim()) || 0;
557
- }
558
- return 0;
559
- } catch (error) {
560
- return 0;
561
- }
562
- }
563
-
564
- async getNetworkUsage() {
565
- // Simplified network usage - would need more complex implementation for real metrics
566
- return { in: 0, out: 0 };
567
- }
568
-
569
- async getProcessInfo() {
570
- try {
571
- const { stdout } = await execAsync('ps aux | grep node | grep -v grep | wc -l');
572
- return {
573
- nodeProcesses: parseInt(stdout.trim()) || 0
574
- };
575
- } catch (error) {
576
- return { nodeProcesses: 0 };
577
- }
578
- }
579
-
580
- // Results validation
581
- validateResults(results) {
582
- const validation = {
583
- passed: true,
584
- issues: [],
585
- score: 100
586
- };
587
-
588
- // Check latency
589
- if (results.metrics.avgLatency > results.config.maxLatency) {
590
- validation.passed = false;
591
- validation.issues.push(`Average latency ${results.metrics.avgLatency.toFixed(2)}ms exceeds threshold ${results.config.maxLatency}ms`);
592
- validation.score -= 20;
593
- }
594
-
595
- // Check throughput
596
- const actualThroughput = results.metrics.operations / (results.duration / 1000);
597
- if (actualThroughput < results.config.targetThroughput * 0.8) {
598
- validation.passed = false;
599
- validation.issues.push(`Throughput ${actualThroughput.toFixed(2)} ops/s below 80% of target ${results.config.targetThroughput} ops/s`);
600
- validation.score -= 15;
601
- }
602
-
603
- // Check success rate
604
- const successRate = results.metrics.successful / results.metrics.operations;
605
- if (successRate < 0.95) {
606
- validation.passed = false;
607
- validation.issues.push(`Success rate ${(successRate * 100).toFixed(2)}% below 95%`);
608
- validation.score -= 25;
609
- }
610
-
611
- // Check system metrics
612
- if (results.systemMetrics && results.systemMetrics.memory.max > this.thresholds.memoryUsage) {
613
- validation.issues.push(`Peak memory usage ${results.systemMetrics.memory.max}MB exceeds threshold`);
614
- validation.score -= 10;
615
- }
616
-
617
- validation.score = Math.max(0, validation.score);
618
- return validation;
619
- }
620
-
621
- // Results management
622
- async saveResults(results) {
623
- try {
624
- // Save detailed results
625
- await fs.writeFile(this.reportFile, JSON.stringify(results, null, 2));
626
-
627
- // Save summary
628
- const summary = {
629
- timestamp: results.startTime,
630
- test: results.config.name,
631
- duration: results.duration,
632
- operations: results.metrics.operations,
633
- successRate: (results.metrics.successful / results.metrics.operations * 100).toFixed(2),
634
- avgLatency: results.metrics.avgLatency.toFixed(2),
635
- throughput: results.metrics.throughput.toFixed(2),
636
- passed: results.validation.passed,
637
- score: results.validation.score
638
- };
639
-
640
- const summaryFile = 'reports/performance-summary.json';
641
- let summaries = [];
642
-
643
- try {
644
- const existing = await fs.readFile(summaryFile, 'utf8');
645
- summaries = JSON.parse(existing);
646
- } catch (err) {
647
- // File doesn't exist, start fresh
648
- }
649
-
650
- summaries.push(summary);
651
-
652
- // Keep only last 100 results
653
- if (summaries.length > 100) {
654
- summaries = summaries.slice(-100);
655
- }
656
-
657
- await fs.writeFile(summaryFile, JSON.stringify(summaries, null, 2));
658
-
659
- this.log(`📊 Results saved to ${this.reportFile}`);
660
-
661
- } catch (error) {
662
- this.log(`❌ Failed to save results: ${error.message}`, 'error');
663
- }
664
- }
665
-
666
- // Report generation
667
- async generateReport(options = {}) {
668
- const { format = 'summary', timeframe = '24h' } = options;
669
-
670
- this.log(`📋 Generating ${format} report for ${timeframe}...`);
671
-
672
- try {
673
- const summaryFile = 'reports/performance-summary.json';
674
- const summaries = JSON.parse(await fs.readFile(summaryFile, 'utf8'));
675
-
676
- // Filter by timeframe
677
- const cutoff = Date.now() - this.parseTimeframe(timeframe);
678
- const filtered = summaries.filter(s => s.timestamp > cutoff);
679
-
680
- if (format === 'summary') {
681
- return this.generateSummaryReport(filtered);
682
- } else if (format === 'detailed') {
683
- return this.generateDetailedReport(filtered);
684
- } else if (format === 'json') {
685
- return filtered;
686
- }
687
-
688
- } catch (error) {
689
- this.log(`❌ Failed to generate report: ${error.message}`, 'error');
690
- return null;
691
- }
692
- }
693
-
694
- generateSummaryReport(data) {
695
- if (data.length === 0) {
696
- return 'No performance data found for the specified timeframe.';
697
- }
698
-
699
- const avgScore = data.reduce((sum, d) => sum + d.score, 0) / data.length;
700
- const passed = data.filter(d => d.passed).length;
701
- const failed = data.length - passed;
702
-
703
- let report = '\n📊 Performance Summary Report\n';
704
- report += '================================\n\n';
705
- report += `Total Tests: ${data.length}\n`;
706
- report += `Passed: ${passed} (${(passed/data.length*100).toFixed(1)}%)\n`;
707
- report += `Failed: ${failed} (${(failed/data.length*100).toFixed(1)}%)\n`;
708
- report += `Average Score: ${avgScore.toFixed(1)}/100\n\n`;
709
-
710
- // Test type breakdown
711
- const byType = {};
712
- data.forEach(d => {
713
- byType[d.test] = (byType[d.test] || 0) + 1;
714
- });
715
-
716
- report += 'Test Distribution:\n';
717
- Object.entries(byType).forEach(([test, count]) => {
718
- report += ` ${test}: ${count}\n`;
719
- });
720
-
721
- // Recent performance
722
- const recent = data.slice(-5);
723
- report += '\nRecent Performance:\n';
724
- recent.forEach(d => {
725
- const status = d.passed ? '✅' : '❌';
726
- report += ` ${status} ${d.test}: ${d.score}/100 (${d.successRate}% success)\n`;
727
- });
728
-
729
- return report;
730
- }
731
-
732
- generateDetailedReport(data) {
733
- // More detailed analysis would go here
734
- return this.generateSummaryReport(data) + '\n\nDetailed metrics available in JSON format.';
735
- }
736
-
737
- parseTimeframe(timeframe) {
738
- const unit = timeframe.slice(-1);
739
- const value = parseInt(timeframe.slice(0, -1));
740
-
741
- switch (unit) {
742
- case 'h': return value * 60 * 60 * 1000;
743
- case 'd': return value * 24 * 60 * 60 * 1000;
744
- case 'w': return value * 7 * 24 * 60 * 60 * 1000;
745
- default: return 24 * 60 * 60 * 1000; // Default 24h
746
- }
747
- }
748
-
749
- // Control methods
750
- stopMonitoring() {
751
- this.monitoring = false;
752
- this.log('🛑 Monitoring stopped');
753
- }
754
-
755
- getMetrics() {
756
- return {
757
- ...this.metrics,
758
- uptime: Date.now() - this.startTime,
759
- monitoring: this.monitoring
760
- };
761
- }
762
-
763
- printUsage() {
764
- console.log('Unified Performance Monitor v' + this.version);
765
- console.log('Comprehensive performance testing and monitoring utility');
766
- console.log('');
767
- console.log('Usage: node performance-monitor.js [command] [options]');
768
- console.log('');
769
- console.log('Commands:');
770
- console.log(' test [type] Run performance tests (basic|load|stress|endurance)');
771
- console.log(' monitor Start build monitoring');
772
- console.log(' report [format] Generate performance report (summary|detailed|json)');
773
- console.log(' metrics Show current metrics');
774
- console.log(' help Show this help');
775
- console.log('');
776
- console.log('Options:');
777
- console.log(' --continuous Run monitoring continuously');
778
- console.log(' --interval N Monitoring interval in ms (default: 30000)');
779
- console.log(' --timeframe T Report timeframe (24h|7d|30d, default: 24h)');
780
- console.log(' --format F Report format (summary|detailed|json)');
781
- console.log(' --dry-run Show what would be done');
782
- console.log('');
783
- console.log('Examples:');
784
- console.log(' node performance-monitor.js test basic');
785
- console.log(' node performance-monitor.js monitor --continuous');
786
- console.log(' node performance-monitor.js report --format detailed --timeframe 7d');
787
- console.log(' node performance-monitor.js metrics');
788
- }
789
- }
790
-
791
- // Main execution
792
- async function main() {
793
- const args = process.argv.slice(2);
794
- const monitor = new UnifiedPerformanceMonitor();
795
-
796
- if (args.length === 0 || args[0] === 'help' || args[0] === '--help') {
797
- monitor.printUsage();
798
- process.exit(0);
799
- }
800
-
801
- const command = args[0];
802
- const options = {};
803
-
804
- // Parse options
805
- for (let i = 1; i < args.length; i++) {
806
- const arg = args[i];
807
- if (arg === '--continuous') {
808
- options.continuous = true;
809
- } else if (arg === '--interval') {
810
- options.interval = parseInt(args[++i]) || 30000;
811
- } else if (arg === '--timeframe') {
812
- options.timeframe = args[++i] || '24h';
813
- } else if (arg === '--format') {
814
- options.format = args[++i] || 'summary';
815
- } else if (arg === '--dry-run') {
816
- options.dryRun = true;
817
- } else if (!arg.startsWith('--') && command === 'test') {
818
- options.testType = arg;
819
- }
820
- }
821
-
822
- try {
823
- switch (command) {
824
- case 'test':
825
- const testType = options.testType || 'basic';
826
- const result = await monitor.runPerformanceTests(testType, options);
827
- console.log(`\n🎯 Test Result: ${result.validation.passed ? 'PASSED' : 'FAILED'}`);
828
- console.log(`📊 Score: ${result.validation.score}/100`);
829
- break;
830
-
831
- case 'monitor':
832
- await monitor.startBuildMonitoring(options);
833
- break;
834
-
835
- case 'report':
836
- const report = await monitor.generateReport(options);
837
- console.log(report);
838
- break;
839
-
840
- case 'metrics':
841
- const metrics = monitor.getMetrics();
842
- console.log(JSON.stringify(metrics, null, 2));
843
- break;
844
-
845
- default:
846
- console.error(`Unknown command: ${command}`);
847
- monitor.printUsage();
848
- process.exit(1);
849
- }
850
-
851
- // Coordination hook
852
- try {
853
- await execAsync('npx claude-flow@alpha hooks post-edit --file "performance-monitor" --memory-key "swarm/phase12/performance"');
854
- } catch (err) {
855
- // Ignore hook errors
856
- }
857
-
858
- } catch (error) {
859
- console.error('❌ Error:', error.message);
860
- process.exit(1);
861
- }
862
- }
863
-
864
- // Execute if run directly
865
- if (import.meta.url === `file://${process.argv[1]}`) {
866
- main();
867
- }
868
-
869
- export { UnifiedPerformanceMonitor };