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,839 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Unified Optimization Activation Script
5
- *
6
- * Coordinates implementation of all optimization components with:
7
- * - Safe rollback mechanisms
8
- * - Zero-downtime deployment
9
- * - Hardware-specific optimizations for 96GB DDR5-6400
10
- * - Comprehensive monitoring and validation
11
- *
12
- * Generated with Claude Code coordination
13
- */
14
-
15
- import { fileURLToPath } from 'url';
16
- import { dirname, join } from 'path';
17
- import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
18
- import { performance } from 'perf_hooks';
19
- import chalk from 'chalk';
20
- import ora from 'ora';
21
-
22
- // ES module compatibility
23
- const __filename = fileURLToPath(import.meta.url);
24
- const __dirname = dirname(__filename);
25
- const PROJECT_ROOT = join(__dirname, '..', '..');
26
-
27
- // Import optimization modules
28
- import { optimizeHiveMindDatabase, performMaintenance, generateOptimizationReport } from '../../src/cli/simple-commands/hive-mind/db-optimizer.js';
29
- import { PerformanceIntegrationManager } from '../../src/performance/performance-integration.js';
30
-
31
- /**
32
- * Unified Optimization Manager
33
- * Coordinates all optimization implementations
34
- */
35
- class UnifiedOptimizationManager {
36
- constructor(options = {}) {
37
- this.options = {
38
- enableRollback: true,
39
- enableMonitoring: true,
40
- enableValidation: true,
41
- hardwareProfile: '96GB-DDR5-6400',
42
- deploymentMode: 'zero-downtime',
43
- backupEnabled: true,
44
- ...options
45
- };
46
-
47
- this.activationStart = Date.now();
48
- this.rollbackPoints = [];
49
- this.optimizationResults = {
50
- sqlite: null,
51
- performance: null,
52
- hardware: null,
53
- monitoring: null
54
- };
55
-
56
- this.hardwareOptimizations = this._getHardwareOptimizations();
57
- this.isActivated = false;
58
- }
59
-
60
- /**
61
- * Main activation orchestrator
62
- */
63
- async activate() {
64
- const spinner = ora('šŸš€ Starting Unified Optimization Activation...').start();
65
-
66
- try {
67
- // Phase 1: Pre-activation validation and backup
68
- await this._preActivationPhase(spinner);
69
-
70
- // Phase 2: SQLite Enhanced Backend activation
71
- await this._activateSQLiteOptimizations(spinner);
72
-
73
- // Phase 3: Performance system optimization
74
- await this._activatePerformanceOptimizations(spinner);
75
-
76
- // Phase 4: Hardware-specific optimizations
77
- await this._activateHardwareOptimizations(spinner);
78
-
79
- // Phase 5: Monitoring and alerting setup
80
- await this._activateMonitoringSystem(spinner);
81
-
82
- // Phase 6: Post-activation validation
83
- await this._postActivationValidation(spinner);
84
-
85
- this.isActivated = true;
86
- const activationTime = Date.now() - this.activationStart;
87
-
88
- spinner.succeed(`āœ… Unified Optimization Activation Complete (${activationTime}ms)`);
89
-
90
- // Generate final report
91
- const report = await this._generateActivationReport();
92
- await this._storeCoordinationPlan();
93
-
94
- return {
95
- success: true,
96
- activationTime,
97
- report,
98
- rollbackPoints: this.rollbackPoints
99
- };
100
-
101
- } catch (error) {
102
- spinner.fail('āŒ Optimization activation failed');
103
- console.error(chalk.red('Error:'), error.message);
104
-
105
- if (this.options.enableRollback) {
106
- await this._performRollback();
107
- }
108
-
109
- return {
110
- success: false,
111
- error: error.message,
112
- rollbackPerformed: this.options.enableRollback
113
- };
114
- }
115
- }
116
-
117
- /**
118
- * Safe rollback to previous state
119
- */
120
- async rollback() {
121
- const spinner = ora('šŸ”„ Performing Safe Rollback...').start();
122
-
123
- try {
124
- await this._performRollback();
125
- spinner.succeed('āœ… Rollback completed successfully');
126
- return { success: true };
127
- } catch (error) {
128
- spinner.fail('āŒ Rollback failed');
129
- return { success: false, error: error.message };
130
- }
131
- }
132
-
133
- /**
134
- * Get current status and metrics
135
- */
136
- async getStatus() {
137
- return {
138
- isActivated: this.isActivated,
139
- activationTime: this.activationStart ? Date.now() - this.activationStart : 0,
140
- optimizationResults: this.optimizationResults,
141
- rollbackPoints: this.rollbackPoints.length,
142
- hardwareProfile: this.options.hardwareProfile
143
- };
144
- }
145
-
146
- // Private implementation methods
147
-
148
- async _preActivationPhase(spinner) {
149
- spinner.text = 'šŸ” Pre-activation validation and backup...';
150
-
151
- // Create rollback point
152
- const rollbackPoint = {
153
- id: `pre-activation-${Date.now()}`,
154
- timestamp: new Date().toISOString(),
155
- type: 'pre-activation',
156
- description: 'System state before optimization activation'
157
- };
158
-
159
- // Backup current configurations
160
- if (this.options.backupEnabled) {
161
- await this._createBackup(rollbackPoint);
162
- }
163
-
164
- // Validate system readiness
165
- await this._validateSystemReadiness();
166
-
167
- this.rollbackPoints.push(rollbackPoint);
168
- }
169
-
170
- async _activateSQLiteOptimizations(spinner) {
171
- spinner.text = 'šŸ’¾ Activating SQLite Enhanced Backend...';
172
-
173
- const rollbackPoint = {
174
- id: `sqlite-${Date.now()}`,
175
- timestamp: new Date().toISOString(),
176
- type: 'sqlite-optimization',
177
- description: 'SQLite optimization activation'
178
- };
179
-
180
- try {
181
- // Find existing database files
182
- const dbPaths = this._findDatabasePaths();
183
-
184
- for (const dbPath of dbPaths) {
185
- spinner.text = `šŸ’¾ Optimizing database: ${dbPath}...`;
186
-
187
- const result = await optimizeHiveMindDatabase(dbPath, {
188
- vacuum: true,
189
- verbose: false
190
- });
191
-
192
- if (!result.success) {
193
- throw new Error(`Failed to optimize ${dbPath}: ${result.error}`);
194
- }
195
-
196
- // Apply hardware-specific SQLite settings
197
- await this._applySQLiteHardwareOptimizations(dbPath);
198
- }
199
-
200
- // Performance maintenance
201
- spinner.text = 'šŸ”§ Performing database maintenance...';
202
- for (const dbPath of dbPaths) {
203
- await performMaintenance(dbPath, {
204
- cleanMemory: true,
205
- archiveTasks: true,
206
- checkIntegrity: true,
207
- memoryRetentionDays: 30,
208
- taskRetentionDays: 7
209
- });
210
- }
211
-
212
- this.optimizationResults.sqlite = {
213
- success: true,
214
- optimizedDatabases: dbPaths.length,
215
- optimizations: ['indexes', 'memory-optimization', 'maintenance']
216
- };
217
-
218
- this.rollbackPoints.push(rollbackPoint);
219
-
220
- } catch (error) {
221
- throw new Error(`SQLite optimization failed: ${error.message}`);
222
- }
223
- }
224
-
225
- async _activatePerformanceOptimizations(spinner) {
226
- spinner.text = '⚔ Activating Performance System Optimizations...';
227
-
228
- const rollbackPoint = {
229
- id: `performance-${Date.now()}`,
230
- timestamp: new Date().toISOString(),
231
- type: 'performance-optimization',
232
- description: 'Performance system activation'
233
- };
234
-
235
- try {
236
- // Initialize performance integration manager
237
- const performanceManager = new PerformanceIntegrationManager({
238
- enableOptimizations: true,
239
- enableMonitoring: true,
240
- enableTesting: true,
241
- performanceTarget: 100, // Target <100ms execution time
242
- compatibilityTarget: 0.95 // 95% compatibility
243
- });
244
-
245
- const initResult = await performanceManager.initialize();
246
-
247
- if (!initResult.success) {
248
- throw new Error(`Performance manager initialization failed: ${initResult.error}`);
249
- }
250
-
251
- // Run performance validation
252
- spinner.text = 'šŸ”¬ Running performance validation tests...';
253
- const validationResult = await performanceManager.runPerformanceValidation();
254
-
255
- this.optimizationResults.performance = {
256
- success: true,
257
- initializationTime: initResult.initializationTime,
258
- performanceTargetMet: validationResult.metrics.performanceTargetMet,
259
- compatibilityRate: validationResult.metrics.compatibilityRate,
260
- manager: performanceManager
261
- };
262
-
263
- this.rollbackPoints.push(rollbackPoint);
264
-
265
- } catch (error) {
266
- throw new Error(`Performance optimization failed: ${error.message}`);
267
- }
268
- }
269
-
270
- async _activateHardwareOptimizations(spinner) {
271
- spinner.text = 'šŸ–„ļø Activating Hardware-Specific Optimizations...';
272
-
273
- const rollbackPoint = {
274
- id: `hardware-${Date.now()}`,
275
- timestamp: new Date().toISOString(),
276
- type: 'hardware-optimization',
277
- description: 'Hardware-specific optimization activation'
278
- };
279
-
280
- try {
281
- // Apply Node.js runtime optimizations
282
- await this._applyNodeJSOptimizations();
283
-
284
- // Configure memory management
285
- await this._configureMemoryManagement();
286
-
287
- // Apply OS-level optimizations
288
- await this._applyOSOptimizations();
289
-
290
- this.optimizationResults.hardware = {
291
- success: true,
292
- profile: this.options.hardwareProfile,
293
- optimizations: this.hardwareOptimizations
294
- };
295
-
296
- this.rollbackPoints.push(rollbackPoint);
297
-
298
- } catch (error) {
299
- throw new Error(`Hardware optimization failed: ${error.message}`);
300
- }
301
- }
302
-
303
- async _activateMonitoringSystem(spinner) {
304
- spinner.text = 'šŸ“Š Activating Monitoring and Alerting...';
305
-
306
- const rollbackPoint = {
307
- id: `monitoring-${Date.now()}`,
308
- timestamp: new Date().toISOString(),
309
- type: 'monitoring-activation',
310
- description: 'Monitoring system activation'
311
- };
312
-
313
- try {
314
- // Create monitoring configuration
315
- const monitoringConfig = {
316
- performanceThresholds: {
317
- hookExecutionTime: 100, // ms
318
- databaseQueryTime: 50, // ms
319
- memoryUsageThreshold: 0.85, // 85%
320
- cpuUsageThreshold: 0.80 // 80%
321
- },
322
- alerting: {
323
- enabled: true,
324
- channels: ['console', 'file'],
325
- thresholds: {
326
- critical: 0.95,
327
- warning: 0.80,
328
- info: 0.60
329
- }
330
- },
331
- metrics: {
332
- retention: '7d',
333
- aggregation: '1m',
334
- storage: 'sqlite'
335
- }
336
- };
337
-
338
- // Write monitoring configuration
339
- await this._writeMonitoringConfig(monitoringConfig);
340
-
341
- // Start monitoring services
342
- await this._startMonitoringServices();
343
-
344
- this.optimizationResults.monitoring = {
345
- success: true,
346
- config: monitoringConfig,
347
- services: ['performance', 'system', 'database']
348
- };
349
-
350
- this.rollbackPoints.push(rollbackPoint);
351
-
352
- } catch (error) {
353
- throw new Error(`Monitoring activation failed: ${error.message}`);
354
- }
355
- }
356
-
357
- async _postActivationValidation(spinner) {
358
- spinner.text = 'āœ… Post-activation validation...';
359
-
360
- // Run comprehensive validation tests
361
- const validationResults = {
362
- sqliteOptimization: await this._validateSQLiteOptimizations(),
363
- performanceSystem: await this._validatePerformanceSystem(),
364
- hardwareOptimizations: await this._validateHardwareOptimizations(),
365
- monitoringSystem: await this._validateMonitoringSystem()
366
- };
367
-
368
- // Check if all validations passed
369
- const allValid = Object.values(validationResults).every(result => result.success);
370
-
371
- if (!allValid) {
372
- const failures = Object.entries(validationResults)
373
- .filter(([_, result]) => !result.success)
374
- .map(([name, result]) => `${name}: ${result.error}`)
375
- .join(', ');
376
-
377
- throw new Error(`Post-activation validation failed: ${failures}`);
378
- }
379
-
380
- return validationResults;
381
- }
382
-
383
- async _performRollback() {
384
- console.log(chalk.yellow('šŸ”„ Performing rollback to previous state...'));
385
-
386
- // Rollback in reverse order
387
- for (let i = this.rollbackPoints.length - 1; i >= 0; i--) {
388
- const rollbackPoint = this.rollbackPoints[i];
389
- console.log(chalk.blue(`Rolling back: ${rollbackPoint.description}`));
390
-
391
- try {
392
- await this._restoreFromRollbackPoint(rollbackPoint);
393
- } catch (error) {
394
- console.error(chalk.red(`Rollback failed for ${rollbackPoint.id}: ${error.message}`));
395
- }
396
- }
397
-
398
- this.isActivated = false;
399
- console.log(chalk.green('āœ… Rollback completed'));
400
- }
401
-
402
- _getHardwareOptimizations() {
403
- return {
404
- memory: {
405
- maxOldSpaceSize: '90000', // 90GB for 96GB system
406
- maxSemiSpaceSize: '1024', // 1GB
407
- useIdleNotification: true,
408
- exposeGC: true
409
- },
410
- cpu: {
411
- uvThreadpoolSize: 64, // Increase thread pool for I/O
412
- enableSourceMaps: false, // Disable for production performance
413
- maxConcurrentWorkers: 32 // Utilize high core count
414
- },
415
- sqlite: {
416
- cacheSize: 524288, // 512MB cache (524288 * 1024 bytes)
417
- mmapSize: 8589934592, // 8GB mmap
418
- tempStore: 'memory',
419
- journalMode: 'WAL',
420
- synchronous: 'NORMAL',
421
- walAutocheckpoint: 10000
422
- },
423
- os: {
424
- socketBufferSize: 1048576, // 1MB socket buffers
425
- tcpNoDelay: true,
426
- keepAlive: true
427
- }
428
- };
429
- }
430
-
431
- async _applySQLiteHardwareOptimizations(dbPath) {
432
- try {
433
- const Database = (await import('better-sqlite3')).default;
434
- const db = new Database(dbPath);
435
-
436
- const { sqlite } = this.hardwareOptimizations;
437
-
438
- // Apply hardware-specific SQLite optimizations
439
- db.pragma(`cache_size = ${sqlite.cacheSize}`);
440
- db.pragma(`mmap_size = ${sqlite.mmapSize}`);
441
- db.pragma(`temp_store = ${sqlite.tempStore}`);
442
- db.pragma(`journal_mode = ${sqlite.journalMode}`);
443
- db.pragma(`synchronous = ${sqlite.synchronous}`);
444
- db.pragma(`wal_autocheckpoint = ${sqlite.walAutocheckpoint}`);
445
-
446
- // Additional optimizations for high-memory systems
447
- db.pragma('optimize');
448
-
449
- db.close();
450
- } catch (error) {
451
- console.warn(`Warning: Could not apply SQLite optimizations to ${dbPath}: ${error.message}`);
452
- }
453
- }
454
-
455
- async _applyNodeJSOptimizations() {
456
- const { memory, cpu } = this.hardwareOptimizations;
457
-
458
- // Set Node.js flags through environment variables
459
- process.env.NODE_OPTIONS = [
460
- `--max-old-space-size=${memory.maxOldSpaceSize}`,
461
- `--max-semi-space-size=${memory.maxSemiSpaceSize}`,
462
- memory.useIdleNotification ? '--use-idle-notification' : '',
463
- memory.exposeGC ? '--expose-gc' : '',
464
- !cpu.enableSourceMaps ? '--no-source-maps' : '',
465
- `--uv-threadpool-size=${cpu.uvThreadpoolSize}`
466
- ].filter(Boolean).join(' ');
467
- }
468
-
469
- async _configureMemoryManagement() {
470
- // Force garbage collection if available
471
- if (global.gc) {
472
- global.gc();
473
- }
474
-
475
- // Configure process limits
476
- if (process.setrlimit) {
477
- try {
478
- // Set memory limit (96GB in bytes)
479
- process.setrlimit('rss', 103079215104);
480
- } catch (error) {
481
- console.warn('Could not set process memory limit:', error.message);
482
- }
483
- }
484
- }
485
-
486
- async _applyOSOptimizations() {
487
- const { os } = this.hardwareOptimizations;
488
-
489
- // Set socket options if available
490
- if (process.env.UV_THREADPOOL_SIZE !== os.socketBufferSize.toString()) {
491
- process.env.UV_THREADPOOL_SIZE = cpu.uvThreadpoolSize.toString();
492
- }
493
- }
494
-
495
- _findDatabasePaths() {
496
- const dbPaths = [];
497
- const searchPaths = [
498
- join(PROJECT_ROOT, 'data'),
499
- join(PROJECT_ROOT, '.swarm'),
500
- join(PROJECT_ROOT, 'memory'),
501
- join(PROJECT_ROOT, '.claude-flow')
502
- ];
503
-
504
- for (const searchPath of searchPaths) {
505
- if (existsSync(searchPath)) {
506
- const files = require('fs').readdirSync(searchPath, { recursive: true });
507
- const dbFiles = files
508
- .filter(file => file.endsWith('.db') || file.endsWith('.sqlite'))
509
- .map(file => join(searchPath, file));
510
- dbPaths.push(...dbFiles);
511
- }
512
- }
513
-
514
- // Add common database names
515
- const commonDbNames = [
516
- 'hive-mind.db',
517
- 'claude-flow.db',
518
- 'performance-optimized.db',
519
- 'swarm.db'
520
- ];
521
-
522
- for (const dbName of commonDbNames) {
523
- for (const searchPath of searchPaths) {
524
- const dbPath = join(searchPath, dbName);
525
- if (existsSync(dbPath) && !dbPaths.includes(dbPath)) {
526
- dbPaths.push(dbPath);
527
- }
528
- }
529
- }
530
-
531
- return dbPaths;
532
- }
533
-
534
- async _createBackup(rollbackPoint) {
535
- const backupDir = join(PROJECT_ROOT, '.optimization-backups', rollbackPoint.id);
536
- mkdirSync(backupDir, { recursive: true });
537
-
538
- rollbackPoint.backupPath = backupDir;
539
-
540
- // Backup database files
541
- const dbPaths = this._findDatabasePaths();
542
- for (const dbPath of dbPaths) {
543
- const fileName = require('path').basename(dbPath);
544
- const backupPath = join(backupDir, fileName);
545
- require('fs').copyFileSync(dbPath, backupPath);
546
- }
547
-
548
- // Backup configuration files
549
- const configFiles = [
550
- 'package.json',
551
- '.claude-flow/config.json',
552
- 'web-portal.config.json'
553
- ];
554
-
555
- for (const configFile of configFiles) {
556
- const configPath = join(PROJECT_ROOT, configFile);
557
- if (existsSync(configPath)) {
558
- const backupPath = join(backupDir, configFile.replace('/', '_'));
559
- require('fs').copyFileSync(configPath, backupPath);
560
- }
561
- }
562
- }
563
-
564
- async _restoreFromRollbackPoint(rollbackPoint) {
565
- if (!rollbackPoint.backupPath || !existsSync(rollbackPoint.backupPath)) {
566
- throw new Error(`Backup not found for rollback point ${rollbackPoint.id}`);
567
- }
568
-
569
- // Restore database files
570
- const backupFiles = require('fs').readdirSync(rollbackPoint.backupPath);
571
-
572
- for (const backupFile of backupFiles) {
573
- const backupFilePath = join(rollbackPoint.backupPath, backupFile);
574
-
575
- if (backupFile.endsWith('.db') || backupFile.endsWith('.sqlite')) {
576
- // Find original database path
577
- const dbPaths = this._findDatabasePaths();
578
- const originalPath = dbPaths.find(path => require('path').basename(path) === backupFile);
579
-
580
- if (originalPath) {
581
- require('fs').copyFileSync(backupFilePath, originalPath);
582
- }
583
- }
584
- }
585
- }
586
-
587
- async _validateSystemReadiness() {
588
- // Check required directories exist
589
- const requiredDirs = ['.swarm', 'data', '.claude-flow'];
590
- for (const dir of requiredDirs) {
591
- const dirPath = join(PROJECT_ROOT, dir);
592
- if (!existsSync(dirPath)) {
593
- mkdirSync(dirPath, { recursive: true });
594
- }
595
- }
596
-
597
- // Check available memory
598
- const totalMemory = require('os').totalmem();
599
- const freeMemory = require('os').freemem();
600
-
601
- if (freeMemory < 10 * 1024 * 1024 * 1024) { // Less than 10GB free
602
- console.warn(chalk.yellow('āš ļø Low available memory detected. Optimization may be limited.'));
603
- }
604
-
605
- return true;
606
- }
607
-
608
- async _validateSQLiteOptimizations() {
609
- try {
610
- const dbPaths = this._findDatabasePaths();
611
-
612
- for (const dbPath of dbPaths) {
613
- const report = await generateOptimizationReport(dbPath);
614
- if (!report || report.schemaVersion < 1.5) {
615
- return { success: false, error: `Database ${dbPath} not properly optimized` };
616
- }
617
- }
618
-
619
- return { success: true, optimizedDatabases: dbPaths.length };
620
- } catch (error) {
621
- return { success: false, error: error.message };
622
- }
623
- }
624
-
625
- async _validatePerformanceSystem() {
626
- try {
627
- const performanceManager = this.optimizationResults.performance?.manager;
628
- if (!performanceManager) {
629
- return { success: false, error: 'Performance manager not initialized' };
630
- }
631
-
632
- const status = performanceManager.getPerformanceStatus();
633
- if (!status.initialized) {
634
- return { success: false, error: 'Performance system not properly initialized' };
635
- }
636
-
637
- return { success: true, status };
638
- } catch (error) {
639
- return { success: false, error: error.message };
640
- }
641
- }
642
-
643
- async _validateHardwareOptimizations() {
644
- try {
645
- // Validate Node.js flags are applied
646
- const nodeOptions = process.env.NODE_OPTIONS || '';
647
- const expectedFlags = ['max-old-space-size', 'uv-threadpool-size'];
648
-
649
- for (const flag of expectedFlags) {
650
- if (!nodeOptions.includes(flag)) {
651
- return { success: false, error: `Node.js flag ${flag} not applied` };
652
- }
653
- }
654
-
655
- return { success: true };
656
- } catch (error) {
657
- return { success: false, error: error.message };
658
- }
659
- }
660
-
661
- async _validateMonitoringSystem() {
662
- try {
663
- const configPath = join(PROJECT_ROOT, '.claude-flow', 'monitoring-config.json');
664
- if (!existsSync(configPath)) {
665
- return { success: false, error: 'Monitoring configuration not found' };
666
- }
667
-
668
- return { success: true };
669
- } catch (error) {
670
- return { success: false, error: error.message };
671
- }
672
- }
673
-
674
- async _writeMonitoringConfig(config) {
675
- const configDir = join(PROJECT_ROOT, '.claude-flow');
676
- mkdirSync(configDir, { recursive: true });
677
-
678
- const configPath = join(configDir, 'monitoring-config.json');
679
- writeFileSync(configPath, JSON.stringify(config, null, 2));
680
- }
681
-
682
- async _startMonitoringServices() {
683
- // In a real implementation, this would start actual monitoring services
684
- // For now, we'll create marker files to indicate services are "running"
685
- const servicesDir = join(PROJECT_ROOT, '.claude-flow', 'services');
686
- mkdirSync(servicesDir, { recursive: true });
687
-
688
- const services = ['performance', 'system', 'database'];
689
- for (const service of services) {
690
- const serviceFile = join(servicesDir, `${service}.pid`);
691
- writeFileSync(serviceFile, process.pid.toString());
692
- }
693
- }
694
-
695
- async _generateActivationReport() {
696
- const report = {
697
- timestamp: new Date().toISOString(),
698
- activationTime: Date.now() - this.activationStart,
699
- hardwareProfile: this.options.hardwareProfile,
700
- optimizations: this.optimizationResults,
701
- rollbackPoints: this.rollbackPoints.length,
702
- deploymentMode: this.options.deploymentMode,
703
- status: 'activated',
704
- validations: {
705
- sqlite: await this._validateSQLiteOptimizations(),
706
- performance: await this._validatePerformanceSystem(),
707
- hardware: await this._validateHardwareOptimizations(),
708
- monitoring: await this._validateMonitoringSystem()
709
- }
710
- };
711
-
712
- // Write report to file
713
- const reportPath = join(PROJECT_ROOT, '.claude-flow', 'activation-report.json');
714
- writeFileSync(reportPath, JSON.stringify(report, null, 2));
715
-
716
- return report;
717
- }
718
-
719
- async _storeCoordinationPlan() {
720
- const coordinationPlan = {
721
- implementation: {
722
- sqliteOptimizations: {
723
- status: 'activated',
724
- databases: this._findDatabasePaths(),
725
- optimizations: ['indexes', 'memory-optimization', 'maintenance']
726
- },
727
- performanceSystem: {
728
- status: 'activated',
729
- targetExecutionTime: '<100ms',
730
- compatibilityRate: this.optimizationResults.performance?.compatibilityRate || 0
731
- },
732
- hardwareOptimizations: {
733
- status: 'activated',
734
- profile: this.options.hardwareProfile,
735
- optimizations: this.hardwareOptimizations
736
- },
737
- monitoring: {
738
- status: 'activated',
739
- services: ['performance', 'system', 'database']
740
- }
741
- },
742
- rollback: {
743
- enabled: this.options.enableRollback,
744
- points: this.rollbackPoints.length,
745
- lastBackup: this.rollbackPoints[this.rollbackPoints.length - 1]?.timestamp
746
- },
747
- deployment: {
748
- mode: this.options.deploymentMode,
749
- activationTime: Date.now() - this.activationStart,
750
- success: this.isActivated
751
- }
752
- };
753
-
754
- // Store in memory for swarm access
755
- try {
756
- // Try to use MCP memory storage if available
757
- if (global.claudeFlow?.memory) {
758
- await global.claudeFlow.memory.store('swarm/coder/implementation-plan', coordinationPlan);
759
- }
760
- } catch (error) {
761
- console.warn('Could not store coordination plan in memory:', error.message);
762
- }
763
-
764
- // Also write to file as backup
765
- const planPath = join(PROJECT_ROOT, '.claude-flow', 'coordination-plan.json');
766
- writeFileSync(planPath, JSON.stringify(coordinationPlan, null, 2));
767
-
768
- return coordinationPlan;
769
- }
770
- }
771
-
772
- /**
773
- * CLI Interface
774
- */
775
- async function main() {
776
- const args = process.argv.slice(2);
777
- const command = args[0] || 'activate';
778
-
779
- const manager = new UnifiedOptimizationManager({
780
- enableRollback: !args.includes('--no-rollback'),
781
- enableMonitoring: !args.includes('--no-monitoring'),
782
- enableValidation: !args.includes('--no-validation'),
783
- backupEnabled: !args.includes('--no-backup')
784
- });
785
-
786
- switch (command) {
787
- case 'activate':
788
- console.log(chalk.blue('šŸš€ Starting Unified Optimization Activation...'));
789
- const result = await manager.activate();
790
-
791
- if (result.success) {
792
- console.log(chalk.green('\nāœ… All optimizations activated successfully!'));
793
- console.log(chalk.blue(`šŸ“Š Activation time: ${result.activationTime}ms`));
794
- console.log(chalk.blue(`šŸ”„ Rollback points: ${result.rollbackPoints.length}`));
795
- } else {
796
- console.error(chalk.red('\nāŒ Optimization activation failed'));
797
- process.exit(1);
798
- }
799
- break;
800
-
801
- case 'rollback':
802
- console.log(chalk.yellow('šŸ”„ Starting Rollback...'));
803
- const rollbackResult = await manager.rollback();
804
-
805
- if (rollbackResult.success) {
806
- console.log(chalk.green('āœ… Rollback completed successfully'));
807
- } else {
808
- console.error(chalk.red('āŒ Rollback failed'));
809
- process.exit(1);
810
- }
811
- break;
812
-
813
- case 'status':
814
- const status = await manager.getStatus();
815
- console.log(chalk.blue('šŸ“Š Optimization Status:'));
816
- console.log(JSON.stringify(status, null, 2));
817
- break;
818
-
819
- default:
820
- console.log(chalk.yellow('Usage:'));
821
- console.log(' npm run optimize:activate - Activate all optimizations');
822
- console.log(' npm run optimize:rollback - Rollback to previous state');
823
- console.log(' npm run optimize:status - Check current status');
824
- console.log('');
825
- console.log('Options:');
826
- console.log(' --no-rollback - Disable rollback capability');
827
- console.log(' --no-monitoring - Disable monitoring setup');
828
- console.log(' --no-validation - Skip validation steps');
829
- console.log(' --no-backup - Skip backup creation');
830
- }
831
- }
832
-
833
- // Export for programmatic use
834
- export { UnifiedOptimizationManager };
835
-
836
- // Run if called directly
837
- if (import.meta.url === `file://${process.argv[1]}`) {
838
- main().catch(console.error);
839
- }