scip-query 0.6.9 → 0.7.1

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 (220) hide show
  1. package/README.md +3 -1
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/chunk-23YIGCYF.js +25 -0
  4. package/dist/{chunk-V4WRHJU3.js → chunk-2IYEIFPP.js} +6 -6
  5. package/dist/chunk-2JEFS2YJ.js +2 -0
  6. package/dist/chunk-33SSUPCB.js +7 -0
  7. package/dist/chunk-3GNFUVFA.js +2 -0
  8. package/dist/chunk-3OUC276S.js +2 -0
  9. package/dist/{chunk-JLFAQ2E2.js → chunk-4STLJYHI.js} +4 -4
  10. package/dist/chunk-563HLCDW.js +35 -0
  11. package/dist/chunk-5TT47UMX.js +44 -0
  12. package/dist/chunk-6H2XIIPY.js +71 -0
  13. package/dist/{chunk-I5BB33E6.js → chunk-72JOIFXL.js} +3 -3
  14. package/dist/chunk-7H4RJ4MC.js +2 -0
  15. package/dist/chunk-7O4MJYIW.js +63 -0
  16. package/dist/chunk-7OX2O53H.js +62 -0
  17. package/dist/chunk-A2AVLALL.js +2 -0
  18. package/dist/chunk-AQYBOORI.js +2 -0
  19. package/dist/chunk-ARBZM2NF.js +34 -0
  20. package/dist/{chunk-GRAEZYYU.js → chunk-BI4F6GXI.js} +2 -2
  21. package/dist/chunk-BOVNTAKQ.js +3 -0
  22. package/dist/chunk-CKIO6SVS.js +2 -0
  23. package/dist/chunk-D6Z67MZL.js +2 -0
  24. package/dist/chunk-DFK54IRN.js +2 -0
  25. package/dist/chunk-FD37DBTD.js +2 -0
  26. package/dist/chunk-FOQQDXE7.js +2 -0
  27. package/dist/chunk-GAQGJ52J.js +11 -0
  28. package/dist/chunk-IODTPF5H.js +20 -0
  29. package/dist/chunk-J6Z5YKGQ.js +4 -0
  30. package/dist/chunk-JB4PUN5S.js +40 -0
  31. package/dist/chunk-JTXKS5GK.js +3 -0
  32. package/dist/chunk-KJ3ZJIE5.js +2 -0
  33. package/dist/chunk-KJ6CW6EK.js +2 -0
  34. package/dist/{chunk-AXHDRSRI.js → chunk-KNA6Z7JB.js} +3 -3
  35. package/dist/{chunk-U3GYMGBX.js → chunk-LDV2B7ET.js} +8 -8
  36. package/dist/chunk-LWYIGRHR.js +5 -0
  37. package/dist/chunk-MDAYGS6T.js +2 -0
  38. package/dist/chunk-MX6F756F.js +2 -0
  39. package/dist/chunk-NHDPYW7O.js +2 -0
  40. package/dist/{chunk-IIKNAXAE.js → chunk-NKJKI6SE.js} +2 -2
  41. package/dist/chunk-NN3O7TPH.js +8 -0
  42. package/dist/chunk-NSTZMBAB.js +18 -0
  43. package/dist/chunk-NYEMZHUC.js +6 -0
  44. package/dist/chunk-OHEIZWIA.js +4 -0
  45. package/dist/chunk-PG3ZI5IH.js +2 -0
  46. package/dist/chunk-QAEDNTY7.js +2 -0
  47. package/dist/chunk-QE6MGGUY.js +2 -0
  48. package/dist/chunk-QPRIYXH4.js +2 -0
  49. package/dist/chunk-QWJBIBE6.js +3 -0
  50. package/dist/chunk-RCJEFQOK.js +4 -0
  51. package/dist/chunk-ROOHENEP.js +61 -0
  52. package/dist/{chunk-3JGBAAP7.js → chunk-ROZNBWIF.js} +2 -2
  53. package/dist/chunk-TGK5DFBJ.js +2 -0
  54. package/dist/chunk-TKDJQ2WD.js +59 -0
  55. package/dist/chunk-TRNAQABL.js +7 -0
  56. package/dist/chunk-U75WH4XG.js +2 -0
  57. package/dist/chunk-V53J46BX.js +2 -0
  58. package/dist/chunk-V76FCF5F.js +2 -0
  59. package/dist/chunk-VUBQBW7H.js +16 -0
  60. package/dist/chunk-WJQY2LGT.js +2 -0
  61. package/dist/{chunk-ZO5IFJRM.js → chunk-WODJHE6Z.js} +3 -3
  62. package/dist/{chunk-IX45SWX5.js → chunk-WPLKHAH7.js} +4 -4
  63. package/dist/chunk-XO6R3X5J.js +2 -0
  64. package/dist/chunk-YSZNAG4G.js +2 -0
  65. package/dist/chunk-ZNUPGRPR.js +3 -0
  66. package/dist/{chunk-UIM4WALN.js → chunk-ZXFTC5ET.js} +4 -4
  67. package/dist/cli.js +364 -527
  68. package/dist/config-types-CGIeLEpY.d.ts +108 -0
  69. package/dist/db-DdTPetj5.d.ts +69 -0
  70. package/dist/health-x7B4Xu_6.d.ts +119 -0
  71. package/dist/index.d.ts +100 -334
  72. package/dist/index.js +3 -131
  73. package/dist/postinstall.js +1 -1
  74. package/dist/queries/affected.d.ts +9 -2
  75. package/dist/queries/affected.js +1 -1
  76. package/dist/queries/bottlenecks.d.ts +12 -2
  77. package/dist/queries/bottlenecks.js +1 -1
  78. package/dist/queries/by-kind.d.ts +12 -2
  79. package/dist/queries/by-kind.js +1 -1
  80. package/dist/queries/call-graph.d.ts +19 -2
  81. package/dist/queries/call-graph.js +1 -1
  82. package/dist/queries/change-surface.d.ts +16 -2
  83. package/dist/queries/change-surface.js +1 -1
  84. package/dist/queries/code.d.ts +12 -2
  85. package/dist/queries/code.js +1 -1
  86. package/dist/queries/complexity-hotspots.d.ts +15 -2
  87. package/dist/queries/complexity-hotspots.js +1 -1
  88. package/dist/queries/complexity.d.ts +19 -2
  89. package/dist/queries/complexity.js +1 -1
  90. package/dist/queries/convergence.d.ts +22 -2
  91. package/dist/queries/convergence.js +1 -1
  92. package/dist/queries/coupling.d.ts +8 -2
  93. package/dist/queries/coupling.js +1 -1
  94. package/dist/queries/cycles.d.ts +16 -2
  95. package/dist/queries/cycles.js +1 -1
  96. package/dist/queries/dataflow.d.ts +32 -2
  97. package/dist/queries/dataflow.js +1 -1
  98. package/dist/queries/dead.d.ts +34 -2
  99. package/dist/queries/dead.js +1 -1
  100. package/dist/queries/deep-chains.d.ts +8 -2
  101. package/dist/queries/deep-chains.js +1 -1
  102. package/dist/queries/deps.d.ts +6 -2
  103. package/dist/queries/deps.js +1 -1
  104. package/dist/queries/diff-impact.d.ts +22 -2
  105. package/dist/queries/diff-impact.js +1 -1
  106. package/dist/queries/drift.d.ts +18 -2
  107. package/dist/queries/drift.js +1 -1
  108. package/dist/queries/extract-candidates.d.ts +19 -2
  109. package/dist/queries/extract-candidates.js +1 -1
  110. package/dist/queries/fan.d.ts +7 -2
  111. package/dist/queries/fan.js +1 -1
  112. package/dist/queries/files.d.ts +6 -2
  113. package/dist/queries/files.js +1 -1
  114. package/dist/queries/health.d.ts +4 -81
  115. package/dist/queries/health.js +1 -1
  116. package/dist/queries/hierarchy.d.ts +8 -2
  117. package/dist/queries/hierarchy.js +1 -1
  118. package/dist/queries/hotspots.d.ts +10 -2
  119. package/dist/queries/hotspots.js +1 -1
  120. package/dist/queries/imports.d.ts +13 -2
  121. package/dist/queries/imports.js +1 -1
  122. package/dist/queries/index.d.ts +45 -44
  123. package/dist/queries/index.js +1 -1
  124. package/dist/queries/isolated.d.ts +11 -2
  125. package/dist/queries/isolated.js +1 -1
  126. package/dist/queries/members.d.ts +10 -2
  127. package/dist/queries/members.js +1 -1
  128. package/dist/queries/methods.d.ts +8 -2
  129. package/dist/queries/methods.js +1 -1
  130. package/dist/queries/outline.d.ts +10 -2
  131. package/dist/queries/outline.js +1 -1
  132. package/dist/queries/passthrough-candidates.d.ts +14 -2
  133. package/dist/queries/passthrough-candidates.js +1 -1
  134. package/dist/queries/redundant-reexports.d.ts +13 -2
  135. package/dist/queries/redundant-reexports.js +1 -1
  136. package/dist/queries/refs.d.ts +7 -2
  137. package/dist/queries/refs.js +1 -1
  138. package/dist/queries/similar-chains.d.ts +21 -2
  139. package/dist/queries/similar-chains.js +1 -1
  140. package/dist/queries/similar-files.d.ts +12 -2
  141. package/dist/queries/similar-files.js +1 -1
  142. package/dist/queries/similar-signatures.d.ts +16 -2
  143. package/dist/queries/similar-signatures.js +1 -1
  144. package/dist/queries/similar.d.ts +21 -2
  145. package/dist/queries/similar.js +1 -1
  146. package/dist/queries/slice.d.ts +16 -2
  147. package/dist/queries/slice.js +1 -1
  148. package/dist/queries/stale-abstractions.d.ts +36 -3
  149. package/dist/queries/stale-abstractions.js +1 -1
  150. package/dist/queries/stats.d.ts +11 -2
  151. package/dist/queries/stats.js +1 -1
  152. package/dist/queries/surface.d.ts +8 -2
  153. package/dist/queries/surface.js +1 -1
  154. package/dist/queries/symbols.d.ts +10 -2
  155. package/dist/queries/symbols.js +1 -1
  156. package/dist/queries/system.d.ts +10 -2
  157. package/dist/queries/system.js +1 -1
  158. package/dist/queries/trace.d.ts +18 -2
  159. package/dist/queries/trace.js +1 -1
  160. package/dist/queries/wrapper-candidates.d.ts +14 -2
  161. package/dist/queries/wrapper-candidates.js +1 -1
  162. package/dist/reindex-worker.js +10 -10
  163. package/dist/reindex.d.ts +153 -0
  164. package/dist/reindex.js +69 -0
  165. package/dist/runtime.d.ts +108 -0
  166. package/dist/runtime.js +3 -0
  167. package/dist/scip-cli-a-xOztiK.d.ts +20 -0
  168. package/package.json +184 -4
  169. package/dist/chunk-2OP63JQQ.js +0 -2
  170. package/dist/chunk-33Z6HQBX.js +0 -5
  171. package/dist/chunk-3F453KPT.js +0 -2
  172. package/dist/chunk-3PKPUCIJ.js +0 -11
  173. package/dist/chunk-42BWO2NN.js +0 -2
  174. package/dist/chunk-4MDCFY3E.js +0 -2
  175. package/dist/chunk-4QWTQ6YV.js +0 -2
  176. package/dist/chunk-5IRX5I64.js +0 -5
  177. package/dist/chunk-5MPZ2A7J.js +0 -2
  178. package/dist/chunk-67OMD56K.js +0 -90
  179. package/dist/chunk-6UVVA5I4.js +0 -7
  180. package/dist/chunk-BAA4EJRX.js +0 -2
  181. package/dist/chunk-BT36WY5B.js +0 -114
  182. package/dist/chunk-CLKFDBS6.js +0 -39
  183. package/dist/chunk-CWMWTHV3.js +0 -2
  184. package/dist/chunk-DXO2ECRF.js +0 -7
  185. package/dist/chunk-EHEZLULQ.js +0 -85
  186. package/dist/chunk-FVH3Y44U.js +0 -1
  187. package/dist/chunk-GWBRU65E.js +0 -2
  188. package/dist/chunk-H4DXD2FB.js +0 -5
  189. package/dist/chunk-I2KUHGMX.js +0 -16
  190. package/dist/chunk-JMASYYSW.js +0 -2
  191. package/dist/chunk-KAM4C6ZD.js +0 -4
  192. package/dist/chunk-LBWLO7NA.js +0 -70
  193. package/dist/chunk-LJ2YWNQF.js +0 -2
  194. package/dist/chunk-LLDPR3DG.js +0 -6
  195. package/dist/chunk-LNUZWWWL.js +0 -2
  196. package/dist/chunk-NLJCXHFU.js +0 -84
  197. package/dist/chunk-NRAJIFQA.js +0 -2
  198. package/dist/chunk-OYRGWW6Z.js +0 -2
  199. package/dist/chunk-PVMRIOM6.js +0 -33
  200. package/dist/chunk-QRYEOK3M.js +0 -2
  201. package/dist/chunk-SF2HYG53.js +0 -4
  202. package/dist/chunk-SHGPRVWH.js +0 -2
  203. package/dist/chunk-SMOUOKAO.js +0 -2
  204. package/dist/chunk-TBJDUS4E.js +0 -71
  205. package/dist/chunk-TPXWXKL6.js +0 -2
  206. package/dist/chunk-TTCUMJ43.js +0 -19
  207. package/dist/chunk-TYR7QY5G.js +0 -2
  208. package/dist/chunk-UZG3QXTG.js +0 -2
  209. package/dist/chunk-VDMRAGBK.js +0 -6
  210. package/dist/chunk-W6SRVK2Y.js +0 -5
  211. package/dist/chunk-WGYJDGBI.js +0 -25
  212. package/dist/chunk-WYX3RU2K.js +0 -2
  213. package/dist/chunk-WZYA234B.js +0 -2
  214. package/dist/chunk-Y6ZFXZ7B.js +0 -2
  215. package/dist/chunk-YCN5XEST.js +0 -7
  216. package/dist/db-Rx8Ho_JF.d.ts +0 -838
  217. package/dist/queries/drift-policy.d.ts +0 -6
  218. package/dist/queries/drift-policy.js +0 -2
  219. package/dist/queries/health-cache-control.d.ts +0 -15
  220. package/dist/queries/health-cache-control.js +0 -2
