@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.
Files changed (153) hide show
  1. package/README.md +855 -0
  2. package/dist/bin/codegraph.d.ts +26 -0
  3. package/dist/bin/command-supervision.d.ts +12 -0
  4. package/dist/bin/fatal-handler.d.ts +20 -0
  5. package/dist/bin/node-version-check.d.ts +37 -0
  6. package/dist/bin/uninstall.d.ts +14 -0
  7. package/dist/context/formatter.d.ts +30 -0
  8. package/dist/context/index.d.ts +119 -0
  9. package/dist/context/markers.d.ts +19 -0
  10. package/dist/db/index.d.ts +122 -0
  11. package/dist/db/migrations.d.ts +44 -0
  12. package/dist/db/queries.d.ts +402 -0
  13. package/dist/db/sqlite-adapter.d.ts +53 -0
  14. package/dist/directory.d.ts +179 -0
  15. package/dist/errors.d.ts +136 -0
  16. package/dist/extraction/astro-extractor.d.ts +79 -0
  17. package/dist/extraction/dfm-extractor.d.ts +31 -0
  18. package/dist/extraction/extraction-version.d.ts +25 -0
  19. package/dist/extraction/function-ref.d.ts +118 -0
  20. package/dist/extraction/generated-detection.d.ts +30 -0
  21. package/dist/extraction/grammars.d.ts +128 -0
  22. package/dist/extraction/index.d.ts +187 -0
  23. package/dist/extraction/languages/c-cpp.d.ts +12 -0
  24. package/dist/extraction/languages/csharp.d.ts +25 -0
  25. package/dist/extraction/languages/dart.d.ts +3 -0
  26. package/dist/extraction/languages/go.d.ts +3 -0
  27. package/dist/extraction/languages/index.d.ts +10 -0
  28. package/dist/extraction/languages/java.d.ts +3 -0
  29. package/dist/extraction/languages/javascript.d.ts +3 -0
  30. package/dist/extraction/languages/kotlin.d.ts +3 -0
  31. package/dist/extraction/languages/lua.d.ts +3 -0
  32. package/dist/extraction/languages/luau.d.ts +3 -0
  33. package/dist/extraction/languages/objc.d.ts +3 -0
  34. package/dist/extraction/languages/pascal.d.ts +3 -0
  35. package/dist/extraction/languages/php.d.ts +3 -0
  36. package/dist/extraction/languages/python.d.ts +3 -0
  37. package/dist/extraction/languages/r.d.ts +3 -0
  38. package/dist/extraction/languages/ruby.d.ts +3 -0
  39. package/dist/extraction/languages/rust.d.ts +3 -0
  40. package/dist/extraction/languages/scala.d.ts +3 -0
  41. package/dist/extraction/languages/swift.d.ts +3 -0
  42. package/dist/extraction/languages/typescript.d.ts +16 -0
  43. package/dist/extraction/liquid-extractor.d.ts +59 -0
  44. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  45. package/dist/extraction/parse-pool.d.ts +126 -0
  46. package/dist/extraction/parse-worker.d.ts +8 -0
  47. package/dist/extraction/razor-extractor.d.ts +42 -0
  48. package/dist/extraction/sql-query-extractor.d.ts +25 -0
  49. package/dist/extraction/svelte-extractor.d.ts +56 -0
  50. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  51. package/dist/extraction/tree-sitter-types.d.ts +239 -0
  52. package/dist/extraction/tree-sitter.d.ts +647 -0
  53. package/dist/extraction/vba-extractor.d.ts +394 -0
  54. package/dist/extraction/vba-form-extractor.d.ts +89 -0
  55. package/dist/extraction/vba-preprocess.d.ts +81 -0
  56. package/dist/extraction/vue-extractor.d.ts +51 -0
  57. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  58. package/dist/graph/index.d.ts +8 -0
  59. package/dist/graph/queries.d.ts +106 -0
  60. package/dist/graph/traversal.d.ts +127 -0
  61. package/dist/index.d.ts +563 -0
  62. package/dist/installer/config-writer.d.ts +28 -0
  63. package/dist/installer/index.d.ts +100 -0
  64. package/dist/installer/instructions-template.d.ts +41 -0
  65. package/dist/installer/targets/antigravity.d.ts +57 -0
  66. package/dist/installer/targets/claude.d.ts +62 -0
  67. package/dist/installer/targets/codex.d.ts +18 -0
  68. package/dist/installer/targets/cursor.d.ts +35 -0
  69. package/dist/installer/targets/gemini.d.ts +26 -0
  70. package/dist/installer/targets/hermes.d.ts +18 -0
  71. package/dist/installer/targets/kiro.d.ts +27 -0
  72. package/dist/installer/targets/opencode.d.ts +38 -0
  73. package/dist/installer/targets/registry.d.ts +35 -0
  74. package/dist/installer/targets/shared.d.ts +101 -0
  75. package/dist/installer/targets/toml.d.ts +52 -0
  76. package/dist/installer/targets/types.d.ts +108 -0
  77. package/dist/mcp/daemon-manager.d.ts +42 -0
  78. package/dist/mcp/daemon-paths.d.ts +73 -0
  79. package/dist/mcp/daemon-registry.d.ts +47 -0
  80. package/dist/mcp/daemon.d.ts +258 -0
  81. package/dist/mcp/dynamic-boundaries.d.ts +41 -0
  82. package/dist/mcp/engine.d.ts +122 -0
  83. package/dist/mcp/index.d.ts +113 -0
  84. package/dist/mcp/liveness-watchdog.d.ts +18 -0
  85. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  86. package/dist/mcp/proxy.d.ts +87 -0
  87. package/dist/mcp/query-pool.d.ts +94 -0
  88. package/dist/mcp/query-worker.d.ts +24 -0
  89. package/dist/mcp/server-instructions.d.ts +34 -0
  90. package/dist/mcp/session.d.ts +79 -0
  91. package/dist/mcp/stdin-teardown.d.ts +27 -0
  92. package/dist/mcp/tools.d.ts +591 -0
  93. package/dist/mcp/transport.d.ts +188 -0
  94. package/dist/mcp/version.d.ts +19 -0
  95. package/dist/project-config.d.ts +56 -0
  96. package/dist/reasoning/config.d.ts +45 -0
  97. package/dist/reasoning/credentials.d.ts +5 -0
  98. package/dist/reasoning/login.d.ts +21 -0
  99. package/dist/reasoning/reasoner.d.ts +43 -0
  100. package/dist/resolution/c-fnptr-synthesizer.d.ts +5 -0
  101. package/dist/resolution/callback-synthesizer.d.ts +15 -0
  102. package/dist/resolution/frameworks/astro.d.ts +9 -0
  103. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  104. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  105. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  106. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  107. package/dist/resolution/frameworks/express.d.ts +8 -0
  108. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  109. package/dist/resolution/frameworks/go.d.ts +8 -0
  110. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  111. package/dist/resolution/frameworks/index.d.ts +50 -0
  112. package/dist/resolution/frameworks/java.d.ts +8 -0
  113. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  114. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  115. package/dist/resolution/frameworks/play.d.ts +19 -0
  116. package/dist/resolution/frameworks/python.d.ts +10 -0
  117. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  118. package/dist/resolution/frameworks/react.d.ts +8 -0
  119. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  120. package/dist/resolution/frameworks/rust.d.ts +8 -0
  121. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  122. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  123. package/dist/resolution/frameworks/swift.d.ts +10 -0
  124. package/dist/resolution/frameworks/vue.d.ts +9 -0
  125. package/dist/resolution/go-module.d.ts +26 -0
  126. package/dist/resolution/goframe-synthesizer.d.ts +28 -0
  127. package/dist/resolution/import-resolver.d.ts +78 -0
  128. package/dist/resolution/index.d.ts +196 -0
  129. package/dist/resolution/lru-cache.d.ts +24 -0
  130. package/dist/resolution/name-matcher.d.ts +93 -0
  131. package/dist/resolution/path-aliases.d.ts +68 -0
  132. package/dist/resolution/strip-comments.d.ts +27 -0
  133. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  134. package/dist/resolution/types.d.ts +233 -0
  135. package/dist/resolution/workspace-packages.d.ts +48 -0
  136. package/dist/search/query-parser.d.ts +57 -0
  137. package/dist/search/query-utils.d.ts +87 -0
  138. package/dist/sync/git-hooks.d.ts +45 -0
  139. package/dist/sync/index.d.ts +19 -0
  140. package/dist/sync/watch-policy.d.ts +48 -0
  141. package/dist/sync/watcher.d.ts +358 -0
  142. package/dist/sync/worktree.d.ts +54 -0
  143. package/dist/telemetry/index.d.ts +143 -0
  144. package/dist/types.d.ts +409 -0
  145. package/dist/ui/glyphs.d.ts +42 -0
  146. package/dist/ui/shimmer-progress.d.ts +11 -0
  147. package/dist/ui/shimmer-worker.d.ts +2 -0
  148. package/dist/ui/types.d.ts +17 -0
  149. package/dist/upgrade/index.d.ts +132 -0
  150. package/dist/utils.d.ts +224 -0
  151. package/npm-sdk.js +75 -0
  152. package/npm-shim.js +246 -0
  153. package/package.json +32 -0
