hex-audit 0.7.0 → 0.8.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 (584) hide show
  1. package/CLAUDE.md +137 -77
  2. package/DEMO.md +40 -117
  3. package/README.md +200 -402
  4. package/dashboard/.next/BUILD_ID +1 -1
  5. package/dashboard/.next/app-build-manifest.json +56 -101
  6. package/dashboard/.next/app-path-routes-manifest.json +1 -1
  7. package/dashboard/.next/build-manifest.json +9 -9
  8. package/dashboard/.next/next-server.js.nft.json +1 -1
  9. package/dashboard/.next/prerender-manifest.json +1 -1
  10. package/dashboard/.next/react-loadable-manifest.json +436 -15
  11. package/dashboard/.next/routes-manifest.json +1 -1
  12. package/dashboard/.next/server/app/_not-found/page.js +1 -1
  13. package/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/dashboard/.next/server/app/api/code/route.js +1 -1
  16. package/dashboard/.next/server/app/api/code/route.js.nft.json +1 -1
  17. package/dashboard/.next/server/app/api/comments/route.js +1 -0
  18. package/dashboard/.next/server/app/api/comments/route.js.nft.json +1 -0
  19. package/dashboard/.next/server/app/api/diagrams/[name]/export/route.js +1 -0
  20. package/dashboard/.next/server/app/api/diagrams/[name]/export/route.js.nft.json +1 -0
  21. package/dashboard/.next/server/app/api/diagrams/[name]/resolve/route.js +1 -0
  22. package/dashboard/.next/server/app/api/diagrams/[name]/resolve/route.js.nft.json +1 -0
  23. package/dashboard/.next/server/app/api/diagrams/[name]/route.js +1 -0
  24. package/dashboard/.next/server/app/api/diagrams/[name]/route.js.nft.json +1 -0
  25. package/dashboard/.next/server/app/api/figures/[name]/route.js +1 -0
  26. package/dashboard/.next/server/app/api/figures/[name]/route.js.nft.json +1 -0
  27. package/dashboard/.next/server/app/api/focus/route.js +1 -0
  28. package/dashboard/.next/server/app/api/focus/route.js.nft.json +1 -0
  29. package/dashboard/.next/server/app/api/github-status/route.js +1 -1
  30. package/dashboard/.next/server/app/api/invariants/[id]/route.js +1 -0
  31. package/dashboard/.next/server/app/api/invariants/[id]/route.js.nft.json +1 -0
  32. package/dashboard/.next/server/app/api/issues/[id]/revert-auto/route.js +1 -0
  33. package/dashboard/.next/server/app/api/issues/[id]/revert-auto/route.js.nft.json +1 -0
  34. package/dashboard/.next/server/app/api/nav/route.js +1 -0
  35. package/dashboard/.next/server/app/api/nav/route.js.nft.json +1 -0
  36. package/dashboard/.next/server/app/api/notes/done/route.js +1 -1
  37. package/dashboard/.next/server/app/api/notes/done/route.js.nft.json +1 -1
  38. package/dashboard/.next/server/app/api/notes/lead/route.js +1 -1
  39. package/dashboard/.next/server/app/api/notes/lead/route.js.nft.json +1 -1
  40. package/dashboard/.next/server/app/api/notes/question/route.js +1 -1
  41. package/dashboard/.next/server/app/api/notes/question/route.js.nft.json +1 -1
  42. package/dashboard/.next/server/app/api/notes/record/route.js +3 -3
  43. package/dashboard/.next/server/app/api/notes/route.js +2 -2
  44. package/dashboard/.next/server/app/api/palette/route.js +1 -0
  45. package/dashboard/.next/server/app/api/palette/route.js.nft.json +1 -0
  46. package/dashboard/.next/server/app/api/progress/route.js +1 -1
  47. package/dashboard/.next/server/app/api/progress/route.js.nft.json +1 -1
  48. package/dashboard/.next/server/app/api/watch/route.js +2 -2
  49. package/dashboard/.next/server/app/api/watch/route.js.nft.json +1 -1
  50. package/dashboard/.next/server/app/api/xref/route.js +1 -0
  51. package/dashboard/.next/server/app/changes/page.js +1 -20
  52. package/dashboard/.next/server/app/changes/page.js.nft.json +1 -1
  53. package/dashboard/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  54. package/dashboard/.next/server/app/excalidraw-assets/[...path]/route.js +1 -0
  55. package/dashboard/.next/server/app/issues/page.js +5 -28
  56. package/dashboard/.next/server/app/issues/page.js.nft.json +1 -1
  57. package/dashboard/.next/server/app/issues/page_client-reference-manifest.js +1 -1
  58. package/dashboard/.next/server/app/model/page.js +1 -0
  59. package/dashboard/.next/server/app/{calls → model}/page.js.nft.json +1 -1
  60. package/dashboard/.next/server/app/model/page_client-reference-manifest.js +1 -0
  61. package/dashboard/.next/server/app/page.js +1 -20
  62. package/dashboard/.next/server/app/page.js.nft.json +1 -1
  63. package/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  64. package/dashboard/.next/server/app/report/page.js +1 -1
  65. package/dashboard/.next/server/app/report/page.js.nft.json +1 -1
  66. package/dashboard/.next/server/app/report/page_client-reference-manifest.js +1 -1
  67. package/dashboard/.next/server/app/review/page.js +1 -0
  68. package/dashboard/.next/server/app/{access → review}/page.js.nft.json +1 -1
  69. package/dashboard/.next/server/app/review/page_client-reference-manifest.js +1 -0
  70. package/dashboard/.next/server/app-paths-manifest.json +19 -16
  71. package/dashboard/.next/server/chunks/310.js +4 -0
  72. package/dashboard/.next/server/chunks/370.js +1 -0
  73. package/dashboard/.next/server/chunks/42.js +1 -1
  74. package/dashboard/.next/server/chunks/624.js +14 -0
  75. package/dashboard/.next/server/chunks/645.js +1 -1
  76. package/dashboard/.next/server/chunks/649.js +1 -1
  77. package/dashboard/.next/server/chunks/653.js +1 -0
  78. package/dashboard/.next/server/functions-config-manifest.json +1 -1
  79. package/dashboard/.next/server/middleware-build-manifest.js +1 -1
  80. package/dashboard/.next/server/middleware-react-loadable-manifest.js +1 -1
  81. package/dashboard/.next/server/pages/500.html +1 -1
  82. package/dashboard/.next/server/pages/_error.js +1 -1
  83. package/dashboard/.next/server/server-reference-manifest.js +1 -1
  84. package/dashboard/.next/server/server-reference-manifest.json +1 -1
  85. package/dashboard/.next/static/chunks/0bbe10ee.8e7ffa06d2170dfe.js +84 -0
  86. package/dashboard/.next/static/chunks/1026.0ef689a305302427.js +1 -0
  87. package/dashboard/.next/static/chunks/1164.34eb76767ebea46f.js +8 -0
  88. package/dashboard/.next/static/chunks/119.a9a79633900a235f.js +5 -0
  89. package/dashboard/.next/static/chunks/1291.6c486c9b1d4b1b3a.js +1 -0
  90. package/dashboard/.next/static/chunks/139.4691848fc5a46253.js +10 -0
  91. package/dashboard/.next/static/chunks/145.1bf74fecdb4022e3.js +11 -0
  92. package/dashboard/.next/static/chunks/1517.8e7075f78e22b3a0.js +8 -0
  93. package/dashboard/.next/static/chunks/165.6f174060a0ce2db4.js +6 -0
  94. package/dashboard/.next/static/chunks/1741.5c370b7702d2eb40.js +8 -0
  95. package/dashboard/.next/static/chunks/1e36816c.5748c83adc8a6bd6.js +108 -0
  96. package/dashboard/.next/static/chunks/2061.eab75b3c1dfa068a.js +1 -0
  97. package/dashboard/.next/static/chunks/2148.3ce718f62d1b2f7c.js +10 -0
  98. package/dashboard/.next/static/chunks/217-1d5b680ffd10e3f9.js +1 -0
  99. package/dashboard/.next/static/chunks/2208.fb884379aa3ae968.js +1 -0
  100. package/dashboard/.next/static/chunks/2276.112c7855333fca5f.js +6 -0
  101. package/dashboard/.next/static/chunks/2374-8c6f137938f8518a.js +1 -0
  102. package/dashboard/.next/static/chunks/2445.18a86507d2996b95.js +1 -0
  103. package/dashboard/.next/static/chunks/2712.15dd8577973baf22.js +10 -0
  104. package/dashboard/.next/static/chunks/2759.533dec5317e0a1d1.js +1 -0
  105. package/dashboard/.next/static/chunks/2812.62b213bef580b69a.js +1 -0
  106. package/dashboard/.next/static/chunks/2895.bb57cacb7aaf42a1.js +9 -0
  107. package/dashboard/.next/static/chunks/2972.e5a9251b538dcf19.js +9 -0
  108. package/dashboard/.next/static/chunks/3206.8d9a10db2b04b93f.js +1 -0
  109. package/dashboard/.next/static/chunks/3485.36766504793b7237.js +9 -0
  110. package/dashboard/.next/static/chunks/3725.de9376dc994735d4.js +9 -0
  111. package/dashboard/.next/static/chunks/3774.1df377928e8387f7.js +9 -0
  112. package/dashboard/.next/static/chunks/3963.39d72b3875dfe2e9.js +13 -0
  113. package/dashboard/.next/static/chunks/4013.73884b23bfaebdde.js +11 -0
  114. package/dashboard/.next/static/chunks/4117.278aff1fa23fd36e.js +6 -0
  115. package/dashboard/.next/static/chunks/4210.cc8594110017c579.js +11 -0
  116. package/dashboard/.next/static/chunks/4282.28485875540886cc.js +7 -0
  117. package/dashboard/.next/static/chunks/4318.a2f469a88d88f6d0.js +8 -0
  118. package/dashboard/.next/static/chunks/4363.8999a6e727c48003.js +1 -0
  119. package/dashboard/.next/static/chunks/4641.e03d118fffebd580.js +5 -0
  120. package/dashboard/.next/static/chunks/483.a910dab7734a1074.js +8 -0
  121. package/dashboard/.next/static/chunks/4926.76693f542e9cc062.js +6 -0
  122. package/dashboard/.next/static/chunks/4938.03f6d04dabf38745.js +10 -0
  123. package/dashboard/.next/static/chunks/5112.0757c2b0c285e62e.js +1 -0
  124. package/dashboard/.next/static/chunks/5199.c83ea7efb0eec705.js +11 -0
  125. package/dashboard/.next/static/chunks/530.849957a8907eb288.js +1 -0
  126. package/dashboard/.next/static/chunks/5424.4e8ca0711a32bccf.js +7 -0
  127. package/dashboard/.next/static/chunks/55.a593a78be9714679.js +1 -0
  128. package/dashboard/.next/static/chunks/5535.6cd0bd8d368d8902.js +4 -0
  129. package/dashboard/.next/static/chunks/5626.7d4e93d7acbeffc9.js +10 -0
  130. package/dashboard/.next/static/chunks/5775.a0d7c1b1e89b9a93.js +9 -0
  131. package/dashboard/.next/static/chunks/6118.266956b3333b1d7a.js +9 -0
  132. package/dashboard/.next/static/chunks/6121.a2e6d93720b1205e.js +77 -0
  133. package/dashboard/.next/static/chunks/6853.d3ad43614e8ca0ab.js +1 -0
  134. package/dashboard/.next/static/chunks/6951.02a3a158d02158c9.js +5 -0
  135. package/dashboard/.next/static/chunks/6970.013f24568c87d918.js +11 -0
  136. package/dashboard/.next/static/chunks/7013.39d41e82b37be63b.js +9 -0
  137. package/dashboard/.next/static/chunks/7107.1c5412197912b8ed.js +8 -0
  138. package/dashboard/.next/static/chunks/7508.dd60e2d06d149f5f.js +9 -0
  139. package/dashboard/.next/static/chunks/7524.0fde4c61553d1491.js +3 -0
  140. package/dashboard/.next/static/chunks/7834-47f318a04a05688f.js +1 -0
  141. package/dashboard/.next/static/chunks/8317.d0b3eddef4cae0d5.js +1 -0
  142. package/dashboard/.next/static/chunks/838.2b2aa006519ba44c.js +10 -0
  143. package/dashboard/.next/static/chunks/8398.924fd8f4c83417c0.js +7 -0
  144. package/dashboard/.next/static/chunks/8428b36f.8ac4e67061c01307.js +34 -0
  145. package/dashboard/.next/static/chunks/8514.85ccbbea8ab21d04.js +5 -0
  146. package/dashboard/.next/static/chunks/8538.5f7ebe76c4b63162.js +1 -0
  147. package/dashboard/.next/static/chunks/8687.9406baa8b5601fd0.js +1 -0
  148. package/dashboard/.next/static/chunks/8721.47346e2cb6412376.js +10 -0
  149. package/dashboard/.next/static/chunks/8770.4f544bd1a6f03a62.js +8 -0
  150. package/dashboard/.next/static/chunks/8812.3d96fd54dba566f8.js +9 -0
  151. package/dashboard/.next/static/chunks/8962.d22aa67a97970dd8.js +1 -0
  152. package/dashboard/.next/static/chunks/8986.b327224b83f4399a.js +5 -0
  153. package/dashboard/.next/static/chunks/9271.5f66c19a8ee1ff36.js +10 -0
  154. package/dashboard/.next/static/chunks/9282.f8d01442bab4c0da.js +2 -0
  155. package/dashboard/.next/static/chunks/9366.0ec24a0791b9b00f.js +1 -0
  156. package/dashboard/.next/static/chunks/9707.5cd7d2ee933a4af5.js +6 -0
  157. package/dashboard/.next/static/chunks/9716.15fffc0b0038601d.js +4 -0
  158. package/dashboard/.next/static/chunks/9791.e3b3f5a367f63c8a.js +1 -0
  159. package/dashboard/.next/static/chunks/9820.8c1efad5260e8137.js +1 -0
  160. package/dashboard/.next/static/chunks/985.50150e9eaa4bde33.js +39 -0
  161. package/dashboard/.next/static/chunks/997.56901b86e1b8a87b.js +8 -0
  162. package/dashboard/.next/static/chunks/app/changes/page-f8a860034221cad4.js +1 -0
  163. package/dashboard/.next/static/chunks/app/issues/page-da4da93188c414a6.js +1 -0
  164. package/dashboard/.next/static/chunks/app/layout-27a9da4610423c1e.js +1 -0
  165. package/dashboard/.next/static/chunks/app/model/page-9680e22fdd6ddb81.js +1 -0
  166. package/dashboard/.next/static/chunks/app/page-0e67750d99fb2836.js +1 -0
  167. package/dashboard/.next/static/chunks/app/report/page-b56b1db9b9dcf2b6.js +1 -0
  168. package/dashboard/.next/static/chunks/app/review/page-3ef69f0e0badd333.js +1 -0
  169. package/dashboard/.next/static/chunks/c75e29e3.d91220f782934d80.js +1 -0
  170. package/dashboard/.next/static/chunks/{main-cc3a889b25e9aa68.js → main-9c95a7ffedc7afb4.js} +1 -1
  171. package/dashboard/.next/static/chunks/webpack-6da70e4f9fcf1799.js +1 -0
  172. package/dashboard/.next/static/css/ceafd91ca8dd753d.css +3 -0
  173. package/dashboard/.next/static/css/e4aad1f9c715b79a.css +1 -0
  174. package/dashboard/.next/static/media/Assistant-Bold.c8f39f24.woff2 +0 -0
  175. package/dashboard/.next/static/media/Assistant-Medium.1e75d8e6.woff2 +0 -0
  176. package/dashboard/.next/static/media/Assistant-Regular.7acbabb8.woff2 +0 -0
  177. package/dashboard/.next/static/media/Assistant-SemiBold.167acbf8.woff2 +0 -0
  178. package/dashboard/app/api/code/route.ts +26 -20
  179. package/dashboard/app/api/comments/route.ts +158 -0
  180. package/dashboard/app/api/diagrams/[name]/export/route.ts +26 -0
  181. package/dashboard/app/api/diagrams/[name]/resolve/route.ts +25 -0
  182. package/dashboard/app/api/diagrams/[name]/route.ts +37 -0
  183. package/dashboard/app/api/figures/[name]/route.ts +15 -0
  184. package/dashboard/app/api/focus/route.ts +35 -0
  185. package/dashboard/app/api/invariants/[id]/route.ts +35 -0
  186. package/dashboard/app/api/issues/[id]/revert-auto/route.ts +18 -0
  187. package/dashboard/app/api/nav/route.ts +120 -0
  188. package/dashboard/app/api/palette/route.ts +68 -0
  189. package/dashboard/app/api/progress/route.ts +54 -23
  190. package/dashboard/app/api/xref/route.ts +30 -0
  191. package/dashboard/app/changes/ChangesClient.tsx +730 -356
  192. package/dashboard/app/changes/page.tsx +27 -19
  193. package/dashboard/app/excalidraw-assets/[...path]/route.ts +56 -0
  194. package/dashboard/app/globals.css +231 -77
  195. package/dashboard/app/issues/BoardClient.tsx +817 -0
  196. package/dashboard/app/issues/page.tsx +27 -272
  197. package/dashboard/app/layout.tsx +32 -17
  198. package/dashboard/app/model/ModelClient.tsx +1303 -0
  199. package/dashboard/app/model/page.tsx +98 -0
  200. package/dashboard/app/page.tsx +191 -277
  201. package/dashboard/app/report/ReportClient.tsx +147 -74
  202. package/dashboard/app/report/page.tsx +25 -14
  203. package/dashboard/app/review/ReviewClient.tsx +1180 -0
  204. package/dashboard/app/review/page.tsx +93 -0
  205. package/dashboard/components/AutoRefresh.tsx +22 -19
  206. package/dashboard/components/CodeComments.tsx +303 -0
  207. package/dashboard/components/CodeNav.tsx +523 -0
  208. package/dashboard/components/CodeReference.tsx +92 -99
  209. package/dashboard/components/CodeViewer.tsx +526 -0
  210. package/dashboard/components/CommandPalette.tsx +141 -66
  211. package/dashboard/components/DiagramCanvas.tsx +275 -0
  212. package/dashboard/components/DianeNote.tsx +244 -0
  213. package/dashboard/components/LiveStatus.tsx +30 -68
  214. package/dashboard/components/MarkdownRenderer.tsx +34 -32
  215. package/dashboard/components/RecordButton.tsx +132 -0
  216. package/dashboard/components/ui/Button.tsx +39 -0
  217. package/dashboard/components/ui/Chip.tsx +37 -0
  218. package/dashboard/components/ui/EmptyState.tsx +31 -0
  219. package/dashboard/components/ui/Icons.tsx +126 -0
  220. package/dashboard/components/ui/Inspector.tsx +122 -0
  221. package/dashboard/components/ui/Kbd.tsx +15 -0
  222. package/dashboard/components/ui/ListRow.tsx +92 -0
  223. package/dashboard/components/ui/LocalTime.tsx +14 -0
  224. package/dashboard/components/ui/ProgressRing.tsx +54 -0
  225. package/dashboard/components/ui/ResizeHandle.tsx +93 -0
  226. package/dashboard/components/ui/RiskMeter.tsx +27 -0
  227. package/dashboard/components/ui/SearchField.tsx +55 -0
  228. package/dashboard/components/ui/SegmentedControl.tsx +71 -0
  229. package/dashboard/components/ui/SeverityDot.tsx +57 -0
  230. package/dashboard/components/ui/Sidebar.tsx +236 -0
  231. package/dashboard/components/ui/SplitView.tsx +122 -0
  232. package/dashboard/components/ui/StateGlyph.tsx +66 -0
  233. package/dashboard/components/ui/Toast.tsx +91 -0
  234. package/dashboard/lib/api.ts +17 -0
  235. package/dashboard/lib/cn.ts +4 -0
  236. package/dashboard/lib/data.ts +2 -21
  237. package/dashboard/lib/finding-markdown.ts +1 -1
  238. package/dashboard/lib/focus.ts +42 -0
  239. package/dashboard/lib/hotkeys.ts +41 -0
  240. package/dashboard/lib/inline-markdown.test.ts +11 -0
  241. package/dashboard/lib/live.ts +32 -0
  242. package/dashboard/lib/pane-width.ts +36 -0
  243. package/dashboard/lib/server/board.ts +229 -0
  244. package/dashboard/lib/server/diagrams.ts +191 -0
  245. package/dashboard/lib/server/safe-path.ts +28 -0
  246. package/dashboard/lib/server/workspace.ts +113 -0
  247. package/dashboard/lib/server/xref.ts +42 -0
  248. package/dashboard/lib/solidity.test.ts +37 -0
  249. package/dashboard/lib/solidity.ts +191 -0
  250. package/dashboard/lib/source.ts +28 -0
  251. package/dashboard/lib/types.ts +164 -0
  252. package/dashboard/lib/url.ts +18 -0
  253. package/dashboard/lib/watcher.ts +31 -22
  254. package/dashboard/tailwind.config.ts +6 -3
  255. package/dist/analysis/code-model.d.ts.map +1 -1
  256. package/dist/analysis/code-model.js +4 -1
  257. package/dist/analysis/code-model.js.map +1 -1
  258. package/dist/analysis/diff.d.ts +12 -1
  259. package/dist/analysis/diff.d.ts.map +1 -1
  260. package/dist/analysis/diff.js +143 -0
  261. package/dist/analysis/diff.js.map +1 -1
  262. package/dist/commands/analyze.d.ts.map +1 -1
  263. package/dist/commands/analyze.js +17 -48
  264. package/dist/commands/analyze.js.map +1 -1
  265. package/dist/commands/claude.d.ts.map +1 -1
  266. package/dist/commands/claude.js +5 -0
  267. package/dist/commands/claude.js.map +1 -1
  268. package/dist/commands/dashboard.d.ts.map +1 -1
  269. package/dist/commands/dashboard.js +10 -2
  270. package/dist/commands/dashboard.js.map +1 -1
  271. package/dist/commands/diagram.d.ts +3 -0
  272. package/dist/commands/diagram.d.ts.map +1 -0
  273. package/dist/commands/diagram.js +71 -0
  274. package/dist/commands/diagram.js.map +1 -0
  275. package/dist/commands/diff.d.ts +4 -5
  276. package/dist/commands/diff.d.ts.map +1 -1
  277. package/dist/commands/diff.js +56 -17
  278. package/dist/commands/diff.js.map +1 -1
  279. package/dist/commands/doctor.d.ts.map +1 -1
  280. package/dist/commands/doctor.js +5 -18
  281. package/dist/commands/doctor.js.map +1 -1
  282. package/dist/commands/facts.d.ts +23 -0
  283. package/dist/commands/facts.d.ts.map +1 -0
  284. package/dist/commands/facts.js +121 -0
  285. package/dist/commands/facts.js.map +1 -0
  286. package/dist/commands/fix-review.d.ts +9 -0
  287. package/dist/commands/fix-review.d.ts.map +1 -0
  288. package/dist/commands/fix-review.js +367 -0
  289. package/dist/commands/fix-review.js.map +1 -0
  290. package/dist/commands/init.d.ts.map +1 -1
  291. package/dist/commands/init.js +51 -47
  292. package/dist/commands/init.js.map +1 -1
  293. package/dist/commands/issue.d.ts.map +1 -1
  294. package/dist/commands/issue.js +151 -2
  295. package/dist/commands/issue.js.map +1 -1
  296. package/dist/commands/mcp.d.ts +3 -0
  297. package/dist/commands/mcp.d.ts.map +1 -0
  298. package/dist/commands/mcp.js +11 -0
  299. package/dist/commands/mcp.js.map +1 -0
  300. package/dist/commands/model.d.ts +4 -0
  301. package/dist/commands/model.d.ts.map +1 -0
  302. package/dist/commands/model.js +275 -0
  303. package/dist/commands/model.js.map +1 -0
  304. package/dist/commands/note.d.ts.map +1 -1
  305. package/dist/commands/note.js +31 -1
  306. package/dist/commands/note.js.map +1 -1
  307. package/dist/commands/review.d.ts +4 -0
  308. package/dist/commands/review.d.ts.map +1 -0
  309. package/dist/commands/review.js +164 -0
  310. package/dist/commands/review.js.map +1 -0
  311. package/dist/core/comments.d.ts +59 -0
  312. package/dist/core/comments.d.ts.map +1 -0
  313. package/dist/core/comments.js +263 -0
  314. package/dist/core/comments.js.map +1 -0
  315. package/dist/core/config.d.ts.map +1 -1
  316. package/dist/core/config.js +0 -1
  317. package/dist/core/config.js.map +1 -1
  318. package/dist/core/dedup.d.ts +56 -0
  319. package/dist/core/dedup.d.ts.map +1 -0
  320. package/dist/core/dedup.js +208 -0
  321. package/dist/core/dedup.js.map +1 -0
  322. package/dist/core/errors.d.ts +1 -1
  323. package/dist/core/errors.d.ts.map +1 -1
  324. package/dist/core/errors.js +0 -15
  325. package/dist/core/errors.js.map +1 -1
  326. package/dist/core/external-tools.d.ts +0 -14
  327. package/dist/core/external-tools.d.ts.map +1 -1
  328. package/dist/core/external-tools.js +2 -52
  329. package/dist/core/external-tools.js.map +1 -1
  330. package/dist/core/fix-review.d.ts +54 -0
  331. package/dist/core/fix-review.d.ts.map +1 -0
  332. package/dist/core/fix-review.js +98 -0
  333. package/dist/core/fix-review.js.map +1 -0
  334. package/dist/core/fuzz-sync.d.ts +93 -0
  335. package/dist/core/fuzz-sync.d.ts.map +1 -0
  336. package/dist/core/fuzz-sync.js +516 -0
  337. package/dist/core/fuzz-sync.js.map +1 -0
  338. package/dist/core/git.d.ts +7 -0
  339. package/dist/core/git.d.ts.map +1 -1
  340. package/dist/core/git.js +42 -0
  341. package/dist/core/git.js.map +1 -1
  342. package/dist/core/issues.d.ts +32 -1
  343. package/dist/core/issues.d.ts.map +1 -1
  344. package/dist/core/issues.js +135 -3
  345. package/dist/core/issues.js.map +1 -1
  346. package/dist/core/mcp-config.d.ts +12 -0
  347. package/dist/core/mcp-config.d.ts.map +1 -0
  348. package/dist/core/mcp-config.js +29 -0
  349. package/dist/core/mcp-config.js.map +1 -0
  350. package/dist/core/model.d.ts +38 -0
  351. package/dist/core/model.d.ts.map +1 -0
  352. package/dist/core/model.js +160 -0
  353. package/dist/core/model.js.map +1 -0
  354. package/dist/core/notes.d.ts +2 -0
  355. package/dist/core/notes.d.ts.map +1 -1
  356. package/dist/core/notes.js +13 -3
  357. package/dist/core/notes.js.map +1 -1
  358. package/dist/core/review.d.ts +47 -0
  359. package/dist/core/review.d.ts.map +1 -1
  360. package/dist/core/review.js +177 -1
  361. package/dist/core/review.js.map +1 -1
  362. package/dist/core/rules.d.ts +12 -0
  363. package/dist/core/rules.d.ts.map +1 -0
  364. package/dist/core/rules.js +66 -0
  365. package/dist/core/rules.js.map +1 -0
  366. package/dist/core/schema.d.ts +4817 -2245
  367. package/dist/core/schema.d.ts.map +1 -1
  368. package/dist/core/schema.js +452 -113
  369. package/dist/core/schema.js.map +1 -1
  370. package/dist/core/scope.d.ts +8 -0
  371. package/dist/core/scope.d.ts.map +1 -0
  372. package/dist/core/scope.js +18 -0
  373. package/dist/core/scope.js.map +1 -0
  374. package/dist/diagrams/build.d.ts +18 -0
  375. package/dist/diagrams/build.d.ts.map +1 -0
  376. package/dist/diagrams/build.js +135 -0
  377. package/dist/diagrams/build.js.map +1 -0
  378. package/dist/diagrams/excalidraw.d.ts +27 -0
  379. package/dist/diagrams/excalidraw.d.ts.map +1 -0
  380. package/dist/diagrams/excalidraw.js +219 -0
  381. package/dist/diagrams/excalidraw.js.map +1 -0
  382. package/dist/diagrams/layout.d.ts +48 -0
  383. package/dist/diagrams/layout.d.ts.map +1 -0
  384. package/dist/diagrams/layout.js +686 -0
  385. package/dist/diagrams/layout.js.map +1 -0
  386. package/dist/facts/build.d.ts +23 -0
  387. package/dist/facts/build.d.ts.map +1 -0
  388. package/dist/facts/build.js +112 -0
  389. package/dist/facts/build.js.map +1 -0
  390. package/dist/facts/extract.d.ts +53 -0
  391. package/dist/facts/extract.d.ts.map +1 -0
  392. package/dist/facts/extract.js +635 -0
  393. package/dist/facts/extract.js.map +1 -0
  394. package/dist/facts/fallback.d.ts +7 -0
  395. package/dist/facts/fallback.d.ts.map +1 -0
  396. package/dist/facts/fallback.js +156 -0
  397. package/dist/facts/fallback.js.map +1 -0
  398. package/dist/facts/implementations.d.ts +29 -0
  399. package/dist/facts/implementations.d.ts.map +1 -0
  400. package/dist/facts/implementations.js +43 -0
  401. package/dist/facts/implementations.js.map +1 -0
  402. package/dist/facts/query.d.ts +35 -0
  403. package/dist/facts/query.d.ts.map +1 -0
  404. package/dist/facts/query.js +157 -0
  405. package/dist/facts/query.js.map +1 -0
  406. package/dist/facts/xref.d.ts +53 -0
  407. package/dist/facts/xref.d.ts.map +1 -0
  408. package/dist/facts/xref.js +282 -0
  409. package/dist/facts/xref.js.map +1 -0
  410. package/dist/index.js +14 -16
  411. package/dist/index.js.map +1 -1
  412. package/dist/mcp/server.d.ts +3 -0
  413. package/dist/mcp/server.d.ts.map +1 -0
  414. package/dist/mcp/server.js +400 -0
  415. package/dist/mcp/server.js.map +1 -0
  416. package/dist/skills/ai-audit/SKILL.md +16 -6
  417. package/dist/skills/ai-audit/UPSTREAM.md +9 -4
  418. package/dist/skills/ai-audit/references/hex-board.md +34 -46
  419. package/dist/skills/diane.md +26 -12
  420. package/dist/skills/fix-review.md +58 -0
  421. package/dist/skills/fuzz/LICENSE +21 -0
  422. package/dist/skills/fuzz/SKILL.md +655 -0
  423. package/dist/skills/fuzz/UPSTREAM.md +119 -0
  424. package/dist/skills/fuzz/agents/implementers/global-property-implementer.md +81 -0
  425. package/dist/skills/fuzz/agents/implementers/specific-property-implementer.md +121 -0
  426. package/dist/skills/fuzz/agents/invariant-discovery/adversarial-profit-maximizer.md +123 -0
  427. package/dist/skills/fuzz/agents/invariant-discovery/conservation-auditor.md +92 -0
  428. package/dist/skills/fuzz/agents/invariant-discovery/protocol-type-specialist.md +173 -0
  429. package/dist/skills/fuzz/agents/invariant-discovery/roundtrip-rounding-analyst.md +164 -0
  430. package/dist/skills/fuzz/agents/invariant-discovery/state-transition-mapper.md +92 -0
  431. package/dist/skills/fuzz/agents/invariant-discovery/synthesizer.md +261 -0
  432. package/dist/skills/fuzz/agents/protocol-analyzer.md +80 -0
  433. package/dist/skills/fuzz/agents/report-writer.md +135 -0
  434. package/dist/skills/fuzz/references/handler-patterns.md +222 -0
  435. package/dist/skills/fuzz/references/hex-invariants.md +102 -0
  436. package/dist/skills/fuzz/references/property-generation.md +149 -0
  437. package/dist/skills/fuzz/references/selection-policy.md +49 -0
  438. package/dist/skills/fuzz/references/setup-playbook.md +92 -0
  439. package/dist/skills/fuzz/references/template-map.md +121 -0
  440. package/dist/skills/fuzz/scripts/ensure_foundry.sh +125 -0
  441. package/dist/skills/fuzz/scripts/estimate_cost.js +157 -0
  442. package/dist/skills/fuzz/scripts/extract_abis.js +303 -0
  443. package/dist/skills/fuzz/scripts/fizz_sync.js +692 -0
  444. package/dist/skills/fuzz/scripts/generate_handlers.js +370 -0
  445. package/dist/skills/fuzz/scripts/generate_suite.js +254 -0
  446. package/dist/skills/fuzz/scripts/lib/log-viewer.js +332 -0
  447. package/dist/skills/fuzz/scripts/run_echidna.js +192 -0
  448. package/dist/skills/fuzz/scripts/run_medusa.js +329 -0
  449. package/dist/skills/fuzz/scripts/select_functions.js +637 -0
  450. package/dist/skills/fuzz/scripts/setup_fuzz_profile.sh +142 -0
  451. package/dist/skills/fuzz/templates/Actor.sol +63 -0
  452. package/dist/skills/fuzz/templates/Base.sol +121 -0
  453. package/dist/skills/fuzz/templates/FoundryTester.sol +29 -0
  454. package/dist/skills/fuzz/templates/FuzzTester.sol +11 -0
  455. package/dist/skills/fuzz/templates/Properties.sol +17 -0
  456. package/dist/skills/fuzz/templates/README.md +56 -0
  457. package/dist/skills/fuzz/templates/Snapshots.sol +26 -0
  458. package/dist/skills/fuzz/templates/echidna.yaml +18 -0
  459. package/dist/skills/fuzz/templates/handlers/Handlers.sol +13 -0
  460. package/dist/skills/fuzz/templates/medusa.json +93 -0
  461. package/dist/skills/fuzz/templates/utils/Clamp.sol +223 -0
  462. package/dist/skills/fuzz/templates/utils/DecimalPrinter.sol +63 -0
  463. package/dist/skills/fuzz/templates/utils/Deployer.sol +17 -0
  464. package/dist/skills/fuzz/templates/utils/EnumerableSet.sol +206 -0
  465. package/dist/skills/fuzz/templates/utils/Hevm.sol +62 -0
  466. package/dist/skills/fuzz/templates/utils/Logger.sol +619 -0
  467. package/dist/skills/fuzz/templates/utils/Math.sol +52 -0
  468. package/dist/skills/fuzz/templates/utils/MockERC20.sol +279 -0
  469. package/dist/skills/fuzz/templates/utils/PropertiesAsserts.sol +238 -0
  470. package/dist/skills/fuzz/templates/utils/StringUtils.sol +85 -0
  471. package/dist/skills/fuzz-convert/SKILL.md +249 -0
  472. package/dist/skills/fuzz-sync/SKILL.md +342 -0
  473. package/dist/skills/generate-poc.md +8 -26
  474. package/dist/skills/generate-report.md +17 -5
  475. package/dist/skills/ingest-aa-report.md +11 -30
  476. package/dist/skills/init-audit/SKILL.md +155 -0
  477. package/dist/skills/init-audit/references/agents/conformance-checker.md +36 -0
  478. package/dist/skills/init-audit/references/agents/contract-reader.md +59 -0
  479. package/dist/skills/init-audit/references/agents/diagram-composer.md +48 -0
  480. package/dist/skills/init-audit/references/agents/docs-extractor.md +26 -0
  481. package/dist/skills/init-audit/references/agents/prior-audit.md +32 -0
  482. package/dist/skills/init-audit/references/agents/regression-checker.md +28 -0
  483. package/dist/skills/init-audit/references/agents/skeptic.md +31 -0
  484. package/dist/skills/init-audit/references/agents/standards-checker.md +39 -0
  485. package/dist/skills/init-audit/references/agents/synthesizer.md +50 -0
  486. package/dist/skills/prevalidate.md +62 -0
  487. package/dist/skills/sync-issues.md +11 -25
  488. package/dist/skills/validate-all-findings.md +2 -2
  489. package/dist/skills/validate-finding.md +25 -24
  490. package/dist/skills/write-finding.md +6 -5
  491. package/dist/types/index.d.ts +16 -12
  492. package/dist/types/index.d.ts.map +1 -1
  493. package/package.json +5 -4
  494. package/dashboard/.next/server/app/access/page.js +0 -1
  495. package/dashboard/.next/server/app/access/page_client-reference-manifest.js +0 -1
  496. package/dashboard/.next/server/app/api/flows/route.js +0 -1
  497. package/dashboard/.next/server/app/api/mermaid/route.js +0 -1
  498. package/dashboard/.next/server/app/calls/page.js +0 -1
  499. package/dashboard/.next/server/app/calls/page_client-reference-manifest.js +0 -1
  500. package/dashboard/.next/server/app/conformance/page.js +0 -1
  501. package/dashboard/.next/server/app/conformance/page.js.nft.json +0 -1
  502. package/dashboard/.next/server/app/conformance/page_client-reference-manifest.js +0 -1
  503. package/dashboard/.next/server/app/diagram/page.js +0 -1
  504. package/dashboard/.next/server/app/diagram/page.js.nft.json +0 -1
  505. package/dashboard/.next/server/app/diagram/page_client-reference-manifest.js +0 -1
  506. package/dashboard/.next/server/app/flows/page.js +0 -1
  507. package/dashboard/.next/server/app/flows/page.js.nft.json +0 -1
  508. package/dashboard/.next/server/app/flows/page_client-reference-manifest.js +0 -1
  509. package/dashboard/.next/server/app/functions/page.js +0 -1
  510. package/dashboard/.next/server/app/functions/page.js.nft.json +0 -1
  511. package/dashboard/.next/server/app/functions/page_client-reference-manifest.js +0 -1
  512. package/dashboard/.next/server/app/notes/page.js +0 -22
  513. package/dashboard/.next/server/app/notes/page.js.nft.json +0 -1
  514. package/dashboard/.next/server/app/notes/page_client-reference-manifest.js +0 -1
  515. package/dashboard/.next/server/app/progress/page.js +0 -1
  516. package/dashboard/.next/server/app/progress/page.js.nft.json +0 -1
  517. package/dashboard/.next/server/app/progress/page_client-reference-manifest.js +0 -1
  518. package/dashboard/.next/server/app/stats/page.js +0 -1
  519. package/dashboard/.next/server/app/stats/page.js.nft.json +0 -1
  520. package/dashboard/.next/server/app/stats/page_client-reference-manifest.js +0 -1
  521. package/dashboard/.next/server/chunks/530.js +0 -1
  522. package/dashboard/.next/server/chunks/622.js +0 -3
  523. package/dashboard/.next/server/chunks/665.js +0 -13
  524. package/dashboard/.next/server/chunks/939.js +0 -1
  525. package/dashboard/.next/static/chunks/3017.4a5312e3c20a173f.js +0 -1
  526. package/dashboard/.next/static/chunks/7397-37adf76cad543297.js +0 -1
  527. package/dashboard/.next/static/chunks/7973.e34032723285a616.js +0 -79
  528. package/dashboard/.next/static/chunks/8452-6d77fa353402422c.js +0 -13
  529. package/dashboard/.next/static/chunks/8928-fc049decdfbdaa6d.js +0 -1
  530. package/dashboard/.next/static/chunks/app/access/page-f8403cbdfc1c176b.js +0 -1
  531. package/dashboard/.next/static/chunks/app/calls/page-41f20d01e12382ef.js +0 -1
  532. package/dashboard/.next/static/chunks/app/changes/page-82bf8b6f48cdc506.js +0 -1
  533. package/dashboard/.next/static/chunks/app/conformance/page-6bb8e3b372e38098.js +0 -1
  534. package/dashboard/.next/static/chunks/app/diagram/page-469cd7a6f183efba.js +0 -1
  535. package/dashboard/.next/static/chunks/app/flows/page-7872dd9141ba0b07.js +0 -1
  536. package/dashboard/.next/static/chunks/app/functions/page-5847bcb77a8e7edf.js +0 -1
  537. package/dashboard/.next/static/chunks/app/issues/page-1ffc64fe40439002.js +0 -1
  538. package/dashboard/.next/static/chunks/app/layout-6c6d2a0fd7c989d3.js +0 -1
  539. package/dashboard/.next/static/chunks/app/notes/page-8bcaa52304500098.js +0 -1
  540. package/dashboard/.next/static/chunks/app/page-d63800ddb072b77b.js +0 -1
  541. package/dashboard/.next/static/chunks/app/progress/page-e26554f655a62eef.js +0 -1
  542. package/dashboard/.next/static/chunks/app/report/page-18c04fb2f193b020.js +0 -1
  543. package/dashboard/.next/static/chunks/app/stats/page-67ff59fd69bed651.js +0 -1
  544. package/dashboard/.next/static/chunks/webpack-4de0e79bdd6a0418.js +0 -1
  545. package/dashboard/.next/static/css/1112cea2260b3926.css +0 -3
  546. package/dashboard/app/access/AccessClient.tsx +0 -402
  547. package/dashboard/app/access/ReadOnlyFunctions.tsx +0 -114
  548. package/dashboard/app/access/page.tsx +0 -125
  549. package/dashboard/app/api/flows/route.ts +0 -32
  550. package/dashboard/app/api/mermaid/route.ts +0 -25
  551. package/dashboard/app/calls/CallsClient.tsx +0 -170
  552. package/dashboard/app/calls/page.tsx +0 -57
  553. package/dashboard/app/conformance/ConformanceTable.tsx +0 -214
  554. package/dashboard/app/conformance/page.tsx +0 -186
  555. package/dashboard/app/diagram/page.tsx +0 -65
  556. package/dashboard/app/flows/page.tsx +0 -102
  557. package/dashboard/app/functions/FunctionsClient.tsx +0 -167
  558. package/dashboard/app/functions/page.tsx +0 -178
  559. package/dashboard/app/issues/IssuesBoardClient.tsx +0 -813
  560. package/dashboard/app/notes/NotesClient.tsx +0 -706
  561. package/dashboard/app/notes/page.tsx +0 -47
  562. package/dashboard/app/progress/ProgressClient.tsx +0 -354
  563. package/dashboard/app/progress/page.tsx +0 -127
  564. package/dashboard/app/stats/StatsClient.tsx +0 -452
  565. package/dashboard/app/stats/page.tsx +0 -50
  566. package/dashboard/components/ConfidenceBadge.tsx +0 -53
  567. package/dashboard/components/DashboardLayout.tsx +0 -510
  568. package/dashboard/components/FilterableTable.tsx +0 -293
  569. package/dashboard/components/MermaidViewer.tsx +0 -267
  570. package/dashboard/components/NotYetGenerated.tsx +0 -32
  571. package/dashboard/components/SeverityBadge.tsx +0 -28
  572. package/dashboard/components/SignalBars.tsx +0 -27
  573. package/dashboard/components/SortableTable.tsx +0 -122
  574. package/dashboard/lib/conformance-tokens.ts +0 -49
  575. package/dist/skills/init-audit.md +0 -386
  576. /package/dashboard/.next/server/app/api/{flows → xref}/route.js.nft.json +0 -0
  577. /package/dashboard/.next/server/app/{api/mermaid → excalidraw-assets/[...path]}/route.js.nft.json +0 -0
  578. /package/dashboard/.next/static/{z5XBev05xDAkDrxWxAjNu → bGV1ry1vvIbM5b506eVBR}/_buildManifest.js +0 -0
  579. /package/dashboard/.next/static/{z5XBev05xDAkDrxWxAjNu → bGV1ry1vvIbM5b506eVBR}/_ssgManifest.js +0 -0
  580. /package/dashboard/.next/static/chunks/{3205-47d09be47325709f.js → 3205-fd963acf2fdfd080.js} +0 -0
  581. /package/dashboard/.next/static/chunks/{3924-88d849290406ee6f.js → 3924-f1f85ccc7d59d7ab.js} +0 -0
  582. /package/dashboard/.next/static/chunks/{618f8807-69fc7bb97c2b87c1.js → 618f8807-fbb1466bc29c17c6.js} +0 -0
  583. /package/dashboard/.next/static/chunks/{7498-d1814d68ba346d13.js → 7498-7cf464d8af69cd0a.js} +0 -0
  584. /package/dashboard/.next/static/chunks/app/_not-found/{page-c299b935209993df.js → page-5ff5d54b6fd6f17e.js} +0 -0