package/dist/index.d.ts CHANGED
@@ -1,51 +1,73 @@
1
- import { S as ScipDatabase, N as SymbolMatch, Q as SymbolLocation, V as IndexedDefinition, X as ScipSymbol, Y as ScipLocalSymbol, Z as SupportedLanguage, _ as IndexerConfig, $ as ProjectConfig, a0 as WatcherStatus } from './db-Rx8Ho_JF.js';
2
- export { A as AffectedResult, B as BottleneckResult, a as ByKindResult, C as CallGraphResult, a1 as ChangeSurfaceEntry, b as ChangeSurfaceResult, c as CodeResult, d as ComplexityHotspot, e as ComplexityResult, f as ConvergenceResult, g as CouplingResult, h as CycleResult, D as DataflowResult, i as DeadOptions, j as DeadSummary, a2 as DeadSymbolResult, k as DeepChainResult, l as DepResult, a3 as DescriptorSuffix, m as DiffImpactResult, a4 as DocumentPathCandidate, a5 as DriftResult, n as DriftSummary, a6 as EntryRootsConfig, E as ExtractCandidate, F as FanResult, o as FileResult, a7 as HealthAction, H as HealthReport, p as HierarchyNode, q as HotspotResult, I as ImportResult, a8 as IndexerOverrides, a9 as InstallMethod, r as IsolatedResult, M as MemberResult, s as MethodResult, O as OutlineNode, aa as ParsedReExport, ab as ParsedSourceExport, ac as ParsedSourceImport, P as PassthroughCandidate, K as RedundantReexport, R as RefResult, ad as ReferenceSite, ae as ScipDescriptor, af as ScipQueryConfig, ag as SemanticConfig, z as SimilarChainResult, y as SimilarFileResult, L as SimilarSignatureGroup, x as SimilarSymbolResult, J as SliceResult, G as StaleAbstraction, t as StatsResult, w as SurfaceResult, u as SymbolResult, v as SystemResult, T as TraceResult, ah as TypeScriptSemanticConfig, U as UnusedImportResult, ai as WatchConfig, W as WrapperCandidate, aj as createGitignoreFilter } from './db-Rx8Ho_JF.js';
3
- export { stats } from './queries/stats.js';
4
- export { files } from './queries/files.js';
5
- export { symbols } from './queries/symbols.js';
6
- export { methods } from './queries/methods.js';
7
- export { refs } from './queries/refs.js';
8
- export { trace } from './queries/trace.js';
9
- export { deps, rdeps } from './queries/deps.js';
10
- export { system } from './queries/system.js';
11
- export { surface } from './queries/surface.js';
12
- export { dead } from './queries/dead.js';
13
- export { hotspots } from './queries/hotspots.js';
14
- export { importedBy, imports, unusedImports } from './queries/imports.js';
15
- export { outline } from './queries/outline.js';
16
- export { members } from './queries/members.js';
17
- export { fanIn, fanOut, topFanIn, topFanOut } from './queries/fan.js';
18
- export { coupling, topCoupling } from './queries/coupling.js';
19
- export { cycles } from './queries/cycles.js';
20
- export { bottlenecks } from './queries/bottlenecks.js';
21
- export { isolated } from './queries/isolated.js';
22
- export { byKind, kindCounts } from './queries/by-kind.js';
23
- export { deepChains } from './queries/deep-chains.js';
24
- export { hierarchy } from './queries/hierarchy.js';
25
- export { callGraph } from './queries/call-graph.js';
26
- export { similar, similarAll } from './queries/similar.js';
27
- export { similarFiles } from './queries/similar-files.js';
28
- export { similarChains } from './queries/similar-chains.js';
29
- export { extractCandidates } from './queries/extract-candidates.js';
30
- export { affected } from './queries/affected.js';
31
- export { changeSurface } from './queries/change-surface.js';
32
- export { diffImpact, diffImpactPartial, diffImpactPlan, mergeDiffImpactPartials } from './queries/diff-impact.js';
33
- export { drift } from './queries/drift.js';
34
- export { wrapperCandidates } from './queries/wrapper-candidates.js';
35
- export { passthroughCandidates } from './queries/passthrough-candidates.js';
36
- export { staleAbstractions } from './queries/stale-abstractions.js';
37
- export { complexityHotspots } from './queries/complexity-hotspots.js';
38
- export { HEALTH_PHASES, health, healthPhase, healthReportFromPhases } from './queries/health.js';
39
- export { convergence } from './queries/convergence.js';
40
- export { code } from './queries/code.js';
41
- export { complexity } from './queries/complexity.js';
42
- export { dataflow } from './queries/dataflow.js';
43
- export { slice } from './queries/slice.js';
44
- export { redundantReexports } from './queries/redundant-reexports.js';
45
- export { similarSignatures } from './queries/similar-signatures.js';
46
- import { Index } from '@c4312/scip';
1
+ import { S as ScipDatabase } from './db-DdTPetj5.js';
2
+ export { c as createGitignoreFilter } from './db-DdTPetj5.js';
3
+ export { S as ScipQueryConfig } from './config-types-CGIeLEpY.js';
47
4
  import 'better-sqlite3';
