kynjal-cli 3.1.3 → 4.0.0

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 (566) hide show
  1. package/.claude/agents/core/coder.md +1 -1
  2. package/.claude/agents/core/planner.md +2 -2
  3. package/.claude/agents/core/researcher.md +1 -1
  4. package/.claude/agents/core/reviewer.md +1 -1
  5. package/.claude/agents/core/tester.md +1 -1
  6. package/.claude/agents/data/data-ml-model.md +4 -4
  7. package/.claude/agents/development/dev-backend-api.md +4 -4
  8. package/.claude/agents/documentation/docs-api-openapi.md +4 -4
  9. package/.claude/agents/github/code-review-swarm.md +2 -2
  10. package/.claude/agents/github/issue-tracker.md +2 -2
  11. package/.claude/agents/github/pr-manager.md +2 -2
  12. package/.claude/agents/github/release-manager.md +2 -2
  13. package/.claude/agents/github/workflow-automation.md +2 -2
  14. package/.claude/agents/sparc/architecture.md +3 -3
  15. package/.claude/agents/sparc/pseudocode.md +2 -2
  16. package/.claude/agents/sparc/refinement.md +3 -3
  17. package/.claude/agents/sparc/specification.md +2 -2
  18. package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
  19. package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
  20. package/.claude/agents/swarm/mesh-coordinator.md +1 -1
  21. package/.claude/agents/templates/base-template-generator.md +25 -4
  22. package/.claude/agents/templates/sparc-coordinator.md +3 -3
  23. package/.claude/helpers/auto-commit.sh +1 -1
  24. package/.claude/helpers/auto-memory-hook.mjs +27 -9
  25. package/.claude/helpers/hook-handler.cjs +58 -18
  26. package/.claude/helpers/statusline.cjs +14 -33
  27. package/.claude/helpers/statusline.js +3 -3
  28. package/.claude/settings.json +9 -9
  29. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  30. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  31. package/README.md +383 -170
  32. package/bin/cli.js +6 -6
  33. package/bin/mcp-server.js +1 -1
  34. package/bin/preinstall.cjs +2 -0
  35. package/dist/src/appliance/gguf-engine.js +664 -0
  36. package/dist/src/appliance/gguf-engine.js.map +1 -0
  37. package/dist/src/appliance/ruvllm-bridge.js +492 -0
  38. package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
  39. package/dist/src/appliance/rvfa-builder.js +383 -0
  40. package/dist/src/appliance/rvfa-builder.js.map +1 -0
  41. package/dist/src/appliance/rvfa-distribution.js +533 -0
  42. package/dist/src/appliance/rvfa-distribution.js.map +1 -0
  43. package/dist/src/appliance/rvfa-format.js +465 -0
  44. package/dist/src/appliance/rvfa-format.js.map +1 -0
  45. package/dist/src/appliance/rvfa-runner.js +373 -0
  46. package/dist/src/appliance/rvfa-runner.js.map +1 -0
  47. package/dist/src/appliance/rvfa-signing.js +469 -0
  48. package/dist/src/appliance/rvfa-signing.js.map +1 -0
  49. package/dist/src/benchmarks/pretrain/index.js +542 -331
  50. package/dist/src/benchmarks/pretrain/index.js.map +1 -1
  51. package/dist/src/commands/agent.d.ts.map +1 -1
  52. package/dist/src/commands/agent.js +725 -502
  53. package/dist/src/commands/agent.js.map +1 -1
  54. package/dist/src/commands/analyze.js +1548 -1218
  55. package/dist/src/commands/analyze.js.map +1 -1
  56. package/dist/src/commands/appliance-advanced.d.ts +9 -0
  57. package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
  58. package/dist/src/commands/appliance-advanced.js +324 -0
  59. package/dist/src/commands/appliance-advanced.js.map +1 -0
  60. package/dist/src/commands/appliance.d.ts +8 -0
  61. package/dist/src/commands/appliance.d.ts.map +1 -0
  62. package/dist/src/commands/appliance.js +581 -0
  63. package/dist/src/commands/appliance.js.map +1 -0
  64. package/dist/src/commands/benchmark.js +523 -372
  65. package/dist/src/commands/benchmark.js.map +1 -1
  66. package/dist/src/commands/claims.js +364 -274
  67. package/dist/src/commands/claims.js.map +1 -1
  68. package/dist/src/commands/cleanup.d.ts +13 -0
  69. package/dist/src/commands/cleanup.d.ts.map +1 -0
  70. package/dist/src/commands/cleanup.js +262 -0
  71. package/dist/src/commands/cleanup.js.map +1 -0
  72. package/dist/src/commands/completions.js +118 -477
  73. package/dist/src/commands/completions.js.map +1 -1
  74. package/dist/src/commands/config.js +303 -237
  75. package/dist/src/commands/config.js.map +1 -1
  76. package/dist/src/commands/daemon.d.ts.map +1 -1
  77. package/dist/src/commands/daemon.js +597 -425
  78. package/dist/src/commands/daemon.js.map +1 -1
  79. package/dist/src/commands/deployment.js +275 -194
  80. package/dist/src/commands/deployment.js.map +1 -1
  81. package/dist/src/commands/doctor.d.ts.map +1 -1
  82. package/dist/src/commands/doctor.js +690 -460
  83. package/dist/src/commands/doctor.js.map +1 -1
  84. package/dist/src/commands/embeddings.js +1543 -1293
  85. package/dist/src/commands/embeddings.js.map +1 -1
  86. package/dist/src/commands/guidance.js +596 -449
  87. package/dist/src/commands/guidance.js.map +1 -1
  88. package/dist/src/commands/hive-mind.js +938 -854
  89. package/dist/src/commands/hive-mind.js.map +1 -1
  90. package/dist/src/commands/hooks.d.ts.map +1 -1
  91. package/dist/src/commands/hooks.js +3677 -2570
  92. package/dist/src/commands/hooks.js.map +1 -1
  93. package/dist/src/commands/index.js +322 -122
  94. package/dist/src/commands/index.js.map +1 -1
  95. package/dist/src/commands/init.d.ts +1 -1
  96. package/dist/src/commands/init.d.ts.map +1 -1
  97. package/dist/src/commands/init.js +943 -787
  98. package/dist/src/commands/init.js.map +1 -1
  99. package/dist/src/commands/issues.js +558 -383
  100. package/dist/src/commands/issues.js.map +1 -1
  101. package/dist/src/commands/mcp.d.ts.map +1 -1
  102. package/dist/src/commands/mcp.js +605 -475
  103. package/dist/src/commands/mcp.js.map +1 -1
  104. package/dist/src/commands/memory.d.ts.map +1 -1
  105. package/dist/src/commands/memory.js +1031 -814
  106. package/dist/src/commands/memory.js.map +1 -1
  107. package/dist/src/commands/migrate.js +347 -282
  108. package/dist/src/commands/migrate.js.map +1 -1
  109. package/dist/src/commands/neural.d.ts.map +1 -1
  110. package/dist/src/commands/neural.js +1563 -1283
  111. package/dist/src/commands/neural.js.map +1 -1
  112. package/dist/src/commands/performance.js +643 -497
  113. package/dist/src/commands/performance.js.map +1 -1
  114. package/dist/src/commands/plugins.js +841 -668
  115. package/dist/src/commands/plugins.js.map +1 -1
  116. package/dist/src/commands/process.js +447 -392
  117. package/dist/src/commands/process.js.map +1 -1
  118. package/dist/src/commands/progress.js +256 -162
  119. package/dist/src/commands/progress.js.map +1 -1
  120. package/dist/src/commands/providers.js +220 -150
  121. package/dist/src/commands/providers.js.map +1 -1
  122. package/dist/src/commands/route.js +665 -520
  123. package/dist/src/commands/route.js.map +1 -1
  124. package/dist/src/commands/ruvector/backup.js +651 -505
  125. package/dist/src/commands/ruvector/backup.js.map +1 -1
  126. package/dist/src/commands/ruvector/benchmark.js +401 -349
  127. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  128. package/dist/src/commands/ruvector/import.js +267 -225
  129. package/dist/src/commands/ruvector/import.js.map +1 -1
  130. package/dist/src/commands/ruvector/index.js +75 -37
  131. package/dist/src/commands/ruvector/index.js.map +1 -1
  132. package/dist/src/commands/ruvector/init.js +359 -336
  133. package/dist/src/commands/ruvector/init.js.map +1 -1
  134. package/dist/src/commands/ruvector/migrate.js +322 -335
  135. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  136. package/dist/src/commands/ruvector/optimize.js +431 -375
  137. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  138. package/dist/src/commands/ruvector/setup.js +117 -703
  139. package/dist/src/commands/ruvector/setup.js.map +1 -1
  140. package/dist/src/commands/ruvector/status.js +419 -364
  141. package/dist/src/commands/ruvector/status.js.map +1 -1
  142. package/dist/src/commands/security.d.ts.map +1 -1
  143. package/dist/src/commands/security.js +610 -456
  144. package/dist/src/commands/security.js.map +1 -1
  145. package/dist/src/commands/session.d.ts +1 -1
  146. package/dist/src/commands/session.js +627 -505
  147. package/dist/src/commands/session.js.map +1 -1
  148. package/dist/src/commands/start.d.ts +1 -1
  149. package/dist/src/commands/start.js +368 -271
  150. package/dist/src/commands/start.js.map +1 -1
  151. package/dist/src/commands/status.d.ts +1 -1
  152. package/dist/src/commands/status.d.ts.map +1 -1
  153. package/dist/src/commands/status.js +492 -379
  154. package/dist/src/commands/status.js.map +1 -1
  155. package/dist/src/commands/swarm.js +488 -408
  156. package/dist/src/commands/swarm.js.map +1 -1
  157. package/dist/src/commands/task.d.ts +1 -1
  158. package/dist/src/commands/task.js +539 -424
  159. package/dist/src/commands/task.js.map +1 -1
  160. package/dist/src/commands/transfer-store.js +412 -322
  161. package/dist/src/commands/transfer-store.js.map +1 -1
  162. package/dist/src/commands/update.js +291 -196
  163. package/dist/src/commands/update.js.map +1 -1
  164. package/dist/src/commands/workflow.js +486 -386
  165. package/dist/src/commands/workflow.js.map +1 -1
  166. package/dist/src/config-adapter.js +40 -39
  167. package/dist/src/config-adapter.js.map +1 -1
  168. package/dist/src/index.js +416 -312
  169. package/dist/src/index.js.map +1 -1
  170. package/dist/src/infrastructure/in-memory-repositories.js +507 -246
  171. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
  172. package/dist/src/init/claudemd-generator.js +78 -368
  173. package/dist/src/init/claudemd-generator.js.map +1 -1
  174. package/dist/src/init/executor.js +1019 -1345
  175. package/dist/src/init/executor.js.map +1 -1
  176. package/dist/src/init/helpers-generator.js +60 -635
  177. package/dist/src/init/helpers-generator.js.map +1 -1
  178. package/dist/src/init/index.d.ts +1 -1
  179. package/dist/src/init/index.d.ts.map +1 -1
  180. package/dist/src/init/index.js +1 -1
  181. package/dist/src/init/index.js.map +1 -1
  182. package/dist/src/init/mcp-generator.d.ts +0 -1
  183. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  184. package/dist/src/init/mcp-generator.js +62 -42
  185. package/dist/src/init/mcp-generator.js.map +1 -1
  186. package/dist/src/init/settings-generator.d.ts.map +1 -1
  187. package/dist/src/init/settings-generator.js +167 -100
  188. package/dist/src/init/settings-generator.js.map +1 -1
  189. package/dist/src/init/statusline-generator.d.ts +16 -8
  190. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  191. package/dist/src/init/statusline-generator.js +20 -1300
  192. package/dist/src/init/statusline-generator.js.map +1 -1
  193. package/dist/src/init/types.d.ts +15 -5
  194. package/dist/src/init/types.d.ts.map +1 -1
  195. package/dist/src/init/types.js +66 -76
  196. package/dist/src/init/types.js.map +1 -1
  197. package/dist/src/mcp-client.js +130 -76
  198. package/dist/src/mcp-client.js.map +1 -1
  199. package/dist/src/mcp-server.js +758 -445
  200. package/dist/src/mcp-server.js.map +1 -1
  201. package/dist/src/mcp-tools/agent-tools.js +492 -391
  202. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
  204. package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
  205. package/dist/src/mcp-tools/agentdb-tools.js +758 -0
  206. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
  207. package/dist/src/mcp-tools/analyze-tools.js +236 -172
  208. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  209. package/dist/src/mcp-tools/auto-install.js +142 -80
  210. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  211. package/dist/src/mcp-tools/browser-tools.js +375 -252
  212. package/dist/src/mcp-tools/browser-tools.js.map +1 -1
  213. package/dist/src/mcp-tools/claims-tools.js +565 -473
  214. package/dist/src/mcp-tools/claims-tools.js.map +1 -1
  215. package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
  216. package/dist/src/mcp-tools/config-tools.js +284 -190
  217. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  218. package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
  219. package/dist/src/mcp-tools/coordination-tools.js +600 -349
  220. package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
  221. package/dist/src/mcp-tools/daa-tools.js +367 -289
  222. package/dist/src/mcp-tools/daa-tools.js.map +1 -1
  223. package/dist/src/mcp-tools/embeddings-tools.js +693 -582
  224. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  225. package/dist/src/mcp-tools/github-tools.js +312 -261
  226. package/dist/src/mcp-tools/github-tools.js.map +1 -1
  227. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  228. package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
  229. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  230. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  231. package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
  232. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  233. package/dist/src/mcp-tools/index.d.ts +2 -0
  234. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  235. package/dist/src/mcp-tools/index.js +2 -0
  236. package/dist/src/mcp-tools/index.js.map +1 -1
  237. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  238. package/dist/src/mcp-tools/memory-tools.js +514 -329
  239. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  240. package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
  241. package/dist/src/mcp-tools/neural-tools.js +428 -326
  242. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  243. package/dist/src/mcp-tools/performance-tools.js +480 -420
  244. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  245. package/dist/src/mcp-tools/progress-tools.js +278 -204
  246. package/dist/src/mcp-tools/progress-tools.js.map +1 -1
  247. package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
  248. package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
  249. package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
  250. package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
  251. package/dist/src/mcp-tools/security-tools.js +429 -297
  252. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  253. package/dist/src/mcp-tools/session-tools.js +234 -185
  254. package/dist/src/mcp-tools/session-tools.js.map +1 -1
  255. package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
  256. package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
  257. package/dist/src/mcp-tools/swarm-tools.js +303 -64
  258. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  259. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  260. package/dist/src/mcp-tools/system-tools.js +352 -200
  261. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  262. package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
  263. package/dist/src/mcp-tools/task-tools.js +357 -189
  264. package/dist/src/mcp-tools/task-tools.js.map +1 -1
  265. package/dist/src/mcp-tools/terminal-tools.js +196 -148
  266. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  267. package/dist/src/mcp-tools/transfer-tools.js +333 -186
  268. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  269. package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
  270. package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
  271. package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
  272. package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
  273. package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
  274. package/dist/src/mcp-tools/workflow-tools.js +471 -335
  275. package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
  276. package/dist/src/memory/ewc-consolidation.js +345 -173
  277. package/dist/src/memory/ewc-consolidation.js.map +1 -1
  278. package/dist/src/memory/intelligence.js +841 -359
  279. package/dist/src/memory/intelligence.js.map +1 -1
  280. package/dist/src/memory/memory-bridge.js +1964 -0
  281. package/dist/src/memory/memory-bridge.js.map +1 -0
  282. package/dist/src/memory/memory-initializer.js +1895 -1602
  283. package/dist/src/memory/memory-initializer.js.map +1 -1
  284. package/dist/src/memory/sona-optimizer.js +329 -199
  285. package/dist/src/memory/sona-optimizer.js.map +1 -1
  286. package/dist/src/output.d.ts +2 -2
  287. package/dist/src/output.d.ts.map +1 -1
  288. package/dist/src/output.js +273 -242
  289. package/dist/src/output.js.map +1 -1
  290. package/dist/src/parser.js +217 -124
  291. package/dist/src/parser.js.map +1 -1
  292. package/dist/src/plugins/manager.js +531 -278
  293. package/dist/src/plugins/manager.js.map +1 -1
  294. package/dist/src/plugins/store/discovery.js +362 -275
  295. package/dist/src/plugins/store/discovery.js.map +1 -1
  296. package/dist/src/plugins/store/index.js +105 -48
  297. package/dist/src/plugins/store/index.js.map +1 -1
  298. package/dist/src/plugins/store/search.js +107 -69
  299. package/dist/src/plugins/store/search.js.map +1 -1
  300. package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
  301. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
  302. package/dist/src/plugins/tests/standalone-test.js +223 -172
  303. package/dist/src/plugins/tests/standalone-test.js.map +1 -1
  304. package/dist/src/plugins/tests/test-plugin-store.js +228 -190
  305. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
  306. package/dist/src/production/circuit-breaker.js +126 -62
  307. package/dist/src/production/circuit-breaker.js.map +1 -1
  308. package/dist/src/production/error-handler.js +156 -86
  309. package/dist/src/production/error-handler.js.map +1 -1
  310. package/dist/src/production/monitoring.js +220 -139
  311. package/dist/src/production/monitoring.js.map +1 -1
  312. package/dist/src/production/rate-limiter.js +93 -74
  313. package/dist/src/production/rate-limiter.js.map +1 -1
  314. package/dist/src/production/retry.js +167 -75
  315. package/dist/src/production/retry.js.map +1 -1
  316. package/dist/src/prompt.js +560 -436
  317. package/dist/src/prompt.js.map +1 -1
  318. package/dist/src/runtime/headless.js +289 -200
  319. package/dist/src/runtime/headless.js.map +1 -1
  320. package/dist/src/ruvector/agent-wasm.js +511 -0
  321. package/dist/src/ruvector/agent-wasm.js.map +1 -0
  322. package/dist/src/ruvector/ast-analyzer.js +232 -145
  323. package/dist/src/ruvector/ast-analyzer.js.map +1 -1
  324. package/dist/src/ruvector/coverage-router.js +419 -287
  325. package/dist/src/ruvector/coverage-router.js.map +1 -1
  326. package/dist/src/ruvector/coverage-tools.js +101 -56
  327. package/dist/src/ruvector/coverage-tools.js.map +1 -1
  328. package/dist/src/ruvector/diff-classifier.js +451 -324
  329. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  330. package/dist/src/ruvector/enhanced-model-router.js +337 -251
  331. package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
  332. package/dist/src/ruvector/flash-attention.js +254 -223
  333. package/dist/src/ruvector/flash-attention.js.map +1 -1
  334. package/dist/src/ruvector/graph-analyzer.js +680 -486
  335. package/dist/src/ruvector/graph-analyzer.js.map +1 -1
  336. package/dist/src/ruvector/index.js +113 -27
  337. package/dist/src/ruvector/index.js.map +1 -1
  338. package/dist/src/ruvector/lora-adapter.js +248 -155
  339. package/dist/src/ruvector/lora-adapter.js.map +1 -1
  340. package/dist/src/ruvector/model-router.js +248 -175
  341. package/dist/src/ruvector/model-router.js.map +1 -1
  342. package/dist/src/ruvector/moe-router.js +286 -228
  343. package/dist/src/ruvector/moe-router.js.map +1 -1
  344. package/dist/src/ruvector/q-learning-router.js +338 -257
  345. package/dist/src/ruvector/q-learning-router.js.map +1 -1
  346. package/dist/src/ruvector/ruvllm-wasm.js +527 -0
  347. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
  348. package/dist/src/ruvector/semantic-router.js +67 -60
  349. package/dist/src/ruvector/semantic-router.js.map +1 -1
  350. package/dist/src/ruvector/vector-db.js +205 -119
  351. package/dist/src/ruvector/vector-db.js.map +1 -1
  352. package/dist/src/services/agentic-flow-bridge.js +168 -0
  353. package/dist/src/services/agentic-flow-bridge.js.map +1 -0
  354. package/dist/src/services/claim-service.js +940 -615
  355. package/dist/src/services/claim-service.js.map +1 -1
  356. package/dist/src/services/container-worker-pool.js +669 -399
  357. package/dist/src/services/container-worker-pool.js.map +1 -1
  358. package/dist/src/services/headless-worker-executor.js +467 -441
  359. package/dist/src/services/headless-worker-executor.js.map +1 -1
  360. package/dist/src/services/index.d.ts +5 -5
  361. package/dist/src/services/index.d.ts.map +1 -1
  362. package/dist/src/services/index.js +4 -4
  363. package/dist/src/services/index.js.map +1 -1
  364. package/dist/src/services/registry-api.js +201 -93
  365. package/dist/src/services/registry-api.js.map +1 -1
  366. package/dist/src/services/ruvector-training.js +414 -144
  367. package/dist/src/services/ruvector-training.js.map +1 -1
  368. package/dist/src/services/worker-daemon.js +928 -531
  369. package/dist/src/services/worker-daemon.js.map +1 -1
  370. package/dist/src/services/worker-queue.js +550 -331
  371. package/dist/src/services/worker-queue.js.map +1 -1
  372. package/dist/src/suggest.js +55 -45
  373. package/dist/src/suggest.js.map +1 -1
  374. package/dist/src/transfer/anonymization/index.js +37 -29
  375. package/dist/src/transfer/anonymization/index.js.map +1 -1
  376. package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
  377. package/dist/src/transfer/deploy-seraphine.js +156 -129
  378. package/dist/src/transfer/deploy-seraphine.js.map +1 -1
  379. package/dist/src/transfer/export.js +142 -84
  380. package/dist/src/transfer/export.js.map +1 -1
  381. package/dist/src/transfer/index.d.ts +1 -1
  382. package/dist/src/transfer/index.d.ts.map +1 -1
  383. package/dist/src/transfer/index.js +2 -0
  384. package/dist/src/transfer/index.js.map +1 -1
  385. package/dist/src/transfer/ipfs/client.js +337 -179
  386. package/dist/src/transfer/ipfs/client.js.map +1 -1
  387. package/dist/src/transfer/ipfs/upload.js +434 -290
  388. package/dist/src/transfer/ipfs/upload.js.map +1 -1
  389. package/dist/src/transfer/models/seraphine.js +58 -58
  390. package/dist/src/transfer/models/seraphine.js.map +1 -1
  391. package/dist/src/transfer/serialization/cfp.js +37 -33
  392. package/dist/src/transfer/serialization/cfp.js.map +1 -1
  393. package/dist/src/transfer/storage/gcs.js +248 -139
  394. package/dist/src/transfer/storage/gcs.js.map +1 -1
  395. package/dist/src/transfer/store/discovery.js +353 -243
  396. package/dist/src/transfer/store/discovery.js.map +1 -1
  397. package/dist/src/transfer/store/download.js +365 -243
  398. package/dist/src/transfer/store/download.js.map +1 -1
  399. package/dist/src/transfer/store/index.js +130 -63
  400. package/dist/src/transfer/store/index.js.map +1 -1
  401. package/dist/src/transfer/store/publish.js +258 -184
  402. package/dist/src/transfer/store/publish.js.map +1 -1
  403. package/dist/src/transfer/store/registry.js +73 -51
  404. package/dist/src/transfer/store/registry.js.map +1 -1
  405. package/dist/src/transfer/store/search.js +96 -64
  406. package/dist/src/transfer/store/search.js.map +1 -1
  407. package/dist/src/transfer/store/tests/standalone-test.js +231 -174
  408. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
  409. package/dist/src/transfer/test-seraphine.js +130 -95
  410. package/dist/src/transfer/test-seraphine.js.map +1 -1
  411. package/dist/src/transfer/tests/test-store.js +239 -194
  412. package/dist/src/transfer/tests/test-store.js.map +1 -1
  413. package/dist/src/types.js +56 -27
  414. package/dist/src/types.js.map +1 -1
  415. package/dist/src/update/checker.js +183 -106
  416. package/dist/src/update/checker.js.map +1 -1
  417. package/dist/src/update/executor.js +198 -135
  418. package/dist/src/update/executor.js.map +1 -1
  419. package/dist/src/update/index.js +85 -38
  420. package/dist/src/update/index.js.map +1 -1
  421. package/dist/src/update/rate-limiter.js +31 -19
  422. package/dist/src/update/rate-limiter.js.map +1 -1
  423. package/dist/src/update/validator.js +64 -38
  424. package/dist/src/update/validator.js.map +1 -1
  425. package/dist/tsconfig.tsbuildinfo +1 -1
  426. package/package.json +13 -10
  427. package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
  428. package/.claude/agents/custom/design-architect.yaml +0 -48
  429. package/.claude/agents/custom/ui-developer.yaml +0 -46
  430. package/.claude/agents/custom/ux-researcher.yaml +0 -60
  431. package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
  432. package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
  433. package/dist/src/commands/index.d.ts +0 -108
  434. package/dist/src/commands/index.d.ts.map +0 -1
  435. package/dist/src/config-adapter.d.ts +0 -15
  436. package/dist/src/config-adapter.d.ts.map +0 -1
  437. package/dist/src/index.d.ts +0 -76
  438. package/dist/src/index.d.ts.map +0 -1
  439. package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  440. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
  441. package/dist/src/init/claudemd-generator.d.ts +0 -25
  442. package/dist/src/init/claudemd-generator.d.ts.map +0 -1
  443. package/dist/src/init/executor.d.ts +0 -41
  444. package/dist/src/init/executor.d.ts.map +0 -1
  445. package/dist/src/init/helpers-generator.d.ts +0 -60
  446. package/dist/src/init/helpers-generator.d.ts.map +0 -1
  447. package/dist/src/mcp-client.d.ts +0 -92
  448. package/dist/src/mcp-client.d.ts.map +0 -1
  449. package/dist/src/mcp-server.d.ts +0 -161
  450. package/dist/src/mcp-server.d.ts.map +0 -1
  451. package/dist/src/mcp-tools/auto-install.d.ts +0 -83
  452. package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
  453. package/dist/src/mcp-tools/types.d.ts +0 -31
  454. package/dist/src/mcp-tools/types.d.ts.map +0 -1
  455. package/dist/src/memory/ewc-consolidation.d.ts +0 -271
  456. package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
  457. package/dist/src/memory/intelligence.d.ts +0 -285
  458. package/dist/src/memory/intelligence.d.ts.map +0 -1
  459. package/dist/src/memory/memory-initializer.d.ts +0 -396
  460. package/dist/src/memory/memory-initializer.d.ts.map +0 -1
  461. package/dist/src/memory/sona-optimizer.d.ts +0 -227
  462. package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
  463. package/dist/src/parser.d.ts +0 -41
  464. package/dist/src/parser.d.ts.map +0 -1
  465. package/dist/src/plugins/manager.d.ts +0 -133
  466. package/dist/src/plugins/manager.d.ts.map +0 -1
  467. package/dist/src/plugins/store/discovery.d.ts +0 -88
  468. package/dist/src/plugins/store/discovery.d.ts.map +0 -1
  469. package/dist/src/plugins/store/index.d.ts +0 -76
  470. package/dist/src/plugins/store/index.d.ts.map +0 -1
  471. package/dist/src/plugins/store/search.d.ts +0 -46
  472. package/dist/src/plugins/store/search.d.ts.map +0 -1
  473. package/dist/src/plugins/store/types.d.ts +0 -274
  474. package/dist/src/plugins/store/types.d.ts.map +0 -1
  475. package/dist/src/production/circuit-breaker.d.ts +0 -101
  476. package/dist/src/production/circuit-breaker.d.ts.map +0 -1
  477. package/dist/src/production/error-handler.d.ts +0 -92
  478. package/dist/src/production/error-handler.d.ts.map +0 -1
  479. package/dist/src/production/monitoring.d.ts +0 -161
  480. package/dist/src/production/monitoring.d.ts.map +0 -1
  481. package/dist/src/production/rate-limiter.d.ts +0 -80
  482. package/dist/src/production/rate-limiter.d.ts.map +0 -1
  483. package/dist/src/production/retry.d.ts +0 -48
  484. package/dist/src/production/retry.d.ts.map +0 -1
  485. package/dist/src/prompt.d.ts +0 -44
  486. package/dist/src/prompt.d.ts.map +0 -1
  487. package/dist/src/runtime/headless.d.ts +0 -60
  488. package/dist/src/runtime/headless.d.ts.map +0 -1
  489. package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
  490. package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
  491. package/dist/src/ruvector/coverage-router.d.ts +0 -160
  492. package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
  493. package/dist/src/ruvector/diff-classifier.d.ts +0 -175
  494. package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
  495. package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
  496. package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
  497. package/dist/src/ruvector/flash-attention.d.ts +0 -195
  498. package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
  499. package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
  500. package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
  501. package/dist/src/ruvector/index.d.ts +0 -34
  502. package/dist/src/ruvector/index.d.ts.map +0 -1
  503. package/dist/src/ruvector/lora-adapter.d.ts +0 -218
  504. package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
  505. package/dist/src/ruvector/model-router.d.ts +0 -220
  506. package/dist/src/ruvector/model-router.d.ts.map +0 -1
  507. package/dist/src/ruvector/moe-router.d.ts +0 -206
  508. package/dist/src/ruvector/moe-router.d.ts.map +0 -1
  509. package/dist/src/ruvector/q-learning-router.d.ts +0 -211
  510. package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
  511. package/dist/src/ruvector/semantic-router.d.ts +0 -77
  512. package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
  513. package/dist/src/ruvector/vector-db.d.ts +0 -69
  514. package/dist/src/ruvector/vector-db.d.ts.map +0 -1
  515. package/dist/src/services/claim-service.d.ts +0 -204
  516. package/dist/src/services/claim-service.d.ts.map +0 -1
  517. package/dist/src/services/container-worker-pool.d.ts +0 -197
  518. package/dist/src/services/container-worker-pool.d.ts.map +0 -1
  519. package/dist/src/services/headless-worker-executor.d.ts +0 -304
  520. package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
  521. package/dist/src/services/registry-api.d.ts +0 -58
  522. package/dist/src/services/registry-api.d.ts.map +0 -1
  523. package/dist/src/services/ruvector-training.d.ts +0 -213
  524. package/dist/src/services/ruvector-training.d.ts.map +0 -1
  525. package/dist/src/services/worker-daemon.d.ts +0 -203
  526. package/dist/src/services/worker-daemon.d.ts.map +0 -1
  527. package/dist/src/services/worker-queue.d.ts +0 -194
  528. package/dist/src/services/worker-queue.d.ts.map +0 -1
  529. package/dist/src/suggest.d.ts +0 -53
  530. package/dist/src/suggest.d.ts.map +0 -1
  531. package/dist/src/transfer/export.d.ts +0 -25
  532. package/dist/src/transfer/export.d.ts.map +0 -1
  533. package/dist/src/transfer/ipfs/client.d.ts +0 -109
  534. package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
  535. package/dist/src/transfer/ipfs/upload.d.ts +0 -95
  536. package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
  537. package/dist/src/transfer/models/seraphine.d.ts +0 -72
  538. package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
  539. package/dist/src/transfer/serialization/cfp.d.ts +0 -49
  540. package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
  541. package/dist/src/transfer/storage/gcs.d.ts +0 -82
  542. package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
  543. package/dist/src/transfer/store/discovery.d.ts +0 -84
  544. package/dist/src/transfer/store/discovery.d.ts.map +0 -1
  545. package/dist/src/transfer/store/download.d.ts +0 -70
  546. package/dist/src/transfer/store/download.d.ts.map +0 -1
  547. package/dist/src/transfer/store/index.d.ts +0 -84
  548. package/dist/src/transfer/store/index.d.ts.map +0 -1
  549. package/dist/src/transfer/store/publish.d.ts +0 -76
  550. package/dist/src/transfer/store/publish.d.ts.map +0 -1
  551. package/dist/src/transfer/store/search.d.ts +0 -54
  552. package/dist/src/transfer/store/search.d.ts.map +0 -1
  553. package/dist/src/transfer/types.d.ts +0 -245
  554. package/dist/src/transfer/types.d.ts.map +0 -1
  555. package/dist/src/types.d.ts +0 -198
  556. package/dist/src/types.d.ts.map +0 -1
  557. package/dist/src/update/checker.d.ts +0 -34
  558. package/dist/src/update/checker.d.ts.map +0 -1
  559. package/dist/src/update/executor.d.ts +0 -32
  560. package/dist/src/update/executor.d.ts.map +0 -1
  561. package/dist/src/update/index.d.ts +0 -33
  562. package/dist/src/update/index.d.ts.map +0 -1
  563. package/dist/src/update/rate-limiter.d.ts +0 -20
  564. package/dist/src/update/rate-limiter.d.ts.map +0 -1
  565. package/dist/src/update/validator.d.ts +0 -17
  566. package/dist/src/update/validator.d.ts.map +0 -1
