@samchon/graph 0.1.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 (391) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/lib/AsyncSamchonGraphSource.d.ts +2 -0
  4. package/lib/AsyncSamchonGraphSource.js +3 -0
  5. package/lib/AsyncSamchonGraphSource.js.map +1 -0
  6. package/lib/SamchonGraphApplication.d.ts +10 -0
  7. package/lib/SamchonGraphApplication.js +64 -0
  8. package/lib/SamchonGraphApplication.js.map +1 -0
  9. package/lib/SamchonGraphSource.d.ts +2 -0
  10. package/lib/SamchonGraphSource.js +3 -0
  11. package/lib/SamchonGraphSource.js.map +1 -0
  12. package/lib/application.d.ts +3 -0
  13. package/lib/application.js +20 -0
  14. package/lib/application.js.map +1 -0
  15. package/lib/bin.d.ts +2 -0
  16. package/lib/bin.js +8 -0
  17. package/lib/bin.js.map +1 -0
  18. package/lib/index.d.ts +13 -0
  19. package/lib/index.js +30 -0
  20. package/lib/index.js.map +1 -0
  21. package/lib/indexer/IBuildGraphOptions.d.ts +41 -0
  22. package/lib/indexer/IBuildGraphOptions.js +3 -0
  23. package/lib/indexer/IBuildGraphOptions.js.map +1 -0
  24. package/lib/indexer/IIndexerResult.d.ts +5 -0
  25. package/lib/indexer/IIndexerResult.js +3 -0
  26. package/lib/indexer/IIndexerResult.js.map +1 -0
  27. package/lib/indexer/ILanguageSpec.d.ts +10 -0
  28. package/lib/indexer/ILanguageSpec.js +3 -0
  29. package/lib/indexer/ILanguageSpec.js.map +1 -0
  30. package/lib/indexer/LANGUAGE_SPECS.d.ts +2 -0
  31. package/lib/indexer/LANGUAGE_SPECS.js +114 -0
  32. package/lib/indexer/LANGUAGE_SPECS.js.map +1 -0
  33. package/lib/indexer/allExtensions.d.ts +2 -0
  34. package/lib/indexer/allExtensions.js +16 -0
  35. package/lib/indexer/allExtensions.js.map +1 -0
  36. package/lib/indexer/buildGraph.d.ts +3 -0
  37. package/lib/indexer/buildGraph.js +10 -0
  38. package/lib/indexer/buildGraph.js.map +1 -0
  39. package/lib/indexer/buildGraphDump.d.ts +3 -0
  40. package/lib/indexer/buildGraphDump.js +394 -0
  41. package/lib/indexer/buildGraphDump.js.map +1 -0
  42. package/lib/indexer/buildLspGraph.d.ts +3 -0
  43. package/lib/indexer/buildLspGraph.js +617 -0
  44. package/lib/indexer/buildLspGraph.js.map +1 -0
  45. package/lib/indexer/buildStaticGraph.d.ts +3 -0
  46. package/lib/indexer/buildStaticGraph.js +479 -0
  47. package/lib/indexer/buildStaticGraph.js.map +1 -0
  48. package/lib/indexer/decoratorsAbove.d.ts +1 -0
  49. package/lib/indexer/decoratorsAbove.js +14 -0
  50. package/lib/indexer/decoratorsAbove.js.map +1 -0
  51. package/lib/indexer/languageOf.d.ts +2 -0
  52. package/lib/indexer/languageOf.js +19 -0
  53. package/lib/indexer/languageOf.js.map +1 -0
  54. package/lib/indexer/languages.d.ts +5 -0
  55. package/lib/indexer/languages.js +22 -0
  56. package/lib/indexer/languages.js.map +1 -0
  57. package/lib/indexer/lspIndexer.d.ts +1 -0
  58. package/lib/indexer/lspIndexer.js +18 -0
  59. package/lib/indexer/lspIndexer.js.map +1 -0
  60. package/lib/indexer/overrideEdges.d.ts +2 -0
  61. package/lib/indexer/overrideEdges.js +45 -0
  62. package/lib/indexer/overrideEdges.js.map +1 -0
  63. package/lib/indexer/resolveType.d.ts +2 -0
  64. package/lib/indexer/resolveType.js +11 -0
  65. package/lib/indexer/resolveType.js.map +1 -0
  66. package/lib/indexer/specOf.d.ts +3 -0
  67. package/lib/indexer/specOf.js +8 -0
  68. package/lib/indexer/specOf.js.map +1 -0
  69. package/lib/indexer/staticIndexer.d.ts +1 -0
  70. package/lib/indexer/staticIndexer.js +18 -0
  71. package/lib/indexer/staticIndexer.js.map +1 -0
  72. package/lib/indexer/supertypesOf.d.ts +4 -0
  73. package/lib/indexer/supertypesOf.js +48 -0
  74. package/lib/indexer/supertypesOf.js.map +1 -0
  75. package/lib/lsp/DocumentSymbolResult.d.ts +3 -0
  76. package/lib/lsp/DocumentSymbolResult.js +3 -0
  77. package/lib/lsp/DocumentSymbolResult.js.map +1 -0
  78. package/lib/lsp/IDiagnostic.d.ts +8 -0
  79. package/lib/lsp/IDiagnostic.js +3 -0
  80. package/lib/lsp/IDiagnostic.js.map +1 -0
  81. package/lib/lsp/IDocumentSymbol.d.ts +9 -0
  82. package/lib/lsp/IDocumentSymbol.js +3 -0
  83. package/lib/lsp/IDocumentSymbol.js.map +1 -0
  84. package/lib/lsp/ILocation.d.ts +5 -0
  85. package/lib/lsp/ILocation.js +3 -0
  86. package/lib/lsp/ILocation.js.map +1 -0
  87. package/lib/lsp/IPosition.d.ts +4 -0
  88. package/lib/lsp/IPosition.js +3 -0
  89. package/lib/lsp/IPosition.js.map +1 -0
  90. package/lib/lsp/IRange.d.ts +5 -0
  91. package/lib/lsp/IRange.js +3 -0
  92. package/lib/lsp/IRange.js.map +1 -0
  93. package/lib/lsp/ISymbolInformation.d.ts +7 -0
  94. package/lib/lsp/ISymbolInformation.js +3 -0
  95. package/lib/lsp/ISymbolInformation.js.map +1 -0
  96. package/lib/lsp/LspClient.d.ts +17 -0
  97. package/lib/lsp/LspClient.js +140 -0
  98. package/lib/lsp/LspClient.js.map +1 -0
  99. package/lib/lsp/isDocumentSymbol.d.ts +3 -0
  100. package/lib/lsp/isDocumentSymbol.js +7 -0
  101. package/lib/lsp/isDocumentSymbol.js.map +1 -0
  102. package/lib/lsp/types.d.ts +8 -0
  103. package/lib/lsp/types.js +25 -0
  104. package/lib/lsp/types.js.map +1 -0
  105. package/lib/mcp/createServer.d.ts +3 -0
  106. package/lib/mcp/createServer.js +1947 -0
  107. package/lib/mcp/createServer.js.map +1 -0
  108. package/lib/mcp/startServer.d.ts +5 -0
  109. package/lib/mcp/startServer.js +23 -0
  110. package/lib/mcp/startServer.js.map +1 -0
  111. package/lib/model/GraphMemory.d.ts +25 -0
  112. package/lib/model/GraphMemory.js +141 -0
  113. package/lib/model/GraphMemory.js.map +1 -0
  114. package/lib/operations/bound.d.ts +1 -0
  115. package/lib/operations/bound.js +8 -0
  116. package/lib/operations/bound.js.map +1 -0
  117. package/lib/operations/common.d.ts +15 -0
  118. package/lib/operations/common.js +32 -0
  119. package/lib/operations/common.js.map +1 -0
  120. package/lib/operations/compareEdges.d.ts +2 -0
  121. package/lib/operations/compareEdges.js +10 -0
  122. package/lib/operations/compareEdges.js.map +1 -0
  123. package/lib/operations/edgeRank.d.ts +1 -0
  124. package/lib/operations/edgeRank.js +25 -0
  125. package/lib/operations/edgeRank.js.map +1 -0
  126. package/lib/operations/isExecution.d.ts +1 -0
  127. package/lib/operations/isExecution.js +11 -0
  128. package/lib/operations/isExecution.js.map +1 -0
  129. package/lib/operations/isPublicApiNoisePath.d.ts +2 -0
  130. package/lib/operations/isPublicApiNoisePath.js +11 -0
  131. package/lib/operations/isPublicApiNoisePath.js.map +1 -0
  132. package/lib/operations/isStructural.d.ts +1 -0
  133. package/lib/operations/isStructural.js +7 -0
  134. package/lib/operations/isStructural.js.map +1 -0
  135. package/lib/operations/isSupportPath.d.ts +2 -0
  136. package/lib/operations/isSupportPath.js +16 -0
  137. package/lib/operations/isSupportPath.js.map +1 -0
  138. package/lib/operations/isTestPath.d.ts +1 -0
  139. package/lib/operations/isTestPath.js +9 -0
  140. package/lib/operations/isTestPath.js.map +1 -0
  141. package/lib/operations/isTypeEdge.d.ts +1 -0
  142. package/lib/operations/isTypeEdge.js +11 -0
  143. package/lib/operations/isTypeEdge.js.map +1 -0
  144. package/lib/operations/publicEvidence.d.ts +2 -0
  145. package/lib/operations/publicEvidence.js +13 -0
  146. package/lib/operations/publicEvidence.js.map +1 -0
  147. package/lib/operations/referencesFromEdges.d.ts +3 -0
  148. package/lib/operations/referencesFromEdges.js +38 -0
  149. package/lib/operations/referencesFromEdges.js.map +1 -0
  150. package/lib/operations/resolveHandle.d.ts +6 -0
  151. package/lib/operations/resolveHandle.js +28 -0
  152. package/lib/operations/resolveHandle.js.map +1 -0
  153. package/lib/operations/resultGuide.d.ts +1 -0
  154. package/lib/operations/resultGuide.js +7 -0
  155. package/lib/operations/resultGuide.js.map +1 -0
  156. package/lib/operations/resultNext.d.ts +2 -0
  157. package/lib/operations/resultNext.js +7 -0
  158. package/lib/operations/resultNext.js.map +1 -0
  159. package/lib/operations/runDetails.d.ts +8 -0
  160. package/lib/operations/runDetails.js +190 -0
  161. package/lib/operations/runDetails.js.map +1 -0
  162. package/lib/operations/runEntrypoints.d.ts +9 -0
  163. package/lib/operations/runEntrypoints.js +122 -0
  164. package/lib/operations/runEntrypoints.js.map +1 -0
  165. package/lib/operations/runLookup.d.ts +10 -0
  166. package/lib/operations/runLookup.js +229 -0
  167. package/lib/operations/runLookup.js.map +1 -0
  168. package/lib/operations/runOverview.d.ts +10 -0
  169. package/lib/operations/runOverview.js +142 -0
  170. package/lib/operations/runOverview.js.map +1 -0
  171. package/lib/operations/runTour.d.ts +8 -0
  172. package/lib/operations/runTour.js +539 -0
  173. package/lib/operations/runTour.js.map +1 -0
  174. package/lib/operations/runTrace.d.ts +10 -0
  175. package/lib/operations/runTrace.js +283 -0
  176. package/lib/operations/runTrace.js.map +1 -0
  177. package/lib/operations/signatureOf.d.ts +2 -0
  178. package/lib/operations/signatureOf.js +45 -0
  179. package/lib/operations/signatureOf.js.map +1 -0
  180. package/lib/operations/subwords.d.ts +1 -0
  181. package/lib/operations/subwords.js +12 -0
  182. package/lib/operations/subwords.js.map +1 -0
  183. package/lib/operations/summaryOf.d.ts +2 -0
  184. package/lib/operations/summaryOf.js +24 -0
  185. package/lib/operations/summaryOf.js.map +1 -0
  186. package/lib/runGraph.d.ts +1 -0
  187. package/lib/runGraph.js +165 -0
  188. package/lib/runGraph.js.map +1 -0
  189. package/lib/structures/GraphEdgeKind.d.ts +10 -0
  190. package/lib/structures/GraphEdgeKind.js +3 -0
  191. package/lib/structures/GraphEdgeKind.js.map +1 -0
  192. package/lib/structures/GraphLanguage.d.ts +2 -0
  193. package/lib/structures/GraphLanguage.js +3 -0
  194. package/lib/structures/GraphLanguage.js.map +1 -0
  195. package/lib/structures/GraphNodeKind.d.ts +11 -0
  196. package/lib/structures/GraphNodeKind.js +3 -0
  197. package/lib/structures/GraphNodeKind.js.map +1 -0
  198. package/lib/structures/IGraphDecorator.d.ts +22 -0
  199. package/lib/structures/IGraphDecorator.js +3 -0
  200. package/lib/structures/IGraphDecorator.js.map +1 -0
  201. package/lib/structures/IGraphDetails.d.ts +126 -0
  202. package/lib/structures/IGraphDetails.js +3 -0
  203. package/lib/structures/IGraphDetails.js.map +1 -0
  204. package/lib/structures/IGraphDiagnostic.d.ts +23 -0
  205. package/lib/structures/IGraphDiagnostic.js +3 -0
  206. package/lib/structures/IGraphDiagnostic.js.map +1 -0
  207. package/lib/structures/IGraphDump.d.ts +37 -0
  208. package/lib/structures/IGraphDump.js +3 -0
  209. package/lib/structures/IGraphDump.js.map +1 -0
  210. package/lib/structures/IGraphEdge.d.ts +20 -0
  211. package/lib/structures/IGraphEdge.js +3 -0
  212. package/lib/structures/IGraphEdge.js.map +1 -0
  213. package/lib/structures/IGraphEntrypoints.d.ts +57 -0
  214. package/lib/structures/IGraphEntrypoints.js +3 -0
  215. package/lib/structures/IGraphEntrypoints.js.map +1 -0
  216. package/lib/structures/IGraphEscape.d.ts +40 -0
  217. package/lib/structures/IGraphEscape.js +3 -0
  218. package/lib/structures/IGraphEscape.js.map +1 -0
  219. package/lib/structures/IGraphEvidence.d.ts +24 -0
  220. package/lib/structures/IGraphEvidence.js +3 -0
  221. package/lib/structures/IGraphEvidence.js.map +1 -0
  222. package/lib/structures/IGraphLookup.d.ts +66 -0
  223. package/lib/structures/IGraphLookup.js +3 -0
  224. package/lib/structures/IGraphLookup.js.map +1 -0
  225. package/lib/structures/IGraphNext.d.ts +15 -0
  226. package/lib/structures/IGraphNext.js +3 -0
  227. package/lib/structures/IGraphNext.js.map +1 -0
  228. package/lib/structures/IGraphNode.d.ts +62 -0
  229. package/lib/structures/IGraphNode.js +3 -0
  230. package/lib/structures/IGraphNode.js.map +1 -0
  231. package/lib/structures/IGraphOverview.d.ts +100 -0
  232. package/lib/structures/IGraphOverview.js +3 -0
  233. package/lib/structures/IGraphOverview.js.map +1 -0
  234. package/lib/structures/IGraphTour.d.ts +54 -0
  235. package/lib/structures/IGraphTour.js +3 -0
  236. package/lib/structures/IGraphTour.js.map +1 -0
  237. package/lib/structures/IGraphTrace.d.ts +126 -0
  238. package/lib/structures/IGraphTrace.js +3 -0
  239. package/lib/structures/IGraphTrace.js.map +1 -0
  240. package/lib/structures/ISamchonGraphApplication.d.ts +162 -0
  241. package/lib/structures/ISamchonGraphApplication.js +3 -0
  242. package/lib/structures/ISamchonGraphApplication.js.map +1 -0
  243. package/lib/structures/index.d.ts +18 -0
  244. package/lib/structures/index.js +35 -0
  245. package/lib/structures/index.js.map +1 -0
  246. package/lib/structures.d.ts +1 -0
  247. package/lib/structures.js +18 -0
  248. package/lib/structures.js.map +1 -0
  249. package/lib/utils/DEFAULT_IGNORES.d.ts +1 -0
  250. package/lib/utils/DEFAULT_IGNORES.js +39 -0
  251. package/lib/utils/DEFAULT_IGNORES.js.map +1 -0
  252. package/lib/utils/IWalkOptions.d.ts +5 -0
  253. package/lib/utils/IWalkOptions.js +3 -0
  254. package/lib/utils/IWalkOptions.js.map +1 -0
  255. package/lib/utils/basename.d.ts +1 -0
  256. package/lib/utils/basename.js +10 -0
  257. package/lib/utils/basename.js.map +1 -0
  258. package/lib/utils/dirname.d.ts +1 -0
  259. package/lib/utils/dirname.js +10 -0
  260. package/lib/utils/dirname.js.map +1 -0
  261. package/lib/utils/fileFromUri.d.ts +1 -0
  262. package/lib/utils/fileFromUri.js +20 -0
  263. package/lib/utils/fileFromUri.js.map +1 -0
  264. package/lib/utils/fileUri.d.ts +1 -0
  265. package/lib/utils/fileUri.js +19 -0
  266. package/lib/utils/fileUri.js.map +1 -0
  267. package/lib/utils/fs.d.ts +6 -0
  268. package/lib/utils/fs.js +23 -0
  269. package/lib/utils/fs.js.map +1 -0
  270. package/lib/utils/isSubPath.d.ts +1 -0
  271. package/lib/utils/isSubPath.js +15 -0
  272. package/lib/utils/isSubPath.js.map +1 -0
  273. package/lib/utils/normalizePath.d.ts +1 -0
  274. package/lib/utils/normalizePath.js +7 -0
  275. package/lib/utils/normalizePath.js.map +1 -0
  276. package/lib/utils/path.d.ts +7 -0
  277. package/lib/utils/path.js +24 -0
  278. package/lib/utils/path.js.map +1 -0
  279. package/lib/utils/projectRelative.d.ts +1 -0
  280. package/lib/utils/projectRelative.js +9 -0
  281. package/lib/utils/projectRelative.js.map +1 -0
  282. package/lib/utils/readLines.d.ts +1 -0
  283. package/lib/utils/readLines.js +8 -0
  284. package/lib/utils/readLines.js.map +1 -0
  285. package/lib/utils/readText.d.ts +1 -0
  286. package/lib/utils/readText.js +17 -0
  287. package/lib/utils/readText.js.map +1 -0
  288. package/lib/utils/relativePath.d.ts +1 -0
  289. package/lib/utils/relativePath.js +12 -0
  290. package/lib/utils/relativePath.js.map +1 -0
  291. package/lib/utils/walkSourceFiles.d.ts +2 -0
  292. package/lib/utils/walkSourceFiles.js +44 -0
  293. package/lib/utils/walkSourceFiles.js.map +1 -0
  294. package/package.json +55 -0
  295. package/src/AsyncSamchonGraphSource.ts +5 -0
  296. package/src/SamchonGraphApplication.ts +74 -0
  297. package/src/SamchonGraphSource.ts +3 -0
  298. package/src/application.ts +3 -0
  299. package/src/bin.ts +6 -0
  300. package/src/index.ts +13 -0
  301. package/src/indexer/IBuildGraphOptions.ts +42 -0
  302. package/src/indexer/IIndexerResult.ts +6 -0
  303. package/src/indexer/ILanguageSpec.ts +11 -0
  304. package/src/indexer/LANGUAGE_SPECS.ts +112 -0
  305. package/src/indexer/allExtensions.ts +12 -0
  306. package/src/indexer/buildGraph.ts +10 -0
  307. package/src/indexer/buildGraphDump.ts +29 -0
  308. package/src/indexer/buildLspGraph.ts +710 -0
  309. package/src/indexer/buildStaticGraph.ts +507 -0
  310. package/src/indexer/decoratorsAbove.ts +9 -0
  311. package/src/indexer/languageOf.ts +13 -0
  312. package/src/indexer/languages.ts +5 -0
  313. package/src/indexer/lspIndexer.ts +1 -0
  314. package/src/indexer/overrideEdges.ts +42 -0
  315. package/src/indexer/resolveType.ts +14 -0
  316. package/src/indexer/specOf.ts +7 -0
  317. package/src/indexer/staticIndexer.ts +1 -0
  318. package/src/indexer/supertypesOf.ts +43 -0
  319. package/src/lsp/DocumentSymbolResult.ts +4 -0
  320. package/src/lsp/IDiagnostic.ts +9 -0
  321. package/src/lsp/IDocumentSymbol.ts +10 -0
  322. package/src/lsp/ILocation.ts +6 -0
  323. package/src/lsp/IPosition.ts +4 -0
  324. package/src/lsp/IRange.ts +6 -0
  325. package/src/lsp/ISymbolInformation.ts +8 -0
  326. package/src/lsp/LspClient.ts +165 -0
  327. package/src/lsp/isDocumentSymbol.ts +8 -0
  328. package/src/lsp/types.ts +8 -0
  329. package/src/mcp/createServer.ts +23 -0
  330. package/src/mcp/startServer.ts +23 -0
  331. package/src/model/GraphMemory.ts +165 -0
  332. package/src/operations/bound.ts +9 -0
  333. package/src/operations/common.ts +15 -0
  334. package/src/operations/compareEdges.ts +10 -0
  335. package/src/operations/edgeRank.ts +23 -0
  336. package/src/operations/isExecution.ts +9 -0
  337. package/src/operations/isPublicApiNoisePath.ts +10 -0
  338. package/src/operations/isStructural.ts +3 -0
  339. package/src/operations/isSupportPath.ts +16 -0
  340. package/src/operations/isTestPath.ts +7 -0
  341. package/src/operations/isTypeEdge.ts +9 -0
  342. package/src/operations/publicEvidence.ts +11 -0
  343. package/src/operations/referencesFromEdges.ts +37 -0
  344. package/src/operations/resolveHandle.ts +27 -0
  345. package/src/operations/resultGuide.ts +3 -0
  346. package/src/operations/resultNext.ts +9 -0
  347. package/src/operations/runDetails.ts +240 -0
  348. package/src/operations/runEntrypoints.ts +153 -0
  349. package/src/operations/runLookup.ts +269 -0
  350. package/src/operations/runOverview.ts +158 -0
  351. package/src/operations/runTour.ts +582 -0
  352. package/src/operations/runTrace.ts +339 -0
  353. package/src/operations/signatureOf.ts +40 -0
  354. package/src/operations/subwords.ts +8 -0
  355. package/src/operations/summaryOf.ts +21 -0
  356. package/src/runGraph.ts +144 -0
  357. package/src/structures/GraphEdgeKind.ts +24 -0
  358. package/src/structures/GraphLanguage.ts +21 -0
  359. package/src/structures/GraphNodeKind.ts +27 -0
  360. package/src/structures/IGraphDecorator.ts +25 -0
  361. package/src/structures/IGraphDetails.ts +153 -0
  362. package/src/structures/IGraphDiagnostic.ts +29 -0
  363. package/src/structures/IGraphDump.ts +45 -0
  364. package/src/structures/IGraphEdge.ts +24 -0
  365. package/src/structures/IGraphEntrypoints.ts +70 -0
  366. package/src/structures/IGraphEscape.ts +49 -0
  367. package/src/structures/IGraphEvidence.ts +29 -0
  368. package/src/structures/IGraphLookup.ts +80 -0
  369. package/src/structures/IGraphNext.ts +23 -0
  370. package/src/structures/IGraphNode.ts +76 -0
  371. package/src/structures/IGraphOverview.ts +121 -0
  372. package/src/structures/IGraphTour.ts +68 -0
  373. package/src/structures/IGraphTrace.ts +154 -0
  374. package/src/structures/ISamchonGraphApplication.ts +186 -0
  375. package/src/structures/index.ts +18 -0
  376. package/src/structures.ts +1 -0
  377. package/src/utils/DEFAULT_IGNORES.ts +35 -0
  378. package/src/utils/IWalkOptions.ts +5 -0
  379. package/src/utils/basename.ts +7 -0
  380. package/src/utils/dirname.ts +7 -0
  381. package/src/utils/fileFromUri.ts +14 -0
  382. package/src/utils/fileUri.ts +13 -0
  383. package/src/utils/fs.ts +6 -0
  384. package/src/utils/isSubPath.ts +9 -0
  385. package/src/utils/normalizePath.ts +3 -0
  386. package/src/utils/path.ts +7 -0
  387. package/src/utils/projectRelative.ts +6 -0
  388. package/src/utils/readLines.ts +5 -0
  389. package/src/utils/readText.ts +10 -0
  390. package/src/utils/relativePath.ts +7 -0
  391. package/src/utils/walkSourceFiles.ts +35 -0