48
5
 
6
+ /**
7
+ * A symbol's location in the SCIP index. The minimum data needed to
8
+ * identify a definition: which document it lives in, which lines it
9
+ * spans, and the global symbol id. Used as a lightweight handle when
10
+ * the caller doesn't need the symbol's textual name or path.
11
+ */
12
+ interface SymbolLocation {
13
+ documentId: number;
14
+ startLine: number;
15
+ endLine: number;
16
+ symbolId: number;
17
+ }
18
+ /**
19
+ * A SymbolLocation plus the human-readable bits: the SCIP symbol string
20
+ * and the document's relative path. Returned by lookup helpers like
21
+ * `findFirstSymbolMatch` so callers don't have to round-trip through the
22
+ * documents table to get a path or symbol name.
23
+ */
24
+ interface SymbolMatch extends SymbolLocation {
25
+ symbol: string;
26
+ relativePath: string;
27
+ }
28
+ /**
29
+ * A full definition record: SymbolMatch plus per-symbol metadata
30
+ * (leaf name, parent type, kind, documentation, enclosing symbol).
31
+ * Used by the catalog APIs (`getDefinitionsForFile`, `getAllDefinitions`,
32
+ * `getScopedDefinitions`) so consumers don't have to re-derive any of
33
+ * these per-record.
34
+ */
35
+ interface IndexedDefinition extends SymbolMatch {
36
+ leaf: string;
37
+ parentTypeName: string | null;
38
+ isFunctionLike: boolean;
39
+ isTypeLike: boolean;
40
+ kind: number | null;
41
+ documentation: string | null;
42
+ enclosingSymbol: string | null;
43
+ }
44
+ /** Parsed components of a SCIP symbol string */
45
+ interface ScipSymbol {
46
+ /** The indexer scheme (e.g. "scip-typescript", "scip-java", "rust-analyzer") */
47
+ scheme: string;
48
+ /** Package manager (e.g. "npm", "maven", "cargo") */
49
+ manager: string;
50
+ /** Package name (e.g. "@vega/api", "com.example/mylib") */
51
+ packageName: string;
52
+ /** Package version */
53
+ version: string;
54
+ /** Descriptor chain — the path to the symbol within the file */
55
+ descriptors: ScipDescriptor[];
56
+ /** The raw, unparsed symbol string */
57
+ raw: string;
58
+ }
59
+ interface ScipDescriptor {
60
+ name: string;
61
+ suffix: DescriptorSuffix;
62
+ }
63
+ type DescriptorSuffix = 'namespace' | 'type' | 'term' | 'method' | 'type-param' | 'parameter' | 'meta' | 'macro';
64
+ /** A local symbol (file-scoped, no cross-file identity) */
65
+ interface ScipLocalSymbol {
66
+ kind: 'local';
67
+ id: string;
68
+ raw: string;
69
+ }
70
+
49
71
  /**
50
72
  * File classifier — one place to decide what role a source file plays.
51
73
  *
@@ -67,48 +89,13 @@ type FileKind = 'entry' | 'barrel' | 'worker' | 'test' | 'source';
67
89
  */
