@diff-review-system/drs 4.0.0-rc.4 → 4.1.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 (419) hide show
  1. package/.pi/agents/describe/pr-describer.md +14 -0
  2. package/.pi/agents/review/unified-reviewer.md +33 -7
  3. package/.pi/agents/task/agents-md-updater.md +3 -1
  4. package/.pi/agents/task/review-assistant.md +22 -0
  5. package/.pi/agents/task/review-issue-fixer.md +18 -1
  6. package/.pi/agents/visual/pr-explainer.md +205 -0
  7. package/.pi/workflows/github-pr-describe.yaml +10 -7
  8. package/.pi/workflows/github-pr-fix-review-issues-stacked.yaml +154 -0
  9. package/.pi/workflows/github-pr-post-comment.yaml +10 -10
  10. package/.pi/workflows/github-pr-review-post.yaml +18 -8
  11. package/.pi/workflows/github-pr-review.yaml +354 -7
  12. package/.pi/workflows/github-pr-show-changes.yaml +8 -8
  13. package/.pi/workflows/github-pr-update-agents-md-stacked.yaml +103 -0
  14. package/.pi/workflows/github-pr-visual-explain.yaml +80 -0
  15. package/.pi/workflows/gitlab-mr-describe.yaml +8 -5
  16. package/.pi/workflows/gitlab-mr-fix-review-issues-stacked.yaml +150 -0
  17. package/.pi/workflows/gitlab-mr-post-comment.yaml +8 -8
  18. package/.pi/workflows/gitlab-mr-review.yaml +354 -5
  19. package/.pi/workflows/gitlab-mr-show-changes.yaml +6 -6
  20. package/.pi/workflows/gitlab-mr-update-agents-md-stacked.yaml +100 -0
  21. package/.pi/workflows/gitlab-mr-visual-explain.yaml +78 -0
  22. package/.pi/workflows/local-fix-review-issues.yaml +89 -13
  23. package/.pi/workflows/local-review.yaml +15 -2
  24. package/.pi/workflows/local-update-agents-md.yaml +1 -1
  25. package/.pi/workflows/local-visual-explain.yaml +76 -0
  26. package/.pi/workflows/release-changelog-finalize.yaml +47 -0
  27. package/.pi/workflows/tag-changelog-update.yaml +4 -4
  28. package/.pi/workflows/temporal-control-smoke.yaml +63 -0
  29. package/README.md +130 -27
  30. package/dist/ci/runner.d.ts.map +1 -1
  31. package/dist/ci/runner.js +3 -1
  32. package/dist/ci/runner.js.map +1 -1
  33. package/dist/cli/index.js +258 -9
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/cli/init.d.ts +6 -1
  36. package/dist/cli/init.d.ts.map +1 -1
  37. package/dist/cli/init.js +29 -10
  38. package/dist/cli/init.js.map +1 -1
  39. package/dist/cli/run-agent.d.ts +4 -7
  40. package/dist/cli/run-agent.d.ts.map +1 -1
  41. package/dist/cli/run-agent.js +4 -0
  42. package/dist/cli/run-agent.js.map +1 -1
  43. package/dist/cli/workflow-executor-selection.d.ts +3 -0
  44. package/dist/cli/workflow-executor-selection.d.ts.map +1 -0
  45. package/dist/cli/workflow-executor-selection.js +15 -0
  46. package/dist/cli/workflow-executor-selection.js.map +1 -0
  47. package/dist/cli/workflow.d.ts +76 -26
  48. package/dist/cli/workflow.d.ts.map +1 -1
  49. package/dist/cli/workflow.js +1624 -192
  50. package/dist/cli/workflow.js.map +1 -1
  51. package/dist/github/client.d.ts +12 -0
  52. package/dist/github/client.d.ts.map +1 -1
  53. package/dist/github/client.js +27 -0
  54. package/dist/github/client.js.map +1 -1
  55. package/dist/github/platform-adapter.d.ts +6 -1
  56. package/dist/github/platform-adapter.d.ts.map +1 -1
  57. package/dist/github/platform-adapter.js +84 -8
  58. package/dist/github/platform-adapter.js.map +1 -1
  59. package/dist/gitlab/client.d.ts +11 -0
  60. package/dist/gitlab/client.d.ts.map +1 -1
  61. package/dist/gitlab/client.js +11 -0
  62. package/dist/gitlab/client.js.map +1 -1
  63. package/dist/gitlab/platform-adapter.d.ts +3 -1
  64. package/dist/gitlab/platform-adapter.d.ts.map +1 -1
  65. package/dist/gitlab/platform-adapter.js +32 -1
  66. package/dist/gitlab/platform-adapter.js.map +1 -1
  67. package/dist/lib/agent-result.d.ts +8 -0
  68. package/dist/lib/agent-result.d.ts.map +1 -0
  69. package/dist/lib/agent-result.js +2 -0
  70. package/dist/lib/agent-result.js.map +1 -0
  71. package/dist/lib/comment-formatter.d.ts +8 -0
  72. package/dist/lib/comment-formatter.d.ts.map +1 -1
  73. package/dist/lib/comment-formatter.js +12 -4
  74. package/dist/lib/comment-formatter.js.map +1 -1
  75. package/dist/lib/comment-poster.d.ts.map +1 -1
  76. package/dist/lib/comment-poster.js +28 -1
  77. package/dist/lib/comment-poster.js.map +1 -1
  78. package/dist/lib/config.d.ts +71 -11
  79. package/dist/lib/config.d.ts.map +1 -1
  80. package/dist/lib/config.js +163 -28
  81. package/dist/lib/config.js.map +1 -1
  82. package/dist/lib/context-compression.d.ts +10 -0
  83. package/dist/lib/context-compression.d.ts.map +1 -1
  84. package/dist/lib/context-compression.js +101 -13
  85. package/dist/lib/context-compression.js.map +1 -1
  86. package/dist/lib/context-loader.d.ts +2 -1
  87. package/dist/lib/context-loader.d.ts.map +1 -1
  88. package/dist/lib/context-loader.js +70 -1
  89. package/dist/lib/context-loader.js.map +1 -1
  90. package/dist/lib/describe-core.d.ts.map +1 -1
  91. package/dist/lib/describe-core.js +3 -2
  92. package/dist/lib/describe-core.js.map +1 -1
  93. package/dist/lib/diff-lines.d.ts +9 -0
  94. package/dist/lib/diff-lines.d.ts.map +1 -1
  95. package/dist/lib/diff-lines.js +17 -9
  96. package/dist/lib/diff-lines.js.map +1 -1
  97. package/dist/lib/exit.js +4 -4
  98. package/dist/lib/exit.js.map +1 -1
  99. package/dist/lib/html-artifact.d.ts +14 -0
  100. package/dist/lib/html-artifact.d.ts.map +1 -0
  101. package/dist/lib/html-artifact.js +59 -0
  102. package/dist/lib/html-artifact.js.map +1 -0
  103. package/dist/lib/issue-parser.js +3 -3
  104. package/dist/lib/issue-parser.js.map +1 -1
  105. package/dist/lib/json-output-schema.d.ts +70 -0
  106. package/dist/lib/json-output-schema.d.ts.map +1 -1
  107. package/dist/lib/json-output-schema.js +40 -0
  108. package/dist/lib/json-output-schema.js.map +1 -1
  109. package/dist/lib/output-paths.d.ts +0 -1
  110. package/dist/lib/output-paths.d.ts.map +1 -1
  111. package/dist/lib/output-paths.js +0 -1
  112. package/dist/lib/output-paths.js.map +1 -1
  113. package/dist/lib/platform-client.d.ts +26 -0
  114. package/dist/lib/platform-client.d.ts.map +1 -1
  115. package/dist/lib/project-setup.d.ts +10 -0
  116. package/dist/lib/project-setup.d.ts.map +1 -0
  117. package/dist/lib/project-setup.js +25 -0
  118. package/dist/lib/project-setup.js.map +1 -0
  119. package/dist/lib/review-artifact-store.d.ts +16 -0
  120. package/dist/lib/review-artifact-store.d.ts.map +1 -0
  121. package/dist/lib/review-artifact-store.js +84 -0
  122. package/dist/lib/review-artifact-store.js.map +1 -0
  123. package/dist/lib/review-artifact.d.ts +69 -0
  124. package/dist/lib/review-artifact.d.ts.map +1 -0
  125. package/dist/lib/review-artifact.js +172 -0
  126. package/dist/lib/review-artifact.js.map +1 -0
  127. package/dist/lib/review-core.d.ts +7 -4
  128. package/dist/lib/review-core.d.ts.map +1 -1
  129. package/dist/lib/review-core.js +82 -165
  130. package/dist/lib/review-core.js.map +1 -1
  131. package/dist/lib/review-orchestrator.d.ts +23 -0
  132. package/dist/lib/review-orchestrator.d.ts.map +1 -1
  133. package/dist/lib/review-orchestrator.js +20 -13
  134. package/dist/lib/review-orchestrator.js.map +1 -1
  135. package/dist/lib/review-parser.d.ts.map +1 -1
  136. package/dist/lib/review-parser.js +15 -12
  137. package/dist/lib/review-parser.js.map +1 -1
  138. package/dist/lib/review-usage.d.ts +4 -0
  139. package/dist/lib/review-usage.d.ts.map +1 -1
  140. package/dist/lib/review-usage.js +25 -0
  141. package/dist/lib/review-usage.js.map +1 -1
  142. package/dist/lib/skills.d.ts +16 -0
  143. package/dist/lib/skills.d.ts.map +1 -0
  144. package/dist/lib/skills.js +140 -0
  145. package/dist/lib/skills.js.map +1 -0
  146. package/dist/lib/trace-collector.d.ts +105 -0
  147. package/dist/lib/trace-collector.d.ts.map +1 -0
  148. package/dist/lib/trace-collector.js +255 -0
  149. package/dist/lib/trace-collector.js.map +1 -0
  150. package/dist/lib/trace-html.d.ts +3 -0
  151. package/dist/lib/trace-html.d.ts.map +1 -0
  152. package/dist/lib/trace-html.js +349 -0
  153. package/dist/lib/trace-html.js.map +1 -0
  154. package/dist/lib/workflow/artifact-store.d.ts +71 -0
  155. package/dist/lib/workflow/artifact-store.d.ts.map +1 -0
  156. package/dist/lib/workflow/artifact-store.js +121 -0
  157. package/dist/lib/workflow/artifact-store.js.map +1 -0
  158. package/dist/lib/workflow/compiled-plan.d.ts +87 -0
  159. package/dist/lib/workflow/compiled-plan.d.ts.map +1 -0
  160. package/dist/lib/workflow/compiled-plan.js +62 -0
  161. package/dist/lib/workflow/compiled-plan.js.map +1 -0
  162. package/dist/lib/workflow/executor.d.ts +18 -0
  163. package/dist/lib/workflow/executor.d.ts.map +1 -0
  164. package/dist/lib/workflow/executor.js +2 -0
  165. package/dist/lib/workflow/executor.js.map +1 -0
  166. package/dist/lib/workflow/graph.d.ts +30 -0
  167. package/dist/lib/workflow/graph.d.ts.map +1 -0
  168. package/dist/lib/workflow/graph.js +139 -0
  169. package/dist/lib/workflow/graph.js.map +1 -0
  170. package/dist/lib/workflow/input.d.ts +4 -0
  171. package/dist/lib/workflow/input.d.ts.map +1 -0
  172. package/dist/lib/workflow/input.js +4 -0
  173. package/dist/lib/workflow/input.js.map +1 -0
  174. package/dist/lib/workflow/node-executor.d.ts +19 -0
  175. package/dist/lib/workflow/node-executor.d.ts.map +1 -0
  176. package/dist/lib/workflow/node-executor.js +2 -0
  177. package/dist/lib/workflow/node-executor.js.map +1 -0
  178. package/dist/lib/workflow/planning.d.ts +51 -0
  179. package/dist/lib/workflow/planning.d.ts.map +1 -0
  180. package/dist/lib/workflow/planning.js +814 -0
  181. package/dist/lib/workflow/planning.js.map +1 -0
  182. package/dist/lib/workflow/types.d.ts +66 -0
  183. package/dist/lib/workflow/types.d.ts.map +1 -0
  184. package/dist/lib/workflow/types.js +2 -0
  185. package/dist/lib/workflow/types.js.map +1 -0
  186. package/dist/lib/workflow-artifacts.d.ts +54 -0
  187. package/dist/lib/workflow-artifacts.d.ts.map +1 -0
  188. package/dist/lib/workflow-artifacts.js +150 -0
  189. package/dist/lib/workflow-artifacts.js.map +1 -0
  190. package/dist/lib/write-json-output.d.ts.map +1 -1
  191. package/dist/lib/write-json-output.js +3 -8
  192. package/dist/lib/write-json-output.js.map +1 -1
  193. package/dist/pi/sdk.d.ts.map +1 -1
  194. package/dist/pi/sdk.js +576 -8
  195. package/dist/pi/sdk.js.map +1 -1
  196. package/dist/runtime/agent-loader.js +2 -2
  197. package/dist/runtime/built-in-paths.d.ts +1 -0
  198. package/dist/runtime/built-in-paths.d.ts.map +1 -1
  199. package/dist/runtime/built-in-paths.js +7 -0
  200. package/dist/runtime/built-in-paths.js.map +1 -1
  201. package/dist/runtime/client.d.ts +2 -0
  202. package/dist/runtime/client.d.ts.map +1 -1
  203. package/dist/runtime/client.js +11 -5
  204. package/dist/runtime/client.js.map +1 -1
  205. package/dist/temporal/activities.d.ts +26 -0
  206. package/dist/temporal/activities.d.ts.map +1 -0
  207. package/dist/temporal/activities.js +219 -0
  208. package/dist/temporal/activities.js.map +1 -0
  209. package/dist/temporal/config.d.ts +4 -0
  210. package/dist/temporal/config.d.ts.map +1 -0
  211. package/dist/temporal/config.js +36 -0
  212. package/dist/temporal/config.js.map +1 -0
  213. package/dist/temporal/executor.d.ts +7 -0
  214. package/dist/temporal/executor.d.ts.map +1 -0
  215. package/dist/temporal/executor.js +233 -0
  216. package/dist/temporal/executor.js.map +1 -0
  217. package/dist/temporal/retry-policy.d.ts +28 -0
  218. package/dist/temporal/retry-policy.d.ts.map +1 -0
  219. package/dist/temporal/retry-policy.js +56 -0
  220. package/dist/temporal/retry-policy.js.map +1 -0
  221. package/dist/temporal/types.d.ts +86 -0
  222. package/dist/temporal/types.d.ts.map +1 -0
  223. package/dist/temporal/types.js +2 -0
  224. package/dist/temporal/types.js.map +1 -0
  225. package/dist/temporal/worker.d.ts +3 -0
  226. package/dist/temporal/worker.d.ts.map +1 -0
  227. package/dist/temporal/worker.js +18 -0
  228. package/dist/temporal/worker.js.map +1 -0
  229. package/dist/temporal/workflow-id.d.ts +27 -0
  230. package/dist/temporal/workflow-id.d.ts.map +1 -0
  231. package/dist/temporal/workflow-id.js +53 -0
  232. package/dist/temporal/workflow-id.js.map +1 -0
  233. package/dist/temporal/workflows.d.ts +6 -0
  234. package/dist/temporal/workflows.d.ts.map +1 -0
  235. package/dist/temporal/workflows.js +342 -0
  236. package/dist/temporal/workflows.js.map +1 -0
  237. package/package.json +26 -15
  238. package/.pi/workflows/github-pr-describe-post.yaml +0 -24
  239. package/.pi/workflows/gitlab-mr-describe-post.yaml +0 -22
  240. package/.pi/workflows/gitlab-mr-review-code-quality.yaml +0 -31
  241. package/.pi/workflows/gitlab-mr-review-post-code-quality.yaml +0 -40
  242. package/.pi/workflows/gitlab-mr-review-post.yaml +0 -30
  243. package/.pi/workflows/local-staged-review.yaml +0 -17
  244. package/dist/cli/run-agent.test.d.ts +0 -2
  245. package/dist/cli/run-agent.test.d.ts.map +0 -1
  246. package/dist/cli/run-agent.test.js +0 -204
  247. package/dist/cli/run-agent.test.js.map +0 -1
  248. package/dist/cli/workflow.test.d.ts +0 -2
  249. package/dist/cli/workflow.test.d.ts.map +0 -1
  250. package/dist/cli/workflow.test.js +0 -1410
  251. package/dist/cli/workflow.test.js.map +0 -1
  252. package/dist/github/client.test.d.ts +0 -2
  253. package/dist/github/client.test.d.ts.map +0 -1
  254. package/dist/github/client.test.js +0 -206
  255. package/dist/github/client.test.js.map +0 -1
  256. package/dist/github/platform-adapter.test.d.ts +0 -2
  257. package/dist/github/platform-adapter.test.d.ts.map +0 -1
  258. package/dist/github/platform-adapter.test.js +0 -40
  259. package/dist/github/platform-adapter.test.js.map +0 -1
  260. package/dist/gitlab/diff-parser.test.d.ts +0 -2
  261. package/dist/gitlab/diff-parser.test.d.ts.map +0 -1
  262. package/dist/gitlab/diff-parser.test.js +0 -315
  263. package/dist/gitlab/diff-parser.test.js.map +0 -1
  264. package/dist/gitlab/platform-adapter.test.d.ts +0 -2
  265. package/dist/gitlab/platform-adapter.test.d.ts.map +0 -1
  266. package/dist/gitlab/platform-adapter.test.js +0 -21
  267. package/dist/gitlab/platform-adapter.test.js.map +0 -1
  268. package/dist/index.test.d.ts +0 -2
  269. package/dist/index.test.d.ts.map +0 -1
  270. package/dist/index.test.js +0 -7
  271. package/dist/index.test.js.map +0 -1
  272. package/dist/lib/code-quality-report.test.d.ts +0 -2
  273. package/dist/lib/code-quality-report.test.d.ts.map +0 -1
  274. package/dist/lib/code-quality-report.test.js +0 -327
  275. package/dist/lib/code-quality-report.test.js.map +0 -1
  276. package/dist/lib/comment-formatter.test.d.ts +0 -2
  277. package/dist/lib/comment-formatter.test.d.ts.map +0 -1
  278. package/dist/lib/comment-formatter.test.js +0 -727
  279. package/dist/lib/comment-formatter.test.js.map +0 -1
  280. package/dist/lib/comment-manager.test.d.ts +0 -2
  281. package/dist/lib/comment-manager.test.d.ts.map +0 -1
  282. package/dist/lib/comment-manager.test.js +0 -680
  283. package/dist/lib/comment-manager.test.js.map +0 -1
  284. package/dist/lib/comment-poster.test.d.ts +0 -5
  285. package/dist/lib/comment-poster.test.d.ts.map +0 -1
  286. package/dist/lib/comment-poster.test.js +0 -255
  287. package/dist/lib/comment-poster.test.js.map +0 -1
  288. package/dist/lib/config-model-overrides.test.d.ts +0 -2
  289. package/dist/lib/config-model-overrides.test.d.ts.map +0 -1
  290. package/dist/lib/config-model-overrides.test.js +0 -218
  291. package/dist/lib/config-model-overrides.test.js.map +0 -1
  292. package/dist/lib/config.test.d.ts +0 -2
  293. package/dist/lib/config.test.d.ts.map +0 -1
  294. package/dist/lib/config.test.js +0 -353
  295. package/dist/lib/config.test.js.map +0 -1
  296. package/dist/lib/context-compression.test.d.ts +0 -2
  297. package/dist/lib/context-compression.test.d.ts.map +0 -1
  298. package/dist/lib/context-compression.test.js +0 -337
  299. package/dist/lib/context-compression.test.js.map +0 -1
  300. package/dist/lib/context-loader.test.d.ts +0 -2
  301. package/dist/lib/context-loader.test.d.ts.map +0 -1
  302. package/dist/lib/context-loader.test.js +0 -212
  303. package/dist/lib/context-loader.test.js.map +0 -1
  304. package/dist/lib/cursor-fix-link.test.d.ts +0 -2
  305. package/dist/lib/cursor-fix-link.test.d.ts.map +0 -1
  306. package/dist/lib/cursor-fix-link.test.js +0 -70
  307. package/dist/lib/cursor-fix-link.test.js.map +0 -1
  308. package/dist/lib/describe-core.test.d.ts +0 -2
  309. package/dist/lib/describe-core.test.d.ts.map +0 -1
  310. package/dist/lib/describe-core.test.js +0 -208
  311. package/dist/lib/describe-core.test.js.map +0 -1
  312. package/dist/lib/describe-output-path.test.d.ts +0 -2
  313. package/dist/lib/describe-output-path.test.d.ts.map +0 -1
  314. package/dist/lib/describe-output-path.test.js +0 -51
  315. package/dist/lib/describe-output-path.test.js.map +0 -1
  316. package/dist/lib/describe-parser.test.d.ts +0 -2
  317. package/dist/lib/describe-parser.test.d.ts.map +0 -1
  318. package/dist/lib/describe-parser.test.js +0 -282
  319. package/dist/lib/describe-parser.test.js.map +0 -1
  320. package/dist/lib/description-executor.test.d.ts +0 -2
  321. package/dist/lib/description-executor.test.d.ts.map +0 -1
  322. package/dist/lib/description-executor.test.js +0 -135
  323. package/dist/lib/description-executor.test.js.map +0 -1
  324. package/dist/lib/description-formatter.test.d.ts +0 -2
  325. package/dist/lib/description-formatter.test.d.ts.map +0 -1
  326. package/dist/lib/description-formatter.test.js +0 -57
  327. package/dist/lib/description-formatter.test.js.map +0 -1
  328. package/dist/lib/diff-lines.test.d.ts +0 -2
  329. package/dist/lib/diff-lines.test.d.ts.map +0 -1
  330. package/dist/lib/diff-lines.test.js +0 -13
  331. package/dist/lib/diff-lines.test.js.map +0 -1
  332. package/dist/lib/diff-parser.test.d.ts +0 -2
  333. package/dist/lib/diff-parser.test.d.ts.map +0 -1
  334. package/dist/lib/diff-parser.test.js +0 -335
  335. package/dist/lib/diff-parser.test.js.map +0 -1
  336. package/dist/lib/error-comment-poster.test.d.ts +0 -2
  337. package/dist/lib/error-comment-poster.test.d.ts.map +0 -1
  338. package/dist/lib/error-comment-poster.test.js +0 -128
  339. package/dist/lib/error-comment-poster.test.js.map +0 -1
  340. package/dist/lib/exit.test.d.ts +0 -2
  341. package/dist/lib/exit.test.d.ts.map +0 -1
  342. package/dist/lib/exit.test.js +0 -120
  343. package/dist/lib/exit.test.js.map +0 -1
  344. package/dist/lib/issue-parser.test.d.ts +0 -2
  345. package/dist/lib/issue-parser.test.d.ts.map +0 -1
  346. package/dist/lib/issue-parser.test.js +0 -281
  347. package/dist/lib/issue-parser.test.js.map +0 -1
  348. package/dist/lib/json-output-schema.test.d.ts +0 -2
  349. package/dist/lib/json-output-schema.test.d.ts.map +0 -1
  350. package/dist/lib/json-output-schema.test.js +0 -92
  351. package/dist/lib/json-output-schema.test.js.map +0 -1
  352. package/dist/lib/json-output.test.d.ts +0 -2
  353. package/dist/lib/json-output.test.d.ts.map +0 -1
  354. package/dist/lib/json-output.test.js +0 -141
  355. package/dist/lib/json-output.test.js.map +0 -1
  356. package/dist/lib/logger.test.d.ts +0 -2
  357. package/dist/lib/logger.test.d.ts.map +0 -1
  358. package/dist/lib/logger.test.js +0 -324
  359. package/dist/lib/logger.test.js.map +0 -1
  360. package/dist/lib/position-validator.test.d.ts +0 -2
  361. package/dist/lib/position-validator.test.d.ts.map +0 -1
  362. package/dist/lib/position-validator.test.js +0 -128
  363. package/dist/lib/position-validator.test.js.map +0 -1
  364. package/dist/lib/prompt-budget.test.d.ts +0 -2
  365. package/dist/lib/prompt-budget.test.d.ts.map +0 -1
  366. package/dist/lib/prompt-budget.test.js +0 -55
  367. package/dist/lib/prompt-budget.test.js.map +0 -1
  368. package/dist/lib/repository-validator.test.d.ts +0 -5
  369. package/dist/lib/repository-validator.test.d.ts.map +0 -1
  370. package/dist/lib/repository-validator.test.js +0 -341
  371. package/dist/lib/repository-validator.test.js.map +0 -1
  372. package/dist/lib/review-core.test.d.ts +0 -2
  373. package/dist/lib/review-core.test.d.ts.map +0 -1
  374. package/dist/lib/review-core.test.js +0 -614
  375. package/dist/lib/review-core.test.js.map +0 -1
  376. package/dist/lib/review-orchestrator.test.d.ts +0 -2
  377. package/dist/lib/review-orchestrator.test.d.ts.map +0 -1
  378. package/dist/lib/review-orchestrator.test.js +0 -552
  379. package/dist/lib/review-orchestrator.test.js.map +0 -1
  380. package/dist/lib/review-output-path.test.d.ts +0 -2
  381. package/dist/lib/review-output-path.test.d.ts.map +0 -1
  382. package/dist/lib/review-output-path.test.js +0 -83
  383. package/dist/lib/review-output-path.test.js.map +0 -1
  384. package/dist/lib/review-parser.test.d.ts +0 -2
  385. package/dist/lib/review-parser.test.d.ts.map +0 -1
  386. package/dist/lib/review-parser.test.js +0 -130
  387. package/dist/lib/review-parser.test.js.map +0 -1
  388. package/dist/lib/review-usage.test.d.ts +0 -2
  389. package/dist/lib/review-usage.test.d.ts.map +0 -1
  390. package/dist/lib/review-usage.test.js +0 -83
  391. package/dist/lib/review-usage.test.js.map +0 -1
  392. package/dist/lib/unified-review-executor.d.ts +0 -58
  393. package/dist/lib/unified-review-executor.d.ts.map +0 -1
  394. package/dist/lib/unified-review-executor.js +0 -201
  395. package/dist/lib/unified-review-executor.js.map +0 -1
  396. package/dist/lib/unified-review-executor.test.d.ts +0 -5
  397. package/dist/lib/unified-review-executor.test.d.ts.map +0 -1
  398. package/dist/lib/unified-review-executor.test.js +0 -472
  399. package/dist/lib/unified-review-executor.test.js.map +0 -1
  400. package/dist/lib/write-json-output.test.d.ts +0 -2
  401. package/dist/lib/write-json-output.test.d.ts.map +0 -1
  402. package/dist/lib/write-json-output.test.js +0 -259
  403. package/dist/lib/write-json-output.test.js.map +0 -1
  404. package/dist/pi/sdk.test.d.ts +0 -2
  405. package/dist/pi/sdk.test.d.ts.map +0 -1
  406. package/dist/pi/sdk.test.js +0 -488
  407. package/dist/pi/sdk.test.js.map +0 -1
  408. package/dist/runtime/agent-loader.test.d.ts +0 -2
  409. package/dist/runtime/agent-loader.test.d.ts.map +0 -1
  410. package/dist/runtime/agent-loader.test.js +0 -277
  411. package/dist/runtime/agent-loader.test.js.map +0 -1
  412. package/dist/runtime/client.test.d.ts +0 -2
  413. package/dist/runtime/client.test.d.ts.map +0 -1
  414. package/dist/runtime/client.test.js +0 -772
  415. package/dist/runtime/client.test.js.map +0 -1
  416. package/dist/runtime/path-config.test.d.ts +0 -2
  417. package/dist/runtime/path-config.test.d.ts.map +0 -1
  418. package/dist/runtime/path-config.test.js +0 -112
  419. package/dist/runtime/path-config.test.js.map +0 -1