@@ -1,174 +1,253 @@
1
1
  /**
2
2
  * Diff Classifier for Change Analysis
3
3
  */
4
- const DEFAULT_CONFIG = {
4
+ var __assign = (this && this.__assign) || function () {
5
+ __assign = Object.assign || function(t) {
6
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7
+ s = arguments[i];
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
+ t[p] = s[p];
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (_) try {
31
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
52
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
53
+ if (ar || !(i in from)) {
54
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
55
+ ar[i] = from[i];
56
+ }
57
+ }
58
+ return to.concat(ar || Array.prototype.slice.call(from));
59
+ };
60
+ var DEFAULT_CONFIG = {
5
61
  maxDiffSize: 10000,
6
62
  classifyByImpact: true,
7
63
  detectRefactoring: true,
8
- minConfidence: 0.5,
64
+ minConfidence: 0.5
9
65
  };
10
- const CLASSIFICATION_PATTERNS = {
66
+ var CLASSIFICATION_PATTERNS = {
11
67
  feature: [/^feat/, /add.*feature/, /implement/, /new.*functionality/i],
12
68
  bugfix: [/^fix/, /bug/, /patch/, /resolve.*issue/i, /hotfix/i],
13
69
  refactor: [/^refactor/, /restructure/, /reorganize/, /cleanup/i, /rename/i],
14
70
  docs: [/^docs?/, /documentation/, /readme/i, /comment/i, /\.md$/i],
15
71
  test: [/^test/, /spec/, /\.test\.[jt]sx?$/, /\.spec\.[jt]sx?$/, /__tests__/],
16
72
  config: [/^config/, /\.config\./, /package\.json/, /tsconfig/, /\.env/],
17
- style: [/^style/, /format/, /lint/, /prettier/, /eslint/],
73
+ style: [/^style/, /format/, /lint/, /prettier/, /eslint/]
18
74
  };
19
- const IMPACT_KEYWORDS = {
75
+ var IMPACT_KEYWORDS = {
20
76
  security: 3, auth: 3, payment: 3, database: 2, api: 2, core: 2,
21
- util: 1, helper: 1, test: 0, mock: 0, fixture: 0,
77
+ util: 1, helper: 1, test: 0, mock: 0, fixture: 0
22
78
  };
23
- export class DiffClassifier {
24
- config;
25
- ruvectorEngine = null;
26
- useNative = false;
27
- classificationCache = new Map();
28
- constructor(config = {}) {
29
- this.config = { ...DEFAULT_CONFIG, ...config };
30
- }
31
- async initialize() {
32
- try {
33
- // @ruvector/diff is optional - gracefully fallback if not installed
34
- const ruvector = await import('@ruvector/diff').catch(() => null);
35
- if (ruvector) {
36
- this.ruvectorEngine = ruvector.createDiffClassifier?.(this.config);
37
- this.useNative = !!this.ruvectorEngine;
38
- }
39
- }
40
- catch {
41
- this.useNative = false;
42
- }
43
- }
44
- parseDiff(diffContent) {
45
- const files = [];
46
- const fileBlocks = diffContent.split(/^diff --git/m).filter(Boolean);
47
- for (const block of fileBlocks) {
48
- const pathMatch = block.match(/a\/(.+?)\s+b\/(.+)/);
79
+ var DiffClassifier = /** @class */ (function () {
80
+ function DiffClassifier(config) {
81
+ if (config === void 0) { config = {}; }
82
+ this.ruvectorEngine = null;
83
+ this.useNative = false;
84
+ this.classificationCache = new Map();
85
+ this.config = __assign(__assign({}, DEFAULT_CONFIG), config);
86
+ }
87
+ DiffClassifier.prototype.initialize = function () {
88
+ var _a, _b;
89
+ return __awaiter(this, void 0, Promise, function () {
90
+ var ruvector, _c;
91
+ return __generator(this, function (_d) {
92
+ switch (_d.label) {
93
+ case 0:
94
+ _d.trys.push([0, 2, , 3]);
95
+ return [4 /*yield*/, import('@ruvector/diff')["catch"](function () { return null; })];
96
+ case 1:
97
+ ruvector = _d.sent();
98
+ if (ruvector) {
99
+ this.ruvectorEngine = (_b = (_a = ruvector).createDiffClassifier) === null || _b === void 0 ? void 0 : _b.call(_a, this.config);
100
+ this.useNative = !!this.ruvectorEngine;
101
+ }
102
+ return [3 /*break*/, 3];
103
+ case 2:
104
+ _c = _d.sent();
105
+ this.useNative = false;
106
+ return [3 /*break*/, 3];
107
+ case 3: return [2 /*return*/];
108
+ }
109
+ });
110
+ });
111
+ };
112
+ DiffClassifier.prototype.parseDiff = function (diffContent) {
113
+ var files = [];
114
+ var fileBlocks = diffContent.split(/^diff --git/m).filter(Boolean);
115
+ for (var _i = 0, fileBlocks_1 = fileBlocks; _i < fileBlocks_1.length; _i++) {
116
+ var block = fileBlocks_1[_i];
117
+ var pathMatch = block.match(/a\/(.+?)\s+b\/(.+)/);
49
118
  if (!pathMatch)
50
119
  continue;
51
- const path = pathMatch[2];
52
- const hunks = this.parseHunks(block);
53
- const additions = hunks.reduce((sum, h) => sum + h.changes.filter(c => c.type === 'add').length, 0);
54
- const deletions = hunks.reduce((sum, h) => sum + h.changes.filter(c => c.type === 'remove').length, 0);
55
- const classification = this.classifyFile(path, hunks);
56
- files.push({ path, hunks, additions, deletions, classification });
120
+ var path = pathMatch[2];
121
+ var hunks = this.parseHunks(block);
122
+ var additions = hunks.reduce(function (sum, h) { return sum + h.changes.filter(function (c) { return c.type === 'add'; }).length; }, 0);
123
+ var deletions = hunks.reduce(function (sum, h) { return sum + h.changes.filter(function (c) { return c.type === 'remove'; }).length; }, 0);
124
+ var classification = this.classifyFile(path, hunks);
125
+ files.push({ path: path, hunks: hunks, additions: additions, deletions: deletions, classification: classification });
57
126
  }
58
127
  return files;
59
- }
60
- classify(files) {
61
- const overall = this.computeOverallClassification(files);
62
- const stats = {
63
- totalAdditions: files.reduce((sum, f) => sum + f.additions, 0),
64
- totalDeletions: files.reduce((sum, f) => sum + f.deletions, 0),
128
+ };
129
+ DiffClassifier.prototype.classify = function (files) {
130
+ var overall = this.computeOverallClassification(files);
131
+ var stats = {
132
+ totalAdditions: files.reduce(function (sum, f) { return sum + f.additions; }, 0),
133
+ totalDeletions: files.reduce(function (sum, f) { return sum + f.deletions; }, 0),
65
134
  filesChanged: files.length,
66
- avgConfidence: files.length > 0 ? files.reduce((sum, f) => sum + f.classification.confidence, 0) / files.length : 0,
135
+ avgConfidence: files.length > 0 ? files.reduce(function (sum, f) { return sum + f.classification.confidence; }, 0) / files.length : 0
67
136
  };
68
- return { files, overall, stats, timestamp: Date.now() };
69
- }
70
- classifyCommitMessage(message) {
71
- const lowerMessage = message.toLowerCase();
72
- for (const [type, patterns] of Object.entries(CLASSIFICATION_PATTERNS)) {
73
- for (const pattern of patterns) {
137
+ return { files: files, overall: overall, stats: stats, timestamp: Date.now() };
138
+ };
139
+ DiffClassifier.prototype.classifyCommitMessage = function (message) {
140
+ var lowerMessage = message.toLowerCase();
141
+ for (var _i = 0, _a = Object.entries(CLASSIFICATION_PATTERNS); _i < _a.length; _i++) {
142
+ var _b = _a[_i], type = _b[0], patterns = _b[1];
143
+ for (var _c = 0, patterns_1 = patterns; _c < patterns_1.length; _c++) {
144
+ var pattern = patterns_1[_c];
74
145
  if (pattern.test(lowerMessage))
75
146
  return type;
76
147
  }
77
148
  }
78
149
  return 'unknown';
79
- }
80
- getStats() {
150
+ };
151
+ DiffClassifier.prototype.getStats = function () {
81
152
  return { useNative: this.useNative, cacheSize: this.classificationCache.size };
82
- }
83
- clearCache() { this.classificationCache.clear(); }
84
- parseHunks(block) {
85
- const hunks = [];
86
- const hunkMatches = block.matchAll(/@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@([^\n]*)\n([\s\S]*?)(?=@@|$)/g);
87
- for (const match of hunkMatches) {
88
- const oldStart = parseInt(match[1], 10);
89
- const oldLines = parseInt(match[2] || '1', 10);
90
- const newStart = parseInt(match[3], 10);
91
- const newLines = parseInt(match[4] || '1', 10);
92
- const content = match[6] || '';
93
- const changes = this.parseChanges(content, newStart);
94
- hunks.push({ oldStart, oldLines, newStart, newLines, content, changes });
153
+ };
154
+ DiffClassifier.prototype.clearCache = function () { this.classificationCache.clear(); };
155
+ DiffClassifier.prototype.parseHunks = function (block) {
156
+ var hunks = [];
157
+ var hunkMatches = block.matchAll(/@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@([^\n]*)\n([\s\S]*?)(?=@@|$)/g);
158
+ for (var _i = 0, hunkMatches_1 = hunkMatches; _i < hunkMatches_1.length; _i++) {
159
+ var match = hunkMatches_1[_i];
160
+ var oldStart = parseInt(match[1], 10);
161
+ var oldLines = parseInt(match[2] || '1', 10);
162
+ var newStart = parseInt(match[3], 10);
163
+ var newLines = parseInt(match[4] || '1', 10);
164
+ var content = match[6] || '';
165
+ var changes = this.parseChanges(content, newStart);
166
+ hunks.push({ oldStart: oldStart, oldLines: oldLines, newStart: newStart, newLines: newLines, content: content, changes: changes });
95
167
  }
96
168
  return hunks;
97
- }
98
- parseChanges(content, startLine) {
99
- const changes = [];
100
- const lines = content.split('\n');
101
- let lineNumber = startLine;
102
- for (const line of lines) {
169
+ };
170
+ DiffClassifier.prototype.parseChanges = function (content, startLine) {
171
+ var changes = [];
172
+ var lines = content.split('\n');
173
+ var lineNumber = startLine;
174
+ for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
175
+ var line = lines_1[_i];
103
176
  if (line.startsWith('+')) {
104
- changes.push({ type: 'add', lineNumber, content: line.substring(1) });
177
+ changes.push({ type: 'add', lineNumber: lineNumber, content: line.substring(1) });
105
178
  lineNumber++;
106
179
  }
107
180
  else if (line.startsWith('-')) {
108
181
  changes.push({ type: 'remove', lineNumber: -1, content: line.substring(1) });
109
182
  }
110
183
  else if (line.startsWith(' ') || line === '') {
111
- changes.push({ type: 'context', lineNumber, content: line.substring(1) || '' });
184
+ changes.push({ type: 'context', lineNumber: lineNumber, content: line.substring(1) || '' });
112
185
  lineNumber++;
113
186
  }
114
187
  }
115
188
  return changes;
116
- }
117
- classifyFile(path, hunks) {
118
- const cacheKey = this.getCacheKey(path, hunks);
119
- const cached = this.classificationCache.get(cacheKey);
189
+ };
190
+ DiffClassifier.prototype.classifyFile = function (path, hunks) {
191
+ var cacheKey = this.getCacheKey(path, hunks);
192
+ var cached = this.classificationCache.get(cacheKey);
120
193
  if (cached)
121
194
  return cached;
122
- const primary = this.determinePrimaryClassification(path, hunks);
123
- const secondary = this.determineSecondaryClassifications(path, hunks, primary);
124
- const confidence = this.calculateConfidence(path, hunks, primary);
125
- const impactLevel = this.determineImpactLevel(path, hunks);
126
- const suggestedReviewers = this.suggestReviewers(path, primary, impactLevel);
127
- const testingStrategy = this.determineTestingStrategy(path, primary, impactLevel);
128
- const riskFactors = this.identifyRiskFactors(path, hunks, impactLevel);
129
- const classification = { primary, secondary, confidence, impactLevel, suggestedReviewers, testingStrategy, riskFactors };
195
+ var primary = this.determinePrimaryClassification(path, hunks);
196
+ var secondary = this.determineSecondaryClassifications(path, hunks, primary);
197
+ var confidence = this.calculateConfidence(path, hunks, primary);
198
+ var impactLevel = this.determineImpactLevel(path, hunks);
199
+ var suggestedReviewers = this.suggestReviewers(path, primary, impactLevel);
200
+ var testingStrategy = this.determineTestingStrategy(path, primary, impactLevel);
201
+ var riskFactors = this.identifyRiskFactors(path, hunks, impactLevel);
202
+ var classification = { primary: primary, secondary: secondary, confidence: confidence, impactLevel: impactLevel, suggestedReviewers: suggestedReviewers, testingStrategy: testingStrategy, riskFactors: riskFactors };
130
203
  this.classificationCache.set(cacheKey, classification);
131
204
  return classification;
132
- }
133
- getCacheKey(path, hunks) {
134
- const hunkSummary = hunks.map(h => h.oldStart + ':' + h.newStart).join(',');
205
+ };
206
+ DiffClassifier.prototype.getCacheKey = function (path, hunks) {
207
+ var hunkSummary = hunks.map(function (h) { return h.oldStart + ':' + h.newStart; }).join(',');
135
208
  return path + ':' + hunkSummary;
136
- }
137
- determinePrimaryClassification(path, hunks) {
138
- for (const [type, patterns] of Object.entries(CLASSIFICATION_PATTERNS)) {
139
- for (const pattern of patterns) {
209
+ };
210
+ DiffClassifier.prototype.determinePrimaryClassification = function (path, hunks) {
211
+ for (var _i = 0, _a = Object.entries(CLASSIFICATION_PATTERNS); _i < _a.length; _i++) {
212
+ var _b = _a[_i], type = _b[0], patterns = _b[1];
213
+ for (var _c = 0, patterns_2 = patterns; _c < patterns_2.length; _c++) {
214
+ var pattern = patterns_2[_c];
140
215
  if (pattern.test(path))
141
216
  return type;
142
217
  }
143
218
  }
144
- const allContent = hunks.flatMap(h => h.changes.map(c => c.content)).join('\n').toLowerCase();
145
- if (/function|class|interface|type\s+\w+/.test(allContent) && hunks.some(h => h.changes.filter(c => c.type === 'add').length > 10))
219
+ var allContent = hunks.flatMap(function (h) { return h.changes.map(function (c) { return c.content; }); }).join('\n').toLowerCase();
220
+ if (/function|class|interface|type\s+\w+/.test(allContent) && hunks.some(function (h) { return h.changes.filter(function (c) { return c.type === 'add'; }).length > 10; }))
146
221
  return 'feature';
147
222
  if (/fix|bug|issue|error|exception/.test(allContent))
148
223
  return 'bugfix';
149
224
  if (this.config.detectRefactoring && this.isRefactoring(hunks))
150
225
  return 'refactor';
151
226
  return 'unknown';
152
- }
153
- isRefactoring(hunks) {
154
- let totalAdds = 0, totalRemoves = 0;
155
- for (const hunk of hunks) {
156
- for (const change of hunk.changes) {
227
+ };
228
+ DiffClassifier.prototype.isRefactoring = function (hunks) {
229
+ var totalAdds = 0, totalRemoves = 0;
230
+ for (var _i = 0, hunks_1 = hunks; _i < hunks_1.length; _i++) {
231
+ var hunk = hunks_1[_i];
232
+ for (var _a = 0, _b = hunk.changes; _a < _b.length; _a++) {
233
+ var change = _b[_a];
157
234
  if (change.type === 'add')
158
235
  totalAdds++;
159
236
  else if (change.type === 'remove')
160
237
  totalRemoves++;
161
238
  }
162
239
  }
163
- const ratio = totalAdds > 0 ? totalRemoves / totalAdds : 0;
240
+ var ratio = totalAdds > 0 ? totalRemoves / totalAdds : 0;
164
241
  return ratio > 0.7 && ratio < 1.4 && totalAdds > 5;
165
- }
166
- determineSecondaryClassifications(path, hunks, primary) {
167
- const secondary = [];
168
- for (const [type, patterns] of Object.entries(CLASSIFICATION_PATTERNS)) {
242
+ };
243
+ DiffClassifier.prototype.determineSecondaryClassifications = function (path, hunks, primary) {
244
+ var secondary = [];
245
+ for (var _i = 0, _a = Object.entries(CLASSIFICATION_PATTERNS); _i < _a.length; _i++) {
246
+ var _b = _a[_i], type = _b[0], patterns = _b[1];
169
247
  if (type === primary)
170
248
  continue;
171
- for (const pattern of patterns) {
249
+ for (var _c = 0, patterns_3 = patterns; _c < patterns_3.length; _c++) {
250
+ var pattern = patterns_3[_c];
172
251
  if (pattern.test(path)) {
173
252
  secondary.push(type);
174
253
  break;
@@ -176,18 +255,20 @@ export class DiffClassifier {
176
255
  }
177
256
  }
178
257
  return secondary.slice(0, 3);
179
- }
180
- calculateConfidence(path, hunks, primary) {
181
- let confidence = 0.5;
182
- for (const patterns of Object.values(CLASSIFICATION_PATTERNS)) {
183
- for (const pattern of patterns) {
258
+ };
259
+ DiffClassifier.prototype.calculateConfidence = function (path, hunks, primary) {
260
+ var confidence = 0.5;
261
+ for (var _i = 0, _a = Object.values(CLASSIFICATION_PATTERNS); _i < _a.length; _i++) {
262
+ var patterns = _a[_i];
263
+ for (var _b = 0, patterns_4 = patterns; _b < patterns_4.length; _b++) {
264
+ var pattern = patterns_4[_b];
184
265
  if (pattern.test(path)) {
185
266
  confidence += 0.2;
186
267
  break;
187
268
  }
188
269
  }
189
270
  }
190
- const totalChanges = hunks.reduce((sum, h) => sum + h.changes.length, 0);
271
+ var totalChanges = hunks.reduce(function (sum, h) { return sum + h.changes.length; }, 0);
191
272
  if (totalChanges > 10)
192
273
  confidence += 0.1;
193
274
  if (totalChanges > 50)
@@ -195,15 +276,16 @@ export class DiffClassifier {
195
276
  if (primary !== 'unknown')
196
277
  confidence += 0.1;
197
278
  return Math.min(1, confidence);
198
- }
199
- determineImpactLevel(path, hunks) {
200
- let score = 0;
201
- const lowerPath = path.toLowerCase();
202
- for (const [keyword, weight] of Object.entries(IMPACT_KEYWORDS)) {
279
+ };
280
+ DiffClassifier.prototype.determineImpactLevel = function (path, hunks) {
281
+ var score = 0;
282
+ var lowerPath = path.toLowerCase();
283
+ for (var _i = 0, _a = Object.entries(IMPACT_KEYWORDS); _i < _a.length; _i++) {
284
+ var _b = _a[_i], keyword = _b[0], weight = _b[1];
203
285
  if (lowerPath.includes(keyword))
204
286
  score = Math.max(score, weight);
205
287
  }
206
- const totalChanges = hunks.reduce((sum, h) => sum + h.changes.filter(c => c.type !== 'context').length, 0);
288
+ var totalChanges = hunks.reduce(function (sum, h) { return sum + h.changes.filter(function (c) { return c.type !== 'context'; }).length; }, 0);
207
289
  if (totalChanges > 100)
208
290
  score = Math.max(score, 2);
209
291
  if (totalChanges > 300)
@@ -215,21 +297,21 @@ export class DiffClassifier {
215
297
  if (score >= 1)
216
298
  return 'medium';
217
299
  return 'low';
218
- }
219
- suggestReviewers(path, primary, impact) {
220
- const reviewers = [];
221
- const typeReviewers = { feature: ['tech-lead', 'product-owner'], bugfix: ['qa-engineer', 'developer'], refactor: ['senior-developer', 'architect'], docs: ['tech-writer', 'developer'], test: ['qa-engineer', 'developer'], config: ['devops', 'tech-lead'], style: ['developer'], unknown: ['developer'] };
222
- reviewers.push(...(typeReviewers[primary] || typeReviewers.unknown));
300
+ };
301
+ DiffClassifier.prototype.suggestReviewers = function (path, primary, impact) {
302
+ var reviewers = [];
303
+ var typeReviewers = { feature: ['tech-lead', 'product-owner'], bugfix: ['qa-engineer', 'developer'], refactor: ['senior-developer', 'architect'], docs: ['tech-writer', 'developer'], test: ['qa-engineer', 'developer'], config: ['devops', 'tech-lead'], style: ['developer'], unknown: ['developer'] };
304
+ reviewers.push.apply(reviewers, (typeReviewers[primary] || typeReviewers.unknown));
223
305
  if (impact === 'critical' || impact === 'high')
224
306
  reviewers.push('security-reviewer');
225
307
  if (/security|auth/.test(path))
226
308
  reviewers.push('security-team');
227
309
  if (/database|migration/.test(path))
228
310
  reviewers.push('dba');
229
- return [...new Set(reviewers)].slice(0, 4);
230
- }
231
- determineTestingStrategy(path, primary, impact) {
232
- const strategies = [];
311
+ return __spreadArray([], new Set(reviewers), true).slice(0, 4);
312
+ };
313
+ DiffClassifier.prototype.determineTestingStrategy = function (path, primary, impact) {
314
+ var strategies = [];
233
315
  if (primary !== 'test')
234
316
  strategies.push('unit-tests');
235
317
  if (primary === 'feature')
@@ -243,10 +325,10 @@ export class DiffClassifier {
243
325
  if (/security|auth|crypto/.test(path))
244
326
  strategies.push('security-audit');
245
327
  return strategies.slice(0, 5);
246
- }
247
- identifyRiskFactors(path, hunks, impact) {
248
- const risks = [];
249
- const totalChanges = hunks.reduce((sum, h) => sum + h.changes.length, 0);
328
+ };
329
+ DiffClassifier.prototype.identifyRiskFactors = function (path, hunks, impact) {
330
+ var risks = [];
331
+ var totalChanges = hunks.reduce(function (sum, h) { return sum + h.changes.length; }, 0);
250
332
  if (totalChanges > 200)
251
333
  risks.push('Large change set - increased review time needed');
252
334
  if (impact === 'critical')
@@ -259,49 +341,59 @@ export class DiffClassifier {
259
341
  risks.push('Database changes - ensure backup strategy');
260
342
  if (/config|env/.test(path))
261
343
  risks.push('Configuration changes - verify all environments');
262
- const allContent = hunks.flatMap(h => h.changes.map(c => c.content)).join('\n');
344
+ var allContent = hunks.flatMap(function (h) { return h.changes.map(function (c) { return c.content; }); }).join('\n');
263
345
  if (/TODO|FIXME|HACK/.test(allContent))
264
346
  risks.push('Contains TODO/FIXME comments');
265
347
  if (/password|secret|key|token/i.test(allContent))
266
348
  risks.push('Potential secrets in code');
267
349
  return risks.slice(0, 5);
268
- }
269
- computeOverallClassification(files) {
350
+ };
351
+ DiffClassifier.prototype.computeOverallClassification = function (files) {
270
352
  if (files.length === 0)
271
353
  return { primary: 'unknown', secondary: [], confidence: 0, impactLevel: 'low', suggestedReviewers: [], testingStrategy: [], riskFactors: [] };
272
- const primaryCounts = {};
273
- for (const file of files) {
274
- const p = file.classification.primary;
354
+ var primaryCounts = {};
355
+ for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
356
+ var file = files_1[_i];
357
+ var p = file.classification.primary;
275
358
  primaryCounts[p] = (primaryCounts[p] || 0) + 1;
276
359
  }
277
- let primary = 'unknown';
278
- let maxCount = 0;
279
- for (const [type, count] of Object.entries(primaryCounts)) {
360
+ var primary = 'unknown';
361
+ var maxCount = 0;
362
+ for (var _a = 0, _b = Object.entries(primaryCounts); _a < _b.length; _a++) {
363
+ var _c = _b[_a], type = _c[0], count = _c[1];
280
364
  if (count > maxCount) {
281
365
  maxCount = count;
282
366
  primary = type;
283
367
  }
284
368
  }
285
- const secondaryCounts = {};
286
- for (const file of files) {
287
- for (const s of file.classification.secondary) {
369
+ var secondaryCounts = {};
370
+ for (var _d = 0, files_2 = files; _d < files_2.length; _d++) {
371
+ var file = files_2[_d];
372
+ for (var _e = 0, _f = file.classification.secondary; _e < _f.length; _e++) {
373
+ var s = _f[_e];
288
374
  secondaryCounts[s] = (secondaryCounts[s] || 0) + 1;
289
375
  }
290
376
  }
291
- const secondary = Object.entries(secondaryCounts).sort((a, b) => b[1] - a[1]).slice(0, 3).map(([type]) => type);
292
- const confidence = files.reduce((sum, f) => sum + f.classification.confidence, 0) / files.length;
293
- const impactOrder = ['low', 'medium', 'high', 'critical'];
294
- let impactLevel = 'low';
295
- for (const file of files) {
377
+ var secondary = Object.entries(secondaryCounts).sort(function (a, b) { return b[1] - a[1]; }).slice(0, 3).map(function (_a) {
378
+ var type = _a[0];
379
+ return type;
380
+ });
381
+ var confidence = files.reduce(function (sum, f) { return sum + f.classification.confidence; }, 0) / files.length;
382
+ var impactOrder = ['low', 'medium', 'high', 'critical'];
383
+ var impactLevel = 'low';
384
+ for (var _g = 0, files_3 = files; _g < files_3.length; _g++) {
385
+ var file = files_3[_g];
296
386
  if (impactOrder.indexOf(file.classification.impactLevel) > impactOrder.indexOf(impactLevel))
297
387
  impactLevel = file.classification.impactLevel;
298
388
  }
299
- const reviewers = [...new Set(files.flatMap(f => f.classification.suggestedReviewers))].slice(0, 5);
300
- const testingStrategy = [...new Set(files.flatMap(f => f.classification.testingStrategy))].slice(0, 5);
301
- const riskFactors = [...new Set(files.flatMap(f => f.classification.riskFactors))].slice(0, 5);
302
- return { primary, secondary, confidence, impactLevel, suggestedReviewers: reviewers, testingStrategy, riskFactors };
303
- }
304
- }
389
+ var reviewers = __spreadArray([], new Set(files.flatMap(function (f) { return f.classification.suggestedReviewers; })), true).slice(0, 5);
390
+ var testingStrategy = __spreadArray([], new Set(files.flatMap(function (f) { return f.classification.testingStrategy; })), true).slice(0, 5);
391
+ var riskFactors = __spreadArray([], new Set(files.flatMap(function (f) { return f.classification.riskFactors; })), true).slice(0, 5);
392
+ return { primary: primary, secondary: secondary, confidence: confidence, impactLevel: impactLevel, suggestedReviewers: reviewers, testingStrategy: testingStrategy, riskFactors: riskFactors };
393
+ };
394
+ return DiffClassifier;
395
+ }());
396
+ export { DiffClassifier };
305
397
  export function createDiffClassifier(config) {
306
398
  return new DiffClassifier(config);
307
399
  }
@@ -309,8 +401,8 @@ export function createDiffClassifier(config) {
309
401
  // Optimized Git Diff Functions
310
402
  // ============================================================================
311
403
  // Cache for diff results (TTL-based)
312
- const diffCache = new Map();
313
- const CACHE_TTL_MS = 5000; // 5 seconds - short TTL since diffs change frequently
404
+ var diffCache = new Map();
405
+ var CACHE_TTL_MS = 5000; // 5 seconds - short TTL since diffs change frequently
314
406
  /**
315
407
  * Validate git ref to prevent command injection
316
408
  * Only allows safe characters: alphanumeric, -, _, /, ., ~, ^
@@ -318,70 +410,73 @@ const CACHE_TTL_MS = 5000; // 5 seconds - short TTL since diffs change frequentl
318
410
  function validateGitRef(ref) {
319
411
  // Block shell metacharacters and dangerous patterns
320
412
  if (!/^[a-zA-Z0-9_\-./~^@]+$/.test(ref)) {
321
- throw new Error(`Invalid git ref: contains unsafe characters`);
413
+ throw new Error("Invalid git ref: contains unsafe characters");
322
414
  }
323
415
  // Block multiple dots (path traversal)
324
416
  if (ref.includes('..') && !ref.match(/^[a-zA-Z0-9_\-]+\.\.\.?[a-zA-Z0-9_\-]+$/)) {
325
417
  if (!/^\w+\.\.[.\w]+$/.test(ref)) {
326
- throw new Error(`Invalid git ref: suspicious pattern`);
418
+ throw new Error("Invalid git ref: suspicious pattern");
327
419
  }
328
420
  }
329
421
  // Max length check
330
422
  if (ref.length > 256) {
331
- throw new Error(`Invalid git ref: too long`);
423
+ throw new Error("Invalid git ref: too long");
332
424
  }
333
425
  }
334
426
  /**
335
427
  * Get git diff statistics using SINGLE combined command (optimized)
336
428
  * Replaces two separate git commands with one
337
429
  */
338
- export function getGitDiffNumstat(ref = 'HEAD') {
430
+ export function getGitDiffNumstat(ref) {
431
+ if (ref === void 0) { ref = 'HEAD'; }
339
432
  // SECURITY: Validate git ref to prevent command injection
340
433
  validateGitRef(ref);
341
434
  // Check cache first
342
- const cacheKey = `numstat:${ref}`;
343
- const cached = diffCache.get(cacheKey);
435
+ var cacheKey = "numstat:" + ref;
436
+ var cached = diffCache.get(cacheKey);
344
437
  if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
345
438
  return cached.files;
346
439
  }
347
- const { execFileSync } = require('child_process');
440
+ var execFileSync = require('child_process').execFileSync;
348
441
  try {
349
442
  // SECURITY: Use execFileSync with args array instead of shell string
350
443
  // This prevents command injection via the ref parameter
351
- const numstatOutput = execFileSync('git', [
444
+ var numstatOutput = execFileSync('git', [
352
445
  'diff', '--numstat', '--diff-filter=ACDMRTUXB', ref
353
446
  ], { encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
354
- const statusOutput = execFileSync('git', [
447
+ var statusOutput = execFileSync('git', [
355
448
  'diff', '--name-status', ref
356
449
  ], { encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
357
- const output = numstatOutput + '---STATUS---' + statusOutput;
358
- const [numstatPart, statusPart] = output.split('---STATUS---');
450
+ var output = numstatOutput + '---STATUS---' + statusOutput;
451
+ var _a = output.split('---STATUS---'), numstatPart = _a[0], statusPart = _a[1];
359
452
  // Parse status (usually smaller, parse first)
360
- const statusMap = new Map();
453
+ var statusMap = new Map();
361
454
  if (statusPart) {
362
- for (const line of statusPart.trim().split('\n')) {
455
+ for (var _i = 0, _b = statusPart.trim().split('\n'); _i < _b.length; _i++) {
456
+ var line = _b[_i];
363
457
  if (!line)
364
458
  continue;
365
- const [status, ...pathParts] = line.split('\t');
366
- const path = pathParts[pathParts.length - 1] || pathParts[0];
459
+ var _c = line.split('\t'), status = _c[0], pathParts = _c.slice(1);
460
+ var path = pathParts[pathParts.length - 1] || pathParts[0];
367
461
  if (path)
368
462
  statusMap.set(path, status.charAt(0));
369
463
  }
370
464
  }
371
465
  // Parse numstat
372
- const files = [];
466
+ var files = [];
373
467
  if (numstatPart) {
374
- for (const line of numstatPart.trim().split('\n')) {
468
+ for (var _d = 0, _e = numstatPart.trim().split('\n'); _d < _e.length; _d++) {
469
+ var line = _e[_d];
375
470
  if (!line)
376
471
  continue;
377
- const [addStr, delStr, path] = line.split('\t');
472
+ var _f = line.split('\t'), addStr = _f[0], delStr = _f[1], path = _f[2];
378
473
  if (!path)
379
474
  continue;
380
- const additions = addStr === '-' ? 0 : parseInt(addStr, 10) || 0;
381
- const deletions = delStr === '-' ? 0 : parseInt(delStr, 10) || 0;
382
- const binary = addStr === '-' && delStr === '-';
383
- const statusChar = statusMap.get(path) || 'M';
384
- let status = 'modified';
475
+ var additions = addStr === '-' ? 0 : parseInt(addStr, 10) || 0;
476
+ var deletions = delStr === '-' ? 0 : parseInt(delStr, 10) || 0;
477
+ var binary = addStr === '-' && delStr === '-';
478
+ var statusChar = statusMap.get(path) || 'M';
479
+ var status = 'modified';
385
480
  switch (statusChar) {
386
481
  case 'A':
387
482
  status = 'added';
@@ -394,87 +489,102 @@ export function getGitDiffNumstat(ref = 'HEAD') {
394
489
  break;
395
490
  default: status = 'modified';
396
491
  }
397
- files.push({ path, status, additions, deletions, hunks: 1, binary });
492
+ files.push({ path: path, status: status, additions: additions, deletions: deletions, hunks: 1, binary: binary });
398
493
  }
399
494
  }
400
495
  // Cache the result
401
- diffCache.set(cacheKey, { files, timestamp: Date.now() });
496
+ diffCache.set(cacheKey, { files: files, timestamp: Date.now() });
402
497
  return files;
403
498
  }
404
- catch {
499
+ catch (_g) {
405
500
  return [];
406
501
  }
407
502
  }
408
503
  /**
409
504
  * Async version of getGitDiffNumstat for non-blocking operation
410
505
  */
411
- export async function getGitDiffNumstatAsync(ref = 'HEAD') {
412
- // SECURITY: Validate git ref to prevent command injection
413
- validateGitRef(ref);
414
- // Check cache first
415
- const cacheKey = `numstat:${ref}`;
416
- const cached = diffCache.get(cacheKey);
417
- if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
418
- return cached.files;
419
- }
420
- const { execFile } = require('child_process');
421
- const { promisify } = require('util');
422
- const execFileAsync = promisify(execFile);
423
- try {
424
- // SECURITY: Use execFile with args array instead of shell string
425
- const { stdout: numstatOutput } = await execFileAsync('git', [
426
- 'diff', '--numstat', '--diff-filter=ACDMRTUXB', ref
427
- ], { maxBuffer: 10 * 1024 * 1024 });
428
- const { stdout: statusOutput } = await execFileAsync('git', [
429
- 'diff', '--name-status', ref
430
- ], { maxBuffer: 10 * 1024 * 1024 });
431
- const stdout = numstatOutput + '---STATUS---' + statusOutput;
432
- const [numstatPart, statusPart] = stdout.split('---STATUS---');
433
- const statusMap = new Map();
434
- if (statusPart) {
435
- for (const line of statusPart.trim().split('\n')) {
436
- if (!line)
437
- continue;
438
- const [status, ...pathParts] = line.split('\t');
439
- const path = pathParts[pathParts.length - 1] || pathParts[0];
440
- if (path)
441
- statusMap.set(path, status.charAt(0));
442
- }
443
- }
444
- const files = [];
445
- if (numstatPart) {
446
- for (const line of numstatPart.trim().split('\n')) {
447
- if (!line)
448
- continue;
449
- const [addStr, delStr, path] = line.split('\t');
450
- if (!path)
451
- continue;
452
- const additions = addStr === '-' ? 0 : parseInt(addStr, 10) || 0;
453
- const deletions = delStr === '-' ? 0 : parseInt(delStr, 10) || 0;
454
- const binary = addStr === '-' && delStr === '-';
455
- const statusChar = statusMap.get(path) || 'M';
456
- let status = 'modified';
457
- switch (statusChar) {
458
- case 'A':
459
- status = 'added';
460
- break;
461
- case 'D':
462
- status = 'deleted';
463
- break;
464
- case 'R':
465
- status = 'renamed';
466
- break;
467
- default: status = 'modified';
468
- }
469
- files.push({ path, status, additions, deletions, hunks: 1, binary });
506
+ export function getGitDiffNumstatAsync(ref) {
507
+ if (ref === void 0) { ref = 'HEAD'; }
508
+ return __awaiter(this, void 0, Promise, function () {
509
+ var cacheKey, cached, execFile, promisify, execFileAsync, numstatOutput, statusOutput, stdout, _a, numstatPart, statusPart, statusMap, _i, _b, line, _c, status, pathParts, path, files, _d, _e, line, _f, addStr, delStr, path, additions, deletions, binary, statusChar, status, _g;
510
+ return __generator(this, function (_h) {
511
+ switch (_h.label) {
512
+ case 0:
513
+ // SECURITY: Validate git ref to prevent command injection
514
+ validateGitRef(ref);
515
+ cacheKey = "numstat:" + ref;
516
+ cached = diffCache.get(cacheKey);
517
+ if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
518
+ return [2 /*return*/, cached.files];
519
+ }
520
+ execFile = require('child_process').execFile;
521
+ promisify = require('util').promisify;
522
+ execFileAsync = promisify(execFile);
523
+ _h.label = 1;
524
+ case 1:
525
+ _h.trys.push([1, 4, , 5]);
526
+ return [4 /*yield*/, execFileAsync('git', [
527
+ 'diff', '--numstat', '--diff-filter=ACDMRTUXB', ref
528
+ ], { maxBuffer: 10 * 1024 * 1024 })];
529
+ case 2:
530
+ numstatOutput = (_h.sent()).stdout;
531
+ return [4 /*yield*/, execFileAsync('git', [
532
+ 'diff', '--name-status', ref
533
+ ], { maxBuffer: 10 * 1024 * 1024 })];
534
+ case 3:
535
+ statusOutput = (_h.sent()).stdout;
536
+ stdout = numstatOutput + '---STATUS---' + statusOutput;
537
+ _a = stdout.split('---STATUS---'), numstatPart = _a[0], statusPart = _a[1];
538
+ statusMap = new Map();
539
+ if (statusPart) {
540
+ for (_i = 0, _b = statusPart.trim().split('\n'); _i < _b.length; _i++) {
541
+ line = _b[_i];
542
+ if (!line)
543
+ continue;
544
+ _c = line.split('\t'), status = _c[0], pathParts = _c.slice(1);
545
+ path = pathParts[pathParts.length - 1] || pathParts[0];
546
+ if (path)
547
+ statusMap.set(path, status.charAt(0));
548
+ }
549
+ }
550
+ files = [];
551
+ if (numstatPart) {
552
+ for (_d = 0, _e = numstatPart.trim().split('\n'); _d < _e.length; _d++) {
553
+ line = _e[_d];
554
+ if (!line)
555
+ continue;
556
+ _f = line.split('\t'), addStr = _f[0], delStr = _f[1], path = _f[2];
557
+ if (!path)
558
+ continue;
559
+ additions = addStr === '-' ? 0 : parseInt(addStr, 10) || 0;
560
+ deletions = delStr === '-' ? 0 : parseInt(delStr, 10) || 0;
561
+ binary = addStr === '-' && delStr === '-';
562
+ statusChar = statusMap.get(path) || 'M';
563
+ status = 'modified';
564
+ switch (statusChar) {
565
+ case 'A':
566
+ status = 'added';
567
+ break;
568
+ case 'D':
569
+ status = 'deleted';
570
+ break;
571
+ case 'R':
572
+ status = 'renamed';
573
+ break;
574
+ default: status = 'modified';
575
+ }
576
+ files.push({ path: path, status: status, additions: additions, deletions: deletions, hunks: 1, binary: binary });
577
+ }
578
+ }
579
+ diffCache.set(cacheKey, { files: files, timestamp: Date.now() });
580
+ return [2 /*return*/, files];
581
+ case 4:
582
+ _g = _h.sent();
583
+ return [2 /*return*/, []];
584
+ case 5: return [2 /*return*/];
470
585
  }
471
- }
472
- diffCache.set(cacheKey, { files, timestamp: Date.now() });
473
- return files;
474
- }
475
- catch {
476
- return [];
477
- }
586
+ });
587
+ });
478
588
  }
479
589
  /**
480
590
  * Clear the diff cache (call when git state changes)
@@ -486,10 +596,10 @@ export function clearDiffCache() {
486
596
  * Assess risk for a single file
487
597
  */
488
598
  export function assessFileRisk(file) {
489
- const reasons = [];
490
- let score = 0;
599
+ var reasons = [];
600
+ var score = 0;
491
601
  // Size-based risk
492
- const totalChanges = file.additions + file.deletions;
602
+ var totalChanges = file.additions + file.deletions;
493
603
  if (totalChanges > 300) {
494
604
  score += 30;
495
605
  reasons.push('Large change size (>300 lines)');
@@ -499,7 +609,7 @@ export function assessFileRisk(file) {
499
609
  reasons.push('Medium change size (>100 lines)');
500
610
  }
501
611
  // Path-based risk
502
- const lowerPath = file.path.toLowerCase();
612
+ var lowerPath = file.path.toLowerCase();
503
613
  if (/security|auth|crypto|password/.test(lowerPath)) {
504
614
  score += 40;
505
615
  reasons.push('Security-sensitive file');
@@ -530,39 +640,40 @@ export function assessFileRisk(file) {
530
640
  score += 5;
531
641
  reasons.push('Binary file');
532
642
  }
533
- let risk = 'low';
643
+ var risk = 'low';
534
644
  if (score >= 60)
535
645
  risk = 'critical';
536
646
  else if (score >= 40)
537
647
  risk = 'high';
538
648
  else if (score >= 20)
539
649
  risk = 'medium';
540
- return { file: file.path, risk, score: Math.min(100, score), reasons };
650
+ return { file: file.path, risk: risk, score: Math.min(100, score), reasons: reasons };
541
651
  }
542
652
  /**
543
653
  * Assess overall risk from files and file risks
544
654
  */
545
655
  export function assessOverallRisk(files, fileRisks) {
546
- const breakdown = { low: 0, medium: 0, high: 0, critical: 0 };
547
- let totalScore = 0;
548
- for (const fr of fileRisks) {
656
+ var breakdown = { low: 0, medium: 0, high: 0, critical: 0 };
657
+ var totalScore = 0;
658
+ for (var _i = 0, fileRisks_1 = fileRisks; _i < fileRisks_1.length; _i++) {
659
+ var fr = fileRisks_1[_i];
549
660
  breakdown[fr.risk]++;
550
661
  totalScore += fr.score;
551
662
  }
552
- const avgScore = fileRisks.length > 0 ? totalScore / fileRisks.length : 0;
663
+ var avgScore = fileRisks.length > 0 ? totalScore / fileRisks.length : 0;
553
664
  // Weight more heavily towards high/critical files
554
- const weightedScore = avgScore + (breakdown.critical * 15) + (breakdown.high * 10);
555
- let overall = 'low';
665
+ var weightedScore = avgScore + (breakdown.critical * 15) + (breakdown.high * 10);
666
+ var overall = 'low';
556
667
  if (weightedScore >= 60 || breakdown.critical > 0)
557
668
  overall = 'critical';
558
669
  else if (weightedScore >= 40 || breakdown.high > 1)
559
670
  overall = 'high';
560
671
  else if (weightedScore >= 20 || breakdown.medium > 2)
561
672
  overall = 'medium';
562
- return { overall, score: Math.min(100, Math.round(weightedScore)), breakdown };
673
+ return { overall: overall, score: Math.min(100, Math.round(weightedScore)), breakdown: breakdown };
563
674
  }
564
675
  // Singleton classifier instance for reuse
565
- let classifierInstance = null;
676
+ var classifierInstance = null;
566
677
  function getClassifier() {
567
678
  if (!classifierInstance) {
568
679
  classifierInstance = new DiffClassifier();
@@ -573,23 +684,24 @@ function getClassifier() {
573
684
  * Classify a diff based on files (uses singleton classifier)
574
685
  */
575
686
  export function classifyDiff(files) {
576
- const classifier = getClassifier();
577
- const fileDiffs = files.map(f => ({
687
+ var classifier = getClassifier();
688
+ var fileDiffs = files.map(function (f) { return ({
578
689
  path: f.path,
579
690
  hunks: [],
580
691
  additions: f.additions,
581
692
  deletions: f.deletions,
582
- classification: classifier['classifyFile'](f.path, []),
583
- }));
693
+ classification: classifier['classifyFile'](f.path, [])
694
+ }); });
584
695
  return classifier['computeOverallClassification'](fileDiffs);
585
696
  }
586
697
  /**
587
698
  * Suggest reviewers based on files and risks
588
699
  */
589
700
  export function suggestReviewers(files, fileRisks) {
590
- const reviewers = new Set();
591
- for (const file of files) {
592
- const lowerPath = file.path.toLowerCase();
701
+ var reviewers = new Set();
702
+ for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
703
+ var file = files_4[_i];
704
+ var lowerPath = file.path.toLowerCase();
593
705
  if (/security|auth|crypto/.test(lowerPath))
594
706
  reviewers.add('security-team');
595
707
  if (/database|migration/.test(lowerPath))
@@ -606,7 +718,7 @@ export function suggestReviewers(files, fileRisks) {
606
718
  reviewers.add('backend-lead');
607
719
  }
608
720
  // Add based on risk
609
- const hasHighRisk = fileRisks.some(fr => fr.risk === 'high' || fr.risk === 'critical');
721
+ var hasHighRisk = fileRisks.some(function (fr) { return fr.risk === 'high' || fr.risk === 'critical'; });
610
722
  if (hasHighRisk) {
611
723
  reviewers.add('tech-lead');
612
724
  reviewers.add('senior-developer');
@@ -618,73 +730,88 @@ export function suggestReviewers(files, fileRisks) {
618
730
  return Array.from(reviewers).slice(0, 5);
619
731
  }
620
732
  // Analysis result cache
621
- const analysisCache = new Map();
622
- const ANALYSIS_CACHE_TTL_MS = 3000; // 3 seconds
733
+ var analysisCache = new Map();
734
+ var ANALYSIS_CACHE_TTL_MS = 3000; // 3 seconds
623
735
  /**
624
736
  * Analyze a diff with full analysis (optimized with caching)
625
737
  */
626
- export async function analyzeDiff(options) {
627
- const ref = options.ref || 'HEAD';
628
- // Check analysis cache (unless skipCache is true)
629
- if (!options.skipCache) {
630
- const cached = analysisCache.get(ref);
631
- if (cached && Date.now() - cached.timestamp < ANALYSIS_CACHE_TTL_MS) {
632
- return cached.result;
633
- }
634
- }
635
- // Use async git diff for non-blocking operation
636
- const files = await getGitDiffNumstatAsync(ref);
637
- // Parallel file risk assessment for large diffs
638
- const fileRisks = files.length > 20
639
- ? await Promise.all(files.map(f => Promise.resolve(assessFileRisk(f))))
640
- : files.map(assessFileRisk);
641
- const risk = assessOverallRisk(files, fileRisks);
642
- const classification = classifyDiff(files);
643
- const recommendedReviewers = suggestReviewers(files, fileRisks);
644
- const totalAdditions = files.reduce((sum, f) => sum + f.additions, 0);
645
- const totalDeletions = files.reduce((sum, f) => sum + f.deletions, 0);
646
- const result = {
647
- ref,
648
- timestamp: Date.now(),
649
- files,
650
- risk,
651
- classification,
652
- summary: `${files.length} files changed (+${totalAdditions}/-${totalDeletions}), ${risk.overall} risk`,
653
- fileRisks,
654
- recommendedReviewers,
655
- };
656
- // Cache the result
657
- analysisCache.set(ref, { result, timestamp: Date.now() });
658
- return result;
738
+ export function analyzeDiff(options) {
739
+ return __awaiter(this, void 0, Promise, function () {
740
+ var ref, cached, files, fileRisks, _a, risk, classification, recommendedReviewers, totalAdditions, totalDeletions, result;
741
+ return __generator(this, function (_b) {
742
+ switch (_b.label) {
743
+ case 0:
744
+ ref = options.ref || 'HEAD';
745
+ // Check analysis cache (unless skipCache is true)
746
+ if (!options.skipCache) {
747
+ cached = analysisCache.get(ref);
748
+ if (cached && Date.now() - cached.timestamp < ANALYSIS_CACHE_TTL_MS) {
749
+ return [2 /*return*/, cached.result];
750
+ }
751
+ }
752
+ return [4 /*yield*/, getGitDiffNumstatAsync(ref)];
753
+ case 1:
754
+ files = _b.sent();
755
+ if (!(files.length > 20)) return [3 /*break*/, 3];
756
+ return [4 /*yield*/, Promise.all(files.map(function (f) { return Promise.resolve(assessFileRisk(f)); }))];
757
+ case 2:
758
+ _a = _b.sent();
759
+ return [3 /*break*/, 4];
760
+ case 3:
761
+ _a = files.map(assessFileRisk);
762
+ _b.label = 4;
763
+ case 4:
764
+ fileRisks = _a;
765
+ risk = assessOverallRisk(files, fileRisks);
766
+ classification = classifyDiff(files);
767
+ recommendedReviewers = suggestReviewers(files, fileRisks);
768
+ totalAdditions = files.reduce(function (sum, f) { return sum + f.additions; }, 0);
769
+ totalDeletions = files.reduce(function (sum, f) { return sum + f.deletions; }, 0);
770
+ result = {
771
+ ref: ref,
772
+ timestamp: Date.now(),
773
+ files: files,
774
+ risk: risk,
775
+ classification: classification,
776
+ summary: files.length + " files changed (+" + totalAdditions + "/-" + totalDeletions + "), " + risk.overall + " risk",
777
+ fileRisks: fileRisks,
778
+ recommendedReviewers: recommendedReviewers
779
+ };
780
+ // Cache the result
781
+ analysisCache.set(ref, { result: result, timestamp: Date.now() });
782
+ return [2 /*return*/, result];
783
+ }
784
+ });
785
+ });
659
786
  }
660
787
  /**
661
788
  * Synchronous version of analyzeDiff for backward compatibility
662
789
  */
663
790
  export function analyzeDiffSync(options) {
664
- const ref = options.ref || 'HEAD';
791
+ var ref = options.ref || 'HEAD';
665
792
  // Check analysis cache
666
- const cached = analysisCache.get(ref);
793
+ var cached = analysisCache.get(ref);
667
794
  if (cached && Date.now() - cached.timestamp < ANALYSIS_CACHE_TTL_MS) {
668
795
  return cached.result;
669
796
  }
670
- const files = getGitDiffNumstat(ref);
671
- const fileRisks = files.map(assessFileRisk);
672
- const risk = assessOverallRisk(files, fileRisks);
673
- const classification = classifyDiff(files);
674
- const recommendedReviewers = suggestReviewers(files, fileRisks);
675
- const totalAdditions = files.reduce((sum, f) => sum + f.additions, 0);
676
- const totalDeletions = files.reduce((sum, f) => sum + f.deletions, 0);
677
- const result = {
678
- ref,
797
+ var files = getGitDiffNumstat(ref);
798
+ var fileRisks = files.map(assessFileRisk);
799
+ var risk = assessOverallRisk(files, fileRisks);
800
+ var classification = classifyDiff(files);
801
+ var recommendedReviewers = suggestReviewers(files, fileRisks);
802
+ var totalAdditions = files.reduce(function (sum, f) { return sum + f.additions; }, 0);
803
+ var totalDeletions = files.reduce(function (sum, f) { return sum + f.deletions; }, 0);
804
+ var result = {
805
+ ref: ref,
679
806
  timestamp: Date.now(),
680
- files,
681
- risk,
682
- classification,
683
- summary: `${files.length} files changed (+${totalAdditions}/-${totalDeletions}), ${risk.overall} risk`,
684
- fileRisks,
685
- recommendedReviewers,
807
+ files: files,
808
+ risk: risk,
809
+ classification: classification,
810
+ summary: files.length + " files changed (+" + totalAdditions + "/-" + totalDeletions + "), " + risk.overall + " risk",
811
+ fileRisks: fileRisks,
812
+ recommendedReviewers: recommendedReviewers
686
813
  };
687
- analysisCache.set(ref, { result, timestamp: Date.now() });
814
+ analysisCache.set(ref, { result: result, timestamp: Date.now() });
688
815
  return result;
689
816
  }
690
817
  /**
@@ -693,6 +820,6 @@ export function analyzeDiffSync(options) {
693
820
  export function clearAllDiffCaches() {
694
821
  diffCache.clear();
695
822
  analysisCache.clear();
696
- classifierInstance?.clearCache();
823
+ classifierInstance === null || classifierInstance === void 0 ? void 0 : classifierInstance.clearCache();
697
824
  }
698
825
  //# sourceMappingURL=diff-classifier.js.map