oc-pilot 0.5.1 → 0.88.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 (481) hide show
  1. package/CHANGELOG.md +683 -0
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +588 -20
  4. package/README.ru.md +572 -10
  5. package/dist/cli.js +185 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cli.test.js +1211 -1
  8. package/dist/cli.test.js.map +1 -1
  9. package/dist/commands/anti-regression.js +97 -0
  10. package/dist/commands/anti-regression.js.map +1 -0
  11. package/dist/commands/arch-diff.js +80 -0
  12. package/dist/commands/arch-diff.js.map +1 -0
  13. package/dist/commands/authz.js +167 -0
  14. package/dist/commands/authz.js.map +1 -0
  15. package/dist/commands/autopsy.js +64 -0
  16. package/dist/commands/autopsy.js.map +1 -0
  17. package/dist/commands/bankruptcy.js +60 -0
  18. package/dist/commands/bankruptcy.js.map +1 -0
  19. package/dist/commands/battle.js +119 -0
  20. package/dist/commands/battle.js.map +1 -0
  21. package/dist/commands/boundaries.js +114 -0
  22. package/dist/commands/boundaries.js.map +1 -0
  23. package/dist/commands/bounty.js +56 -0
  24. package/dist/commands/bounty.js.map +1 -0
  25. package/dist/commands/brag.js +62 -0
  26. package/dist/commands/brag.js.map +1 -0
  27. package/dist/commands/cache.js +62 -0
  28. package/dist/commands/cache.js.map +1 -0
  29. package/dist/commands/cinema.js +61 -0
  30. package/dist/commands/cinema.js.map +1 -0
  31. package/dist/commands/cleanup.js +110 -0
  32. package/dist/commands/cleanup.js.map +1 -0
  33. package/dist/commands/commit.js +177 -0
  34. package/dist/commands/commit.js.map +1 -0
  35. package/dist/commands/commit.test.js +160 -0
  36. package/dist/commands/commit.test.js.map +1 -0
  37. package/dist/commands/compliance.js +121 -0
  38. package/dist/commands/compliance.js.map +1 -0
  39. package/dist/commands/contract-drift.js +97 -0
  40. package/dist/commands/contract-drift.js.map +1 -0
  41. package/dist/commands/coverage.js +137 -0
  42. package/dist/commands/coverage.js.map +1 -0
  43. package/dist/commands/day.js +116 -0
  44. package/dist/commands/day.js.map +1 -0
  45. package/dist/commands/day.test.js +45 -0
  46. package/dist/commands/day.test.js.map +1 -0
  47. package/dist/commands/deps.js +245 -0
  48. package/dist/commands/deps.js.map +1 -0
  49. package/dist/commands/docgen.js +4 -2
  50. package/dist/commands/docgen.js.map +1 -1
  51. package/dist/commands/doctor.js +146 -2
  52. package/dist/commands/doctor.js.map +1 -1
  53. package/dist/commands/doctor.test.js +69 -0
  54. package/dist/commands/doctor.test.js.map +1 -0
  55. package/dist/commands/echo.js +78 -0
  56. package/dist/commands/echo.js.map +1 -0
  57. package/dist/commands/ecosystem-verify.js +113 -0
  58. package/dist/commands/ecosystem-verify.js.map +1 -0
  59. package/dist/commands/env-sync.js +102 -0
  60. package/dist/commands/env-sync.js.map +1 -0
  61. package/dist/commands/explain.js +115 -0
  62. package/dist/commands/explain.js.map +1 -0
  63. package/dist/commands/fix.js +145 -3
  64. package/dist/commands/fix.js.map +1 -1
  65. package/dist/commands/flaky.js +111 -0
  66. package/dist/commands/flaky.js.map +1 -0
  67. package/dist/commands/fuzz.js +119 -0
  68. package/dist/commands/fuzz.js.map +1 -0
  69. package/dist/commands/hivemind.js +124 -0
  70. package/dist/commands/hivemind.js.map +1 -0
  71. package/dist/commands/impact.js +73 -0
  72. package/dist/commands/impact.js.map +1 -0
  73. package/dist/commands/init.js +73 -11
  74. package/dist/commands/init.js.map +1 -1
  75. package/dist/commands/init.test.js +138 -0
  76. package/dist/commands/init.test.js.map +1 -0
  77. package/dist/commands/install-hook.js +161 -0
  78. package/dist/commands/install-hook.js.map +1 -0
  79. package/dist/commands/install-hook.test.js +100 -0
  80. package/dist/commands/install-hook.test.js.map +1 -0
  81. package/dist/commands/invariants.js +103 -0
  82. package/dist/commands/invariants.js.map +1 -0
  83. package/dist/commands/mock-leak.js +97 -0
  84. package/dist/commands/mock-leak.js.map +1 -0
  85. package/dist/commands/mutate.js +99 -0
  86. package/dist/commands/mutate.js.map +1 -0
  87. package/dist/commands/pack.js +144 -0
  88. package/dist/commands/pack.js.map +1 -0
  89. package/dist/commands/preflight.js +137 -0
  90. package/dist/commands/preflight.js.map +1 -0
  91. package/dist/commands/query.js +57 -0
  92. package/dist/commands/query.js.map +1 -0
  93. package/dist/commands/ready.js +152 -0
  94. package/dist/commands/ready.js.map +1 -0
  95. package/dist/commands/receipt.js +289 -0
  96. package/dist/commands/receipt.js.map +1 -0
  97. package/dist/commands/replay.js +112 -0
  98. package/dist/commands/replay.js.map +1 -0
  99. package/dist/commands/replay.test.js +125 -0
  100. package/dist/commands/replay.test.js.map +1 -0
  101. package/dist/commands/restore.js +54 -0
  102. package/dist/commands/restore.js.map +1 -0
  103. package/dist/commands/review.js +263 -4
  104. package/dist/commands/review.js.map +1 -1
  105. package/dist/commands/review.test.js +160 -0
  106. package/dist/commands/review.test.js.map +1 -0
  107. package/dist/commands/reviewers.js +86 -0
  108. package/dist/commands/reviewers.js.map +1 -0
  109. package/dist/commands/roast.js +102 -0
  110. package/dist/commands/roast.js.map +1 -0
  111. package/dist/commands/sandbox.js +82 -0
  112. package/dist/commands/sandbox.js.map +1 -0
  113. package/dist/commands/sast.js +162 -0
  114. package/dist/commands/sast.js.map +1 -0
  115. package/dist/commands/scan.js +47 -12
  116. package/dist/commands/scan.js.map +1 -1
  117. package/dist/commands/slop.js +145 -0
  118. package/dist/commands/slop.js.map +1 -0
  119. package/dist/commands/slop.test.js +135 -0
  120. package/dist/commands/slop.test.js.map +1 -0
  121. package/dist/commands/stats.js +61 -0
  122. package/dist/commands/stats.js.map +1 -0
  123. package/dist/commands/test-gen.js +372 -0
  124. package/dist/commands/test-gen.js.map +1 -0
  125. package/dist/commands/test-guard.js +89 -0
  126. package/dist/commands/test-guard.js.map +1 -0
  127. package/dist/commands/test-plan.js +133 -0
  128. package/dist/commands/test-plan.js.map +1 -0
  129. package/dist/commands/zoom-symbol.js +52 -0
  130. package/dist/commands/zoom-symbol.js.map +1 -0
  131. package/dist/core/agent-rules.js +35 -0
  132. package/dist/core/agent-rules.js.map +1 -0
  133. package/dist/core/anthropic.test.js +116 -0
  134. package/dist/core/anthropic.test.js.map +1 -0
  135. package/dist/core/anti-regression.js +161 -0
  136. package/dist/core/anti-regression.js.map +1 -0
  137. package/dist/core/anti-regression.test.js +154 -0
  138. package/dist/core/anti-regression.test.js.map +1 -0
  139. package/dist/core/aql.js +220 -0
  140. package/dist/core/aql.js.map +1 -0
  141. package/dist/core/aql.test.js +64 -0
  142. package/dist/core/aql.test.js.map +1 -0
  143. package/dist/core/arch-diff.js +122 -0
  144. package/dist/core/arch-diff.js.map +1 -0
  145. package/dist/core/arch-diff.test.js +93 -0
  146. package/dist/core/arch-diff.test.js.map +1 -0
  147. package/dist/core/authz.js +292 -0
  148. package/dist/core/authz.js.map +1 -0
  149. package/dist/core/authz.test.js +115 -0
  150. package/dist/core/authz.test.js.map +1 -0
  151. package/dist/core/autopsy.js +230 -0
  152. package/dist/core/autopsy.js.map +1 -0
  153. package/dist/core/autopsy.test.js +106 -0
  154. package/dist/core/autopsy.test.js.map +1 -0
  155. package/dist/core/bankruptcy.js +232 -0
  156. package/dist/core/bankruptcy.js.map +1 -0
  157. package/dist/core/bankruptcy.test.js +91 -0
  158. package/dist/core/bankruptcy.test.js.map +1 -0
  159. package/dist/core/baseline.js +131 -0
  160. package/dist/core/baseline.js.map +1 -0
  161. package/dist/core/baseline.test.js +91 -0
  162. package/dist/core/baseline.test.js.map +1 -0
  163. package/dist/core/battle.js +213 -0
  164. package/dist/core/battle.js.map +1 -0
  165. package/dist/core/battle.test.js +116 -0
  166. package/dist/core/battle.test.js.map +1 -0
  167. package/dist/core/boundaries.js +200 -0
  168. package/dist/core/boundaries.js.map +1 -0
  169. package/dist/core/boundaries.test.js +62 -0
  170. package/dist/core/boundaries.test.js.map +1 -0
  171. package/dist/core/bounty.js +128 -0
  172. package/dist/core/bounty.js.map +1 -0
  173. package/dist/core/bounty.test.js +82 -0
  174. package/dist/core/bounty.test.js.map +1 -0
  175. package/dist/core/brag.js +174 -0
  176. package/dist/core/brag.js.map +1 -0
  177. package/dist/core/brag.test.js +43 -0
  178. package/dist/core/brag.test.js.map +1 -0
  179. package/dist/core/cache.js +189 -0
  180. package/dist/core/cache.js.map +1 -0
  181. package/dist/core/cache.test.js +159 -0
  182. package/dist/core/cache.test.js.map +1 -0
  183. package/dist/core/cinema.js +242 -0
  184. package/dist/core/cinema.js.map +1 -0
  185. package/dist/core/cinema.test.js +73 -0
  186. package/dist/core/cinema.test.js.map +1 -0
  187. package/dist/core/cleanup.js +107 -0
  188. package/dist/core/cleanup.js.map +1 -0
  189. package/dist/core/compliance.js +193 -0
  190. package/dist/core/compliance.js.map +1 -0
  191. package/dist/core/compliance.test.js +123 -0
  192. package/dist/core/compliance.test.js.map +1 -0
  193. package/dist/core/config.js +78 -0
  194. package/dist/core/config.js.map +1 -1
  195. package/dist/core/config.test.js +66 -0
  196. package/dist/core/config.test.js.map +1 -1
  197. package/dist/core/contract-drift.js +296 -0
  198. package/dist/core/contract-drift.js.map +1 -0
  199. package/dist/core/contract-drift.test.js +166 -0
  200. package/dist/core/contract-drift.test.js.map +1 -0
  201. package/dist/core/cost.test.js +103 -0
  202. package/dist/core/cost.test.js.map +1 -0
  203. package/dist/core/coverage.js +335 -0
  204. package/dist/core/coverage.js.map +1 -0
  205. package/dist/core/coverage.test.js +190 -0
  206. package/dist/core/coverage.test.js.map +1 -0
  207. package/dist/core/deps-fix.js +169 -0
  208. package/dist/core/deps-fix.js.map +1 -0
  209. package/dist/core/deps-fix.test.js +176 -0
  210. package/dist/core/deps-fix.test.js.map +1 -0
  211. package/dist/core/deps-health.js +353 -0
  212. package/dist/core/deps-health.js.map +1 -0
  213. package/dist/core/deps-health.test.js +230 -0
  214. package/dist/core/deps-health.test.js.map +1 -0
  215. package/dist/core/deps-why.js +260 -0
  216. package/dist/core/deps-why.js.map +1 -0
  217. package/dist/core/deps-why.test.js +175 -0
  218. package/dist/core/deps-why.test.js.map +1 -0
  219. package/dist/core/deps.js +179 -0
  220. package/dist/core/deps.js.map +1 -0
  221. package/dist/core/deps.test.js +88 -0
  222. package/dist/core/deps.test.js.map +1 -0
  223. package/dist/core/diff-source.js +4 -2
  224. package/dist/core/diff-source.js.map +1 -1
  225. package/dist/core/echo.js +151 -0
  226. package/dist/core/echo.js.map +1 -0
  227. package/dist/core/echo.test.js +90 -0
  228. package/dist/core/echo.test.js.map +1 -0
  229. package/dist/core/ecosystem-verify.js +331 -0
  230. package/dist/core/ecosystem-verify.js.map +1 -0
  231. package/dist/core/ecosystem-verify.test.js +158 -0
  232. package/dist/core/ecosystem-verify.test.js.map +1 -0
  233. package/dist/core/engine-preset.test.js +60 -0
  234. package/dist/core/engine-preset.test.js.map +1 -0
  235. package/dist/core/engine.js +278 -32
  236. package/dist/core/engine.js.map +1 -1
  237. package/dist/core/engine.test.js +63 -0
  238. package/dist/core/engine.test.js.map +1 -1
  239. package/dist/core/env-sync.js +122 -0
  240. package/dist/core/env-sync.js.map +1 -0
  241. package/dist/core/env-sync.test.js +99 -0
  242. package/dist/core/env-sync.test.js.map +1 -0
  243. package/dist/core/file-context.js +4 -2
  244. package/dist/core/file-context.js.map +1 -1
  245. package/dist/core/findings-baseline.js +60 -0
  246. package/dist/core/findings-baseline.js.map +1 -0
  247. package/dist/core/findings-baseline.test.js +77 -0
  248. package/dist/core/findings-baseline.test.js.map +1 -0
  249. package/dist/core/findings.js +68 -21
  250. package/dist/core/findings.js.map +1 -1
  251. package/dist/core/flaky.js +137 -0
  252. package/dist/core/flaky.js.map +1 -0
  253. package/dist/core/flaky.test.js +97 -0
  254. package/dist/core/flaky.test.js.map +1 -0
  255. package/dist/core/format.js +5 -3
  256. package/dist/core/format.js.map +1 -1
  257. package/dist/core/fuzz.js +306 -0
  258. package/dist/core/fuzz.js.map +1 -0
  259. package/dist/core/fuzz.test.js +121 -0
  260. package/dist/core/fuzz.test.js.map +1 -0
  261. package/dist/core/git.js +22 -0
  262. package/dist/core/git.js.map +1 -1
  263. package/dist/core/gitlab.js +176 -0
  264. package/dist/core/gitlab.js.map +1 -0
  265. package/dist/core/gitlab.test.js +199 -0
  266. package/dist/core/gitlab.test.js.map +1 -0
  267. package/dist/core/hivemind.js +250 -0
  268. package/dist/core/hivemind.js.map +1 -0
  269. package/dist/core/hivemind.test.js +79 -0
  270. package/dist/core/hivemind.test.js.map +1 -0
  271. package/dist/core/hologram.js +463 -0
  272. package/dist/core/hologram.js.map +1 -0
  273. package/dist/core/hologram.test.js +124 -0
  274. package/dist/core/hologram.test.js.map +1 -0
  275. package/dist/core/impact.js +240 -0
  276. package/dist/core/impact.js.map +1 -0
  277. package/dist/core/impact.test.js +105 -0
  278. package/dist/core/impact.test.js.map +1 -0
  279. package/dist/core/import-graph.js +170 -0
  280. package/dist/core/import-graph.js.map +1 -0
  281. package/dist/core/import-graph.test.js +52 -0
  282. package/dist/core/import-graph.test.js.map +1 -0
  283. package/dist/core/injection.js +55 -0
  284. package/dist/core/injection.js.map +1 -0
  285. package/dist/core/injection.test.js +45 -0
  286. package/dist/core/injection.test.js.map +1 -0
  287. package/dist/core/invariants.js +286 -0
  288. package/dist/core/invariants.js.map +1 -0
  289. package/dist/core/invariants.test.js +87 -0
  290. package/dist/core/invariants.test.js.map +1 -0
  291. package/dist/core/last-review.js +92 -0
  292. package/dist/core/last-review.js.map +1 -0
  293. package/dist/core/last-review.test.js +97 -0
  294. package/dist/core/last-review.test.js.map +1 -0
  295. package/dist/core/lockfile-support.test.js +112 -0
  296. package/dist/core/lockfile-support.test.js.map +1 -0
  297. package/dist/core/lockfile.js +284 -0
  298. package/dist/core/lockfile.js.map +1 -0
  299. package/dist/core/lockfile.test.js +203 -0
  300. package/dist/core/lockfile.test.js.map +1 -0
  301. package/dist/core/mock-leak.js +120 -0
  302. package/dist/core/mock-leak.js.map +1 -0
  303. package/dist/core/mock-leak.test.js +79 -0
  304. package/dist/core/mock-leak.test.js.map +1 -0
  305. package/dist/core/mutation.js +206 -0
  306. package/dist/core/mutation.js.map +1 -0
  307. package/dist/core/mutation.test.js +104 -0
  308. package/dist/core/mutation.test.js.map +1 -0
  309. package/dist/core/opencode.js +15 -2
  310. package/dist/core/opencode.js.map +1 -1
  311. package/dist/core/opencode.test.js +10 -1
  312. package/dist/core/opencode.test.js.map +1 -1
  313. package/dist/core/options.js +51 -3
  314. package/dist/core/options.js.map +1 -1
  315. package/dist/core/osv.js +202 -0
  316. package/dist/core/osv.js.map +1 -0
  317. package/dist/core/osv.test.js +173 -0
  318. package/dist/core/osv.test.js.map +1 -0
  319. package/dist/core/output-format.test.js +102 -0
  320. package/dist/core/output-format.test.js.map +1 -0
  321. package/dist/core/pack.js +212 -0
  322. package/dist/core/pack.js.map +1 -0
  323. package/dist/core/pack.test.js +129 -0
  324. package/dist/core/pack.test.js.map +1 -0
  325. package/dist/core/phantom.js +155 -0
  326. package/dist/core/phantom.js.map +1 -0
  327. package/dist/core/phantom.test.js +58 -0
  328. package/dist/core/phantom.test.js.map +1 -0
  329. package/dist/core/pr-comment.js +116 -0
  330. package/dist/core/pr-comment.js.map +1 -0
  331. package/dist/core/pr-comment.test.js +53 -0
  332. package/dist/core/pr-comment.test.js.map +1 -0
  333. package/dist/core/pr-review.js +160 -0
  334. package/dist/core/pr-review.js.map +1 -0
  335. package/dist/core/pr-review.test.js +62 -0
  336. package/dist/core/pr-review.test.js.map +1 -0
  337. package/dist/core/preflight-run.js +106 -0
  338. package/dist/core/preflight-run.js.map +1 -0
  339. package/dist/core/preflight.js +173 -0
  340. package/dist/core/preflight.js.map +1 -0
  341. package/dist/core/preflight.test.js +187 -0
  342. package/dist/core/preflight.test.js.map +1 -0
  343. package/dist/core/presets.js +408 -0
  344. package/dist/core/presets.js.map +1 -0
  345. package/dist/core/presets.test.js +79 -0
  346. package/dist/core/presets.test.js.map +1 -0
  347. package/dist/core/prompt.golden.test.js +74 -0
  348. package/dist/core/prompt.golden.test.js.map +1 -0
  349. package/dist/core/prompt.js +43 -4
  350. package/dist/core/prompt.js.map +1 -1
  351. package/dist/core/prompt.test.js +16 -0
  352. package/dist/core/prompt.test.js.map +1 -1
  353. package/dist/core/readiness-fix.js +111 -0
  354. package/dist/core/readiness-fix.js.map +1 -0
  355. package/dist/core/readiness-fix.test.js +99 -0
  356. package/dist/core/readiness-fix.test.js.map +1 -0
  357. package/dist/core/readiness.js +189 -0
  358. package/dist/core/readiness.js.map +1 -0
  359. package/dist/core/readiness.test.js +199 -0
  360. package/dist/core/readiness.test.js.map +1 -0
  361. package/dist/core/receipt.js +193 -0
  362. package/dist/core/receipt.js.map +1 -0
  363. package/dist/core/receipt.test.js +193 -0
  364. package/dist/core/receipt.test.js.map +1 -0
  365. package/dist/core/reviewers.js +179 -0
  366. package/dist/core/reviewers.js.map +1 -0
  367. package/dist/core/reviewers.test.js +105 -0
  368. package/dist/core/reviewers.test.js.map +1 -0
  369. package/dist/core/roast.js +27 -0
  370. package/dist/core/roast.js.map +1 -0
  371. package/dist/core/roast.test.js +19 -0
  372. package/dist/core/roast.test.js.map +1 -0
  373. package/dist/core/router.js +8 -0
  374. package/dist/core/router.js.map +1 -0
  375. package/dist/core/router.test.js +157 -0
  376. package/dist/core/router.test.js.map +1 -0
  377. package/dist/core/rules.js +2 -2
  378. package/dist/core/rules.js.map +1 -1
  379. package/dist/core/run.js +322 -20
  380. package/dist/core/run.js.map +1 -1
  381. package/dist/core/sarif.js +125 -0
  382. package/dist/core/sarif.js.map +1 -0
  383. package/dist/core/sarif.test.js +60 -0
  384. package/dist/core/sarif.test.js.map +1 -0
  385. package/dist/core/sast.js +324 -0
  386. package/dist/core/sast.js.map +1 -0
  387. package/dist/core/sast.test.js +105 -0
  388. package/dist/core/sast.test.js.map +1 -0
  389. package/dist/core/sbom.js +121 -0
  390. package/dist/core/sbom.js.map +1 -0
  391. package/dist/core/sbom.test.js +81 -0
  392. package/dist/core/sbom.test.js.map +1 -0
  393. package/dist/core/second-opinion.js +88 -0
  394. package/dist/core/second-opinion.js.map +1 -0
  395. package/dist/core/second-opinion.test.js +89 -0
  396. package/dist/core/second-opinion.test.js.map +1 -0
  397. package/dist/core/secrets.js +120 -5
  398. package/dist/core/secrets.js.map +1 -1
  399. package/dist/core/secrets.test.js +74 -1
  400. package/dist/core/secrets.test.js.map +1 -1
  401. package/dist/core/shadow.js +94 -0
  402. package/dist/core/shadow.js.map +1 -0
  403. package/dist/core/shadow.test.js +50 -0
  404. package/dist/core/shadow.test.js.map +1 -0
  405. package/dist/core/slicing.js +110 -0
  406. package/dist/core/slicing.js.map +1 -0
  407. package/dist/core/slicing.test.js +287 -0
  408. package/dist/core/slicing.test.js.map +1 -0
  409. package/dist/core/slop/churn.js +49 -0
  410. package/dist/core/slop/churn.js.map +1 -0
  411. package/dist/core/slop/collect.js +186 -0
  412. package/dist/core/slop/collect.js.map +1 -0
  413. package/dist/core/slop/dead-exports.js +101 -0
  414. package/dist/core/slop/dead-exports.js.map +1 -0
  415. package/dist/core/slop/duplicates.js +155 -0
  416. package/dist/core/slop/duplicates.js.map +1 -0
  417. package/dist/core/slop/index.js +72 -0
  418. package/dist/core/slop/index.js.map +1 -0
  419. package/dist/core/slop/model.js +2 -0
  420. package/dist/core/slop/model.js.map +1 -0
  421. package/dist/core/slop/score.js +185 -0
  422. package/dist/core/slop/score.js.map +1 -0
  423. package/dist/core/slop/slop.test.js +160 -0
  424. package/dist/core/slop/slop.test.js.map +1 -0
  425. package/dist/core/slop/source.js +129 -0
  426. package/dist/core/slop/source.js.map +1 -0
  427. package/dist/core/slop/test-debt.js +178 -0
  428. package/dist/core/slop/test-debt.js.map +1 -0
  429. package/dist/core/slop/test-debt.test.js +114 -0
  430. package/dist/core/slop/test-debt.test.js.map +1 -0
  431. package/dist/core/slop/todos.js +117 -0
  432. package/dist/core/slop/todos.js.map +1 -0
  433. package/dist/core/snapshot.js +214 -0
  434. package/dist/core/snapshot.js.map +1 -0
  435. package/dist/core/snapshot.test.js +101 -0
  436. package/dist/core/snapshot.test.js.map +1 -0
  437. package/dist/core/stats.js +119 -0
  438. package/dist/core/stats.js.map +1 -0
  439. package/dist/core/stats.test.js +86 -0
  440. package/dist/core/stats.test.js.map +1 -0
  441. package/dist/core/suppressions.js +96 -0
  442. package/dist/core/suppressions.js.map +1 -0
  443. package/dist/core/suppressions.test.js +90 -0
  444. package/dist/core/suppressions.test.js.map +1 -0
  445. package/dist/core/test-delta.js +53 -0
  446. package/dist/core/test-delta.js.map +1 -0
  447. package/dist/core/test-delta.test.js +41 -0
  448. package/dist/core/test-delta.test.js.map +1 -0
  449. package/dist/core/test-plan.js +212 -0
  450. package/dist/core/test-plan.js.map +1 -0
  451. package/dist/core/test-plan.test.js +94 -0
  452. package/dist/core/test-plan.test.js.map +1 -0
  453. package/dist/core/test-weakening.js +191 -0
  454. package/dist/core/test-weakening.js.map +1 -0
  455. package/dist/core/test-weakening.test.js +114 -0
  456. package/dist/core/test-weakening.test.js.map +1 -0
  457. package/dist/core/tree-scan.js +77 -0
  458. package/dist/core/tree-scan.js.map +1 -0
  459. package/dist/core/tree-scan.test.js +58 -0
  460. package/dist/core/tree-scan.test.js.map +1 -0
  461. package/dist/mcp-prompts.test.js +133 -0
  462. package/dist/mcp-prompts.test.js.map +1 -0
  463. package/dist/mcp.js +3303 -240
  464. package/dist/mcp.js.map +1 -1
  465. package/dist/mcp.test.js +1739 -1
  466. package/dist/mcp.test.js.map +1 -1
  467. package/dist/skills.test.js +221 -0
  468. package/dist/skills.test.js.map +1 -0
  469. package/dist/version.js +1 -1
  470. package/dist/version.js.map +1 -1
  471. package/docs/integrations.md +151 -7
  472. package/package.json +2 -1
  473. package/prompts/oc-pilot.en.md +8 -1
  474. package/prompts/oc-pilot.ru.md +8 -1
  475. package/server.json +2 -2
  476. package/skills/agent-self-review/SKILL.md +87 -0
  477. package/skills/commit-discipline/SKILL.md +86 -0
  478. package/skills/oc-pilot/SKILL.md +86 -0
  479. package/skills/secure-diff-gate/SKILL.md +101 -0
  480. package/skills/stack-review-packs/SKILL.md +76 -0
  481. package/skills/test-failure-triage/SKILL.md +88 -0