68
90
  declare function classifyFile(file: string): FileKind;
69
91
 
70
- /**
71
- * reference-graph — bulk caller/callee maps and reference-site
72
- * resolution.
73
- *
74
- * Where to get what:
75
- * Reference lines (where is this used?):
76
- * - Primary: `getSourceReferenceSites` — cross-file identifier
77
- * scan (re-exported from identifier-attribution).
78
- * Returns [] when the leaf name is ambiguous.
79
- * - Fallback: `getResolvedReferenceSites` — mention-resolved
80
- * chunks with in-chunk line refinement. Always
81
- * returns a result when the symbol has mentions.
82
- * Do NOT read `chunks.start_line` as the "line of a reference"; a
83
- * chunk spans many source lines.
84
- *
85
- * Bulk graph builders:
86
- * - `buildCalleeMap(db, defs)` — for each definition, the symbols
87
- * it calls (AST + chunk merged).
88
- * - `buildCrossFileCallerMap(db, defs?)` — reverse: symbolId →
89
- * set of files that reference it.
90
- * - `buildCallerRowsMap(db)` — symbolId → list of caller
91
- * (symbol, file) rows, cached once per DB.
92
- * - `getCalleeRowsForSymbol` / `getCallerRowsForSymbol` — narrow
93
- * single-symbol views over the bulk maps.
94
- *
95
- * File-dependency graph:
96
- * - `buildFileDepGraph(db, scope?)` — file → set of files it
97
- * imports/references.
98
- *
99
- * Layer position: top of the layering — uses path-resolver,
100
- * symbol-lookup, and definition-catalog. Identifier-attribution sits
101
- * alongside (re-exported here as `getSourceReferenceSites` /
102
- * `buildSourceFallbackCallerFiles` so callers don't have to learn a
103
- * second module name).
104
- */
105
-
92
+ type CalleeEvidenceSource = 'ast-callsite' | 'semantic-callee' | 'scip-chunk';
106
93
  interface CalleeRow {
107
94
  symbol: string;
108
95
  file: string;
109
96
  chunkId: number;
97
+ source: CalleeEvidenceSource;
110
98
  }
