@aroman22/codegraph-vba 1.3.3
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 +855 -0
- package/dist/bin/codegraph.d.ts +26 -0
- package/dist/bin/command-supervision.d.ts +12 -0
- package/dist/bin/fatal-handler.d.ts +20 -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 +122 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/queries.d.ts +402 -0
- package/dist/db/sqlite-adapter.d.ts +53 -0
- package/dist/directory.d.ts +179 -0
- package/dist/errors.d.ts +136 -0
- package/dist/extraction/astro-extractor.d.ts +79 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/extraction-version.d.ts +25 -0
- package/dist/extraction/function-ref.d.ts +118 -0
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/grammars.d.ts +128 -0
- package/dist/extraction/index.d.ts +187 -0
- package/dist/extraction/languages/c-cpp.d.ts +12 -0
- package/dist/extraction/languages/csharp.d.ts +25 -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/r.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 +16 -0
- package/dist/extraction/liquid-extractor.d.ts +59 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/parse-pool.d.ts +126 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/razor-extractor.d.ts +42 -0
- package/dist/extraction/sql-query-extractor.d.ts +25 -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 +239 -0
- package/dist/extraction/tree-sitter.d.ts +647 -0
- package/dist/extraction/vba-extractor.d.ts +394 -0
- package/dist/extraction/vba-form-extractor.d.ts +89 -0
- package/dist/extraction/vba-preprocess.d.ts +81 -0
- package/dist/extraction/vue-extractor.d.ts +51 -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 +563 -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 +41 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/claude.d.ts +62 -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 +38 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/shared.d.ts +101 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/types.d.ts +108 -0
- package/dist/mcp/daemon-manager.d.ts +42 -0
- package/dist/mcp/daemon-paths.d.ts +73 -0
- package/dist/mcp/daemon-registry.d.ts +47 -0
- package/dist/mcp/daemon.d.ts +258 -0
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/engine.d.ts +122 -0
- package/dist/mcp/index.d.ts +113 -0
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/dist/mcp/proxy.d.ts +87 -0
- package/dist/mcp/query-pool.d.ts +94 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/server-instructions.d.ts +34 -0
- package/dist/mcp/session.d.ts +79 -0
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/tools.d.ts +591 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/project-config.d.ts +56 -0
- package/dist/reasoning/config.d.ts +45 -0
- package/dist/reasoning/credentials.d.ts +5 -0
- package/dist/reasoning/login.d.ts +21 -0
- package/dist/reasoning/reasoner.d.ts +43 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +5 -0
- package/dist/resolution/callback-synthesizer.d.ts +15 -0
- package/dist/resolution/frameworks/astro.d.ts +9 -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/goframe.d.ts +41 -0
- package/dist/resolution/frameworks/index.d.ts +50 -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/goframe-synthesizer.d.ts +28 -0
- package/dist/resolution/import-resolver.d.ts +78 -0
- package/dist/resolution/index.d.ts +196 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/name-matcher.d.ts +93 -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 +233 -0
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-utils.d.ts +87 -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 +358 -0
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/telemetry/index.d.ts +143 -0
- package/dist/types.d.ts +409 -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/upgrade/index.d.ts +132 -0
- package/dist/utils.d.ts +224 -0
- package/npm-sdk.js +75 -0
- package/npm-shim.js +246 -0
- package/package.json +32 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeGraph Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Core types for the semantic knowledge graph system.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Types of nodes in the knowledge graph.
|
|
8
|
+
*
|
|
9
|
+
* Defined as a runtime-iterable `as const` array so the same source
|
|
10
|
+
* of truth backs both the TS type and any runtime validation
|
|
11
|
+
* (e.g. the search query parser).
|
|
12
|
+
*/
|
|
13
|
+
export declare const NODE_KINDS: readonly ["file", "module", "class", "struct", "interface", "trait", "protocol", "function", "method", "property", "field", "variable", "constant", "enum", "enum_member", "type_alias", "namespace", "parameter", "import", "export", "route", "component", "query", "form-layout", "form-instance-control"];
|
|
14
|
+
export type NodeKind = (typeof NODE_KINDS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Types of edges (relationships) between nodes
|
|
17
|
+
*/
|
|
18
|
+
export type EdgeKind = 'contains' | 'calls' | 'imports' | 'exports' | 'extends' | 'implements' | 'references' | 'type_of' | 'returns' | 'instantiates' | 'overrides' | 'decorates' | 'event-handler' | 'opens-form';
|
|
19
|
+
/**
|
|
20
|
+
* Supported programming languages. See NODE_KINDS for why this is a
|
|
21
|
+
* runtime-iterable const array.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LANGUAGES: readonly ["typescript", "javascript", "tsx", "jsx", "python", "go", "rust", "java", "c", "cpp", "csharp", "razor", "php", "ruby", "swift", "kotlin", "dart", "svelte", "vue", "astro", "liquid", "pascal", "scala", "lua", "luau", "objc", "r", "vba", "sql", "yaml", "twig", "xml", "properties", "unknown"];
|
|
24
|
+
export type Language = (typeof LANGUAGES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* A node in the knowledge graph representing a code symbol
|
|
27
|
+
*/
|
|
28
|
+
export interface Node {
|
|
29
|
+
/** Unique identifier (hash of file path + qualified name) */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Type of code element */
|
|
32
|
+
kind: NodeKind;
|
|
33
|
+
/** Simple name (e.g., "calculateTotal") */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Fully qualified name (e.g., "src/utils.ts::MathHelper.calculateTotal") */
|
|
36
|
+
qualifiedName: string;
|
|
37
|
+
/** File path relative to project root */
|
|
38
|
+
filePath: string;
|
|
39
|
+
/** Programming language */
|
|
40
|
+
language: Language;
|
|
41
|
+
/** Starting line number (1-indexed) */
|
|
42
|
+
startLine: number;
|
|
43
|
+
/** Ending line number (1-indexed) */
|
|
44
|
+
endLine: number;
|
|
45
|
+
/** Starting column (0-indexed) */
|
|
46
|
+
startColumn: number;
|
|
47
|
+
/** Ending column (0-indexed) */
|
|
48
|
+
endColumn: number;
|
|
49
|
+
/** Documentation string if present */
|
|
50
|
+
docstring?: string;
|
|
51
|
+
/** Function/method signature */
|
|
52
|
+
signature?: string;
|
|
53
|
+
/** Visibility modifier */
|
|
54
|
+
visibility?: 'public' | 'private' | 'protected' | 'internal';
|
|
55
|
+
/** Whether symbol is exported */
|
|
56
|
+
isExported?: boolean;
|
|
57
|
+
/** Whether symbol is async */
|
|
58
|
+
isAsync?: boolean;
|
|
59
|
+
/** Whether symbol is static */
|
|
60
|
+
isStatic?: boolean;
|
|
61
|
+
/** Whether symbol is abstract */
|
|
62
|
+
isAbstract?: boolean;
|
|
63
|
+
/** Decorators/annotations applied */
|
|
64
|
+
decorators?: string[];
|
|
65
|
+
/** Generic type parameters */
|
|
66
|
+
typeParameters?: string[];
|
|
67
|
+
/**
|
|
68
|
+
* Normalized return/result type name for a function/method (the bare class
|
|
69
|
+
* name, smart-pointer pointee unwrapped). Captured for C/C++ so resolution
|
|
70
|
+
* can infer a chained receiver's type from what the inner call returns —
|
|
71
|
+
* `Foo::instance().bar()` resolves `bar` on `Foo` (issue #645). Undefined for
|
|
72
|
+
* languages/symbols where it isn't captured.
|
|
73
|
+
*/
|
|
74
|
+
returnType?: string;
|
|
75
|
+
/** When the node was last updated */
|
|
76
|
+
updatedAt: number;
|
|
77
|
+
/**
|
|
78
|
+
* Optional metadata bag for language-/extractor-specific annotations.
|
|
79
|
+
* Used by VBA to carry `hasClassInitializer` / `initializerName` on class
|
|
80
|
+
* nodes and `controlType` on form property nodes; reserved by other
|
|
81
|
+
* extractors for similar per-language extras. Mirrors the
|
|
82
|
+
* `Edge.metadata` shape (`Record<string, unknown>`).
|
|
83
|
+
*/
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* An edge representing a relationship between two nodes
|
|
88
|
+
*/
|
|
89
|
+
export interface Edge {
|
|
90
|
+
/** Source node ID */
|
|
91
|
+
source: string;
|
|
92
|
+
/** Target node ID */
|
|
93
|
+
target: string;
|
|
94
|
+
/** Type of relationship */
|
|
95
|
+
kind: EdgeKind;
|
|
96
|
+
/** Additional context about the relationship */
|
|
97
|
+
metadata?: Record<string, unknown>;
|
|
98
|
+
/** Line number where relationship occurs (e.g., call site) */
|
|
99
|
+
line?: number;
|
|
100
|
+
/** Column number where relationship occurs */
|
|
101
|
+
column?: number;
|
|
102
|
+
/** How this edge was created */
|
|
103
|
+
provenance?: 'tree-sitter' | 'scip' | 'parser' | 'heuristic';
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Metadata about a tracked file
|
|
107
|
+
*/
|
|
108
|
+
export interface FileRecord {
|
|
109
|
+
/** File path relative to project root */
|
|
110
|
+
path: string;
|
|
111
|
+
/** Content hash for change detection */
|
|
112
|
+
contentHash: string;
|
|
113
|
+
/** Detected language */
|
|
114
|
+
language: Language;
|
|
115
|
+
/** File size in bytes */
|
|
116
|
+
size: number;
|
|
117
|
+
/** Last modification timestamp */
|
|
118
|
+
modifiedAt: number;
|
|
119
|
+
/** When last indexed */
|
|
120
|
+
indexedAt: number;
|
|
121
|
+
/** Number of nodes extracted */
|
|
122
|
+
nodeCount: number;
|
|
123
|
+
/** Any extraction errors */
|
|
124
|
+
errors?: ExtractionError[];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Result from parsing a source file
|
|
128
|
+
*/
|
|
129
|
+
export interface ExtractionResult {
|
|
130
|
+
/** Extracted nodes */
|
|
131
|
+
nodes: Node[];
|
|
132
|
+
/** Extracted edges */
|
|
133
|
+
edges: Edge[];
|
|
134
|
+
/** References that couldn't be resolved yet */
|
|
135
|
+
unresolvedReferences: UnresolvedReference[];
|
|
136
|
+
/** Any errors during extraction */
|
|
137
|
+
errors: ExtractionError[];
|
|
138
|
+
/** Extraction duration in milliseconds */
|
|
139
|
+
durationMs: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Error during code extraction
|
|
143
|
+
*/
|
|
144
|
+
export interface ExtractionError {
|
|
145
|
+
/** Error message */
|
|
146
|
+
message: string;
|
|
147
|
+
/** File path where the error occurred */
|
|
148
|
+
filePath?: string;
|
|
149
|
+
/** Line number if available */
|
|
150
|
+
line?: number;
|
|
151
|
+
/** Column number if available */
|
|
152
|
+
column?: number;
|
|
153
|
+
/** Error severity */
|
|
154
|
+
severity: 'error' | 'warning';
|
|
155
|
+
/** Error code for categorization */
|
|
156
|
+
code?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Kinds an unresolved reference can carry. `function_ref` is internal-only —
|
|
160
|
+
* a function name used as a VALUE (callback registration, #756). It never
|
|
161
|
+
* becomes an edge kind: resolution maps it to a `references` edge targeting
|
|
162
|
+
* function/method nodes only (see `matchFunctionRef`).
|
|
163
|
+
*/
|
|
164
|
+
export type ReferenceKind = EdgeKind | 'function_ref';
|
|
165
|
+
/**
|
|
166
|
+
* A reference that couldn't be resolved during extraction
|
|
167
|
+
*/
|
|
168
|
+
export interface UnresolvedReference {
|
|
169
|
+
/** ID of the node containing the reference */
|
|
170
|
+
fromNodeId: string;
|
|
171
|
+
/** Name being referenced */
|
|
172
|
+
referenceName: string;
|
|
173
|
+
/** Type of reference (call, type, import, etc.) */
|
|
174
|
+
referenceKind: ReferenceKind;
|
|
175
|
+
/** Location of the reference */
|
|
176
|
+
line: number;
|
|
177
|
+
column: number;
|
|
178
|
+
/** File path where reference occurs (denormalized for performance) */
|
|
179
|
+
filePath?: string;
|
|
180
|
+
/** Language of the source file (denormalized for performance) */
|
|
181
|
+
language?: Language;
|
|
182
|
+
/** Possible qualified names it might resolve to */
|
|
183
|
+
candidates?: string[];
|
|
184
|
+
/**
|
|
185
|
+
* Optional metadata bag for language-/extractor-specific annotations on
|
|
186
|
+
* unresolved references. Used by VBA to carry
|
|
187
|
+
* `synthesizedBy: 'vba-form-binding'` on the form → sibling-`.cls`
|
|
188
|
+
* reference so downstream resolvers can render the provenance inline.
|
|
189
|
+
* Mirrors `Edge.metadata` and `Node.metadata` shapes
|
|
190
|
+
* (`Record<string, unknown>`).
|
|
191
|
+
*/
|
|
192
|
+
metadata?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A subgraph containing a subset of the knowledge graph
|
|
196
|
+
*/
|
|
197
|
+
export interface Subgraph {
|
|
198
|
+
/** Nodes in this subgraph */
|
|
199
|
+
nodes: Map<string, Node>;
|
|
200
|
+
/** Edges in this subgraph */
|
|
201
|
+
edges: Edge[];
|
|
202
|
+
/** Root node IDs (entry points) */
|
|
203
|
+
roots: string[];
|
|
204
|
+
/**
|
|
205
|
+
* Retrieval confidence for context-style queries. `'low'` means the query
|
|
206
|
+
* resolved only to isolated common-word matches (no entry point corroborated
|
|
207
|
+
* by 2+ distinct query terms) — callers should surface an honest handoff to
|
|
208
|
+
* explore/trace rather than present the results as comprehensive. Undefined
|
|
209
|
+
* for graph traversals that don't run the search-ranking path.
|
|
210
|
+
*/
|
|
211
|
+
confidence?: 'high' | 'low';
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Options for graph traversal
|
|
215
|
+
*/
|
|
216
|
+
export interface TraversalOptions {
|
|
217
|
+
/** Maximum depth to traverse (default: Infinity) */
|
|
218
|
+
maxDepth?: number;
|
|
219
|
+
/** Edge types to follow (default: all) */
|
|
220
|
+
edgeKinds?: EdgeKind[];
|
|
221
|
+
/** Node types to include (default: all) */
|
|
222
|
+
nodeKinds?: NodeKind[];
|
|
223
|
+
/** Direction of traversal */
|
|
224
|
+
direction?: 'outgoing' | 'incoming' | 'both';
|
|
225
|
+
/** Maximum nodes to return */
|
|
226
|
+
limit?: number;
|
|
227
|
+
/** Whether to include the starting node */
|
|
228
|
+
includeStart?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Options for searching the graph
|
|
232
|
+
*/
|
|
233
|
+
export interface SearchOptions {
|
|
234
|
+
/** Node types to search */
|
|
235
|
+
kinds?: NodeKind[];
|
|
236
|
+
/** Languages to include */
|
|
237
|
+
languages?: Language[];
|
|
238
|
+
/** File path patterns to include */
|
|
239
|
+
includePatterns?: string[];
|
|
240
|
+
/** File path patterns to exclude */
|
|
241
|
+
excludePatterns?: string[];
|
|
242
|
+
/** Maximum results to return */
|
|
243
|
+
limit?: number;
|
|
244
|
+
/** Offset for pagination */
|
|
245
|
+
offset?: number;
|
|
246
|
+
/** Whether search is case-sensitive */
|
|
247
|
+
caseSensitive?: boolean;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* A search result with relevance scoring
|
|
251
|
+
*/
|
|
252
|
+
export interface SearchResult {
|
|
253
|
+
/** Matching node */
|
|
254
|
+
node: Node;
|
|
255
|
+
/** Relevance score (0-1) */
|
|
256
|
+
score: number;
|
|
257
|
+
/** Matched text snippets for highlighting */
|
|
258
|
+
highlights?: string[];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Context information for code understanding
|
|
262
|
+
*/
|
|
263
|
+
export interface Context {
|
|
264
|
+
/** Primary node being examined */
|
|
265
|
+
focal: Node;
|
|
266
|
+
/** Nodes containing the focal node (file, class, etc.) */
|
|
267
|
+
ancestors: Node[];
|
|
268
|
+
/** Nodes directly contained by focal node */
|
|
269
|
+
children: Node[];
|
|
270
|
+
/** Incoming references (who calls/uses this) */
|
|
271
|
+
incomingRefs: Array<{
|
|
272
|
+
node: Node;
|
|
273
|
+
edge: Edge;
|
|
274
|
+
}>;
|
|
275
|
+
/** Outgoing references (what this calls/uses) */
|
|
276
|
+
outgoingRefs: Array<{
|
|
277
|
+
node: Node;
|
|
278
|
+
edge: Edge;
|
|
279
|
+
}>;
|
|
280
|
+
/** Related type information */
|
|
281
|
+
types: Node[];
|
|
282
|
+
/** Relevant imports */
|
|
283
|
+
imports: Node[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* A block of code with context
|
|
287
|
+
*/
|
|
288
|
+
export interface CodeBlock {
|
|
289
|
+
/** The code content */
|
|
290
|
+
content: string;
|
|
291
|
+
/** File path */
|
|
292
|
+
filePath: string;
|
|
293
|
+
/** Starting line */
|
|
294
|
+
startLine: number;
|
|
295
|
+
/** Ending line */
|
|
296
|
+
endLine: number;
|
|
297
|
+
/** Language for syntax highlighting */
|
|
298
|
+
language: Language;
|
|
299
|
+
/** Associated node if extracted */
|
|
300
|
+
node?: Node;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Database schema version info
|
|
304
|
+
*/
|
|
305
|
+
export interface SchemaVersion {
|
|
306
|
+
/** Current schema version */
|
|
307
|
+
version: number;
|
|
308
|
+
/** When schema was created/updated */
|
|
309
|
+
appliedAt: number;
|
|
310
|
+
/** Description of this version */
|
|
311
|
+
description?: string;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Statistics about the knowledge graph
|
|
315
|
+
*/
|
|
316
|
+
export interface GraphStats {
|
|
317
|
+
/** Total number of nodes */
|
|
318
|
+
nodeCount: number;
|
|
319
|
+
/** Total number of edges */
|
|
320
|
+
edgeCount: number;
|
|
321
|
+
/** Number of tracked files */
|
|
322
|
+
fileCount: number;
|
|
323
|
+
/** Node counts by kind */
|
|
324
|
+
nodesByKind: Record<NodeKind, number>;
|
|
325
|
+
/** Edge counts by kind */
|
|
326
|
+
edgesByKind: Record<EdgeKind, number>;
|
|
327
|
+
/** File counts by language */
|
|
328
|
+
filesByLanguage: Record<Language, number>;
|
|
329
|
+
/** Database size in bytes */
|
|
330
|
+
dbSizeBytes: number;
|
|
331
|
+
/** Last update timestamp */
|
|
332
|
+
lastUpdated: number;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Input for building task context
|
|
336
|
+
*/
|
|
337
|
+
export type TaskInput = string | {
|
|
338
|
+
title: string;
|
|
339
|
+
description?: string;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Options for building task context
|
|
343
|
+
*/
|
|
344
|
+
export interface BuildContextOptions {
|
|
345
|
+
/** Maximum number of nodes to include (default: 50) */
|
|
346
|
+
maxNodes?: number;
|
|
347
|
+
/** Maximum number of code blocks to include (default: 10) */
|
|
348
|
+
maxCodeBlocks?: number;
|
|
349
|
+
/** Maximum characters per code block (default: 2000) */
|
|
350
|
+
maxCodeBlockSize?: number;
|
|
351
|
+
/** Whether to include code blocks (default: true) */
|
|
352
|
+
includeCode?: boolean;
|
|
353
|
+
/** Output format (default: 'markdown') */
|
|
354
|
+
format?: 'markdown' | 'json';
|
|
355
|
+
/** Number of semantic search results (default: 5) */
|
|
356
|
+
searchLimit?: number;
|
|
357
|
+
/** Graph traversal depth from entry points (default: 2) */
|
|
358
|
+
traversalDepth?: number;
|
|
359
|
+
/** Minimum semantic similarity score (default: 0.3) */
|
|
360
|
+
minScore?: number;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Full context for a task, ready for Claude
|
|
364
|
+
*/
|
|
365
|
+
export interface TaskContext {
|
|
366
|
+
/** The original query/task */
|
|
367
|
+
query: string;
|
|
368
|
+
/** Subgraph of relevant nodes and edges */
|
|
369
|
+
subgraph: Subgraph;
|
|
370
|
+
/** Entry point nodes (from semantic search) */
|
|
371
|
+
entryPoints: Node[];
|
|
372
|
+
/** Code blocks extracted from key nodes */
|
|
373
|
+
codeBlocks: CodeBlock[];
|
|
374
|
+
/** Files involved in this context */
|
|
375
|
+
relatedFiles: string[];
|
|
376
|
+
/** Brief summary of the context */
|
|
377
|
+
summary: string;
|
|
378
|
+
/** Statistics about the context */
|
|
379
|
+
stats: {
|
|
380
|
+
/** Number of nodes included */
|
|
381
|
+
nodeCount: number;
|
|
382
|
+
/** Number of edges included */
|
|
383
|
+
edgeCount: number;
|
|
384
|
+
/** Number of files touched */
|
|
385
|
+
fileCount: number;
|
|
386
|
+
/** Number of code blocks included */
|
|
387
|
+
codeBlockCount: number;
|
|
388
|
+
/** Total characters in code blocks */
|
|
389
|
+
totalCodeSize: number;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Options for finding relevant context
|
|
394
|
+
*/
|
|
395
|
+
export interface FindRelevantContextOptions {
|
|
396
|
+
/** Number of semantic search results (default: 5) */
|
|
397
|
+
searchLimit?: number;
|
|
398
|
+
/** Graph traversal depth (default: 2) */
|
|
399
|
+
traversalDepth?: number;
|
|
400
|
+
/** Maximum nodes in result (default: 50) */
|
|
401
|
+
maxNodes?: number;
|
|
402
|
+
/** Minimum semantic similarity score (default: 0.3) */
|
|
403
|
+
minScore?: number;
|
|
404
|
+
/** Edge types to follow in traversal */
|
|
405
|
+
edgeKinds?: EdgeKind[];
|
|
406
|
+
/** Node types to include */
|
|
407
|
+
nodeKinds?: NodeKind[];
|
|
408
|
+
}
|
|
409
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glyph selection for CLI output.
|
|
3
|
+
*
|
|
4
|
+
* On Windows, console output is interpreted via the active output
|
|
5
|
+
* codepage. PowerShell 5.1 and cmd.exe default to OEM codepages
|
|
6
|
+
* (CP437, CP936, ...), so UTF-8 bytes written to the console render
|
|
7
|
+
* as mojibake (see #168). The shimmer worker is hit hardest because
|
|
8
|
+
* it uses `fs.writeSync(1, ...)` (raw bytes, no TTY-aware encoding
|
|
9
|
+
* conversion) to keep animation smooth while the main thread is
|
|
10
|
+
* blocked in SQLite. To stay readable everywhere, we fall back to
|
|
11
|
+
* ASCII glyphs whenever the terminal is not known to handle UTF-8.
|
|
12
|
+
*
|
|
13
|
+
* Detection is intentionally simple:
|
|
14
|
+
* - `CODEGRAPH_ASCII=1` -> ASCII (escape hatch for any terminal)
|
|
15
|
+
* - `CODEGRAPH_UNICODE=1` -> Unicode (opt-in on Windows)
|
|
16
|
+
* - Windows -> ASCII by default
|
|
17
|
+
* - Linux kernel console (`TERM=linux`) -> ASCII
|
|
18
|
+
* - Everything else -> Unicode
|
|
19
|
+
*/
|
|
20
|
+
export declare function supportsUnicode(): boolean;
|
|
21
|
+
export interface Glyphs {
|
|
22
|
+
ok: string;
|
|
23
|
+
err: string;
|
|
24
|
+
info: string;
|
|
25
|
+
warn: string;
|
|
26
|
+
spinner: string[];
|
|
27
|
+
barFilled: string;
|
|
28
|
+
barEmpty: string;
|
|
29
|
+
rail: string;
|
|
30
|
+
phaseDone: string;
|
|
31
|
+
dash: string;
|
|
32
|
+
hLine: string;
|
|
33
|
+
treeBranch: string;
|
|
34
|
+
treeLast: string;
|
|
35
|
+
treePipe: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const UNICODE_GLYPHS: Glyphs;
|
|
38
|
+
export declare const ASCII_GLYPHS: Glyphs;
|
|
39
|
+
export declare function getGlyphs(): Glyphs;
|
|
40
|
+
/** Reset the cached glyph set. Test-only; production code should call `getGlyphs()`. */
|
|
41
|
+
export declare function _resetGlyphsCache(): void;
|
|
42
|
+
//# sourceMappingURL=glyphs.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IndexProgress {
|
|
2
|
+
phase: string;
|
|
3
|
+
current: number;
|
|
4
|
+
total: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ShimmerProgress {
|
|
7
|
+
onProgress: (progress: IndexProgress) => void;
|
|
8
|
+
stop: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createShimmerProgress(): ShimmerProgress;
|
|
11
|
+
//# sourceMappingURL=shimmer-progress.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Messages from main thread to worker */
|
|
2
|
+
export type ShimmerWorkerMessage = {
|
|
3
|
+
type: 'update';
|
|
4
|
+
phase: string;
|
|
5
|
+
phaseName: string;
|
|
6
|
+
percent: number;
|
|
7
|
+
count: number;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'finish-phase';
|
|
10
|
+
} | {
|
|
11
|
+
type: 'stop';
|
|
12
|
+
};
|
|
13
|
+
/** Messages from worker to main thread */
|
|
14
|
+
export type ShimmerMainMessage = {
|
|
15
|
+
type: 'stopped';
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `codegraph upgrade`
|
|
3
|
+
*
|
|
4
|
+
* Self-update for the CLI, whatever way it was installed:
|
|
5
|
+
*
|
|
6
|
+
* - **bundle** — the self-contained runtime+app installed by `install.sh`
|
|
7
|
+
* (Linux/macOS) or `install.ps1` (Windows). Upgrading re-runs the SAME
|
|
8
|
+
* canonical installer script (single source of truth) so the download /
|
|
9
|
+
* version-resolution / PATH logic never drifts between first-install and
|
|
10
|
+
* upgrade.
|
|
11
|
+
* - **npm** — installed via `npm i -g @colbymchenry/codegraph`. Upgrading
|
|
12
|
+
* shells out to npm.
|
|
13
|
+
* - **npx** — ephemeral; nothing to upgrade (next `npx` fetches latest).
|
|
14
|
+
* - **source** — a git checkout running its own `dist/`; `git pull` + rebuild.
|
|
15
|
+
*
|
|
16
|
+
* Detection is structural (see `detectInstallMethod`): a bundle carries a
|
|
17
|
+
* vendored `node` binary and a `bin/codegraph` launcher next to its `lib/`, so
|
|
18
|
+
* we can recognize it from the running file's path without a marker file.
|
|
19
|
+
*
|
|
20
|
+
* Windows wrinkle: a running `node.exe` is locked and can't be deleted, so the
|
|
21
|
+
* bundle's `current\` dir can't be overwritten in place by the process doing
|
|
22
|
+
* the upgrade. We therefore spawn a DETACHED helper that waits for this
|
|
23
|
+
* process to exit (releasing the lock), then runs `install.ps1`. This is the
|
|
24
|
+
* conventional Windows self-update dance (rustup/nvm-windows do the same).
|
|
25
|
+
*/
|
|
26
|
+
export declare const REPO = "ardelperal/codegraph";
|
|
27
|
+
export declare const NPM_PACKAGE = "codegraph-vba";
|
|
28
|
+
export declare const INSTALL_SH_URL = "https://raw.githubusercontent.com/ardelperal/codegraph/main/install.sh";
|
|
29
|
+
export type InstallMethod = {
|
|
30
|
+
kind: 'bundle';
|
|
31
|
+
os: 'unix' | 'windows';
|
|
32
|
+
bundleRoot: string;
|
|
33
|
+
installDir: string | null;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'npm';
|
|
36
|
+
scope: 'global' | 'local';
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'npx';
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'source';
|
|
41
|
+
root: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'unknown';
|
|
44
|
+
reason: string;
|
|
45
|
+
};
|
|
46
|
+
export interface DetectInput {
|
|
47
|
+
/** `__filename` of the running CLI module — `<…>/dist/bin/codegraph.js`. */
|
|
48
|
+
filename: string;
|
|
49
|
+
platform: NodeJS.Platform;
|
|
50
|
+
cwd: string;
|
|
51
|
+
/** Injectable existence probe (defaults to fs.existsSync) — for tests. */
|
|
52
|
+
exists?: (p: string) => boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Where the bundle installer keeps its install root, derived from the bundle
|
|
56
|
+
* dir so an upgrade reuses a custom `CODEGRAPH_INSTALL_DIR`. Returns null when
|
|
57
|
+
* the layout isn't the one the installer creates (then the installer falls
|
|
58
|
+
* back to its own default).
|
|
59
|
+
*
|
|
60
|
+
* unix: <installDir>/versions/<vX.Y.Z> (bundleRoot) → <installDir>
|
|
61
|
+
* windows: <installDir>\current (bundleRoot) → <installDir>
|
|
62
|
+
*/
|
|
63
|
+
export declare function deriveInstallDir(bundleRoot: string, os: 'unix' | 'windows', exists: (p: string) => boolean): string | null;
|
|
64
|
+
export declare function detectInstallMethod(input: DetectInput): InstallMethod;
|
|
65
|
+
export interface Semver {
|
|
66
|
+
major: number;
|
|
67
|
+
minor: number;
|
|
68
|
+
patch: number;
|
|
69
|
+
pre: string | null;
|
|
70
|
+
}
|
|
71
|
+
export declare function parseSemver(version: string): Semver | null;
|
|
72
|
+
/** Returns >0 if a>b, <0 if a<b, 0 if equal. Throws on unparseable input. */
|
|
73
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
74
|
+
export declare function isUpdateAvailable(current: string, latest: string): boolean;
|
|
75
|
+
/** `0.9.9` / `v0.9.9` → `v0.9.9` (release tags are v-prefixed). */
|
|
76
|
+
export declare function normalizeVersion(v: string): string;
|
|
77
|
+
/** Strip a leading `v`: `v0.9.9` → `0.9.9`. */
|
|
78
|
+
export declare function stripV(v: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Parse the release tag out of the `Location` header GitHub returns for
|
|
81
|
+
* `/releases/latest` → `…/releases/tag/v0.9.9`. Pure so it's unit-tested.
|
|
82
|
+
*/
|
|
83
|
+
export declare function parseLatestTagFromLocation(location: string | undefined): string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve the latest release tag (e.g. `v0.9.9`).
|
|
86
|
+
*
|
|
87
|
+
* Primary: read the redirect `Location` from `github.com/<repo>/releases/latest`
|
|
88
|
+
* — same trick install.sh uses, because the unauthenticated GitHub API is
|
|
89
|
+
* rate-limited to 60 req/h/IP and 403s on shared/cloud hosts (issue #325). The
|
|
90
|
+
* redirect has no such limit. Fall back to the API only if the redirect can't
|
|
91
|
+
* be read.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveLatestVersion(repo?: string, timeoutMs?: number): Promise<string>;
|
|
94
|
+
export interface UpgradeOptions {
|
|
95
|
+
/** Pin a specific version (positional arg or CODEGRAPH_VERSION). */
|
|
96
|
+
version?: string;
|
|
97
|
+
/** Report current vs latest, don't change anything. */
|
|
98
|
+
check?: boolean;
|
|
99
|
+
/** Reinstall even if already on the resolved version. */
|
|
100
|
+
force?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** Injectable side-effects so the orchestrator stays unit-testable. */
|
|
103
|
+
export interface UpgradeDeps {
|
|
104
|
+
currentVersion: string;
|
|
105
|
+
method: InstallMethod;
|
|
106
|
+
resolveLatest: (pin?: string) => Promise<string>;
|
|
107
|
+
/** Run a command inheriting stdio; returns its exit code (-1 = spawn failed). */
|
|
108
|
+
run: (cmd: string, args: string[], env?: NodeJS.ProcessEnv) => number;
|
|
109
|
+
hasCommand: (cmd: string) => boolean;
|
|
110
|
+
log: (msg: string) => void;
|
|
111
|
+
warn: (msg: string) => void;
|
|
112
|
+
error: (msg: string) => void;
|
|
113
|
+
platform: NodeJS.Platform;
|
|
114
|
+
}
|
|
115
|
+
/** The honest, additive re-index reminder shown after a successful upgrade. */
|
|
116
|
+
export declare function reindexAdvisory(): string;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the process exit code (0 = success / nothing to do, 1 = failure).
|
|
119
|
+
*/
|
|
120
|
+
export declare function runUpgrade(opts: UpgradeOptions, deps: UpgradeDeps): Promise<number>;
|
|
121
|
+
/** Build the in-place Windows upgrade script (exported for unit-testing). */
|
|
122
|
+
export declare function buildWindowsUpgradeScript(bundleRoot: string, version: string, arch: string): string;
|
|
123
|
+
/**
|
|
124
|
+
* True if `cmd` resolves to an executable on PATH. A pure-Node PATH scan — NOT
|
|
125
|
+
* a spawned `command -v`/`which`: `command` is a shell builtin (no standalone
|
|
126
|
+
* binary on Debian, though macOS ships one), and `which` isn't guaranteed
|
|
127
|
+
* present on minimal images, so spawning either is unreliable. Scanning PATH
|
|
128
|
+
* ourselves behaves identically on every platform.
|
|
129
|
+
*/
|
|
130
|
+
export declare function hasCommand(cmd: string): boolean;
|
|
131
|
+
export declare function defaultRun(cmd: string, args: string[], env?: NodeJS.ProcessEnv): number;
|
|
132
|
+
//# sourceMappingURL=index.d.ts.map
|