@diff-review-system/drs 3.3.1 → 4.0.1

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