@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirname.js","sourceRoot":"","sources":["../../src/utils/dirname.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,iBAAwB,IAAY;IAClC,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,IAAI,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fileFromUri(uri: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fileFromUri = fileFromUri;
|
|
4
|
+
function fileFromUri(uri) {
|
|
5
|
+
if (!uri.startsWith("file://"))
|
|
6
|
+
return uri;
|
|
7
|
+
// Language servers encode the Windows drive-letter colon as `%3A`, which
|
|
8
|
+
// `decodeURI` leaves intact; normalize it before the drive-letter check so
|
|
9
|
+
// the path does not stay malformed and drop every reference edge.
|
|
10
|
+
const withoutScheme = uri
|
|
11
|
+
.slice("file://".length)
|
|
12
|
+
.replace(/^\/([A-Za-z])%3[Aa]/, "/$1:");
|
|
13
|
+
// `decodeURI` leaves reserved characters encoded, but `fileUri` percent-encodes
|
|
14
|
+
// `#` in real paths; restore it (and `?`) so the path round-trips.
|
|
15
|
+
const decoded = decodeURI(withoutScheme).replace(/%23/g, "#").replace(/%3[Ff]/g, "?");
|
|
16
|
+
if (/^\/[A-Za-z]:/.test(decoded))
|
|
17
|
+
return decoded.slice(1).replace(/\//g, "\\");
|
|
18
|
+
return decoded;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=fileFromUri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileFromUri.js","sourceRoot":"","sources":["../../src/utils/fileFromUri.ts"],"names":[],"mappings":";;;AAAA,qBAA4B,GAAW;IACrC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,GAAG,CAAC;IAC3C,yEAAyE;IACzE,2EAA2E;IAC3E,kEAAkE;IAClE,MAAM,aAAa,GAAG,GAAG;SACtB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;SACvB,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC1C,gFAAgF;IAChF,mEAAmE;IACnE,MAAM,OAAO,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACtF,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC/E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fileUri(file: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fileUri = fileUri;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
function fileUri(file) {
|
|
9
|
+
// Prepend a leading slash for Windows drive paths (`C:/x` -> `/C:/x`) while
|
|
10
|
+
// leaving POSIX paths untouched. A branchless replace keeps the coverage gate
|
|
11
|
+
// reachable on every platform, since a plain `if` here is only ever taken on
|
|
12
|
+
// one OS.
|
|
13
|
+
const resolved = node_path_1.default
|
|
14
|
+
.resolve(file)
|
|
15
|
+
.replace(/\\/g, "/")
|
|
16
|
+
.replace(/^(?!\/)/, "/");
|
|
17
|
+
return `file://${encodeURI(resolved).replace(/#/g, "%23")}`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fileUri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUri.js","sourceRoot":"","sources":["../../src/utils/fileUri.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,iBAAwB,IAAY;IAClC,4EAA4E;IAC5E,8EAA8E;IAC9E,6EAA6E;IAC7E,UAAU;IACV,MAAM,QAAQ,GAAG,mBAAI;SAClB,OAAO,CAAC,IAAI,CAAC;SACb,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,UAAU,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;AAC9D,CAAC"}
|
package/lib/utils/fs.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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("./DEFAULT_IGNORES"), exports);
|
|
18
|
+
__exportStar(require("./IWalkOptions"), exports);
|
|
19
|
+
__exportStar(require("./projectRelative"), exports);
|
|
20
|
+
__exportStar(require("./readLines"), exports);
|
|
21
|
+
__exportStar(require("./readText"), exports);
|
|
22
|
+
__exportStar(require("./walkSourceFiles"), exports);
|
|
23
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iDAA+B;AAC/B,oDAAkC;AAClC,8CAA4B;AAC5B,6CAA2B;AAC3B,oDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSubPath(root: string, candidate: string): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isSubPath = isSubPath;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
function isSubPath(root, candidate) {
|
|
9
|
+
const rel = node_path_1.default.relative(node_path_1.default.resolve(root), node_path_1.default.resolve(candidate));
|
|
10
|
+
// A path that merely starts with ".." (e.g. `..foo`) is still a child; only a
|
|
11
|
+
// bare ".." or one under "../" escapes the root.
|
|
12
|
+
const escapes = rel === ".." || rel.startsWith(`..${node_path_1.default.sep}`);
|
|
13
|
+
return rel === "" || (!escapes && !node_path_1.default.isAbsolute(rel));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=isSubPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSubPath.js","sourceRoot":"","sources":["../../src/utils/isSubPath.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,mBAA0B,IAAY,EAAE,SAAiB;IACvD,MAAM,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,mBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACvE,8EAA8E;IAC9E,iDAAiD;IACjD,MAAM,OAAO,GAAG,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,mBAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAChE,OAAO,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,mBAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizePath(value: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizePath.js","sourceRoot":"","sources":["../../src/utils/normalizePath.ts"],"names":[],"mappings":";;;AAAA,uBAA8B,KAAa;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./basename"), exports);
|
|
18
|
+
__exportStar(require("./dirname"), exports);
|
|
19
|
+
__exportStar(require("./fileFromUri"), exports);
|
|
20
|
+
__exportStar(require("./fileUri"), exports);
|
|
21
|
+
__exportStar(require("./isSubPath"), exports);
|
|
22
|
+
__exportStar(require("./normalizePath"), exports);
|
|
23
|
+
__exportStar(require("./relativePath"), exports);
|
|
24
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,4CAA0B;AAC1B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,kDAAgC;AAChC,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function projectRelative(root: string, file: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectRelative = projectRelative;
|
|
4
|
+
const normalizePath_1 = require("./normalizePath");
|
|
5
|
+
const relativePath_1 = require("./relativePath");
|
|
6
|
+
function projectRelative(root, file) {
|
|
7
|
+
return (0, normalizePath_1.normalizePath)((0, relativePath_1.relativePath)(root, file));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=projectRelative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectRelative.js","sourceRoot":"","sources":["../../src/utils/projectRelative.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,iDAA8C;AAE9C,yBAAgC,IAAY,EAAE,IAAY;IACxD,OAAO,IAAA,6BAAa,EAAC,IAAA,2BAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readLines(file: string): string[] | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readLines = readLines;
|
|
4
|
+
const readText_1 = require("./readText");
|
|
5
|
+
function readLines(file) {
|
|
6
|
+
return (0, readText_1.readText)(file)?.split(/\r?\n/);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=readLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readLines.js","sourceRoot":"","sources":["../../src/utils/readLines.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC,mBAA0B,IAAY;IACpC,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readText(file: string): string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readText = readText;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
function readText(file) {
|
|
9
|
+
try {
|
|
10
|
+
// Strip a UTF-8 BOM (U+FEFF) so it does not offset the first line's columns.
|
|
11
|
+
return node_fs_1.default.readFileSync(file, "utf8").replace(/^\uFEFF/, "");
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=readText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readText.js","sourceRoot":"","sources":["../../src/utils/readText.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AAEzB,kBAAyB,IAAY;IACnC,IAAI,CAAC;QACH,6EAA6E;QAC7E,OAAO,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function relativePath(root: string, file: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.relativePath = relativePath;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const normalizePath_1 = require("./normalizePath");
|
|
9
|
+
function relativePath(root, file) {
|
|
10
|
+
return (0, normalizePath_1.normalizePath)(node_path_1.default.relative(root, file));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=relativePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relativePath.js","sourceRoot":"","sources":["../../src/utils/relativePath.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,mDAAgD;AAEhD,sBAA6B,IAAY,EAAE,IAAY;IACrD,OAAO,IAAA,6BAAa,EAAC,mBAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.walkSourceFiles = walkSourceFiles;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const DEFAULT_IGNORES_1 = require("./DEFAULT_IGNORES");
|
|
10
|
+
function walkSourceFiles(root, options) {
|
|
11
|
+
const out = [];
|
|
12
|
+
const ignoreDirs = options.ignoreDirs ?? DEFAULT_IGNORES_1.DEFAULT_IGNORES;
|
|
13
|
+
const visit = (dir) => {
|
|
14
|
+
if (options.maxFiles !== undefined && out.length >= options.maxFiles)
|
|
15
|
+
return;
|
|
16
|
+
let entries;
|
|
17
|
+
try {
|
|
18
|
+
entries = node_fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
if (options.maxFiles !== undefined && out.length >= options.maxFiles)
|
|
26
|
+
break;
|
|
27
|
+
const abs = node_path_1.default.join(dir, entry.name);
|
|
28
|
+
if (entry.isDirectory()) {
|
|
29
|
+
if (!ignoreDirs.has(entry.name))
|
|
30
|
+
visit(abs);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
/* c8 ignore next */
|
|
34
|
+
if (!entry.isFile())
|
|
35
|
+
continue;
|
|
36
|
+
if (options.extensions.has(node_path_1.default.extname(entry.name).toLowerCase())) {
|
|
37
|
+
out.push(abs);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
visit(node_path_1.default.resolve(root));
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=walkSourceFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walkSourceFiles.js","sourceRoot":"","sources":["../../src/utils/walkSourceFiles.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,uDAAoD;AAGpD,yBAAgC,IAAY,EAAE,OAAqB;IACjE,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,iCAAe,CAAC;IACzD,MAAM,KAAK,GAAG,CAAC,GAAW,EAAQ,EAAE;QAClC,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ;YAAE,OAAO;QAC7E,IAAI,OAAoB,CAAC;QACzB,IAAI,CAAC;YACH,OAAO,GAAG,iBAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ;gBAAE,MAAM;YAC5E,MAAM,GAAG,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;oBAAE,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC5C,SAAS;YACX,CAAC;YACD,oBAAoB;YACpB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAAE,SAAS;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,mBAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBACnE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@samchon/graph",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Language-server-backed code graph over MCP for statically typed compiled languages.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"samchon-graph": "lib/bin.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/index.d.ts",
|
|
13
|
+
"default": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mcp",
|
|
19
|
+
"lsp",
|
|
20
|
+
"code-graph",
|
|
21
|
+
"language-server",
|
|
22
|
+
"static-analysis"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"lib",
|
|
28
|
+
"src"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
32
|
+
"@typia/interface": "^13.0.0",
|
|
33
|
+
"@typia/mcp": "^13.0.0",
|
|
34
|
+
"typia": "^13.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.18.0",
|
|
38
|
+
"rimraf": "^6.0.1",
|
|
39
|
+
"ttsc": "^0.17.4",
|
|
40
|
+
"typescript": "^7.0.2"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/samchon/graph"
|
|
45
|
+
},
|
|
46
|
+
"author": "Jeongho Nam",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/samchon/graph/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/samchon/graph#readme",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "rimraf lib && ttsc -p tsconfig.json && node -e \"require('node:fs').copyFileSync('../../README.md', 'README.md')\""
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { AsyncSamchonGraphSource } from "./AsyncSamchonGraphSource";
|
|
2
|
+
import { GraphMemory } from "./model/GraphMemory";
|
|
3
|
+
import { resultGuide, resultNext } from "./operations/common";
|
|
4
|
+
import { runDetails } from "./operations/runDetails";
|
|
5
|
+
import { runEntrypoints } from "./operations/runEntrypoints";
|
|
6
|
+
import { runLookup } from "./operations/runLookup";
|
|
7
|
+
import { runOverview } from "./operations/runOverview";
|
|
8
|
+
import { runTour } from "./operations/runTour";
|
|
9
|
+
import { runTrace } from "./operations/runTrace";
|
|
10
|
+
import { IGraphEscape, ISamchonGraphApplication } from "./structures";
|
|
11
|
+
|
|
12
|
+
export class SamchonGraphApplication implements ISamchonGraphApplication {
|
|
13
|
+
private readonly graph: () => GraphMemory | Promise<GraphMemory>;
|
|
14
|
+
private promise?: Promise<GraphMemory>;
|
|
15
|
+
|
|
16
|
+
public constructor(source: AsyncSamchonGraphSource) {
|
|
17
|
+
this.graph = typeof source === "function" ? source : () => source;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async inspect_code_graph(
|
|
21
|
+
props: ISamchonGraphApplication.IProps,
|
|
22
|
+
): Promise<ISamchonGraphApplication.IResult> {
|
|
23
|
+
const graph = await this.load();
|
|
24
|
+
switch (props.request.type) {
|
|
25
|
+
case "entrypoints":
|
|
26
|
+
return { result: runEntrypoints(graph, props.request) };
|
|
27
|
+
case "lookup":
|
|
28
|
+
return { result: runLookup(graph, props.request) };
|
|
29
|
+
case "trace":
|
|
30
|
+
return { result: runTrace(graph, props.request) };
|
|
31
|
+
case "details":
|
|
32
|
+
return { result: runDetails(graph, props.request) };
|
|
33
|
+
case "overview":
|
|
34
|
+
return { result: runOverview(graph, props.request) };
|
|
35
|
+
case "tour":
|
|
36
|
+
return { result: runTour(graph, props.request) };
|
|
37
|
+
case "escape":
|
|
38
|
+
return { result: this.escape(props.request.reason, props.request.nextStep) };
|
|
39
|
+
default:
|
|
40
|
+
props.request satisfies never;
|
|
41
|
+
throw new Error("Unknown graph request type");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private escape(reason: string, nextStep?: string): IGraphEscape {
|
|
46
|
+
return {
|
|
47
|
+
type: "escape",
|
|
48
|
+
skipped: true,
|
|
49
|
+
reason,
|
|
50
|
+
...(nextStep !== undefined ? { nextStep } : {}),
|
|
51
|
+
next: resultNext(
|
|
52
|
+
"outside",
|
|
53
|
+
nextStep ?? "Graph evidence is exhausted or not the next evidence source.",
|
|
54
|
+
),
|
|
55
|
+
guide: resultGuide(
|
|
56
|
+
"Finish from existing graph evidence, state the graph gap, or ask for clarification.",
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private async load(): Promise<GraphMemory> {
|
|
62
|
+
// Cache the built graph on success only. Caching a rejected promise would
|
|
63
|
+
// brick the resident server for the whole session after one transient index
|
|
64
|
+
// failure (e.g. a slow language-server cold start); clear it so the next
|
|
65
|
+
// call rebuilds.
|
|
66
|
+
if (this.promise === undefined) {
|
|
67
|
+
this.promise = Promise.resolve(this.graph()).catch((error: unknown) => {
|
|
68
|
+
this.promise = undefined;
|
|
69
|
+
throw error;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return this.promise;
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/bin.ts
ADDED
package/src/index.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";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GraphLanguage } from "../structures";
|
|
2
|
+
|
|
3
|
+
export interface IBuildGraphOptions {
|
|
4
|
+
cwd?: string;
|
|
5
|
+
mode?: "auto" | "lsp" | "static";
|
|
6
|
+
languages?: GraphLanguage[];
|
|
7
|
+
server?: string;
|
|
8
|
+
serverArgs?: string[];
|
|
9
|
+
initializationOptions?: unknown;
|
|
10
|
+
maxFiles?: number;
|
|
11
|
+
lspReferenceLimit?: number;
|
|
12
|
+
lspTimeoutMs?: number;
|
|
13
|
+
/**
|
|
14
|
+
* How many `textDocument/references` requests to keep in flight at once.
|
|
15
|
+
* Reference collection dominates indexing time on large repositories, and the
|
|
16
|
+
* requests are independent, so they are issued concurrently up to this bound.
|
|
17
|
+
*/
|
|
18
|
+
lspConcurrency?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum time to wait for a language server to finish its initial indexing
|
|
21
|
+
* (reported through `$/progress`) before collecting references. Servers such
|
|
22
|
+
* as rust-analyzer, clangd, and jdtls answer reference requests with nothing
|
|
23
|
+
* until indexing completes, so skipping this wait yields zero edges.
|
|
24
|
+
*/
|
|
25
|
+
lspReadyTimeoutMs?: number;
|
|
26
|
+
/**
|
|
27
|
+
* How long the server must stay silent on `$/progress` before its initial
|
|
28
|
+
* indexing is treated as settled. Also bounds the wait for servers that never
|
|
29
|
+
* report progress at all.
|
|
30
|
+
*/
|
|
31
|
+
lspReadyQuietMs?: number;
|
|
32
|
+
/**
|
|
33
|
+
* How long to wait for the FIRST `textDocument/references` request, which may
|
|
34
|
+
* trigger the server to build its cross-file reference index lazily. Once that
|
|
35
|
+
* one warmup request returns, later references are cache-fast and use the
|
|
36
|
+
* normal `lspTimeoutMs`. A timeout here means the server cannot answer
|
|
37
|
+
* references at all, so only structural edges are kept. Defaults to a patient
|
|
38
|
+
* budget (slow servers like ruby-lsp need it); fast servers answer instantly
|
|
39
|
+
* and never reach it.
|
|
40
|
+
*/
|
|
41
|
+
lspWarmupTimeoutMs?: number;
|
|
42
|
+
}
|