111
- declare function buildFileDepGraph(db: ScipDatabase, scope?: string): Map<string, Set<string>>;
112
99
  /**
113
100
  * Bulk callee map: for each definition in the list, find every symbol it
114
101
  * actually calls.
@@ -135,19 +122,9 @@ declare function buildCalleeMap(db: ScipDatabase, definitions: ReadonlyArray<Sym
135
122
  additive?: boolean;
136
123
  semantic?: boolean;
137
124
  }): Map<number, CalleeRow[]>;
138
- /**
139
- * Bulk caller map: symbolId set of distinct files that reference the
140
- * symbol.
141
- *
142
- * For files with tree-sitter support, callers come from AST call_expression
143
- * nodes — each callsite resolves to a real symbol via the global leaf index
144
- * with same-file preference. For non-AST files, callers come from SCIP's
145
- * mentions table (chunk-level) with self-reference filtering.
146
- *
147
- * If `definitions` is supplied, references that fall inside the symbol's own
148
- * defining file are treated as potential self-references and only counted
149
- * when they originate from a different document.
150
- */
125
+
126
+ declare function buildFileDepGraph(db: ScipDatabase, scope?: string): Map<string, Set<string>>;
127
+
151
128
  declare function buildCrossFileCallerMap(db: ScipDatabase, definitions?: ReadonlyArray<SymbolLocation>, opts?: {
152
129
  semantic?: boolean;
153
130
  }): Map<number, Set<string>>;