@@ -0,0 +1,136 @@
1
+ /**
2
+ * CodeGraph Error Classes
3
+ *
4
+ * Custom error types for better error handling and debugging.
5
+ *
6
+ * @module errors
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { FileError, ParseError, setLogger, silentLogger } from 'codegraph';
11
+ *
12
+ * // Catch specific error types
13
+ * try {
14
+ * await cg.indexAll();
15
+ * } catch (error) {
16
+ * if (error instanceof FileError) {
17
+ * console.log(`File error at ${error.filePath}: ${error.message}`);
18
+ * } else if (error instanceof ParseError) {
19
+ * console.log(`Parse error at ${error.filePath}:${error.line}`);
20
+ * }
21
+ * }
22
+ *
23
+ * // Disable logging for tests
24
+ * setLogger(silentLogger);
25
+ * ```
26
+ */
27
+ /**
28
+ * Base error class for all CodeGraph errors.
29
+ *
30
+ * All CodeGraph-specific errors extend this class, allowing you to catch
31
+ * all CodeGraph errors with a single catch block.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * try {
36
+ * await cg.indexAll();
37
+ * } catch (error) {
38
+ * if (error instanceof CodeGraphError) {
39
+ * console.log(`CodeGraph error [${error.code}]: ${error.message}`);
40
+ * }
41
+ * }
42
+ * ```
43
+ */
44
+ export declare class CodeGraphError extends Error {
45
+ /** Error code for categorization (e.g., 'FILE_ERROR', 'PARSE_ERROR') */
46
+ readonly code: string;
47
+ /** Additional context about the error */
48
+ readonly context?: Record<string, unknown>;
49
+ constructor(message: string, code: string, context?: Record<string, unknown>);
50
+ }
51
+ /**
52
+ * Error reading or accessing files
53
+ */
54
+ export declare class FileError extends CodeGraphError {
55
+ readonly filePath: string;
56
+ constructor(message: string, filePath: string, cause?: Error);
57
+ }
58
+ /**
59
+ * Error parsing source code
60
+ */
61
+ export declare class ParseError extends CodeGraphError {
62
+ readonly filePath: string;
63
+ readonly line?: number;
64
+ readonly column?: number;
65
+ constructor(message: string, filePath: string, options?: {
66
+ line?: number;
67
+ column?: number;
68
+ cause?: Error;
69
+ });
70
+ }
71
+ /**
72
+ * Error with database operations
73
+ */
74
+ export declare class DatabaseError extends CodeGraphError {
75
+ readonly operation: string;
76
+ constructor(message: string, operation: string, cause?: Error);
77
+ }
78
+ /**
79
+ * Error with search operations
80
+ */
81
+ export declare class SearchError extends CodeGraphError {
82
+ readonly query: string;
83
+ constructor(message: string, query: string, cause?: Error);
84
+ }
85
+ /**
86
+ * Error with vector/embedding operations
87
+ */
88
+ export declare class VectorError extends CodeGraphError {
89
+ constructor(message: string, operation: string, cause?: Error);
90
+ }
91
+ /**
92
+ * Error with configuration
93
+ */
94
+ export declare class ConfigError extends CodeGraphError {
95
+ constructor(message: string, details?: Record<string, unknown>);
96
+ }
97
+ /**
98
+ * Simple logger for CodeGraph operations
99
+ *
100
+ * By default, logs to console.warn for warnings and console.error for errors.
101
+ * Can be configured to use custom logging.
102
+ */
103
+ export interface Logger {
104
+ debug(message: string, context?: Record<string, unknown>): void;
105
+ warn(message: string, context?: Record<string, unknown>): void;
106
+ error(message: string, context?: Record<string, unknown>): void;
107
+ }
108
+ /**
109
+ * Default console-based logger
110
+ */
111
+ export declare const defaultLogger: Logger;
112
+ /**
113
+ * Silent logger (no output) - useful for tests
114
+ */
115
+ export declare const silentLogger: Logger;
116
+ /**
117
+ * Set the global logger
118
+ */
119
+ export declare function setLogger(logger: Logger): void;
120
+ /**
121
+ * Get the current logger
122
+ */
123
+ export declare function getLogger(): Logger;
124
+ /**
125
+ * Log a debug message
126
+ */
127
+ export declare function logDebug(message: string, context?: Record<string, unknown>): void;
128
+ /**
129
+ * Log a warning message
130
+ */
131
+ export declare function logWarn(message: string, context?: Record<string, unknown>): void;
132
+ /**
133
+ * Log an error message
134
+ */
135
+ export declare function logError(message: string, context?: Record<string, unknown>): void;
136
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,79 @@
1
+ import { ExtractionResult } from '../types';
2
+ /**
3
+ * AstroExtractor - Extracts code relationships from Astro component files
4
+ *
5
+ * Astro files are multi-language: a TypeScript frontmatter block fenced by
6
+ * `---` lines, a JSX-like HTML template, and optional <script>/<style> blocks.
7
+ * Rather than parsing a full Astro grammar, we extract the frontmatter and
8
+ * <script> contents and delegate them to the TypeScript TreeSitterExtractor
9
+ * (Astro processes both as TypeScript by default — no `lang` attr needed).
10
+ *
11
+ * Also extracts function calls from template expressions (`{fn(...)}`) and
12
+ * component usages (`<PascalCase>`) so cross-file edges are captured even
13
+ * when the only reference lives in markup.
14
+ *
15
+ * Every .astro file produces a component node (Astro components are always
16
+ * importable).
17
+ */
18
+ export declare class AstroExtractor {
19
+ private filePath;
20
+ private source;
21
+ private nodes;
22
+ private edges;
23
+ private unresolvedReferences;
24
+ private errors;
25
+ constructor(filePath: string, source: string);
26
+ /**
27
+ * Extract from Astro source
28
+ */
29
+ extract(): ExtractionResult;
30
+ /**
31
+ * Create a component node for the .astro file
32
+ */
33
+ private createComponentNode;
34
+ /**
35
+ * Extract the frontmatter block: the content between the opening `---`
36
+ * fence (first non-blank line of the file) and the closing `---` fence.
37
+ * An unclosed fence is treated as "no frontmatter" rather than swallowing
38
+ * the whole template as TypeScript.
39
+ *
40
+ * Returns the content plus its 0-indexed start line, or null.
41
+ */
42
+ private extractFrontmatter;
43
+ /**
44
+ * Extract <script> blocks from the template portion
45
+ */
46
+ private extractScriptBlocks;
47
+ /**
48
+ * Process frontmatter / script content by delegating to TreeSitterExtractor.
49
+ * Astro treats both as TypeScript by default.
50
+ */
51
+ private processScriptContent;
52
+ /**
53
+ * Line ranges (0-indexed, inclusive) the template scans must skip:
54
+ * the frontmatter block and <script>/<style> blocks.
55
+ */
56
+ private getCoveredRanges;
57
+ /**
58
+ * Extract function calls from Astro template expressions.
59
+ *
60
+ * Astro templates embed JSX-like expressions (`{formatDate(post.date)}`,
61
+ * `class:list={cn(...)}`), so calls frequently live in markup rather than
62
+ * the frontmatter. We scan template lines for `{expression}` groups and
63
+ * extract call patterns from them. A `{` group left open at end-of-line
64
+ * (the pervasive `{posts.map((post) => (` pattern) contributes the calls
65
+ * on its opening line.
66
+ */
67
+ private extractTemplateCalls;
68
+ /**
69
+ * Extract component usages from the Astro template.
70
+ *
71
+ * PascalCase tags like <Layout>, <PostCard /> represent component
72
+ * instantiations — analogous to function calls in imperative code.
73
+ * Lowercase tags are native HTML (Astro does not register kebab-case
74
+ * components the way Vue does, so those are real custom elements and
75
+ * are skipped).
76
+ */
77
+ private extractTemplateComponents;
78
+ }
79
+ //# sourceMappingURL=astro-extractor.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { ExtractionResult } from '../types';
2
+ /**
3
+ * Custom extractor for Delphi DFM/FMX form files.
4
+ *
5
+ * DFM/FMX files describe the visual component hierarchy and event handler
6
+ * bindings. They use a simple text format (object/end blocks) that we parse
7
+ * with regex — no tree-sitter grammar exists for this format.
8
+ *
9
+ * Extracted information:
10
+ * - Components as NodeKind `component`
11
+ * - Nesting as EdgeKind `contains`
12
+ * - Event handlers (OnClick = MethodName) as UnresolvedReference → EdgeKind `references`
13
+ */
14
+ export declare class DfmExtractor {
15
+ private filePath;
16
+ private source;
17
+ private nodes;
18
+ private edges;
19
+ private unresolvedReferences;
20
+ private errors;
21
+ constructor(filePath: string, source: string);
22
+ /**
23
+ * Extract components and event handler references from DFM/FMX source
24
+ */
25
+ extract(): ExtractionResult;
26
+ /** Create a file node for the DFM form file */
27
+ private createFileNode;
28
+ /** Parse object/end blocks and extract components + event handlers */
29
+ private parseComponents;
30
+ }
31
+ //# sourceMappingURL=dfm-extractor.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Extraction version
3
+ *
4
+ * A monotonically-increasing integer that identifies the *shape and depth* of
5
+ * what the extractor writes into the graph. Unlike `CURRENT_SCHEMA_VERSION`
6
+ * (which tracks the SQLite table layout and is migrated in place), this tracks
7
+ * the EXTRACTED CONTENT — node kinds, edges, synthesizers, resolver coverage.
8
+ *
9
+ * When an index was built by an older engine whose `EXTRACTION_VERSION` is
10
+ * below the running engine's, the data on disk is structurally fine but
11
+ * *stale*: it's missing whatever a newer extractor would now produce. A schema
12
+ * migration can't backfill that — only a re-index can. So this is the signal
13
+ * `codegraph status` uses to recommend a re-index, and the reason `codegraph
14
+ * upgrade` reminds users to refresh their projects.
15
+ *
16
+ * BUMP THIS when a release changes extraction output enough that existing
17
+ * indexes should be rebuilt to benefit — e.g. a new language/framework
18
+ * extractor, a new dynamic-dispatch synthesizer, a new node/edge kind, or a
19
+ * resolver fix that materially changes which edges exist. Do NOT bump for
20
+ * pure bug fixes, CLI/UX changes, or schema-only migrations. Over-bumping
21
+ * turns the re-index hint into noise — keep it honest (see CLAUDE.md, "Honesty
22
+ * in the product is load-bearing").
23
+ */
24
+ export declare const EXTRACTION_VERSION = 24;
25
+ //# sourceMappingURL=extraction-version.d.ts.map
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Function-as-value capture (#756) — registration-linking for callbacks.
3
+ *
4
+ * A function name used as a VALUE — passed as a call argument
5
+ * (`register_handler(target_cb)`, `signal(SIGINT, handler)`), assigned to a
6
+ * field or function pointer (`o->cb = target_cb`, `OnFire := TargetCb`),
7
+ * placed in a struct/object initializer (`{ .recv_cb = my_cb }`,
8
+ * `{ recv: targetCb }`, `Ops{Cb: targetCb}`), or listed in a function table
9
+ * (`static cb_t table[] = { cb_a, cb_b }`) — is a real dependency that static
10
+ * call extraction misses entirely: `callers(target_cb)` showed nothing but
11
+ * direct calls, so every callback looked dead and its registration sites were
12
+ * invisible to impact analysis.
13
+ *
14
+ * This module captures those value positions during the AST walk as
15
+ * `function_ref` candidates. Capture is table-driven per language (the value
16
+ * positions and wrapper forms differ per grammar — `&fn` in C, `Main::fn` in
17
+ * Java, `::fn` in Kotlin, `#selector(fn)` in Swift, `@TargetCb` in Pascal,
18
+ * `method(:fn)` in Ruby). Candidates are GATED at end-of-file extraction
19
+ * (see `TreeSitterExtractor.flushFnRefCandidates`): only names matching a
20
+ * same-file function/method or an imported binding survive, which bounds
21
+ * volume and keeps precision high. Resolution then matches survivors against
22
+ * function/method nodes ONLY (`matchFunctionRef` in
23
+ * `src/resolution/name-matcher.ts`) and persists them as `references` edges,
24
+ * which `callers`/`impact` already traverse.
25
+ *
26
+ * Deliberately NOT covered (resolving the *dispatch* — `o->cb(x)` → the
27
+ * registered function — needs data-flow through struct fields; a wrong edge
28
+ * is worse than none): indirect-call resolution and `obj.method` member
29
+ * values where `obj` isn't `this`/`self` (the receiver's type is statically
30
+ * unknowable without local data-flow).
31
+ */
32
+ import type { Node as SyntaxNode } from 'web-tree-sitter';
33
+ export interface FnRefCandidate {
34
+ name: string;
35
+ line: number;
36
+ column: number;
37
+ /** Which capture position produced this candidate (gate policy keys on it). */
38
+ mode: CaptureMode;
39
+ /**
40
+ * True when the value was an explicit reference form (`&fn`, `&Cls::m`,
41
+ * `::fn`, `#selector`, `method(:sym)`) rather than a bare identifier —
42
+ * C++'s flush policy keys on it.
43
+ */
44
+ explicitRef: boolean;
45
+ /**
46
+ * Skip the same-file/import name gate for this candidate. Set for PHP
47
+ * string callables in known HOF positions: PHP global functions are
48
+ * referenced cross-file WITHOUT imports (global namespace), so the gate
49
+ * can't see them — the strong positional prior (a string argument to
50
+ * `usort`/`array_map`/…) plus resolution's unique-or-drop rule carry the
51
+ * precision instead.
52
+ */
53
+ skipGate?: boolean;
54
+ }
55
+ /** How to pull candidate value nodes out of a dispatched container node. */
56
+ type CaptureMode = 'args' | 'rhs' | 'value' | 'list' | 'varinit';
57
+ interface CaptureRule {
58
+ mode: CaptureMode;
59
+ /** Field holding the value for rhs/value/varinit (defaults per mode). */
60
+ field?: string;
61
+ }
62
+ export interface FnRefSpec {
63
+ /** Bare identifier node types that can act as a function value. */
64
+ idTypes: Set<string>;
65
+ /** Container node type → how to extract candidate values from it. */
66
+ dispatch: Map<string, CaptureRule>;
67
+ /**
68
+ * Transparent wrapper layers between a container and its values
69
+ * (`argument`, `value_argument`, `literal_element`, `expression_list`…).
70
+ * Value: the field to descend into, or null for "named children".
71
+ * `expression_list` fans out to ALL named children (Go multi-assign).
72
+ */
73
+ layers?: Map<string, string | null>;
74
+ /**
75
+ * Unary wrappers whose operand is the function value — C/C++ `&fn`
76
+ * (pointer_expression), Pascal `@Fn` (exprUnary), Scala eta `fn _`
77
+ * (postfix_expression). Value: operand field, or null for first named child.
78
+ */
79
+ unwrap?: Map<string, string | null>;
80
+ /**
81
+ * Whole-node reference forms needing bespoke name extraction —
82
+ * `method_reference` (Java), `callable_reference` / `navigation_expression`
83
+ * (Kotlin), `selector_expression` (Swift `#selector` / ObjC `@selector`),
84
+ * Ruby `method(:sym)` calls, and `this.method` member forms.
85
+ */
86
+ special?: Set<string>;
87
+ /**
88
+ * Capture modes whose candidates skip the same-file/import gate and rely on
89
+ * resolution's unique-or-drop rule instead. C-family only: an initializer
90
+ * value, function-pointer assignment RHS, or table element is a
91
+ * function-pointer position by construction, and C has no symbol imports —
92
+ * the dominant repo-scale pattern (`server.c`'s command table naming
93
+ * handlers defined across files) would otherwise be invisible. Call
94
+ * arguments stay gated everywhere (locals passed as args dwarf callbacks).
95
+ */
96
+ ungatedModes?: Set<CaptureMode>;
97
+ /**
98
+ * C++ only: in args/rhs/varinit positions, accept ONLY explicit reference
99
+ * forms (`&fn`, `&Cls::method`) — never bare identifiers. C++ codebases are
100
+ * dense with generic free-function/accessor names (`begin`, `end`, `out`,
101
+ * `size`, `data`) that collide with parameters and locals, and out-of-line
102
+ * member definitions extract as function-kind nodes — bare-id matching on
103
+ * fmt was mostly wrong edges. File-scope initializer tables (value/list)
104
+ * still accept bare identifiers, same as C.
105
+ */
106
+ addressOfOnly?: boolean;
107
+ }
108
+ /**
109
+ * Capture specs by language.
110
+ */
111
+ export declare const FN_REF_SPECS: Record<string, FnRefSpec | undefined>;
112
+ /**
113
+ * Extract candidate names from a dispatched container node. Returns the
114
+ * (name, position) pairs of every function-value-shaped expression found.
115
+ */
116
+ export declare function captureFnRefCandidates(container: SyntaxNode, rule: CaptureRule, spec: FnRefSpec, source: string): FnRefCandidate[];
117
+ export {};
118
+ //# sourceMappingURL=function-ref.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Generated-file detection for symbol-disambiguation down-ranking.
3
+ *
4
+ * When a query like "Send" matches 17 symbols across protobuf scaffolding,
5
+ * test mocks, and the hand-written implementation, the FTS ranker often
6
+ * surfaces the generated stubs first because their names are identical
7
+ * to the implementation's name (validated empirically on cosmos-sdk —
8
+ * see project_go_multi_module_audit memory). Generated stubs frequently
9
+ * have no body to trace from, so the agent ends up reading source anyway.
10
+ *
11
+ * This helper is a pure path-based classifier consulted at disambiguation
12
+ * time (findSymbol / findAllSymbols / codegraph_search formatting), NOT
13
+ * a hard filter — generated nodes are still in the graph and remain
14
+ * reachable; they just rank LAST when there's a real implementation
15
+ * with the same name.
16
+ *
17
+ * Scope: suffix patterns only. Most generated files follow the
18
+ * `<basename>.<tool>.<ext>` convention (`.pb.go`, `_grpc.pb.go`,
19
+ * `.g.dart`, `_pb2.py`), and that covers ~all of what we saw in the
20
+ * Go audit. A future addition would be scanning for the canonical
21
+ * `// Code generated by` header during extraction, for the rare files
22
+ * that defy the suffix convention.
23
+ */
24
+ /**
25
+ * Whether `filePath` looks like a tool-generated source file based on
26
+ * its filename. Path-only — does not read content. The result is a
27
+ * relevance hint for disambiguation, not a hard claim.
28
+ */
29
+ export declare function isGeneratedFile(filePath: string): boolean;
30
+ //# sourceMappingURL=generated-detection.d.ts.map
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Grammar Loading and Caching
3
+ *
4
+ * Uses web-tree-sitter (WASM) for universal cross-platform support.
5
+ * Grammars are loaded lazily — only languages actually present in the project
6
+ * are compiled, keeping V8 WASM memory pressure low on large codebases.
7
+ */
8
+ import { Parser } from 'web-tree-sitter';
9
+ import { Language } from '../types';
10
+ export type GrammarLanguage = Exclude<Language, 'svelte' | 'vue' | 'astro' | 'liquid' | 'razor' | 'yaml' | 'twig' | 'xml' | 'properties' | 'vba' | 'sql' | 'unknown'>;
11
+ /**
12
+ * File extension to Language mapping
13
+ */
14
+ export declare const EXTENSION_MAP: Record<string, Language>;
15
+ /**
16
+ * Whether a file is one CodeGraph can parse, based purely on its extension.
17
+ * This is the single source of truth for "should we index this file" — derived
18
+ * from EXTENSION_MAP so parser support and indexing selection never drift.
19
+ *
20
+ * `overrides` is the project's validated custom extension → language map (from
21
+ * `codegraph.json`); when present its extensions count as indexable in addition
22
+ * to the built-ins. Omitting it is byte-identical to the zero-config behavior.
23
+ */
24
+ export declare function isSourceFile(filePath: string, overrides?: Record<string, Language>): boolean;
25
+ /**
26
+ * Shopify OS 2.0 JSON template (`templates/*.json`) or section group
27
+ * (`sections/*.json`) — these reference sections by `"type"`, so the Liquid
28
+ * extractor links them. (config/ + locales/ JSON have no section refs.)
29
+ */
30
+ export declare function isShopifyLiquidJson(filePath: string): boolean;
31
+ /**
32
+ * Play Framework routes file: the extensionless `conf/routes` (and included
33
+ * `conf/*.routes`). No grammar — route extraction is done by the Play framework
34
+ * resolver, so it's processed through the no-grammar (`yaml`-style) path.
35
+ */
36
+ export declare function isPlayRoutesFile(filePath: string): boolean;
37
+ /**
38
+ * Dysflow exports Access/VBA form/report UI as `.form.txt` and `.report.txt`
39
+ * (two-segment extensions). `path.extname()` collapses them to `.txt`, which
40
+ * would falsely classify every text file as VBA. This helper recognizes the
41
+ * two-segment shape by checking the basename's last 9 or 11 characters.
42
+ *
43
+ * Used as a pre-check BEFORE `path.extname()` in both `detectLanguage()` and
44
+ * `isSourceFile()`. Returns true for `.form.txt` / `.report.txt` (any depth,
45
+ * forward or backslash separators); false for everything else.
46
+ *
47
+ * Trailing whitespace, case differences, and bare `.form`/`.report` (no .txt)
48
+ * are all treated as non-VBA — Dysflow always writes the `.txt` suffix.
49
+ */
50
+ export declare function detectVbaFormFile(filePath: string): boolean;
51
+ /**
52
+ * Initialize the tree-sitter WASM runtime. Must be called before loading grammars.
53
+ * Does NOT load any grammar WASM files — use loadGrammarsForLanguages() for that.
54
+ * Idempotent — safe to call multiple times.
55
+ */
56
+ export declare function initGrammars(): Promise<void>;
57
+ /**
58
+ * Load grammar WASM files for specific languages only.
59
+ * Skips languages that are already loaded or have no WASM grammar.
60
+ * Must be called after initGrammars().
61
+ */
62
+ export declare function loadGrammarsForLanguages(languages: Language[]): Promise<void>;
63
+ /**
64
+ * Load ALL grammar WASM files. Convenience function for tests and
65
+ * backward compatibility. Prefer loadGrammarsForLanguages() in production.
66
+ */
67
+ export declare function loadAllGrammars(): Promise<void>;
68
+ /**
69
+ * Check if grammars have been initialized
70
+ */
71
+ export declare function isGrammarsInitialized(): boolean;
72
+ /**
73
+ * Get a parser for the specified language.
74
+ * Returns synchronously from pre-loaded cache.
75
+ */
76
+ export declare function getParser(language: Language): Parser | null;
77
+ /**
78
+ * Detect language from file extension.
79
+ *
80
+ * `overrides` is the project's validated custom extension → language map (from
81
+ * `codegraph.json`); when present its mappings take precedence over the built-in
82
+ * `EXTENSION_MAP`. Omitting it is byte-identical to the zero-config behavior.
83
+ */
84
+ export declare function detectLanguage(filePath: string, source?: string, overrides?: Record<string, Language>): Language;
85
+ /**
86
+ * Check if a language is supported (has a grammar defined).
87
+ * Returns true if the grammar exists, even if not yet loaded.
88
+ */
89
+ export declare function isLanguageSupported(language: Language): boolean;
90
+ /**
91
+ * Check if a grammar has been loaded and is ready for parsing.
92
+ */
93
+ export declare function isGrammarLoaded(language: Language): boolean;
94
+ /**
95
+ * Languages tracked at the file-record level only: parsing emits zero symbol
96
+ * nodes, but the file is still stored (and framework resolvers may add per-file
97
+ * references later, e.g. Drupal routing yml, Spring `@Value` against
98
+ * application.properties). This is the canonical set behind the no-symbol
99
+ * branch in `tree-sitter.ts`; `xml` is intentionally excluded because its
100
+ * MyBatis extractor emits a file node. Callers use this to count such files as
101
+ * indexed rather than skipped, so it must stay in sync with that branch.
102
+ */
103
+ export declare function isFileLevelOnlyLanguage(language: Language): boolean;
104
+ /**
105
+ * Get all supported languages (those with grammar definitions).
106
+ */
107
+ export declare function getSupportedLanguages(): Language[];
108
+ /**
109
+ * Reset the cached parser for a language to reclaim WASM heap memory.
110
+ * The tree-sitter WASM runtime accumulates fragmented memory over thousands
111
+ * of parses. Deleting and recreating the Parser instance forces the WASM
112
+ * heap to reset, preventing "memory access out of bounds" crashes in
113
+ * large repos.
114
+ */
115
+ export declare function resetParser(language: Language): void;
116
+ /**
117
+ * Clear parser/grammar caches (useful for testing)
118
+ */
119
+ export declare function clearParserCache(): void;
120
+ /**
121
+ * Report grammars that failed to load.
122
+ */
123
+ export declare function getUnavailableGrammarErrors(): Partial<Record<Language, string>>;
124
+ /**
125
+ * Get language display name
126
+ */
127
+ export declare function getLanguageDisplayName(language: Language): string;
128
+ //# sourceMappingURL=grammars.d.ts.map