@colbymchenry/codegraph 0.9.7 → 0.9.9
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/README.md +116 -32
- package/dist/bin/codegraph.d.ts +25 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/context/formatter.d.ts +30 -0
- package/dist/context/index.d.ts +119 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/db/index.d.ts +101 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/queries.d.ts +344 -0
- package/dist/db/sqlite-adapter.d.ts +46 -0
- package/dist/directory.d.ts +57 -0
- package/dist/errors.d.ts +136 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/grammars.d.ts +100 -0
- package/dist/extraction/index.d.ts +138 -0
- package/dist/extraction/languages/c-cpp.d.ts +4 -0
- package/dist/extraction/languages/csharp.d.ts +3 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/typescript.d.ts +3 -0
- package/dist/extraction/liquid-extractor.d.ts +52 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-types.d.ts +193 -0
- package/dist/extraction/tree-sitter.d.ts +317 -0
- package/dist/extraction/vue-extractor.d.ts +36 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/index.d.ts +498 -0
- package/dist/installer/config-writer.d.ts +28 -0
- package/dist/installer/index.d.ts +100 -0
- package/dist/installer/instructions-template.d.ts +18 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/claude.d.ts +56 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/opencode.d.ts +30 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/shared.d.ts +77 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/types.d.ts +101 -0
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon.d.ts +161 -0
- package/dist/mcp/engine.d.ts +105 -0
- package/dist/mcp/index.d.ts +112 -0
- package/dist/mcp/proxy.d.ts +81 -0
- package/dist/mcp/server-instructions.d.ts +19 -0
- package/dist/mcp/session.d.ts +77 -0
- package/dist/mcp/tools.d.ts +413 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/index.d.ts +48 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/import-resolver.d.ts +68 -0
- package/dist/resolution/index.d.ts +116 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/name-matcher.d.ts +32 -0
- package/dist/resolution/path-aliases.d.ts +68 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/types.d.ts +209 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-utils.d.ts +71 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watcher.d.ts +191 -0
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/types.d.ts +377 -0
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/types.d.ts +17 -0
- package/dist/utils.d.ts +205 -0
- package/npm-sdk.js +75 -0
- package/package.json +18 -7
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph Query Functions
|
|
3
|
+
*
|
|
4
|
+
* Higher-level query functions built on top of traversal algorithms.
|
|
5
|
+
*/
|
|
6
|
+
import { Node, Context, Subgraph } from '../types';
|
|
7
|
+
import { QueryBuilder } from '../db/queries';
|
|
8
|
+
import { GraphTraverser } from './traversal';
|
|
9
|
+
/**
|
|
10
|
+
* Graph query manager for complex queries
|
|
11
|
+
*/
|
|
12
|
+
export declare class GraphQueryManager {
|
|
13
|
+
private queries;
|
|
14
|
+
private traverser;
|
|
15
|
+
constructor(queries: QueryBuilder);
|
|
16
|
+
/**
|
|
17
|
+
* Get full context for a node
|
|
18
|
+
*
|
|
19
|
+
* Returns the focal node along with its ancestors, children,
|
|
20
|
+
* and both incoming and outgoing references.
|
|
21
|
+
*
|
|
22
|
+
* @param nodeId - ID of the focal node
|
|
23
|
+
* @returns Context object with all related information
|
|
24
|
+
*/
|
|
25
|
+
getContext(nodeId: string): Context;
|
|
26
|
+
/**
|
|
27
|
+
* Get dependencies of a file
|
|
28
|
+
*
|
|
29
|
+
* Returns all files that this file imports from.
|
|
30
|
+
*
|
|
31
|
+
* @param filePath - Path to the file
|
|
32
|
+
* @returns Array of file paths this file depends on
|
|
33
|
+
*/
|
|
34
|
+
getFileDependencies(filePath: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Get dependents of a file
|
|
37
|
+
*
|
|
38
|
+
* Returns all files that import from this file.
|
|
39
|
+
*
|
|
40
|
+
* @param filePath - Path to the file
|
|
41
|
+
* @returns Array of file paths that depend on this file
|
|
42
|
+
*/
|
|
43
|
+
getFileDependents(filePath: string): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Get all symbols exported by a file
|
|
46
|
+
*
|
|
47
|
+
* @param filePath - Path to the file
|
|
48
|
+
* @returns Array of exported nodes
|
|
49
|
+
*/
|
|
50
|
+
getExportedSymbols(filePath: string): Node[];
|
|
51
|
+
/**
|
|
52
|
+
* Find symbols by qualified name pattern
|
|
53
|
+
*
|
|
54
|
+
* @param pattern - Pattern to match (supports * wildcard)
|
|
55
|
+
* @returns Array of matching nodes
|
|
56
|
+
*/
|
|
57
|
+
findByQualifiedName(pattern: string): Node[];
|
|
58
|
+
/**
|
|
59
|
+
* Get the module/package structure
|
|
60
|
+
*
|
|
61
|
+
* Returns a tree structure of files organized by directory.
|
|
62
|
+
*
|
|
63
|
+
* @returns Map of directory paths to contained files
|
|
64
|
+
*/
|
|
65
|
+
getModuleStructure(): Map<string, string[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Find circular dependencies in the graph
|
|
68
|
+
*
|
|
69
|
+
* @returns Array of cycles, each cycle is an array of node IDs
|
|
70
|
+
*/
|
|
71
|
+
findCircularDependencies(): string[][];
|
|
72
|
+
/**
|
|
73
|
+
* Get complexity metrics for a node
|
|
74
|
+
*
|
|
75
|
+
* @param nodeId - ID of the node
|
|
76
|
+
* @returns Object containing various complexity metrics
|
|
77
|
+
*/
|
|
78
|
+
getNodeMetrics(nodeId: string): {
|
|
79
|
+
incomingEdgeCount: number;
|
|
80
|
+
outgoingEdgeCount: number;
|
|
81
|
+
callCount: number;
|
|
82
|
+
callerCount: number;
|
|
83
|
+
childCount: number;
|
|
84
|
+
depth: number;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Find dead code (nodes with no incoming references)
|
|
88
|
+
*
|
|
89
|
+
* @param kinds - Node kinds to check (default: functions, methods, classes)
|
|
90
|
+
* @returns Array of unreferenced nodes
|
|
91
|
+
*/
|
|
92
|
+
findDeadCode(kinds?: Node['kind'][]): Node[];
|
|
93
|
+
/**
|
|
94
|
+
* Get subgraph containing nodes matching a filter
|
|
95
|
+
*
|
|
96
|
+
* @param filter - Filter function to select nodes
|
|
97
|
+
* @param includeEdges - Whether to include edges between matching nodes
|
|
98
|
+
* @returns Subgraph containing matching nodes
|
|
99
|
+
*/
|
|
100
|
+
getFilteredSubgraph(filter: (node: Node) => boolean, includeEdges?: boolean): Subgraph;
|
|
101
|
+
/**
|
|
102
|
+
* Access the underlying traverser for direct traversal operations
|
|
103
|
+
*/
|
|
104
|
+
getTraverser(): GraphTraverser;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph Traversal Algorithms
|
|
3
|
+
*
|
|
4
|
+
* BFS and DFS traversal for the code knowledge graph.
|
|
5
|
+
*/
|
|
6
|
+
import { Node, Edge, Subgraph, TraversalOptions, EdgeKind } from '../types';
|
|
7
|
+
import { QueryBuilder } from '../db/queries';
|
|
8
|
+
/**
|
|
9
|
+
* Graph traverser for BFS and DFS traversal
|
|
10
|
+
*/
|
|
11
|
+
export declare class GraphTraverser {
|
|
12
|
+
private queries;
|
|
13
|
+
constructor(queries: QueryBuilder);
|
|
14
|
+
/**
|
|
15
|
+
* Traverse the graph using breadth-first search
|
|
16
|
+
*
|
|
17
|
+
* @param startId - Starting node ID
|
|
18
|
+
* @param options - Traversal options
|
|
19
|
+
* @returns Subgraph containing traversed nodes and edges
|
|
20
|
+
*/
|
|
21
|
+
traverseBFS(startId: string, options?: TraversalOptions): Subgraph;
|
|
22
|
+
/**
|
|
23
|
+
* Traverse the graph using depth-first search
|
|
24
|
+
*
|
|
25
|
+
* @param startId - Starting node ID
|
|
26
|
+
* @param options - Traversal options
|
|
27
|
+
* @returns Subgraph containing traversed nodes and edges
|
|
28
|
+
*/
|
|
29
|
+
traverseDFS(startId: string, options?: TraversalOptions): Subgraph;
|
|
30
|
+
/**
|
|
31
|
+
* Recursive DFS helper
|
|
32
|
+
*/
|
|
33
|
+
private dfsRecursive;
|
|
34
|
+
/**
|
|
35
|
+
* Get adjacent edges based on direction
|
|
36
|
+
*/
|
|
37
|
+
private getAdjacentEdges;
|
|
38
|
+
/**
|
|
39
|
+
* Find all callers of a function/method
|
|
40
|
+
*
|
|
41
|
+
* @param nodeId - ID of the function/method node
|
|
42
|
+
* @param maxDepth - Maximum depth to traverse (default: 1)
|
|
43
|
+
* @returns Array of nodes that call this function
|
|
44
|
+
*/
|
|
45
|
+
getCallers(nodeId: string, maxDepth?: number): Array<{
|
|
46
|
+
node: Node;
|
|
47
|
+
edge: Edge;
|
|
48
|
+
}>;
|
|
49
|
+
private getCallersRecursive;
|
|
50
|
+
/**
|
|
51
|
+
* Find all functions/methods called by a function
|
|
52
|
+
*
|
|
53
|
+
* @param nodeId - ID of the function/method node
|
|
54
|
+
* @param maxDepth - Maximum depth to traverse (default: 1)
|
|
55
|
+
* @returns Array of nodes called by this function
|
|
56
|
+
*/
|
|
57
|
+
getCallees(nodeId: string, maxDepth?: number): Array<{
|
|
58
|
+
node: Node;
|
|
59
|
+
edge: Edge;
|
|
60
|
+
}>;
|
|
61
|
+
private getCalleesRecursive;
|
|
62
|
+
/**
|
|
63
|
+
* Get the call graph for a function (both callers and callees)
|
|
64
|
+
*
|
|
65
|
+
* @param nodeId - ID of the function/method node
|
|
66
|
+
* @param depth - Maximum depth in each direction (default: 2)
|
|
67
|
+
* @returns Subgraph containing the call graph
|
|
68
|
+
*/
|
|
69
|
+
getCallGraph(nodeId: string, depth?: number): Subgraph;
|
|
70
|
+
/**
|
|
71
|
+
* Get the type hierarchy for a class/interface
|
|
72
|
+
*
|
|
73
|
+
* @param nodeId - ID of the class/interface node
|
|
74
|
+
* @returns Subgraph containing the type hierarchy
|
|
75
|
+
*/
|
|
76
|
+
getTypeHierarchy(nodeId: string): Subgraph;
|
|
77
|
+
private getTypeAncestors;
|
|
78
|
+
private getTypeDescendants;
|
|
79
|
+
/**
|
|
80
|
+
* Find all usages of a symbol
|
|
81
|
+
*
|
|
82
|
+
* @param nodeId - ID of the symbol node
|
|
83
|
+
* @returns Array of nodes and edges that reference this symbol
|
|
84
|
+
*/
|
|
85
|
+
findUsages(nodeId: string): Array<{
|
|
86
|
+
node: Node;
|
|
87
|
+
edge: Edge;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Calculate the impact radius of a node
|
|
91
|
+
*
|
|
92
|
+
* Returns all nodes that could be affected by changes to this node.
|
|
93
|
+
*
|
|
94
|
+
* @param nodeId - ID of the node
|
|
95
|
+
* @param maxDepth - Maximum depth to traverse (default: 3)
|
|
96
|
+
* @returns Subgraph containing potentially impacted nodes
|
|
97
|
+
*/
|
|
98
|
+
getImpactRadius(nodeId: string, maxDepth?: number): Subgraph;
|
|
99
|
+
private getImpactRecursive;
|
|
100
|
+
/**
|
|
101
|
+
* Find the shortest path between two nodes
|
|
102
|
+
*
|
|
103
|
+
* @param fromId - Starting node ID
|
|
104
|
+
* @param toId - Target node ID
|
|
105
|
+
* @param edgeKinds - Edge types to consider (all if empty)
|
|
106
|
+
* @returns Array of nodes and edges forming the path, or null if no path exists
|
|
107
|
+
*/
|
|
108
|
+
findPath(fromId: string, toId: string, edgeKinds?: EdgeKind[]): Array<{
|
|
109
|
+
node: Node;
|
|
110
|
+
edge: Edge | null;
|
|
111
|
+
}> | null;
|
|
112
|
+
/**
|
|
113
|
+
* Get the containment hierarchy for a node (ancestors)
|
|
114
|
+
*
|
|
115
|
+
* @param nodeId - ID of the node
|
|
116
|
+
* @returns Array of ancestor nodes from immediate parent to root
|
|
117
|
+
*/
|
|
118
|
+
getAncestors(nodeId: string): Node[];
|
|
119
|
+
/**
|
|
120
|
+
* Get immediate children of a node
|
|
121
|
+
*
|
|
122
|
+
* @param nodeId - ID of the node
|
|
123
|
+
* @returns Array of child nodes
|
|
124
|
+
*/
|
|
125
|
+
getChildren(nodeId: string): Node[];
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=traversal.d.ts.map
|