@@ -157,7 +134,7 @@ declare function buildCrossFileCallerMap(db: ScipDatabase, definitions?: Readonl
157
134
  * hit in file F, which SCIP symbol(s) does it refer to?"
158
135
  *
159
136
  * Pre-this-module the same logic lived in four places (sourceCandidateLines,
160
- * importAttributedCandidateLines, buildSourceFallbackCallerFiles inner loop,
137
+ * importAttributedCandidateLines, findCallerFiles inner loop,
161
138
  * dead.ts:resolveLeaf) with subtle drift. Bug fixes in one site silently
162
139
  * coexisted with the bug in the others. The Vue support and interface-
163
140
  * dispatch fixes from earlier had to touch all four sites separately.
@@ -206,11 +183,18 @@ interface CallableSignature {
206
183
  * On first call per file, walks the entire AST once and indexes every
207
184
  * callable's signature by (startLine, endLine). Subsequent calls are O(1)
208
185
  * Map lookups — critical when called for thousands of candidates.
186
+ *
187
+ * scip-query: ignore-wrapper — public AST-signature primitive used through
188
+ * ProjectIndex; callers should not know the per-tree signature cache shape.
209
189
  */
210
190
  declare function getCallableSignature(db: ScipDatabase, relativePath: string, startLine: number, endLine: number): CallableSignature | null;
211
191
 
212
192
  type SourceReferenceKind = 'identifier' | 'cross-language-dispatch' | 'rust-attribute';
213
- type SourceReferenceTarget = ReturnType<typeof attributeIdentifier>[number];
193
+ type DefaultSourceReferenceTarget = ReturnType<typeof attributeIdentifier>[number];
194
+ interface SourceReferenceTarget {
195
+ symbolId: number;
196
+ relativePath: string;
197
+ }
214
198
  interface SourceReferenceHit {
215
199
  sourceFile: string;
216
200
  name: string;
@@ -226,6 +210,14 @@ interface ScanSourceReferencesOptions {
226
210
  identifierResolution?: 'strict' | 'permissive';
227
211
  candidateNames?: ReadonlySet<string>;
228
212
  skipPath?: (relativePath: string) => boolean;
213
+ resolveTargets?: (ctx: SourceReferenceResolveContext) => Iterable<SourceReferenceTarget>;
214
+ afterPath?: (relativePath: string) => void;
215
+ }
216
+ interface SourceReferenceResolveContext {
217
+ sourceFile: string;
218
+ name: string;
219
+ kind: SourceReferenceKind;
220
+ defaultTargets: () => readonly DefaultSourceReferenceTarget[];
229
221
  }
230
222
  declare function scanSourceReferences(db: ScipDatabase, opts: ScanSourceReferencesOptions, visit: (hit: SourceReferenceHit) => void): void;
231
223
 
@@ -256,6 +248,15 @@ declare class ProjectIndex {
256
248
  semantic?: boolean;
257
249
  }): ReturnType<typeof buildCrossFileCallerMap>;
258
250
  sourceFallbackCallerFiles(definitions: ReadonlyArray<IndexedDefinition>): ReturnType<typeof findCallerFiles>;
251
+ callerFileMap(definitions: ReadonlyArray<IndexedDefinition>, opts?: {
252
+ semantic?: boolean;
253
+ sourceFallback?: boolean;
254
+ }): Map<number, Set<string>>;
255
+ frameworkReferencedSymbolIds(definitions: ReadonlyArray<IndexedDefinition>): Set<number>;
256
+ symbolsWithNonSelfCallees(definitions: ReadonlyArray<IndexedDefinition>, opts?: {
257
+ additive?: boolean;
258
+ semantic?: boolean;
259
+ }): Set<number>;
259
260
  fileDependencyGraph(scope?: string): ReturnType<typeof buildFileDepGraph>;
260
261
  fileKind(relativePath: string): ReturnType<typeof classifyFile>;
261
262
  hasSuppressionComment(definition: Pick<IndexedDefinition, 'relativePath' | 'startLine'>): boolean;
@@ -290,239 +291,4 @@ declare function shortenSymbol(raw: string): string;
290
291
  */
291
292
  declare function leafName(raw: string): string;
292
293
 
293
- /**
294
- * Detect which languages are present in a project directory by checking for
295
- * marker files, root-level project files, and source-file extensions.
296
- */
297
- declare function detectLanguages(projectRoot: string): SupportedLanguage[];
298
-
299
- interface AugmentAuxiliaryDocumentsOptions {
300
- projectRoot: string;
301
- dbPath: string;
302
- extensions?: readonly string[];
303
- onStatus?: (message: string) => void;
304
- }
305
- interface AugmentAuxiliaryDocumentsResult {
306
- scanned: number;
307
- inserted: number;
308
- existing: number;
309
- }
310
- /**
311
- * Add source files that upstream SCIP indexers skipped to the SQLite
312
- * documents table. Vue SFCs are the motivating case: scip-typescript can
313
- * resolve imports to generated TS, but it does not emit `.vue` documents.
314
- */
315
- declare function augmentAuxiliaryDocuments(opts: AugmentAuxiliaryDocumentsOptions): AugmentAuxiliaryDocumentsResult;
316
-
317
- interface AugmentVueResolvedOptions {
318
- projectRoot: string;
319
- dbPath: string;
320
- tsconfig: string;
321
- onStatus?: (message: string) => void;
322
- }
323
- interface AugmentVueResolvedResult {
324
- vueFiles: number;
325
- resolvedReferences: number;
326
- insertedMentions: number;
327
- skippedReferences: number;
328
- syntheticSymbols: number;
329
- }
330
- declare function augmentVueResolvedReferences(opts: AugmentVueResolvedOptions): AugmentVueResolvedResult;
331
-
332
- /**
333
- * Indexer configurations for each supported language.
334
- * Each entry describes how to produce a SCIP index for that language.
335
- *
336
- * The `scip` CLI binary is required for all languages (to convert protobuf -> SQLite).
337
- * Each language also needs its own SCIP indexer installed.
338
- */
339
- declare const INDEXER_CONFIGS: Record<SupportedLanguage, IndexerConfig>;
340
- /** Get the indexer config for a language */
341
- declare function getIndexerConfig(language: SupportedLanguage): IndexerConfig;
342
-
343
- interface MergeScipResult {
344
- documentCount: number;
345
- externalSymbolCount: number;
346
- inputCount: number;
347
- }
348
- /**
349
- * Merge multiple SCIP indices into a single index message.
350
- *
351
- * A SCIP index is a code graph snapshot: metadata about one indexed project plus
352
- * the documents and external symbols discovered by one or more indexers. Merging
353
- * means producing one unified snapshot so later conversion to SQLite sees the
354
- * whole repo instead of whichever language indexed last.
355
- */
356
- declare function mergeScipIndexes(indexes: readonly Index[]): Index;
357
- declare function mergeScipFiles(inputPaths: readonly string[], outputPath: string): MergeScipResult;
358
-
359
- /**
360
- * Check if a binary is available on PATH.
361
- */
362
- declare function isBinaryAvailable(name: string): boolean;
363
- /**
364
- * Check if an indexer's binary is available on PATH.
365
- */
366
- declare function isIndexerInstalled(config: IndexerConfig): boolean;
367
- /**
368
- * Attempt to auto-install an indexer using its configured install methods.
369
- * Tries each method in order, checking prerequisites first.
370
- * Returns true if installation succeeded.
371
- */
372
- declare function tryInstallIndexer(config: IndexerConfig, onStatus: (msg: string) => void): boolean;
373
-
374
- /**
375
- * Check if the `scip` CLI binary is available on PATH.
376
- */
377
- declare function isScipInstalled(): boolean;
378
- /**
379
- * Get the scip CLI version if installed.
380
- */
381
- declare function getScipVersion(): string | null;
382
- /**
383
- * Print instructions for installing the scip CLI binary.
384
- */
385
- declare function printScipInstallInstructions(): void;
386
- /**
387
- * Attempt to auto-install the `scip` CLI binary.
388
- * Tries brew (macOS), then go install, then prints manual instructions.
389
- * Returns true if installation succeeded.
390
- */
391
- declare function tryInstallScipCli(onStatus: (msg: string) => void): boolean;
392
-
393
- interface ReindexOptions {
394
- projectRoot: string;
395
- /** Override language detection — index only these languages */
396
- languages?: SupportedLanguage[];
397
- /** Path for the SCIP protobuf output (default: <projectRoot>/index.scip) */
398
- outputScip?: string;
399
- /** Path for the SQLite output (default: <projectRoot>/index.db) */
400
- outputDb?: string;
401
- /** Max Node.js heap size in MB (default: 8192) */
402
- maxHeapMb?: number;
403
- /** Callback for status updates */
404
- onStatus?: (message: string) => void;
405
- /** Extra flags for pnpm-workspace-aware TS indexing */
406
- pnpmWorkspaces?: boolean;
407
- /** Skip auto-install prompts */
408
- skipAutoInstall?: boolean;
409
- /** Reuse an existing index when tracked source inputs are unchanged (default true). */
410
- skipIfUnchanged?: boolean;
411
- /** Permit a partial index when some detected/requested languages fail (default false). */
412
- allowPartial?: boolean;
413
- /** Number of language indexers to run at once (default: conservative auto). */
414
- indexerConcurrency?: number;
415
- }
416
- interface ReindexResult {
417
- /** Languages that were successfully indexed. */
418
- languages: SupportedLanguage[];
419
- indexPath: string;
420
- dbPath: string;
421
- durationMs: number;
422
- /** True when existing SCIP/SQLite outputs were reused because inputs were unchanged. */
423
- reused: boolean;
424
- /**
425
- * Languages detected in the project but skipped because their indexer
426
- * could not be located, installed, or run. Each entry includes the reason.
427
- */
428
- skipped: {
429
- language: SupportedLanguage;
430
- reason: string;
431
- }[];
432
- }
433
- /**
434
- * Reindex a project: detect languages, run the appropriate SCIP indexer(s),
435
- * and convert the output to SQLite.
436
- */
437
- declare function reindex(opts: ReindexOptions): Promise<ReindexResult>;
438
-
439
- /**
440
- * Load project config from .scipquery.json in the project root.
441
- * Returns defaults for anything not specified.
442
- */
443
- declare function loadProjectConfig(projectRoot: string): ProjectConfig;
444
- /**
445
- * Resolve all paths for a project's index files.
446
- */
447
- declare function resolveIndexPaths(projectRoot: string, config?: ProjectConfig): {
448
- cacheDir: string;
449
- dbPath: string;
450
- indexPath: string;
451
- metaPath: string;
452
- };
453
- /**
454
- * Scaffold a default .scipquery.json in the project root.
455
- * Does not overwrite an existing config.
456
- */
457
- declare function initProjectConfig(projectRoot: string, languages: string[]): string;
458
-
459
- interface WatcherOptions {
460
- projectRoot: string;
461
- config: ProjectConfig;
462
- languages?: SupportedLanguage[];
463
- onStatus?: (status: WatcherStatus) => void;
464
- onReindexComplete?: (durationMs: number) => void;
465
- onError?: (error: Error) => void;
466
- }
467
- /**
468
- * File watcher that triggers single-flight background reindexing.
469
- *
470
- * Design:
471
- * - Debounce: waits 30s (configurable) after the last file change
472
- * - Single-flight: only one reindex runs at a time, never queued
473
- * - Dirty flag: changes during reindex schedule ONE follow-up
474
- * - Cooldown: minimum interval between reindex completions
475
- * - Atomic swap: writes to index.db.tmp, renames on success
476
- */
477
- declare class Watcher {
478
- private projectRoot;
479
- private watchConfig;
480
- private indexPaths;
481
- private languages?;
482
- private pnpmWorkspaces;
483
- private onStatus;
484
- private onReindexComplete;
485
- private onError;
486
- private status;
487
- private debounceTimer;
488
- private cooldownTimer;
489
- private dirty;
490
- private changedFiles;
491
- private reindexInFlight;
492
- private lastReindexEnd;
493
- private fsWatchers;
494
- private gitignoreFilter;
495
- private extraIgnore;
496
- private stopped;
497
- constructor(opts: WatcherOptions);
498
- /** Start watching for file changes */
499
- start(): void;
500
- /** Stop watching and clean up */
501
- stop(): void;
502
- private handleFileChange;
503
- private triggerReindex;
504
- /**
505
- * Run the reindex in a forked child process.
506
- * Writes to index.db.tmp, then atomically renames to index.db.
507
- */
508
- private runReindex;
509
- private setStatus;
510
- private clearDebounceTimer;
511
- private clearCooldownTimer;
512
- }
513
-
514
- interface InstallSkillsResult {
515
- installed: string[];
516
- skipped: string[];
517
- alreadyLinked: string[];
518
- }
519
- /**
520
- * Install scip-query skills into both Claude Code (~/.claude/skills/)
521
- * and Codex (~/.codex/skills/). Uses symlinks (junctions on Windows)
522
- * so skills auto-update when the package updates.
523
- */
524
- declare function installSkills(opts?: {
525
- quiet?: boolean;
526
- }): InstallSkillsResult;
527
-
528
- export { INDEXER_CONFIGS, IndexedDefinition, IndexerConfig, ProjectConfig, ProjectIndex, ScipDatabase, ScipLocalSymbol, ScipSymbol, SupportedLanguage, SymbolLocation, SymbolMatch, Watcher, WatcherStatus, augmentAuxiliaryDocuments, augmentVueResolvedReferences, detectLanguages, getIndexerConfig, getScipVersion, initProjectConfig, installSkills, isBinaryAvailable, isIndexerInstalled, isScipInstalled, leafName, loadProjectConfig, mergeScipFiles, mergeScipIndexes, parseSymbol, printScipInstallInstructions, reindex, resolveIndexPaths, shortenSymbol, tryInstallIndexer, tryInstallScipCli };
294
+ export { ProjectIndex, ScipDatabase, leafName, parseSymbol, shortenSymbol };