@sentry/warden 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (589) hide show
  1. package/dist/cli/commands/init.d.ts.map +1 -1
  2. package/dist/cli/commands/init.js +36 -2
  3. package/dist/cli/commands/init.js.map +1 -1
  4. package/dist/cli/commands/setup-app/manifest.d.ts.map +1 -1
  5. package/dist/cli/commands/setup-app/manifest.js +3 -1
  6. package/dist/cli/commands/setup-app/manifest.js.map +1 -1
  7. package/dist/cli/commands/setup-app.js +1 -1
  8. package/dist/cli/commands/setup-app.js.map +1 -1
  9. package/dist/cli/diff-apply.d.ts +15 -0
  10. package/dist/cli/diff-apply.d.ts.map +1 -0
  11. package/dist/cli/diff-apply.js +69 -0
  12. package/dist/cli/diff-apply.js.map +1 -0
  13. package/dist/cli/files.d.ts +11 -1
  14. package/dist/cli/files.d.ts.map +1 -1
  15. package/dist/cli/files.js +145 -4
  16. package/dist/cli/files.js.map +1 -1
  17. package/dist/cli/fix.d.ts +1 -5
  18. package/dist/cli/fix.d.ts.map +1 -1
  19. package/dist/cli/fix.js +3 -62
  20. package/dist/cli/fix.js.map +1 -1
  21. package/dist/cli/git.d.ts.map +1 -1
  22. package/dist/cli/git.js +5 -9
  23. package/dist/cli/git.js.map +1 -1
  24. package/dist/cli/index.js +0 -0
  25. package/dist/cli/output/tasks.d.ts.map +1 -1
  26. package/dist/cli/output/tasks.js +5 -1
  27. package/dist/cli/output/tasks.js.map +1 -1
  28. package/dist/config/schema.d.ts.map +1 -1
  29. package/dist/config/schema.js +15 -1
  30. package/dist/config/schema.js.map +1 -1
  31. package/dist/diff/coalesce.d.ts +32 -2
  32. package/dist/diff/coalesce.d.ts.map +1 -1
  33. package/dist/diff/coalesce.js +174 -2
  34. package/dist/diff/coalesce.js.map +1 -1
  35. package/dist/output/dedup.d.ts +7 -4
  36. package/dist/output/dedup.d.ts.map +1 -1
  37. package/dist/output/dedup.js +48 -12
  38. package/dist/output/dedup.js.map +1 -1
  39. package/dist/output/renderer.d.ts.map +1 -1
  40. package/dist/output/renderer.js +52 -7
  41. package/dist/output/renderer.js.map +1 -1
  42. package/dist/output/stale.d.ts.map +1 -1
  43. package/dist/output/stale.js +7 -0
  44. package/dist/output/stale.js.map +1 -1
  45. package/dist/output/types.d.ts +15 -1
  46. package/dist/output/types.d.ts.map +1 -1
  47. package/dist/sdk/analyze.d.ts +18 -0
  48. package/dist/sdk/analyze.d.ts.map +1 -0
  49. package/dist/sdk/analyze.js +421 -0
  50. package/dist/sdk/analyze.js.map +1 -0
  51. package/dist/sdk/errors.d.ts +23 -0
  52. package/dist/sdk/errors.d.ts.map +1 -0
  53. package/dist/sdk/errors.js +74 -0
  54. package/dist/sdk/errors.js.map +1 -0
  55. package/dist/sdk/extract.d.ts +44 -0
  56. package/dist/sdk/extract.d.ts.map +1 -0
  57. package/dist/sdk/extract.js +224 -0
  58. package/dist/sdk/extract.js.map +1 -0
  59. package/dist/sdk/prepare.d.ts +13 -0
  60. package/dist/sdk/prepare.d.ts.map +1 -0
  61. package/dist/sdk/prepare.js +73 -0
  62. package/dist/sdk/prepare.js.map +1 -0
  63. package/dist/sdk/prompt.d.ts +30 -0
  64. package/dist/sdk/prompt.d.ts.map +1 -0
  65. package/dist/sdk/prompt.js +109 -0
  66. package/dist/sdk/prompt.js.map +1 -0
  67. package/dist/sdk/retry.d.ts +12 -0
  68. package/dist/sdk/retry.d.ts.map +1 -0
  69. package/dist/sdk/retry.js +31 -0
  70. package/dist/sdk/retry.js.map +1 -0
  71. package/dist/sdk/runner.d.ts +22 -199
  72. package/dist/sdk/runner.d.ts.map +1 -1
  73. package/dist/sdk/runner.js +26 -884
  74. package/dist/sdk/runner.js.map +1 -1
  75. package/dist/sdk/types.d.ts +127 -0
  76. package/dist/sdk/types.d.ts.map +1 -0
  77. package/dist/sdk/types.js +5 -0
  78. package/dist/sdk/types.js.map +1 -0
  79. package/dist/sdk/usage.d.ts +20 -0
  80. package/dist/sdk/usage.d.ts.map +1 -0
  81. package/dist/sdk/usage.js +44 -0
  82. package/dist/sdk/usage.js.map +1 -0
  83. package/dist/skills/remote.d.ts.map +1 -1
  84. package/dist/skills/remote.js +3 -7
  85. package/dist/skills/remote.js.map +1 -1
  86. package/dist/types/index.d.ts +1 -0
  87. package/dist/types/index.d.ts.map +1 -1
  88. package/dist/types/index.js +2 -0
  89. package/dist/types/index.js.map +1 -1
  90. package/dist/utils/exec.d.ts +61 -0
  91. package/dist/utils/exec.d.ts.map +1 -0
  92. package/dist/utils/exec.js +111 -0
  93. package/dist/utils/exec.js.map +1 -0
  94. package/dist/utils/index.d.ts +2 -0
  95. package/dist/utils/index.d.ts.map +1 -1
  96. package/dist/utils/index.js +1 -0
  97. package/dist/utils/index.js.map +1 -1
  98. package/package.json +15 -16
  99. package/.agents/skills/find-bugs/SKILL.md +0 -75
  100. package/.agents/skills/vercel-react-best-practices/AGENTS.md +0 -2934
  101. package/.agents/skills/vercel-react-best-practices/SKILL.md +0 -136
  102. package/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  103. package/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
  104. package/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
  105. package/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +0 -38
  106. package/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +0 -80
  107. package/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +0 -51
  108. package/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +0 -28
  109. package/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
  110. package/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -59
  111. package/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
  112. package/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
  113. package/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  114. package/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +0 -50
  115. package/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
  116. package/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
  117. package/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
  118. package/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
  119. package/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
  120. package/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
  121. package/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
  122. package/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
  123. package/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
  124. package/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +0 -50
  125. package/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
  126. package/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +0 -37
  127. package/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
  128. package/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
  129. package/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
  130. package/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
  131. package/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +0 -26
  132. package/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  133. package/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
  134. package/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
  135. package/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  136. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  137. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
  138. package/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
  139. package/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
  140. package/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
  141. package/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
  142. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
  143. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
  144. package/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
  145. package/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  146. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
  147. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +0 -44
  148. package/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
  149. package/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
  150. package/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
  151. package/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
  152. package/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
  153. package/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
  154. package/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
  155. package/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +0 -76
  156. package/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
  157. package/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
  158. package/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +0 -38
  159. package/.claude/settings.json +0 -57
  160. package/.claude/skills/agent-prompt/SKILL.md +0 -54
  161. package/.claude/skills/agent-prompt/references/agentic-patterns.md +0 -94
  162. package/.claude/skills/agent-prompt/references/anti-patterns.md +0 -140
  163. package/.claude/skills/agent-prompt/references/context-design.md +0 -124
  164. package/.claude/skills/agent-prompt/references/core-principles.md +0 -75
  165. package/.claude/skills/agent-prompt/references/model-guidance.md +0 -118
  166. package/.claude/skills/agent-prompt/references/output-formats.md +0 -98
  167. package/.claude/skills/agent-prompt/references/skill-structure.md +0 -115
  168. package/.claude/skills/agent-prompt/references/system-prompts.md +0 -115
  169. package/.claude/skills/notseer/SKILL.md +0 -131
  170. package/.claude/skills/skill-writer/SKILL.md +0 -140
  171. package/.claude/skills/testing-guidelines/SKILL.md +0 -132
  172. package/.claude/skills/warden-skill/SKILL.md +0 -226
  173. package/.claude/skills/warden-skill/references/config-schema.md +0 -116
  174. package/.dex/config.toml +0 -2
  175. package/.github/workflows/ci.yml +0 -33
  176. package/.github/workflows/release.yml +0 -59
  177. package/.github/workflows/warden.yml +0 -40
  178. package/AGENTS.md +0 -89
  179. package/CONTRIBUTING.md +0 -60
  180. package/SPEC.md +0 -263
  181. package/action.yml +0 -87
  182. package/assets/favicon.png +0 -0
  183. package/assets/warden-icon-bw.svg +0 -5
  184. package/assets/warden-icon-purple.png +0 -0
  185. package/assets/warden-icon-purple.svg +0 -5
  186. package/dist/action/159.index.js +0 -523
  187. package/dist/action/159.index.js.map +0 -1
  188. package/dist/action/action/index.d.ts +0 -2
  189. package/dist/action/action/index.d.ts.map +0 -1
  190. package/dist/action/action/main.d.ts +0 -2
  191. package/dist/action/action/main.d.ts.map +0 -1
  192. package/dist/action/cli/args.d.ts +0 -74
  193. package/dist/action/cli/args.d.ts.map +0 -1
  194. package/dist/action/cli/args.test.d.ts +0 -2
  195. package/dist/action/cli/args.test.d.ts.map +0 -1
  196. package/dist/action/cli/commands/add.d.ts +0 -7
  197. package/dist/action/cli/commands/add.d.ts.map +0 -1
  198. package/dist/action/cli/commands/init.d.ts +0 -10
  199. package/dist/action/cli/commands/init.d.ts.map +0 -1
  200. package/dist/action/cli/commands/init.test.d.ts +0 -2
  201. package/dist/action/cli/commands/init.test.d.ts.map +0 -1
  202. package/dist/action/cli/commands/setup-app/browser.d.ts +0 -9
  203. package/dist/action/cli/commands/setup-app/browser.d.ts.map +0 -1
  204. package/dist/action/cli/commands/setup-app/credentials.d.ts +0 -15
  205. package/dist/action/cli/commands/setup-app/credentials.d.ts.map +0 -1
  206. package/dist/action/cli/commands/setup-app/manifest.d.ts +0 -24
  207. package/dist/action/cli/commands/setup-app/manifest.d.ts.map +0 -1
  208. package/dist/action/cli/commands/setup-app/server.d.ts +0 -28
  209. package/dist/action/cli/commands/setup-app/server.d.ts.map +0 -1
  210. package/dist/action/cli/commands/setup-app.d.ts +0 -11
  211. package/dist/action/cli/commands/setup-app.d.ts.map +0 -1
  212. package/dist/action/cli/commands/sync.d.ts +0 -9
  213. package/dist/action/cli/commands/sync.d.ts.map +0 -1
  214. package/dist/action/cli/context.d.ts +0 -27
  215. package/dist/action/cli/context.d.ts.map +0 -1
  216. package/dist/action/cli/files.d.ts +0 -22
  217. package/dist/action/cli/files.d.ts.map +0 -1
  218. package/dist/action/cli/files.test.d.ts +0 -2
  219. package/dist/action/cli/files.test.d.ts.map +0 -1
  220. package/dist/action/cli/fix.d.ts +0 -41
  221. package/dist/action/cli/fix.d.ts.map +0 -1
  222. package/dist/action/cli/fix.test.d.ts +0 -2
  223. package/dist/action/cli/fix.test.d.ts.map +0 -1
  224. package/dist/action/cli/git.d.ts +0 -73
  225. package/dist/action/cli/git.d.ts.map +0 -1
  226. package/dist/action/cli/git.test.d.ts +0 -2
  227. package/dist/action/cli/git.test.d.ts.map +0 -1
  228. package/dist/action/cli/index.d.ts +0 -3
  229. package/dist/action/cli/index.d.ts.map +0 -1
  230. package/dist/action/cli/main.d.ts +0 -7
  231. package/dist/action/cli/main.d.ts.map +0 -1
  232. package/dist/action/cli/output/box.d.ts +0 -75
  233. package/dist/action/cli/output/box.d.ts.map +0 -1
  234. package/dist/action/cli/output/formatters.d.ts +0 -90
  235. package/dist/action/cli/output/formatters.d.ts.map +0 -1
  236. package/dist/action/cli/output/formatters.test.d.ts +0 -2
  237. package/dist/action/cli/output/formatters.test.d.ts.map +0 -1
  238. package/dist/action/cli/output/icons.d.ts +0 -15
  239. package/dist/action/cli/output/icons.d.ts.map +0 -1
  240. package/dist/action/cli/output/index.d.ts +0 -10
  241. package/dist/action/cli/output/index.d.ts.map +0 -1
  242. package/dist/action/cli/output/ink-runner.d.ts +0 -29
  243. package/dist/action/cli/output/ink-runner.d.ts.map +0 -1
  244. package/dist/action/cli/output/jsonl.d.ts +0 -43
  245. package/dist/action/cli/output/jsonl.d.ts.map +0 -1
  246. package/dist/action/cli/output/jsonl.test.d.ts +0 -2
  247. package/dist/action/cli/output/jsonl.test.d.ts.map +0 -1
  248. package/dist/action/cli/output/reporter.d.ts +0 -108
  249. package/dist/action/cli/output/reporter.d.ts.map +0 -1
  250. package/dist/action/cli/output/tasks.d.ts +0 -89
  251. package/dist/action/cli/output/tasks.d.ts.map +0 -1
  252. package/dist/action/cli/output/tty.d.ts +0 -21
  253. package/dist/action/cli/output/tty.d.ts.map +0 -1
  254. package/dist/action/cli/output/tty.test.d.ts +0 -2
  255. package/dist/action/cli/output/tty.test.d.ts.map +0 -1
  256. package/dist/action/cli/output/verbosity.d.ts +0 -20
  257. package/dist/action/cli/output/verbosity.d.ts.map +0 -1
  258. package/dist/action/cli/output/verbosity.test.d.ts +0 -2
  259. package/dist/action/cli/output/verbosity.test.d.ts.map +0 -1
  260. package/dist/action/cli/terminal.d.ts +0 -19
  261. package/dist/action/cli/terminal.d.ts.map +0 -1
  262. package/dist/action/cli/terminal.test.d.ts +0 -2
  263. package/dist/action/cli/terminal.test.d.ts.map +0 -1
  264. package/dist/action/config/index.d.ts +0 -4
  265. package/dist/action/config/index.d.ts.map +0 -1
  266. package/dist/action/config/loader.d.ts +0 -27
  267. package/dist/action/config/loader.d.ts.map +0 -1
  268. package/dist/action/config/loader.test.d.ts +0 -2
  269. package/dist/action/config/loader.test.d.ts.map +0 -1
  270. package/dist/action/config/schema.d.ts +0 -318
  271. package/dist/action/config/schema.d.ts.map +0 -1
  272. package/dist/action/config/writer.d.ts +0 -11
  273. package/dist/action/config/writer.d.ts.map +0 -1
  274. package/dist/action/config/writer.test.d.ts +0 -2
  275. package/dist/action/config/writer.test.d.ts.map +0 -1
  276. package/dist/action/diff/classify.d.ts +0 -29
  277. package/dist/action/diff/classify.d.ts.map +0 -1
  278. package/dist/action/diff/classify.test.d.ts +0 -2
  279. package/dist/action/diff/classify.test.d.ts.map +0 -1
  280. package/dist/action/diff/coalesce.d.ts +0 -42
  281. package/dist/action/diff/coalesce.d.ts.map +0 -1
  282. package/dist/action/diff/coalesce.test.d.ts +0 -2
  283. package/dist/action/diff/coalesce.test.d.ts.map +0 -1
  284. package/dist/action/diff/context.d.ts +0 -30
  285. package/dist/action/diff/context.d.ts.map +0 -1
  286. package/dist/action/diff/context.test.d.ts +0 -2
  287. package/dist/action/diff/context.test.d.ts.map +0 -1
  288. package/dist/action/diff/index.d.ts +0 -5
  289. package/dist/action/diff/index.d.ts.map +0 -1
  290. package/dist/action/diff/parser.d.ts +0 -52
  291. package/dist/action/diff/parser.d.ts.map +0 -1
  292. package/dist/action/diff/parser.test.d.ts +0 -2
  293. package/dist/action/diff/parser.test.d.ts.map +0 -1
  294. package/dist/action/event/context.d.ts +0 -9
  295. package/dist/action/event/context.d.ts.map +0 -1
  296. package/dist/action/event/index.d.ts +0 -3
  297. package/dist/action/event/index.d.ts.map +0 -1
  298. package/dist/action/event/schedule-context.d.ts +0 -30
  299. package/dist/action/event/schedule-context.d.ts.map +0 -1
  300. package/dist/action/examples/examples.integration.test.d.ts +0 -2
  301. package/dist/action/examples/examples.integration.test.d.ts.map +0 -1
  302. package/dist/action/examples/index.d.ts +0 -50
  303. package/dist/action/examples/index.d.ts.map +0 -1
  304. package/dist/action/examples/index.test.d.ts +0 -2
  305. package/dist/action/examples/index.test.d.ts.map +0 -1
  306. package/dist/action/examples/setup.d.ts +0 -2
  307. package/dist/action/examples/setup.d.ts.map +0 -1
  308. package/dist/action/index.d.ts +0 -11
  309. package/dist/action/index.d.ts.map +0 -1
  310. package/dist/action/index.js +0 -38231
  311. package/dist/action/index.js.map +0 -1
  312. package/dist/action/licenses.txt +0 -992
  313. package/dist/action/main.d.ts +0 -2
  314. package/dist/action/main.d.ts.map +0 -1
  315. package/dist/action/main.js +0 -707
  316. package/dist/action/main.js.map +0 -1
  317. package/dist/action/output/dedup.d.ts +0 -153
  318. package/dist/action/output/dedup.d.ts.map +0 -1
  319. package/dist/action/output/dedup.test.d.ts +0 -2
  320. package/dist/action/output/dedup.test.d.ts.map +0 -1
  321. package/dist/action/output/github-checks.d.ts +0 -106
  322. package/dist/action/output/github-checks.d.ts.map +0 -1
  323. package/dist/action/output/github-checks.test.d.ts +0 -2
  324. package/dist/action/output/github-checks.test.d.ts.map +0 -1
  325. package/dist/action/output/github-issues.d.ts +0 -35
  326. package/dist/action/output/github-issues.d.ts.map +0 -1
  327. package/dist/action/output/index.d.ts +0 -6
  328. package/dist/action/output/index.d.ts.map +0 -1
  329. package/dist/action/output/issue-renderer.d.ts +0 -20
  330. package/dist/action/output/issue-renderer.d.ts.map +0 -1
  331. package/dist/action/output/renderer.d.ts +0 -4
  332. package/dist/action/output/renderer.d.ts.map +0 -1
  333. package/dist/action/output/renderer.test.d.ts +0 -2
  334. package/dist/action/output/renderer.test.d.ts.map +0 -1
  335. package/dist/action/output/stale.d.ts +0 -31
  336. package/dist/action/output/stale.d.ts.map +0 -1
  337. package/dist/action/output/stale.test.d.ts +0 -2
  338. package/dist/action/output/stale.test.d.ts.map +0 -1
  339. package/dist/action/output/types.d.ts +0 -31
  340. package/dist/action/output/types.d.ts.map +0 -1
  341. package/dist/action/package.json +0 -3
  342. package/dist/action/sdk/index.d.ts +0 -2
  343. package/dist/action/sdk/index.d.ts.map +0 -1
  344. package/dist/action/sdk/runner.d.ts +0 -202
  345. package/dist/action/sdk/runner.d.ts.map +0 -1
  346. package/dist/action/sdk/runner.test.d.ts +0 -2
  347. package/dist/action/sdk/runner.test.d.ts.map +0 -1
  348. package/dist/action/skills/index.d.ts +0 -5
  349. package/dist/action/skills/index.d.ts.map +0 -1
  350. package/dist/action/skills/loader.d.ts +0 -111
  351. package/dist/action/skills/loader.d.ts.map +0 -1
  352. package/dist/action/skills/loader.test.d.ts +0 -2
  353. package/dist/action/skills/loader.test.d.ts.map +0 -1
  354. package/dist/action/skills/remote.d.ts +0 -117
  355. package/dist/action/skills/remote.d.ts.map +0 -1
  356. package/dist/action/skills/remote.test.d.ts +0 -2
  357. package/dist/action/skills/remote.test.d.ts.map +0 -1
  358. package/dist/action/sourcemap-register.cjs +0 -1
  359. package/dist/action/triggers/matcher.d.ts +0 -30
  360. package/dist/action/triggers/matcher.d.ts.map +0 -1
  361. package/dist/action/triggers/matcher.test.d.ts +0 -2
  362. package/dist/action/triggers/matcher.test.d.ts.map +0 -1
  363. package/dist/action/types/index.d.ts +0 -269
  364. package/dist/action/types/index.d.ts.map +0 -1
  365. package/dist/action/utils/async.d.ts +0 -5
  366. package/dist/action/utils/async.d.ts.map +0 -1
  367. package/dist/action/utils/index.d.ts +0 -16
  368. package/dist/action/utils/index.d.ts.map +0 -1
  369. package/dist/action/utils/index.test.d.ts +0 -2
  370. package/dist/action/utils/index.test.d.ts.map +0 -1
  371. package/dist/action/utils/version.d.ts +0 -3
  372. package/dist/action/utils/version.d.ts.map +0 -1
  373. package/dist/cli/args.test.d.ts +0 -2
  374. package/dist/cli/args.test.d.ts.map +0 -1
  375. package/dist/cli/args.test.js +0 -392
  376. package/dist/cli/args.test.js.map +0 -1
  377. package/dist/cli/commands/init.test.d.ts +0 -2
  378. package/dist/cli/commands/init.test.d.ts.map +0 -1
  379. package/dist/cli/commands/init.test.js +0 -117
  380. package/dist/cli/commands/init.test.js.map +0 -1
  381. package/dist/cli/files.test.d.ts +0 -2
  382. package/dist/cli/files.test.d.ts.map +0 -1
  383. package/dist/cli/files.test.js +0 -117
  384. package/dist/cli/files.test.js.map +0 -1
  385. package/dist/cli/fix.test.d.ts +0 -2
  386. package/dist/cli/fix.test.d.ts.map +0 -1
  387. package/dist/cli/fix.test.js +0 -251
  388. package/dist/cli/fix.test.js.map +0 -1
  389. package/dist/cli/git.test.d.ts +0 -2
  390. package/dist/cli/git.test.d.ts.map +0 -1
  391. package/dist/cli/git.test.js +0 -96
  392. package/dist/cli/git.test.js.map +0 -1
  393. package/dist/cli/output/formatters.test.d.ts +0 -2
  394. package/dist/cli/output/formatters.test.d.ts.map +0 -1
  395. package/dist/cli/output/formatters.test.js +0 -152
  396. package/dist/cli/output/formatters.test.js.map +0 -1
  397. package/dist/cli/output/jsonl.test.d.ts +0 -2
  398. package/dist/cli/output/jsonl.test.d.ts.map +0 -1
  399. package/dist/cli/output/jsonl.test.js +0 -284
  400. package/dist/cli/output/jsonl.test.js.map +0 -1
  401. package/dist/cli/output/tty.test.d.ts +0 -2
  402. package/dist/cli/output/tty.test.d.ts.map +0 -1
  403. package/dist/cli/output/tty.test.js +0 -105
  404. package/dist/cli/output/tty.test.js.map +0 -1
  405. package/dist/cli/output/verbosity.test.d.ts +0 -2
  406. package/dist/cli/output/verbosity.test.d.ts.map +0 -1
  407. package/dist/cli/output/verbosity.test.js +0 -35
  408. package/dist/cli/output/verbosity.test.js.map +0 -1
  409. package/dist/cli/terminal.test.d.ts +0 -2
  410. package/dist/cli/terminal.test.d.ts.map +0 -1
  411. package/dist/cli/terminal.test.js +0 -123
  412. package/dist/cli/terminal.test.js.map +0 -1
  413. package/dist/config/loader.test.d.ts +0 -2
  414. package/dist/config/loader.test.d.ts.map +0 -1
  415. package/dist/config/loader.test.js +0 -263
  416. package/dist/config/loader.test.js.map +0 -1
  417. package/dist/config/writer.test.d.ts +0 -2
  418. package/dist/config/writer.test.d.ts.map +0 -1
  419. package/dist/config/writer.test.js +0 -98
  420. package/dist/config/writer.test.js.map +0 -1
  421. package/dist/diff/classify.test.d.ts +0 -2
  422. package/dist/diff/classify.test.d.ts.map +0 -1
  423. package/dist/diff/classify.test.js +0 -140
  424. package/dist/diff/classify.test.js.map +0 -1
  425. package/dist/diff/coalesce.test.d.ts +0 -2
  426. package/dist/diff/coalesce.test.d.ts.map +0 -1
  427. package/dist/diff/coalesce.test.js +0 -159
  428. package/dist/diff/coalesce.test.js.map +0 -1
  429. package/dist/diff/context.test.d.ts +0 -2
  430. package/dist/diff/context.test.d.ts.map +0 -1
  431. package/dist/diff/context.test.js +0 -190
  432. package/dist/diff/context.test.js.map +0 -1
  433. package/dist/diff/parser.test.d.ts +0 -2
  434. package/dist/diff/parser.test.d.ts.map +0 -1
  435. package/dist/diff/parser.test.js +0 -178
  436. package/dist/diff/parser.test.js.map +0 -1
  437. package/dist/examples/examples.integration.test.d.ts +0 -2
  438. package/dist/examples/examples.integration.test.d.ts.map +0 -1
  439. package/dist/examples/examples.integration.test.js +0 -55
  440. package/dist/examples/examples.integration.test.js.map +0 -1
  441. package/dist/examples/index.test.d.ts +0 -2
  442. package/dist/examples/index.test.d.ts.map +0 -1
  443. package/dist/examples/index.test.js +0 -88
  444. package/dist/examples/index.test.js.map +0 -1
  445. package/dist/output/dedup.test.d.ts +0 -2
  446. package/dist/output/dedup.test.d.ts.map +0 -1
  447. package/dist/output/dedup.test.js +0 -357
  448. package/dist/output/dedup.test.js.map +0 -1
  449. package/dist/output/github-checks.test.d.ts +0 -2
  450. package/dist/output/github-checks.test.d.ts.map +0 -1
  451. package/dist/output/github-checks.test.js +0 -255
  452. package/dist/output/github-checks.test.js.map +0 -1
  453. package/dist/output/renderer.test.d.ts +0 -2
  454. package/dist/output/renderer.test.d.ts.map +0 -1
  455. package/dist/output/renderer.test.js +0 -645
  456. package/dist/output/renderer.test.js.map +0 -1
  457. package/dist/output/stale.test.d.ts +0 -2
  458. package/dist/output/stale.test.d.ts.map +0 -1
  459. package/dist/output/stale.test.js +0 -330
  460. package/dist/output/stale.test.js.map +0 -1
  461. package/dist/sdk/runner.test.d.ts +0 -2
  462. package/dist/sdk/runner.test.d.ts.map +0 -1
  463. package/dist/sdk/runner.test.js +0 -677
  464. package/dist/sdk/runner.test.js.map +0 -1
  465. package/dist/skills/loader.test.d.ts +0 -2
  466. package/dist/skills/loader.test.d.ts.map +0 -1
  467. package/dist/skills/loader.test.js +0 -241
  468. package/dist/skills/loader.test.js.map +0 -1
  469. package/dist/skills/remote.test.d.ts +0 -2
  470. package/dist/skills/remote.test.d.ts.map +0 -1
  471. package/dist/skills/remote.test.js +0 -582
  472. package/dist/skills/remote.test.js.map +0 -1
  473. package/dist/triggers/matcher.test.d.ts +0 -2
  474. package/dist/triggers/matcher.test.d.ts.map +0 -1
  475. package/dist/triggers/matcher.test.js +0 -234
  476. package/dist/triggers/matcher.test.js.map +0 -1
  477. package/dist/utils/index.test.d.ts +0 -2
  478. package/dist/utils/index.test.d.ts.map +0 -1
  479. package/dist/utils/index.test.js +0 -68
  480. package/dist/utils/index.test.js.map +0 -1
  481. package/docs/astro.config.mjs +0 -43
  482. package/docs/package.json +0 -19
  483. package/docs/pnpm-lock.yaml +0 -4000
  484. package/docs/public/favicon.svg +0 -5
  485. package/docs/src/components/Code.astro +0 -141
  486. package/docs/src/components/PackageManagerTabs.astro +0 -183
  487. package/docs/src/components/Terminal.astro +0 -212
  488. package/docs/src/layouts/Base.astro +0 -380
  489. package/docs/src/pages/cli.astro +0 -167
  490. package/docs/src/pages/config.astro +0 -395
  491. package/docs/src/pages/guide.astro +0 -450
  492. package/docs/src/pages/index.astro +0 -490
  493. package/docs/src/styles/global.css +0 -551
  494. package/docs/src/utils/version.ts +0 -6
  495. package/docs/tsconfig.json +0 -3
  496. package/docs/vercel.json +0 -5
  497. package/eslint.config.js +0 -33
  498. package/src/action/index.ts +0 -1
  499. package/src/action/main.ts +0 -868
  500. package/src/cli/args.test.ts +0 -477
  501. package/src/cli/args.ts +0 -414
  502. package/src/cli/commands/add.ts +0 -447
  503. package/src/cli/commands/init.test.ts +0 -137
  504. package/src/cli/commands/init.ts +0 -134
  505. package/src/cli/commands/setup-app/browser.ts +0 -38
  506. package/src/cli/commands/setup-app/credentials.ts +0 -45
  507. package/src/cli/commands/setup-app/manifest.ts +0 -48
  508. package/src/cli/commands/setup-app/server.ts +0 -172
  509. package/src/cli/commands/setup-app.ts +0 -156
  510. package/src/cli/commands/sync.ts +0 -114
  511. package/src/cli/context.ts +0 -131
  512. package/src/cli/files.test.ts +0 -155
  513. package/src/cli/files.ts +0 -89
  514. package/src/cli/fix.test.ts +0 -310
  515. package/src/cli/fix.ts +0 -387
  516. package/src/cli/git.test.ts +0 -119
  517. package/src/cli/git.ts +0 -318
  518. package/src/cli/index.ts +0 -14
  519. package/src/cli/main.ts +0 -672
  520. package/src/cli/output/box.ts +0 -235
  521. package/src/cli/output/formatters.test.ts +0 -187
  522. package/src/cli/output/formatters.ts +0 -269
  523. package/src/cli/output/icons.ts +0 -19
  524. package/src/cli/output/index.ts +0 -44
  525. package/src/cli/output/ink-runner.tsx +0 -366
  526. package/src/cli/output/jsonl.test.ts +0 -347
  527. package/src/cli/output/jsonl.ts +0 -126
  528. package/src/cli/output/reporter.ts +0 -434
  529. package/src/cli/output/tasks.ts +0 -374
  530. package/src/cli/output/tty.test.ts +0 -117
  531. package/src/cli/output/tty.ts +0 -60
  532. package/src/cli/output/verbosity.test.ts +0 -40
  533. package/src/cli/output/verbosity.ts +0 -31
  534. package/src/cli/terminal.test.ts +0 -148
  535. package/src/cli/terminal.ts +0 -301
  536. package/src/config/index.ts +0 -3
  537. package/src/config/loader.test.ts +0 -313
  538. package/src/config/loader.ts +0 -103
  539. package/src/config/schema.ts +0 -168
  540. package/src/config/writer.test.ts +0 -119
  541. package/src/config/writer.ts +0 -84
  542. package/src/diff/classify.test.ts +0 -162
  543. package/src/diff/classify.ts +0 -92
  544. package/src/diff/coalesce.test.ts +0 -208
  545. package/src/diff/coalesce.ts +0 -133
  546. package/src/diff/context.test.ts +0 -226
  547. package/src/diff/context.ts +0 -201
  548. package/src/diff/index.ts +0 -4
  549. package/src/diff/parser.test.ts +0 -212
  550. package/src/diff/parser.ts +0 -149
  551. package/src/event/context.ts +0 -132
  552. package/src/event/index.ts +0 -2
  553. package/src/event/schedule-context.ts +0 -101
  554. package/src/examples/examples.integration.test.ts +0 -66
  555. package/src/examples/index.test.ts +0 -101
  556. package/src/examples/index.ts +0 -122
  557. package/src/examples/setup.ts +0 -25
  558. package/src/index.ts +0 -115
  559. package/src/output/dedup.test.ts +0 -419
  560. package/src/output/dedup.ts +0 -607
  561. package/src/output/github-checks.test.ts +0 -300
  562. package/src/output/github-checks.ts +0 -476
  563. package/src/output/github-issues.ts +0 -329
  564. package/src/output/index.ts +0 -5
  565. package/src/output/issue-renderer.ts +0 -197
  566. package/src/output/renderer.test.ts +0 -727
  567. package/src/output/renderer.ts +0 -217
  568. package/src/output/stale.test.ts +0 -375
  569. package/src/output/stale.ts +0 -155
  570. package/src/output/types.ts +0 -34
  571. package/src/sdk/index.ts +0 -1
  572. package/src/sdk/runner.test.ts +0 -806
  573. package/src/sdk/runner.ts +0 -1232
  574. package/src/skills/index.ts +0 -36
  575. package/src/skills/loader.test.ts +0 -300
  576. package/src/skills/loader.ts +0 -423
  577. package/src/skills/remote.test.ts +0 -704
  578. package/src/skills/remote.ts +0 -604
  579. package/src/triggers/matcher.test.ts +0 -277
  580. package/src/triggers/matcher.ts +0 -152
  581. package/src/types/index.ts +0 -194
  582. package/src/utils/async.ts +0 -18
  583. package/src/utils/index.test.ts +0 -84
  584. package/src/utils/index.ts +0 -51
  585. package/src/utils/version.ts +0 -17
  586. package/tsconfig.json +0 -25
  587. package/vitest.config.ts +0 -8
  588. package/vitest.integration.config.ts +0 -11
  589. package/warden.toml +0 -19