@@ -0,0 +1,339 @@
1
+ import { GraphMemory } from "../model/GraphMemory";
2
+ import { IGraphEdge, IGraphNode, IGraphTrace } from "../structures";
3
+ import {
4
+ bound,
5
+ compareEdges,
6
+ edgeRank,
7
+ isExecution,
8
+ isTestPath,
9
+ isTypeEdge,
10
+ publicEvidence,
11
+ resolveHandle,
12
+ resultGuide,
13
+ resultNext,
14
+ signatureOf,
15
+ summaryOf,
16
+ } from "./common";
17
+
18
+ const DEFAULT_DEPTH = 2;
19
+ const DEFAULT_MAX_NODES = 6;
20
+ const MAX_OPEN_DEPTH = 2;
21
+ const MAX_OPEN_NODES = 8;
22
+ const MAX_IMPACT_DEPTH = 4;
23
+ const MAX_IMPACT_NODES = 16;
24
+ const MAX_HOPS_PER_NODE = 2;
25
+ const MAX_STEPS = 6;
26
+ const MAX_PATH_DEPTH = 12;
27
+
28
+ /**
29
+ * Breadth-first trace along the dependency graph. Structural
30
+ * (contains/exports/imports) edges are excluded so the path is real call/type
31
+ * flow; forward walks callees, reverse and impact walk callers. Impact
32
+ * additionally tags each reached node's role so the blast radius on the public
33
+ * surface is legible.
34
+ */
35
+ export function runTrace(
36
+ graph: GraphMemory,
37
+ props: IGraphTrace.IRequest,
38
+ ): IGraphTrace {
39
+ const direction = props.direction ?? "forward";
40
+ const focus = props.focus ?? "all";
41
+ const impact = direction === "impact";
42
+ const reverse = direction === "reverse" || direction === "impact";
43
+ const includeExternal = props.includeExternal === true;
44
+ const maxDepth = bound(
45
+ props.maxDepth,
46
+ DEFAULT_DEPTH,
47
+ 1,
48
+ impact ? MAX_IMPACT_DEPTH : MAX_OPEN_DEPTH,
49
+ );
50
+ const maxNodes = bound(
51
+ props.maxNodes,
52
+ DEFAULT_MAX_NODES,
53
+ 1,
54
+ impact ? MAX_IMPACT_NODES : MAX_OPEN_NODES,
55
+ );
56
+ const maxHops = maxNodes * MAX_HOPS_PER_NODE;
57
+
58
+ const start = resolveHandle(graph, props.from);
59
+ if (start.candidates !== undefined) {
60
+ return {
61
+ type: "trace",
62
+ direction,
63
+ hops: [],
64
+ reached: [],
65
+ truncated: false,
66
+ candidates: start.candidates.map((node) => traceNode(graph, node)),
67
+ next: resultNext("clarify", "The start handle is ambiguous; choose one candidate."),
68
+ guide: resultGuide("Disambiguate with returned candidates."),
69
+ };
70
+ }
71
+ if (start.node === undefined) {
72
+ return {
73
+ type: "trace",
74
+ direction,
75
+ hops: [],
76
+ reached: [],
77
+ truncated: false,
78
+ next: resultNext("clarify", "The start handle did not resolve in the graph."),
79
+ guide: resultGuide("Answer that the graph has no trace from this handle."),
80
+ };
81
+ }
82
+
83
+ // Path mode: with `to`, return the dependency path from `from` to `to`, the
84
+ // one-call answer for "how does A reach B", instead of an open-ended trace.
85
+ if (props.to !== undefined && props.to.trim() !== "") {
86
+ const target = resolveHandle(graph, props.to);
87
+ const startNode = traceNode(graph, start.node);
88
+ // Mirror the start handle: an ambiguous or unresolved target must ask to
89
+ // clarify, not report an empty path with next: "answer" (which reads as
90
+ // "no flow exists").
91
+ if (target.candidates !== undefined) {
92
+ return {
93
+ type: "trace",
94
+ direction: "path",
95
+ start: startNode,
96
+ hops: [],
97
+ reached: [],
98
+ truncated: false,
99
+ candidates: target.candidates.map((node) => traceNode(graph, node)),
100
+ next: resultNext("clarify", "The target handle is ambiguous; choose one candidate."),
101
+ guide: resultGuide("Disambiguate the target with returned candidates."),
102
+ };
103
+ }
104
+ if (target.node === undefined) {
105
+ return {
106
+ type: "trace",
107
+ direction: "path",
108
+ start: startNode,
109
+ hops: [],
110
+ reached: [],
111
+ truncated: false,
112
+ next: resultNext("clarify", "The target handle did not resolve in the graph."),
113
+ guide: resultGuide("Answer that the graph has no path to this target."),
114
+ };
115
+ }
116
+ const found = findPath(
117
+ graph,
118
+ start.node.id,
119
+ target.node.id,
120
+ bound(props.maxDepth, MAX_PATH_DEPTH, 1, MAX_PATH_DEPTH),
121
+ focus,
122
+ includeExternal,
123
+ );
124
+ return {
125
+ type: "trace",
126
+ direction: "path",
127
+ start: startNode,
128
+ target: traceNode(graph, target.node),
129
+ path: (found?.path ?? []).map((node, depth) => traceNode(graph, node, depth, true)),
130
+ hops: found?.hops ?? [],
131
+ reached: [],
132
+ truncated: false,
133
+ steps: steps(graph, found?.hops ?? []),
134
+ next: resultNext(
135
+ "answer",
136
+ "The path result is the flow answer; cite path nodes and evidence ranges.",
137
+ ),
138
+ guide: resultGuide("Use path, hops, and evidence as the flow answer."),
139
+ };
140
+ }
141
+
142
+ const hops: IGraphTrace.IHop[] = [];
143
+ const reached = new Map<string, IGraphTrace.INode>();
144
+ const visited = new Set<string>([start.node.id]);
145
+ let queue: Array<{ id: string; depth: number }> = [{ id: start.node.id, depth: 0 }];
146
+ let truncated = false;
147
+
148
+ while (queue.length > 0) {
149
+ const next: Array<{ id: string; depth: number }> = [];
150
+ for (const { id, depth } of queue) {
151
+ if (depth >= maxDepth) {
152
+ truncated = true;
153
+ continue;
154
+ }
155
+ const edges = orderedEdges(
156
+ graph,
157
+ reverse ? graph.incoming(id) : graph.outgoing(id),
158
+ impact,
159
+ ).filter((edge) => traversable(edge, focus));
160
+ for (const edge of edges) {
161
+ const otherId = reverse ? edge.from : edge.to;
162
+ const other = graph.node(otherId);
163
+ if (other === undefined || other.kind === "file") continue;
164
+ if (!includeExternal && other.external) continue;
165
+ const hop = hopOf(edge, depth + 1);
166
+ // A back-edge to the start or an already-reached node: record the hop;
167
+ // its endpoints are already represented.
168
+ if (visited.has(otherId)) {
169
+ if (hops.length >= maxHops) truncated = true;
170
+ else hops.push(hop);
171
+ continue;
172
+ }
173
+ // A new node past the cap is left unrepresented, so drop its hop too:
174
+ // every hop's endpoints stay resolvable in `reached`/`start`.
175
+ if (reached.size >= maxNodes) {
176
+ truncated = true;
177
+ continue;
178
+ }
179
+ if (hops.length >= maxHops) {
180
+ truncated = true;
181
+ continue;
182
+ }
183
+ visited.add(otherId);
184
+ reached.set(otherId, traceNode(graph, other, depth + 1, false, impact));
185
+ next.push({ id: otherId, depth: depth + 1 });
186
+ hops.push(hop);
187
+ }
188
+ }
189
+ queue = next;
190
+ }
191
+
192
+ return {
193
+ type: "trace",
194
+ start: traceNode(graph, start.node),
195
+ direction,
196
+ hops,
197
+ reached: [...reached.values()],
198
+ truncated,
199
+ steps: steps(graph, hops),
200
+ next: resultNext(
201
+ "answer",
202
+ "Steps, hops, reached nodes, and evidence ranges are the flow answer surface.",
203
+ ),
204
+ guide: resultGuide("Use steps, hops, reached nodes, and evidence ranges as the flow answer."),
205
+ };
206
+ }
207
+
208
+ function findPath(
209
+ graph: GraphMemory,
210
+ startId: string,
211
+ targetId: string,
212
+ maxDepth: number,
213
+ focus: IGraphTrace.IRequest["focus"],
214
+ includeExternal: boolean,
215
+ ): { path: IGraphNode[]; hops: IGraphTrace.IHop[] } | null {
216
+ const parent = new Map<string, { from: string; edge: IGraphEdge }>();
217
+ const queue: Array<{ id: string; depth: number }> = [{ id: startId, depth: 0 }];
218
+ const visited = new Set<string>([startId]);
219
+ while (queue.length > 0) {
220
+ const item = queue.shift()!;
221
+ /* c8 ignore next */
222
+ if (item.depth >= maxDepth) continue;
223
+ for (const edge of graph.outgoing(item.id).filter((e) => traversable(e, focus)).sort(compareEdges)) {
224
+ const other = graph.node(edge.to);
225
+ if (other === undefined || other.kind === "file") continue;
226
+ if (!includeExternal && other.external) continue;
227
+ if (visited.has(edge.to)) continue;
228
+ visited.add(edge.to);
229
+ parent.set(edge.to, { from: item.id, edge });
230
+ if (edge.to === targetId) {
231
+ const ids = [targetId];
232
+ let cursor = targetId;
233
+ while (cursor !== startId) {
234
+ const p = parent.get(cursor)!;
235
+ ids.unshift(p.from);
236
+ cursor = p.from;
237
+ }
238
+ const nodes = ids
239
+ .map((id) => graph.node(id))
240
+ .filter((node): node is IGraphNode => node !== undefined);
241
+ const pathHops: IGraphTrace.IHop[] = [];
242
+ for (let i = 1; i < ids.length; i++) {
243
+ const p = parent.get(ids[i]!);
244
+ if (p !== undefined) pathHops.push(hopOf(p.edge, i));
245
+ }
246
+ return { path: nodes, hops: pathHops };
247
+ }
248
+ queue.push({ id: edge.to, depth: item.depth + 1 });
249
+ }
250
+ }
251
+ return null;
252
+ }
253
+
254
+ /**
255
+ * Order edges before traversal. A normal trace ranks by edge kind then
256
+ * evidence; an impact trace ranks reached endpoints by public-surface role
257
+ * first so the blast radius on the exported/test surface leads.
258
+ */
259
+ // Only the impact BFS orders edges here, and it always traverses incoming
260
+ // edges, so the ranked endpoint is the edge's `from`.
261
+ function orderedEdges(
262
+ graph: GraphMemory,
263
+ edges: readonly IGraphEdge[],
264
+ impact: boolean,
265
+ ): readonly IGraphEdge[] {
266
+ if (!impact) return [...edges].sort(compareEdges);
267
+ return [...edges].sort(
268
+ (a, b) =>
269
+ impactEndpointRank(graph, a.from) - impactEndpointRank(graph, b.from) ||
270
+ edgeRank(a.kind) - edgeRank(b.kind) ||
271
+ (a.evidence?.startLine ?? 999_999) - (b.evidence?.startLine ?? 999_999),
272
+ );
273
+ }
274
+
275
+ function impactEndpointRank(graph: GraphMemory, id: string): number {
276
+ const node = graph.node(id);
277
+ // `id` is always an endpoint of a real graph edge, so it resolves.
278
+ /* c8 ignore next */
279
+ if (node === undefined) return 9;
280
+ if (isTestPath(node.file)) return 0;
281
+ if (node.exported) return 1;
282
+ if (node.external || node.ignored) return 4;
283
+ return 2;
284
+ }
285
+
286
+ function traversable(edge: IGraphEdge, focus: IGraphTrace.IRequest["focus"]): boolean {
287
+ if (edge.kind === "contains" || edge.kind === "exports" || edge.kind === "imports") {
288
+ return false;
289
+ }
290
+ if (focus === "execution") return isExecution(edge.kind);
291
+ if (focus === "types") return isTypeEdge(edge.kind);
292
+ return true;
293
+ }
294
+
295
+ function hopOf(edge: IGraphEdge, depth: number): IGraphTrace.IHop {
296
+ return {
297
+ from: edge.from,
298
+ to: edge.to,
299
+ kind: edge.kind,
300
+ depth,
301
+ ...(edge.evidence !== undefined ? { evidence: publicEvidence(edge.evidence) } : {}),
302
+ };
303
+ }
304
+
305
+ function traceNode(
306
+ graph: GraphMemory,
307
+ node: IGraphNode,
308
+ depth?: number,
309
+ withSignature = false,
310
+ withRoles = false,
311
+ ): IGraphTrace.INode {
312
+ const out: IGraphTrace.INode = {
313
+ ...summaryOf(node),
314
+ ...(depth !== undefined ? { depth } : {}),
315
+ };
316
+ if (withSignature) {
317
+ const signature = signatureOf(graph.project, node);
318
+ if (signature !== undefined) out.signature = signature;
319
+ }
320
+ if (withRoles) {
321
+ const roles: string[] = [];
322
+ if (node.exported) roles.push("exported");
323
+ if (isTestPath(node.file)) roles.push("test");
324
+ if (roles.length > 0) out.roles = roles;
325
+ }
326
+ return out;
327
+ }
328
+
329
+ function steps(graph: GraphMemory, hops: readonly IGraphTrace.IHop[]): string[] {
330
+ return hops.slice(0, MAX_STEPS).map((hop) => {
331
+ const from = graph.node(hop.from)!;
332
+ const to = graph.node(hop.to)!;
333
+ const lhs = from.qualifiedName ?? from.name;
334
+ const rhs = to.qualifiedName ?? to.name;
335
+ const at =
336
+ hop.evidence === undefined ? "" : ` at ${hop.evidence.file}:${hop.evidence.startLine}`;
337
+ return `${lhs} -[${hop.kind}${at}]-> ${rhs}`;
338
+ });
339
+ }
@@ -0,0 +1,40 @@
1
+ import path from "node:path";
2
+
3
+ import { IGraphNode } from "../structures";
4
+ import { readLines } from "../utils/fs";
5
+
6
+ export function signatureOf(project: string, node: IGraphNode): string | undefined {
7
+ if (node.signature !== undefined && node.signature.trim() !== "") {
8
+ return compactSignature(node.signature);
9
+ }
10
+ if (node.evidence === undefined || node.file === "") return undefined;
11
+ const lines = readLines(path.join(project, node.evidence.file));
12
+ if (lines === undefined) return undefined;
13
+ const start = Math.max(0, node.evidence.startLine - 1);
14
+ const end =
15
+ node.evidence.endLine === undefined
16
+ ? Math.min(lines.length, start + 4)
17
+ : Math.min(lines.length, node.evidence.endLine);
18
+ const out: string[] = [];
19
+ for (let i = start; i < end && out.length < 4; i++) {
20
+ const line = lines[i];
21
+ /* c8 ignore next */
22
+ if (line === undefined) break;
23
+ out.push(line);
24
+ const trimmed = line.trimEnd();
25
+ if (trimmed.endsWith(";") || trimmed.endsWith("{") || trimmed.endsWith("}")) {
26
+ break;
27
+ }
28
+ }
29
+ const text = out.join("\n").trim();
30
+ return text === "" ? undefined : compactSignature(text);
31
+ }
32
+
33
+ function compactSignature(text: string): string {
34
+ return text
35
+ .split(/\r?\n/)
36
+ .slice(0, 4)
37
+ .join("\n")
38
+ .replace(/\s+$/gm, "")
39
+ .trim();
40
+ }
@@ -0,0 +1,8 @@
1
+ export function subwords(text: string): string[] {
2
+ return text
3
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
4
+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2")
5
+ .split(/[^a-zA-Z0-9_$]+/)
6
+ .map((word) => word.toLowerCase())
7
+ .filter((word) => word.length > 0);
8
+ }
@@ -0,0 +1,21 @@
1
+ import { IGraphNode, IGraphOverview } from "../structures";
2
+
3
+ export function summaryOf(node: IGraphNode): IGraphOverview.INode {
4
+ const out: IGraphOverview.INode = {
5
+ id: node.id,
6
+ name: node.qualifiedName ?? node.name,
7
+ kind: node.kind,
8
+ language: node.language,
9
+ file: node.file,
10
+ };
11
+ if (node.evidence?.startLine !== undefined) out.line = node.evidence.startLine;
12
+ const span = node.implementation ?? node.evidence;
13
+ if (span !== undefined) {
14
+ out.sourceSpan = {
15
+ file: span.file,
16
+ startLine: span.startLine,
17
+ ...(span.endLine !== undefined ? { endLine: span.endLine } : {}),
18
+ };
19
+ }
20
+ return out;
21
+ }
@@ -0,0 +1,144 @@
1
+ import { buildGraph } from "./indexer/buildGraph";
2
+ import { buildGraphDump } from "./indexer/buildGraphDump";
3
+ import { LANGUAGE_SPECS } from "./indexer/LANGUAGE_SPECS";
4
+ import { GraphLanguage } from "./structures";
5
+ import { startServer } from "./mcp/startServer";
6
+ import packageJson from "../package.json";
7
+
8
+ const VERSION: string = packageJson.version;
9
+
10
+ export function runGraph(argv: readonly string[] = process.argv.slice(2)): number | void {
11
+ try {
12
+ if (argv[0] === "dump") {
13
+ void runDump(argv.slice(1));
14
+ return;
15
+ }
16
+ if (argv[0] === "help" || argv[0] === "--help" || argv[0] === "-h") {
17
+ process.stdout.write(helpText());
18
+ return 0;
19
+ }
20
+
21
+ const options = parseArgs(argv);
22
+ void startServer({ ...options, version: VERSION }).catch((error: Error) => {
23
+ /* c8 ignore next 2 */
24
+ writeError(error);
25
+ process.exit(1);
26
+ });
27
+ } catch (error) {
28
+ writeError(error as Error);
29
+ return 1;
30
+ }
31
+ }
32
+
33
+ async function runDump(argv: readonly string[]): Promise<void> {
34
+ try {
35
+ const dump = await buildGraphDump(parseArgs(argv));
36
+ process.stdout.write(`${JSON.stringify(dump, null, 2)}\n`);
37
+ } catch (error) {
38
+ writeError(error as Error);
39
+ process.exitCode = 1;
40
+ }
41
+ }
42
+
43
+ function parseArgs(argv: readonly string[]) {
44
+ const options: Parameters<typeof buildGraph>[0] & { graphFile?: string } = {};
45
+ for (let i = 0; i < argv.length; i++) {
46
+ const arg = argv[i]!;
47
+ const next = (): string => {
48
+ const value = argv[++i];
49
+ if (value === undefined) throw new Error(`Missing value for ${arg}`);
50
+ return value;
51
+ };
52
+ if (arg === "--cwd") options.cwd = next();
53
+ else if (arg.startsWith("--cwd=")) options.cwd = arg.slice("--cwd=".length);
54
+ else if (arg === "--mode") options.mode = parseMode(next());
55
+ else if (arg.startsWith("--mode=")) options.mode = parseMode(arg.slice("--mode=".length));
56
+ else if (arg === "--language") options.languages = [...(options.languages ?? []), parseLanguage(next())];
57
+ else if (arg.startsWith("--language=")) {
58
+ options.languages = [
59
+ ...(options.languages ?? []),
60
+ parseLanguage(arg.slice("--language=".length)),
61
+ ];
62
+ } else if (arg === "--server") options.server = next();
63
+ else if (arg.startsWith("--server=")) options.server = arg.slice("--server=".length);
64
+ else if (arg === "--server-arg") {
65
+ options.serverArgs = [...(options.serverArgs ?? []), next()];
66
+ } else if (arg.startsWith("--server-arg=")) {
67
+ options.serverArgs = [
68
+ ...(options.serverArgs ?? []),
69
+ arg.slice("--server-arg=".length),
70
+ ];
71
+ } else if (arg === "--max-files") options.maxFiles = parseInteger(next());
72
+ else if (arg.startsWith("--max-files=")) {
73
+ options.maxFiles = parseInteger(arg.slice("--max-files=".length));
74
+ } else if (arg === "--lsp-timeout-ms") {
75
+ options.lspTimeoutMs = parseInteger(next());
76
+ } else if (arg.startsWith("--lsp-timeout-ms=")) {
77
+ options.lspTimeoutMs = parseInteger(arg.slice("--lsp-timeout-ms=".length));
78
+ } else if (arg === "--lsp-reference-limit") {
79
+ options.lspReferenceLimit = parseInteger(next());
80
+ } else if (arg.startsWith("--lsp-reference-limit=")) {
81
+ options.lspReferenceLimit = parseInteger(arg.slice("--lsp-reference-limit=".length));
82
+ } else if (arg === "--lsp-concurrency") {
83
+ options.lspConcurrency = parseInteger(next());
84
+ } else if (arg.startsWith("--lsp-concurrency=")) {
85
+ options.lspConcurrency = parseInteger(arg.slice("--lsp-concurrency=".length));
86
+ } else if (arg === "--lsp-warmup-timeout-ms") {
87
+ options.lspWarmupTimeoutMs = parseInteger(next());
88
+ } else if (arg.startsWith("--lsp-warmup-timeout-ms=")) {
89
+ options.lspWarmupTimeoutMs = parseInteger(arg.slice("--lsp-warmup-timeout-ms=".length));
90
+ } else if (arg === "--graph-file") {
91
+ options.graphFile = next();
92
+ } else if (arg.startsWith("--graph-file=")) {
93
+ options.graphFile = arg.slice("--graph-file=".length);
94
+ } else {
95
+ throw new Error(`Unknown argument: ${arg}`);
96
+ }
97
+ }
98
+ return options;
99
+ }
100
+
101
+ function parseMode(value: string): "auto" | "lsp" | "static" {
102
+ if (value === "auto" || value === "lsp" || value === "static") return value;
103
+ throw new Error(`Invalid --mode: ${value}`);
104
+ }
105
+
106
+ const ALLOWED_LANGUAGES = new Set<string>([
107
+ ...LANGUAGE_SPECS.map((spec) => spec.language),
108
+ "unknown",
109
+ ]);
110
+
111
+ function parseLanguage(value: string): GraphLanguage {
112
+ if (!ALLOWED_LANGUAGES.has(value)) throw new Error(`Invalid --language: ${value}`);
113
+ return value as GraphLanguage;
114
+ }
115
+
116
+ function parseInteger(value: string): number {
117
+ const parsed = Number(value);
118
+ if (!Number.isFinite(parsed) || parsed < 1) {
119
+ throw new Error(`Expected positive integer, got: ${value}`);
120
+ }
121
+ return Math.floor(parsed);
122
+ }
123
+
124
+ function helpText(): string {
125
+ return `@samchon/graph
126
+
127
+ Usage:
128
+ samchon-graph [--cwd DIR] [--mode auto|lsp|static] [--language LANG]
129
+ samchon-graph dump [same options]
130
+
131
+ Options:
132
+ --server CMD Override the language server command.
133
+ --server-arg ARG Add one language server argument.
134
+ --max-files N Cap source files indexed.
135
+ --lsp-timeout-ms N Per-request LSP timeout.
136
+ --lsp-reference-limit N Reference targets to collect edges for.
137
+ --lsp-concurrency N Concurrent reference requests.
138
+ --graph-file PATH Serve a pre-built dump instead of indexing.
139
+ `;
140
+ }
141
+
142
+ function writeError(error: Error): void {
143
+ process.stderr.write(`@samchon/graph: ${error.message}\n`);
144
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The relationship a directed edge encodes between two {@link IGraphNode}s.
3
+ *
4
+ * Structural edges (`contains`, `exports`, `imports`) come from the declaration
5
+ * pass. Value and type edges (`calls`, `accesses`, `instantiates`, `type_ref`,
6
+ * `extends`, `implements`, `overrides`, `renders`) are resolved by the language
7
+ * server — `renders` is a component use. `decorates` carries a decorator fact
8
+ * and `tests` a test-to-subject relationship.
9
+ */
10
+ export type GraphEdgeKind =
11
+ | "contains"
12
+ | "exports"
13
+ | "imports"
14
+ | "calls"
15
+ | "accesses"
16
+ | "instantiates"
17
+ | "type_ref"
18
+ | "extends"
19
+ | "implements"
20
+ | "overrides"
21
+ | "decorates"
22
+ | "renders"
23
+ | "tests"
24
+ | "references";
@@ -0,0 +1,21 @@
1
+ /** A source language a graph node can be declared in. */
2
+ export type GraphLanguage =
3
+ | "typescript"
4
+ | "javascript"
5
+ | "go"
6
+ | "rust"
7
+ | "cpp"
8
+ | "c"
9
+ | "java"
10
+ | "csharp"
11
+ | "kotlin"
12
+ | "swift"
13
+ | "scala"
14
+ | "zig"
15
+ | "python"
16
+ | "ruby"
17
+ | "php"
18
+ | "lua"
19
+ | "bash"
20
+ | "dart"
21
+ | "unknown";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What a graph node represents.
3
+ *
4
+ * The symbol kinds (`file` through `constructor`) are declarations the language
5
+ * server owns and resolves. `external_symbol` is a dependency-boundary leaf the
6
+ * workspace references but does not declare. The graph keeps it as a named
7
+ * endpoint without walking into the dependency's internals.
8
+ *
9
+ * Used as the `kind` discriminant on {@link IGraphNode}.
10
+ */
11
+ export type GraphNodeKind =
12
+ | "file"
13
+ | "package"
14
+ | "namespace"
15
+ | "module"
16
+ | "function"
17
+ | "class"
18
+ | "interface"
19
+ | "type"
20
+ | "enum"
21
+ | "variable"
22
+ | "method"
23
+ | "property"
24
+ | "parameter"
25
+ | "field"
26
+ | "constructor"
27
+ | "external_symbol";
@@ -0,0 +1,25 @@
1
+ import { IGraphEvidence } from "./IGraphEvidence";
2
+
3
+ /**
4
+ * A decorator as written on a declaration, carried on the decorated
5
+ * {@link IGraphNode}'s `decorators`.
6
+ *
7
+ * The graph reports the decorator faithfully rather than interpreting any
8
+ * framework's convention: the `name` is the decorator as written (`Controller`,
9
+ * `Get`, `TypedRoute.Get`, ...), and statically resolvable literal arguments
10
+ * are preserved so a consumer can apply its own meaning without re-parsing
11
+ * source.
12
+ */
13
+ export interface IGraphDecorator {
14
+ /**
15
+ * The decorator name as written, qualified through its access path:
16
+ * `Controller`, `Get`, `TypedRoute.Get`, `MessagePattern`.
17
+ */
18
+ name: string;
19
+
20
+ /** The literal call arguments, in source order. Empty for a bare decorator. */
21
+ arguments?: string[];
22
+
23
+ /** The decorator expression span, for display. */
24
+ evidence?: IGraphEvidence;
25
+ }