@@ -1,727 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { formatIssueComment, formatSummaryComment, formatTerminalIssue, formatErrorComment, calculateSummary, } from './comment-formatter.js';
3
- describe('comment-formatter', () => {
4
- describe('formatIssueComment', () => {
5
- it('should format issue with line number', () => {
6
- const issue = {
7
- category: 'SECURITY',
8
- severity: 'CRITICAL',
9
- title: 'SQL Injection',
10
- file: 'src/db.ts',
11
- line: 42,
12
- problem: 'Unsafe query construction',
13
- solution: 'Use parameterized queries',
14
- agent: 'security',
15
- };
16
- const formatted = formatIssueComment(issue);
17
- expect(formatted).toContain('🔒 SECURITY - SQL Injection');
18
- expect(formatted).toContain('src/db.ts:42');
19
- expect(formatted).toContain('🔴 CRITICAL');
20
- expect(formatted).toContain('security');
21
- expect(formatted).toContain('Unsafe query construction');
22
- expect(formatted).toContain('Use parameterized queries');
23
- });
24
- it('should format issue without line number', () => {
25
- const issue = {
26
- category: 'QUALITY',
27
- severity: 'MEDIUM',
28
- title: 'Code complexity',
29
- file: 'src/app.ts',
30
- problem: 'Function is too complex',
31
- solution: 'Refactor into smaller functions',
32
- agent: 'quality',
33
- };
34
- const formatted = formatIssueComment(issue);
35
- expect(formatted).toContain('📊 QUALITY - Code complexity');
36
- expect(formatted).toContain('src/app.ts`');
37
- expect(formatted).not.toContain('src/app.ts:'); // Should not have line number
38
- expect(formatted).toContain('🟠 MEDIUM');
39
- });
40
- it('should format issue with references', () => {
41
- const issue = {
42
- category: 'SECURITY',
43
- severity: 'HIGH',
44
- title: 'XSS Vulnerability',
45
- file: 'src/render.ts',
46
- line: 10,
47
- problem: 'Unescaped user input',
48
- solution: 'Sanitize input before rendering',
49
- references: ['https://owasp.org/www-community/attacks/xss/', 'CWE-79'],
50
- agent: 'security',
51
- };
52
- const formatted = formatIssueComment(issue);
53
- expect(formatted).toContain('### References');
54
- expect(formatted).toContain('https://owasp.org/www-community/attacks/xss/');
55
- expect(formatted).toContain('CWE-79');
56
- });
57
- it('should include fingerprint when provided', () => {
58
- const issue = {
59
- category: 'STYLE',
60
- severity: 'LOW',
61
- title: 'Missing semicolon',
62
- file: 'src/utils.ts',
63
- line: 5,
64
- problem: 'Inconsistent style',
65
- solution: 'Add semicolon',
66
- agent: 'style',
67
- };
68
- const fingerprint = 'src/utils.ts:5:STYLE:Missing semicolon';
69
- const formatted = formatIssueComment(issue, fingerprint);
70
- expect(formatted).toContain(`<!-- issue-fp: ${fingerprint} -->`);
71
- });
72
- it('should include a Fix in Cursor link when enabled', () => {
73
- const issue = {
74
- category: 'QUALITY',
75
- severity: 'HIGH',
76
- title: 'Bug fix needed',
77
- file: 'src/app.ts',
78
- line: 7,
79
- problem: 'Code is wrong',
80
- solution: 'Fix the code',
81
- agent: 'quality',
82
- };
83
- const formatted = formatIssueComment(issue, undefined, {
84
- enabled: true,
85
- workspace: 'drs',
86
- });
87
- expect(formatted).toContain('[Fix in Cursor](https://cursor.com/link/prompt?');
88
- expect(formatted).toContain('workspace=drs');
89
- });
90
- it('should not include fingerprint when not provided', () => {
91
- const issue = {
92
- category: 'STYLE',
93
- severity: 'LOW',
94
- title: 'Missing semicolon',
95
- file: 'src/utils.ts',
96
- line: 5,
97
- problem: 'Inconsistent style',
98
- solution: 'Add semicolon',
99
- agent: 'style',
100
- };
101
- const formatted = formatIssueComment(issue);
102
- expect(formatted).not.toContain('<!-- issue-fp:');
103
- });
104
- it('should format PERFORMANCE category correctly', () => {
105
- const issue = {
106
- category: 'PERFORMANCE',
107
- severity: 'HIGH',
108
- title: 'Inefficient loop',
109
- file: 'src/process.ts',
110
- line: 20,
111
- problem: 'N^2 complexity',
112
- solution: 'Use hash map for O(n) lookup',
113
- agent: 'performance',
114
- };
115
- const formatted = formatIssueComment(issue);
116
- expect(formatted).toContain('⚡ PERFORMANCE - Inefficient loop');
117
- });
118
- it('should format DOCUMENTATION category correctly', () => {
119
- const issue = {
120
- category: 'DOCUMENTATION',
121
- severity: 'LOW',
122
- title: 'Missing JSDoc',
123
- file: 'src/api.ts',
124
- line: 15,
125
- problem: 'Function lacks documentation',
126
- solution: 'Add JSDoc comment',
127
- agent: 'documentation',
128
- };
129
- const formatted = formatIssueComment(issue);
130
- expect(formatted).toContain('📝 DOCUMENTATION - Missing JSDoc');
131
- expect(formatted).toContain('⚪ LOW');
132
- });
133
- });
134
- describe('formatSummaryComment', () => {
135
- it('should format summary with no issues', () => {
136
- const summary = {
137
- filesReviewed: 5,
138
- issuesFound: 0,
139
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
140
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
141
- };
142
- const formatted = formatSummaryComment(summary, []);
143
- expect(formatted).toContain('📋 Code Review Analysis');
144
- expect(formatted).toContain('Files Reviewed**: 5');
145
- expect(formatted).toContain('Total Issues**: 0');
146
- expect(formatted).toContain('✅ **No issues found!**');
147
- expect(formatted).toContain('DRS');
148
- });
149
- it('should format summary with issues', () => {
150
- const issues = [
151
- {
152
- category: 'SECURITY',
153
- severity: 'CRITICAL',
154
- title: 'SQL Injection',
155
- file: 'src/db.ts',
156
- line: 42,
157
- problem: 'Problem',
158
- solution: 'Solution',
159
- agent: 'security',
160
- },
161
- {
162
- category: 'QUALITY',
163
- severity: 'HIGH',
164
- title: 'Code smell',
165
- file: 'src/app.ts',
166
- line: 10,
167
- problem: 'Problem',
168
- solution: 'Solution',
169
- agent: 'quality',
170
- },
171
- ];
172
- const summary = {
173
- filesReviewed: 2,
174
- issuesFound: 2,
175
- bySeverity: { CRITICAL: 1, HIGH: 1, MEDIUM: 0, LOW: 0 },
176
- byCategory: { SECURITY: 1, QUALITY: 1, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
177
- };
178
- const formatted = formatSummaryComment(summary, issues);
179
- expect(formatted).toContain('Files Reviewed**: 2');
180
- expect(formatted).toContain('Total Issues**: 2');
181
- expect(formatted).toContain('Critical**: 1');
182
- expect(formatted).toContain('High**: 1');
183
- expect(formatted).toContain('Security**: 1');
184
- expect(formatted).toContain('Quality**: 1');
185
- expect(formatted).toContain('🔴 Critical Issues');
186
- expect(formatted).toContain('🟡 High Priority Issues');
187
- expect(formatted).toContain('SQL Injection');
188
- expect(formatted).toContain('Code smell');
189
- });
190
- it('should include comment ID when provided', () => {
191
- const summary = {
192
- filesReviewed: 1,
193
- issuesFound: 0,
194
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
195
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
196
- };
197
- const commentId = 'drs-review-summary';
198
- const formatted = formatSummaryComment(summary, [], commentId);
199
- expect(formatted).toContain(`<!-- drs-comment-id: ${commentId} -->`);
200
- });
201
- it('should include review metadata when provided', () => {
202
- const summary = {
203
- filesReviewed: 1,
204
- issuesFound: 0,
205
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
206
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
207
- };
208
- const formatted = formatSummaryComment(summary, [], undefined, undefined, undefined, undefined, {
209
- headSha: 'abcdef1234567890',
210
- sourceBranch: 'feature/review-metadata',
211
- targetBranch: 'main',
212
- });
213
- expect(formatted).toContain('<!-- drs-reviewed-head-sha: abcdef1234567890 -->');
214
- expect(formatted).toContain('🔎 Review Context');
215
- expect(formatted).toContain('Reviewed Commit**: `abcdef123456`');
216
- expect(formatted).toContain('Branch**: `feature/review-metadata` -> `main`');
217
- });
218
- it('should sanitize review metadata before embedding it', () => {
219
- const summary = {
220
- filesReviewed: 1,
221
- issuesFound: 0,
222
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
223
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
224
- };
225
- const formatted = formatSummaryComment(summary, [], undefined, undefined, undefined, undefined, {
226
- headSha: 'abc-->def',
227
- sourceBranch: 'feature/`branch`',
228
- targetBranch: '`main`',
229
- });
230
- expect(formatted).not.toContain('abc-->def');
231
- expect(formatted).toContain('<!-- drs-reviewed-head-sha: abc- ->def -->');
232
- expect(formatted).toContain('Branch**: `` feature/`branch` `` -> `` `main` ``');
233
- });
234
- it('should include change summary when provided', () => {
235
- const summary = {
236
- filesReviewed: 1,
237
- issuesFound: 0,
238
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
239
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
240
- };
241
- const changeSummary = {
242
- description: 'Added authentication system',
243
- type: 'feature',
244
- complexity: 'high',
245
- riskLevel: 'medium',
246
- subsystems: ['auth', 'api'],
247
- };
248
- const formatted = formatSummaryComment(summary, [], undefined, changeSummary);
249
- expect(formatted).toContain('🧭 Change Summary');
250
- expect(formatted).toContain('Added authentication system');
251
- expect(formatted).toContain('Type**: feature');
252
- expect(formatted).toContain('Complexity**: high');
253
- expect(formatted).toContain('Risk Level**: medium');
254
- expect(formatted).toContain('Affected Subsystems**: auth, api');
255
- });
256
- it('should format medium priority issues', () => {
257
- const issues = [
258
- {
259
- category: 'QUALITY',
260
- severity: 'MEDIUM',
261
- title: 'Medium issue',
262
- file: 'file.ts',
263
- line: 10,
264
- problem: 'Problem',
265
- solution: 'Solution',
266
- agent: 'quality',
267
- },
268
- ];
269
- const summary = {
270
- filesReviewed: 1,
271
- issuesFound: 1,
272
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 1, LOW: 0 },
273
- byCategory: { SECURITY: 0, QUALITY: 1, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
274
- };
275
- const formatted = formatSummaryComment(summary, issues);
276
- expect(formatted).toContain('🟠 Medium Priority Issues');
277
- expect(formatted).toContain('Medium issue');
278
- });
279
- it('should format low priority issues', () => {
280
- const issues = [
281
- {
282
- category: 'STYLE',
283
- severity: 'LOW',
284
- title: 'Low issue',
285
- file: 'file.ts',
286
- line: 10,
287
- problem: 'Problem',
288
- solution: 'Solution',
289
- agent: 'style',
290
- },
291
- ];
292
- const summary = {
293
- filesReviewed: 1,
294
- issuesFound: 1,
295
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 1 },
296
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 1, PERFORMANCE: 0, DOCUMENTATION: 0 },
297
- };
298
- const formatted = formatSummaryComment(summary, issues);
299
- expect(formatted).toContain('⚪ Low Priority Issues');
300
- expect(formatted).toContain('Low issue');
301
- });
302
- it('should include references in issue details', () => {
303
- const issues = [
304
- {
305
- category: 'SECURITY',
306
- severity: 'CRITICAL',
307
- title: 'Issue with refs',
308
- file: 'file.ts',
309
- line: 10,
310
- problem: 'Problem',
311
- solution: 'Solution',
312
- references: ['https://example.com', 'CWE-123'],
313
- agent: 'security',
314
- },
315
- ];
316
- const summary = {
317
- filesReviewed: 1,
318
- issuesFound: 1,
319
- bySeverity: { CRITICAL: 1, HIGH: 0, MEDIUM: 0, LOW: 0 },
320
- byCategory: { SECURITY: 1, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
321
- };
322
- const formatted = formatSummaryComment(summary, issues);
323
- expect(formatted).toContain('**References**: https://example.com, CWE-123');
324
- });
325
- it('should handle change summary without subsystems', () => {
326
- const summary = {
327
- filesReviewed: 1,
328
- issuesFound: 0,
329
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
330
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
331
- };
332
- const changeSummary = {
333
- description: 'Minor fix',
334
- type: 'bugfix',
335
- complexity: 'simple',
336
- riskLevel: 'low',
337
- subsystems: [],
338
- };
339
- const formatted = formatSummaryComment(summary, [], undefined, changeSummary);
340
- expect(formatted).toContain('Minor fix');
341
- expect(formatted).not.toContain('Affected Subsystems');
342
- });
343
- it('should include expandable usage block when usage data is provided', () => {
344
- const summary = {
345
- filesReviewed: 3,
346
- issuesFound: 0,
347
- bySeverity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
348
- byCategory: { SECURITY: 0, QUALITY: 0, STYLE: 0, PERFORMANCE: 0, DOCUMENTATION: 0 },
349
- };
350
- const usage = {
351
- total: {
352
- input: 1234,
353
- output: 234,
354
- cacheRead: 500,
355
- cacheWrite: 0,
356
- totalTokens: 1968,
357
- cost: 0.0423,
358
- },
359
- agents: [
360
- {
361
- agentType: 'unified-reviewer',
362
- model: 'opencode/glm-5-free',
363
- turns: 4,
364
- success: true,
365
- usage: {
366
- input: 1234,
367
- output: 234,
368
- cacheRead: 500,
369
- cacheWrite: 0,
370
- totalTokens: 1968,
371
- cost: 0.0423,
372
- },
373
- },
374
- ],
375
- };
376
- const formatted = formatSummaryComment(summary, [], undefined, undefined, usage);
377
- expect(formatted).toContain('💰 Model Usage');
378
- expect(formatted).toContain('<details>');
379
- expect(formatted).toContain('View token and cost breakdown');
380
- expect(formatted).toContain('| Agent | Model | Turns | Input | Output | Cache Read |');
381
- expect(formatted).toContain('unified-reviewer');
382
- expect(formatted).toContain('opencode/glm-5-free');
383
- expect(formatted).toContain('$0.0423');
384
- expect(formatted).toContain('</details>');
385
- });
386
- });
387
- describe('formatTerminalIssue', () => {
388
- it('should format issue for terminal output', () => {
389
- const issue = {
390
- category: 'SECURITY',
391
- severity: 'CRITICAL',
392
- title: 'Security Issue',
393
- file: 'src/app.ts',
394
- line: 10,
395
- problem: 'This is a problem',
396
- solution: 'This is a solution',
397
- agent: 'security',
398
- };
399
- const formatted = formatTerminalIssue(issue);
400
- expect(formatted).toContain('🔴 CRITICAL');
401
- expect(formatted).toContain('🔒 SECURITY');
402
- expect(formatted).toContain('Security Issue');
403
- expect(formatted).toContain('📁 src/app.ts:10');
404
- expect(formatted).toContain('This is a problem');
405
- expect(formatted).toContain('✅ Fix: This is a solution');
406
- expect(formatted).toContain('━━━'); // Border
407
- });
408
- it('should format issue without line number', () => {
409
- const issue = {
410
- category: 'QUALITY',
411
- severity: 'MEDIUM',
412
- title: 'Quality Issue',
413
- file: 'src/utils.ts',
414
- problem: 'Problem description',
415
- solution: 'Solution description',
416
- agent: 'quality',
417
- };
418
- const formatted = formatTerminalIssue(issue);
419
- expect(formatted).toContain('📁 src/utils.ts');
420
- expect(formatted).not.toContain('src/utils.ts:'); // Should not have line number
421
- });
422
- it('should format all severity levels correctly', () => {
423
- const severities = [
424
- { severity: 'CRITICAL', emoji: '🔴' },
425
- { severity: 'HIGH', emoji: '🟡' },
426
- { severity: 'MEDIUM', emoji: '🟠' },
427
- { severity: 'LOW', emoji: '⚪' },
428
- ];
429
- for (const { severity, emoji } of severities) {
430
- const issue = {
431
- category: 'SECURITY',
432
- severity,
433
- title: 'Test',
434
- file: 'test.ts',
435
- line: 1,
436
- problem: 'Problem',
437
- solution: 'Solution',
438
- agent: 'test',
439
- };
440
- const formatted = formatTerminalIssue(issue);
441
- expect(formatted).toContain(`${emoji} ${severity}`);
442
- }
443
- });
444
- it('should format all categories correctly', () => {
445
- const categories = [
446
- { category: 'SECURITY', emoji: '🔒' },
447
- { category: 'QUALITY', emoji: '📊' },
448
- { category: 'STYLE', emoji: '✨' },
449
- { category: 'PERFORMANCE', emoji: '⚡' },
450
- { category: 'DOCUMENTATION', emoji: '📝' },
451
- ];
452
- for (const { category, emoji } of categories) {
453
- const issue = {
454
- category,
455
- severity: 'MEDIUM',
456
- title: 'Test',
457
- file: 'test.ts',
458
- line: 1,
459
- problem: 'Problem',
460
- solution: 'Solution',
461
- agent: 'test',
462
- };
463
- const formatted = formatTerminalIssue(issue);
464
- expect(formatted).toContain(`${emoji} ${category}`);
465
- }
466
- });
467
- });
468
- describe('calculateSummary', () => {
469
- it('should calculate summary for empty issues', () => {
470
- const summary = calculateSummary(5, []);
471
- expect(summary.filesReviewed).toBe(5);
472
- expect(summary.issuesFound).toBe(0);
473
- expect(summary.bySeverity.CRITICAL).toBe(0);
474
- expect(summary.bySeverity.HIGH).toBe(0);
475
- expect(summary.bySeverity.MEDIUM).toBe(0);
476
- expect(summary.bySeverity.LOW).toBe(0);
477
- expect(summary.byCategory.SECURITY).toBe(0);
478
- expect(summary.byCategory.QUALITY).toBe(0);
479
- expect(summary.byCategory.STYLE).toBe(0);
480
- expect(summary.byCategory.PERFORMANCE).toBe(0);
481
- expect(summary.byCategory.DOCUMENTATION).toBe(0);
482
- });
483
- it('should calculate summary with mixed severity issues', () => {
484
- const issues = [
485
- {
486
- category: 'SECURITY',
487
- severity: 'CRITICAL',
488
- title: 'Issue 1',
489
- file: 'file.ts',
490
- line: 1,
491
- problem: 'Problem',
492
- solution: 'Solution',
493
- agent: 'security',
494
- },
495
- {
496
- category: 'SECURITY',
497
- severity: 'HIGH',
498
- title: 'Issue 2',
499
- file: 'file.ts',
500
- line: 2,
501
- problem: 'Problem',
502
- solution: 'Solution',
503
- agent: 'security',
504
- },
505
- {
506
- category: 'QUALITY',
507
- severity: 'MEDIUM',
508
- title: 'Issue 3',
509
- file: 'file.ts',
510
- line: 3,
511
- problem: 'Problem',
512
- solution: 'Solution',
513
- agent: 'quality',
514
- },
515
- {
516
- category: 'STYLE',
517
- severity: 'LOW',
518
- title: 'Issue 4',
519
- file: 'file.ts',
520
- line: 4,
521
- problem: 'Problem',
522
- solution: 'Solution',
523
- agent: 'style',
524
- },
525
- ];
526
- const summary = calculateSummary(3, issues);
527
- expect(summary.filesReviewed).toBe(3);
528
- expect(summary.issuesFound).toBe(4);
529
- expect(summary.bySeverity.CRITICAL).toBe(1);
530
- expect(summary.bySeverity.HIGH).toBe(1);
531
- expect(summary.bySeverity.MEDIUM).toBe(1);
532
- expect(summary.bySeverity.LOW).toBe(1);
533
- expect(summary.byCategory.SECURITY).toBe(2);
534
- expect(summary.byCategory.QUALITY).toBe(1);
535
- expect(summary.byCategory.STYLE).toBe(1);
536
- });
537
- it('should calculate summary with multiple issues of same severity', () => {
538
- const issues = [
539
- {
540
- category: 'SECURITY',
541
- severity: 'CRITICAL',
542
- title: 'Issue 1',
543
- file: 'file.ts',
544
- line: 1,
545
- problem: 'Problem',
546
- solution: 'Solution',
547
- agent: 'security',
548
- },
549
- {
550
- category: 'QUALITY',
551
- severity: 'CRITICAL',
552
- title: 'Issue 2',
553
- file: 'file.ts',
554
- line: 2,
555
- problem: 'Problem',
556
- solution: 'Solution',
557
- agent: 'quality',
558
- },
559
- {
560
- category: 'PERFORMANCE',
561
- severity: 'CRITICAL',
562
- title: 'Issue 3',
563
- file: 'file.ts',
564
- line: 3,
565
- problem: 'Problem',
566
- solution: 'Solution',
567
- agent: 'performance',
568
- },
569
- ];
570
- const summary = calculateSummary(1, issues);
571
- expect(summary.issuesFound).toBe(3);
572
- expect(summary.bySeverity.CRITICAL).toBe(3);
573
- expect(summary.byCategory.SECURITY).toBe(1);
574
- expect(summary.byCategory.QUALITY).toBe(1);
575
- expect(summary.byCategory.PERFORMANCE).toBe(1);
576
- });
577
- it('should calculate summary with multiple issues of same category', () => {
578
- const issues = [
579
- {
580
- category: 'SECURITY',
581
- severity: 'CRITICAL',
582
- title: 'Issue 1',
583
- file: 'file.ts',
584
- line: 1,
585
- problem: 'Problem',
586
- solution: 'Solution',
587
- agent: 'security',
588
- },
589
- {
590
- category: 'SECURITY',
591
- severity: 'HIGH',
592
- title: 'Issue 2',
593
- file: 'file.ts',
594
- line: 2,
595
- problem: 'Problem',
596
- solution: 'Solution',
597
- agent: 'security',
598
- },
599
- {
600
- category: 'SECURITY',
601
- severity: 'MEDIUM',
602
- title: 'Issue 3',
603
- file: 'file.ts',
604
- line: 3,
605
- problem: 'Problem',
606
- solution: 'Solution',
607
- agent: 'security',
608
- },
609
- ];
610
- const summary = calculateSummary(1, issues);
611
- expect(summary.issuesFound).toBe(3);
612
- expect(summary.byCategory.SECURITY).toBe(3);
613
- expect(summary.bySeverity.CRITICAL).toBe(1);
614
- expect(summary.bySeverity.HIGH).toBe(1);
615
- expect(summary.bySeverity.MEDIUM).toBe(1);
616
- });
617
- it('should handle zero files reviewed', () => {
618
- const issues = [
619
- {
620
- category: 'STYLE',
621
- severity: 'LOW',
622
- title: 'Issue',
623
- file: 'file.ts',
624
- line: 1,
625
- problem: 'Problem',
626
- solution: 'Solution',
627
- agent: 'style',
628
- },
629
- ];
630
- const summary = calculateSummary(0, issues);
631
- expect(summary.filesReviewed).toBe(0);
632
- expect(summary.issuesFound).toBe(1);
633
- });
634
- it('should handle all categories and severities', () => {
635
- const issues = [
636
- {
637
- category: 'SECURITY',
638
- severity: 'CRITICAL',
639
- title: '1',
640
- file: 'f.ts',
641
- line: 1,
642
- problem: 'P',
643
- solution: 'S',
644
- agent: 'a',
645
- },
646
- {
647
- category: 'QUALITY',
648
- severity: 'HIGH',
649
- title: '2',
650
- file: 'f.ts',
651
- line: 2,
652
- problem: 'P',
653
- solution: 'S',
654
- agent: 'a',
655
- },
656
- {
657
- category: 'STYLE',
658
- severity: 'MEDIUM',
659
- title: '3',
660
- file: 'f.ts',
661
- line: 3,
662
- problem: 'P',
663
- solution: 'S',
664
- agent: 'a',
665
- },
666
- {
667
- category: 'PERFORMANCE',
668
- severity: 'LOW',
669
- title: '4',
670
- file: 'f.ts',
671
- line: 4,
672
- problem: 'P',
673
- solution: 'S',
674
- agent: 'a',
675
- },
676
- {
677
- category: 'DOCUMENTATION',
678
- severity: 'LOW',
679
- title: '5',
680
- file: 'f.ts',
681
- line: 5,
682
- problem: 'P',
683
- solution: 'S',
684
- agent: 'a',
685
- },
686
- ];
687
- const summary = calculateSummary(5, issues);
688
- expect(summary.issuesFound).toBe(5);
689
- expect(summary.byCategory.SECURITY).toBe(1);
690
- expect(summary.byCategory.QUALITY).toBe(1);
691
- expect(summary.byCategory.STYLE).toBe(1);
692
- expect(summary.byCategory.PERFORMANCE).toBe(1);
693
- expect(summary.byCategory.DOCUMENTATION).toBe(1);
694
- expect(summary.bySeverity.CRITICAL).toBe(1);
695
- expect(summary.bySeverity.HIGH).toBe(1);
696
- expect(summary.bySeverity.MEDIUM).toBe(1);
697
- expect(summary.bySeverity.LOW).toBe(2);
698
- });
699
- });
700
- describe('formatErrorComment', () => {
701
- it('should format error comment with standard message', () => {
702
- const formatted = formatErrorComment();
703
- expect(formatted).toContain(':warning: DRS Review Failed');
704
- expect(formatted).toContain('automated code review encountered an error');
705
- expect(formatted).toContain('check the CI/CD logs');
706
- expect(formatted).toContain('automatically removed when the review succeeds');
707
- expect(formatted).toContain('DRS');
708
- });
709
- it('should include comment ID when provided', () => {
710
- const formatted = formatErrorComment('drs-error');
711
- expect(formatted).toContain('<!-- drs-comment-id: drs-error -->');
712
- });
713
- it('should not include comment ID when not provided', () => {
714
- const formatted = formatErrorComment();
715
- expect(formatted).not.toContain('<!-- drs-comment-id:');
716
- });
717
- it('should not expose error details in comment', () => {
718
- // Error details should not be in the comment - users should check CI/CD logs
719
- const formatted = formatErrorComment('drs-error');
720
- // Should contain the log directive
721
- expect(formatted).toContain('Please check the CI/CD logs for error details');
722
- // Should not have a code block for error messages
723
- expect(formatted).not.toContain('```');
724
- });
725
- });
726
- });
727
- //# sourceMappingURL=comment-formatter.test.js.map