codebase-onboarder 0.6.0 → 0.7.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 (448) hide show
  1. package/README.md +174 -46
  2. package/bin/build-if-source.js +23 -0
  3. package/cli/commands.d.ts +26 -0
  4. package/cli/commands.js +836 -811
  5. package/cli/commands.js.map +1 -0
  6. package/cli/explorer/advanced.d.ts +14 -0
  7. package/cli/explorer/advanced.js +321 -329
  8. package/cli/explorer/advanced.js.map +1 -0
  9. package/cli/explorer/app.d.ts +1 -0
  10. package/cli/explorer/app.js +384 -313
  11. package/cli/explorer/app.js.map +1 -0
  12. package/cli/explorer/assistant.d.ts +9 -0
  13. package/cli/explorer/assistant.js +58 -0
  14. package/cli/explorer/assistant.js.map +1 -0
  15. package/cli/explorer/commands.d.ts +17 -0
  16. package/cli/explorer/commands.js +368 -302
  17. package/cli/explorer/commands.js.map +1 -0
  18. package/cli/explorer/featureViews.d.ts +124 -0
  19. package/cli/explorer/featureViews.js +179 -0
  20. package/cli/explorer/featureViews.js.map +1 -0
  21. package/cli/explorer/github.d.ts +21 -0
  22. package/cli/explorer/github.js +42 -44
  23. package/cli/explorer/github.js.map +1 -0
  24. package/cli/explorer/graphs.d.ts +7 -0
  25. package/cli/explorer/graphs.js +90 -95
  26. package/cli/explorer/graphs.js.map +1 -0
  27. package/cli/explorer/picker.d.ts +22 -0
  28. package/cli/explorer/picker.js +150 -0
  29. package/cli/explorer/picker.js.map +1 -0
  30. package/cli/explorer/report.d.ts +85 -0
  31. package/cli/explorer/report.js +60 -0
  32. package/cli/explorer/report.js.map +1 -0
  33. package/cli/explorer/session.d.ts +449 -0
  34. package/cli/explorer/session.js +143 -144
  35. package/cli/explorer/session.js.map +1 -0
  36. package/cli/explorer/views.d.ts +19 -0
  37. package/cli/explorer/views.js +465 -482
  38. package/cli/explorer/views.js.map +1 -0
  39. package/cli/explorer/wrap.d.ts +1 -0
  40. package/cli/explorer/wrap.js +28 -44
  41. package/cli/explorer/wrap.js.map +1 -0
  42. package/cli/main.d.ts +1 -0
  43. package/cli/main.js +214 -161
  44. package/cli/main.js.map +1 -0
  45. package/cli/prompt.d.ts +5 -0
  46. package/cli/prompt.js +84 -80
  47. package/cli/prompt.js.map +1 -0
  48. package/cli/scanOptions.d.ts +2 -0
  49. package/cli/scanOptions.js +11 -0
  50. package/cli/scanOptions.js.map +1 -0
  51. package/cli/ui.d.ts +33 -0
  52. package/cli/ui.js +35 -44
  53. package/cli/ui.js.map +1 -0
  54. package/cli/wizard.d.ts +187 -0
  55. package/cli/wizard.js +304 -284
  56. package/cli/wizard.js.map +1 -0
  57. package/package.json +15 -4
  58. package/public/app.d.ts +1 -0
  59. package/public/app.js +1057 -1009
  60. package/public/app.js.map +1 -0
  61. package/public/browser.d.ts +68 -0
  62. package/public/browser.js +2 -0
  63. package/public/browser.js.map +1 -0
  64. package/public/index.html +30 -13
  65. package/public/js/about.d.ts +6 -0
  66. package/public/js/about.js +152 -172
  67. package/public/js/about.js.map +1 -0
  68. package/public/js/aiDraft.d.ts +3 -0
  69. package/public/js/aiDraft.js +116 -124
  70. package/public/js/aiDraft.js.map +1 -0
  71. package/public/js/analysisPanel.d.ts +7 -0
  72. package/public/js/analysisPanel.js +166 -166
  73. package/public/js/analysisPanel.js.map +1 -0
  74. package/public/js/analysisReport.d.ts +38 -0
  75. package/public/js/analysisReport.js +105 -110
  76. package/public/js/analysisReport.js.map +1 -0
  77. package/public/js/api.d.ts +26 -0
  78. package/public/js/api.js +176 -167
  79. package/public/js/api.js.map +1 -0
  80. package/public/js/atlas.d.ts +6 -0
  81. package/public/js/atlas.js +50 -58
  82. package/public/js/atlas.js.map +1 -0
  83. package/public/js/blameView.d.ts +2 -0
  84. package/public/js/blameView.js +36 -37
  85. package/public/js/blameView.js.map +1 -0
  86. package/public/js/codeTab.d.ts +3 -0
  87. package/public/js/codeTab.js +175 -180
  88. package/public/js/codeTab.js.map +1 -0
  89. package/public/js/codeViewer.d.ts +5 -0
  90. package/public/js/codeViewer.js +162 -150
  91. package/public/js/codeViewer.js.map +1 -0
  92. package/public/js/components/FileChip.d.ts +9 -0
  93. package/public/js/components/FileChip.js +45 -49
  94. package/public/js/components/FileChip.js.map +1 -0
  95. package/public/js/components/MetricSparkline.d.ts +7 -0
  96. package/public/js/components/MetricSparkline.js +35 -44
  97. package/public/js/components/MetricSparkline.js.map +1 -0
  98. package/public/js/components/RiskBadge.d.ts +9 -0
  99. package/public/js/components/RiskBadge.js +55 -63
  100. package/public/js/components/RiskBadge.js.map +1 -0
  101. package/public/js/deepAnalysisView.d.ts +99 -0
  102. package/public/js/deepAnalysisView.js +282 -302
  103. package/public/js/deepAnalysisView.js.map +1 -0
  104. package/public/js/diagramPane.d.ts +8 -0
  105. package/public/js/diagramPane.js +133 -135
  106. package/public/js/diagramPane.js.map +1 -0
  107. package/public/js/diffView.d.ts +6 -0
  108. package/public/js/diffView.js +222 -209
  109. package/public/js/diffView.js.map +1 -0
  110. package/public/js/docsView.d.ts +2 -0
  111. package/public/js/docsView.js +441 -442
  112. package/public/js/docsView.js.map +1 -0
  113. package/public/js/dom.d.ts +189 -0
  114. package/public/js/dom.js +5 -0
  115. package/public/js/dom.js.map +1 -0
  116. package/public/js/fileSourceBrowser.d.ts +5 -0
  117. package/public/js/fileSourceBrowser.js +33 -41
  118. package/public/js/fileSourceBrowser.js.map +1 -0
  119. package/public/js/flameGraph.d.ts +5 -0
  120. package/public/js/flameGraph.js +62 -72
  121. package/public/js/flameGraph.js.map +1 -0
  122. package/public/js/forceGraph.d.ts +10 -0
  123. package/public/js/forceGraph.js +581 -556
  124. package/public/js/forceGraph.js.map +1 -0
  125. package/public/js/heatmap.d.ts +4 -0
  126. package/public/js/heatmap.js +142 -164
  127. package/public/js/heatmap.js.map +1 -0
  128. package/public/js/highlight.d.ts +2 -0
  129. package/public/js/highlight.js +116 -107
  130. package/public/js/highlight.js.map +1 -0
  131. package/public/js/html.d.ts +2 -0
  132. package/public/js/html.js +14 -44
  133. package/public/js/html.js.map +1 -0
  134. package/public/js/insightsView.d.ts +5 -0
  135. package/public/js/insightsView.js +93 -111
  136. package/public/js/insightsView.js.map +1 -0
  137. package/public/js/inspector.d.ts +37 -0
  138. package/public/js/inspector.js +416 -445
  139. package/public/js/inspector.js.map +1 -0
  140. package/public/js/llm.d.ts +113 -0
  141. package/public/js/llm.js +233 -272
  142. package/public/js/llm.js.map +1 -0
  143. package/public/js/mapView.d.ts +3 -0
  144. package/public/js/mapView.js +121 -120
  145. package/public/js/mapView.js.map +1 -0
  146. package/public/js/markdown.d.ts +3 -0
  147. package/public/js/markdown.js +84 -91
  148. package/public/js/markdown.js.map +1 -0
  149. package/public/js/mindmap.d.ts +32 -0
  150. package/public/js/mindmap.js +244 -259
  151. package/public/js/mindmap.js.map +1 -0
  152. package/public/js/mobilePanels.d.ts +5 -0
  153. package/public/js/mobilePanels.js +50 -0
  154. package/public/js/mobilePanels.js.map +1 -0
  155. package/public/js/repoFiles.d.ts +12 -0
  156. package/public/js/repoFiles.js +28 -27
  157. package/public/js/repoFiles.js.map +1 -0
  158. package/public/js/reviewView.d.ts +28 -0
  159. package/public/js/reviewView.js +256 -0
  160. package/public/js/reviewView.js.map +1 -0
  161. package/public/js/sbomView.d.ts +3 -0
  162. package/public/js/sbomView.js +59 -67
  163. package/public/js/sbomView.js.map +1 -0
  164. package/public/js/scanCache.d.ts +16 -0
  165. package/public/js/scanCache.js +67 -65
  166. package/public/js/scanCache.js.map +1 -0
  167. package/public/js/search.d.ts +7 -0
  168. package/public/js/search.js +868 -800
  169. package/public/js/search.js.map +1 -0
  170. package/public/js/searchLocal.d.ts +42 -0
  171. package/public/js/searchLocal.js +87 -0
  172. package/public/js/searchLocal.js.map +1 -0
  173. package/public/js/serverSettings.d.ts +5 -0
  174. package/public/js/serverSettings.js +153 -164
  175. package/public/js/serverSettings.js.map +1 -0
  176. package/public/js/state.d.ts +798 -0
  177. package/public/js/state.js +114 -122
  178. package/public/js/state.js.map +1 -0
  179. package/public/js/tour.d.ts +6 -0
  180. package/public/js/tour.js +5 -7
  181. package/public/js/tour.js.map +1 -0
  182. package/public/js/transitions.d.ts +2 -0
  183. package/public/js/transitions.js +9 -10
  184. package/public/js/transitions.js.map +1 -0
  185. package/public/js/tree.d.ts +12 -0
  186. package/public/js/tree.js +157 -154
  187. package/public/js/tree.js.map +1 -0
  188. package/public/js/workflowsView.d.ts +3 -0
  189. package/public/js/workflowsView.js +15 -22
  190. package/public/js/workflowsView.js.map +1 -0
  191. package/public/search.css +495 -0
  192. package/public/styles.css +163 -346
  193. package/public/workbench.css +166 -0
  194. package/server/apiAuth.d.ts +3 -0
  195. package/server/apiAuth.js +18 -20
  196. package/server/apiAuth.js.map +1 -0
  197. package/server/apiDiff.d.ts +2 -0
  198. package/server/apiDiff.js +20 -18
  199. package/server/apiDiff.js.map +1 -0
  200. package/server/apiDocs.d.ts +2 -0
  201. package/server/apiDocs.js +38 -40
  202. package/server/apiDocs.js.map +1 -0
  203. package/server/apiFile.d.ts +1 -0
  204. package/server/apiFile.js +14 -17
  205. package/server/apiFile.js.map +1 -0
  206. package/server/apiGitBlame.d.ts +2 -0
  207. package/server/apiGitBlame.js +50 -51
  208. package/server/apiGitBlame.js.map +1 -0
  209. package/server/apiMcp.d.ts +4 -0
  210. package/server/apiMcp.js +64 -66
  211. package/server/apiMcp.js.map +1 -0
  212. package/server/apiReview.d.ts +2 -0
  213. package/server/apiReview.js +45 -0
  214. package/server/apiReview.js.map +1 -0
  215. package/server/apiScan.d.ts +5 -0
  216. package/server/apiScan.js +90 -71
  217. package/server/apiScan.js.map +1 -0
  218. package/server/apiSearch.d.ts +33 -0
  219. package/server/apiSearch.js +184 -200
  220. package/server/apiSearch.js.map +1 -0
  221. package/server/apiSettings.d.ts +4 -0
  222. package/server/apiSettings.js +84 -85
  223. package/server/apiSettings.js.map +1 -0
  224. package/server/apiTools.d.ts +3 -0
  225. package/server/apiTools.js +55 -56
  226. package/server/apiTools.js.map +1 -0
  227. package/server/auth.d.ts +5 -0
  228. package/server/auth.js +54 -51
  229. package/server/auth.js.map +1 -0
  230. package/server/config.d.ts +42 -0
  231. package/server/config.js +189 -194
  232. package/server/config.js.map +1 -0
  233. package/server/daemon.d.ts +12 -0
  234. package/server/daemon.js +124 -114
  235. package/server/daemon.js.map +1 -0
  236. package/server/fileSourceNode.d.ts +2 -0
  237. package/server/fileSourceNode.js +34 -36
  238. package/server/fileSourceNode.js.map +1 -0
  239. package/server/gitClone.d.ts +9 -0
  240. package/server/gitClone.js +59 -61
  241. package/server/gitClone.js.map +1 -0
  242. package/server/gitDiff.d.ts +36 -0
  243. package/server/gitDiff.js +271 -169
  244. package/server/gitDiff.js.map +1 -0
  245. package/server/gitHistory.d.ts +12 -0
  246. package/server/gitHistory.js +80 -80
  247. package/server/gitHistory.js.map +1 -0
  248. package/server/gitRemote.d.ts +12 -0
  249. package/server/gitRemote.js +37 -38
  250. package/server/gitRemote.js.map +1 -0
  251. package/server/htmlText.d.ts +4 -0
  252. package/server/htmlText.js +16 -23
  253. package/server/htmlText.js.map +1 -0
  254. package/server/http.d.ts +5 -0
  255. package/server/http.js +27 -30
  256. package/server/http.js.map +1 -0
  257. package/server/httpGuards.d.ts +2 -0
  258. package/server/httpGuards.js +47 -43
  259. package/server/httpGuards.js.map +1 -0
  260. package/server/https.d.ts +34 -0
  261. package/server/https.js +121 -111
  262. package/server/https.js.map +1 -0
  263. package/server/index.d.ts +40 -0
  264. package/server/index.js +139 -147
  265. package/server/index.js.map +1 -0
  266. package/server/layout.d.ts +26 -0
  267. package/server/layout.js +59 -64
  268. package/server/layout.js.map +1 -0
  269. package/server/llmProxy.d.ts +3 -0
  270. package/server/llmProxy.js +137 -135
  271. package/server/llmProxy.js.map +1 -0
  272. package/server/logger.d.ts +38 -0
  273. package/server/logger.js +198 -211
  274. package/server/logger.js.map +1 -0
  275. package/server/mcp/analysis.d.ts +29 -0
  276. package/server/mcp/analysis.js +99 -120
  277. package/server/mcp/analysis.js.map +1 -0
  278. package/server/mcp/http.d.ts +9 -0
  279. package/server/mcp/http.js +128 -137
  280. package/server/mcp/http.js.map +1 -0
  281. package/server/mcp/runner.d.ts +68 -0
  282. package/server/mcp/runner.js +208 -218
  283. package/server/mcp/runner.js.map +1 -0
  284. package/server/mcp/server.d.ts +29 -0
  285. package/server/mcp/server.js +166 -179
  286. package/server/mcp/server.js.map +1 -0
  287. package/server/mcp/standalone.d.ts +1 -0
  288. package/server/mcp/standalone.js +8 -10
  289. package/server/mcp/standalone.js.map +1 -0
  290. package/server/mcp/tools.d.ts +2020 -0
  291. package/server/mcp/tools.js +523 -574
  292. package/server/mcp/tools.js.map +1 -0
  293. package/server/paths.d.ts +3 -0
  294. package/server/paths.js +17 -15
  295. package/server/paths.js.map +1 -0
  296. package/server/pidfile.d.ts +9 -0
  297. package/server/pidfile.js +43 -45
  298. package/server/pidfile.js.map +1 -0
  299. package/server/review.d.ts +5 -0
  300. package/server/review.js +35 -0
  301. package/server/review.js.map +1 -0
  302. package/server/router.d.ts +33 -0
  303. package/server/router.js +191 -197
  304. package/server/router.js.map +1 -0
  305. package/server/scanRequest.d.ts +3 -0
  306. package/server/scanRequest.js +36 -0
  307. package/server/scanRequest.js.map +1 -0
  308. package/server/searchIndex.d.ts +17 -0
  309. package/server/searchIndex.js +83 -80
  310. package/server/searchIndex.js.map +1 -0
  311. package/server/sessions.d.ts +14 -0
  312. package/server/sessions.js +62 -70
  313. package/server/sessions.js.map +1 -0
  314. package/server/startup.d.ts +118 -0
  315. package/server/startup.js +143 -148
  316. package/server/startup.js.map +1 -0
  317. package/server/static.d.ts +6 -0
  318. package/server/static.js +28 -31
  319. package/server/static.js.map +1 -0
  320. package/server/tools/install.d.ts +4 -0
  321. package/server/tools/install.js +176 -185
  322. package/server/tools/install.js.map +1 -0
  323. package/server/tools/parse.d.ts +8 -0
  324. package/server/tools/parse.js +112 -114
  325. package/server/tools/parse.js.map +1 -0
  326. package/server/tools/platform.d.ts +9 -0
  327. package/server/tools/platform.js +49 -47
  328. package/server/tools/platform.js.map +1 -0
  329. package/server/tools/registry.d.ts +137 -0
  330. package/server/tools/registry.js +173 -172
  331. package/server/tools/registry.js.map +1 -0
  332. package/server/tools/scan.d.ts +34 -0
  333. package/server/tools/scan.js +89 -98
  334. package/server/tools/scan.js.map +1 -0
  335. package/server/tools.d.ts +34 -0
  336. package/server/tools.js +94 -107
  337. package/server/tools.js.map +1 -0
  338. package/server/tunnel.d.ts +29 -0
  339. package/server/tunnel.js +61 -66
  340. package/server/tunnel.js.map +1 -0
  341. package/shared/analyzer/docs.d.ts +16 -0
  342. package/shared/analyzer/docs.js +99 -93
  343. package/shared/analyzer/docs.js.map +1 -0
  344. package/shared/analyzer/explainLocal.d.ts +4 -0
  345. package/shared/analyzer/explainLocal.js +122 -142
  346. package/shared/analyzer/explainLocal.js.map +1 -0
  347. package/shared/analyzer/github.d.ts +37 -0
  348. package/shared/analyzer/github.js +41 -43
  349. package/shared/analyzer/github.js.map +1 -0
  350. package/shared/analyzer/graph.d.ts +41 -0
  351. package/shared/analyzer/graph.js +393 -400
  352. package/shared/analyzer/graph.js.map +1 -0
  353. package/shared/analyzer/health.d.ts +33 -0
  354. package/shared/analyzer/health.js +197 -193
  355. package/shared/analyzer/health.js.map +1 -0
  356. package/shared/analyzer/history.d.ts +29 -0
  357. package/shared/analyzer/history.js +110 -111
  358. package/shared/analyzer/history.js.map +1 -0
  359. package/shared/analyzer/jsonConfig.d.ts +2 -0
  360. package/shared/analyzer/jsonConfig.js +61 -0
  361. package/shared/analyzer/jsonConfig.js.map +1 -0
  362. package/shared/analyzer/languages/csharp.d.ts +26 -0
  363. package/shared/analyzer/languages/csharp.js +83 -88
  364. package/shared/analyzer/languages/csharp.js.map +1 -0
  365. package/shared/analyzer/languages/generic.d.ts +23 -0
  366. package/shared/analyzer/languages/generic.js +94 -105
  367. package/shared/analyzer/languages/generic.js.map +1 -0
  368. package/shared/analyzer/languages/go.d.ts +24 -0
  369. package/shared/analyzer/languages/go.js +45 -54
  370. package/shared/analyzer/languages/go.js.map +1 -0
  371. package/shared/analyzer/languages/index.d.ts +6 -0
  372. package/shared/analyzer/languages/index.js +19 -20
  373. package/shared/analyzer/languages/index.js.map +1 -0
  374. package/shared/analyzer/languages/java.d.ts +20 -0
  375. package/shared/analyzer/languages/java.js +73 -78
  376. package/shared/analyzer/languages/java.js.map +1 -0
  377. package/shared/analyzer/languages/javascript.d.ts +12 -0
  378. package/shared/analyzer/languages/javascript.js +258 -209
  379. package/shared/analyzer/languages/javascript.js.map +1 -0
  380. package/shared/analyzer/languages/python.d.ts +23 -0
  381. package/shared/analyzer/languages/python.js +92 -100
  382. package/shared/analyzer/languages/python.js.map +1 -0
  383. package/shared/analyzer/languages/rust.d.ts +17 -0
  384. package/shared/analyzer/languages/rust.js +96 -98
  385. package/shared/analyzer/languages/rust.js.map +1 -0
  386. package/shared/analyzer/languages/typescript.d.ts +11 -0
  387. package/shared/analyzer/languages/typescript.js +117 -116
  388. package/shared/analyzer/languages/typescript.js.map +1 -0
  389. package/shared/analyzer/licenses.d.ts +18 -0
  390. package/shared/analyzer/licenses.js +130 -133
  391. package/shared/analyzer/licenses.js.map +1 -0
  392. package/shared/analyzer/metrics.d.ts +20 -0
  393. package/shared/analyzer/metrics.js +112 -104
  394. package/shared/analyzer/metrics.js.map +1 -0
  395. package/shared/analyzer/pathUtil.d.ts +10 -0
  396. package/shared/analyzer/pathUtil.js +29 -35
  397. package/shared/analyzer/pathUtil.js.map +1 -0
  398. package/shared/analyzer/patterns.d.ts +11 -0
  399. package/shared/analyzer/patterns.js +231 -253
  400. package/shared/analyzer/patterns.js.map +1 -0
  401. package/shared/analyzer/scan.d.ts +62 -0
  402. package/shared/analyzer/scan.js +451 -442
  403. package/shared/analyzer/scan.js.map +1 -0
  404. package/shared/analyzer/scanControl.d.ts +11 -0
  405. package/shared/analyzer/scanControl.js +62 -0
  406. package/shared/analyzer/scanControl.js.map +1 -0
  407. package/shared/analyzer/security.d.ts +18 -0
  408. package/shared/analyzer/security.js +159 -159
  409. package/shared/analyzer/security.js.map +1 -0
  410. package/shared/analyzer/services.d.ts +5 -0
  411. package/shared/analyzer/services.js +141 -138
  412. package/shared/analyzer/services.js.map +1 -0
  413. package/shared/analyzer/stack.d.ts +6 -0
  414. package/shared/analyzer/stack.js +134 -141
  415. package/shared/analyzer/stack.js.map +1 -0
  416. package/shared/analyzer/tour.d.ts +2 -0
  417. package/shared/analyzer/tour.js +45 -53
  418. package/shared/analyzer/tour.js.map +1 -0
  419. package/shared/analyzer/util.d.ts +8 -0
  420. package/shared/analyzer/util.js +130 -76
  421. package/shared/analyzer/util.js.map +1 -0
  422. package/shared/analyzer/workflows.d.ts +8 -0
  423. package/shared/analyzer/workflows.js +139 -134
  424. package/shared/analyzer/workflows.js.map +1 -0
  425. package/shared/contracts.d.ts +250 -0
  426. package/shared/contracts.js +2 -0
  427. package/shared/contracts.js.map +1 -0
  428. package/shared/diagram/aiFacts.d.ts +35 -0
  429. package/shared/diagram/aiFacts.js +102 -105
  430. package/shared/diagram/aiFacts.js.map +1 -0
  431. package/shared/diagram/aiMermaid.d.ts +5 -0
  432. package/shared/diagram/aiMermaid.js +46 -45
  433. package/shared/diagram/aiMermaid.js.map +1 -0
  434. package/shared/diagram/atlas.d.ts +16 -0
  435. package/shared/diagram/atlas.js +51 -60
  436. package/shared/diagram/atlas.js.map +1 -0
  437. package/shared/diagram/mermaid.d.ts +43 -0
  438. package/shared/diagram/mermaid.js +348 -370
  439. package/shared/diagram/mermaid.js.map +1 -0
  440. package/shared/review/contracts.d.ts +95 -0
  441. package/shared/review/contracts.js +2 -0
  442. package/shared/review/contracts.js.map +1 -0
  443. package/shared/review/review.d.ts +10 -0
  444. package/shared/review/review.js +184 -0
  445. package/shared/review/review.js.map +1 -0
  446. package/shared/search/query.d.ts +32 -0
  447. package/shared/search/query.js +395 -388
  448. package/shared/search/query.js.map +1 -0
