codebase-onboarder 0.6.0 → 1.0.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 (526) hide show
  1. package/README.md +284 -53
  2. package/bin/build-if-source.js +23 -0
  3. package/bin/onboarder.js +0 -0
  4. package/cli/agent/command.d.ts +71 -0
  5. package/cli/agent/command.js +177 -0
  6. package/cli/agent/command.js.map +1 -0
  7. package/cli/agent/config.d.ts +31 -0
  8. package/cli/agent/config.js +98 -0
  9. package/cli/agent/config.js.map +1 -0
  10. package/cli/agent/contracts.d.ts +77 -0
  11. package/cli/agent/contracts.js +2 -0
  12. package/cli/agent/contracts.js.map +1 -0
  13. package/cli/agent/files.d.ts +19 -0
  14. package/cli/agent/files.js +109 -0
  15. package/cli/agent/files.js.map +1 -0
  16. package/cli/agent/gitSource.d.ts +18 -0
  17. package/cli/agent/gitSource.js +69 -0
  18. package/cli/agent/gitSource.js.map +1 -0
  19. package/cli/agent/github.d.ts +21 -0
  20. package/cli/agent/github.js +94 -0
  21. package/cli/agent/github.js.map +1 -0
  22. package/cli/agent/mcp.d.ts +15 -0
  23. package/cli/agent/mcp.js +78 -0
  24. package/cli/agent/mcp.js.map +1 -0
  25. package/cli/agent/process.d.ts +18 -0
  26. package/cli/agent/process.js +118 -0
  27. package/cli/agent/process.js.map +1 -0
  28. package/cli/agent/protocol.d.ts +3 -0
  29. package/cli/agent/protocol.js +26 -0
  30. package/cli/agent/protocol.js.map +1 -0
  31. package/cli/agent/runner.d.ts +34 -0
  32. package/cli/agent/runner.js +152 -0
  33. package/cli/agent/runner.js.map +1 -0
  34. package/cli/agent/stdio.d.ts +1 -0
  35. package/cli/agent/stdio.js +62 -0
  36. package/cli/agent/stdio.js.map +1 -0
  37. package/cli/agent/tools.d.ts +7 -0
  38. package/cli/agent/tools.js +201 -0
  39. package/cli/agent/tools.js.map +1 -0
  40. package/cli/chat/app.d.ts +16 -0
  41. package/cli/chat/app.js +345 -0
  42. package/cli/chat/app.js.map +1 -0
  43. package/cli/chat/commands.d.ts +11 -0
  44. package/cli/chat/commands.js +120 -0
  45. package/cli/chat/commands.js.map +1 -0
  46. package/cli/chat/composer.d.ts +75 -0
  47. package/cli/chat/composer.js +467 -0
  48. package/cli/chat/composer.js.map +1 -0
  49. package/cli/chat/controller.d.ts +60 -0
  50. package/cli/chat/controller.js +393 -0
  51. package/cli/chat/controller.js.map +1 -0
  52. package/cli/chat/logo.d.ts +3 -0
  53. package/cli/chat/logo.js +14 -0
  54. package/cli/chat/logo.js.map +1 -0
  55. package/cli/chat/models.d.ts +18 -0
  56. package/cli/chat/models.js +88 -0
  57. package/cli/chat/models.js.map +1 -0
  58. package/cli/chat/profile.d.ts +5 -0
  59. package/cli/chat/profile.js +98 -0
  60. package/cli/chat/profile.js.map +1 -0
  61. package/cli/chat/render.d.ts +40 -0
  62. package/cli/chat/render.js +259 -0
  63. package/cli/chat/render.js.map +1 -0
  64. package/cli/chat/screen.d.ts +26 -0
  65. package/cli/chat/screen.js +117 -0
  66. package/cli/chat/screen.js.map +1 -0
  67. package/cli/chat/source.d.ts +29 -0
  68. package/cli/chat/source.js +116 -0
  69. package/cli/chat/source.js.map +1 -0
  70. package/cli/chat/store.d.ts +43 -0
  71. package/cli/chat/store.js +94 -0
  72. package/cli/chat/store.js.map +1 -0
  73. package/cli/chat/text.d.ts +4 -0
  74. package/cli/chat/text.js +27 -0
  75. package/cli/chat/text.js.map +1 -0
  76. package/cli/commands.d.ts +26 -0
  77. package/cli/commands.js +836 -811
  78. package/cli/commands.js.map +1 -0
  79. package/cli/explorer/advanced.d.ts +14 -0
  80. package/cli/explorer/advanced.js +321 -329
  81. package/cli/explorer/advanced.js.map +1 -0
  82. package/cli/explorer/app.d.ts +2 -0
  83. package/cli/explorer/app.js +404 -314
  84. package/cli/explorer/app.js.map +1 -0
  85. package/cli/explorer/assistant.d.ts +9 -0
  86. package/cli/explorer/assistant.js +58 -0
  87. package/cli/explorer/assistant.js.map +1 -0
  88. package/cli/explorer/commands.d.ts +17 -0
  89. package/cli/explorer/commands.js +373 -302
  90. package/cli/explorer/commands.js.map +1 -0
  91. package/cli/explorer/featureViews.d.ts +124 -0
  92. package/cli/explorer/featureViews.js +179 -0
  93. package/cli/explorer/featureViews.js.map +1 -0
  94. package/cli/explorer/github.d.ts +21 -0
  95. package/cli/explorer/github.js +42 -44
  96. package/cli/explorer/github.js.map +1 -0
  97. package/cli/explorer/graphs.d.ts +7 -0
  98. package/cli/explorer/graphs.js +90 -95
  99. package/cli/explorer/graphs.js.map +1 -0
  100. package/cli/explorer/picker.d.ts +22 -0
  101. package/cli/explorer/picker.js +150 -0
  102. package/cli/explorer/picker.js.map +1 -0
  103. package/cli/explorer/report.d.ts +85 -0
  104. package/cli/explorer/report.js +60 -0
  105. package/cli/explorer/report.js.map +1 -0
  106. package/cli/explorer/session.d.ts +449 -0
  107. package/cli/explorer/session.js +143 -144
  108. package/cli/explorer/session.js.map +1 -0
  109. package/cli/explorer/views.d.ts +19 -0
  110. package/cli/explorer/views.js +465 -482
  111. package/cli/explorer/views.js.map +1 -0
  112. package/cli/explorer/wrap.d.ts +1 -0
  113. package/cli/explorer/wrap.js +28 -44
  114. package/cli/explorer/wrap.js.map +1 -0
  115. package/cli/main.d.ts +1 -0
  116. package/cli/main.js +251 -164
  117. package/cli/main.js.map +1 -0
  118. package/cli/prompt.d.ts +5 -0
  119. package/cli/prompt.js +84 -80
  120. package/cli/prompt.js.map +1 -0
  121. package/cli/scanOptions.d.ts +2 -0
  122. package/cli/scanOptions.js +11 -0
  123. package/cli/scanOptions.js.map +1 -0
  124. package/cli/ui.d.ts +33 -0
  125. package/cli/ui.js +35 -44
  126. package/cli/ui.js.map +1 -0
  127. package/cli/wizard.d.ts +187 -0
  128. package/cli/wizard.js +304 -284
  129. package/cli/wizard.js.map +1 -0
  130. package/docs/HERMES_RESEARCH.md +51 -0
  131. package/package.json +16 -4
  132. package/public/app.d.ts +1 -0
  133. package/public/app.js +1133 -1011
  134. package/public/app.js.map +1 -0
  135. package/public/assets/onboarder-mark.svg +11 -0
  136. package/public/browser.d.ts +71 -0
  137. package/public/browser.js +2 -0
  138. package/public/browser.js.map +1 -0
  139. package/public/index.html +54 -20
  140. package/public/js/about.d.ts +6 -0
  141. package/public/js/about.js +152 -172
  142. package/public/js/about.js.map +1 -0
  143. package/public/js/aiDraft.d.ts +4 -0
  144. package/public/js/aiDraft.js +166 -125
  145. package/public/js/aiDraft.js.map +1 -0
  146. package/public/js/analysisPanel.d.ts +7 -0
  147. package/public/js/analysisPanel.js +166 -166
  148. package/public/js/analysisPanel.js.map +1 -0
  149. package/public/js/analysisReport.d.ts +38 -0
  150. package/public/js/analysisReport.js +105 -110
  151. package/public/js/analysisReport.js.map +1 -0
  152. package/public/js/api.d.ts +29 -0
  153. package/public/js/api.js +198 -166
  154. package/public/js/api.js.map +1 -0
  155. package/public/js/atlas.d.ts +6 -0
  156. package/public/js/atlas.js +50 -58
  157. package/public/js/atlas.js.map +1 -0
  158. package/public/js/blameView.d.ts +2 -0
  159. package/public/js/blameView.js +36 -37
  160. package/public/js/blameView.js.map +1 -0
  161. package/public/js/codeTab.d.ts +3 -0
  162. package/public/js/codeTab.js +175 -180
  163. package/public/js/codeTab.js.map +1 -0
  164. package/public/js/codeViewer.d.ts +5 -0
  165. package/public/js/codeViewer.js +162 -150
  166. package/public/js/codeViewer.js.map +1 -0
  167. package/public/js/components/FileChip.d.ts +9 -0
  168. package/public/js/components/FileChip.js +45 -49
  169. package/public/js/components/FileChip.js.map +1 -0
  170. package/public/js/components/MetricSparkline.d.ts +7 -0
  171. package/public/js/components/MetricSparkline.js +35 -44
  172. package/public/js/components/MetricSparkline.js.map +1 -0
  173. package/public/js/components/RiskBadge.d.ts +9 -0
  174. package/public/js/components/RiskBadge.js +55 -63
  175. package/public/js/components/RiskBadge.js.map +1 -0
  176. package/public/js/deepAnalysisView.d.ts +99 -0
  177. package/public/js/deepAnalysisView.js +282 -302
  178. package/public/js/deepAnalysisView.js.map +1 -0
  179. package/public/js/diagramPane.d.ts +9 -0
  180. package/public/js/diagramPane.js +138 -135
  181. package/public/js/diagramPane.js.map +1 -0
  182. package/public/js/diffView.d.ts +6 -0
  183. package/public/js/diffView.js +222 -209
  184. package/public/js/diffView.js.map +1 -0
  185. package/public/js/docsView.d.ts +2 -0
  186. package/public/js/docsView.js +441 -442
  187. package/public/js/docsView.js.map +1 -0
  188. package/public/js/dom.d.ts +197 -0
  189. package/public/js/dom.js +5 -0
  190. package/public/js/dom.js.map +1 -0
  191. package/public/js/fileSourceBrowser.d.ts +5 -0
  192. package/public/js/fileSourceBrowser.js +33 -41
  193. package/public/js/fileSourceBrowser.js.map +1 -0
  194. package/public/js/flameGraph.d.ts +5 -0
  195. package/public/js/flameGraph.js +62 -72
  196. package/public/js/flameGraph.js.map +1 -0
  197. package/public/js/forceGraph.d.ts +10 -0
  198. package/public/js/forceGraph.js +581 -556
  199. package/public/js/forceGraph.js.map +1 -0
  200. package/public/js/heatmap.d.ts +4 -0
  201. package/public/js/heatmap.js +142 -164
  202. package/public/js/heatmap.js.map +1 -0
  203. package/public/js/highlight.d.ts +2 -0
  204. package/public/js/highlight.js +116 -107
  205. package/public/js/highlight.js.map +1 -0
  206. package/public/js/html.d.ts +2 -0
  207. package/public/js/html.js +14 -44
  208. package/public/js/html.js.map +1 -0
  209. package/public/js/insightsView.d.ts +5 -0
  210. package/public/js/insightsView.js +93 -111
  211. package/public/js/insightsView.js.map +1 -0
  212. package/public/js/inspector.d.ts +37 -0
  213. package/public/js/inspector.js +416 -445
  214. package/public/js/inspector.js.map +1 -0
  215. package/public/js/llm.d.ts +115 -0
  216. package/public/js/llm.js +246 -278
  217. package/public/js/llm.js.map +1 -0
  218. package/public/js/mapView.d.ts +3 -0
  219. package/public/js/mapView.js +121 -120
  220. package/public/js/mapView.js.map +1 -0
  221. package/public/js/markdown.d.ts +3 -0
  222. package/public/js/markdown.js +84 -91
  223. package/public/js/markdown.js.map +1 -0
  224. package/public/js/mindmap.d.ts +32 -0
  225. package/public/js/mindmap.js +244 -259
  226. package/public/js/mindmap.js.map +1 -0
  227. package/public/js/mobilePanels.d.ts +5 -0
  228. package/public/js/mobilePanels.js +50 -0
  229. package/public/js/mobilePanels.js.map +1 -0
  230. package/public/js/repoFiles.d.ts +12 -0
  231. package/public/js/repoFiles.js +29 -28
  232. package/public/js/repoFiles.js.map +1 -0
  233. package/public/js/reviewView.d.ts +28 -0
  234. package/public/js/reviewView.js +256 -0
  235. package/public/js/reviewView.js.map +1 -0
  236. package/public/js/sbomView.d.ts +3 -0
  237. package/public/js/sbomView.js +59 -67
  238. package/public/js/sbomView.js.map +1 -0
  239. package/public/js/scanCache.d.ts +16 -0
  240. package/public/js/scanCache.js +67 -65
  241. package/public/js/scanCache.js.map +1 -0
  242. package/public/js/search.d.ts +7 -0
  243. package/public/js/search.js +868 -800
  244. package/public/js/search.js.map +1 -0
  245. package/public/js/searchLocal.d.ts +42 -0
  246. package/public/js/searchLocal.js +87 -0
  247. package/public/js/searchLocal.js.map +1 -0
  248. package/public/js/serverSettings.d.ts +5 -0
  249. package/public/js/serverSettings.js +153 -164
  250. package/public/js/serverSettings.js.map +1 -0
  251. package/public/js/state.d.ts +798 -0
  252. package/public/js/state.js +114 -122
  253. package/public/js/state.js.map +1 -0
  254. package/public/js/tour.d.ts +6 -0
  255. package/public/js/tour.js +5 -7
  256. package/public/js/tour.js.map +1 -0
  257. package/public/js/transitions.d.ts +2 -0
  258. package/public/js/transitions.js +9 -10
  259. package/public/js/transitions.js.map +1 -0
  260. package/public/js/tree.d.ts +12 -0
  261. package/public/js/tree.js +157 -154
  262. package/public/js/tree.js.map +1 -0
  263. package/public/js/workflowsView.d.ts +3 -0
  264. package/public/js/workflowsView.js +15 -22
  265. package/public/js/workflowsView.js.map +1 -0
  266. package/public/search.css +495 -0
  267. package/public/styles.css +188 -346
  268. package/public/workbench.css +166 -0
  269. package/server/apiAuth.d.ts +3 -0
  270. package/server/apiAuth.js +18 -20
  271. package/server/apiAuth.js.map +1 -0
  272. package/server/apiDiff.d.ts +2 -0
  273. package/server/apiDiff.js +20 -18
  274. package/server/apiDiff.js.map +1 -0
  275. package/server/apiDocs.d.ts +2 -0
  276. package/server/apiDocs.js +38 -40
  277. package/server/apiDocs.js.map +1 -0
  278. package/server/apiFile.d.ts +1 -0
  279. package/server/apiFile.js +14 -17
  280. package/server/apiFile.js.map +1 -0
  281. package/server/apiGitBlame.d.ts +2 -0
  282. package/server/apiGitBlame.js +50 -51
  283. package/server/apiGitBlame.js.map +1 -0
  284. package/server/apiMcp.d.ts +4 -0
  285. package/server/apiMcp.js +64 -66
  286. package/server/apiMcp.js.map +1 -0
  287. package/server/apiReview.d.ts +2 -0
  288. package/server/apiReview.js +45 -0
  289. package/server/apiReview.js.map +1 -0
  290. package/server/apiScan.d.ts +5 -0
  291. package/server/apiScan.js +90 -71
  292. package/server/apiScan.js.map +1 -0
  293. package/server/apiSearch.d.ts +33 -0
  294. package/server/apiSearch.js +184 -200
  295. package/server/apiSearch.js.map +1 -0
  296. package/server/apiSettings.d.ts +4 -0
  297. package/server/apiSettings.js +84 -85
  298. package/server/apiSettings.js.map +1 -0
  299. package/server/apiTools.d.ts +3 -0
  300. package/server/apiTools.js +55 -56
  301. package/server/apiTools.js.map +1 -0
  302. package/server/auth.d.ts +5 -0
  303. package/server/auth.js +54 -51
  304. package/server/auth.js.map +1 -0
  305. package/server/config.d.ts +42 -0
  306. package/server/config.js +189 -194
  307. package/server/config.js.map +1 -0
  308. package/server/daemon.d.ts +12 -0
  309. package/server/daemon.js +124 -114
  310. package/server/daemon.js.map +1 -0
  311. package/server/fileSourceNode.d.ts +2 -0
  312. package/server/fileSourceNode.js +34 -36
  313. package/server/fileSourceNode.js.map +1 -0
  314. package/server/gitClone.d.ts +9 -0
  315. package/server/gitClone.js +59 -61
  316. package/server/gitClone.js.map +1 -0
  317. package/server/gitDiff.d.ts +36 -0
  318. package/server/gitDiff.js +271 -169
  319. package/server/gitDiff.js.map +1 -0
  320. package/server/gitHistory.d.ts +12 -0
  321. package/server/gitHistory.js +80 -80
  322. package/server/gitHistory.js.map +1 -0
  323. package/server/gitRemote.d.ts +12 -0
  324. package/server/gitRemote.js +37 -38
  325. package/server/gitRemote.js.map +1 -0
  326. package/server/hermesChat.d.ts +13 -0
  327. package/server/hermesChat.js +145 -0
  328. package/server/hermesChat.js.map +1 -0
  329. package/server/htmlText.d.ts +4 -0
  330. package/server/htmlText.js +16 -23
  331. package/server/htmlText.js.map +1 -0
  332. package/server/http.d.ts +6 -0
  333. package/server/http.js +27 -34
  334. package/server/http.js.map +1 -0
  335. package/server/httpGuards.d.ts +2 -0
  336. package/server/httpGuards.js +47 -43
  337. package/server/httpGuards.js.map +1 -0
  338. package/server/https.d.ts +34 -0
  339. package/server/https.js +121 -111
  340. package/server/https.js.map +1 -0
  341. package/server/index.d.ts +40 -0
  342. package/server/index.js +139 -147
  343. package/server/index.js.map +1 -0
  344. package/server/layout.d.ts +26 -0
  345. package/server/layout.js +59 -64
  346. package/server/layout.js.map +1 -0
  347. package/server/llmProxy.d.ts +3 -0
  348. package/server/llmProxy.js +137 -135
  349. package/server/llmProxy.js.map +1 -0
  350. package/server/logger.d.ts +38 -0
  351. package/server/logger.js +198 -211
  352. package/server/logger.js.map +1 -0
  353. package/server/mcp/analysis.d.ts +29 -0
  354. package/server/mcp/analysis.js +99 -120
  355. package/server/mcp/analysis.js.map +1 -0
  356. package/server/mcp/http.d.ts +9 -0
  357. package/server/mcp/http.js +128 -137
  358. package/server/mcp/http.js.map +1 -0
  359. package/server/mcp/runner.d.ts +68 -0
  360. package/server/mcp/runner.js +208 -218
  361. package/server/mcp/runner.js.map +1 -0
  362. package/server/mcp/server.d.ts +29 -0
  363. package/server/mcp/server.js +167 -180
  364. package/server/mcp/server.js.map +1 -0
  365. package/server/mcp/standalone.d.ts +1 -0
  366. package/server/mcp/standalone.js +8 -10
  367. package/server/mcp/standalone.js.map +1 -0
  368. package/server/mcp/tools.d.ts +2020 -0
  369. package/server/mcp/tools.js +523 -574
  370. package/server/mcp/tools.js.map +1 -0
  371. package/server/paths.d.ts +3 -0
  372. package/server/paths.js +17 -15
  373. package/server/paths.js.map +1 -0
  374. package/server/pidfile.d.ts +9 -0
  375. package/server/pidfile.js +43 -45
  376. package/server/pidfile.js.map +1 -0
  377. package/server/review.d.ts +5 -0
  378. package/server/review.js +35 -0
  379. package/server/review.js.map +1 -0
  380. package/server/router.d.ts +33 -0
  381. package/server/router.js +195 -197
  382. package/server/router.js.map +1 -0
  383. package/server/scanRequest.d.ts +3 -0
  384. package/server/scanRequest.js +36 -0
  385. package/server/scanRequest.js.map +1 -0
  386. package/server/searchIndex.d.ts +17 -0
  387. package/server/searchIndex.js +83 -80
  388. package/server/searchIndex.js.map +1 -0
  389. package/server/sessions.d.ts +14 -0
  390. package/server/sessions.js +62 -70
  391. package/server/sessions.js.map +1 -0
  392. package/server/startup.d.ts +118 -0
  393. package/server/startup.js +143 -148
  394. package/server/startup.js.map +1 -0
  395. package/server/static.d.ts +6 -0
  396. package/server/static.js +28 -31
  397. package/server/static.js.map +1 -0
  398. package/server/tools/install.d.ts +4 -0
  399. package/server/tools/install.js +176 -185
  400. package/server/tools/install.js.map +1 -0
  401. package/server/tools/parse.d.ts +8 -0
  402. package/server/tools/parse.js +112 -114
  403. package/server/tools/parse.js.map +1 -0
  404. package/server/tools/platform.d.ts +9 -0
  405. package/server/tools/platform.js +49 -47
  406. package/server/tools/platform.js.map +1 -0
  407. package/server/tools/registry.d.ts +137 -0
  408. package/server/tools/registry.js +173 -172
  409. package/server/tools/registry.js.map +1 -0
  410. package/server/tools/scan.d.ts +34 -0
  411. package/server/tools/scan.js +89 -98
  412. package/server/tools/scan.js.map +1 -0
  413. package/server/tools.d.ts +34 -0
  414. package/server/tools.js +94 -107
  415. package/server/tools.js.map +1 -0
  416. package/server/tunnel.d.ts +29 -0
  417. package/server/tunnel.js +61 -66
  418. package/server/tunnel.js.map +1 -0
  419. package/shared/analyzer/docs.d.ts +16 -0
  420. package/shared/analyzer/docs.js +99 -93
  421. package/shared/analyzer/docs.js.map +1 -0
  422. package/shared/analyzer/explainLocal.d.ts +4 -0
  423. package/shared/analyzer/explainLocal.js +122 -142
  424. package/shared/analyzer/explainLocal.js.map +1 -0
  425. package/shared/analyzer/github.d.ts +37 -0
  426. package/shared/analyzer/github.js +41 -43
  427. package/shared/analyzer/github.js.map +1 -0
  428. package/shared/analyzer/graph.d.ts +41 -0
  429. package/shared/analyzer/graph.js +393 -400
  430. package/shared/analyzer/graph.js.map +1 -0
  431. package/shared/analyzer/health.d.ts +33 -0
  432. package/shared/analyzer/health.js +197 -193
  433. package/shared/analyzer/health.js.map +1 -0
  434. package/shared/analyzer/history.d.ts +29 -0
  435. package/shared/analyzer/history.js +110 -111
  436. package/shared/analyzer/history.js.map +1 -0
  437. package/shared/analyzer/jsonConfig.d.ts +2 -0
  438. package/shared/analyzer/jsonConfig.js +61 -0
  439. package/shared/analyzer/jsonConfig.js.map +1 -0
  440. package/shared/analyzer/languages/csharp.d.ts +26 -0
  441. package/shared/analyzer/languages/csharp.js +83 -88
  442. package/shared/analyzer/languages/csharp.js.map +1 -0
  443. package/shared/analyzer/languages/generic.d.ts +23 -0
  444. package/shared/analyzer/languages/generic.js +94 -105
  445. package/shared/analyzer/languages/generic.js.map +1 -0
  446. package/shared/analyzer/languages/go.d.ts +24 -0
  447. package/shared/analyzer/languages/go.js +45 -54
  448. package/shared/analyzer/languages/go.js.map +1 -0
  449. package/shared/analyzer/languages/index.d.ts +6 -0
  450. package/shared/analyzer/languages/index.js +19 -20
  451. package/shared/analyzer/languages/index.js.map +1 -0
  452. package/shared/analyzer/languages/java.d.ts +20 -0
  453. package/shared/analyzer/languages/java.js +73 -78
  454. package/shared/analyzer/languages/java.js.map +1 -0
  455. package/shared/analyzer/languages/javascript.d.ts +12 -0
  456. package/shared/analyzer/languages/javascript.js +258 -209
  457. package/shared/analyzer/languages/javascript.js.map +1 -0
  458. package/shared/analyzer/languages/python.d.ts +23 -0
  459. package/shared/analyzer/languages/python.js +92 -100
  460. package/shared/analyzer/languages/python.js.map +1 -0
  461. package/shared/analyzer/languages/rust.d.ts +17 -0
  462. package/shared/analyzer/languages/rust.js +96 -98
  463. package/shared/analyzer/languages/rust.js.map +1 -0
  464. package/shared/analyzer/languages/typescript.d.ts +11 -0
  465. package/shared/analyzer/languages/typescript.js +117 -116
  466. package/shared/analyzer/languages/typescript.js.map +1 -0
  467. package/shared/analyzer/licenses.d.ts +18 -0
  468. package/shared/analyzer/licenses.js +130 -133
  469. package/shared/analyzer/licenses.js.map +1 -0
  470. package/shared/analyzer/metrics.d.ts +20 -0
  471. package/shared/analyzer/metrics.js +112 -104
  472. package/shared/analyzer/metrics.js.map +1 -0
  473. package/shared/analyzer/pathUtil.d.ts +10 -0
  474. package/shared/analyzer/pathUtil.js +29 -35
  475. package/shared/analyzer/pathUtil.js.map +1 -0
  476. package/shared/analyzer/patterns.d.ts +11 -0
  477. package/shared/analyzer/patterns.js +231 -253
  478. package/shared/analyzer/patterns.js.map +1 -0
  479. package/shared/analyzer/scan.d.ts +62 -0
  480. package/shared/analyzer/scan.js +451 -442
  481. package/shared/analyzer/scan.js.map +1 -0
  482. package/shared/analyzer/scanControl.d.ts +11 -0
  483. package/shared/analyzer/scanControl.js +62 -0
  484. package/shared/analyzer/scanControl.js.map +1 -0
  485. package/shared/analyzer/security.d.ts +18 -0
  486. package/shared/analyzer/security.js +159 -159
  487. package/shared/analyzer/security.js.map +1 -0
  488. package/shared/analyzer/services.d.ts +5 -0
  489. package/shared/analyzer/services.js +141 -138
  490. package/shared/analyzer/services.js.map +1 -0
  491. package/shared/analyzer/stack.d.ts +6 -0
  492. package/shared/analyzer/stack.js +134 -141
  493. package/shared/analyzer/stack.js.map +1 -0
  494. package/shared/analyzer/tour.d.ts +2 -0
  495. package/shared/analyzer/tour.js +45 -53
  496. package/shared/analyzer/tour.js.map +1 -0
  497. package/shared/analyzer/util.d.ts +8 -0
  498. package/shared/analyzer/util.js +130 -76
  499. package/shared/analyzer/util.js.map +1 -0
  500. package/shared/analyzer/workflows.d.ts +8 -0
  501. package/shared/analyzer/workflows.js +139 -134
  502. package/shared/analyzer/workflows.js.map +1 -0
  503. package/shared/contracts.d.ts +250 -0
  504. package/shared/contracts.js +2 -0
  505. package/shared/contracts.js.map +1 -0
  506. package/shared/diagram/aiFacts.d.ts +35 -0
  507. package/shared/diagram/aiFacts.js +102 -105
  508. package/shared/diagram/aiFacts.js.map +1 -0
  509. package/shared/diagram/aiMermaid.d.ts +5 -0
  510. package/shared/diagram/aiMermaid.js +50 -46
  511. package/shared/diagram/aiMermaid.js.map +1 -0
  512. package/shared/diagram/atlas.d.ts +16 -0
  513. package/shared/diagram/atlas.js +51 -60
  514. package/shared/diagram/atlas.js.map +1 -0
  515. package/shared/diagram/mermaid.d.ts +43 -0
  516. package/shared/diagram/mermaid.js +348 -370
  517. package/shared/diagram/mermaid.js.map +1 -0
  518. package/shared/review/contracts.d.ts +95 -0
  519. package/shared/review/contracts.js +2 -0
  520. package/shared/review/contracts.js.map +1 -0
  521. package/shared/review/review.d.ts +10 -0
  522. package/shared/review/review.js +184 -0
  523. package/shared/review/review.js.map +1 -0
  524. package/shared/search/query.d.ts +32 -0
  525. package/shared/search/query.js +395 -388
  526. package/shared/search/query.js.map +1 -0
