scip-query 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -29
- package/dist/augment-vue-worker.js +2 -0
- package/dist/chunk-2ZGHRI2A.js +5 -0
- package/dist/chunk-32R4VYYA.js +2 -0
- package/dist/chunk-3UB2DPLP.js +2 -0
- package/dist/chunk-4X7C236P.js +84 -0
- package/dist/chunk-5LQ6CVX3.js +2 -0
- package/dist/chunk-5YYMKE3G.js +70 -0
- package/dist/chunk-7LSCW7NF.js +6 -0
- package/dist/chunk-7X7FLQC5.js +2 -0
- package/dist/chunk-A5UNS4DR.js +4 -0
- package/dist/chunk-BNCTPTVX.js +2 -0
- package/dist/{chunk-TRBNQ273.js → chunk-C5BFS23M.js} +2 -2
- package/dist/{chunk-DM56ECPZ.js → chunk-DRLWW74T.js} +2 -2
- package/dist/chunk-EB5IVUNU.js +2 -0
- package/dist/{chunk-TPOYTT6O.js → chunk-ERRUE5G4.js} +4 -4
- package/dist/chunk-F4KR22Z2.js +2 -0
- package/dist/chunk-FG6A6ZUP.js +2 -0
- package/dist/chunk-FHSD5RKF.js +19 -0
- package/dist/chunk-FVVEIGP3.js +5 -0
- package/dist/chunk-GBDZY73J.js +2 -0
- package/dist/{chunk-4TYGGOLO.js → chunk-H4DXD2FB.js} +1 -1
- package/dist/chunk-HUASU3AD.js +71 -0
- package/dist/chunk-IJWIYZO5.js +2 -0
- package/dist/chunk-K6H3XJQW.js +7 -0
- package/dist/{chunk-KYT47WU2.js → chunk-KAM4C6ZD.js} +1 -1
- package/dist/{chunk-56LPZC3S.js → chunk-KTCODJNQ.js} +3 -3
- package/dist/chunk-LJ2YWNQF.js +2 -0
- package/dist/chunk-LT2CPEQ4.js +2 -0
- package/dist/chunk-M5QTG55L.js +2 -0
- package/dist/chunk-MKFH7QJG.js +7 -0
- package/dist/chunk-MO32JMOD.js +12 -0
- package/dist/chunk-MO65UK5V.js +6 -0
- package/dist/chunk-MTK3JAJT.js +2 -0
- package/dist/{chunk-6TRXTRCW.js → chunk-MXWC53GJ.js} +4 -4
- package/dist/{chunk-HLILTI7S.js → chunk-OQZF2DQJ.js} +3 -3
- package/dist/chunk-PBFMZKXE.js +6 -0
- package/dist/{chunk-MMKNCPHB.js → chunk-PFMGJ4BR.js} +4 -4
- package/dist/{chunk-5KWWENJZ.js → chunk-PK4U6NWP.js} +2 -2
- package/dist/{chunk-CH47OLNL.js → chunk-Q2ALKKSE.js} +4 -4
- package/dist/chunk-QFCK6WV2.js +39 -0
- package/dist/chunk-QFZE73XF.js +84 -0
- package/dist/chunk-QRYEOK3M.js +2 -0
- package/dist/{chunk-LORWXBOO.js → chunk-RKTDEIHF.js} +1 -1
- package/dist/chunk-ROWAEEOD.js +2 -0
- package/dist/chunk-RT5PV5JQ.js +7 -0
- package/dist/chunk-TLRA5TR6.js +2 -0
- package/dist/chunk-U5MVUPOO.js +2 -0
- package/dist/chunk-URUVLDM7.js +29 -0
- package/dist/chunk-WHGCGENP.js +16 -0
- package/dist/chunk-WIIZF5FP.js +2 -0
- package/dist/chunk-WNMAH3P7.js +2 -0
- package/dist/chunk-XV3XUZ3X.js +11 -0
- package/dist/chunk-YDKWDTAW.js +2 -0
- package/dist/{chunk-IUNRL2AQ.js → chunk-YDNCX5PF.js} +2 -2
- package/dist/chunk-YU25IHJX.js +90 -0
- package/dist/{chunk-VZE4SOJG.js → chunk-Z5CTXSWT.js} +3 -3
- package/dist/chunk-ZFCQQ4B5.js +2 -0
- package/dist/chunk-ZHHMG4UC.js +114 -0
- package/dist/cli.js +487 -388
- package/dist/{db-DKhNQ75l.d.ts → db-BZPa7dzJ.d.ts} +19 -9
- package/dist/index.d.ts +221 -13
- package/dist/index.js +45 -31
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift-policy.d.ts +6 -0
- package/dist/queries/drift-policy.js +2 -0
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -63
- package/package.json +4 -2
- package/dist/chunk-2OXZVIED.js +0 -41
- package/dist/chunk-5IM4IQ6N.js +0 -2
- package/dist/chunk-5OV6CUTY.js +0 -2
- package/dist/chunk-6QXYWGE5.js +0 -10
- package/dist/chunk-C6PQLWHR.js +0 -7
- package/dist/chunk-DX5YEUX4.js +0 -6
- package/dist/chunk-DXXROCSQ.js +0 -19
- package/dist/chunk-EARGTC7U.js +0 -12
- package/dist/chunk-EJXPKSWV.js +0 -29
- package/dist/chunk-EUHHVFTI.js +0 -2
- package/dist/chunk-F2TGKDMW.js +0 -2
- package/dist/chunk-GSVIC6KN.js +0 -2
- package/dist/chunk-H4IWC7KJ.js +0 -89
- package/dist/chunk-H7BWAMFI.js +0 -4
- package/dist/chunk-HUEIPY4M.js +0 -5
- package/dist/chunk-ID7TO4P6.js +0 -65
- package/dist/chunk-J22I2FWD.js +0 -6
- package/dist/chunk-KOGVTPGE.js +0 -7
- package/dist/chunk-LUYN4IWJ.js +0 -2
- package/dist/chunk-MDUIJELV.js +0 -39
- package/dist/chunk-MSNW2AR2.js +0 -2
- package/dist/chunk-N3Z2SJCR.js +0 -2
- package/dist/chunk-NB3GIT4Z.js +0 -7
- package/dist/chunk-OBPP5RRE.js +0 -2
- package/dist/chunk-ORBQ3HJD.js +0 -2
- package/dist/chunk-P6IUCZA3.js +0 -24
- package/dist/chunk-Q2MCCKWZ.js +0 -2
- package/dist/chunk-QRULHDMO.js +0 -84
- package/dist/chunk-RAJHIEBM.js +0 -70
- package/dist/chunk-RKZBRDFK.js +0 -2
- package/dist/chunk-RPRIZ43D.js +0 -2
- package/dist/chunk-RXGCTLHY.js +0 -2
- package/dist/chunk-S6IGA6KK.js +0 -2
- package/dist/chunk-TVJMEDHH.js +0 -2
- package/dist/chunk-UDKLKBPQ.js +0 -2
- package/dist/chunk-UGUBEKK5.js +0 -2
- package/dist/chunk-VKYLXCV6.js +0 -2
- package/dist/chunk-VQXXSUQF.js +0 -8
- package/dist/chunk-VZHI3TUX.js +0 -6
- package/dist/chunk-YSEQFGGH.js +0 -2
|
@@ -91,6 +91,7 @@ interface ParsedSourceImport {
|
|
|
91
91
|
kind: 'named' | 'default' | 'namespace' | 'side-effect';
|
|
92
92
|
used: boolean;
|
|
93
93
|
usedMembers: string[];
|
|
94
|
+
isTypeOnly?: boolean;
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
96
97
|
* A single export-from binding parsed out of a source file. Used by the
|
|
@@ -417,13 +418,15 @@ interface SimilarSymbolResult {
|
|
|
417
418
|
symbolB: string;
|
|
418
419
|
shortNameB: string;
|
|
419
420
|
fileB: string;
|
|
420
|
-
/**
|
|
421
|
+
/** Similarity score (0-1). Basis says what evidence was compared. */
|
|
421
422
|
similarity: number;
|
|
422
|
-
/**
|
|
423
|
+
/** Evidence used for similarity: call graph callees or lexical source tokens. */
|
|
424
|
+
similarityBasis?: 'callees' | 'source-tokens';
|
|
425
|
+
/** Shared callees or source tokens, depending on similarityBasis. */
|
|
423
426
|
sharedCallees: string[];
|
|
424
|
-
/** Callees unique to A */
|
|
427
|
+
/** Callees or source tokens unique to A, depending on similarityBasis. */
|
|
425
428
|
uniqueToA: string[];
|
|
426
|
-
/** Callees unique to B */
|
|
429
|
+
/** Callees or source tokens unique to B, depending on similarityBasis. */
|
|
427
430
|
uniqueToB: string[];
|
|
428
431
|
}
|
|
429
432
|
interface SimilarFileResult {
|
|
@@ -693,6 +696,8 @@ interface ScipQueryConfig {
|
|
|
693
696
|
entryRoots?: EntryRootsConfig;
|
|
694
697
|
/** Paths to .gitignore files to load for filtering */
|
|
695
698
|
gitignorePaths?: string[];
|
|
699
|
+
/** Optional semantic-provider configuration */
|
|
700
|
+
semantic?: SemanticConfig;
|
|
696
701
|
}
|
|
697
702
|
interface ProjectConfig {
|
|
698
703
|
/** Override which languages to index (default: auto-detect) */
|
|
@@ -705,6 +710,15 @@ interface ProjectConfig {
|
|
|
705
710
|
dbPath?: string;
|
|
706
711
|
/** Project-specific externally-live roots for dead-code filtering */
|
|
707
712
|
entryRoots?: EntryRootsConfig;
|
|
713
|
+
/** Optional semantic-provider configuration */
|
|
714
|
+
semantic?: SemanticConfig;
|
|
715
|
+
}
|
|
716
|
+
interface SemanticConfig {
|
|
717
|
+
typescript?: TypeScriptSemanticConfig;
|
|
718
|
+
}
|
|
719
|
+
interface TypeScriptSemanticConfig {
|
|
720
|
+
/** Explicit tsconfig paths, relative to project root unless absolute */
|
|
721
|
+
tsconfigs?: string[];
|
|
708
722
|
}
|
|
709
723
|
interface EntryRootsConfig {
|
|
710
724
|
/** Any symbol defined in these path prefixes is externally live */
|
|
@@ -814,11 +828,7 @@ declare class ScipDatabase {
|
|
|
814
828
|
all<T = Record<string, unknown>>(sql: string, ...params: unknown[]): T[];
|
|
815
829
|
/** Run a raw SQL query and return the first row */
|
|
816
830
|
get<T = Record<string, unknown>>(sql: string, ...params: unknown[]): T | undefined;
|
|
817
|
-
/** Get the database file size in bytes */
|
|
818
|
-
sizeBytes(): number;
|
|
819
|
-
/** Get the last modification time of the database file */
|
|
820
|
-
lastModified(): Date | null;
|
|
821
831
|
close(): void;
|
|
822
832
|
}
|
|
823
833
|
|
|
824
|
-
export { type
|
|
834
|
+
export { type ProjectConfig as $, type AffectedResult as A, type BottleneckResult as B, type CallGraphResult as C, type DataflowResult as D, type ExtractCandidate as E, type FanResult as F, type StaleAbstraction as G, type HealthReport as H, type ImportResult as I, type SliceResult as J, type RedundantReexport as K, type SimilarSignatureGroup as L, type MemberResult as M, type SymbolMatch as N, type OutlineNode as O, type PassthroughCandidate as P, type SymbolLocation as Q, type RefResult as R, ScipDatabase as S, type TraceResult as T, type UnusedImportResult as U, type IndexedDefinition as V, type WrapperCandidate as W, type ScipSymbol as X, type ScipLocalSymbol as Y, type SupportedLanguage as Z, type IndexerConfig as _, type ByKindResult as a, type WatcherStatus as a0, type ChangeSurfaceEntry as a1, type DeadSymbolResult as a2, type DescriptorSuffix as a3, type DocumentPathCandidate as a4, type DriftResult as a5, type EntryRootsConfig as a6, type HealthAction as a7, type IndexerOverrides as a8, type InstallMethod as a9, type ParsedReExport as aa, type ParsedSourceExport as ab, type ParsedSourceImport as ac, type ReferenceSite as ad, type ScipDescriptor as ae, type ScipQueryConfig as af, type SemanticConfig as ag, type TypeScriptSemanticConfig as ah, type WatchConfig as ai, createGitignoreFilter as aj, type ChangeSurfaceResult as b, type CodeResult as c, type ComplexityHotspot as d, type ComplexityResult as e, type ConvergenceResult as f, type CouplingResult as g, type CycleResult as h, type DeadOptions as i, type DeadSummary as j, type DeepChainResult as k, type DepResult as l, type DiffImpactResult as m, type DriftSummary as n, type FileResult as o, type HierarchyNode as p, type HotspotResult as q, type IsolatedResult as r, type MethodResult as s, type StatsResult as t, type SymbolResult as u, type SystemResult as v, type SurfaceResult as w, type SimilarSymbolResult as x, type SimilarFileResult as y, type SimilarChainResult as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as
|
|
2
|
-
export { A as AffectedResult, B as BottleneckResult, a as ByKindResult, C as CallGraphResult,
|
|
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-BZPa7dzJ.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-BZPa7dzJ.js';
|
|
3
3
|
export { stats } from './queries/stats.js';
|
|
4
4
|
export { files } from './queries/files.js';
|
|
5
5
|
export { symbols } from './queries/symbols.js';
|
|
@@ -46,6 +46,216 @@ export { similarSignatures } from './queries/similar-signatures.js';
|
|
|
46
46
|
import { Index } from '@c4312/scip';
|
|
47
47
|
import 'better-sqlite3';
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* File classifier — one place to decide what role a source file plays.
|
|
51
|
+
*
|
|
52
|
+
* Multiple queries (dead, health, cycles, drift) all need to ask
|
|
53
|
+
* questions like "is this a test file?", "is this an entry point?",
|
|
54
|
+
* "is this a barrel?" Pre-this-module each query had its own answer
|
|
55
|
+
* with subtle divergences. classifyFile gives every query one
|
|
56
|
+
* consistent verdict.
|
|
57
|
+
*
|
|
58
|
+
* `FileKind` is closed — when a future contributor adds a kind they
|
|
59
|
+
* edit the type, and the compiler forces every consumer's switch to
|
|
60
|
+
* handle it.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
type FileKind = 'entry' | 'barrel' | 'worker' | 'test' | 'source';
|
|
64
|
+
/**
|
|
65
|
+
* Classify a file by role. Pure pattern matching — doesn't need a DB.
|
|
66
|
+
* For "is this barrel reachable?" use `isLiveBarrel(db, file)` instead.
|
|
67
|
+
*/
|
|
68
|
+
declare function classifyFile(file: string): FileKind;
|
|
69
|
+
|
|
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
|
+
|
|
106
|
+
declare function buildFileDepGraph(db: ScipDatabase, scope?: string): Map<string, Set<string>>;
|
|
107
|
+
/**
|
|
108
|
+
* Bulk callee map: for each definition in the list, find every symbol it
|
|
109
|
+
* actually calls.
|
|
110
|
+
*
|
|
111
|
+
* For files with tree-sitter support (Rust, TS/JS, Python), we use AST
|
|
112
|
+
* call_expression / new_expression nodes — every callsite is exact, every
|
|
113
|
+
* attribution is to the precise enclosing function.
|
|
114
|
+
*
|
|
115
|
+
* For files without AST support (Java, JVM, Ruby, .NET, Dart, PHP, C/C++),
|
|
116
|
+
* we fall back to chunk-level SCIP mentions.
|
|
117
|
+
*
|
|
118
|
+
* `opts.additive`:
|
|
119
|
+
* - false (default, "call-strict"): AST is the ground truth for AST files;
|
|
120
|
+
* chunk attribution is NOT unioned in. Use for callee fingerprints,
|
|
121
|
+
* extract/passthrough analysis, callGraph — anywhere you need exact
|
|
122
|
+
* "what does this function call" without false positives from chunk
|
|
123
|
+
* attribution placing a mention in the wrong enclosing function.
|
|
124
|
+
* - true ("union with chunks"): merges both paths. Use for liveness
|
|
125
|
+
* checks (isolated, "has any callee at all") where ambiguous-leaf
|
|
126
|
+
* callees that AST resolution skips would otherwise produce false
|
|
127
|
+
* positives.
|
|
128
|
+
*/
|
|
129
|
+
declare function buildCalleeMap(db: ScipDatabase, definitions: ReadonlyArray<SymbolMatch>, opts?: {
|
|
130
|
+
additive?: boolean;
|
|
131
|
+
}): Map<number, Array<{
|
|
132
|
+
symbol: string;
|
|
133
|
+
file: string;
|
|
134
|
+
chunkId: number;
|
|
135
|
+
}>>;
|
|
136
|
+
/**
|
|
137
|
+
* Bulk caller map: symbolId → set of distinct files that reference the
|
|
138
|
+
* symbol.
|
|
139
|
+
*
|
|
140
|
+
* For files with tree-sitter support, callers come from AST call_expression
|
|
141
|
+
* nodes — each callsite resolves to a real symbol via the global leaf index
|
|
142
|
+
* with same-file preference. For non-AST files, callers come from SCIP's
|
|
143
|
+
* mentions table (chunk-level) with self-reference filtering.
|
|
144
|
+
*
|
|
145
|
+
* If `definitions` is supplied, references that fall inside the symbol's own
|
|
146
|
+
* defining file are treated as potential self-references and only counted
|
|
147
|
+
* when they originate from a different document.
|
|
148
|
+
*/
|
|
149
|
+
declare function buildCrossFileCallerMap(db: ScipDatabase, definitions?: ReadonlyArray<SymbolLocation>): Map<number, Set<string>>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Identifier-attribution module — one owner of "given a textual identifier
|
|
153
|
+
* hit in file F, which SCIP symbol(s) does it refer to?"
|
|
154
|
+
*
|
|
155
|
+
* Pre-this-module the same logic lived in four places (sourceCandidateLines,
|
|
156
|
+
* importAttributedCandidateLines, buildSourceFallbackCallerFiles inner loop,
|
|
157
|
+
* dead.ts:resolveLeaf) with subtle drift. Bug fixes in one site silently
|
|
158
|
+
* coexisted with the bug in the others. The Vue support and interface-
|
|
159
|
+
* dispatch fixes from earlier had to touch all four sites separately.
|
|
160
|
+
*
|
|
161
|
+
* The forward call (`attributeIdentifier`) is the core. The inverse views
|
|
162
|
+
* (`findReferences`, `findCallerFiles`) build on it.
|
|
163
|
+
*
|
|
164
|
+
* The disambiguation policy — same-file > direct import > interface-dispatch
|
|
165
|
+
* (all candidates in same imported file) > empty — is owned here. Callers
|
|
166
|
+
* receive the answer, not raw candidates.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
interface SymbolRef {
|
|
170
|
+
symbolId: number;
|
|
171
|
+
symbol: string;
|
|
172
|
+
/** Defining file of the symbol. */
|
|
173
|
+
relativePath: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* What symbol(s) does identifier `name` in file `file` refer to?
|
|
177
|
+
*
|
|
178
|
+
* Returns the symbols this textual hit reasonably resolves to. May
|
|
179
|
+
* return >1 entry when an interface and one or more impls all live
|
|
180
|
+
* in the same imported file (runtime dispatch could land on any).
|
|
181
|
+
* Returns [] when the leaf is ambiguous and no disambiguation
|
|
182
|
+
* signal applies.
|
|
183
|
+
*/
|
|
184
|
+
declare function attributeIdentifier(db: ScipDatabase, file: string, identifier: string): SymbolRef[];
|
|
185
|
+
/**
|
|
186
|
+
* For each symbol in `candidates`, which files reference it?
|
|
187
|
+
*
|
|
188
|
+
* Bulk variant of `findReferences` — one file walk credits every
|
|
189
|
+
* candidate-leaf hit in the file at once, instead of N walks per
|
|
190
|
+
* candidate. Used by the dead-code source-fallback path.
|
|
191
|
+
*/
|
|
192
|
+
declare function findCallerFiles(db: ScipDatabase, candidates: ReadonlyArray<IndexedDefinition>): Map<number, Set<string>>;
|
|
193
|
+
|
|
194
|
+
interface CallableSignature {
|
|
195
|
+
paramCount: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Pull a function's parameter count from the AST. Used by similar-pair
|
|
199
|
+
* filtering to avoid declaring a 1-arg helper similar to a 7-arg orchestrator
|
|
200
|
+
* just because they happen to share infrastructure callees.
|
|
201
|
+
*
|
|
202
|
+
* On first call per file, walks the entire AST once and indexes every
|
|
203
|
+
* callable's signature by (startLine, endLine). Subsequent calls are O(1)
|
|
204
|
+
* Map lookups — critical when called for thousands of candidates.
|
|
205
|
+
*/
|
|
206
|
+
declare function getCallableSignature(db: ScipDatabase, relativePath: string, startLine: number, endLine: number): CallableSignature | null;
|
|
207
|
+
|
|
208
|
+
type SourceReferenceKind = 'identifier' | 'cross-language-dispatch' | 'rust-attribute';
|
|
209
|
+
type SourceReferenceTarget = ReturnType<typeof attributeIdentifier>[number];
|
|
210
|
+
interface SourceReferenceHit {
|
|
211
|
+
sourceFile: string;
|
|
212
|
+
name: string;
|
|
213
|
+
target: SourceReferenceTarget;
|
|
214
|
+
occurrences: number;
|
|
215
|
+
kind: SourceReferenceKind;
|
|
216
|
+
}
|
|
217
|
+
interface ScanSourceReferencesOptions {
|
|
218
|
+
paths: Iterable<string>;
|
|
219
|
+
includeVueSfc?: boolean;
|
|
220
|
+
includeCrossLanguageDispatchNames?: boolean;
|
|
221
|
+
includeRustAttributeNames?: boolean;
|
|
222
|
+
identifierResolution?: 'strict' | 'permissive';
|
|
223
|
+
skipPath?: (relativePath: string) => boolean;
|
|
224
|
+
}
|
|
225
|
+
declare function scanSourceReferences(db: ScipDatabase, opts: ScanSourceReferencesOptions, visit: (hit: SourceReferenceHit) => void): void;
|
|
226
|
+
|
|
227
|
+
interface ProductionCallableDefinitionsOptions {
|
|
228
|
+
scope?: string;
|
|
229
|
+
minLoc?: number;
|
|
230
|
+
maxLoc?: number;
|
|
231
|
+
excludeSymbol?: string;
|
|
232
|
+
excludeEntrySurfaces?: boolean;
|
|
233
|
+
excludeTypesFiles?: boolean;
|
|
234
|
+
excludeRustTraitImplMembers?: boolean;
|
|
235
|
+
includeSuppressed?: boolean;
|
|
236
|
+
requireFunctionLikeSymbol?: boolean;
|
|
237
|
+
requireCallableSymbol?: boolean;
|
|
238
|
+
sortByLocDesc?: boolean;
|
|
239
|
+
}
|
|
240
|
+
declare class ProjectIndex {
|
|
241
|
+
private readonly db;
|
|
242
|
+
constructor(db: ScipDatabase);
|
|
243
|
+
scopedDefinitions(scope?: string): IndexedDefinition[];
|
|
244
|
+
definitionsForFile(relativePath: string): IndexedDefinition[];
|
|
245
|
+
productionCallableDefinitions(opts?: ProductionCallableDefinitionsOptions): IndexedDefinition[];
|
|
246
|
+
calleeMap(definitions: ReadonlyArray<SymbolMatch>, opts?: {
|
|
247
|
+
additive?: boolean;
|
|
248
|
+
}): ReturnType<typeof buildCalleeMap>;
|
|
249
|
+
crossFileCallerMap(definitions?: ReadonlyArray<SymbolMatch>): ReturnType<typeof buildCrossFileCallerMap>;
|
|
250
|
+
sourceFallbackCallerFiles(definitions: ReadonlyArray<IndexedDefinition>): ReturnType<typeof findCallerFiles>;
|
|
251
|
+
fileDependencyGraph(scope?: string): ReturnType<typeof buildFileDepGraph>;
|
|
252
|
+
fileKind(relativePath: string): ReturnType<typeof classifyFile>;
|
|
253
|
+
hasSuppressionComment(definition: Pick<IndexedDefinition, 'relativePath' | 'startLine'>): boolean;
|
|
254
|
+
sourceFiles(): string[];
|
|
255
|
+
scanSourceReferences(opts: Parameters<typeof scanSourceReferences>[1], visit: Parameters<typeof scanSourceReferences>[2]): void;
|
|
256
|
+
callableSignature(definition: Pick<IndexedDefinition, 'relativePath' | 'startLine' | 'endLine'>): ReturnType<typeof getCallableSignature>;
|
|
257
|
+
}
|
|
258
|
+
|
|
49
259
|
/**
|
|
50
260
|
* Parse a SCIP symbol string into its structured components.
|
|
51
261
|
* Works for any SCIP-indexed language (TypeScript, Java, Rust, Python, etc.)
|
|
@@ -188,6 +398,12 @@ interface ReindexOptions {
|
|
|
188
398
|
pnpmWorkspaces?: boolean;
|
|
189
399
|
/** Skip auto-install prompts */
|
|
190
400
|
skipAutoInstall?: boolean;
|
|
401
|
+
/** Reuse an existing index when tracked source inputs are unchanged (default true). */
|
|
402
|
+
skipIfUnchanged?: boolean;
|
|
403
|
+
/** Permit a partial index when some detected/requested languages fail (default false). */
|
|
404
|
+
allowPartial?: boolean;
|
|
405
|
+
/** Number of language indexers to run at once (default: conservative auto). */
|
|
406
|
+
indexerConcurrency?: number;
|
|
191
407
|
}
|
|
192
408
|
interface ReindexResult {
|
|
193
409
|
/** Languages that were successfully indexed. */
|
|
@@ -195,6 +411,8 @@ interface ReindexResult {
|
|
|
195
411
|
indexPath: string;
|
|
196
412
|
dbPath: string;
|
|
197
413
|
durationMs: number;
|
|
414
|
+
/** True when existing SCIP/SQLite outputs were reused because inputs were unchanged. */
|
|
415
|
+
reused: boolean;
|
|
198
416
|
/**
|
|
199
417
|
* Languages detected in the project but skipped because their indexer
|
|
200
418
|
* could not be located, installed, or run. Each entry includes the reason.
|
|
@@ -215,16 +433,6 @@ declare function reindex(opts: ReindexOptions): Promise<ReindexResult>;
|
|
|
215
433
|
* Returns defaults for anything not specified.
|
|
216
434
|
*/
|
|
217
435
|
declare function loadProjectConfig(projectRoot: string): ProjectConfig;
|
|
218
|
-
/**
|
|
219
|
-
* Resolve the cache directory for a project's SCIP index.
|
|
220
|
-
*
|
|
221
|
-
* Default: ~/.cache/scip-query/projects/<hash>/
|
|
222
|
-
* Override: project config dbPath, or SCIP_QUERY_DB_PATH env var
|
|
223
|
-
*
|
|
224
|
-
* The hash is derived from the absolute project path so each
|
|
225
|
-
* project gets its own isolated index storage.
|
|
226
|
-
*/
|
|
227
|
-
declare function resolveCacheDir(projectRoot: string, config?: ProjectConfig): string;
|
|
228
436
|
/**
|
|
229
437
|
* Resolve all paths for a project's index files.
|
|
230
438
|
*/
|
|
@@ -307,4 +515,4 @@ declare function installSkills(opts?: {
|
|
|
307
515
|
quiet?: boolean;
|
|
308
516
|
}): InstallSkillsResult;
|
|
309
517
|
|
|
310
|
-
export { INDEXER_CONFIGS, IndexerConfig, ProjectConfig, ScipLocalSymbol, ScipSymbol, SupportedLanguage, Watcher, WatcherStatus, augmentAuxiliaryDocuments, augmentVueResolvedReferences, detectLanguages, getIndexerConfig, getScipVersion, initProjectConfig, installSkills, isBinaryAvailable, isIndexerInstalled, isScipInstalled, leafName, loadProjectConfig, mergeScipFiles, mergeScipIndexes, parseSymbol, printScipInstallInstructions, reindex,
|
|
518
|
+
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 };
|