@@ -7,52 +7,43 @@
7
7
  // at all — the C# analyzer sitting next to this one cannot, because a C# file
8
8
  // carries no path↔namespace correspondence to invert.
9
9
  import { blankComments, lineCounter, uniqueBy } from '../util.js';
10
-
11
10
  export const extensions = ['.java'];
12
-
13
11
  const PACKAGE_RE = /^[ \t]*package\s+([a-zA-Z0-9_.]+)\s*;/m;
14
-
15
12
  export function analyze(source, path) {
16
- const clean = blankComments(source);
17
- const lineAt = lineCounter(clean);
18
-
19
- // The file's own package, captured first because every import in the file is
20
- // resolved relative to it: `resolveImport` has to know where the source root
21
- // ends and the package begins, and this declaration is the only place that is
22
- // written down. A file with no `package` is in the default package, which is a
23
- // real (if unfashionable) case rather than an error.
24
- const packageName = (clean.match(PACKAGE_RE) || [])[1] || '';
25
-
26
- const imports = [];
27
- for (const m of clean.matchAll(/\bimport\s+(static\s+)?([a-zA-Z0-9_.]+)/g)) {
28
- // `packageName` rides along on the import so the resolver can do its job
29
- // from the import object alone — which is the fifth argument scan.js passes.
30
- imports.push({ spec: m[2], static: !!m[1], packageName, line: lineAt(m.index) });
31
- }
32
-
33
- const classes = [];
34
- for (const m of clean.matchAll(/(@[A-Za-z0-9_]+\s*)*\b(?:public\s+|private\s+|protected\s+)?(?:abstract\s+)?(?:class|interface|enum|record|@interface)\s+([a-zA-Z0-9_]+)/g)) {
35
- const annotations = [];
36
- if (m[1]) {
37
- for (const am of m[1].matchAll(/@([A-Za-z0-9_]+)/g)) {
38
- annotations.push(am[1]);
39
- }
13
+ const clean = blankComments(source);
14
+ const lineAt = lineCounter(clean);
15
+ // The file's own package, captured first because every import in the file is
16
+ // resolved relative to it: `resolveImport` has to know where the source root
17
+ // ends and the package begins, and this declaration is the only place that is
18
+ // written down. A file with no `package` is in the default package, which is a
19
+ // real (if unfashionable) case rather than an error.
20
+ const packageName = (clean.match(PACKAGE_RE) || [])[1] || '';
21
+ const imports = [];
22
+ for (const m of clean.matchAll(/\bimport\s+(static\s+)?([a-zA-Z0-9_.]+)/g)) {
23
+ // `packageName` rides along on the import so the resolver can do its job
24
+ // from the import object alone — which is the fifth argument scan.js passes.
25
+ imports.push({ spec: m[2], static: !!m[1], packageName, line: lineAt(m.index) });
40
26
  }
41
- classes.push({ name: m[2], annotations, line: lineAt(m.index) });
42
- }
43
-
44
- const hasMain = /public\s+static\s+void\s+main\s*\(/.test(clean);
45
-
46
- return {
47
- imports: uniqueBy(imports, (i) => i.spec + (i.static ? ' static' : '')),
48
- exports: classes.map(c => ({ name: c.name, kind: 'class' })),
49
- functions: [],
50
- classes,
51
- hasMain,
52
- packageName,
53
- };
27
+ const classes = [];
28
+ for (const m of clean.matchAll(/(@[A-Za-z0-9_]+\s*)*\b(?:public\s+|private\s+|protected\s+)?(?:abstract\s+)?(?:class|interface|enum|record|@interface)\s+([a-zA-Z0-9_]+)/g)) {
29
+ const annotations = [];
30
+ if (m[1]) {
31
+ for (const am of m[1].matchAll(/@([A-Za-z0-9_]+)/g)) {
32
+ annotations.push(am[1]);
33
+ }
34
+ }
35
+ classes.push({ name: m[2], annotations, line: lineAt(m.index) });
36
+ }
37
+ const hasMain = /public\s+static\s+void\s+main\s*\(/.test(clean);
38
+ return {
39
+ imports: uniqueBy(imports, (i) => i.spec + (i.static ? ' static' : '')),
40
+ exports: classes.map(c => ({ name: c.name, kind: 'class' })),
41
+ functions: [],
42
+ classes,
43
+ hasMain,
44
+ packageName,
45
+ };
54
46
  }
55
-
56
47
  // The source root: the part of this file's path that sits *above* its package.
57
48
  // `src/main/java/com/example/app/AppController.java` with package
58
49
  // `com.example.app` gives `src/main/java/` — and that prefix is exactly what
@@ -61,23 +52,25 @@ export function analyze(source, path) {
61
52
  // Returns '' when the file declares no package: with nothing to strip there is
62
53
  // no way to know where the root is, and guessing would mean inventing files.
63
54
  export function sourceRootFor(fromPath, packageName) {
64
- if (!packageName) return null;
65
- const suffix = packageName.replace(/\./g, '/');
66
- const normalized = String(fromPath).replace(/\\/g, '/');
67
- // Two shapes, and both are real. With a source root the package segment is
68
- // preceded by a directory (`src/main/java/com/acme/…`); in a project with no
69
- // root at all the path *begins* with the package (`com/acme/…`) and the root
70
- // is the empty string. That is not the same as "no root" — it is the repo top,
71
- // which is a perfectly good answer.
72
- const nested = normalized.lastIndexOf('/' + suffix + '/');
73
- if (nested >= 0) return normalized.slice(0, nested + 1);
74
- if (normalized === suffix || normalized.startsWith(suffix + '/')) return '';
75
- // The package is not in the path at all (a generated source dir, a file moved
76
- // out of its package). No root can be inferred, and inventing one would put a
77
- // node in the graph that does not exist.
78
- return null;
55
+ if (!packageName)
56
+ return null;
57
+ const suffix = packageName.replace(/\./g, '/');
58
+ const normalized = String(fromPath).replace(/\\/g, '/');
59
+ // Two shapes, and both are real. With a source root the package segment is
60
+ // preceded by a directory (`src/main/java/com/acme/…`); in a project with no
61
+ // root at all the path *begins* with the package (`com/acme/…`) and the root
62
+ // is the empty string. That is not the same as "no root" — it is the repo top,
63
+ // which is a perfectly good answer.
64
+ const nested = normalized.lastIndexOf('/' + suffix + '/');
65
+ if (nested >= 0)
66
+ return normalized.slice(0, nested + 1);
67
+ if (normalized === suffix || normalized.startsWith(suffix + '/'))
68
+ return '';
69
+ // The package is not in the path at all (a generated source dir, a file moved
70
+ // out of its package). No root can be inferred, and inventing one would put a
71
+ // node in the graph that does not exist.
72
+ return null;
79
73
  }
80
-
81
74
  // Candidate file paths for an import, longest spec first.
82
75
  //
83
76
  // The longest is the obvious one (`model.User` → `…/model/User.java`). The
@@ -88,27 +81,29 @@ export function sourceRootFor(fromPath, packageName) {
88
81
  // that exists. The static flag only decides where the walk starts, so the
89
82
  // common case does not pay for the rare one.
90
83
  function candidatesFor(spec, root, { static: isStatic = false } = {}) {
91
- const parts = spec.split('.').filter(Boolean);
92
- const out = [];
93
- const start = isStatic && parts.length > 1 ? 1 : 0;
94
- for (let end = parts.length; end > start; end -= 1) {
95
- out.push(root + parts.slice(0, end).join('/') + '.java');
96
- }
97
- return out;
84
+ const parts = spec.split('.').filter(Boolean);
85
+ const out = [];
86
+ const start = isStatic && parts.length > 1 ? 1 : 0;
87
+ for (let end = parts.length; end > start; end -= 1) {
88
+ out.push(root + parts.slice(0, end).join('/') + '.java');
89
+ }
90
+ return out;
98
91
  }
99
-
100
92
  export function resolveImport(spec, fromPath, has, context = {}, meta = {}) {
101
- const root = sourceRootFor(fromPath, meta.packageName);
102
- // `null` means "no root could be inferred". `''` means the root is the repo
103
- // top, which is the correct answer for a project laid out with no source root
104
- // at all — treating that as "no root" silently dropped every flat-layout import.
105
- if (root === null) return { unresolved: spec };
106
- for (const candidate of candidatesFor(spec, root, { static: meta.static })) {
107
- if (has(candidate)) return { path: candidate };
108
- }
109
- // Nothing in the repo matched. The JDK and every third-party library land
110
- // here, and staying `unresolved` is the honest answer: inventing a file would
111
- // put a node in the graph that does not exist. scan.js reports these by name
112
- // so the reader knows exactly what the analyzer could not place.
113
- return { unresolved: spec };
93
+ const root = sourceRootFor(fromPath, meta.packageName);
94
+ // `null` means "no root could be inferred". `''` means the root is the repo
95
+ // top, which is the correct answer for a project laid out with no source root
96
+ // at all — treating that as "no root" silently dropped every flat-layout import.
97
+ if (root === null)
98
+ return { unresolved: spec };
99
+ for (const candidate of candidatesFor(spec, root, { static: meta.static })) {
100
+ if (has(candidate))
101
+ return { path: candidate };
102
+ }
103
+ // Nothing in the repo matched. The JDK and every third-party library land
104
+ // here, and staying `unresolved` is the honest answer: inventing a file would
105
+ // put a node in the graph that does not exist. scan.js reports these by name
106
+ // so the reader knows exactly what the analyzer could not place.
107
+ return { unresolved: spec };
114
108
  }
109
+ //# sourceMappingURL=java.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"java.js","sourceRoot":"","sources":["../../../src/shared/analyzer/languages/java.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,sDAAsD;AACtD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,CAAC,M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4E;IAC5E,8EAA8E;IAC9E,iFAAiF;IACjF,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC/C,KAAK,MAAM,SAAS,IAAI,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QAC3E,IAAI,GAAG,CAAC,SAAS,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACjD,CAAC;IACD,0EAA0E;IAC1E,8EAA8E;IAC9E,6EAA6E;IAC7E,iEAAiE;IACjE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["// Java analyzer\n//\n// Java is package-rooted: a source file's path *is* its package spelled with\n// slashes, under a source root (`src/main/java` in Maven, `src/main/java` in\n// Gradle, or a plain directory in a one-off project). That single fact is what\n// turns an import into a file, and it is why Java can have a real import graph\n// at all — the C# analyzer sitting next to this one cannot, because a C# file\n// carries no path↔namespace correspondence to invert.\nimport { blankComments, lineCounter, uniqueBy } from '../util.js';\n\nexport const extensions = ['.java'];\n\nconst PACKAGE_RE = /^[ \\t]*package\\s+([a-zA-Z0-9_.]+)\\s*;/m;\n\nexport function analyze(source, path) {\n const clean = blankComments(source);\n const lineAt = lineCounter(clean);\n\n // The file's own package, captured first because every import in the file is\n // resolved relative to it: `resolveImport` has to know where the source root\n // ends and the package begins, and this declaration is the only place that is\n // written down. A file with no `package` is in the default package, which is a\n // real (if unfashionable) case rather than an error.\n const packageName = (clean.match(PACKAGE_RE) || [])[1] || '';\n\n const imports = [];\n for (const m of clean.matchAll(/\\bimport\\s+(static\\s+)?([a-zA-Z0-9_.]+)/g)) {\n // `packageName` rides along on the import so the resolver can do its job\n // from the import object alone — which is the fifth argument scan.js passes.\n imports.push({ spec: m[2], static: !!m[1], packageName, line: lineAt(m.index) });\n }\n\n const classes = [];\n for (const m of clean.matchAll(/(@[A-Za-z0-9_]+\\s*)*\\b(?:public\\s+|private\\s+|protected\\s+)?(?:abstract\\s+)?(?:class|interface|enum|record|@interface)\\s+([a-zA-Z0-9_]+)/g)) {\n const annotations = [];\n if (m[1]) {\n for (const am of m[1].matchAll(/@([A-Za-z0-9_]+)/g)) {\n annotations.push(am[1]);\n }\n }\n classes.push({ name: m[2], annotations, line: lineAt(m.index) });\n }\n\n const hasMain = /public\\s+static\\s+void\\s+main\\s*\\(/.test(clean);\n\n return {\n imports: uniqueBy(imports, (i) => i.spec + (i.static ? ' static' : '')),\n exports: classes.map(c => ({ name: c.name, kind: 'class' })),\n functions: [],\n classes,\n hasMain,\n packageName,\n };\n}\n\n// The source root: the part of this file's path that sits *above* its package.\n// `src/main/java/com/example/app/AppController.java` with package\n// `com.example.app` gives `src/main/java/` — and that prefix is exactly what\n// turns `com.example.model.User` into a path worth looking for.\n//\n// Returns '' when the file declares no package: with nothing to strip there is\n// no way to know where the root is, and guessing would mean inventing files.\nexport function sourceRootFor(fromPath, packageName) {\n if (!packageName) return null;\n const suffix = packageName.replace(/\\./g, '/');\n const normalized = String(fromPath).replace(/\\\\/g, '/');\n // Two shapes, and both are real. With a source root the package segment is\n // preceded by a directory (`src/main/java/com/acme/…`); in a project with no\n // root at all the path *begins* with the package (`com/acme/…`) and the root\n // is the empty string. That is not the same as \"no root\" — it is the repo top,\n // which is a perfectly good answer.\n const nested = normalized.lastIndexOf('/' + suffix + '/');\n if (nested >= 0) return normalized.slice(0, nested + 1);\n if (normalized === suffix || normalized.startsWith(suffix + '/')) return '';\n // The package is not in the path at all (a generated source dir, a file moved\n // out of its package). No root can be inferred, and inventing one would put a\n // node in the graph that does not exist.\n return null;\n}\n\n// Candidate file paths for an import, longest spec first.\n//\n// The longest is the obvious one (`model.User` → `…/model/User.java`). The\n// shorter ones exist because Java lets you import a *nested* type\n// (`com.example.Outer.Inner` lives in `Outer.java`) and a *static member*\n// (`com.example.Constants.MAX` lives in `Constants.java`). Rather than\n// special-case the syntax, walk back a segment at a time and take the first\n// that exists. The static flag only decides where the walk starts, so the\n// common case does not pay for the rare one.\nfunction candidatesFor(spec, root, { static: isStatic = false }: Record<string, any> = {}) {\n const parts = spec.split('.').filter(Boolean);\n const out = [];\n const start = isStatic && parts.length > 1 ? 1 : 0;\n for (let end = parts.length; end > start; end -= 1) {\n out.push(root + parts.slice(0, end).join('/') + '.java');\n }\n return out;\n}\n\nexport function resolveImport(spec, fromPath, has, context: Record<string, any> = {}, meta: Record<string, any> = {}) {\n const root = sourceRootFor(fromPath, meta.packageName);\n // `null` means \"no root could be inferred\". `''` means the root is the repo\n // top, which is the correct answer for a project laid out with no source root\n // at all — treating that as \"no root\" silently dropped every flat-layout import.\n if (root === null) return { unresolved: spec };\n for (const candidate of candidatesFor(spec, root, { static: meta.static })) {\n if (has(candidate)) return { path: candidate };\n }\n // Nothing in the repo matched. The JDK and every third-party library land\n // here, and staying `unresolved` is the honest answer: inventing a file would\n // put a node in the graph that does not exist. scan.js reports these by name\n // so the reader knows exactly what the analyzer could not place.\n return { unresolved: spec };\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { ResolverContext, ImportResolution } from '../../contracts.js';
2
+ export declare const extensions: string[];
3
+ export declare function analyze(source: any, path: any): {
4
+ imports: any[];
5
+ exports: any[];
6
+ functions: any[];
7
+ classes: any[];
8
+ calls: any[];
9
+ hasMain: boolean;
10
+ };
11
+ export declare function packageNameOf(spec: any): any;
12
+ export declare function resolveImport(spec: string, fromPath: string, has: (path: string) => boolean, context?: ResolverContext): ImportResolution;