@@ -0,0 +1,817 @@
1
+ 'use client';
2
+
3
+ import { LocalTime } from '@/components/ui/LocalTime';
4
+ import Link from 'next/link';
5
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
+ import { useRouter, useSearchParams } from 'next/navigation';
7
+ import {
8
+ DndContext,
9
+ type DragEndEvent,
10
+ PointerSensor,
11
+ useDraggable,
12
+ useDroppable,
13
+ useSensor,
14
+ useSensors,
15
+ } from '@dnd-kit/core';
16
+ import { SplitView, Toolbar } from '@/components/ui/SplitView';
17
+ import { Inspector, InspectorField, InspectorSection } from '@/components/ui/Inspector';
18
+ import { SearchField } from '@/components/ui/SearchField';
19
+ import { SegmentedControl, type Segment } from '@/components/ui/SegmentedControl';
20
+ import { SeverityDot } from '@/components/ui/SeverityDot';
21
+ import { Chip } from '@/components/ui/Chip';
22
+ import { Button } from '@/components/ui/Button';
23
+ import { Kbd } from '@/components/ui/Kbd';
24
+ import { useToast } from '@/components/ui/Toast';
25
+ import { IconChevron, IconExternal } from '@/components/ui/Icons';
26
+ import { MarkdownRenderer } from '@/components/MarkdownRenderer';
27
+ import { useHotkeys } from '@/lib/hotkeys';
28
+ import { setFocus } from '@/lib/focus';
29
+ import { replaceQuery } from '@/lib/url';
30
+ import { sendJson } from '@/lib/api';
31
+ import { cn } from '@/lib/cn';
32
+ import { findingToHackmd, type FormatContext } from '@/lib/finding-markdown';
33
+ import { SEVERITY_ORDER, SOURCE_LABEL, type BoardColumn, type BoardIssue } from '@/lib/types';
34
+
35
+ interface Rule {
36
+ id: string;
37
+ kind: string;
38
+ text: string;
39
+ scope: string[];
40
+ }
41
+
42
+ const COLUMNS: Array<{ id: BoardColumn; label: string; hint: string }> = [
43
+ { id: 'potential', label: 'Potential', hint: 'Awaiting validation' },
44
+ { id: 'verified', label: 'Verified', hint: 'Confirmed, ready to sync' },
45
+ { id: 'synced', label: 'Synced', hint: 'On GitHub; edit there' },
46
+ { id: 'invalid', label: 'Rejected', hint: 'Not in the report' },
47
+ { id: 'duplicate', label: 'Duplicate', hint: 'Covered by another card' },
48
+ ];
49
+
50
+ const COLUMN_LABEL: Record<BoardColumn, string> = Object.fromEntries(
51
+ COLUMNS.map((c) => [c.id, c.label]),
52
+ ) as Record<BoardColumn, string>;
53
+
54
+ const STATUS_FOR: Record<BoardColumn, string> = {
55
+ potential: 'pending_validation',
56
+ verified: 'verified',
57
+ synced: 'synced',
58
+ invalid: 'rejected',
59
+ duplicate: 'duplicate',
60
+ };
61
+
62
+ const RULE_KIND: Record<string, string> = {
63
+ out_of_scope: 'Out of scope',
64
+ trusted_role: 'Trusted role',
65
+ by_design: 'By design',
66
+ known_issue: 'Known issue',
67
+ };
68
+
69
+ const VERDICT: Record<string, string> = {
70
+ reproduced: 'Reproduced',
71
+ refuted: 'Refuted',
72
+ uncertain: 'Uncertain',
73
+ valid_no_poc: 'Valid, no PoC',
74
+ };
75
+
76
+ const SEVERITIES = ['Critical', 'High', 'Medium', 'Low', 'Info'] as const;
77
+ const RESOLUTIONS = ['Fixed', 'Mitigated', 'Acknowledged', 'Not Fixed', 'Unresolved'];
78
+
79
+ /** At most one status chip per card: auto-moved › PoC › duplicate. */
80
+ function statusChip(c: BoardIssue): React.ReactNode {
81
+ if (c.validation?.auto_moved_to) return <Chip>Auto-moved</Chip>;
82
+ if (c.poc_status === 'passing') return <Chip tone="ok">PoC ✓</Chip>;
83
+ if (c.poc_status === 'failing') return <Chip tone="danger">PoC ✕</Chip>;
84
+ if (c.duplicate_of) return <Chip>Dup of {c.duplicate_of}</Chip>;
85
+ return null;
86
+ }
87
+
88
+ export function BoardClient({
89
+ issues,
90
+ rules,
91
+ formatCtx,
92
+ }: {
93
+ issues: BoardIssue[];
94
+ rules: Rule[];
95
+ formatCtx: FormatContext;
96
+ }) {
97
+ const router = useRouter();
98
+ const params = useSearchParams();
99
+ const toast = useToast();
100
+
101
+ // Optimistic column moves, dropped when fresh props arrive.
102
+ const [moves, setMoves] = useState<Record<string, BoardColumn>>({});
103
+ useEffect(() => setMoves({}), [issues]);
104
+ const live = useMemo(
105
+ () =>
106
+ issues.map((i) =>
107
+ moves[i.id] ? { ...i, column: moves[i.id], status: STATUS_FOR[moves[i.id]] } : i,
108
+ ),
109
+ [issues, moves],
110
+ );
111
+
112
+ const [query, setQuery] = useState('');
113
+ const [source, setSource] = useState<string>('all');
114
+ const [collapsed, setCollapsed] = useState<Record<BoardColumn, boolean>>({
115
+ potential: false,
116
+ verified: false,
117
+ synced: false,
118
+ invalid: true,
119
+ duplicate: true,
120
+ });
121
+ const [selectedId, setSelectedId] = useState<string | null>(() => params.get('card'));
122
+ const [editing, setEditing] = useState(false);
123
+ const [showRules, setShowRules] = useState(false);
124
+
125
+ useEffect(() => {
126
+ const id = params.get('card');
127
+ if (id) setSelectedId(id);
128
+ }, [params]);
129
+
130
+ const selected = live.find((i) => i.id === selectedId) ?? null;
131
+
132
+ useEffect(() => {
133
+ replaceQuery({ card: selected?.id ?? null });
134
+ if (selected) setFocus({ ref: selected.id, kind: 'card', label: selected.title });
135
+ setEditing(false);
136
+ }, [selected?.id]); // eslint-disable-line react-hooks/exhaustive-deps
137
+
138
+ // Open the column that holds a deep-linked card.
139
+ useEffect(() => {
140
+ if (selected && collapsed[selected.column])
141
+ setCollapsed((c) => ({ ...c, [selected.column]: false }));
142
+ }, [selected?.id]); // eslint-disable-line react-hooks/exhaustive-deps
143
+
144
+ const sources = useMemo(() => {
145
+ const present = Array.from(new Set(issues.map((i) => i.source)));
146
+ return present.sort((a, b) => (SOURCE_LABEL[a] ?? a).localeCompare(SOURCE_LABEL[b] ?? b));
147
+ }, [issues]);
148
+
149
+ const filtered = useMemo(() => {
150
+ const q = query.trim().toLowerCase();
151
+ return live.filter(
152
+ (i) =>
153
+ (source === 'all' || i.source === source) &&
154
+ (!q || `${i.id} ${i.title} ${i.description}`.toLowerCase().includes(q)),
155
+ );
156
+ }, [live, query, source]);
157
+
158
+ const grouped = useMemo(() => {
159
+ const m: Record<BoardColumn, BoardIssue[]> = {
160
+ potential: [],
161
+ verified: [],
162
+ synced: [],
163
+ invalid: [],
164
+ duplicate: [],
165
+ };
166
+ for (const i of filtered) m[i.column].push(i);
167
+ for (const col of Object.values(m)) {
168
+ col.sort(
169
+ (a, b) =>
170
+ (SEVERITY_ORDER[a.severity] ?? 5) - (SEVERITY_ORDER[b.severity] ?? 5) ||
171
+ a.id.localeCompare(b.id),
172
+ );
173
+ }
174
+ return m;
175
+ }, [filtered]);
176
+
177
+ const order = useMemo(
178
+ () => COLUMNS.filter((c) => !collapsed[c.id]).flatMap((c) => grouped[c.id].map((i) => i.id)),
179
+ [grouped, collapsed],
180
+ );
181
+
182
+ const move = useCallback(
183
+ async (id: string, to: BoardColumn, opts: { undoable?: boolean } = { undoable: true }) => {
184
+ const current = live.find((i) => i.id === id);
185
+ if (!current || current.column === to) return;
186
+ const from = current.column;
187
+ setMoves((m) => ({ ...m, [id]: to }));
188
+ try {
189
+ await sendJson(`/api/issues/${encodeURIComponent(id)}/move`, { column: to });
190
+ if (opts.undoable) {
191
+ toast({
192
+ message: `${id} moved to ${COLUMN_LABEL[to]}`,
193
+ action: {
194
+ label: 'Undo',
195
+ onClick: () => {
196
+ setMoves((m) => ({ ...m, [id]: from }));
197
+ void sendJson(`/api/issues/${encodeURIComponent(id)}/move`, { column: from }).then(
198
+ () => router.refresh(),
199
+ );
200
+ },
201
+ },
202
+ });
203
+ }
204
+ router.refresh();
205
+ } catch (err) {
206
+ setMoves((m) => {
207
+ const next = { ...m };
208
+ delete next[id];
209
+ return next;
210
+ });
211
+ toast({ message: (err as Error).message, tone: 'error' });
212
+ }
213
+ },
214
+ [live, router, toast],
215
+ );
216
+
217
+ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 5 } }));
218
+ const onDragEnd = (e: DragEndEvent) => {
219
+ if (!e.over) return;
220
+ const to = e.over.id as BoardColumn;
221
+ const card = live.find((i) => i.id === e.active.id);
222
+ if (!card || card.column === to || to === 'synced' || card.column === 'synced') return;
223
+ void move(card.id, to);
224
+ };
225
+
226
+ const boardRef = useRef<HTMLDivElement>(null);
227
+ const select = (id: string | null) => {
228
+ setSelectedId(id);
229
+ if (id)
230
+ requestAnimationFrame(() =>
231
+ boardRef.current
232
+ ?.querySelector<HTMLElement>(`[data-card="${CSS.escape(id)}"]`)
233
+ ?.scrollIntoView({ block: 'nearest' }),
234
+ );
235
+ };
236
+
237
+ useHotkeys({
238
+ j: () => {
239
+ const i = selectedId ? order.indexOf(selectedId) : -1;
240
+ if (order.length) select(order[Math.min(order.length - 1, i + 1)]);
241
+ },
242
+ k: () => {
243
+ const i = selectedId ? order.indexOf(selectedId) : 0;
244
+ if (order.length) select(order[Math.max(0, i - 1)]);
245
+ },
246
+ e: (e) => {
247
+ if (selected && selected.column !== 'synced') {
248
+ e.preventDefault();
249
+ setEditing(true);
250
+ }
251
+ },
252
+ Escape: () => {
253
+ if (editing) setEditing(false);
254
+ else if (showRules) setShowRules(false);
255
+ else select(null);
256
+ },
257
+ });
258
+
259
+ const segments: Segment<string>[] = [
260
+ { value: 'all', label: 'All' },
261
+ ...sources.map((s) => ({ value: s, label: SOURCE_LABEL[s] ?? s })),
262
+ ];
263
+
264
+ return (
265
+ <SplitView
266
+ toolbar={
267
+ <Toolbar title="Board" meta={`${issues.length} card${issues.length === 1 ? '' : 's'}`}>
268
+ <SearchField
269
+ value={query}
270
+ onChange={setQuery}
271
+ placeholder="Search cards"
272
+ className="w-56"
273
+ />
274
+ {sources.length > 1 && (
275
+ <SegmentedControl
276
+ segments={segments}
277
+ value={source}
278
+ onChange={setSource}
279
+ ariaLabel="Source"
280
+ />
281
+ )}
282
+ </Toolbar>
283
+ }
284
+ inspector={
285
+ selected ? (
286
+ <CardInspector
287
+ key={selected.id}
288
+ card={selected}
289
+ editing={editing}
290
+ setEditing={setEditing}
291
+ formatCtx={formatCtx}
292
+ onClose={() => select(null)}
293
+ onReverted={() => setMoves((m) => ({ ...m, [selected.id]: 'potential' }))}
294
+ />
295
+ ) : undefined
296
+ }
297
+ >
298
+ <div className="flex min-h-0 flex-1 flex-col">
299
+ <DndContext sensors={sensors} onDragEnd={onDragEnd}>
300
+ <div ref={boardRef} className="flex min-h-0 flex-1 gap-5 overflow-x-auto px-5 pt-4">
301
+ {COLUMNS.map((col) => (
302
+ <Column
303
+ key={col.id}
304
+ column={col}
305
+ cards={grouped[col.id]}
306
+ collapsed={collapsed[col.id]}
307
+ onToggle={() => setCollapsed((c) => ({ ...c, [col.id]: !c[col.id] }))}
308
+ selectedId={selectedId}
309
+ onSelect={select}
310
+ />
311
+ ))}
312
+ </div>
313
+ </DndContext>
314
+ <footer className="relative flex shrink-0 items-center gap-3 border-t border-border-subtle px-5 py-2 text-caption text-text-tertiary">
315
+ <button
316
+ type="button"
317
+ onClick={() => setShowRules((v) => !v)}
318
+ className="rounded-md px-1.5 py-0.5 hover:bg-surface-2 hover:text-text-primary"
319
+ aria-expanded={showRules}
320
+ >
321
+ {rules.length
322
+ ? `${rules.length} triage rule${rules.length === 1 ? '' : 's'}`
323
+ : 'No triage rules'}
324
+ </button>
325
+ <span className="hidden truncate sm:inline">
326
+ Drag a card to move it · <Kbd>j</Kbd> <Kbd>k</Kbd> to step · <Kbd>e</Kbd> to edit
327
+ </span>
328
+ {showRules && (
329
+ <div className="rise-in absolute bottom-10 left-4 z-20 w-[min(420px,calc(100vw-2rem))] rounded-lg border border-border-default bg-surface-1 p-4 shadow-lg">
330
+ <div className="mb-2 text-body font-medium text-text-primary">Triage rules</div>
331
+ {rules.length === 0 ? (
332
+ <p className="text-body text-text-secondary">
333
+ Standing decisions that keep AI runs from resurfacing the same false positives.
334
+ Add one with <code className="font-mono text-caption">hex rule add</code>.
335
+ </p>
336
+ ) : (
337
+ <ul className="space-y-2">
338
+ {rules.map((r) => (
339
+ <li key={r.id} className="text-body">
340
+ <span className="text-text-primary">{r.text}</span>
341
+ <span className="block text-caption text-text-tertiary">
342
+ {r.id} · {RULE_KIND[r.kind] ?? r.kind}
343
+ {r.scope.length ? ` · ${r.scope.join(', ')}` : ' · whole audit'}
344
+ </span>
345
+ </li>
346
+ ))}
347
+ </ul>
348
+ )}
349
+ </div>
350
+ )}
351
+ </footer>
352
+ </div>
353
+ </SplitView>
354
+ );
355
+ }
356
+
357
+ function Column({
358
+ column,
359
+ cards,
360
+ collapsed,
361
+ onToggle,
362
+ selectedId,
363
+ onSelect,
364
+ }: {
365
+ column: { id: BoardColumn; label: string; hint: string };
366
+ cards: BoardIssue[];
367
+ collapsed: boolean;
368
+ onToggle: () => void;
369
+ selectedId: string | null;
370
+ onSelect: (id: string) => void;
371
+ }) {
372
+ const { isOver, setNodeRef } = useDroppable({ id: column.id, disabled: column.id === 'synced' });
373
+
374
+ if (collapsed) {
375
+ return (
376
+ <section
377
+ ref={setNodeRef}
378
+ aria-label={column.label}
379
+ className={cn(
380
+ 'flex w-10 shrink-0 flex-col items-center rounded-lg pb-4 pt-1',
381
+ isOver ? 'bg-accent-subtle' : 'hover:bg-surface-1',
382
+ )}
383
+ >
384
+ <button
385
+ type="button"
386
+ onClick={onToggle}
387
+ title={`Show ${column.label}`}
388
+ className="flex h-full w-full flex-col items-center gap-2 pt-1 text-text-tertiary hover:text-text-primary"
389
+ >
390
+ <IconChevron className="h-3.5 w-3.5" />
391
+ <span className="text-caption tabular-nums">{cards.length}</span>
392
+ <span className="text-caption font-medium [writing-mode:vertical-rl]">
393
+ {column.label}
394
+ </span>
395
+ </button>
396
+ </section>
397
+ );
398
+ }
399
+
400
+ return (
401
+ <section
402
+ ref={setNodeRef}
403
+ aria-label={column.label}
404
+ className={cn(
405
+ 'flex min-w-[200px] max-w-[360px] flex-1 flex-col rounded-lg',
406
+ isOver && 'bg-accent-subtle',
407
+ )}
408
+ >
409
+ <header className="flex shrink-0 items-baseline gap-2 px-1 pb-3 pt-1" title={column.hint}>
410
+ <h2 className="text-heading font-medium text-text-primary">{column.label}</h2>
411
+ <span className="text-caption tabular-nums text-text-tertiary">{cards.length}</span>
412
+ {(column.id === 'invalid' || column.id === 'duplicate') && (
413
+ <button
414
+ type="button"
415
+ onClick={onToggle}
416
+ className="ml-auto rounded px-1 text-caption text-text-tertiary hover:text-text-primary"
417
+ >
418
+ Hide
419
+ </button>
420
+ )}
421
+ </header>
422
+ <div className="min-h-0 flex-1 space-y-2 overflow-y-auto pb-6">
423
+ {cards.map((c) => (
424
+ <Card key={c.id} card={c} selected={c.id === selectedId} onSelect={onSelect} />
425
+ ))}
426
+ {cards.length === 0 && (
427
+ <div className="rounded-lg border border-dashed border-border-subtle px-3 py-6 text-center text-caption text-text-tertiary">
428
+ {column.hint}
429
+ </div>
430
+ )}
431
+ </div>
432
+ </section>
433
+ );
434
+ }
435
+
436
+ function Card({
437
+ card,
438
+ selected,
439
+ onSelect,
440
+ }: {
441
+ card: BoardIssue;
442
+ selected: boolean;
443
+ onSelect: (id: string) => void;
444
+ }) {
445
+ const locked = card.column === 'synced';
446
+ const { attributes, listeners, setNodeRef, transform, isDragging } = useDraggable({
447
+ id: card.id,
448
+ disabled: locked,
449
+ });
450
+ const style: React.CSSProperties = transform
451
+ ? { transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`, zIndex: 40 }
452
+ : {};
453
+ return (
454
+ <article
455
+ ref={setNodeRef}
456
+ data-card={card.id}
457
+ style={style}
458
+ {...(locked ? {} : attributes)}
459
+ {...(locked ? {} : listeners)}
460
+ onClick={() => !transform && onSelect(card.id)}
461
+ className={cn(
462
+ 'cursor-pointer select-none rounded-lg border bg-surface-1 px-3 py-2.5',
463
+ selected ? 'border-accent' : 'border-border-subtle hover:border-border-default',
464
+ isDragging && 'shadow-lg',
465
+ )}
466
+ >
467
+ <h3 className="line-clamp-3 text-body text-text-primary">{card.title}</h3>
468
+ <div className="mt-2 flex items-center gap-2 text-caption text-text-tertiary">
469
+ <SeverityDot severity={card.severity} className="text-text-secondary" />
470
+ <span className="min-w-0 truncate">
471
+ {card.id} · {SOURCE_LABEL[card.source] ?? card.source}
472
+ </span>
473
+ <span className="ml-auto">{statusChip(card)}</span>
474
+ </div>
475
+ </article>
476
+ );
477
+ }
478
+
479
+ // ─── Inspector ──────────────────────────────────────────────────────
480
+
481
+ function CardInspector({
482
+ card,
483
+ editing,
484
+ setEditing,
485
+ formatCtx,
486
+ onClose,
487
+ onReverted,
488
+ }: {
489
+ card: BoardIssue;
490
+ editing: boolean;
491
+ setEditing: (v: boolean) => void;
492
+ formatCtx: FormatContext;
493
+ onClose: () => void;
494
+ onReverted: () => void;
495
+ }) {
496
+ const router = useRouter();
497
+ const toast = useToast();
498
+ const locked = card.column === 'synced';
499
+ const v = card.validation;
500
+
501
+ const revert = async () => {
502
+ try {
503
+ await sendJson(`/api/issues/${encodeURIComponent(card.id)}/revert-auto`, {});
504
+ onReverted();
505
+ toast({ message: `${card.id} is back in Potential` });
506
+ router.refresh();
507
+ } catch (err) {
508
+ toast({ message: (err as Error).message, tone: 'error' });
509
+ }
510
+ };
511
+
512
+ const copy = async () => {
513
+ try {
514
+ await navigator.clipboard.writeText(findingToHackmd(card, formatCtx));
515
+ toast({ message: 'Copied as HackMD' });
516
+ } catch {
517
+ toast({ message: 'Clipboard is not available here', tone: 'error' });
518
+ }
519
+ };
520
+
521
+ if (editing) return <CardEditor card={card} onDone={() => setEditing(false)} onClose={onClose} />;
522
+
523
+ return (
524
+ <Inspector
525
+ eyebrow={`${card.id} · ${SOURCE_LABEL[card.source] ?? card.source} · ${COLUMN_LABEL[card.column]}`}
526
+ title={card.title}
527
+ subtitle={<SeverityDot severity={card.severity} className="text-text-secondary" />}
528
+ onClose={onClose}
529
+ actions={
530
+ <>
531
+ <Button
532
+ onClick={() => setEditing(true)}
533
+ disabled={locked}
534
+ title={locked ? 'Synced to GitHub: edit it there' : undefined}
535
+ >
536
+ Edit <Kbd>e</Kbd>
537
+ </Button>
538
+ <Button variant="ghost" onClick={copy}>
539
+ Copy as HackMD
540
+ </Button>
541
+ {card.github_issue_url && (
542
+ <a
543
+ href={card.github_issue_url}
544
+ target="_blank"
545
+ rel="noreferrer"
546
+ className="inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-body text-text-secondary hover:bg-surface-2 hover:text-text-primary"
547
+ >
548
+ #{card.github_issue_number} <IconExternal className="h-3.5 w-3.5" />
549
+ </a>
550
+ )}
551
+ </>
552
+ }
553
+ >
554
+ {v?.auto_moved_to && (
555
+ <div className="mb-4 rounded-lg bg-surface-2 px-3 py-2.5">
556
+ <p className="text-body text-text-primary">
557
+ An agent moved this card to {v.auto_moved_to === 'verified' ? 'Verified' : 'Rejected'}
558
+ {v.auto_moved_to === 'verified' && v.poc_status === 'passing'
559
+ ? ' after its PoC passed'
560
+ : ''}
561
+ {v.auto_moved_to === 'rejected' && v.refuters
562
+ ? ` after ${v.refuters} refuters agreed`
563
+ : ''}
564
+ .
565
+ </p>
566
+ <Button size="sm" variant="secondary" onClick={revert} className="mt-2">
567
+ Revert to Potential
568
+ </Button>
569
+ </div>
570
+ )}
571
+
572
+ {v && (
573
+ <InspectorSection label="Validation">
574
+ {v.verdict && (
575
+ <InspectorField label="Verdict">{VERDICT[v.verdict] ?? v.verdict}</InspectorField>
576
+ )}
577
+ {v.validated_by && (
578
+ <InspectorField label="By">
579
+ {v.validated_by === 'agent' ? 'An agent' : 'The auditor'}
580
+ </InspectorField>
581
+ )}
582
+ {(v.poc_file || card.poc_file) && (
583
+ <InspectorField label="PoC">
584
+ <span className="font-mono text-caption">{v.poc_file ?? card.poc_file}</span>
585
+ {(v.poc_status ?? card.poc_status) && (
586
+ <span className="ml-2 text-caption text-text-tertiary">
587
+ {(v.poc_status ?? card.poc_status)?.replace('_', ' ')}
588
+ </span>
589
+ )}
590
+ </InspectorField>
591
+ )}
592
+ {v.memo && (
593
+ <InspectorField label="Memo">
594
+ <span className="font-mono text-caption">{v.memo}</span>
595
+ </InspectorField>
596
+ )}
597
+ {v.reverted_at && (
598
+ <InspectorField label="Reverted">
599
+ <LocalTime iso={v.reverted_at} />
600
+ </InspectorField>
601
+ )}
602
+ </InspectorSection>
603
+ )}
604
+
605
+ {card.description && (
606
+ <InspectorSection label="Description">
607
+ <MarkdownRenderer content={card.description} />
608
+ </InspectorSection>
609
+ )}
610
+ {card.recommendation && (
611
+ <InspectorSection label="Recommendation">
612
+ <MarkdownRenderer content={card.recommendation} />
613
+ </InspectorSection>
614
+ )}
615
+ {(card.resolution || card.update_from_client) && (
616
+ <InspectorSection label="Client response">
617
+ {card.resolution && <InspectorField label="Status">{card.resolution}</InspectorField>}
618
+ {card.update_from_client && (
619
+ <p className="mt-1 text-body text-text-secondary">{card.update_from_client}</p>
620
+ )}
621
+ </InspectorSection>
622
+ )}
623
+
624
+ {(card.functions.length > 0 || card.code_locations.length > 0) && (
625
+ <InspectorSection label="Code">
626
+ {card.functions.map((fn) => (
627
+ <Link
628
+ key={fn}
629
+ href={`/review?fn=${encodeURIComponent(fn)}`}
630
+ className="-mx-1.5 flex items-center justify-between gap-2 rounded-md px-1.5 py-1 text-body text-text-primary hover:bg-surface-2"
631
+ >
632
+ <span className="truncate">{fn.split('(')[0]}</span>
633
+ <span className="shrink-0 text-caption text-text-tertiary">Review</span>
634
+ </Link>
635
+ ))}
636
+ {card.functions.length === 0 &&
637
+ Array.from(new Set(card.code_locations.map((l) => l.file))).map((f) => (
638
+ <p key={f} className="truncate font-mono text-caption text-text-secondary">
639
+ {f}
640
+ </p>
641
+ ))}
642
+ </InspectorSection>
643
+ )}
644
+
645
+ {(card.duplicate_of || card.match_signals) && (
646
+ <InspectorSection label="Duplicate">
647
+ {card.duplicate_of && <InspectorField label="Of">{card.duplicate_of}</InspectorField>}
648
+ {card.match_signals && (
649
+ <p className="mt-1 text-caption text-text-secondary">
650
+ Contract {card.match_signals.contract ? 'matches' : 'differs'} · function{' '}
651
+ {card.match_signals.function ? 'matches' : 'differs'} · root cause{' '}
652
+ {card.match_signals.root_cause} · attack vector {card.match_signals.attack_vector}
653
+ </p>
654
+ )}
655
+ {card.reasoning && <p className="mt-1 text-body text-text-secondary">{card.reasoning}</p>}
656
+ </InspectorSection>
657
+ )}
658
+
659
+ {locked && (
660
+ <p className="mt-2 text-caption text-text-tertiary">
661
+ Synced to GitHub and read-only here. Edit it on GitHub, then run{' '}
662
+ <code className="font-mono">/sync-issues</code>.
663
+ </p>
664
+ )}
665
+ </Inspector>
666
+ );
667
+ }
668
+
669
+ function CardEditor({
670
+ card,
671
+ onDone,
672
+ onClose,
673
+ }: {
674
+ card: BoardIssue;
675
+ onDone: () => void;
676
+ onClose: () => void;
677
+ }) {
678
+ const router = useRouter();
679
+ const toast = useToast();
680
+ const [f, setF] = useState({
681
+ title: card.title,
682
+ severity: card.severity as string,
683
+ resolution: card.resolution ?? '',
684
+ description: card.description,
685
+ recommendation: card.recommendation,
686
+ update_from_client: card.update_from_client ?? '',
687
+ });
688
+ const [saving, setSaving] = useState(false);
689
+ const titleRef = useRef<HTMLInputElement>(null);
690
+ useEffect(() => titleRef.current?.focus(), []);
691
+
692
+ const save = async () => {
693
+ setSaving(true);
694
+ try {
695
+ await sendJson(
696
+ `/api/issues/${encodeURIComponent(card.id)}`,
697
+ {
698
+ ...f,
699
+ resolution: f.resolution || undefined,
700
+ update_from_client: f.update_from_client || undefined,
701
+ },
702
+ 'PATCH',
703
+ );
704
+ toast({ message: `${card.id} saved` });
705
+ router.refresh();
706
+ onDone();
707
+ } catch (err) {
708
+ toast({ message: (err as Error).message, tone: 'error' });
709
+ } finally {
710
+ setSaving(false);
711
+ }
712
+ };
713
+
714
+ const field =
715
+ 'w-full rounded-md border border-border-subtle bg-surface-0 px-2.5 py-1.5 text-body text-text-primary focus:border-border-emphasis focus:outline-none';
716
+
717
+ return (
718
+ <Inspector
719
+ eyebrow={`Editing ${card.id}`}
720
+ title={f.title || card.id}
721
+ onClose={onClose}
722
+ actions={
723
+ <>
724
+ <Button variant="primary" onClick={save} disabled={saving}>
725
+ {saving ? 'Saving…' : 'Save'}
726
+ </Button>
727
+ <Button variant="ghost" onClick={onDone}>
728
+ Cancel
729
+ </Button>
730
+ </>
731
+ }
732
+ >
733
+ <form
734
+ className="space-y-4 border-t border-border-subtle pt-4"
735
+ onSubmit={(e) => {
736
+ e.preventDefault();
737
+ void save();
738
+ }}
739
+ onKeyDown={(e) => {
740
+ if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) void save();
741
+ if (e.key === 'Escape') onDone();
742
+ }}
743
+ >
744
+ <Label text="Title">
745
+ <input
746
+ ref={titleRef}
747
+ className={field}
748
+ value={f.title}
749
+ onChange={(e) => setF({ ...f, title: e.target.value })}
750
+ />
751
+ </Label>
752
+ <div className="grid grid-cols-2 gap-3">
753
+ <Label text="Severity">
754
+ <select
755
+ className={field}
756
+ value={f.severity}
757
+ onChange={(e) => setF({ ...f, severity: e.target.value })}
758
+ >
759
+ {SEVERITIES.map((s) => (
760
+ <option key={s}>{s}</option>
761
+ ))}
762
+ </select>
763
+ </Label>
764
+ <Label text="Resolution">
765
+ <select
766
+ className={field}
767
+ value={f.resolution}
768
+ onChange={(e) => setF({ ...f, resolution: e.target.value })}
769
+ >
770
+ <option value="">None</option>
771
+ {RESOLUTIONS.map((r) => (
772
+ <option key={r}>{r}</option>
773
+ ))}
774
+ </select>
775
+ </Label>
776
+ </div>
777
+ <Label text="Description">
778
+ <textarea
779
+ className={cn(field, 'leading-6')}
780
+ rows={10}
781
+ value={f.description}
782
+ onChange={(e) => setF({ ...f, description: e.target.value })}
783
+ />
784
+ </Label>
785
+ <Label text="Recommendation">
786
+ <textarea
787
+ className={cn(field, 'leading-6')}
788
+ rows={4}
789
+ value={f.recommendation}
790
+ onChange={(e) => setF({ ...f, recommendation: e.target.value })}
791
+ />
792
+ </Label>
793
+ <Label text="Update from the client">
794
+ <textarea
795
+ className={field}
796
+ rows={3}
797
+ value={f.update_from_client}
798
+ placeholder="Used by /generate-report"
799
+ onChange={(e) => setF({ ...f, update_from_client: e.target.value })}
800
+ />
801
+ </Label>
802
+ <p className="text-caption text-text-tertiary">
803
+ <Kbd>⌘</Kbd> <Kbd>↵</Kbd> to save · <Kbd>esc</Kbd> to cancel
804
+ </p>
805
+ </form>
806
+ </Inspector>
807
+ );
808
+ }
809
+
810
+ function Label({ text, children }: { text: string; children: React.ReactNode }) {
811
+ return (
812
+ <label className="block">
813
+ <span className="mb-1 block text-caption text-text-tertiary">{text}</span>
814
+ {children}
815
+ </label>
816
+ );
817
+ }