@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,68 @@
1
+ /**
2
+ * Project-level import-path alias loading.
3
+ *
4
+ * Reads `compilerOptions.paths` from `tsconfig.json` / `jsconfig.json`
5
+ * at the project root and converts the patterns into a form the
6
+ * import-resolver can consult.
7
+ *
8
+ * This is the single biggest blocker to accurate resolution on modern
9
+ * JS/TS codebases: aliases like `@/components/Foo` (Next, Nuxt, Nest,
10
+ * Vite scaffolds) point into a `paths` map the resolver previously
11
+ * ignored — every import through an alias was treated as unresolvable
12
+ * unless it happened to match the small hard-coded fallback list.
13
+ *
14
+ * Scope deliberately small for v1:
15
+ * - reads tsconfig.json, then jsconfig.json
16
+ * - honours top-level `compilerOptions.baseUrl` and `compilerOptions.paths`
17
+ * - supports `*` wildcard (the only TS-supported wildcard)
18
+ * - does NOT follow `extends` chains yet (most projects don't need it)
19
+ * - does NOT read Vite/webpack/Rollup configs (separate follow-up)
20
+ *
21
+ * The file is parsed as JSON-with-comments-tolerant — tsconfigs in the
22
+ * wild routinely contain `//` and `/* *\/` comments and trailing
23
+ * commas, which JSON.parse rejects. We strip those before parsing.
24
+ */
25
+ /** A single alias pattern from `compilerOptions.paths`. */
26
+ export interface AliasPattern {
27
+ /** The literal prefix before `*` (or the whole pattern if no `*`). */
28
+ prefix: string;
29
+ /** The literal suffix after `*` (almost always empty). */
30
+ suffix: string;
31
+ /** Whether the pattern contains a `*` wildcard. */
32
+ hasWildcard: boolean;
33
+ /**
34
+ * Replacement templates. When `hasWildcard` is true, `*` in the
35
+ * replacement is filled with the captured wildcard portion of the
36
+ * import path. Stored relative to {@link AliasMap.baseUrl}.
37
+ * tsconfig allows multiple targets per alias (priority order).
38
+ */
39
+ replacements: string[];
40
+ }
41
+ export interface AliasMap {
42
+ /** Absolute path. The directory `compilerOptions.paths` is rooted at. */
43
+ baseUrl: string;
44
+ /**
45
+ * Patterns ordered by specificity: longer prefix first, then literal-
46
+ * before-wildcard, so the resolver tries the most-specific match.
47
+ */
48
+ patterns: AliasPattern[];
49
+ }
50
+ /**
51
+ * Load aliases for `projectRoot`. Returns `null` when no tsconfig /
52
+ * jsconfig is present or when the file has no usable `paths`.
53
+ *
54
+ * Cheap to call repeatedly — caching is the caller's job (the
55
+ * resolver does it via {@link aliasCache}).
56
+ */
57
+ export declare function loadProjectAliases(projectRoot: string): AliasMap | null;
58
+ /**
59
+ * Resolve an import path through an {@link AliasMap}. Returns the list
60
+ * of candidate filesystem paths (relative to `projectRoot`), in the
61
+ * priority order defined by tsconfig (multiple replacements per alias
62
+ * are tried in order). Returns `[]` when no alias matches.
63
+ *
64
+ * Callers still need to try each candidate with the language's
65
+ * extension list — this function only does the alias rewrite.
66
+ */
67
+ export declare function applyAliases(importPath: string, aliases: AliasMap, projectRoot: string): string[];
68
+ //# sourceMappingURL=path-aliases.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Per-language comment stripper for framework route extractors.
3
+ *
4
+ * Replaces comment characters and string-literal contents that hide
5
+ * routing-shaped text with spaces (NOT removal) so that source offsets
6
+ * are preserved. This means `match.index` from a regex run on the
7
+ * stripped output still maps to the same line in the original source.
8
+ *
9
+ * Example:
10
+ * Input: "x = 1 # path('/fake/', V)\n real = 2"
11
+ * Output: "x = 1 \n real = 2"
12
+ *
13
+ * Why strip strings/docstrings as well as comments? Python module/class
14
+ * docstrings are a common source of false positives — they often contain
15
+ * `path('/example/', View)` examples in usage docs. We treat triple-quoted
16
+ * strings the same as comments. Single-line strings stay intact (a `#`
17
+ * inside a Python string is NOT a comment).
18
+ *
19
+ * Scope: this is a pragmatic, regex-supporting helper, not a full parser.
20
+ * It does NOT try to detect JS regex literals, Python f-string expressions,
21
+ * or shell-style heredocs. Those edge cases are not load-bearing for the
22
+ * `path(...)`, `Route::get(...)`, `app.get(...)` style patterns that
23
+ * framework extractors scan for.
24
+ */
25
+ export type CommentLang = 'python' | 'javascript' | 'typescript' | 'php' | 'ruby' | 'java' | 'csharp' | 'swift' | 'go' | 'rust' | 'c' | 'cpp';
26
+ export declare function stripCommentsForRegex(content: string, lang: CommentLang): string;
27
+ //# sourceMappingURL=strip-comments.d.ts.map
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Swift ↔ Objective-C bridging rules.
3
+ *
4
+ * Apple's auto-bridging mechanism exposes Swift declarations to the ObjC
5
+ * runtime under a deterministic selector name. The full rule set:
6
+ * https://developer.apple.com/documentation/swift/importing-swift-into-objective-c
7
+ *
8
+ * This module is **pure name math** — given a Swift declaration's base name
9
+ * + parameter external labels (or the raw signature text), produce the
10
+ * bridged ObjC selector(s); given an ObjC selector, produce the
11
+ * candidate Swift base names. No graph/DB access here.
12
+ *
13
+ * Used by `frameworks/swift-objc.ts` (the framework resolver that wires
14
+ * the rules into the resolution pipeline) and by its tests.
15
+ *
16
+ * ─── Bridging cheat sheet ───────────────────────────────────────────────
17
+ *
18
+ * Swift declaration ObjC selector
19
+ * ───────────────────────────────────────── ─────────────────────────
20
+ * func play() play
21
+ * func play(_ song: String) play:
22
+ * func play(song: String) playWithSong:
23
+ * func play(_ song: String, by artist: String) play:by:
24
+ * func play(song: String, by artist: String) playWithSong:by:
25
+ * init(name: String) initWithName:
26
+ * init(name: String, age: Int) initWithName:age:
27
+ * var name: String (getter / setter) name / setName:
28
+ * @objc(custom:) func f(_ x: Int) custom: (literal override)
29
+ *
30
+ * The reverse direction (ObjC → Swift) collapses the bridge: a Swift call
31
+ * site for `play(song:)` reaches us as the bare base name `play` (Swift's
32
+ * tree-sitter call_expression strips parameter labels from the callee
33
+ * name). So `swiftBaseNamesForObjcSelector('playWithSong:')` returns
34
+ * `['play']` — the resolver looks up Swift methods named `play`.
35
+ */
36
+ /**
37
+ * Compute the auto-bridged ObjC selector for a Swift method declaration.
38
+ *
39
+ * @param baseName The Swift method's base name (e.g. `play`).
40
+ * @param externalLabels Parameter EXTERNAL labels in declaration order;
41
+ * `null` for a `_` (unlabeled) parameter.
42
+ * `[]` for a no-parameter method.
43
+ * @param explicitObjcName If `@objc(customSel:)` was specified, the
44
+ * literal selector — short-circuits the rule
45
+ * and is returned as-is.
46
+ * @returns The ObjC selector (e.g. `playWithSong:by:`), or `null` if it
47
+ * can't be determined.
48
+ *
49
+ * **Method rules:**
50
+ * - No params → base name (no colons)
51
+ * - Single param, `_` label → `baseName:`
52
+ * - Single param, explicit label `L` → `baseNameWithL:`
53
+ * - Multi-param, `_` first label → `baseName:label2:label3:`
54
+ * - Multi-param, explicit first label `L1` → `baseNameWithL1:label2:label3:`
55
+ *
56
+ * Initializer rules are handled by `objcSelectorForSwiftInit`.
57
+ */
58
+ export declare function objcSelectorForSwiftMethod(baseName: string, externalLabels: (string | null)[], explicitObjcName?: string | null): string | null;
59
+ /**
60
+ * Compute the bridged ObjC selector for a Swift `init(...)` declaration.
61
+ *
62
+ * **Init rules** (different from regular methods — Apple always uses
63
+ * `initWith` regardless of whether the first label is `_`):
64
+ * - `init()` → `init`
65
+ * - `init(_ name: String)` → `initWithName:` (uses the INTERNAL
66
+ * name when external is `_`, per Apple's
67
+ * bridging conventions)
68
+ * - `init(name: String)` → `initWithName:`
69
+ * - `init(name: String, age: Int)` → `initWithName:age:`
70
+ *
71
+ * For the `_` case we need the internal (second identifier) name —
72
+ * passed via `internalNames`.
73
+ */
74
+ export declare function objcSelectorForSwiftInit(externalLabels: (string | null)[], internalNames: string[], explicitObjcName?: string | null): string | null;
75
+ /**
76
+ * Compute the bridged ObjC getter + setter for a Swift `@objc` property.
77
+ *
78
+ * - `var name: String` → getter `name`, setter `setName:`
79
+ * - `var isReady: Bool` → getter `isReady`, setter `setIsReady:`
80
+ * (no special `is` handling — Swift's `isReady` stays as `isReady` in ObjC;
81
+ * `@objc(name:)` overrides if a Cocoa-style getter `isReady` / setter
82
+ * `setReady:` pairing is needed — that's the responsibility of the
83
+ * declaration's `@objc(customGetter)` annotation, which we surface via
84
+ * `explicitObjcName`.)
85
+ */
86
+ export declare function objcAccessorsForSwiftProperty(swiftName: string, explicitObjcName?: string | null): {
87
+ getter: string;
88
+ setter: string;
89
+ } | null;
90
+ /**
91
+ * Reverse: from an ObjC selector, return the candidate Swift base names
92
+ * the resolver should try when looking for the bridged Swift declaration.
93
+ *
94
+ * Examples:
95
+ * `play` → ['play']
96
+ * `play:` → ['play']
97
+ * `playWithSong:` → ['play', 'playWithSong']
98
+ * `play:by:` → ['play']
99
+ * `playWithSong:by:` → ['play', 'playWithSong']
100
+ * `initWithName:` → ['init'] (init is its own base name)
101
+ * `initWithName:age:` → ['init']
102
+ * `setName:` → ['name', 'setName'] (could be a setter OR a regular func)
103
+ * `tableView:didSel…:` → ['tableView']
104
+ *
105
+ * Returns multiple candidates because the bare base name is ambiguous —
106
+ * `playWithSong:` could correspond to either `func play(song:)` or
107
+ * `func playWithSong(_ x:)` (a Swift method literally named that with a
108
+ * `_` first label). The resolver tries each.
109
+ */
110
+ export declare function swiftBaseNamesForObjcSelector(selector: string): string[];
111
+ /**
112
+ * Detect whether a Swift method `@objc` declaration uses the `@objc(custom:)`
113
+ * override form, returning the literal selector when present.
114
+ *
115
+ * Regex-based scan over the small chunk of source preceding the declaration —
116
+ * tree-sitter would be more precise but this is only consulted as a fallback
117
+ * when the structured AST isn't available (e.g. resolver-time lookups
118
+ * via `context.readFile`).
119
+ *
120
+ * Returns `null` when the declaration is plain `@objc` (no override) or has
121
+ * no `@objc` attribute at all.
122
+ */
123
+ export declare function detectExplicitObjcName(sourceSlice: string): string | null;
124
+ /**
125
+ * Detect whether a Swift declaration is `@objc`-exposed by scanning the
126
+ * source slice that precedes it. Returns true for explicit `@objc`,
127
+ * `@objc(custom:)`, or membership in a `@objcMembers` class (caller's
128
+ * responsibility to pass class-level context if relevant).
129
+ *
130
+ * `@nonobjc` returns false even if `@objc` also appears (per Swift's rule
131
+ * that `@nonobjc` opts out of class-level `@objcMembers`).
132
+ */
133
+ export declare function isObjcExposed(sourceSlice: string): boolean;
134
+ //# sourceMappingURL=swift-objc-bridge.d.ts.map
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Reference Resolution Types
3
+ *
4
+ * Types for the reference resolution system.
5
+ */
6
+ import { Language, Node, ReferenceKind } from '../types';
7
+ /**
8
+ * An unresolved reference from extraction
9
+ */
10
+ export interface UnresolvedRef {
11
+ /** ID of the source node containing the reference */
12
+ fromNodeId: string;
13
+ /** The name being referenced */
14
+ referenceName: string;
15
+ /** Type of reference */
16
+ referenceKind: ReferenceKind;
17
+ /** Line where reference occurs */
18
+ line: number;
19
+ /** Column where reference occurs */
20
+ column: number;
21
+ /** File path where reference occurs */
22
+ filePath: string;
23
+ /** Language of the source file */
24
+ language: Language;
25
+ /** Possible qualified names it might resolve to */
26
+ candidates?: string[];
27
+ }
28
+ /**
29
+ * A resolved reference
30
+ */
31
+ export interface ResolvedRef {
32
+ /** Original unresolved reference */
33
+ original: UnresolvedRef;
34
+ /** ID of the target node */
35
+ targetNodeId: string;
36
+ /** Confidence score (0-1) */
37
+ confidence: number;
38
+ /** How it was resolved */
39
+ resolvedBy: 'exact-match' | 'import' | 'qualified-name' | 'framework' | 'fuzzy' | 'instance-method' | 'file-path' | 'function-ref';
40
+ }
41
+ /**
42
+ * Result of resolution attempt
43
+ */
44
+ export interface ResolutionResult {
45
+ /** Successfully resolved references */
46
+ resolved: ResolvedRef[];
47
+ /** References that couldn't be resolved */
48
+ unresolved: UnresolvedRef[];
49
+ /** Statistics */
50
+ stats: {
51
+ total: number;
52
+ resolved: number;
53
+ unresolved: number;
54
+ byMethod: Record<string, number>;
55
+ };
56
+ }
57
+ /**
58
+ * Context for resolution - provides access to the graph
59
+ */
60
+ export interface ResolutionContext {
61
+ /** Get all nodes in a file */
62
+ getNodesInFile(filePath: string): Node[];
63
+ /** Get all nodes by name */
64
+ getNodesByName(name: string): Node[];
65
+ /** Get all nodes by qualified name */
66
+ getNodesByQualifiedName(qualifiedName: string): Node[];
67
+ /** Get all nodes of a kind */
68
+ getNodesByKind(kind: Node['kind']): Node[];
69
+ /** Check if a file exists */
70
+ fileExists(filePath: string): boolean;
71
+ /** Read file content */
72
+ readFile(filePath: string): string | null;
73
+ /** Get project root */
74
+ getProjectRoot(): string;
75
+ /** Get all files */
76
+ getAllFiles(): string[];
77
+ /** Get nodes by lowercase name (O(1) lookup for fuzzy matching) */
78
+ getNodesByLowerName(lowerName: string): Node[];
79
+ /**
80
+ * Direct supertypes of the type named `typeName` (same language): the classes
81
+ * it extends and the interfaces / protocols / traits it implements/conforms to,
82
+ * by simple name. Backed by the resolved `implements`/`extends` edges, so it is
83
+ * EMPTY during the first resolution pass (edges aren't built yet) and populated
84
+ * afterward — the conformance pass uses it to resolve a chained method defined
85
+ * on a supertype the receiver type conforms to (e.g. a protocol-extension
86
+ * method). Optional so external/test contexts compile without it.
87
+ */
88
+ getSupertypes?(typeName: string, language: Language): string[];
89
+ /**
90
+ * Look up a node by its id. Lets matchers derive the FROM-symbol's
91
+ * enclosing-class scope (Swift implicit-self method scoping, `this.X`
92
+ * member resolution). Optional so external/test contexts compile
93
+ * without it.
94
+ */
95
+ getNodeById?(id: string): Node | null;
96
+ /** Get cached import mappings for a file */
97
+ getImportMappings(filePath: string, language: Language): ImportMapping[];
98
+ /**
99
+ * Project import-path aliases (tsconfig/jsconfig `paths`). Returns
100
+ * `null` when the project doesn't define any. Cached per resolver
101
+ * instance — safe to call from any resolver code path. Optional so
102
+ * existing test fixtures and external context implementations
103
+ * compile without modification; production resolver implements it.
104
+ */
105
+ getProjectAliases?(): import('./path-aliases').AliasMap | null;
106
+ /**
107
+ * Go module info from `go.mod` at the project root. Returns `null`
108
+ * when the project has no `go.mod` (non-Go projects, pre-modules
109
+ * Go code, or projects whose modules live in subdirectories). Used
110
+ * by the Go branch of import resolution to distinguish in-module
111
+ * cross-package imports from third-party packages.
112
+ */
113
+ getGoModule?(): import('./go-module').GoModule | null;
114
+ /**
115
+ * Monorepo workspace member packages, keyed by declared package name.
116
+ * Returns `null` for single-package repos (no `workspaces` field).
117
+ * Lets the resolver treat `@scope/ui/sub` as a local import into the
118
+ * member's directory instead of an external npm package (#629).
119
+ */
120
+ getWorkspacePackages?(): import('./workspace-packages').WorkspacePackages | null;
121
+ /**
122
+ * Re-exports declared by a file (`export { x } from './other'`,
123
+ * `export * from './other'`). Empty array when the file has none.
124
+ * Optional so older callers compile; the import resolver follows
125
+ * re-export chains when this is provided.
126
+ */
127
+ getReExports?(filePath: string, language: Language): ReExport[];
128
+ /**
129
+ * List immediate subdirectories of `relativePath` (relative to the
130
+ * project root). Returns an empty array when the path doesn't exist
131
+ * or isn't a directory. Used by framework resolvers that need to
132
+ * walk build-system metadata (e.g. Cargo workspace globs). Optional
133
+ * so external context implementations and test fixtures compile
134
+ * without modification.
135
+ */
136
+ listDirectories?(relativePath: string): string[];
137
+ /**
138
+ * C/C++ include search directories (relative to project root),
139
+ * extracted from compile_commands.json or discovered by heuristic.
140
+ * Used by resolveCppIncludePath to search -I directories when
141
+ * relative resolution fails. Optional so existing callers compile.
142
+ */
143
+ getCppIncludeDirs?(): string[];
144
+ }
145
+ /**
146
+ * Result of framework-specific file extraction.
147
+ */
148
+ export interface FrameworkExtractionResult {
149
+ /** Framework-specific nodes (e.g. routes) */
150
+ nodes: Node[];
151
+ /** Framework-specific unresolved references (e.g. route -> handler) */
152
+ references: UnresolvedRef[];
153
+ }
154
+ /**
155
+ * Framework-specific resolver
156
+ */
157
+ export interface FrameworkResolver {
158
+ /** Framework name */
159
+ name: string;
160
+ /** Languages this framework applies to. If omitted, applies to all languages. */
161
+ languages?: Language[];
162
+ /** Detect if project uses this framework (project-level, called once at startup) */
163
+ detect(context: ResolutionContext): boolean;
164
+ /** Resolve a reference using framework-specific patterns */
165
+ resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
166
+ /**
167
+ * Opt a reference NAME through the resolver's name-exists pre-filter, even when
168
+ * no node is named that. Needed for dynamic dispatch where the call target is
169
+ * an attribute/descriptor, not a declared symbol (e.g. Django's
170
+ * `self._iterable_class(...)`, React effect callbacks). Returning true lets the
171
+ * ref reach `resolve()` instead of being dropped for having no name match.
172
+ */
173
+ claimsReference?(name: string): boolean;
174
+ /**
175
+ * Extract framework-specific nodes and references from a file.
176
+ *
177
+ * Returns route nodes, middleware nodes, etc., plus unresolved references
178
+ * that link those nodes to handlers (view classes, controller methods,
179
+ * included modules). Unresolved references flow into the normal resolution
180
+ * pipeline; the framework's own `resolve()` is one of the strategies tried.
181
+ */
182
+ extract?(filePath: string, content: string): FrameworkExtractionResult;
183
+ /**
184
+ * Cross-file finalization pass, called once after all per-file extraction
185
+ * completes (and again on every incremental sync). Used by frameworks where
186
+ * a symbol's final representation depends on a sibling file the per-file
187
+ * `extract()` never saw — e.g. NestJS's `RouterModule.register([...])`
188
+ * sets route prefixes for controllers declared elsewhere.
189
+ *
190
+ * Implementations return route/etc. nodes with mutated fields (typically
191
+ * `name`); the orchestrator persists each via `updateNode`. The node `id`
192
+ * MUST be preserved so existing edges (route → handler, etc.) stay intact;
193
+ * `qualifiedName` SHOULD be preserved so the pass stays idempotent — a
194
+ * second run can recover the original in-file form from `qualifiedName`.
195
+ */
196
+ postExtract?(context: ResolutionContext): Node[];
197
+ }
198
+ /**
199
+ * Import mapping from a file
200
+ */
201
+ export interface ImportMapping {
202
+ /** Local name used in the file */
203
+ localName: string;
204
+ /** Original exported name (may differ due to aliasing) */
205
+ exportedName: string;
206
+ /** Source module/path */
207
+ source: string;
208
+ /** Whether it's a default import */
209
+ isDefault: boolean;
210
+ /** Whether it's a namespace import (import * as X) */
211
+ isNamespace: boolean;
212
+ /** Resolved file path (if local) */
213
+ resolvedPath?: string;
214
+ }
215
+ /**
216
+ * Re-export from a file: `export { x } from './other'` or
217
+ * `export * from './other'`. Used by the resolver to chase
218
+ * symbols through barrel files.
219
+ */
220
+ export type ReExport = {
221
+ kind: 'named';
222
+ /** Name as exported by THIS file. */
223
+ exportedName: string;
224
+ /** Name in the upstream module (differs when renamed: `as`). */
225
+ originalName: string;
226
+ /** Module specifier of the upstream module. */
227
+ source: string;
228
+ } | {
229
+ kind: 'wildcard';
230
+ /** Module specifier of the upstream module. */
231
+ source: string;
232
+ };
233
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * JS/TS workspace (monorepo) package resolution.
3
+ *
4
+ * npm / yarn / bun read member packages from the root `package.json`
5
+ * `workspaces` field; pnpm from `pnpm-workspace.yaml`. A cross-package
6
+ * import like `@scope/ui/widgets` is LOCAL to the monorepo, but to a
7
+ * single-package resolver it looks exactly like a third-party npm
8
+ * specifier — so `isExternalImport` flags it external and the
9
+ * consumer↔definition edge is never created. For component barrels
10
+ * (`export { default as X } from './x.svelte'`) that surfaces as a false
11
+ * `0 callers` on a live component (issue #629).
12
+ *
13
+ * This module maps each member package's declared `name` to its
14
+ * directory so the resolver can rewrite `@scope/ui/widgets` →
15
+ * `packages/ui/widgets` and then run normal extension/index resolution.
16
+ *
17
+ * Scope deliberately small for v1 (mirrors path-aliases.ts):
18
+ * - reads `workspaces` (array OR `{ packages: [...] }`) from package.json,
19
+ * plus a minimal `pnpm-workspace.yaml` `packages:` list
20
+ * - expands one level of `*` / `**` globs (`packages/*`, `apps/*`)
21
+ * - subpath resolution is directory-based (`@scope/ui/sub` → `<ui>/sub`);
22
+ * it does NOT yet honour a member's `exports` map or `main` field
23
+ * - returns null when the project declares no workspaces, so single-
24
+ * package repos pay nothing and see no behaviour change.
25
+ */
26
+ export interface WorkspacePackages {
27
+ /** Member package `name` → directory relative to projectRoot (posix). */
28
+ byName: Map<string, string>;
29
+ }
30
+ /**
31
+ * Load workspace member packages for `projectRoot`. Returns `null` when
32
+ * the project declares no workspaces (the common single-package case) —
33
+ * callers then skip all workspace logic.
34
+ *
35
+ * Cheap to call repeatedly only via the resolver's per-instance cache;
36
+ * this function itself touches the filesystem, so the resolver memoises it
37
+ * the same way it does {@link loadProjectAliases} / {@link loadGoModule}.
38
+ */
39
+ export declare function loadWorkspacePackages(projectRoot: string): WorkspacePackages | null;
40
+ /**
41
+ * Rewrite a bare workspace import to a path relative to projectRoot,
42
+ * WITHOUT an extension — the caller applies the language's extension/index
43
+ * resolution. `@scope/ui/widgets` → `packages/ui/widgets`; the bare package
44
+ * name `@scope/ui` → its directory. Returns `null` when no member package
45
+ * name matches.
46
+ */
47
+ export declare function resolveWorkspaceImport(importPath: string, ws: WorkspacePackages): string | null;
48
+ //# sourceMappingURL=workspace-packages.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Field-qualified search query parser.
3
+ *
4
+ * Splits a raw query like
5
+ *
6
+ * kind:function name:auth path:src/api authenticate
7
+ *
8
+ * into structured filters (kind=function, name="auth", path prefix
9
+ * "src/api") plus the free-text portion ("authenticate") that goes
10
+ * to FTS. Free-text and filters compose: filters narrow the result
11
+ * set, FTS scores within the narrowed set.
12
+ *
13
+ * Recognised fields (case-insensitive, value is the rest until
14
+ * whitespace):
15
+ *
16
+ * kind: one of function|method|class|interface|struct|...
17
+ * lang: one of typescript|python|go|... (alias: language:)
18
+ * path: case-insensitive substring of file_path
19
+ * name: case-insensitive substring of the symbol's name
20
+ *
21
+ * Unknown field prefixes (e.g. `foo:bar`) are passed through to FTS
22
+ * as plain text — that's how someone searching for `TODO:` gets a
23
+ * result instead of a parse error.
24
+ *
25
+ * Quoting:
26
+ * kind:function path:"src/some path/with spaces" → handled by stripping
27
+ * the surrounding double quotes from the value (single token only,
28
+ * no nested escapes).
29
+ */
30
+ import type { NodeKind, Language } from '../types';
31
+ export interface ParsedQuery {
32
+ /** Free-text portion to feed to FTS / LIKE. May be empty. */
33
+ text: string;
34
+ /** kind: filters (OR'd). Empty when none specified. */
35
+ kinds: NodeKind[];
36
+ /** lang:/language: filters (OR'd). Empty when none specified. */
37
+ languages: Language[];
38
+ /** path: filters (OR'd, case-insensitive substring of file_path). Empty when none. */
39
+ pathFilters: string[];
40
+ /** name: filters (OR'd, case-insensitive substring of node.name). */
41
+ nameFilters: string[];
42
+ }
43
+ /**
44
+ * Parse a raw query into structured filters + remaining text.
45
+ * Always returns a value; never throws.
46
+ */
47
+ export declare function parseQuery(raw: string): ParsedQuery;
48
+ /**
49
+ * Damerau-Levenshtein-ish bounded edit distance. Returns `maxDist + 1`
50
+ * as soon as the distance is known to exceed `maxDist`; that early-exit
51
+ * makes the fuzzy fallback cheap even over tens of thousands of names.
52
+ *
53
+ * Pure DP, O(min(len(a), len(b))) memory. Compares case-folded inputs;
54
+ * callers should pass `lowercase(name)` strings.
55
+ */
56
+ export declare function boundedEditDistance(a: string, b: string, maxDist: number): number;
57
+ //# sourceMappingURL=query-parser.d.ts.map
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Search Query Utilities
3
+ *
4
+ * Shared module for search term extraction and scoring.
5
+ */
6
+ import { Node } from '../types';
7
+ /** Normalize a name to a comparable token: lowercase, alphanumerics only. */
8
+ export declare function normalizeNameToken(raw: string): string;
9
+ /**
10
+ * Tokens that name the PROJECT as a whole — its `go.mod` module, `package.json`
11
+ * name, or repo root directory — rather than any specific symbol. A user
12
+ * naturally puts the project name in a query as context ("MyApp backend
13
+ * routes"), but it carries no discriminative signal: when it's also a substring
14
+ * of a symbol or path on one stack (a `MyAppFrontend/` dir, a `MyAppApp` class)
15
+ * it lexically inflates that stack and buries the rest (#720).
16
+ *
17
+ * Returned normalized (lowercase, alphanumerics only) so a query word can be
18
+ * compared by its normalized form. Only names ≥5 chars are kept — short ones
19
+ * (`api`, `app`, `core`, `web`) collide with real query terms too often to
20
+ * safely down-weight.
21
+ */
22
+ export declare function deriveProjectNameTokens(projectRoot: string): Set<string>;
23
+ /**
24
+ * Common stop words to filter from search queries.
25
+ * Includes generic English + code-specific noise words.
26
+ */
27
+ export declare const STOP_WORDS: Set<string>;
28
+ /**
29
+ * Generate stem variants of a search term by removing common English suffixes.
30
+ * Used for FTS query expansion so "caching" also finds "cache", "eviction" finds "evict", etc.
31
+ * Stems are used as PREFIX matches in FTS, so they don't need to be perfect English words.
32
+ */
33
+ export declare function getStemVariants(term: string): string[];
34
+ /**
35
+ * Extract meaningful search terms from a natural language query.
36
+ * Splits camelCase, PascalCase, snake_case, SCREAMING_SNAKE, and dot.notation
37
+ * into individual tokens before filtering.
38
+ *
39
+ * Preserves original compound identifiers (e.g., "scrapeLoop") alongside
40
+ * their split parts so that FTS can match both the full symbol name and
41
+ * individual words within it.
42
+ *
43
+ * Also generates stem variants (e.g., "caching"→"cache", "eviction"→"evict")
44
+ * so FTS prefix matching can find related code symbols.
45
+ */
46
+ export declare function extractSearchTerms(query: string, options?: {
47
+ stems?: boolean;
48
+ }): string[];
49
+ /**
50
+ * Score path relevance to a query
51
+ * Higher score = more relevant path
52
+ */
53
+ export declare function scorePathRelevance(filePath: string, query: string, projectNameTokens?: Set<string>): number;
54
+ /**
55
+ * Check if a file path looks like a test file
56
+ */
57
+ export declare function isTestFile(filePath: string): boolean;
58
+ /**
59
+ * Bonus when a node's name matches the search query.
60
+ * Exact matches get the largest boost; prefix matches get smaller boosts.
61
+ * Multi-word queries also check individual term matches against the name.
62
+ */
63
+ export declare function nameMatchBonus(nodeName: string, query: string): number;
64
+ /**
65
+ * Kind-based bonus for search ranking
66
+ * Functions and classes are typically more relevant than variables/imports
67
+ */
68
+ export declare function kindBonus(kind: Node['kind']): number;
69
+ /**
70
+ * Whether a query token looks like a code identifier the user deliberately typed
71
+ * (camelCase / PascalCase-with-internal-caps / snake_case / has a digit) rather
72
+ * than a plain dictionary word ("flat", "object", "screen").
73
+ *
74
+ * Used to decide whether an EXACT name match earns the "the user named this
75
+ * symbol" exemption from single-term dampening. A common English word that
76
+ * happens to exact-match an unrelated symbol — the query "flat object" matching
77
+ * a constant named `FLAT` — must NOT get that exemption, or the +exact-name
78
+ * bonus floats it to the top of a prose query on its own.
79
+ *
80
+ * Classifies the token AS THE USER TYPED IT, not the matched symbol's name:
81
+ * "flat" (lowercase, descriptive) is non-distinctive even though it matches
82
+ * `FLAT`. A leading-capital-only word ("Screen", "Zustand") is also treated as
83
+ * a plain word — sentence-start capitalization and proper nouns aren't reliable
84
+ * identifier signals.
85
+ */
86
+ export declare function isDistinctiveIdentifier(token: string): boolean;
87
+ //# sourceMappingURL=query-utils.d.ts.map