@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.
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/lib/AsyncSamchonGraphSource.d.ts +2 -0
- package/lib/AsyncSamchonGraphSource.js +3 -0
- package/lib/AsyncSamchonGraphSource.js.map +1 -0
- package/lib/SamchonGraphApplication.d.ts +10 -0
- package/lib/SamchonGraphApplication.js +64 -0
- package/lib/SamchonGraphApplication.js.map +1 -0
- package/lib/SamchonGraphSource.d.ts +2 -0
- package/lib/SamchonGraphSource.js +3 -0
- package/lib/SamchonGraphSource.js.map +1 -0
- package/lib/application.d.ts +3 -0
- package/lib/application.js +20 -0
- package/lib/application.js.map +1 -0
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +8 -0
- package/lib/bin.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +30 -0
- package/lib/index.js.map +1 -0
- package/lib/indexer/IBuildGraphOptions.d.ts +41 -0
- package/lib/indexer/IBuildGraphOptions.js +3 -0
- package/lib/indexer/IBuildGraphOptions.js.map +1 -0
- package/lib/indexer/IIndexerResult.d.ts +5 -0
- package/lib/indexer/IIndexerResult.js +3 -0
- package/lib/indexer/IIndexerResult.js.map +1 -0
- package/lib/indexer/ILanguageSpec.d.ts +10 -0
- package/lib/indexer/ILanguageSpec.js +3 -0
- package/lib/indexer/ILanguageSpec.js.map +1 -0
- package/lib/indexer/LANGUAGE_SPECS.d.ts +2 -0
- package/lib/indexer/LANGUAGE_SPECS.js +114 -0
- package/lib/indexer/LANGUAGE_SPECS.js.map +1 -0
- package/lib/indexer/allExtensions.d.ts +2 -0
- package/lib/indexer/allExtensions.js +16 -0
- package/lib/indexer/allExtensions.js.map +1 -0
- package/lib/indexer/buildGraph.d.ts +3 -0
- package/lib/indexer/buildGraph.js +10 -0
- package/lib/indexer/buildGraph.js.map +1 -0
- package/lib/indexer/buildGraphDump.d.ts +3 -0
- package/lib/indexer/buildGraphDump.js +394 -0
- package/lib/indexer/buildGraphDump.js.map +1 -0
- package/lib/indexer/buildLspGraph.d.ts +3 -0
- package/lib/indexer/buildLspGraph.js +617 -0
- package/lib/indexer/buildLspGraph.js.map +1 -0
- package/lib/indexer/buildStaticGraph.d.ts +3 -0
- package/lib/indexer/buildStaticGraph.js +479 -0
- package/lib/indexer/buildStaticGraph.js.map +1 -0
- package/lib/indexer/decoratorsAbove.d.ts +1 -0
- package/lib/indexer/decoratorsAbove.js +14 -0
- package/lib/indexer/decoratorsAbove.js.map +1 -0
- package/lib/indexer/languageOf.d.ts +2 -0
- package/lib/indexer/languageOf.js +19 -0
- package/lib/indexer/languageOf.js.map +1 -0
- package/lib/indexer/languages.d.ts +5 -0
- package/lib/indexer/languages.js +22 -0
- package/lib/indexer/languages.js.map +1 -0
- package/lib/indexer/lspIndexer.d.ts +1 -0
- package/lib/indexer/lspIndexer.js +18 -0
- package/lib/indexer/lspIndexer.js.map +1 -0
- package/lib/indexer/overrideEdges.d.ts +2 -0
- package/lib/indexer/overrideEdges.js +45 -0
- package/lib/indexer/overrideEdges.js.map +1 -0
- package/lib/indexer/resolveType.d.ts +2 -0
- package/lib/indexer/resolveType.js +11 -0
- package/lib/indexer/resolveType.js.map +1 -0
- package/lib/indexer/specOf.d.ts +3 -0
- package/lib/indexer/specOf.js +8 -0
- package/lib/indexer/specOf.js.map +1 -0
- package/lib/indexer/staticIndexer.d.ts +1 -0
- package/lib/indexer/staticIndexer.js +18 -0
- package/lib/indexer/staticIndexer.js.map +1 -0
- package/lib/indexer/supertypesOf.d.ts +4 -0
- package/lib/indexer/supertypesOf.js +48 -0
- package/lib/indexer/supertypesOf.js.map +1 -0
- package/lib/lsp/DocumentSymbolResult.d.ts +3 -0
- package/lib/lsp/DocumentSymbolResult.js +3 -0
- package/lib/lsp/DocumentSymbolResult.js.map +1 -0
- package/lib/lsp/IDiagnostic.d.ts +8 -0
- package/lib/lsp/IDiagnostic.js +3 -0
- package/lib/lsp/IDiagnostic.js.map +1 -0
- package/lib/lsp/IDocumentSymbol.d.ts +9 -0
- package/lib/lsp/IDocumentSymbol.js +3 -0
- package/lib/lsp/IDocumentSymbol.js.map +1 -0
- package/lib/lsp/ILocation.d.ts +5 -0
- package/lib/lsp/ILocation.js +3 -0
- package/lib/lsp/ILocation.js.map +1 -0
- package/lib/lsp/IPosition.d.ts +4 -0
- package/lib/lsp/IPosition.js +3 -0
- package/lib/lsp/IPosition.js.map +1 -0
- package/lib/lsp/IRange.d.ts +5 -0
- package/lib/lsp/IRange.js +3 -0
- package/lib/lsp/IRange.js.map +1 -0
- package/lib/lsp/ISymbolInformation.d.ts +7 -0
- package/lib/lsp/ISymbolInformation.js +3 -0
- package/lib/lsp/ISymbolInformation.js.map +1 -0
- package/lib/lsp/LspClient.d.ts +17 -0
- package/lib/lsp/LspClient.js +140 -0
- package/lib/lsp/LspClient.js.map +1 -0
- package/lib/lsp/isDocumentSymbol.d.ts +3 -0
- package/lib/lsp/isDocumentSymbol.js +7 -0
- package/lib/lsp/isDocumentSymbol.js.map +1 -0
- package/lib/lsp/types.d.ts +8 -0
- package/lib/lsp/types.js +25 -0
- package/lib/lsp/types.js.map +1 -0
- package/lib/mcp/createServer.d.ts +3 -0
- package/lib/mcp/createServer.js +1947 -0
- package/lib/mcp/createServer.js.map +1 -0
- package/lib/mcp/startServer.d.ts +5 -0
- package/lib/mcp/startServer.js +23 -0
- package/lib/mcp/startServer.js.map +1 -0
- package/lib/model/GraphMemory.d.ts +25 -0
- package/lib/model/GraphMemory.js +141 -0
- package/lib/model/GraphMemory.js.map +1 -0
- package/lib/operations/bound.d.ts +1 -0
- package/lib/operations/bound.js +8 -0
- package/lib/operations/bound.js.map +1 -0
- package/lib/operations/common.d.ts +15 -0
- package/lib/operations/common.js +32 -0
- package/lib/operations/common.js.map +1 -0
- package/lib/operations/compareEdges.d.ts +2 -0
- package/lib/operations/compareEdges.js +10 -0
- package/lib/operations/compareEdges.js.map +1 -0
- package/lib/operations/edgeRank.d.ts +1 -0
- package/lib/operations/edgeRank.js +25 -0
- package/lib/operations/edgeRank.js.map +1 -0
- package/lib/operations/isExecution.d.ts +1 -0
- package/lib/operations/isExecution.js +11 -0
- package/lib/operations/isExecution.js.map +1 -0
- package/lib/operations/isPublicApiNoisePath.d.ts +2 -0
- package/lib/operations/isPublicApiNoisePath.js +11 -0
- package/lib/operations/isPublicApiNoisePath.js.map +1 -0
- package/lib/operations/isStructural.d.ts +1 -0
- package/lib/operations/isStructural.js +7 -0
- package/lib/operations/isStructural.js.map +1 -0
- package/lib/operations/isSupportPath.d.ts +2 -0
- package/lib/operations/isSupportPath.js +16 -0
- package/lib/operations/isSupportPath.js.map +1 -0
- package/lib/operations/isTestPath.d.ts +1 -0
- package/lib/operations/isTestPath.js +9 -0
- package/lib/operations/isTestPath.js.map +1 -0
- package/lib/operations/isTypeEdge.d.ts +1 -0
- package/lib/operations/isTypeEdge.js +11 -0
- package/lib/operations/isTypeEdge.js.map +1 -0
- package/lib/operations/publicEvidence.d.ts +2 -0
- package/lib/operations/publicEvidence.js +13 -0
- package/lib/operations/publicEvidence.js.map +1 -0
- package/lib/operations/referencesFromEdges.d.ts +3 -0
- package/lib/operations/referencesFromEdges.js +38 -0
- package/lib/operations/referencesFromEdges.js.map +1 -0
- package/lib/operations/resolveHandle.d.ts +6 -0
- package/lib/operations/resolveHandle.js +28 -0
- package/lib/operations/resolveHandle.js.map +1 -0
- package/lib/operations/resultGuide.d.ts +1 -0
- package/lib/operations/resultGuide.js +7 -0
- package/lib/operations/resultGuide.js.map +1 -0
- package/lib/operations/resultNext.d.ts +2 -0
- package/lib/operations/resultNext.js +7 -0
- package/lib/operations/resultNext.js.map +1 -0
- package/lib/operations/runDetails.d.ts +8 -0
- package/lib/operations/runDetails.js +190 -0
- package/lib/operations/runDetails.js.map +1 -0
- package/lib/operations/runEntrypoints.d.ts +9 -0
- package/lib/operations/runEntrypoints.js +122 -0
- package/lib/operations/runEntrypoints.js.map +1 -0
- package/lib/operations/runLookup.d.ts +10 -0
- package/lib/operations/runLookup.js +229 -0
- package/lib/operations/runLookup.js.map +1 -0
- package/lib/operations/runOverview.d.ts +10 -0
- package/lib/operations/runOverview.js +142 -0
- package/lib/operations/runOverview.js.map +1 -0
- package/lib/operations/runTour.d.ts +8 -0
- package/lib/operations/runTour.js +539 -0
- package/lib/operations/runTour.js.map +1 -0
- package/lib/operations/runTrace.d.ts +10 -0
- package/lib/operations/runTrace.js +283 -0
- package/lib/operations/runTrace.js.map +1 -0
- package/lib/operations/signatureOf.d.ts +2 -0
- package/lib/operations/signatureOf.js +45 -0
- package/lib/operations/signatureOf.js.map +1 -0
- package/lib/operations/subwords.d.ts +1 -0
- package/lib/operations/subwords.js +12 -0
- package/lib/operations/subwords.js.map +1 -0
- package/lib/operations/summaryOf.d.ts +2 -0
- package/lib/operations/summaryOf.js +24 -0
- package/lib/operations/summaryOf.js.map +1 -0
- package/lib/runGraph.d.ts +1 -0
- package/lib/runGraph.js +165 -0
- package/lib/runGraph.js.map +1 -0
- package/lib/structures/GraphEdgeKind.d.ts +10 -0
- package/lib/structures/GraphEdgeKind.js +3 -0
- package/lib/structures/GraphEdgeKind.js.map +1 -0
- package/lib/structures/GraphLanguage.d.ts +2 -0
- package/lib/structures/GraphLanguage.js +3 -0
- package/lib/structures/GraphLanguage.js.map +1 -0
- package/lib/structures/GraphNodeKind.d.ts +11 -0
- package/lib/structures/GraphNodeKind.js +3 -0
- package/lib/structures/GraphNodeKind.js.map +1 -0
- package/lib/structures/IGraphDecorator.d.ts +22 -0
- package/lib/structures/IGraphDecorator.js +3 -0
- package/lib/structures/IGraphDecorator.js.map +1 -0
- package/lib/structures/IGraphDetails.d.ts +126 -0
- package/lib/structures/IGraphDetails.js +3 -0
- package/lib/structures/IGraphDetails.js.map +1 -0
- package/lib/structures/IGraphDiagnostic.d.ts +23 -0
- package/lib/structures/IGraphDiagnostic.js +3 -0
- package/lib/structures/IGraphDiagnostic.js.map +1 -0
- package/lib/structures/IGraphDump.d.ts +37 -0
- package/lib/structures/IGraphDump.js +3 -0
- package/lib/structures/IGraphDump.js.map +1 -0
- package/lib/structures/IGraphEdge.d.ts +20 -0
- package/lib/structures/IGraphEdge.js +3 -0
- package/lib/structures/IGraphEdge.js.map +1 -0
- package/lib/structures/IGraphEntrypoints.d.ts +57 -0
- package/lib/structures/IGraphEntrypoints.js +3 -0
- package/lib/structures/IGraphEntrypoints.js.map +1 -0
- package/lib/structures/IGraphEscape.d.ts +40 -0
- package/lib/structures/IGraphEscape.js +3 -0
- package/lib/structures/IGraphEscape.js.map +1 -0
- package/lib/structures/IGraphEvidence.d.ts +24 -0
- package/lib/structures/IGraphEvidence.js +3 -0
- package/lib/structures/IGraphEvidence.js.map +1 -0
- package/lib/structures/IGraphLookup.d.ts +66 -0
- package/lib/structures/IGraphLookup.js +3 -0
- package/lib/structures/IGraphLookup.js.map +1 -0
- package/lib/structures/IGraphNext.d.ts +15 -0
- package/lib/structures/IGraphNext.js +3 -0
- package/lib/structures/IGraphNext.js.map +1 -0
- package/lib/structures/IGraphNode.d.ts +62 -0
- package/lib/structures/IGraphNode.js +3 -0
- package/lib/structures/IGraphNode.js.map +1 -0
- package/lib/structures/IGraphOverview.d.ts +100 -0
- package/lib/structures/IGraphOverview.js +3 -0
- package/lib/structures/IGraphOverview.js.map +1 -0
- package/lib/structures/IGraphTour.d.ts +54 -0
- package/lib/structures/IGraphTour.js +3 -0
- package/lib/structures/IGraphTour.js.map +1 -0
- package/lib/structures/IGraphTrace.d.ts +126 -0
- package/lib/structures/IGraphTrace.js +3 -0
- package/lib/structures/IGraphTrace.js.map +1 -0
- package/lib/structures/ISamchonGraphApplication.d.ts +162 -0
- package/lib/structures/ISamchonGraphApplication.js +3 -0
- package/lib/structures/ISamchonGraphApplication.js.map +1 -0
- package/lib/structures/index.d.ts +18 -0
- package/lib/structures/index.js +35 -0
- package/lib/structures/index.js.map +1 -0
- package/lib/structures.d.ts +1 -0
- package/lib/structures.js +18 -0
- package/lib/structures.js.map +1 -0
- package/lib/utils/DEFAULT_IGNORES.d.ts +1 -0
- package/lib/utils/DEFAULT_IGNORES.js +39 -0
- package/lib/utils/DEFAULT_IGNORES.js.map +1 -0
- package/lib/utils/IWalkOptions.d.ts +5 -0
- package/lib/utils/IWalkOptions.js +3 -0
- package/lib/utils/IWalkOptions.js.map +1 -0
- package/lib/utils/basename.d.ts +1 -0
- package/lib/utils/basename.js +10 -0
- package/lib/utils/basename.js.map +1 -0
- package/lib/utils/dirname.d.ts +1 -0
- package/lib/utils/dirname.js +10 -0
- package/lib/utils/dirname.js.map +1 -0
- package/lib/utils/fileFromUri.d.ts +1 -0
- package/lib/utils/fileFromUri.js +20 -0
- package/lib/utils/fileFromUri.js.map +1 -0
- package/lib/utils/fileUri.d.ts +1 -0
- package/lib/utils/fileUri.js +19 -0
- package/lib/utils/fileUri.js.map +1 -0
- package/lib/utils/fs.d.ts +6 -0
- package/lib/utils/fs.js +23 -0
- package/lib/utils/fs.js.map +1 -0
- package/lib/utils/isSubPath.d.ts +1 -0
- package/lib/utils/isSubPath.js +15 -0
- package/lib/utils/isSubPath.js.map +1 -0
- package/lib/utils/normalizePath.d.ts +1 -0
- package/lib/utils/normalizePath.js +7 -0
- package/lib/utils/normalizePath.js.map +1 -0
- package/lib/utils/path.d.ts +7 -0
- package/lib/utils/path.js +24 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/projectRelative.d.ts +1 -0
- package/lib/utils/projectRelative.js +9 -0
- package/lib/utils/projectRelative.js.map +1 -0
- package/lib/utils/readLines.d.ts +1 -0
- package/lib/utils/readLines.js +8 -0
- package/lib/utils/readLines.js.map +1 -0
- package/lib/utils/readText.d.ts +1 -0
- package/lib/utils/readText.js +17 -0
- package/lib/utils/readText.js.map +1 -0
- package/lib/utils/relativePath.d.ts +1 -0
- package/lib/utils/relativePath.js +12 -0
- package/lib/utils/relativePath.js.map +1 -0
- package/lib/utils/walkSourceFiles.d.ts +2 -0
- package/lib/utils/walkSourceFiles.js +44 -0
- package/lib/utils/walkSourceFiles.js.map +1 -0
- package/package.json +55 -0
- package/src/AsyncSamchonGraphSource.ts +5 -0
- package/src/SamchonGraphApplication.ts +74 -0
- package/src/SamchonGraphSource.ts +3 -0
- package/src/application.ts +3 -0
- package/src/bin.ts +6 -0
- package/src/index.ts +13 -0
- package/src/indexer/IBuildGraphOptions.ts +42 -0
- package/src/indexer/IIndexerResult.ts +6 -0
- package/src/indexer/ILanguageSpec.ts +11 -0
- package/src/indexer/LANGUAGE_SPECS.ts +112 -0
- package/src/indexer/allExtensions.ts +12 -0
- package/src/indexer/buildGraph.ts +10 -0
- package/src/indexer/buildGraphDump.ts +29 -0
- package/src/indexer/buildLspGraph.ts +710 -0
- package/src/indexer/buildStaticGraph.ts +507 -0
- package/src/indexer/decoratorsAbove.ts +9 -0
- package/src/indexer/languageOf.ts +13 -0
- package/src/indexer/languages.ts +5 -0
- package/src/indexer/lspIndexer.ts +1 -0
- package/src/indexer/overrideEdges.ts +42 -0
- package/src/indexer/resolveType.ts +14 -0
- package/src/indexer/specOf.ts +7 -0
- package/src/indexer/staticIndexer.ts +1 -0
- package/src/indexer/supertypesOf.ts +43 -0
- package/src/lsp/DocumentSymbolResult.ts +4 -0
- package/src/lsp/IDiagnostic.ts +9 -0
- package/src/lsp/IDocumentSymbol.ts +10 -0
- package/src/lsp/ILocation.ts +6 -0
- package/src/lsp/IPosition.ts +4 -0
- package/src/lsp/IRange.ts +6 -0
- package/src/lsp/ISymbolInformation.ts +8 -0
- package/src/lsp/LspClient.ts +165 -0
- package/src/lsp/isDocumentSymbol.ts +8 -0
- package/src/lsp/types.ts +8 -0
- package/src/mcp/createServer.ts +23 -0
- package/src/mcp/startServer.ts +23 -0
- package/src/model/GraphMemory.ts +165 -0
- package/src/operations/bound.ts +9 -0
- package/src/operations/common.ts +15 -0
- package/src/operations/compareEdges.ts +10 -0
- package/src/operations/edgeRank.ts +23 -0
- package/src/operations/isExecution.ts +9 -0
- package/src/operations/isPublicApiNoisePath.ts +10 -0
- package/src/operations/isStructural.ts +3 -0
- package/src/operations/isSupportPath.ts +16 -0
- package/src/operations/isTestPath.ts +7 -0
- package/src/operations/isTypeEdge.ts +9 -0
- package/src/operations/publicEvidence.ts +11 -0
- package/src/operations/referencesFromEdges.ts +37 -0
- package/src/operations/resolveHandle.ts +27 -0
- package/src/operations/resultGuide.ts +3 -0
- package/src/operations/resultNext.ts +9 -0
- package/src/operations/runDetails.ts +240 -0
- package/src/operations/runEntrypoints.ts +153 -0
- package/src/operations/runLookup.ts +269 -0
- package/src/operations/runOverview.ts +158 -0
- package/src/operations/runTour.ts +582 -0
- package/src/operations/runTrace.ts +339 -0
- package/src/operations/signatureOf.ts +40 -0
- package/src/operations/subwords.ts +8 -0
- package/src/operations/summaryOf.ts +21 -0
- package/src/runGraph.ts +144 -0
- package/src/structures/GraphEdgeKind.ts +24 -0
- package/src/structures/GraphLanguage.ts +21 -0
- package/src/structures/GraphNodeKind.ts +27 -0
- package/src/structures/IGraphDecorator.ts +25 -0
- package/src/structures/IGraphDetails.ts +153 -0
- package/src/structures/IGraphDiagnostic.ts +29 -0
- package/src/structures/IGraphDump.ts +45 -0
- package/src/structures/IGraphEdge.ts +24 -0
- package/src/structures/IGraphEntrypoints.ts +70 -0
- package/src/structures/IGraphEscape.ts +49 -0
- package/src/structures/IGraphEvidence.ts +29 -0
- package/src/structures/IGraphLookup.ts +80 -0
- package/src/structures/IGraphNext.ts +23 -0
- package/src/structures/IGraphNode.ts +76 -0
- package/src/structures/IGraphOverview.ts +121 -0
- package/src/structures/IGraphTour.ts +68 -0
- package/src/structures/IGraphTrace.ts +154 -0
- package/src/structures/ISamchonGraphApplication.ts +186 -0
- package/src/structures/index.ts +18 -0
- package/src/structures.ts +1 -0
- package/src/utils/DEFAULT_IGNORES.ts +35 -0
- package/src/utils/IWalkOptions.ts +5 -0
- package/src/utils/basename.ts +7 -0
- package/src/utils/dirname.ts +7 -0
- package/src/utils/fileFromUri.ts +14 -0
- package/src/utils/fileUri.ts +13 -0
- package/src/utils/fs.ts +6 -0
- package/src/utils/isSubPath.ts +9 -0
- package/src/utils/normalizePath.ts +3 -0
- package/src/utils/path.ts +7 -0
- package/src/utils/projectRelative.ts +6 -0
- package/src/utils/readLines.ts +5 -0
- package/src/utils/readText.ts +10 -0
- package/src/utils/relativePath.ts +7 -0
- package/src/utils/walkSourceFiles.ts +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeongho Nam
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# `@samchon/graph`
|
|
2
|
+
|
|
3
|
+
[](https://github.com/samchon/graph/blob/master/LICENSE) [](https://www.npmjs.com/package/@samchon/graph) [](https://www.npmjs.com/package/@samchon/graph) [](https://github.com/samchon/graph/actions?query=workflow%3Atest)
|
|
4
|
+
|
|
5
|
+
**A code graph that answers "how does this repo work?" without your agent reading the repo.**
|
|
6
|
+
|
|
7
|
+
`@samchon/graph` is an MCP server. It indexes a codebase — across **18 languages** — into a graph of declarations and their relationships, and answers an agent's orientation questions from that graph instead of from source files. The agent gets the map in one call rather than grepping and reading its way through dozens of files.
|
|
8
|
+
|
|
9
|
+
That collapses the token cost. On a 12-language benchmark it cuts the agent's tokens by a **median of 96%** on onboarding questions — while [`codegraph`](https://github.com/colbymchenry/codegraph) cuts 63% and [`serena`](https://github.com/oraios/serena) makes it *worse*.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
### 1. Add the MCP server
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -D @samchon/graph
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"samchon-graph": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["-y", "@samchon/graph"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Start the client from the project root. The server builds one resident graph and answers every MCP call from memory. With no language server installed it still works — the **static indexer** parses the source directly (every language indexes in ~1–2 seconds, even on large repositories).
|
|
33
|
+
|
|
34
|
+
### 2. Install a language server (optional, for compiler-grade edges)
|
|
35
|
+
|
|
36
|
+
A language server sharpens the graph with semantically-resolved edges. Install the one(s) for your stack — nothing else is auto-provided (an installed editor like VS Code does **not** expose a stdio language server):
|
|
37
|
+
|
|
38
|
+
| Language | Server | Install |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| TypeScript / JavaScript | `typescript-language-server` | `npm i -g typescript-language-server typescript` |
|
|
41
|
+
| Python | `pyright-langserver` | `npm i -g pyright` |
|
|
42
|
+
| Go | `gopls` | `go install golang.org/x/tools/gopls@latest` |
|
|
43
|
+
| Rust | `rust-analyzer` | `rustup component add rust-analyzer` |
|
|
44
|
+
| C / C++ | `clangd` | LLVM release, or your package manager |
|
|
45
|
+
| Java | `jdtls` | Eclipse JDT LS (needs JDK 21+) |
|
|
46
|
+
| C# | `csharp-ls` | `dotnet tool install -g csharp-ls` |
|
|
47
|
+
| Kotlin | `kotlin-language-server` | fwcd/kotlin-language-server |
|
|
48
|
+
| Swift | `sourcekit-lsp` | ships with the Swift toolchain |
|
|
49
|
+
| Scala | `metals` | `cs install metals` |
|
|
50
|
+
| Zig | `zls` | zigtools/zls |
|
|
51
|
+
| Ruby | `ruby-lsp` | `gem install ruby-lsp` |
|
|
52
|
+
| PHP | `intelephense` | `npm i -g intelephense` |
|
|
53
|
+
| Lua | `lua-language-server` | LuaLS/lua-language-server |
|
|
54
|
+
| Dart | `dart` | ships with the Dart SDK |
|
|
55
|
+
| Bash | `bash-language-server` | `npm i -g bash-language-server` |
|
|
56
|
+
|
|
57
|
+
Each server must be on `PATH`. If none is present for a file's language, that language falls back to the static indexer automatically.
|
|
58
|
+
|
|
59
|
+
### 3. TypeScript / JavaScript — the fast path
|
|
60
|
+
|
|
61
|
+
The community `typescript-language-server` is an unofficial wrapper over the classic `tsserver` and answers references one symbol at a time. For compiler-grade TS/JS graphs at native speed, point the server at **[`ttscserver`](https://github.com/samchon/ttsc)** (the `typescript-go`–backed LSP host) once it exposes the graph channel — tracked in [samchon/ttsc#335](https://github.com/samchon/ttsc/issues/335) and [#337](https://github.com/samchon/ttsc/issues/337).
|
|
62
|
+
|
|
63
|
+
## Benchmark
|
|
64
|
+
|
|
65
|
+
Reproduce the numbers yourself (spends real credits, never wired into CI):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm --filter @samchon/graph-benchmark corpus # 12 repos / 12 languages, pinned
|
|
69
|
+
pnpm --filter @samchon/graph-benchmark preflight # zero-spend go/no-go
|
|
70
|
+
pnpm --filter @samchon/graph-benchmark suite-codex -- --runs=1
|
|
71
|
+
pnpm --filter @samchon/graph-benchmark render # results -> SVG charts
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## How it works
|
|
75
|
+
|
|
76
|
+
The whole surface is one tool with one typed contract:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
export interface ISamchonGraphApplication {
|
|
80
|
+
inspect_code_graph(
|
|
81
|
+
props: ISamchonGraphApplication.IProps,
|
|
82
|
+
): Promise<ISamchonGraphApplication.IResult>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export namespace ISamchonGraphApplication {
|
|
86
|
+
export interface IProps {
|
|
87
|
+
question: string; // restate the code question
|
|
88
|
+
draft: IDraft; // intended request + why it is smallest
|
|
89
|
+
review: string; // correct the draft before committing
|
|
90
|
+
request:
|
|
91
|
+
| IGraphTour.IRequest // broad orientation / runtime flow
|
|
92
|
+
| IGraphLookup.IRequest // find a symbol
|
|
93
|
+
| IGraphTrace.IRequest // follow a flow
|
|
94
|
+
| IGraphDetails.IRequest // one symbol's facts
|
|
95
|
+
| IGraphEntrypoints.IRequest
|
|
96
|
+
| IGraphOverview.IRequest
|
|
97
|
+
| IGraphEscape.IRequest; // leave the graph
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface IDraft {
|
|
101
|
+
reason: string; // why this is the smallest useful step
|
|
102
|
+
type: IProps["request"]["type"]; // the request type being considered
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The other tools try to change what the agent does by *talking* to it — `serena` swaps in ~150 lines of system prompt, `codegraph` ships ~100 lines plus a skill file, both spent almost entirely on forbidding the agent from grepping anyway. `@samchon/graph` changes the **shape of the tool** instead:
|
|
108
|
+
|
|
109
|
+
- **One tool, not fifty.** `serena` buries its graph behind ~50 tools and the agent never finds the right one; `@samchon/graph` has exactly one, and a union type — filled in by the chain-of-thought — routes the request by construction instead of by persuasion.
|
|
110
|
+
- **CoT compliance, not a wall of rules.** A required schema field can't be skipped the way a prompt line can be ignored. `props` makes the model write `question` → `draft` → `review` before it may act — so it reasons first, and a `review`/`escape` step catches a wrong turn.
|
|
111
|
+
- **Index facts, not inlined source.** The result is names, signatures, and spans — never pasted file bodies. That is where the tokens actually go: the baseline agent blows its budget dumping source into context, while the graph answers the same question from the index.
|
|
112
|
+
- **It respects the agent, it doesn't cage it.** No "use this instead of Read." It states a condition, then tells the agent where to stop — so the agent reaches for the graph when it should and skips it when it shouldn't.
|
|
113
|
+
|
|
114
|
+
This is the design proven by the TypeScript-only predecessor, [`@ttsc/graph`](https://ttsc.dev/blog/i-made-ts-compiler-graph-mcp) — the launch post is the full autopsy of why the tools before it don't move the token bill. `@samchon/graph` generalizes it to 18 languages over LSP, with edges built by a single linear pass per file (a 2,000-file repo indexes in **~1.6 seconds**, re-indexed incrementally as source changes).
|
|
115
|
+
|
|
116
|
+
## Sponsors
|
|
117
|
+
|
|
118
|
+
[](https://github.com/sponsors/samchon)
|
|
119
|
+
|
|
120
|
+
Thanks for your support.
|
|
121
|
+
|
|
122
|
+
Your [donation](https://github.com/sponsors/samchon) encourages `@samchon/graph` development.
|
|
123
|
+
|
|
124
|
+
## References
|
|
125
|
+
|
|
126
|
+
- Predecessor: [`@ttsc/graph`](https://github.com/samchon/ttsc) — the TypeScript-only, compiler-powered original this generalizes.
|
|
127
|
+
- Compared against: [`codegraph`](https://github.com/colbymchenry/codegraph) and [`serena`](https://github.com/oraios/serena).
|
|
128
|
+
- Protocol: the [Model Context Protocol](https://modelcontextprotocol.io) and the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/).
|
|
129
|
+
- Validation & MCP surface: [`typia`](https://github.com/samchon/typia) and [`@typia/mcp`](https://github.com/samchon/typia).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncSamchonGraphSource.js","sourceRoot":"","sources":["../src/AsyncSamchonGraphSource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AsyncSamchonGraphSource } from "./AsyncSamchonGraphSource";
|
|
2
|
+
import { ISamchonGraphApplication } from "./structures";
|
|
3
|
+
export declare class SamchonGraphApplication implements ISamchonGraphApplication {
|
|
4
|
+
private readonly graph;
|
|
5
|
+
private promise?;
|
|
6
|
+
constructor(source: AsyncSamchonGraphSource);
|
|
7
|
+
inspect_code_graph(props: ISamchonGraphApplication.IProps): Promise<ISamchonGraphApplication.IResult>;
|
|
8
|
+
private escape;
|
|
9
|
+
private load;
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SamchonGraphApplication = void 0;
|
|
4
|
+
const common_1 = require("./operations/common");
|
|
5
|
+
const runDetails_1 = require("./operations/runDetails");
|
|
6
|
+
const runEntrypoints_1 = require("./operations/runEntrypoints");
|
|
7
|
+
const runLookup_1 = require("./operations/runLookup");
|
|
8
|
+
const runOverview_1 = require("./operations/runOverview");
|
|
9
|
+
const runTour_1 = require("./operations/runTour");
|
|
10
|
+
const runTrace_1 = require("./operations/runTrace");
|
|
11
|
+
class SamchonGraphApplication {
|
|
12
|
+
graph;
|
|
13
|
+
promise;
|
|
14
|
+
constructor(source) {
|
|
15
|
+
this.graph = typeof source === "function" ? source : () => source;
|
|
16
|
+
}
|
|
17
|
+
async inspect_code_graph(props) {
|
|
18
|
+
const graph = await this.load();
|
|
19
|
+
switch (props.request.type) {
|
|
20
|
+
case "entrypoints":
|
|
21
|
+
return { result: (0, runEntrypoints_1.runEntrypoints)(graph, props.request) };
|
|
22
|
+
case "lookup":
|
|
23
|
+
return { result: (0, runLookup_1.runLookup)(graph, props.request) };
|
|
24
|
+
case "trace":
|
|
25
|
+
return { result: (0, runTrace_1.runTrace)(graph, props.request) };
|
|
26
|
+
case "details":
|
|
27
|
+
return { result: (0, runDetails_1.runDetails)(graph, props.request) };
|
|
28
|
+
case "overview":
|
|
29
|
+
return { result: (0, runOverview_1.runOverview)(graph, props.request) };
|
|
30
|
+
case "tour":
|
|
31
|
+
return { result: (0, runTour_1.runTour)(graph, props.request) };
|
|
32
|
+
case "escape":
|
|
33
|
+
return { result: this.escape(props.request.reason, props.request.nextStep) };
|
|
34
|
+
default:
|
|
35
|
+
props.request;
|
|
36
|
+
throw new Error("Unknown graph request type");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
escape(reason, nextStep) {
|
|
40
|
+
return {
|
|
41
|
+
type: "escape",
|
|
42
|
+
skipped: true,
|
|
43
|
+
reason,
|
|
44
|
+
...(nextStep !== undefined ? { nextStep } : {}),
|
|
45
|
+
next: (0, common_1.resultNext)("outside", nextStep ?? "Graph evidence is exhausted or not the next evidence source."),
|
|
46
|
+
guide: (0, common_1.resultGuide)("Finish from existing graph evidence, state the graph gap, or ask for clarification."),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async load() {
|
|
50
|
+
// Cache the built graph on success only. Caching a rejected promise would
|
|
51
|
+
// brick the resident server for the whole session after one transient index
|
|
52
|
+
// failure (e.g. a slow language-server cold start); clear it so the next
|
|
53
|
+
// call rebuilds.
|
|
54
|
+
if (this.promise === undefined) {
|
|
55
|
+
this.promise = Promise.resolve(this.graph()).catch((error) => {
|
|
56
|
+
this.promise = undefined;
|
|
57
|
+
throw error;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return this.promise;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.SamchonGraphApplication = SamchonGraphApplication;
|
|
64
|
+
//# sourceMappingURL=SamchonGraphApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SamchonGraphApplication.js","sourceRoot":"","sources":["../src/SamchonGraphApplication.ts"],"names":[],"mappings":";;;AAEA,g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C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/E;gBACE,KAAK,CAAC,OAAuB,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,MAAc,EAAE,QAAiB;QAC9C,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,IAAI;YACb,MAAM;YACN,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/C,IAAI,EAAE,IAAA,mBAAU,EACd,SAAS,EACT,QAAQ,IAAI,8DAA8D,CAC3E;YACD,KAAK,EAAE,IAAA,oBAAW,EAChB,qFAAqF,CACtF;SACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,IAAI;QAChB,0EAA0E;QAC1E,4EAA4E;QAC5E,yEAAyE;QACzE,iBAAiB;QACjB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACpE,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;gBACzB,MAAM,KAAK,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SamchonGraphSource.js","sourceRoot":"","sources":["../src/SamchonGraphSource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AsyncSamchonGraphSource"), exports);
|
|
18
|
+
__exportStar(require("./SamchonGraphApplication"), exports);
|
|
19
|
+
__exportStar(require("./SamchonGraphSource"), exports);
|
|
20
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,4DAA0C;AAC1C,uDAAqC"}
|
package/lib/bin.d.ts
ADDED
package/lib/bin.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const code = (0, index_1.runGraph)(process.argv.slice(2));
|
|
6
|
+
if (typeof code === "number")
|
|
7
|
+
process.exitCode = code;
|
|
8
|
+
//# sourceMappingURL=bin.js.map
|
package/lib/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AAEA,mCAAmC;AAEnC,MAAM,IAAI,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,IAAI,OAAO,IAAI,KAAK,QAAQ;IAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./application";
|
|
2
|
+
export * from "./indexer/allExtensions";
|
|
3
|
+
export * from "./indexer/buildGraph";
|
|
4
|
+
export * from "./indexer/buildGraphDump";
|
|
5
|
+
export * from "./indexer/IBuildGraphOptions";
|
|
6
|
+
export * from "./indexer/IIndexerResult";
|
|
7
|
+
export * from "./indexer/ILanguageSpec";
|
|
8
|
+
export * from "./indexer/LANGUAGE_SPECS";
|
|
9
|
+
export * from "./indexer/languageOf";
|
|
10
|
+
export * from "./indexer/specOf";
|
|
11
|
+
export * from "./model/GraphMemory";
|
|
12
|
+
export * from "./runGraph";
|
|
13
|
+
export * from "./structures";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./application"), exports);
|
|
18
|
+
__exportStar(require("./indexer/allExtensions"), exports);
|
|
19
|
+
__exportStar(require("./indexer/buildGraph"), exports);
|
|
20
|
+
__exportStar(require("./indexer/buildGraphDump"), exports);
|
|
21
|
+
__exportStar(require("./indexer/IBuildGraphOptions"), exports);
|
|
22
|
+
__exportStar(require("./indexer/IIndexerResult"), exports);
|
|
23
|
+
__exportStar(require("./indexer/ILanguageSpec"), exports);
|
|
24
|
+
__exportStar(require("./indexer/LANGUAGE_SPECS"), exports);
|
|
25
|
+
__exportStar(require("./indexer/languageOf"), exports);
|
|
26
|
+
__exportStar(require("./indexer/specOf"), exports);
|
|
27
|
+
__exportStar(require("./model/GraphMemory"), exports);
|
|
28
|
+
__exportStar(require("./runGraph"), exports);
|
|
29
|
+
__exportStar(require("./structures"), exports);
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,0DAAwC;AACxC,uDAAqC;AACrC,2DAAyC;AACzC,+DAA6C;AAC7C,2DAAyC;AACzC,0DAAwC;AACxC,2DAAyC;AACzC,uDAAqC;AACrC,mDAAiC;AACjC,sDAAoC;AACpC,6CAA2B;AAC3B,+CAA6B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GraphLanguage } from "../structures";
|
|
2
|
+
export interface IBuildGraphOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
mode?: "auto" | "lsp" | "static";
|
|
5
|
+
languages?: GraphLanguage[];
|
|
6
|
+
server?: string;
|
|
7
|
+
serverArgs?: string[];
|
|
8
|
+
initializationOptions?: unknown;
|
|
9
|
+
maxFiles?: number;
|
|
10
|
+
lspReferenceLimit?: number;
|
|
11
|
+
lspTimeoutMs?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How many `textDocument/references` requests to keep in flight at once.
|
|
14
|
+
* Reference collection dominates indexing time on large repositories, and the
|
|
15
|
+
* requests are independent, so they are issued concurrently up to this bound.
|
|
16
|
+
*/
|
|
17
|
+
lspConcurrency?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum time to wait for a language server to finish its initial indexing
|
|
20
|
+
* (reported through `$/progress`) before collecting references. Servers such
|
|
21
|
+
* as rust-analyzer, clangd, and jdtls answer reference requests with nothing
|
|
22
|
+
* until indexing completes, so skipping this wait yields zero edges.
|
|
23
|
+
*/
|
|
24
|
+
lspReadyTimeoutMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* How long the server must stay silent on `$/progress` before its initial
|
|
27
|
+
* indexing is treated as settled. Also bounds the wait for servers that never
|
|
28
|
+
* report progress at all.
|
|
29
|
+
*/
|
|
30
|
+
lspReadyQuietMs?: number;
|
|
31
|
+
/**
|
|
32
|
+
* How long to wait for the FIRST `textDocument/references` request, which may
|
|
33
|
+
* trigger the server to build its cross-file reference index lazily. Once that
|
|
34
|
+
* one warmup request returns, later references are cache-fast and use the
|
|
35
|
+
* normal `lspTimeoutMs`. A timeout here means the server cannot answer
|
|
36
|
+
* references at all, so only structural edges are kept. Defaults to a patient
|
|
37
|
+
* budget (slow servers like ruby-lsp need it); fast servers answer instantly
|
|
38
|
+
* and never reach it.
|
|
39
|
+
*/
|
|
40
|
+
lspWarmupTimeoutMs?: number;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBuildGraphOptions.js","sourceRoot":"","sources":["../../src/indexer/IBuildGraphOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IIndexerResult.js","sourceRoot":"","sources":["../../src/indexer/IIndexerResult.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILanguageSpec.js","sourceRoot":"","sources":["../../src/indexer/ILanguageSpec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LANGUAGE_SPECS = void 0;
|
|
4
|
+
exports.LANGUAGE_SPECS = [
|
|
5
|
+
{
|
|
6
|
+
language: "typescript",
|
|
7
|
+
extensions: [".ts", ".tsx", ".mts", ".cts"],
|
|
8
|
+
lsp: { command: "typescript-language-server", args: ["--stdio"] },
|
|
9
|
+
lineComment: "//",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
language: "javascript",
|
|
13
|
+
extensions: [".js", ".jsx", ".mjs", ".cjs"],
|
|
14
|
+
lsp: { command: "typescript-language-server", args: ["--stdio"] },
|
|
15
|
+
lineComment: "//",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
language: "go",
|
|
19
|
+
extensions: [".go"],
|
|
20
|
+
lsp: { command: "gopls", args: [] },
|
|
21
|
+
lineComment: "//",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
language: "rust",
|
|
25
|
+
extensions: [".rs"],
|
|
26
|
+
lsp: { command: "rust-analyzer", args: [] },
|
|
27
|
+
lineComment: "//",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
language: "cpp",
|
|
31
|
+
extensions: [".cc", ".cpp", ".cxx", ".c++", ".hh", ".hpp", ".hxx", ".h++"],
|
|
32
|
+
lsp: { command: "clangd", args: [] },
|
|
33
|
+
lineComment: "//",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
language: "c",
|
|
37
|
+
extensions: [".c", ".h"],
|
|
38
|
+
lsp: { command: "clangd", args: [] },
|
|
39
|
+
lineComment: "//",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
language: "java",
|
|
43
|
+
extensions: [".java"],
|
|
44
|
+
lsp: { command: "jdtls", args: [] },
|
|
45
|
+
lineComment: "//",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
language: "csharp",
|
|
49
|
+
extensions: [".cs"],
|
|
50
|
+
lsp: { command: "csharp-ls", args: [] },
|
|
51
|
+
lineComment: "//",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
language: "kotlin",
|
|
55
|
+
extensions: [".kt", ".kts"],
|
|
56
|
+
lsp: { command: "kotlin-language-server", args: [] },
|
|
57
|
+
lineComment: "//",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
language: "swift",
|
|
61
|
+
extensions: [".swift"],
|
|
62
|
+
lsp: { command: "sourcekit-lsp", args: [] },
|
|
63
|
+
lineComment: "//",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
language: "scala",
|
|
67
|
+
extensions: [".scala", ".sc"],
|
|
68
|
+
lsp: { command: "metals", args: [] },
|
|
69
|
+
lineComment: "//",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
language: "zig",
|
|
73
|
+
extensions: [".zig"],
|
|
74
|
+
lsp: { command: "zls", args: [] },
|
|
75
|
+
lineComment: "//",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
language: "python",
|
|
79
|
+
extensions: [".py", ".pyi"],
|
|
80
|
+
lsp: { command: "pyright-langserver", args: ["--stdio"] },
|
|
81
|
+
lineComment: "#",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
language: "ruby",
|
|
85
|
+
extensions: [".rb", ".rake", ".gemspec"],
|
|
86
|
+
lsp: { command: "ruby-lsp", args: [] },
|
|
87
|
+
lineComment: "#",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
language: "php",
|
|
91
|
+
extensions: [".php", ".phtml"],
|
|
92
|
+
lsp: { command: "intelephense", args: ["--stdio"] },
|
|
93
|
+
lineComment: "//",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
language: "lua",
|
|
97
|
+
extensions: [".lua"],
|
|
98
|
+
lsp: { command: "lua-language-server", args: [] },
|
|
99
|
+
lineComment: "--",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
language: "bash",
|
|
103
|
+
extensions: [".sh", ".bash"],
|
|
104
|
+
lsp: { command: "bash-language-server", args: ["start"] },
|
|
105
|
+
lineComment: "#",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
language: "dart",
|
|
109
|
+
extensions: [".dart"],
|
|
110
|
+
lsp: { command: "dart", args: ["language-server"] },
|
|
111
|
+
lineComment: "//",
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
//# sourceMappingURL=LANGUAGE_SPECS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LANGUAGE_SPECS.js","sourceRoot":"","sources":["../../src/indexer/LANGUAGE_SPECS.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAoB;IAC7C;QACE,QAAQ,EAAE,YAAY;QACtB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC3C,GAAG,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;QACjE,WAAW,EAAE,IAAI;KAClB;IACD;QACE,QAAQ,EAAE,YAAY;QACtB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC3C,GAAG,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;QACjE,WAAW,EAAE,IAAI;KAClB;IACD;QACE,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,CAAC,KAAK,CAAC;QACnB,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QACnC,WAAW,EAAE,IAAI;KAClB;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,CAAC,KAAK,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AAE,CAAC,OAAO,CAAC,EAAE;QACzD,WAAW,EAAE,GAAG;KACjB;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,CAAC,OAAO,CAAC;QACrB,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,EAAE;QACnD,WAAW,EAAE,IAAI;KAClB;CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allExtensions = allExtensions;
|
|
4
|
+
const LANGUAGE_SPECS_1 = require("./LANGUAGE_SPECS");
|
|
5
|
+
function allExtensions(languages) {
|
|
6
|
+
const allowed = languages === undefined ? undefined : new Set(languages);
|
|
7
|
+
const out = new Set();
|
|
8
|
+
for (const spec of LANGUAGE_SPECS_1.LANGUAGE_SPECS) {
|
|
9
|
+
if (allowed !== undefined && !allowed.has(spec.language))
|
|
10
|
+
continue;
|
|
11
|
+
for (const ext of spec.extensions)
|
|
12
|
+
out.add(ext);
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=allExtensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allExtensions.js","sourceRoot":"","sources":["../../src/indexer/allExtensions.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAElD,uBAA8B,SAAoC;IAChE,MAAM,OAAO,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACzE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,+BAAc,EAAE,CAAC;QAClC,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,SAAS;QACnE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildGraph = buildGraph;
|
|
4
|
+
const GraphMemory_1 = require("../model/GraphMemory");
|
|
5
|
+
const buildGraphDump_1 = require("./buildGraphDump");
|
|
6
|
+
async function buildGraph(options = {}) {
|
|
7
|
+
const dump = await (0, buildGraphDump_1.buildGraphDump)(options);
|
|
8
|
+
return GraphMemory_1.GraphMemory.from(dump);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=buildGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildGraph.js","sourceRoot":"","sources":["../../src/indexer/buildGraph.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,qDAAkD;AAG3C,KAAK,qBACV,OAAO,GAAuB,EAAE;IAEhC,MAAM,IAAI,GAAG,MAAM,IAAA,+BAAc,EAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
|