@@ -1,888 +1,30 @@
1
- import { existsSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { query } from '@anthropic-ai/claude-agent-sdk';
4
- import Anthropic from '@anthropic-ai/sdk';
5
- import { FindingSchema } from '../types/index.js';
6
- import { APIError, RateLimitError, InternalServerError, APIConnectionError, APIConnectionTimeoutError, } from '@anthropic-ai/sdk';
7
- import { parseFileDiff, expandDiffContext, formatHunkForAnalysis, classifyFile, coalesceHunks, } from '../diff/index.js';
8
- export class SkillRunnerError extends Error {
9
- constructor(message, options) {
10
- super(message, options);
11
- this.name = 'SkillRunnerError';
12
- }
13
- }
14
- /** Default concurrency for file-level parallel processing */
15
- const DEFAULT_FILE_CONCURRENCY = 5;
16
- /** Pattern to match the start of findings JSON (allows whitespace after brace) */
17
- const FINDINGS_JSON_START = /\{\s*"findings"/;
18
- /** Threshold in characters above which to warn about large prompts (~25k tokens) */
19
- const LARGE_PROMPT_THRESHOLD_CHARS = 100000;
20
1
  /**
21
- * Estimate token count from character count.
22
- * Uses chars/4 as a rough approximation for English text.
23
- */
24
- export function estimateTokens(chars) {
25
- return Math.ceil(chars / 4);
26
- }
27
- /**
28
- * Extract usage stats from an SDK result message.
29
- */
30
- function extractUsage(result) {
31
- return {
32
- inputTokens: result.usage['input_tokens'],
33
- outputTokens: result.usage['output_tokens'],
34
- cacheReadInputTokens: result.usage['cache_read_input_tokens'] ?? 0,
35
- cacheCreationInputTokens: result.usage['cache_creation_input_tokens'] ?? 0,
36
- costUSD: result.total_cost_usd,
37
- };
38
- }
39
- /**
40
- * Create empty usage stats.
41
- */
42
- function emptyUsage() {
43
- return {
44
- inputTokens: 0,
45
- outputTokens: 0,
46
- cacheReadInputTokens: 0,
47
- cacheCreationInputTokens: 0,
48
- costUSD: 0,
49
- };
50
- }
51
- /**
52
- * Aggregate multiple usage stats into one.
53
- */
54
- export function aggregateUsage(usages) {
55
- return usages.reduce((acc, u) => ({
56
- inputTokens: acc.inputTokens + u.inputTokens,
57
- outputTokens: acc.outputTokens + u.outputTokens,
58
- cacheReadInputTokens: (acc.cacheReadInputTokens ?? 0) + (u.cacheReadInputTokens ?? 0),
59
- cacheCreationInputTokens: (acc.cacheCreationInputTokens ?? 0) + (u.cacheCreationInputTokens ?? 0),
60
- costUSD: acc.costUSD + u.costUSD,
61
- }), emptyUsage());
62
- }
63
- /** Default retry configuration */
64
- const DEFAULT_RETRY_CONFIG = {
65
- maxRetries: 3,
66
- initialDelayMs: 1000,
67
- backoffMultiplier: 2,
68
- maxDelayMs: 30000,
69
- };
70
- /**
71
- * Check if an error is retryable.
72
- * Retries on: rate limits (429), server errors (5xx), connection errors, timeouts.
73
- */
74
- export function isRetryableError(error) {
75
- if (error instanceof RateLimitError)
76
- return true;
77
- if (error instanceof InternalServerError)
78
- return true;
79
- if (error instanceof APIConnectionError)
80
- return true;
81
- if (error instanceof APIConnectionTimeoutError)
82
- return true;
83
- // Check for generic APIError with retryable status codes
84
- if (error instanceof APIError) {
85
- const status = error.status;
86
- if (status === 429)
87
- return true;
88
- if (status !== undefined && status >= 500 && status < 600)
89
- return true;
90
- }
91
- return false;
92
- }
93
- /**
94
- * Check if an error is an authentication failure.
95
- * These require user action (login or API key) and should not be retried.
96
- */
97
- export function isAuthenticationError(error) {
98
- if (error instanceof APIError && error.status === 401) {
99
- return true;
100
- }
101
- // Check error message for common auth failure patterns
102
- const message = error instanceof Error ? error.message : String(error);
103
- const authPatterns = [
104
- 'authentication',
105
- 'unauthorized',
106
- 'invalid.*api.*key',
107
- 'not.*logged.*in',
108
- 'login.*required',
109
- ];
110
- return authPatterns.some((pattern) => new RegExp(pattern, 'i').test(message));
111
- }
112
- /** User-friendly error message for authentication failures */
113
- const AUTH_ERROR_MESSAGE = `Authentication required.
114
-
115
- claude login # Use Claude Code subscription
116
- export WARDEN_ANTHROPIC_API_KEY=sk-... # Or use API key
117
-
118
- https://console.anthropic.com/ for API keys`;
119
- export class WardenAuthenticationError extends Error {
120
- constructor() {
121
- super(AUTH_ERROR_MESSAGE);
122
- this.name = 'WardenAuthenticationError';
123
- }
124
- }
125
- /**
126
- * Calculate delay for a retry attempt using exponential backoff.
127
- */
128
- export function calculateRetryDelay(attempt, config) {
129
- const delay = config.initialDelayMs * Math.pow(config.backoffMultiplier, attempt);
130
- return Math.min(delay, config.maxDelayMs);
131
- }
132
- /**
133
- * Sleep for a specified duration, respecting abort signal.
134
- */
135
- async function sleep(ms, abortSignal) {
136
- return new Promise((resolve, reject) => {
137
- if (abortSignal?.aborted) {
138
- reject(new Error('Aborted'));
139
- return;
140
- }
141
- const timeout = setTimeout(resolve, ms);
142
- abortSignal?.addEventListener('abort', () => {
143
- clearTimeout(timeout);
144
- reject(new Error('Aborted'));
145
- }, { once: true });
146
- });
147
- }
148
- /**
149
- * Builds the system prompt for hunk-based analysis.
150
- *
151
- * Future enhancement: Could have the agent output a structured `contextAssessment`
152
- * (applicationType, trustBoundaries, filesChecked) to cache across hunks, allow
153
- * user overrides, or build analytics. Not implemented since we don't consume it yet.
154
- */
155
- function buildHunkSystemPrompt(skill) {
156
- const sections = [
157
- `<role>
158
- You are a code analysis agent for Warden. You evaluate code changes against specific skill criteria and report findings ONLY when the code violates or conflicts with those criteria. You do not perform general code review or report issues outside the skill's scope.
159
- </role>`,
160
- `<tools>
161
- You have access to these tools to gather context:
162
- - **Read**: Check related files to understand context
163
- - **Grep**: Search for patterns to trace data flow or find related code
164
- </tools>`,
165
- `<skill_instructions>
166
- The following defines the ONLY criteria you should evaluate. Do not report findings outside this scope:
167
-
168
- ${skill.prompt}
169
- </skill_instructions>`,
170
- `<output_format>
171
- IMPORTANT: Your response must be ONLY a valid JSON object. No markdown, no explanation, no code fences.
172
-
173
- Example response format:
174
- {"findings": [{"id": "example-1", "severity": "medium", "confidence": "high", "title": "Issue title", "description": "Description", "location": {"path": "file.ts", "startLine": 10}}]}
175
-
176
- Full schema:
177
- {
178
- "findings": [
179
- {
180
- "id": "unique-identifier",
181
- "severity": "critical|high|medium|low|info",
182
- "confidence": "high|medium|low",
183
- "title": "Short descriptive title",
184
- "description": "Detailed explanation of the issue",
185
- "location": {
186
- "path": "path/to/file.ts",
187
- "startLine": 10,
188
- "endLine": 15
189
- },
190
- "suggestedFix": {
191
- "description": "How to fix this issue",
192
- "diff": "unified diff format"
193
- }
194
- }
195
- ]
196
- }
197
-
198
- Requirements:
199
- - Return ONLY valid JSON starting with {"findings":
200
- - "findings" array can be empty if no issues found
201
- - "location.path" is auto-filled from context - just provide startLine (and optionally endLine). Omit location entirely for general findings not about a specific line.
202
- - "confidence" reflects how certain you are this is a real issue given the codebase context
203
- - "suggestedFix" is optional - only include when you can provide a complete, correct fix **to the file being analyzed**. Omit suggestedFix if:
204
- - The fix would be incomplete or you're uncertain about the correct solution
205
- - The fix requires changes to a different file or a new file (describe the fix in the description field instead)
206
- - Keep descriptions SHORT (1-2 sentences max) - avoid lengthy explanations
207
- - Be concise - focus only on the changes shown
208
- </output_format>`,
209
- ];
210
- const { rootDir } = skill;
211
- if (rootDir) {
212
- const resourceDirs = ['scripts', 'references', 'assets'].filter((dir) => existsSync(join(rootDir, dir)));
213
- if (resourceDirs.length > 0) {
214
- const dirList = resourceDirs.map((d) => `${d}/`).join(', ');
215
- sections.push(`<skill_resources>
216
- This skill is located at: ${rootDir}
217
- You can read files from ${dirList} subdirectories using the Read tool with the full path.
218
- </skill_resources>`);
219
- }
220
- }
221
- return sections.join('\n\n');
222
- }
223
- /**
224
- * Builds the user prompt for a single hunk.
225
- */
226
- function buildHunkUserPrompt(skill, hunkCtx, prContext) {
227
- const sections = [];
228
- sections.push(`Analyze this code change according to the "${skill.name}" skill criteria.`);
229
- // Include PR title and description for context on intent
230
- if (prContext?.title) {
231
- let prSection = `## Pull Request Context\n**Title:** ${prContext.title}`;
232
- if (prContext.body) {
233
- // Truncate very long PR descriptions to avoid bloating prompts
234
- const maxBodyLength = 1000;
235
- const body = prContext.body.length > maxBodyLength
236
- ? prContext.body.slice(0, maxBodyLength) + '...'
237
- : prContext.body;
238
- prSection += `\n\n**Description:**\n${body}`;
239
- }
240
- sections.push(prSection);
241
- }
242
- // Include list of other files being changed in the PR for context
243
- const otherFiles = prContext?.changedFiles.filter((f) => f !== hunkCtx.filename) ?? [];
244
- if (otherFiles.length > 0) {
245
- sections.push(`## Other Files in This PR
246
- The following files are also being changed in this PR (may provide useful context):
247
- ${otherFiles.map((f) => `- ${f}`).join('\n')}`);
248
- }
249
- sections.push(formatHunkForAnalysis(hunkCtx));
250
- sections.push(`IMPORTANT: Only report findings that are explicitly covered by the skill instructions. Do not report general code quality issues, bugs, or improvements unless the skill specifically asks for them. Return an empty findings array if no issues match the skill's criteria.`);
251
- return sections.join('\n\n');
252
- }
253
- /**
254
- * Extract JSON object from text, handling nested braces correctly.
255
- * Starts from the given position and returns the balanced JSON object.
256
- */
257
- export function extractBalancedJson(text, startIndex) {
258
- let depth = 0;
259
- let inString = false;
260
- let escape = false;
261
- for (let i = startIndex; i < text.length; i++) {
262
- const char = text[i];
263
- if (escape) {
264
- escape = false;
265
- continue;
266
- }
267
- if (char === '\\' && inString) {
268
- escape = true;
269
- continue;
270
- }
271
- if (char === '"') {
272
- inString = !inString;
273
- continue;
274
- }
275
- if (inString)
276
- continue;
277
- if (char === '{')
278
- depth++;
279
- if (char === '}') {
280
- depth--;
281
- if (depth === 0) {
282
- return text.slice(startIndex, i + 1);
283
- }
284
- }
285
- }
286
- return null;
287
- }
288
- /**
289
- * Extract findings JSON from model output text.
290
- * Handles markdown code fences, prose before JSON, and nested objects.
291
- */
292
- export function extractFindingsJson(rawText) {
293
- let text = rawText.trim();
294
- // Strip markdown code fences if present (handles any language tag: ```json, ```typescript, ```c++, etc.)
295
- const codeBlockMatch = text.match(/```[\w+#-]*\s*([\s\S]*?)```/);
296
- if (codeBlockMatch?.[1]) {
297
- text = codeBlockMatch[1].trim();
298
- }
299
- // Find the start of the findings JSON object
300
- const findingsMatch = text.match(FINDINGS_JSON_START);
301
- if (!findingsMatch || findingsMatch.index === undefined) {
302
- return {
303
- success: false,
304
- error: 'no_findings_json',
305
- preview: text.slice(0, 200),
306
- };
307
- }
308
- const findingsStart = findingsMatch.index;
309
- // Extract the balanced JSON object
310
- const jsonStr = extractBalancedJson(text, findingsStart);
311
- if (!jsonStr) {
312
- return {
313
- success: false,
314
- error: 'unbalanced_json',
315
- preview: text.slice(findingsStart, findingsStart + 200),
316
- };
317
- }
318
- // Parse the JSON
319
- let parsed;
320
- try {
321
- parsed = JSON.parse(jsonStr);
322
- }
323
- catch {
324
- return {
325
- success: false,
326
- error: 'invalid_json',
327
- preview: jsonStr.slice(0, 200),
328
- };
329
- }
330
- // Validate structure
331
- if (typeof parsed !== 'object' || parsed === null || !('findings' in parsed)) {
332
- return {
333
- success: false,
334
- error: 'missing_findings_key',
335
- preview: jsonStr.slice(0, 200),
336
- };
337
- }
338
- const findings = parsed.findings;
339
- if (!Array.isArray(findings)) {
340
- return {
341
- success: false,
342
- error: 'findings_not_array',
343
- preview: jsonStr.slice(0, 200),
344
- };
345
- }
346
- return { success: true, findings };
347
- }
348
- /** Max characters to send to LLM fallback (roughly ~8k tokens) */
349
- const LLM_FALLBACK_MAX_CHARS = 32000;
350
- /** Timeout for LLM fallback API calls in milliseconds */
351
- const LLM_FALLBACK_TIMEOUT_MS = 30000;
352
- /**
353
- * Truncate text for LLM fallback while preserving the findings JSON.
2
+ * SDK Runner - Main orchestration for skill execution.
354
3
  *
355
- * Caller must ensure findings JSON exists in the text before calling.
356
- */
357
- export function truncateForLLMFallback(rawText, maxChars) {
358
- if (rawText.length <= maxChars) {
359
- return rawText;
360
- }
361
- const findingsIndex = rawText.match(FINDINGS_JSON_START)?.index ?? -1;
362
- // If findings starts within our budget, simple truncation from start preserves it
363
- if (findingsIndex < maxChars - 20) {
364
- return rawText.slice(0, maxChars) + '\n[... truncated]';
365
- }
366
- // Findings is beyond our budget - skip to just before it
367
- // Keep minimal context (10% of budget or 200 chars, whichever is smaller)
368
- const markerOverhead = 40;
369
- const usableBudget = maxChars - markerOverhead;
370
- const contextBefore = Math.min(200, Math.floor(usableBudget * 0.1), findingsIndex);
371
- const startIndex = findingsIndex - contextBefore;
372
- const endIndex = startIndex + usableBudget;
373
- const truncatedContent = rawText.slice(startIndex, endIndex);
374
- const suffix = endIndex < rawText.length ? '\n[... truncated]' : '';
375
- return '[... truncated ...]\n' + truncatedContent + suffix;
376
- }
377
- /**
378
- * Extract findings from malformed output using LLM as a fallback.
379
- * Uses claude-haiku-4-5 for lightweight, fast extraction.
380
- */
381
- export async function extractFindingsWithLLM(rawText, apiKey) {
382
- if (!apiKey) {
383
- return {
384
- success: false,
385
- error: 'no_api_key_for_fallback',
386
- preview: rawText.slice(0, 200),
387
- };
388
- }
389
- // If no findings anchor exists, there's nothing to extract
390
- if (!FINDINGS_JSON_START.test(rawText)) {
391
- return {
392
- success: false,
393
- error: 'no_findings_to_extract',
394
- preview: rawText.slice(0, 200),
395
- };
396
- }
397
- // Truncate input while preserving JSON boundaries
398
- const truncatedText = truncateForLLMFallback(rawText, LLM_FALLBACK_MAX_CHARS);
399
- try {
400
- const client = new Anthropic({ apiKey, timeout: LLM_FALLBACK_TIMEOUT_MS });
401
- const response = await client.messages.create({
402
- model: 'claude-haiku-4-5',
403
- max_tokens: 4096,
404
- messages: [
405
- {
406
- role: 'user',
407
- content: `Extract the findings JSON from this model output.
408
- Return ONLY valid JSON in format: {"findings": [...]}
409
- If no findings exist, return: {"findings": []}
410
-
411
- Model output:
412
- ${truncatedText}`,
413
- },
414
- ],
415
- });
416
- const content = response.content[0];
417
- if (!content || content.type !== 'text') {
418
- return {
419
- success: false,
420
- error: 'llm_unexpected_response',
421
- preview: rawText.slice(0, 200),
422
- };
423
- }
424
- // Parse the LLM response as JSON
425
- return extractFindingsJson(content.text);
426
- }
427
- catch (error) {
428
- const errorMessage = error instanceof Error ? error.message : String(error);
429
- return {
430
- success: false,
431
- error: `llm_extraction_failed: ${errorMessage}`,
432
- preview: rawText.slice(0, 200),
433
- };
434
- }
435
- }
436
- /**
437
- * Validate and normalize findings from extracted JSON.
438
- */
439
- function validateFindings(findings, filename) {
440
- const validated = [];
441
- for (const f of findings) {
442
- // Normalize location path before validation
443
- if (typeof f === 'object' && f !== null && 'location' in f) {
444
- const loc = f['location'];
445
- if (loc && typeof loc === 'object') {
446
- loc['path'] = filename;
447
- }
448
- }
449
- const result = FindingSchema.safeParse(f);
450
- if (result.success) {
451
- validated.push({
452
- ...result.data,
453
- location: result.data.location ? { ...result.data.location, path: filename } : undefined,
454
- });
455
- }
456
- }
457
- return validated;
458
- }
459
- /**
460
- * Parse findings from a hunk analysis result.
461
- * Uses a two-tier extraction strategy:
462
- * 1. Regex-based extraction (fast, handles well-formed output)
463
- * 2. LLM fallback using haiku (handles malformed output gracefully)
464
- */
465
- async function parseHunkOutput(result, filename, apiKey) {
466
- if (result.subtype !== 'success') {
467
- // Silently return empty - the SDK already handles error reporting
468
- return [];
469
- }
470
- // Tier 1: Try regex-based extraction first (fast)
471
- const extracted = extractFindingsJson(result.result);
472
- if (extracted.success) {
473
- return validateFindings(extracted.findings, filename);
474
- }
475
- // Tier 2: Try LLM fallback for malformed output
476
- const fallback = await extractFindingsWithLLM(result.result, apiKey);
477
- if (fallback.success) {
478
- return validateFindings(fallback.findings, filename);
479
- }
480
- // Both tiers failed - return empty findings silently
481
- return [];
482
- }
483
- /**
484
- * Execute a single SDK query attempt.
485
- */
486
- async function executeQuery(systemPrompt, userPrompt, repoPath, options) {
487
- const { maxTurns = 50, model, abortController, pathToClaudeCodeExecutable } = options;
488
- const stream = query({
489
- prompt: userPrompt,
490
- options: {
491
- maxTurns,
492
- cwd: repoPath,
493
- systemPrompt,
494
- // Only allow read-only tools - context is already provided in the prompt
495
- allowedTools: ['Read', 'Grep'],
496
- // Explicitly block modification/side-effect tools as defense-in-depth
497
- disallowedTools: ['Write', 'Edit', 'Bash', 'WebFetch', 'WebSearch', 'Task', 'TodoWrite'],
498
- permissionMode: 'bypassPermissions',
499
- model,
500
- abortController,
501
- pathToClaudeCodeExecutable,
502
- },
503
- });
504
- let resultMessage;
505
- for await (const message of stream) {
506
- if (message.type === 'result') {
507
- resultMessage = message;
508
- }
509
- }
510
- return resultMessage;
511
- }
512
- /**
513
- * Analyze a single hunk with retry logic for transient failures.
514
- */
515
- async function analyzeHunk(skill, hunkCtx, repoPath, options, callbacks, prContext) {
516
- const { apiKey, abortController, retry } = options;
517
- const systemPrompt = buildHunkSystemPrompt(skill);
518
- const userPrompt = buildHunkUserPrompt(skill, hunkCtx, prContext);
519
- // Report prompt size information
520
- const systemChars = systemPrompt.length;
521
- const userChars = userPrompt.length;
522
- const totalChars = systemChars + userChars;
523
- const estimatedTokens = estimateTokens(totalChars);
524
- // Always call onPromptSize if provided (for debug mode)
525
- callbacks?.onPromptSize?.(callbacks.lineRange, systemChars, userChars, totalChars, estimatedTokens);
526
- // Warn about large prompts
527
- if (totalChars > LARGE_PROMPT_THRESHOLD_CHARS) {
528
- callbacks?.onLargePrompt?.(callbacks.lineRange, totalChars, estimatedTokens);
529
- }
530
- // Merge retry config with defaults
531
- const retryConfig = {
532
- ...DEFAULT_RETRY_CONFIG,
533
- ...retry,
534
- };
535
- let lastError;
536
- // Track accumulated usage across retry attempts for accurate cost reporting
537
- const accumulatedUsage = [];
538
- for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
539
- // Check for abort before each attempt
540
- if (abortController?.signal.aborted) {
541
- return { findings: [], usage: aggregateUsage(accumulatedUsage), failed: true };
542
- }
543
- try {
544
- const resultMessage = await executeQuery(systemPrompt, userPrompt, repoPath, options);
545
- if (!resultMessage) {
546
- return { findings: [], usage: aggregateUsage(accumulatedUsage), failed: true };
547
- }
548
- // Extract usage from the result, regardless of success/error status
549
- const usage = extractUsage(resultMessage);
550
- accumulatedUsage.push(usage);
551
- // Check if the SDK returned an error result (e.g., max turns, budget exceeded)
552
- const isError = resultMessage.is_error || resultMessage.subtype !== 'success';
553
- if (isError) {
554
- // SDK error - we have usage but no valid findings
555
- return {
556
- findings: [],
557
- usage: aggregateUsage(accumulatedUsage),
558
- failed: true,
559
- };
560
- }
561
- return {
562
- findings: await parseHunkOutput(resultMessage, hunkCtx.filename, apiKey),
563
- usage: aggregateUsage(accumulatedUsage),
564
- failed: false,
565
- };
566
- }
567
- catch (error) {
568
- lastError = error;
569
- // Authentication errors should surface immediately with helpful guidance
570
- if (isAuthenticationError(error)) {
571
- throw new WardenAuthenticationError();
572
- }
573
- // Don't retry if not a retryable error or we've exhausted retries
574
- if (!isRetryableError(error) || attempt >= retryConfig.maxRetries) {
575
- break;
576
- }
577
- // Calculate delay and wait before retry
578
- const delayMs = calculateRetryDelay(attempt, retryConfig);
579
- const errorMessage = error instanceof Error ? error.message : String(error);
580
- // Notify about retry in verbose mode
581
- callbacks?.onRetry?.(callbacks.lineRange, attempt + 1, retryConfig.maxRetries, errorMessage, delayMs);
582
- try {
583
- await sleep(delayMs, abortController?.signal);
584
- }
585
- catch {
586
- // Aborted during sleep
587
- return { findings: [], usage: aggregateUsage(accumulatedUsage), failed: true };
588
- }
589
- }
590
- }
591
- // All attempts failed - return failure with any accumulated usage
592
- // Log the final error for debugging if verbose
593
- if (options.verbose && lastError) {
594
- const errorMessage = lastError instanceof Error ? lastError.message : String(lastError);
595
- callbacks?.onRetry?.(callbacks.lineRange, retryConfig.maxRetries + 1, retryConfig.maxRetries, `Final failure: ${errorMessage}`, 0);
596
- }
597
- return { findings: [], usage: aggregateUsage(accumulatedUsage), failed: true };
598
- }
599
- /**
600
- * Deduplicate findings by id and location.
601
- */
602
- export function deduplicateFindings(findings) {
603
- const seen = new Set();
604
- return findings.filter((f) => {
605
- const key = `${f.id}:${f.location?.path}:${f.location?.startLine}`;
606
- if (seen.has(key))
607
- return false;
608
- seen.add(key);
609
- return true;
610
- });
611
- }
612
- function groupHunksByFile(hunks) {
613
- const fileMap = new Map();
614
- for (const hunk of hunks) {
615
- const existing = fileMap.get(hunk.filename);
616
- if (existing) {
617
- existing.push(hunk);
618
- }
619
- else {
620
- fileMap.set(hunk.filename, [hunk]);
621
- }
622
- }
623
- return Array.from(fileMap, ([filename, fileHunks]) => ({ filename, hunks: fileHunks }));
624
- }
625
- /**
626
- * Get line range string for a hunk.
627
- */
628
- function getHunkLineRange(hunk) {
629
- const start = hunk.hunk.newStart;
630
- const end = start + hunk.hunk.newCount - 1;
631
- return start === end ? `${start}` : `${start}-${end}`;
632
- }
633
- /**
634
- * Attach elapsed time to findings if skill start time is available.
635
- */
636
- function attachElapsedTime(findings, skillStartTime) {
637
- if (skillStartTime === undefined)
638
- return;
639
- const elapsedMs = Date.now() - skillStartTime;
640
- for (const finding of findings) {
641
- finding.elapsedMs = elapsedMs;
642
- }
643
- }
644
- /**
645
- * Prepare files for analysis by parsing patches into hunks with context.
646
- * Returns files that have changes to analyze and files that were skipped.
647
- */
648
- export function prepareFiles(context, options = {}) {
649
- const { contextLines = 20, chunking } = options;
650
- if (!context.pullRequest) {
651
- return { files: [], skippedFiles: [] };
652
- }
653
- const pr = context.pullRequest;
654
- const allHunks = [];
655
- const skippedFiles = [];
656
- for (const file of pr.files) {
657
- if (!file.patch)
658
- continue;
659
- // Check if this file should be skipped based on chunking patterns
660
- const mode = classifyFile(file.filename, chunking?.filePatterns);
661
- if (mode === 'skip') {
662
- skippedFiles.push({
663
- filename: file.filename,
664
- reason: 'builtin', // Could be enhanced to track which pattern matched
665
- });
666
- continue;
667
- }
668
- const statusMap = {
669
- added: 'added',
670
- removed: 'removed',
671
- modified: 'modified',
672
- renamed: 'renamed',
673
- copied: 'added',
674
- changed: 'modified',
675
- unchanged: 'modified',
676
- };
677
- const status = statusMap[file.status] ?? 'modified';
678
- const diff = parseFileDiff(file.filename, file.patch, status);
679
- // Apply hunk coalescing if enabled (default: enabled)
680
- const coalesceEnabled = chunking?.coalesce?.enabled !== false;
681
- const hunks = coalesceEnabled
682
- ? coalesceHunks(diff.hunks, {
683
- maxGapLines: chunking?.coalesce?.maxGapLines,
684
- maxChunkSize: chunking?.coalesce?.maxChunkSize,
685
- })
686
- : diff.hunks;
687
- const hunksWithContext = expandDiffContext(context.repoPath, { ...diff, hunks }, contextLines);
688
- allHunks.push(...hunksWithContext);
689
- }
690
- return {
691
- files: groupHunksByFile(allHunks),
692
- skippedFiles,
693
- };
694
- }
695
- /**
696
- * Analyze a single prepared file's hunks.
697
- */
698
- export async function analyzeFile(skill, file, repoPath, options = {}, callbacks, prContext) {
699
- const { abortController } = options;
700
- const fileFindings = [];
701
- const fileUsage = [];
702
- let failedHunks = 0;
703
- for (const [hunkIndex, hunk] of file.hunks.entries()) {
704
- if (abortController?.signal.aborted)
705
- break;
706
- const lineRange = getHunkLineRange(hunk);
707
- callbacks?.onHunkStart?.(hunkIndex + 1, file.hunks.length, lineRange);
708
- const hunkCallbacks = callbacks
709
- ? {
710
- lineRange,
711
- onLargePrompt: callbacks.onLargePrompt,
712
- onPromptSize: callbacks.onPromptSize,
713
- onRetry: callbacks.onRetry,
714
- }
715
- : undefined;
716
- const result = await analyzeHunk(skill, hunk, repoPath, options, hunkCallbacks, prContext);
717
- if (result.failed) {
718
- failedHunks++;
719
- }
720
- attachElapsedTime(result.findings, callbacks?.skillStartTime);
721
- callbacks?.onHunkComplete?.(hunkIndex + 1, result.findings);
722
- fileFindings.push(...result.findings);
723
- fileUsage.push(result.usage);
724
- }
725
- return {
726
- filename: file.filename,
727
- findings: fileFindings,
728
- usage: aggregateUsage(fileUsage),
729
- failedHunks,
730
- };
731
- }
732
- /**
733
- * Run a skill on a PR, analyzing each hunk separately.
734
- */
735
- export async function runSkill(skill, context, options = {}) {
736
- const { parallel = true, callbacks, abortController } = options;
737
- const startTime = Date.now();
738
- if (!context.pullRequest) {
739
- throw new SkillRunnerError('Pull request context required for skill execution');
740
- }
741
- const { files: fileHunks, skippedFiles } = prepareFiles(context, {
742
- contextLines: options.contextLines,
743
- // Note: chunking config should come from the caller (e.g., from warden.toml defaults)
744
- // For now, we use built-in defaults. The caller can pass explicit chunking config.
745
- });
746
- if (fileHunks.length === 0) {
747
- const report = {
748
- skill: skill.name,
749
- summary: 'No code changes to analyze',
750
- findings: [],
751
- usage: emptyUsage(),
752
- durationMs: Date.now() - startTime,
753
- };
754
- if (skippedFiles.length > 0) {
755
- report.skippedFiles = skippedFiles;
756
- }
757
- return report;
758
- }
759
- const totalFiles = fileHunks.length;
760
- const allFindings = [];
761
- // Track all usage stats for aggregation
762
- const allUsage = [];
763
- // Track failed hunks across all files
764
- let totalFailedHunks = 0;
765
- // Build PR context for inclusion in prompts (helps LLM understand the full scope of changes)
766
- const prContext = {
767
- changedFiles: context.pullRequest.files.map((f) => f.filename),
768
- title: context.pullRequest.title,
769
- body: context.pullRequest.body,
770
- };
771
- /**
772
- * Process all hunks for a single file sequentially.
773
- * Wraps analyzeFile with progress callbacks.
774
- */
775
- async function processFile(fileHunkEntry, fileIndex) {
776
- const { filename } = fileHunkEntry;
777
- callbacks?.onFileStart?.(filename, fileIndex, totalFiles);
778
- const fileCallbacks = {
779
- skillStartTime: callbacks?.skillStartTime,
780
- onHunkStart: (hunkNum, totalHunks, lineRange) => {
781
- callbacks?.onHunkStart?.(filename, hunkNum, totalHunks, lineRange);
782
- },
783
- onHunkComplete: (hunkNum, findings) => {
784
- callbacks?.onHunkComplete?.(filename, hunkNum, findings);
785
- },
786
- onLargePrompt: callbacks?.onLargePrompt
787
- ? (lineRange, chars, estimatedTokens) => {
788
- callbacks.onLargePrompt?.(filename, lineRange, chars, estimatedTokens);
789
- }
790
- : undefined,
791
- onPromptSize: callbacks?.onPromptSize
792
- ? (lineRange, systemChars, userChars, totalChars, estimatedTokens) => {
793
- callbacks.onPromptSize?.(filename, lineRange, systemChars, userChars, totalChars, estimatedTokens);
794
- }
795
- : undefined,
796
- onRetry: callbacks?.onRetry
797
- ? (lineRange, attempt, maxRetries, error, delayMs) => {
798
- callbacks.onRetry?.(filename, lineRange, attempt, maxRetries, error, delayMs);
799
- }
800
- : undefined,
801
- };
802
- const result = await analyzeFile(skill, fileHunkEntry, context.repoPath, options, fileCallbacks, prContext);
803
- callbacks?.onFileComplete?.(filename, fileIndex, totalFiles);
804
- return result;
805
- }
806
- // Process files - parallel or sequential based on options
807
- if (parallel) {
808
- // Process files in parallel with concurrency limit
809
- const fileConcurrency = options.concurrency ?? DEFAULT_FILE_CONCURRENCY;
810
- const batchDelayMs = options.batchDelayMs ?? 0;
811
- for (let i = 0; i < fileHunks.length; i += fileConcurrency) {
812
- // Check for abort before starting new batch
813
- if (abortController?.signal.aborted)
814
- break;
815
- // Apply rate limiting delay between batches (not before the first batch)
816
- if (i > 0 && batchDelayMs > 0) {
817
- await new Promise((resolve) => setTimeout(resolve, batchDelayMs));
818
- }
819
- const batch = fileHunks.slice(i, i + fileConcurrency);
820
- const batchPromises = batch.map((fileHunkEntry, batchIndex) => processFile(fileHunkEntry, i + batchIndex));
821
- const batchResults = await Promise.all(batchPromises);
822
- for (const result of batchResults) {
823
- allFindings.push(...result.findings);
824
- allUsage.push(result.usage);
825
- totalFailedHunks += result.failedHunks;
826
- }
827
- }
828
- }
829
- else {
830
- // Process files sequentially
831
- for (const [fileIndex, fileHunkEntry] of fileHunks.entries()) {
832
- // Check for abort before starting new file
833
- if (abortController?.signal.aborted)
834
- break;
835
- const result = await processFile(fileHunkEntry, fileIndex);
836
- allFindings.push(...result.findings);
837
- allUsage.push(result.usage);
838
- totalFailedHunks += result.failedHunks;
839
- }
840
- }
841
- // Deduplicate findings
842
- const uniqueFindings = deduplicateFindings(allFindings);
843
- // Generate summary
844
- const summary = generateSummary(skill.name, uniqueFindings);
845
- // Aggregate usage across all hunks
846
- const totalUsage = aggregateUsage(allUsage);
847
- const report = {
848
- skill: skill.name,
849
- summary,
850
- findings: uniqueFindings,
851
- usage: totalUsage,
852
- durationMs: Date.now() - startTime,
853
- };
854
- if (skippedFiles.length > 0) {
855
- report.skippedFiles = skippedFiles;
856
- }
857
- if (totalFailedHunks > 0) {
858
- report.failedHunks = totalFailedHunks;
859
- }
860
- return report;
861
- }
862
- /**
863
- * Generate a summary of findings.
864
- */
865
- export function generateSummary(skillName, findings) {
866
- if (findings.length === 0) {
867
- return `${skillName}: No issues found`;
868
- }
869
- const counts = {};
870
- for (const f of findings) {
871
- counts[f.severity] = (counts[f.severity] ?? 0) + 1;
872
- }
873
- const parts = [];
874
- if (counts['critical'])
875
- parts.push(`${counts['critical']} critical`);
876
- if (counts['high'])
877
- parts.push(`${counts['high']} high`);
878
- if (counts['medium'])
879
- parts.push(`${counts['medium']} medium`);
880
- if (counts['low'])
881
- parts.push(`${counts['low']} low`);
882
- if (counts['info'])
883
- parts.push(`${counts['info']} info`);
884
- return `${skillName}: Found ${findings.length} issue${findings.length === 1 ? '' : 's'} (${parts.join(', ')})`;
885
- }
4
+ * This module re-exports functionality from focused submodules:
5
+ * - errors.ts: Error classes and classification (SkillRunnerError, WardenAuthenticationError)
6
+ * - retry.ts: Retry logic with exponential backoff
7
+ * - usage.ts: Usage stats extraction and aggregation
8
+ * - prompt.ts: Prompt building for skills
9
+ * - extract.ts: JSON extraction from model output
10
+ * - prepare.ts: File preparation for analysis
11
+ * - analyze.ts: Hunk and file analysis orchestration
12
+ * - types.ts: Shared interfaces
13
+ */
14
+ // Re-export error classes and utilities
15
+ export { SkillRunnerError, WardenAuthenticationError, isRetryableError, isAuthenticationError, isAuthenticationErrorMessage } from './errors.js';
16
+ // Re-export retry utilities
17
+ export { calculateRetryDelay } from './retry.js';
18
+ // Re-export usage utilities
19
+ export { aggregateUsage, estimateTokens } from './usage.js';
20
+ // Re-export prompt building (with legacy alias)
21
+ export { buildHunkSystemPrompt, buildHunkUserPrompt } from './prompt.js';
886
22
  // Legacy export for backwards compatibility
887
- export { buildHunkSystemPrompt as buildSystemPrompt };
23
+ export { buildHunkSystemPrompt as buildSystemPrompt } from './prompt.js';
24
+ // Re-export extraction utilities
25
+ export { extractFindingsJson, extractBalancedJson, extractFindingsWithLLM, truncateForLLMFallback, deduplicateFindings, } from './extract.js';
26
+ // Re-export file preparation
27
+ export { prepareFiles } from './prepare.js';
28
+ // Re-export analysis functions
29
+ export { analyzeFile, runSkill, generateSummary } from './analyze.js';
888
30
  //# sourceMappingURL=runner.js.map