@@ -0,0 +1,408 @@
1
+ const COMMON_HEAD = `# Project review rules
2
+
3
+ These rules are injected into every review, test-fix and fix request.
4
+ Keep the file short and concrete; long rule files get truncated.
5
+
6
+ `;
7
+ function preset(id, title, description, body) {
8
+ return { id, title, description, rules: `${COMMON_HEAD}${body.trim()}\n` };
9
+ }
10
+ export const PRESETS = [
11
+ preset("base", "Base", "Minimal language-agnostic starter rules", `
12
+ ## Correctness
13
+ - Flag race conditions, off-by-one errors and incorrect null/undefined handling.
14
+ - Flag swallowed errors: empty catch blocks, \`catch {}\` without logging or rethrow.
15
+ - Flag dead branches and unreachable code after return/throw.
16
+
17
+ ## Security
18
+ - Flag injection risks: string-built SQL, shell commands, HTML and eval usage.
19
+ - Flag unvalidated external input crossing trust boundaries without checks.
20
+ - Flag hardcoded credentials, tokens and private keys.
21
+
22
+ ## Maintainability
23
+ - Flag functions longer than ~80 lines or with deeply nested conditionals (3+ levels).
24
+ - Flag duplicated logic that appears three or more times.
25
+ - Flag misleading names: a function that does something other than its name says.
26
+ `),
27
+ preset("node", "Node.js / TypeScript", "Backend services, CLIs and libraries on modern Node", `
28
+ ## Async and errors
29
+ - Always await or explicitly handle promises; flag floating promises and missing .catch.
30
+ - Flag sync APIs in hot paths: readFileSync, existsSync in request handlers.
31
+ - Wrap async route handlers so rejections reach the error middleware.
32
+ - Use structured errors with codes; never throw plain strings.
33
+
34
+ ## APIs and data
35
+ - Validate and normalize all external input at the boundary; distrust it downstream.
36
+ - Flag unbounded queries and missing pagination on collection endpoints.
37
+ - Prefer explicit typed schemas over \`any\`; flag \`as any\` casts and non-null \`!\` chains.
38
+
39
+ ## Operations
40
+ - Fail fast on misconfiguration at startup, not on first request.
41
+ - Log with context (request id, user id); never log secrets or full payloads.
42
+ - Respect timeouts on every outbound call: fetch, DB, message queues.
43
+ - Flag missing cleanup: open handles, timers, listeners after shutdown.
44
+ `),
45
+ preset("react", "React", "React 18+ components, hooks and state management", `
46
+ ## Hooks
47
+ - Every effect dependency must be intentional; flag missing deps and stale closures.
48
+ - Flag derived state stored in useState that should be computed during render.
49
+ - Prefer useReducer or external stores over chains of inter-dependent useState.
50
+ - Flag effects that duplicate what event handlers should do.
51
+
52
+ ## Rendering
53
+ - Keys must be stable ids; flag array-index keys on reorderable lists.
54
+ - Flag state updates that mutate objects or arrays in place.
55
+ - Flag expensive computations in render without useMemo only when measurable.
56
+ - Accessible by default: label inputs, keep keyboard handlers, alt non-decorative images.
57
+
58
+ ## Boundaries
59
+ - Validate data at the network layer; components render, they do not fetch-validate.
60
+ - Flag direct DOM manipulation that React also manages (className, styles, listeners).
61
+ - Colocate styles and types with the component; flag cross-importing internals.
62
+ `),
63
+ preset("next", "Next.js", "App Router: server components, server actions and caching", `
64
+ ## Rendering and data
65
+ - Server Components by default; flag "use client" without a concrete reason.
66
+ - Do not fetch in useEffect for data available via server components; move it server-side.
67
+ - Flag searchParams and dynamic segment params used without validation.
68
+
69
+ ## Security
70
+ - Server Actions must validate input and check auth/ownership; flag blind mutations.
71
+ - Flag secrets reaching the client: sensitive values in NEXT_PUBLIC_ vars or client props.
72
+ - Flag dangerouslySetInnerHTML on user content; sanitize at the data source.
73
+ - Keep middleware lean: it runs on every request.
74
+
75
+ ## Caching and correctness
76
+ - Fetch calls state their cache/revalidate strategy where staleness matters.
77
+ - Flag hydration mismatches: server/client differences in dates, randomness, locale.
78
+ - Use next/image and next/link; flag raw <img> and <a> in app code.
79
+ `),
80
+ preset("vue", "Vue", "Vue 3 Composition API components and reactivity", `
81
+ ## Composition API
82
+ - Flag props mutation and v-model on props; props are read-only.
83
+ - computed must stay pure; flag side effects inside computed.
84
+ - watch needs cleanup and a precise source; flag deep watchers used as a default.
85
+
86
+ ## Reactivity
87
+ - Destructuring props loses reactivity; use toRefs where reactivity must survive.
88
+ - Flag in-place mutations of non-reactive copies expected to update the view.
89
+ - v-for keys must be stable ids, not array index, on reorderable lists.
90
+
91
+ ## Boundaries
92
+ - Validate API data at the network layer; components render, they do not fetch-validate.
93
+ - Flag direct DOM manipulation that Vue also manages (bound attrs, listeners).
94
+ - Keep provide/inject typed; flag untyped injection of app-wide state.
95
+ `),
96
+ preset("svelte", "Svelte", "Svelte 5 runes, stores and SSR", `
97
+ ## Runes and state
98
+ - $derived must be pure; flag side effects inside $derived.
99
+ - $effect is for synchronizing with the outside world, not for events; flag misuse.
100
+ - Flag $effect without cleanup of subscriptions and timers.
101
+ - Bindable props must be declared; flag mutating props directly.
102
+
103
+ ## Rendering
104
+ - {#each} keys must be stable ids, not index, on reorderable lists.
105
+ - Flag store subscriptions that should be $derived, and vice versa.
106
+ - Flag reactivity broken by replacing fields of non-reactive objects.
107
+
108
+ ## SSR and boundaries
109
+ - Guard browser-only APIs (window, localStorage) in SSR contexts.
110
+ - Validate data at the load/network layer; components render, they do not fetch-validate.
111
+ `),
112
+ preset("angular", "Angular", "Signals, dependency injection and RxJS", `
113
+ ## Components and signals
114
+ - Use signals (signal/computed/effect) for template state; flag plain mutable fields.
115
+ - OnPush by default: flag in-place array mutations that skip change detection.
116
+ - effect() is for side effects, not dataflow; flag signal chains hidden in effects.
117
+
118
+ ## Templates and DI
119
+ - Prefer inject() over constructor injection; flag services instantiated in components.
120
+ - Flag logic in templates that belongs in the component class.
121
+ - Flag field injection and mutable service state in request-scoped code.
122
+
123
+ ## RxJS
124
+ - Flag subscriptions without takeUntilDestroyed or async pipe management.
125
+ - Prefer switchMap for dependent requests; flag nested subscribe calls.
126
+ - Share expensive streams with shareReplay when many consumers subscribe.
127
+ `),
128
+ preset("typescript", "TypeScript", "Strict type safety across any runtime", `
129
+ ## Type safety
130
+ - Flag \`as any\`, \`@ts-ignore\` without an explanation and implicit any at boundaries.
131
+ - Prefer discriminated unions over boolean-flag combinations.
132
+ - Flag non-null \`!\` on values that can genuinely be null/undefined at runtime.
133
+ - Switch over unions must be exhaustive or safely defaulted.
134
+
135
+ ## Boundaries
136
+ - Validate external data (API, env, files) with a schema before use; distrust unknown.
137
+ - Prefer \`readonly\` and \`as const\` for data that must not change.
138
+ - Flag platform types leaking from untyped interop without explicit narrowing.
139
+
140
+ ## Runtime hygiene
141
+ - Flag \`==\` where \`===\` is meant and truthiness checks where 0 or "" are valid.
142
+ - async functions must propagate errors; flag swallowed promise rejections.
143
+ - Catch clauses narrow \`unknown\` before use; flag \`catch (e: any)\`.
144
+ `),
145
+ preset("python", "Python", "Python 3.10+ services, scripts and libraries", `
146
+ ## Typing and contracts
147
+ - Public functions carry type hints; flag untyped boundaries of modules.
148
+ - Prefer dataclasses or pydantic models over dicts for structured data.
149
+ - Flag bare except and except Exception without re-raise or log; never swallow KeyboardInterrupt.
150
+
151
+ ## Correctness
152
+ - Use context managers for files, sockets, locks and DB transactions.
153
+ - Flag mutable default arguments (\`def f(x=[])\`).
154
+ - Prefer pathlib over string path concatenation.
155
+ - Flag f-string SQL and subprocess calls built from untrusted input; use parameters.
156
+
157
+ ## Style
158
+ - Prefer comprehensions and early returns over nested loops and flags.
159
+ - Flag wildcard imports and unused imports left in the diff.
160
+ - Enums and constants instead of magic strings repeated across files.
161
+ `),
162
+ preset("go", "Go", "Go services and CLIs", `
163
+ ## Errors
164
+ - Always check returned errors; flag \`_\` assignments of err.
165
+ - Wrap with context: fmt.Errorf("doing x: %w", err); never lose the chain.
166
+ - Do not log and return the same error; pick one per call path.
167
+
168
+ ## Concurrency
169
+ - Every goroutine must have a termination path; flag leaks in loops and handlers.
170
+ - Flag unreleased mutexes, tickers and contexts without defer cancel.
171
+ - Channels: know who closes; flag close from the receiver side.
172
+ - Respect context.Context: pass it down, abort on ctx.Done().
173
+
174
+ ## Correctness
175
+ - Flag range-loop variable capture in goroutines and closures.
176
+ - Defer close on every resource acquired (files, rows, response bodies).
177
+ - Flag ignored return values of fmt.Fprintf-style writers where errors matter.
178
+ - Keep structs narrow; flag exported fields that leak internal state.
179
+ `),
180
+ preset("rust", "Rust", "Ownership, Result handling and unsafe discipline", `
181
+ ## Ownership and errors
182
+ - Use Result/Option instead of unwrap/expect outside tests; invariants need a comment.
183
+ - Prefer \`?\` propagation; flag match arms that swallow Err silently.
184
+ - Flag clones that hide move problems where borrows suffice.
185
+
186
+ ## Safety
187
+ - unsafe blocks must carry a safety comment explaining the invariants upheld.
188
+ - Flag manual pointer arithmetic and transmute in ordinary code.
189
+ - Prefer iterators over index loops; flag slice indexing with computed offsets.
190
+
191
+ ## API
192
+ - Public APIs document panic paths; flag unwrap/index/slice panics in library code.
193
+ - Public error types implement std::error::Error; flag String errors at API boundaries.
194
+ - Flag obvious clippy-level lints introduced by the diff.
195
+ `),
196
+ preset("java", "Java", "Services on modern Java and Spring", `
197
+ ## Errors
198
+ - Exceptions carry context; flag catch blocks that swallow, log-and-continue, or return null.
199
+ - Use Optional over null returns; flag get() without isPresent/orElse guards.
200
+ - Flag catch (Exception/Throwable) without a documented re-throw intent.
201
+
202
+ ## Concurrency
203
+ - Shared mutable state needs synchronization; flag racy fields in request-scoped services.
204
+ - Use try-with-resources for everything AutoCloseable (streams, connections).
205
+ - CompletableFuture chains must handle failures (exceptionally/handle).
206
+
207
+ ## API and data
208
+ - Validate at boundaries; flag unvalidated request params reaching queries.
209
+ - Flag collect-to-list-then-loop where a single stream pipeline suffices.
210
+ - Prefer constructor injection; flag mutable statics and field injection.
211
+ `),
212
+ preset("kotlin", "Kotlin", "Idiomatic Kotlin, coroutines and Android", `
213
+ ## Null safety
214
+ - Flag \`!!\` on values that can be null at runtime; prefer safe calls and early returns.
215
+ - Java interop boundaries handle platform types explicitly.
216
+ - Flag late-initialized state that could be plain nullable or lazy.
217
+
218
+ ## Coroutines
219
+ - Structured concurrency: launch in scopes that get cancelled (viewModelScope, lifecycle).
220
+ - Every launch/async handles errors; flag fire-and-forget coroutines.
221
+ - Flag GlobalScope and runBlocking on production paths; prefer suspend functions.
222
+ - Cancellation must be cooperative: flag CPU loops without isActive/ensureActive checks.
223
+
224
+ ## Idiomatic
225
+ - Prefer val, data classes, sealed hierarchies and expression bodies.
226
+ - Flag Java-style Kotlin: StringBuilder chains, manual getters, platform types leaking.
227
+ `),
228
+ preset("csharp", "C# / .NET", "async/await discipline and resource safety", `
229
+ ## Async
230
+ - Flag .Result/.Wait() on tasks: deadlock risk; async all the way.
231
+ - Flag async void outside event handlers and fire-and-forget without error handling.
232
+ - CancellationToken must flow through every async call chain.
233
+
234
+ ## Resources
235
+ - IDisposable needs using/await using; flag undisposed contexts and connections.
236
+ - Flag event subscriptions and closures that capture this longer than its lifetime.
237
+
238
+ ## API and types
239
+ - Nullable reference types stay on; flag null-forgiving \`!\` where null is possible.
240
+ - Validate at boundaries; flag unvalidated input reaching EF/SQL queries.
241
+ - Flag double enumeration of IEnumerable; materialize when reused.
242
+ `),
243
+ preset("swift", "Swift", "Optionals, structured concurrency and UI state", `
244
+ ## Optionals and errors
245
+ - Force unwrap only with an invariant comment; prefer guard let and nil-coalescing.
246
+ - Flag try? that swallows errors silently; handle or propagate instead.
247
+
248
+ ## Concurrency
249
+ - Flag mutable shared state crossing concurrency domains; use actors or isolation.
250
+ - Prefer async/await over manual queues and locks.
251
+ - Long-lived closures and delegates capture [weak self]; flag retain cycles.
252
+
253
+ ## UI and data
254
+ - UI state mutates on the main actor; flag background-context updates.
255
+ - Prefer Codable models over dictionaries; validate decoded external data.
256
+ `),
257
+ preset("php", "PHP", "PHP 8+ services and Laravel", `
258
+ ## Types and errors
259
+ - Declare strict_types; flag missing parameter/return types on public functions.
260
+ - Flag catch blocks that swallow; rethrow or log with context.
261
+
262
+ ## Security
263
+ - SQL through prepared statements only; flag string-interpolated queries.
264
+ - Flag raw $_GET/$_POST/$_SERVER reaching queries or HTML; validate and escape by context.
265
+ - Flag unserialize on user input and any eval usage.
266
+
267
+ ## Laravel
268
+ - N+1: flag relation loops without eager loading.
269
+ - Validate via FormRequest; flag mass assignment without \$fillable.
270
+ - Migrations safe for production: chunk big tables, avoid destructive one-step DDL.
271
+ `),
272
+ preset("ruby", "Ruby / Rails", "Rails services, queries and migrations", `
273
+ ## Errors
274
+ - Never rescue Exception; flag rescue without an error class.
275
+ - Flag swallowed errors; raise specific errors with context over nil returns.
276
+
277
+ ## Rails
278
+ - Strong params on every controller; flag params[:x] used raw.
279
+ - N+1: flag association loops without includes/preload; prefer batch finders.
280
+ - Migrations safe for production: flag renames/removals without a two-step plan.
281
+
282
+ ## Idiomatic
283
+ - Prefer each/map over for loops; early returns over nested conditionals.
284
+ - Do not mutate frozen constants; keep structured logging free of secrets.
285
+ `),
286
+ preset("flutter", "Flutter / Dart", "Widget trees, state and rendering rules", `
287
+ ## Widgets and state
288
+ - Mark constructors const where possible; keep build() pure and cheap.
289
+ - Dispose controllers and streams; flag subscriptions without cancel.
290
+ - Never use BuildContext across async gaps; check mounted after await.
291
+ - setState for local repaints only; prefer ValueNotifier or state packages above the widget.
292
+ - Theme and MediaQuery over hardcoded colors, paddings and text styles.
293
+
294
+ ## Lists and layout
295
+ - ListView.builder for long lists; flag shrinkWrap inside scrollables.
296
+ - Stable keys on dynamic children; const keys where identity suffices.
297
+ - Hero and animations need bounded constraints; flag unbounded Row/Column flex errors.
298
+
299
+ ## Data and platform
300
+ - JSON via typed fromJson/toJson; flag raw Map<String, dynamic> access.
301
+ - Channels and plugins validated on both sides; flag untyped platform calls.
302
+ - Async errors observed: FutureBuilder error paths and runZonedGuarded zones.
303
+ `),
304
+ preset("elixir", "Elixir / Erlang", "BEAM concurrency and OTP rules", `
305
+ ## Processes and OTP
306
+ - GenServer callbacks stay fast; no blocking work in handle_call.
307
+ - Every process has a supervisor; flag spawn/spawn_link without a restart strategy.
308
+ - Task.async needs Task.await with a timeout; flag fire-and-forget tasks on user paths.
309
+ - Trap exits only with a reason; flag catch-all handle_info that swallows messages.
310
+
311
+ ## Correctness
312
+ - Pattern match instead of nil checks; flag case clauses that mimic if-chains.
313
+ - with/else for happy-path pipelines; every else branch handles a real error.
314
+ - Recursion and Enum over manual loops; flag Enum into Map.put (O(n^2) growth).
315
+ - Changesets validate and constrain: flag cast without validate_required or unique_constraint.
316
+
317
+ ## Safety
318
+ - Repo queries parameterized; flag fragment with interpolated user input.
319
+ - No atom creation from user input; strings over atoms at boundaries.
320
+ - Timeouts on external calls; flag GenServer calls to remote nodes without one.
321
+ `),
322
+ preset("zig", "Zig", "Explicit memory and safety rules", `
323
+ ## Memory
324
+ - Every allocation pairs with a free or defer; flag alloc without a visible owner.
325
+ - defer matches acquisition order; errdefer for cleanup before an error return.
326
+ - Allocations return errors: handle OutOfMemory instead of assuming success.
327
+ - No use-after-free: flag returning pointers into stack frames or freed slices.
328
+ - Initialize memory explicitly; flag reads of undefined or padding values.
329
+
330
+ ## Correctness
331
+ - Slices carry bounds; flag pointer arithmetic where slice indexing works.
332
+ - @intCast and @truncate need range justification; flag unchecked narrowing.
333
+ - Prefer tagged unions and exhaustive switch; flag reachable unreachable.
334
+ - Comptime for constants and generics; flag runtime values that should be comptime.
335
+
336
+ ## Idiomatic
337
+ - Errors via error sets with try propagation; flag catch |_| that discards cause.
338
+ - Testing with zig test blocks beside the code; edge cases for boundary math.
339
+ `),
340
+ preset("scala", "Scala", "Type-safe functional rules", `
341
+ ## Types and options
342
+ - Option instead of null; flag .get, .head on Option and isDefined+get pairs.
343
+ - Prefer fold/map/foreach chains over match scaffolding on simple shapes.
344
+ - Either for fallible paths; flag exceptions used as local control flow.
345
+ - Discriminated sealed traits with exhaustive match; flag catch-all cases that hide new variants.
346
+
347
+ ## Concurrency
348
+ - Futures compose with for-comprehensions; block only at the edge.
349
+ - Flag Await.result without timeout on request paths.
350
+ - Side effects in ZIO/Cats Effect kept at the boundary; pure core logic.
351
+ - Structured lifetimes for Akka actors; flag tell to stopped or unwatched actors.
352
+
353
+ ## Idiomatic
354
+ - Givens/implicits with explicit types; flag inferred context params on public APIs.
355
+ - Immutable case classes and copy over var fields.
356
+ - Lazy structures (view, LazyList) when sizes are large; flag eager map on big collections.
357
+ - No wildcard imports; unused imports removed; values over unit-returning expressions.
358
+ `),
359
+ preset("security", "Security", "Cross-stack hardening rules, combine with a stack preset", `
360
+ ## Injection
361
+ - Parameterized queries only; flag string-built SQL and ORM filters from user input.
362
+ - Shell calls take argument arrays, never interpolated strings; flag unsanitized paths.
363
+ - Escape output by context: HTML, attributes, URLs, SQL, shell.
364
+
365
+ ## Auth and crypto
366
+ - Flag mutations missing an auth check and IDOR (ownership) risks on id-addressed data.
367
+ - Compare secrets with constant-time APIs; never log tokens or password fields.
368
+ - Crypto via vetted libraries; flag hand-rolled hashing or encoding labeled as crypto.
369
+ - New dependencies get a provenance check: right repo, no typosquats, lockfile pinned.
370
+
371
+ ## Data exposure
372
+ - Flag secrets in code, config, logs, errors, client bundles and test fixtures.
373
+ - Validate size and content of uploads; flag user input reaching eval or exec.
374
+ `),
375
+ preset("devops", "DevOps", "Dockerfiles, CI workflows and infrastructure", `
376
+ ## Dockerfiles
377
+ - Pin base images to digests or minor versions; flag :latest.
378
+ - Multi-stage builds; flag toolchains shipped in runtime images.
379
+ - Non-root USER, minimal EXPOSE, no secrets in ENV or layers.
380
+ - .dockerignore excludes .git, dependencies and local env files.
381
+
382
+ ## CI workflows
383
+ - Pin actions to commit SHAs; flag floating tags on security-relevant steps.
384
+ - Least-privilege tokens (permissions:); flag secret leaks to forks or logs.
385
+ - Flag secrets echoed to logs or passed into untrusted scripts.
386
+
387
+ ## Infrastructure
388
+ - Terraform/Kubernetes: flag resources without explicit limits and security contexts.
389
+ - Destructive steps (delete, force-push) need an explicit guard or manual gate.
390
+ `),
391
+ ];
392
+ export function presetIds() {
393
+ return PRESETS.map((preset) => preset.id);
394
+ }
395
+ export function getPreset(id) {
396
+ return PRESETS.find((preset) => preset.id === id);
397
+ }
398
+ const PRESET_SEPARATOR = "\n---\n\n";
399
+ /**
400
+ * Combines several presets into one rules document for comma-separated
401
+ * `--preset a,b`. The common header appears once; bodies are joined with
402
+ * horizontal rules so each stack keeps its own section.
403
+ */
404
+ export function combinePresets(items) {
405
+ const bodies = items.map((item) => item.rules.slice(COMMON_HEAD.length));
406
+ return `${COMMON_HEAD}${bodies.join(PRESET_SEPARATOR)}`;
407
+ }
408
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/core/presets.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,GAAG;;;;;CAKnB,CAAC;AAEF,SAAS,MAAM,CAAC,EAAU,EAAE,KAAa,EAAE,WAAmB,EAAE,IAAY;IAC1E,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAiB;IACnC,MAAM,CACJ,MAAM,EACN,MAAM,EACN,yCAAyC,EACzC;;;;;;;;;;;;;;;CAeH,CACE;IACD,MAAM,CACJ,MAAM,EACN,sBAAsB,EACtB,qDAAqD,EACrD;;;;;;;;;;;;;;;;;CAiBH,CACE;IACD,MAAM,CACJ,OAAO,EACP,OAAO,EACP,kDAAkD,EAClD;;;;;;;;;;;;;;;;;CAiBH,CACE;IACD,MAAM,CACJ,MAAM,EACN,SAAS,EACT,2DAA2D,EAC3D;;;;;;;;;;;;;;;;CAgBH,CACE;IACD,MAAM,CACJ,KAAK,EACL,KAAK,EACL,iDAAiD,EACjD;;;;;;;;;;;;;;;CAeH,CACE;IACD,MAAM,CACJ,QAAQ,EACR,QAAQ,EACR,gCAAgC,EAChC;;;;;;;;;;;;;;;CAeH,CACE;IACD,MAAM,CACJ,SAAS,EACT,SAAS,EACT,wCAAwC,EACxC;;;;;;;;;;;;;;;CAeH,CACE;IACD,MAAM,CACJ,YAAY,EACZ,YAAY,EACZ,uCAAuC,EACvC;;;;;;;;;;;;;;;;CAgBH,CACE;IACD,MAAM,CACJ,QAAQ,EACR,QAAQ,EACR,8CAA8C,EAC9C;;;;;;;;;;;;;;;;CAgBH,CACE;IACD,MAAM,CACJ,IA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E,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAU;IAClC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAmB;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,79 @@
1
+ import assert from "node:assert/strict";
2
+ import { test } from "node:test";
3
+ import { combinePresets, getPreset, presetIds, PRESETS } from "./presets.js";
4
+ test("all presets are registered with stable ids", () => {
5
+ assert.deepEqual(presetIds(), [
6
+ "base",
7
+ "node",
8
+ "react",
9
+ "next",
10
+ "vue",
11
+ "svelte",
12
+ "angular",
13
+ "typescript",
14
+ "python",
15
+ "go",
16
+ "rust",
17
+ "java",
18
+ "kotlin",
19
+ "csharp",
20
+ "swift",
21
+ "php",
22
+ "ruby",
23
+ "flutter",
24
+ "elixir",
25
+ "zig",
26
+ "scala",
27
+ "security",
28
+ "devops",
29
+ ]);
30
+ });
31
+ test("every preset ships non-empty markdown rules", () => {
32
+ for (const preset of PRESETS) {
33
+ assert.ok(preset.rules.length > 200, `${preset.id} rules look too short`);
34
+ assert.ok(preset.rules.startsWith("# Project review rules"), `${preset.id} must start with the common header`);
35
+ assert.ok(preset.description.length > 0, `${preset.id} needs a description`);
36
+ }
37
+ });
38
+ test("presets carry stack-specific guidance", () => {
39
+ const markers = {
40
+ base: "race conditions",
41
+ node: "floating promises",
42
+ react: "## Hooks",
43
+ next: "use client",
44
+ vue: "## Composition API",
45
+ svelte: "$derived",
46
+ angular: "takeUntilDestroyed",
47
+ typescript: "discriminated unions",
48
+ python: "dataclasses",
49
+ go: "%w",
50
+ rust: "unsafe",
51
+ java: "try-with-resources",
52
+ kotlin: "GlobalScope",
53
+ csharp: "async void",
54
+ swift: "retain cycles",
55
+ php: "strict_types",
56
+ ruby: "Strong params",
57
+ flutter: "BuildContext",
58
+ elixir: "GenServer",
59
+ zig: "defer",
60
+ scala: "Option",
61
+ security: "constant-time",
62
+ devops: ":latest",
63
+ };
64
+ for (const [id, marker] of Object.entries(markers)) {
65
+ assert.ok(getPreset(id).rules.includes(marker), `${id} must mention "${marker}"`);
66
+ }
67
+ });
68
+ test("getPreset returns undefined for unknown ids", () => {
69
+ assert.equal(getPreset("cobol"), undefined);
70
+ });
71
+ test("combinePresets merges bodies under a single header", () => {
72
+ const combined = combinePresets([getPreset("react"), getPreset("security")]);
73
+ assert.equal(combined.split("# Project review rules").length - 1, 1);
74
+ assert.ok(combined.includes("## Hooks"));
75
+ assert.ok(combined.includes("constant-time"));
76
+ assert.ok(combined.includes("\n---\n"));
77
+ assert.ok(combined.endsWith("\n"));
78
+ });
79
+ //# sourceMappingURL=presets.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.test.js","sourceRoot":"","sources":["../../src/core/presets.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE7E,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACtD,MAAM,CAAC,SAAS,CACd,SAAS,EAAE,EACX;QACE,MAAM;QACN,MAAM;QACN,OAAO;QACP,MAAM;QACN,KAAK;QACL,QAAQ;QACR,SAAS;QACT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 import assert from "node:assert/strict";
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { test } from "node:test";
5
+ import { fileURLToPath } from "node:url";
6
+ import { buildInput, buildPrompt, SYSTEM_PROMPT_EN } from "./prompt.js";
7
+ const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
8
+ const GOLDEN = join(ROOT, "test", "golden");
9
+ const UPDATE = process.env.OC_PILOT_UPDATE_GOLDEN === "1";
10
+ const DIFF = [
11
+ "diff --git a/wallet.go b/wallet.go",
12
+ "@@ -10,3 +10,4 @@ func DeductBalance(u *User, amount int) {",
13
+ "-\tu.Balance -= amount",
14
+ "+\tu.Balance -= amount",
15
+ "+\tlog.Info(\"deduct\", amount)",
16
+ " }",
17
+ ].join("\n");
18
+ const BASE = {
19
+ recipe: "review",
20
+ projectType: "Go",
21
+ additionalContext: "type User struct { ID string; Balance int }",
22
+ diff: DIFF,
23
+ };
24
+ /**
25
+ * The prompt is the CLI contract with every model: section order, empty-value
26
+ * handling and secret redaction must only change on purpose. These snapshots
27
+ * pin the input half of the prompt; the system half is checked against
28
+ * prompts/*.md by prompt.test.ts.
29
+ */
30
+ const CASES = [
31
+ { name: "input-review-en.txt", input: { ...BASE, lang: "en", repoContext: true } },
32
+ { name: "input-review-ru.txt", input: { ...BASE, lang: "ru", repoContext: false } },
33
+ {
34
+ name: "input-review-secrets.txt",
35
+ input: {
36
+ ...BASE,
37
+ findings: [
38
+ {
39
+ file: "wallet.go",
40
+ line: 4,
41
+ kind: "OpenAI API key",
42
+ severity: "critical",
43
+ preview: "sk-p…AAAA",
44
+ },
45
+ ],
46
+ },
47
+ },
48
+ {
49
+ name: "input-empty-commit.txt",
50
+ input: { recipe: "commit", projectType: "Go", additionalContext: "", diff: "" },
51
+ },
52
+ ];
53
+ for (const item of CASES) {
54
+ test(`golden ${item.name} matches the built input`, () => {
55
+ const path = join(GOLDEN, item.name);
56
+ const actual = `${buildInput(item.input)}\n`;
57
+ if (UPDATE) {
58
+ mkdirSync(GOLDEN, { recursive: true });
59
+ writeFileSync(path, actual, "utf8");
60
+ return;
61
+ }
62
+ assert.ok(existsSync(path), `${item.name} is missing; run OC_PILOT_UPDATE_GOLDEN=1 npm test`);
63
+ const expected = readFileSync(path, "utf8").replace(/\r\n/g, "\n");
64
+ assert.equal(actual, expected, `${item.name} drifted; regenerate with OC_PILOT_UPDATE_GOLDEN=1 when the change is intended`);
65
+ });
66
+ }
67
+ test("every recipe reaches the model with its own RECIPE line", () => {
68
+ for (const recipe of ["review", "test-fix", "docgen", "custom", "commit"]) {
69
+ const text = buildPrompt({ ...BASE, recipe });
70
+ assert.ok(text.includes(`RECIPE: ${recipe}\n`), `${recipe} is not named in the input`);
71
+ assert.ok(text.startsWith(SYSTEM_PROMPT_EN), `${recipe} lost the system prompt`);
72
+ }
73
+ });
74
+ //# sourceMappingURL=prompt.golden.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.golden.test.js","sourceRoot":"","sources":["../../src/core/prompt.golden.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI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