package/public/js/llm.js CHANGED
@@ -1,292 +1,264 @@
1
- // LLM settings and prompt assembly. The key lives in localStorage and only
2
- // ever travels to the local server, which forwards it to whatever
3
- // OpenAI-compatible endpoint the user pointed at.
4
-
1
+ // AI connection settings and prompt assembly. Hermes resolves its login on
2
+ // the server; API mode forwards the browser's key to the chosen endpoint.
5
3
  const STORE_KEY = 'onboarder.llm.v1';
6
-
7
4
  // No endpoint, model, or key ships with the repo. Anything saved in the
8
- // API-key drawer overrides these empty defaults (localStorage wins); without
9
- // a saved endpoint the app stays on the offline graph explanations.
5
+ // connection drawer overrides these defaults; without a connection the app
6
+ // stays on the offline graph explanations. Old settings remain in API mode.
10
7
  export const DEFAULT_SETTINGS = {
11
- baseUrl: '',
12
- apiKey: '',
13
- model: '',
8
+ connection: 'api',
9
+ baseUrl: '',
10
+ apiKey: '',
11
+ model: '',
12
+ hermesModel: '',
14
13
  };
15
-
16
- export function getSettings() {
17
- try {
18
- return { ...DEFAULT_SETTINGS, ...JSON.parse(localStorage.getItem(STORE_KEY) || '{}') };
19
- } catch {
20
- return { ...DEFAULT_SETTINGS };
21
- }
14
+ export function getSettings(displayModel = true) {
15
+ try {
16
+ const s = { ...DEFAULT_SETTINGS, ...JSON.parse(localStorage.getItem(STORE_KEY) || '{}') };
17
+ s.connection = s.connection === 'hermes' ? 'hermes' : 'api';
18
+ if (displayModel && s.connection === 'hermes')
19
+ s.model = s.hermesModel || 'Hermes';
20
+ return s;
21
+ }
22
+ catch {
23
+ return { ...DEFAULT_SETTINGS };
24
+ }
22
25
  }
23
-
24
26
  export function saveSettings(settings) {
25
- localStorage.setItem(STORE_KEY, JSON.stringify({
26
- baseUrl: (settings.baseUrl || '').trim().replace(/\/+$/, ''),
27
- apiKey: settings.apiKey || '',
28
- model: (settings.model || '').trim(),
29
- }));
27
+ localStorage.setItem(STORE_KEY, JSON.stringify({
28
+ connection: settings.connection === 'hermes' ? 'hermes' : 'api',
29
+ hermesModel: settings.hermesModel || '',
30
+ baseUrl: (settings.baseUrl || '').trim().replace(/\/+$/, ''),
31
+ apiKey: settings.apiKey || '',
32
+ model: (settings.model || '').trim(),
33
+ }));
30
34
  }
31
-
32
35
  export function isConfigured() {
33
- const s = getSettings();
34
- return Boolean(s.baseUrl && s.model);
36
+ const s = getSettings();
37
+ return s.connection === 'hermes' || Boolean(s.baseUrl && s.model);
35
38
  }
36
-
37
39
  // Azure OpenAI speaks a slightly different dialect than the rest: api-key
38
40
  // header (handled server-side) and no `reasoning` request parameter.
39
41
  export function isAzureHost(baseUrl) {
40
- return /\.openai\.azure\.com|\.cognitiveservices\.azure\.com/i.test(baseUrl || '');
42
+ return /\.openai\.azure\.com|\.cognitiveservices\.azure\.com/i.test(baseUrl || '');
41
43
  }
42
-
43
44
  const SYSTEM_PROMPT = [
44
- 'You are a senior engineer walking a new teammate through a codebase they have never seen.',
45
- 'Write like a person, not a product page: plain sentences, concrete names, no hype, no bullet-point cosplay unless a list is genuinely clearer.',
46
- 'Keep it under 180 words. Refer to files and functions by their real names in backticks.',
47
- 'If something looks risky to change, say so plainly.',
45
+ 'You are a senior engineer walking a new teammate through a codebase they have never seen.',
46
+ 'Write like a person, not a product page: plain sentences, concrete names, no hype, no bullet-point cosplay unless a list is genuinely clearer.',
47
+ 'Keep it under 180 words. Refer to files and functions by their real names in backticks.',
48
+ 'If something looks risky to change, say so plainly.',
48
49
  ].join(' ');
49
-
50
50
  export function fileMessages({ repoName, overview, path, role, fanIn, fanOut, importers, imports, functions, exports_, source }) {
51
- const context = [
52
- `Repository: ${repoName}`,
53
- overview ? `Big picture: ${overview}` : '',
54
- '',
55
- `File: ${path} (role: ${role})`,
56
- `Imported by ${fanIn} files: ${importers.slice(0, 8).join(', ') || 'none'}`,
57
- `Imports ${fanOut} files: ${imports.slice(0, 8).join(', ') || 'none'}`,
58
- functions?.length ? `Functions: ${functions.slice(0, 14).join(', ')}` : '',
59
- exports_?.length ? `Exports: ${exports_.slice(0, 10).join(', ')}` : '',
60
- ].filter(Boolean).join('\n');
61
-
62
- const user = source
63
- ? `${context}\n\nHere is the source, possibly truncated:\n\`\`\`\n${source.slice(0, 12000)}\n\`\`\`\n\nExplain what this file does, how it fits into the repo, and what breaks if it is deleted.`
64
- : `${context}\n\n(Source was not available.) Explain what this file most likely does, how it fits into the repo, and what breaks if it is deleted. Say what you are inferring versus what the graph proves.`;
65
-
66
- return [
67
- { role: 'system', content: SYSTEM_PROMPT },
68
- { role: 'user', content: user },
69
- ];
51
+ const context = [
52
+ `Repository: ${repoName}`,
53
+ overview ? `Big picture: ${overview}` : '',
54
+ '',
55
+ `File: ${path} (role: ${role})`,
56
+ `Imported by ${fanIn} files: ${importers.slice(0, 8).join(', ') || 'none'}`,
57
+ `Imports ${fanOut} files: ${imports.slice(0, 8).join(', ') || 'none'}`,
58
+ functions?.length ? `Functions: ${functions.slice(0, 14).join(', ')}` : '',
59
+ exports_?.length ? `Exports: ${exports_.slice(0, 10).join(', ')}` : '',
60
+ ].filter(Boolean).join('\n');
61
+ const user = source
62
+ ? `${context}\n\nHere is the source, possibly truncated:\n\`\`\`\n${source.slice(0, 12000)}\n\`\`\`\n\nExplain what this file does, how it fits into the repo, and what breaks if it is deleted.`
63
+ : `${context}\n\n(Source was not available.) Explain what this file most likely does, how it fits into the repo, and what breaks if it is deleted. Say what you are inferring versus what the graph proves.`;
64
+ return [
65
+ { role: 'system', content: SYSTEM_PROMPT },
66
+ { role: 'user', content: user },
67
+ ];
70
68
  }
71
-
72
69
  export function overviewMessages({ repoName, overview, entries, hubs, services, cycles, orphans, languages }) {
73
- const user = [
74
- `Repository: ${repoName}`,
75
- `Languages: ${languages}`,
76
- overview ? `Static notes: ${overview}` : '',
77
- entries?.length ? `Entry points: ${entries.slice(0, 5).join(', ')}` : '',
78
- hubs?.length ? `Most-depended-on files: ${hubs.slice(0, 5).map((h) => h.path + ' (' + h.fanIn + ')').join(', ')}` : '',
79
- services?.length ? `Services: ${services.map((s) => s.name).join(', ')}` : '',
80
- cycles?.length ? `${cycles.length} circular dependencies` : '',
81
- orphans?.length ? `${orphans.length} files imported by nothing` : '',
82
- '',
83
- 'Give a new teammate the orientation you would give on their first day: what this thing is, where to start reading, and which files to treat with respect.',
84
- ].filter(Boolean).join('\n');
85
-
86
- return [
87
- { role: 'system', content: SYSTEM_PROMPT },
88
- { role: 'user', content: user },
89
- ];
70
+ const user = [
71
+ `Repository: ${repoName}`,
72
+ `Languages: ${languages}`,
73
+ overview ? `Static notes: ${overview}` : '',
74
+ entries?.length ? `Entry points: ${entries.slice(0, 5).join(', ')}` : '',
75
+ hubs?.length ? `Most-depended-on files: ${hubs.slice(0, 5).map((h) => h.path + ' (' + h.fanIn + ')').join(', ')}` : '',
76
+ services?.length ? `Services: ${services.map((s) => s.name).join(', ')}` : '',
77
+ cycles?.length ? `${cycles.length} circular dependencies` : '',
78
+ orphans?.length ? `${orphans.length} files imported by nothing` : '',
79
+ '',
80
+ 'Give a new teammate the orientation you would give on their first day: what this thing is, where to start reading, and which files to treat with respect.',
81
+ ].filter(Boolean).join('\n');
82
+ return [
83
+ { role: 'system', content: SYSTEM_PROMPT },
84
+ { role: 'user', content: user },
85
+ ];
90
86
  }
91
-
92
87
  // Diagram generation prompts. The model gets compact graph facts and returns
93
88
  // a Mermaid flowchart with a caption; the theme is injected by us afterwards
94
89
  // so AI drafts look exactly like the hand-drawn ones.
95
-
96
90
  const DIAGRAM_PROMPT = [
97
- 'You turn codebase facts into Mermaid flowcharts that teach.',
98
- 'Output format, exactly: first line `%% caption: <one honest sentence about what the diagram shows>`, then the flowchart source. Nothing else — no fences, no commentary, no sign-off.',
99
- 'Rules: start with `flowchart LR` or `flowchart TD` on its own line; use short alphanumeric ids (a1, b2); put every label in "double quotes"; at most 36 nodes; group with subgraphs where it helps; A --> B means A depends on B; no click, style or linkStyle statements.',
100
- 'Where you can infer what a group of files is FOR, name the cluster by its purpose instead of repeating folder names.',
91
+ 'You turn codebase facts into Mermaid flowcharts that teach.',
92
+ 'Output format, exactly: first line `%% caption: <one honest sentence about what the diagram shows>`, then the flowchart source. Nothing else — no fences, no commentary, no sign-off.',
93
+ 'Rules: start with `flowchart LR` or `flowchart TD` on its own line; use short alphanumeric ids (a1, b2); put every label in "double quotes"; at most 36 nodes; group with subgraphs where it helps; A --> B means A depends on B; no click, style or linkStyle statements.',
94
+ 'Where you can infer what a group of files is FOR, name the cluster by its purpose instead of repeating folder names.',
101
95
  ].join(' ');
102
-
103
96
  export function diagramMessages({ repoName, kind, facts }) {
104
- const user = [
105
- `Repository: ${repoName}`,
106
- `Diagram to draw: ${kind}`,
107
- 'Facts:',
108
- facts.join('\n'),
109
- '',
110
- `Draw the most useful ${kind} for someone who has never seen this codebase.`,
111
- ].join('\n');
112
-
113
- return [
114
- { role: 'system', content: DIAGRAM_PROMPT },
115
- { role: 'user', content: user },
116
- ];
97
+ const user = [
98
+ `Repository: ${repoName}`,
99
+ `Diagram to draw: ${kind}`,
100
+ 'Facts:',
101
+ facts.join('\n'),
102
+ '',
103
+ `Draw the most useful ${kind} for someone who has never seen this codebase.`,
104
+ ].join('\n');
105
+ return [
106
+ { role: 'system', content: DIAGRAM_PROMPT },
107
+ { role: 'user', content: user },
108
+ ];
117
109
  }
118
-
119
110
  // ---- documentation prompts -------------------------------------------------
120
-
121
111
  const DOC_SYSTEM = [
122
- 'You write documentation for a codebase as a senior engineer would: concrete, calm, specific.',
123
- 'Plain sentences. Real names. No hype, no filler, no "this file plays a crucial role".',
112
+ 'You write documentation for a codebase as a senior engineer would: concrete, calm, specific.',
113
+ 'Plain sentences. Real names. No hype, no filler, no "this file plays a crucial role".',
124
114
  ].join(' ');
125
-
126
115
  // Detailed reference notes for one file or folder, opened as a tab in Docs.
127
116
  const FILE_DOC_SYSTEM = [
128
- 'You write detailed reference notes for one file in a codebase, as a senior engineer would for a new teammate.',
129
- 'Concrete and specific: real names, real numbers, no filler. Answer in Markdown with exactly these sections, in this order:',
130
- '## Purpose',
131
- '## How it fits',
132
- '## Key parts',
133
- '## Handle with care',
134
- 'Keep "Key parts" a short bullet list of the functions or exports that matter. Under 350 words total. If a section honestly has nothing to say, one line saying so.',
117
+ 'You write detailed reference notes for one file in a codebase, as a senior engineer would for a new teammate.',
118
+ 'Concrete and specific: real names, real numbers, no filler. Answer in Markdown with exactly these sections, in this order:',
119
+ '## Purpose',
120
+ '## How it fits',
121
+ '## Key parts',
122
+ '## Handle with care',
123
+ 'Keep "Key parts" a short bullet list of the functions or exports that matter. Under 350 words total. If a section honestly has nothing to say, one line saying so.',
135
124
  ].join('\n');
136
-
137
125
  const FOLDER_DOC_SYSTEM = [
138
- 'You write detailed reference notes for one folder in a codebase, as a senior engineer would for a new teammate.',
139
- 'Concrete and specific: real names, no filler. Answer in Markdown with exactly these sections, in this order:',
140
- '## Purpose',
141
- '## How the parts cooperate',
142
- '## The files that matter',
143
- '## Handle with care',
144
- 'Under 300 words total. Say what you infer from names and import facts versus what you know.',
126
+ 'You write detailed reference notes for one folder in a codebase, as a senior engineer would for a new teammate.',
127
+ 'Concrete and specific: real names, no filler. Answer in Markdown with exactly these sections, in this order:',
128
+ '## Purpose',
129
+ '## How the parts cooperate',
130
+ '## The files that matter',
131
+ '## Handle with care',
132
+ 'Under 300 words total. Say what you infer from names and import facts versus what you know.',
145
133
  ].join('\n');
146
-
147
134
  export function fileDocMessages({ repoName, overview, file }) {
148
- const blocks = [
149
- `Repository: ${repoName}`,
150
- overview ? `Big picture: ${overview}` : '',
151
- `File: ${file.path} (role: ${file.role})`,
152
- `Imported by ${file.fanIn} files: ${file.importers.slice(0, 8).join(', ') || 'none'}`,
153
- `Imports ${file.fanOut} files: ${file.imports.slice(0, 8).join(', ') || 'none'}`,
154
- file.functions?.length ? `Functions: ${file.functions.slice(0, 14).join(', ')}` : '',
155
- file.exports_?.length ? `Exports: ${file.exports_.slice(0, 10).join(', ')}` : '',
156
- file.source
157
- ? `Source, possibly truncated:\n\`\`\`\n${file.source.slice(0, 12000)}\n\`\`\``
158
- : '(Source unavailable — write from the graph facts and say what you are inferring.)',
159
- ].filter(Boolean);
160
- return [
161
- { role: 'system', content: FILE_DOC_SYSTEM },
162
- { role: 'user', content: blocks.join('\n') },
163
- ];
135
+ const blocks = [
136
+ `Repository: ${repoName}`,
137
+ overview ? `Big picture: ${overview}` : '',
138
+ `File: ${file.path} (role: ${file.role})`,
139
+ `Imported by ${file.fanIn} files: ${file.importers.slice(0, 8).join(', ') || 'none'}`,
140
+ `Imports ${file.fanOut} files: ${file.imports.slice(0, 8).join(', ') || 'none'}`,
141
+ file.functions?.length ? `Functions: ${file.functions.slice(0, 14).join(', ')}` : '',
142
+ file.exports_?.length ? `Exports: ${file.exports_.slice(0, 10).join(', ')}` : '',
143
+ file.source
144
+ ? `Source, possibly truncated:\n\`\`\`\n${file.source.slice(0, 12000)}\n\`\`\``
145
+ : '(Source unavailable — write from the graph facts and say what you are inferring.)',
146
+ ].filter(Boolean);
147
+ return [
148
+ { role: 'system', content: FILE_DOC_SYSTEM },
149
+ { role: 'user', content: blocks.join('\n') },
150
+ ];
164
151
  }
165
-
166
152
  export function folderDocDetailedMessages({ repoName, folder, subfolders, files }) {
167
- const lines = files.map((f) =>
168
- `- ${f.name} — ${f.fanIn} dependents, pulls in ${f.fanOut}` +
169
- (f.role !== 'module' ? `, role: ${f.role}` : '') +
170
- (f.functions.length ? `, functions: ${f.functions.slice(0, 5).join(', ')}` : '')
171
- );
172
- const user = [
173
- `Repository: ${repoName}`,
174
- `Folder: ${folder || '(repo root)'}`,
175
- subfolders?.length ? `Subfolders: ${subfolders.join(', ')}` : '',
176
- 'Files with import-graph facts:',
177
- lines.join('\n') || '(no files directly here)',
178
- ].filter(Boolean).join('\n');
179
- return [
180
- { role: 'system', content: FOLDER_DOC_SYSTEM },
181
- { role: 'user', content: user },
182
- ];
153
+ const lines = files.map((f) => `- ${f.name} — ${f.fanIn} dependents, pulls in ${f.fanOut}` +
154
+ (f.role !== 'module' ? `, role: ${f.role}` : '') +
155
+ (f.functions.length ? `, functions: ${f.functions.slice(0, 5).join(', ')}` : ''));
156
+ const user = [
157
+ `Repository: ${repoName}`,
158
+ `Folder: ${folder || '(repo root)'}`,
159
+ subfolders?.length ? `Subfolders: ${subfolders.join(', ')}` : '',
160
+ 'Files with import-graph facts:',
161
+ lines.join('\n') || '(no files directly here)',
162
+ ].filter(Boolean).join('\n');
163
+ return [
164
+ { role: 'system', content: FOLDER_DOC_SYSTEM },
165
+ { role: 'user', content: user },
166
+ ];
183
167
  }
184
-
185
168
  export function repoDocMessages({ repoName, overview, readmeExcerpt, entries, hubs }) {
186
- const user = [
187
- `Repository: ${repoName}`,
188
- overview ? `Static analysis notes: ${overview}` : '',
189
- entries?.length ? `Entry points: ${entries.slice(0, 5).join(', ')}` : '',
190
- hubs?.length ? `Most depended-on files: ${hubs.slice(0, 5).map((h) => h.path + ' (' + h.fanIn + ')').join(', ')}` : '',
191
- readmeExcerpt ? `The project's own README begins:\n"""\n${readmeExcerpt.slice(0, 1500)}\n"""` : '(No README found.)',
192
- '',
193
- 'Write 3–4 sentences of high-level overview for a brand-new teammate: what this project is, how it is organized at the top level, and where to start reading. Plain prose only — no headings, no bullets.',
194
- ].filter(Boolean).join('\n');
195
-
196
- return [
197
- { role: 'system', content: DOC_SYSTEM },
198
- { role: 'user', content: user },
199
- ];
169
+ const user = [
170
+ `Repository: ${repoName}`,
171
+ overview ? `Static analysis notes: ${overview}` : '',
172
+ entries?.length ? `Entry points: ${entries.slice(0, 5).join(', ')}` : '',
173
+ hubs?.length ? `Most depended-on files: ${hubs.slice(0, 5).map((h) => h.path + ' (' + h.fanIn + ')').join(', ')}` : '',
174
+ readmeExcerpt ? `The project's own README begins:\n"""\n${readmeExcerpt.slice(0, 1500)}\n"""` : '(No README found.)',
175
+ '',
176
+ 'Write 3–4 sentences of high-level overview for a brand-new teammate: what this project is, how it is organized at the top level, and where to start reading. Plain prose only — no headings, no bullets.',
177
+ ].filter(Boolean).join('\n');
178
+ return [
179
+ { role: 'system', content: DOC_SYSTEM },
180
+ { role: 'user', content: user },
181
+ ];
200
182
  }
201
-
202
183
  export function folderDocMessages({ repoName, folder, subfolders, files }) {
203
- const fileLines = files.map((f) => {
204
- if (!f.parsed) return `- ${f.name} — not parsed (asset or data)`;
205
- const bits = [`${f.fanIn} dependents`, `pulls in ${f.fanOut}`];
206
- if (f.role !== 'module') bits.push('role: ' + f.role);
207
- if (f.functions.length) bits.push('functions: ' + f.functions.slice(0, 5).join(', '));
208
- return `- ${f.name} — ${bits.join(', ')}`;
209
- });
210
-
211
- const user = [
212
- `Repository: ${repoName}`,
213
- `Folder under review: ${folder || '(repo root)'}`,
214
- subfolders?.length ? `Subfolders inside it: ${subfolders.join(', ')}` : '',
215
- 'Files (with import-graph facts):',
216
- fileLines.join('\n') || '(no files directly here)',
217
- '',
218
- 'Write complete documentation for this folder, in exactly this format, no preamble, no fences:',
219
- 'FOLDER: <3-5 sentences — what lives here, why it exists, how the parts cooperate, and what a newcomer should read first>',
220
- ...files.filter((f) => f.parsed).map((f) => `FILE: ${f.name}: <2-3 sentences — what this file is for, who it talks to, and what to handle with care>`),
221
- ].filter(Boolean).join('\n');
222
-
223
- return [
224
- { role: 'system', content: DOC_SYSTEM },
225
- { role: 'user', content: user },
226
- ];
184
+ const fileLines = files.map((f) => {
185
+ if (!f.parsed)
186
+ return `- ${f.name} — not parsed (asset or data)`;
187
+ const bits = [`${f.fanIn} dependents`, `pulls in ${f.fanOut}`];
188
+ if (f.role !== 'module')
189
+ bits.push('role: ' + f.role);
190
+ if (f.functions.length)
191
+ bits.push('functions: ' + f.functions.slice(0, 5).join(', '));
192
+ return `- ${f.name} — ${bits.join(', ')}`;
193
+ });
194
+ const user = [
195
+ `Repository: ${repoName}`,
196
+ `Folder under review: ${folder || '(repo root)'}`,
197
+ subfolders?.length ? `Subfolders inside it: ${subfolders.join(', ')}` : '',
198
+ 'Files (with import-graph facts):',
199
+ fileLines.join('\n') || '(no files directly here)',
200
+ '',
201
+ 'Write complete documentation for this folder, in exactly this format, no preamble, no fences:',
202
+ 'FOLDER: <3-5 sentences — what lives here, why it exists, how the parts cooperate, and what a newcomer should read first>',
203
+ ...files.filter((f) => f.parsed).map((f) => `FILE: ${f.name}: <2-3 sentences — what this file is for, who it talks to, and what to handle with care>`),
204
+ ].filter(Boolean).join('\n');
205
+ return [
206
+ { role: 'system', content: DOC_SYSTEM },
207
+ { role: 'user', content: user },
208
+ ];
227
209
  }
228
-
229
210
  const QUESTION_PROMPT = [
230
- 'You are a senior engineer answering a teammate\'s question about a codebase.',
231
- 'Answer directly and concretely, citing real file and function names in backticks.',
232
- 'If the answer is not in the graph facts or source you were given, say so plainly and name the file you would open next to find out.',
233
- 'Keep it under 200 words unless the question genuinely needs more.',
211
+ 'You are a senior engineer answering a teammate\'s question about a codebase.',
212
+ 'Answer directly and concretely, citing real file and function names in backticks.',
213
+ 'If the answer is not in the graph facts or source you were given, say so plainly and name the file you would open next to find out.',
214
+ 'Keep it under 200 words unless the question genuinely needs more.',
234
215
  ].join(' ');
235
-
236
216
  // A free-form question. When the user has a file selected, its facts and
237
217
  // source ride along; otherwise the model reasons from the repo overview.
238
218
  export function questionMessages({ repoName, overview, question, file }) {
239
- const blocks = [
240
- `Repository: ${repoName}`,
241
- overview ? `Big picture: ${overview}` : '',
242
- ];
243
-
244
- if (file) {
245
- blocks.push(
246
- `The user is currently looking at: ${file.path} (role: ${file.role})`,
247
- `Imported by ${file.fanIn} files: ${file.importers.slice(0, 8).join(', ') || 'none'}`,
248
- `Imports ${file.fanOut} files: ${file.imports.slice(0, 8).join(', ') || 'none'}`
249
- );
250
- if (file.functions?.length) blocks.push(`Functions: ${file.functions.slice(0, 14).join(', ')}`);
251
- if (file.exports_?.length) blocks.push(`Exports: ${file.exports_.slice(0, 10).join(', ')}`);
252
- if (file.source) {
253
- blocks.push(`Source of ${file.path}, possibly truncated:\n\`\`\`\n${file.source.slice(0, 12000)}\n\`\`\``);
254
- } else {
255
- blocks.push('(Source for that file was not available — answer from the graph facts and say so.)');
219
+ const blocks = [
220
+ `Repository: ${repoName}`,
221
+ overview ? `Big picture: ${overview}` : '',
222
+ ];
223
+ if (file) {
224
+ blocks.push(`The user is currently looking at: ${file.path} (role: ${file.role})`, `Imported by ${file.fanIn} files: ${file.importers.slice(0, 8).join(', ') || 'none'}`, `Imports ${file.fanOut} files: ${file.imports.slice(0, 8).join(', ') || 'none'}`);
225
+ if (file.functions?.length)
226
+ blocks.push(`Functions: ${file.functions.slice(0, 14).join(', ')}`);
227
+ if (file.exports_?.length)
228
+ blocks.push(`Exports: ${file.exports_.slice(0, 10).join(', ')}`);
229
+ if (file.source) {
230
+ blocks.push(`Source of ${file.path}, possibly truncated:\n\`\`\`\n${file.source.slice(0, 12000)}\n\`\`\``);
231
+ }
232
+ else {
233
+ blocks.push('(Source for that file was not available — answer from the graph facts and say so.)');
234
+ }
256
235
  }
257
- }
258
-
259
- blocks.push(`Question: ${question}`);
260
-
261
- return [
262
- { role: 'system', content: QUESTION_PROMPT },
263
- { role: 'user', content: blocks.filter(Boolean).join('\n') },
264
- ];
236
+ blocks.push(`Question: ${question}`);
237
+ return [
238
+ { role: 'system', content: QUESTION_PROMPT },
239
+ { role: 'user', content: blocks.filter(Boolean).join('\n') },
240
+ ];
265
241
  }
266
-
267
-
268
242
  // Used by the About tab to summarize a detected framework/library: the model
269
243
  // reasons from the official docs excerpt (when fetched) plus the repo's own
270
244
  // context. docsText may be empty — the prompt says so and falls back to
271
245
  // general knowledge.
272
246
  export function stackSummaryMessages({ repoName, item, docsText, repoNote }) {
273
- const system =
274
- 'You are a senior developer writing compact field notes for a codebase onboarding tool. Be specific and honest; distinguish between what the docs state and what you infer. No headings, no "Sure" / "Absolutely" openers, no filler.';
275
- const declared = item.version
276
- ? `The project declares ${item.name} ${item.version} (${item.category}, ${item.lang}${item.dev ? ', dev dependency' : ''}).`
277
- : `The project uses ${item.name} (${item.category}, ${item.lang}).`;
278
- const user = [
279
- `Repository: ${repoName}.`,
280
- declared,
281
- `Repo context: ${repoNote}`,
282
- docsText
283
- ? `Official docs excerpt:\n${docsText}`
284
- : 'No official docs could be fetched for this dependency — rely on your own knowledge and say so in one short clause.',
285
- 'In 2-4 sentences: what this is, why the project likely chose it, and anything a new teammate should know about using it here.',
286
- ].join('\n\n');
287
- return [{ role: 'system', content: system }, { role: 'user', content: user }];
247
+ const system = 'You are a senior developer writing compact field notes for a codebase onboarding tool. Be specific and honest; distinguish between what the docs state and what you infer. No headings, no "Sure" / "Absolutely" openers, no filler.';
248
+ const declared = item.version
249
+ ? `The project declares ${item.name} ${item.version} (${item.category}, ${item.lang}${item.dev ? ', dev dependency' : ''}).`
250
+ : `The project uses ${item.name} (${item.category}, ${item.lang}).`;
251
+ const user = [
252
+ `Repository: ${repoName}.`,
253
+ declared,
254
+ `Repo context: ${repoNote}`,
255
+ docsText
256
+ ? `Official docs excerpt:\n${docsText}`
257
+ : 'No official docs could be fetched for this dependency — rely on your own knowledge and say so in one short clause.',
258
+ 'In 2-4 sentences: what this is, why the project likely chose it, and anything a new teammate should know about using it here.',
259
+ ].join('\n\n');
260
+ return [{ role: 'system', content: system }, { role: 'user', content: user }];
288
261
  }
289
-
290
262
  // The Deep Analysis report, read back by the model. Two jobs in one builder: a
291
263
  // report is either *explained* (no question — prioritize what to fix) or asked
292
264
  // about ("is the eval finding actually reachable?"). The engine list is part of
@@ -294,52 +266,48 @@ export function stackSummaryMessages({ repoName, item, docsText, repoNote }) {
294
266
  // answer, and a model that does not know a tool was missing will invent
295
267
  // confidence it has not earned.
296
268
  const ANALYSIS_SYSTEM = [
297
- 'You are a senior engineer walking the owner of a codebase through a static-analysis report.',
298
- 'Be concrete and calm. Name real files, rules and line numbers in backticks.',
299
- 'Prioritize: what must be fixed now, what can wait, and what is noise. Say plainly when a finding looks like a false positive and why.',
300
- 'Never invent a finding that is not in the list you were given. If the list is empty, say so — and say what that does and does not prove.',
301
- 'If some engines did not run or are not installed, say what that leaves unchecked.',
302
- 'Keep it under 220 words unless the question genuinely needs more.',
269
+ 'You are a senior engineer walking the owner of a codebase through a static-analysis report.',
270
+ 'Be concrete and calm. Name real files, rules and line numbers in backticks.',
271
+ 'Prioritize: what must be fixed now, what can wait, and what is noise. Say plainly when a finding looks like a false positive and why.',
272
+ 'Never invent a finding that is not in the list you were given. If the list is empty, say so — and say what that does and does not prove.',
273
+ 'If some engines did not run or are not installed, say what that leaves unchecked.',
274
+ 'Keep it under 220 words unless the question genuinely needs more.',
303
275
  ].join(' ');
304
-
305
276
  export function analysisMessages({ repoName, grade, score, counts, engines, findings, question }) {
306
- const engineLines = (engines || []).map((e) => {
307
- if (e.ran) return `- ${e.label}: ran, ${e.findings} finding(s) in ${e.ms}ms`;
308
- if (e.failed) return `- ${e.label}: ran but failed — ${e.failure || 'no reason given'}`;
309
- if (e.available) return `- ${e.label}: installed but not run`;
310
- return `- ${e.label}: NOT INSTALLED (${e.reason || 'unknown'})`;
311
- });
312
-
313
- const findingLines = (findings || []).slice(0, 40).map(
314
- (f) => `- [${f.severity}] ${f.path}:${f.line} — ${f.message} (${f.tool} · ${f.rule})`,
315
- );
316
-
317
- const user = [
318
- `Repository: ${repoName}`,
319
- grade ? `Built-in security grade: ${grade} (${score}/100)` : '',
320
- counts
321
- ? `Findings: ${counts.total} total — ${counts.critical} critical, ${counts.high} high, ${counts.medium} medium, ${counts.low} low. ${counts.external} came from external engines, ${counts.builtin} from the built-in scanner.`
322
- : '',
323
- engineLines.length ? `Engines:\n${engineLines.join('\n')}` : '',
324
- findingLines.length
325
- ? `Findings, worst first:\n${findingLines.join('\n')}`
326
- : 'No findings were reported by anything.',
327
- question
328
- ? `Question: ${question}`
329
- : 'Explain this report: what matters most, what to fix first, and what the engines could not see.',
330
- ].filter(Boolean).join('\n\n');
331
-
332
- return [
333
- { role: 'system', content: ANALYSIS_SYSTEM },
334
- { role: 'user', content: user },
335
- ];
277
+ const engineLines = (engines || []).map((e) => {
278
+ if (e.ran)
279
+ return `- ${e.label}: ran, ${e.findings} finding(s) in ${e.ms}ms`;
280
+ if (e.failed)
281
+ return `- ${e.label}: ran but failed — ${e.failure || 'no reason given'}`;
282
+ if (e.available)
283
+ return `- ${e.label}: installed but not run`;
284
+ return `- ${e.label}: NOT INSTALLED (${e.reason || 'unknown'})`;
285
+ });
286
+ const findingLines = (findings || []).slice(0, 40).map((f) => `- [${f.severity}] ${f.path}:${f.line} — ${f.message} (${f.tool} · ${f.rule})`);
287
+ const user = [
288
+ `Repository: ${repoName}`,
289
+ grade ? `Built-in security grade: ${grade} (${score}/100)` : '',
290
+ counts
291
+ ? `Findings: ${counts.total} total — ${counts.critical} critical, ${counts.high} high, ${counts.medium} medium, ${counts.low} low. ${counts.external} came from external engines, ${counts.builtin} from the built-in scanner.`
292
+ : '',
293
+ engineLines.length ? `Engines:\n${engineLines.join('\n')}` : '',
294
+ findingLines.length
295
+ ? `Findings, worst first:\n${findingLines.join('\n')}`
296
+ : 'No findings were reported by anything.',
297
+ question
298
+ ? `Question: ${question}`
299
+ : 'Explain this report: what matters most, what to fix first, and what the engines could not see.',
300
+ ].filter(Boolean).join('\n\n');
301
+ return [
302
+ { role: 'system', content: ANALYSIS_SYSTEM },
303
+ { role: 'user', content: user },
304
+ ];
336
305
  }
337
-
338
306
  export async function streamTokens(container, text) {
339
- container.innerHTML = '';
340
- for (let i = 0; i < text.length; i++) {
341
- container.innerHTML += text[i];
342
- await new Promise(r => setTimeout(r, 10));
343
- }
307
+ container.innerHTML = '';
308
+ for (let i = 0; i < text.length; i++) {
309
+ container.innerHTML += text[i];
310
+ await new Promise(r => setTimeout(r, 10));
311
+ }
344
312
  }
345
-
313
+ //# sourceMappingURL=llm.js.map