scip-query 0.6.9 → 0.7.0
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 +3 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-23YIGCYF.js +25 -0
- package/dist/{chunk-V4WRHJU3.js → chunk-2IYEIFPP.js} +6 -6
- package/dist/chunk-2JEFS2YJ.js +2 -0
- package/dist/chunk-33SSUPCB.js +7 -0
- package/dist/chunk-3GNFUVFA.js +2 -0
- package/dist/chunk-3OUC276S.js +2 -0
- package/dist/{chunk-JLFAQ2E2.js → chunk-4STLJYHI.js} +4 -4
- package/dist/chunk-563HLCDW.js +35 -0
- package/dist/chunk-5TT47UMX.js +44 -0
- package/dist/chunk-6H2XIIPY.js +71 -0
- package/dist/{chunk-I5BB33E6.js → chunk-72JOIFXL.js} +3 -3
- package/dist/chunk-7H4RJ4MC.js +2 -0
- package/dist/chunk-7O4MJYIW.js +63 -0
- package/dist/chunk-7OX2O53H.js +62 -0
- package/dist/chunk-A2AVLALL.js +2 -0
- package/dist/chunk-AQYBOORI.js +2 -0
- package/dist/chunk-ARBZM2NF.js +34 -0
- package/dist/{chunk-GRAEZYYU.js → chunk-BI4F6GXI.js} +2 -2
- package/dist/chunk-BOVNTAKQ.js +3 -0
- package/dist/chunk-CKIO6SVS.js +2 -0
- package/dist/chunk-D6Z67MZL.js +2 -0
- package/dist/chunk-DFK54IRN.js +2 -0
- package/dist/chunk-FD37DBTD.js +2 -0
- package/dist/chunk-FOQQDXE7.js +2 -0
- package/dist/chunk-GAQGJ52J.js +11 -0
- package/dist/chunk-IODTPF5H.js +20 -0
- package/dist/chunk-J6Z5YKGQ.js +4 -0
- package/dist/chunk-JB4PUN5S.js +40 -0
- package/dist/chunk-JTXKS5GK.js +3 -0
- package/dist/chunk-KJ3ZJIE5.js +2 -0
- package/dist/chunk-KJ6CW6EK.js +2 -0
- package/dist/{chunk-AXHDRSRI.js → chunk-KNA6Z7JB.js} +3 -3
- package/dist/{chunk-U3GYMGBX.js → chunk-LDV2B7ET.js} +8 -8
- package/dist/chunk-LWYIGRHR.js +5 -0
- package/dist/chunk-MDAYGS6T.js +2 -0
- package/dist/chunk-MX6F756F.js +2 -0
- package/dist/chunk-NHDPYW7O.js +2 -0
- package/dist/{chunk-IIKNAXAE.js → chunk-NKJKI6SE.js} +2 -2
- package/dist/chunk-NN3O7TPH.js +8 -0
- package/dist/chunk-NSTZMBAB.js +18 -0
- package/dist/chunk-NYEMZHUC.js +6 -0
- package/dist/chunk-OHEIZWIA.js +4 -0
- package/dist/chunk-PG3ZI5IH.js +2 -0
- package/dist/chunk-QAEDNTY7.js +2 -0
- package/dist/chunk-QE6MGGUY.js +2 -0
- package/dist/chunk-QPRIYXH4.js +2 -0
- package/dist/chunk-QWJBIBE6.js +3 -0
- package/dist/chunk-RCJEFQOK.js +4 -0
- package/dist/chunk-ROOHENEP.js +61 -0
- package/dist/{chunk-3JGBAAP7.js → chunk-ROZNBWIF.js} +2 -2
- package/dist/chunk-TGK5DFBJ.js +2 -0
- package/dist/chunk-TKDJQ2WD.js +59 -0
- package/dist/chunk-TRNAQABL.js +7 -0
- package/dist/chunk-U75WH4XG.js +2 -0
- package/dist/chunk-V53J46BX.js +2 -0
- package/dist/chunk-V76FCF5F.js +2 -0
- package/dist/chunk-VUBQBW7H.js +16 -0
- package/dist/chunk-WJQY2LGT.js +2 -0
- package/dist/{chunk-ZO5IFJRM.js → chunk-WODJHE6Z.js} +3 -3
- package/dist/{chunk-IX45SWX5.js → chunk-WPLKHAH7.js} +4 -4
- package/dist/chunk-XO6R3X5J.js +2 -0
- package/dist/chunk-YSZNAG4G.js +2 -0
- package/dist/chunk-ZNUPGRPR.js +3 -0
- package/dist/{chunk-UIM4WALN.js → chunk-ZXFTC5ET.js} +4 -4
- package/dist/cli.js +362 -527
- package/dist/config-types-CGIeLEpY.d.ts +108 -0
- package/dist/db-DdTPetj5.d.ts +69 -0
- package/dist/health-x7B4Xu_6.d.ts +119 -0
- package/dist/index.d.ts +100 -334
- package/dist/index.js +3 -131
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +9 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +12 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +12 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +19 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +16 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +12 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +15 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +19 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +22 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +8 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +16 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +32 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +34 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +8 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +6 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +22 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.d.ts +18 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +19 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +7 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +6 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +4 -81
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +8 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +10 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +13 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +45 -44
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +11 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +10 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +8 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +10 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +14 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +13 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +7 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +21 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +12 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +16 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +21 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +16 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +36 -3
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +11 -2
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +8 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +10 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +10 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +18 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +14 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.d.ts +153 -0
- package/dist/reindex.js +69 -0
- package/dist/runtime.d.ts +108 -0
- package/dist/runtime.js +3 -0
- package/dist/scip-cli-a-xOztiK.d.ts +20 -0
- package/package.json +184 -4
- package/dist/chunk-2OP63JQQ.js +0 -2
- package/dist/chunk-33Z6HQBX.js +0 -5
- package/dist/chunk-3F453KPT.js +0 -2
- package/dist/chunk-3PKPUCIJ.js +0 -11
- package/dist/chunk-42BWO2NN.js +0 -2
- package/dist/chunk-4MDCFY3E.js +0 -2
- package/dist/chunk-4QWTQ6YV.js +0 -2
- package/dist/chunk-5IRX5I64.js +0 -5
- package/dist/chunk-5MPZ2A7J.js +0 -2
- package/dist/chunk-67OMD56K.js +0 -90
- package/dist/chunk-6UVVA5I4.js +0 -7
- package/dist/chunk-BAA4EJRX.js +0 -2
- package/dist/chunk-BT36WY5B.js +0 -114
- package/dist/chunk-CLKFDBS6.js +0 -39
- package/dist/chunk-CWMWTHV3.js +0 -2
- package/dist/chunk-DXO2ECRF.js +0 -7
- package/dist/chunk-EHEZLULQ.js +0 -85
- package/dist/chunk-FVH3Y44U.js +0 -1
- package/dist/chunk-GWBRU65E.js +0 -2
- package/dist/chunk-H4DXD2FB.js +0 -5
- package/dist/chunk-I2KUHGMX.js +0 -16
- package/dist/chunk-JMASYYSW.js +0 -2
- package/dist/chunk-KAM4C6ZD.js +0 -4
- package/dist/chunk-LBWLO7NA.js +0 -70
- package/dist/chunk-LJ2YWNQF.js +0 -2
- package/dist/chunk-LLDPR3DG.js +0 -6
- package/dist/chunk-LNUZWWWL.js +0 -2
- package/dist/chunk-NLJCXHFU.js +0 -84
- package/dist/chunk-NRAJIFQA.js +0 -2
- package/dist/chunk-OYRGWW6Z.js +0 -2
- package/dist/chunk-PVMRIOM6.js +0 -33
- package/dist/chunk-QRYEOK3M.js +0 -2
- package/dist/chunk-SF2HYG53.js +0 -4
- package/dist/chunk-SHGPRVWH.js +0 -2
- package/dist/chunk-SMOUOKAO.js +0 -2
- package/dist/chunk-TBJDUS4E.js +0 -71
- package/dist/chunk-TPXWXKL6.js +0 -2
- package/dist/chunk-TTCUMJ43.js +0 -19
- package/dist/chunk-TYR7QY5G.js +0 -2
- package/dist/chunk-UZG3QXTG.js +0 -2
- package/dist/chunk-VDMRAGBK.js +0 -6
- package/dist/chunk-W6SRVK2Y.js +0 -5
- package/dist/chunk-WGYJDGBI.js +0 -25
- package/dist/chunk-WYX3RU2K.js +0 -2
- package/dist/chunk-WZYA234B.js +0 -2
- package/dist/chunk-Y6ZFXZ7B.js +0 -2
- package/dist/chunk-YCN5XEST.js +0 -7
- package/dist/db-Rx8Ho_JF.d.ts +0 -838
- package/dist/queries/drift-policy.d.ts +0 -6
- package/dist/queries/drift-policy.js +0 -2
- package/dist/queries/health-cache-control.d.ts +0 -15
- package/dist/queries/health-cache-control.js +0 -2
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
interface InstallMethod {
|
|
2
|
+
/** Human-readable label (e.g., "npm", "pip", "go install") */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Binary that must exist for this install method to work (e.g., "npm", "pip3", "go") */
|
|
5
|
+
prerequisite: string;
|
|
6
|
+
/** Command to execute */
|
|
7
|
+
binary: string;
|
|
8
|
+
/** Arguments for the command */
|
|
9
|
+
args: string[];
|
|
10
|
+
}
|
|
11
|
+
type SupportedLanguage = 'typescript' | 'javascript' | 'java' | 'scala' | 'kotlin' | 'rust' | 'python' | 'ruby' | 'go' | 'cpp' | 'c' | 'csharp' | 'vb' | 'dart' | 'php';
|
|
12
|
+
interface IndexerConfig {
|
|
13
|
+
language: SupportedLanguage;
|
|
14
|
+
/** Preferred executable name for the indexer */
|
|
15
|
+
indexerBinary: string;
|
|
16
|
+
/** Additional executable names accepted on PATH for the same indexer */
|
|
17
|
+
binaryAliases?: string[];
|
|
18
|
+
/** Project-local executable paths to prefer when they exist */
|
|
19
|
+
projectLocalBinaries?: string[];
|
|
20
|
+
/** Command to check if the indexer is installed */
|
|
21
|
+
checkCommand: string;
|
|
22
|
+
/** Returns the binary + args array for execFileSync (no shell injection) */
|
|
23
|
+
indexArgs: (opts: {
|
|
24
|
+
projectRoot: string;
|
|
25
|
+
outputPath: string;
|
|
26
|
+
pnpmWorkspaces?: boolean;
|
|
27
|
+
indexerBinary: string;
|
|
28
|
+
}) => {
|
|
29
|
+
binary: string;
|
|
30
|
+
args: string[];
|
|
31
|
+
};
|
|
32
|
+
/** Relative output path written by the indexer when it ignores outputPath */
|
|
33
|
+
defaultOutputPath?: string;
|
|
34
|
+
/** Marker files that indicate this language is present */
|
|
35
|
+
markerFiles: string[];
|
|
36
|
+
/** Installation methods to try in order of preference */
|
|
37
|
+
installMethods?: InstallMethod[];
|
|
38
|
+
/** URL for manual installation if auto-install fails */
|
|
39
|
+
installUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* npm package bundled with scip-query as an optionalDependency. When this
|
|
42
|
+
* package resolves locally (i.e. it installed successfully), the indexer is
|
|
43
|
+
* considered available even if its binary isn't on PATH — `npx <binary>`
|
|
44
|
+
* will pick up the local install.
|
|
45
|
+
*/
|
|
46
|
+
bundledNpmPackage?: string;
|
|
47
|
+
}
|
|
48
|
+
interface ScipQueryConfig {
|
|
49
|
+
/** Path to the SQLite database (index.db) */
|
|
50
|
+
dbPath: string;
|
|
51
|
+
/** Path to the SCIP protobuf index (index.scip) */
|
|
52
|
+
indexPath: string;
|
|
53
|
+
/** Project root directory */
|
|
54
|
+
projectRoot: string;
|
|
55
|
+
/** Project-specific externally-live roots for dead-code filtering */
|
|
56
|
+
entryRoots?: EntryRootsConfig;
|
|
57
|
+
/** Paths to .gitignore files to load for filtering */
|
|
58
|
+
gitignorePaths?: string[];
|
|
59
|
+
/** Optional semantic-provider configuration */
|
|
60
|
+
semantic?: SemanticConfig;
|
|
61
|
+
}
|
|
62
|
+
interface ProjectConfig {
|
|
63
|
+
/** Override which languages to index (default: auto-detect) */
|
|
64
|
+
languages?: SupportedLanguage[];
|
|
65
|
+
/** Watch mode settings */
|
|
66
|
+
watch?: WatchConfig;
|
|
67
|
+
/** Per-language indexer overrides */
|
|
68
|
+
indexer?: Partial<Record<SupportedLanguage, IndexerOverrides>>;
|
|
69
|
+
/** Override the database storage path (default: ~/.cache/scip-query/<hash>/) */
|
|
70
|
+
dbPath?: string;
|
|
71
|
+
/** Project-specific externally-live roots for dead-code filtering */
|
|
72
|
+
entryRoots?: EntryRootsConfig;
|
|
73
|
+
/** Optional semantic-provider configuration */
|
|
74
|
+
semantic?: SemanticConfig;
|
|
75
|
+
}
|
|
76
|
+
interface SemanticConfig {
|
|
77
|
+
typescript?: TypeScriptSemanticConfig;
|
|
78
|
+
}
|
|
79
|
+
interface TypeScriptSemanticConfig {
|
|
80
|
+
/** Explicit tsconfig paths, relative to project root unless absolute */
|
|
81
|
+
tsconfigs?: string[];
|
|
82
|
+
}
|
|
83
|
+
interface EntryRootsConfig {
|
|
84
|
+
/** Any symbol defined in these path prefixes is externally live */
|
|
85
|
+
pathPrefixes?: string[];
|
|
86
|
+
/** Any symbol defined in these exact files is externally live */
|
|
87
|
+
files?: string[];
|
|
88
|
+
/** Symbols matching these regular expressions are externally live */
|
|
89
|
+
symbolPatterns?: string[];
|
|
90
|
+
/** Qualified var names like my.ns/my-fn that are externally live */
|
|
91
|
+
qualifiedVars?: string[];
|
|
92
|
+
}
|
|
93
|
+
interface WatchConfig {
|
|
94
|
+
/** Enable file watching (default: false, must opt in) */
|
|
95
|
+
enabled?: boolean;
|
|
96
|
+
/** Ms to wait after the last file change before triggering reindex (default: 30000) */
|
|
97
|
+
debounceMs?: number;
|
|
98
|
+
/** Minimum ms between reindex completions (default: 60000) */
|
|
99
|
+
cooldownMs?: number;
|
|
100
|
+
/** Extra glob patterns to ignore beyond .gitignore */
|
|
101
|
+
ignore?: string[];
|
|
102
|
+
}
|
|
103
|
+
interface IndexerOverrides {
|
|
104
|
+
/** Enable pnpm workspace support (TypeScript) */
|
|
105
|
+
pnpmWorkspaces?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type { IndexerConfig as I, ProjectConfig as P, ScipQueryConfig as S, SupportedLanguage as a };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
2
|
+
import { S as ScipQueryConfig } from './config-types-CGIeLEpY.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Builds a gitignore-based path filter from .gitignore files found
|
|
6
|
+
* in the project directory tree. This replaces hardcoded path exclusions
|
|
7
|
+
* like "node_modules/", "dist/", "target/", "__pycache__/" — instead,
|
|
8
|
+
* we respect whatever the project already ignores.
|
|
9
|
+
*
|
|
10
|
+
* Falls back to sensible defaults if no .gitignore is found.
|
|
11
|
+
*/
|
|
12
|
+
declare function createGitignoreFilter(projectRoot: string): PathFilter;
|
|
13
|
+
interface PathFilter {
|
|
14
|
+
/** Returns true if this path should be excluded from results */
|
|
15
|
+
isIgnored: (relativePath: string) => boolean;
|
|
16
|
+
/** Filter an array of paths, keeping only non-ignored ones */
|
|
17
|
+
filter: (paths: string[]) => string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Thin wrapper around better-sqlite3 with a pre-configured connection
|
|
22
|
+
* and helper methods for the SCIP SQLite schema.
|
|
23
|
+
*
|
|
24
|
+
* The schema is produced by `scip expt-convert` and is identical
|
|
25
|
+
* regardless of source language (TypeScript, Rust, Python, etc.).
|
|
26
|
+
*
|
|
27
|
+
* Tables:
|
|
28
|
+
* documents — indexed files (id, language, relative_path)
|
|
29
|
+
* global_symbols — all symbols (id, symbol, display_name, kind, documentation)
|
|
30
|
+
* defn_enclosing_ranges — definition locations (document_id, symbol_id, start/end line/char)
|
|
31
|
+
* mentions — references & definitions (chunk_id, symbol_id, role)
|
|
32
|
+
* chunks — code segments (document_id, chunk_index, start/end line, occurrences)
|
|
33
|
+
*/
|
|
34
|
+
declare class ScipDatabase {
|
|
35
|
+
readonly db: Database.Database;
|
|
36
|
+
readonly config: ScipQueryConfig;
|
|
37
|
+
private pathFilter;
|
|
38
|
+
constructor(config: ScipQueryConfig, pathFilter?: PathFilter);
|
|
39
|
+
/** Check if a path should be excluded based on .gitignore rules */
|
|
40
|
+
isIgnored(relativePath: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The local-symbol predicate: only match symbols that are defined
|
|
43
|
+
* in files NOT excluded by gitignore. This replaces the old hardcoded
|
|
44
|
+
* `NOT LIKE 'node_modules/%'` check.
|
|
45
|
+
*
|
|
46
|
+
* Since SQLite can't evaluate JS gitignore rules inline, we use a
|
|
47
|
+
* simpler approach: query broadly, then filter in JS. For queries
|
|
48
|
+
* that need SQL-level filtering, use excludedPathPatterns().
|
|
49
|
+
*/
|
|
50
|
+
get localSymbolPredicate(): string;
|
|
51
|
+
/**
|
|
52
|
+
* SQL WHERE clause fragments to exclude common build/dependency paths.
|
|
53
|
+
* Complements the JS-level gitignore filtering for performance.
|
|
54
|
+
*/
|
|
55
|
+
get pathExclusions(): string;
|
|
56
|
+
/** Reusable SQL fragment: filter out synthetic/internal symbol noise */
|
|
57
|
+
get symbolNoise(): string;
|
|
58
|
+
/** Build SQL path exclusions for one or more document table aliases */
|
|
59
|
+
pathExclusionsFor(...aliases: string[]): string;
|
|
60
|
+
/** Build SQL symbol exclusions for the given global_symbols alias */
|
|
61
|
+
symbolNoiseFor(alias: string): string;
|
|
62
|
+
/** Run a raw SQL query and return all rows */
|
|
63
|
+
all<T = Record<string, unknown>>(sql: string, ...params: unknown[]): T[];
|
|
64
|
+
/** Run a raw SQL query and return the first row */
|
|
65
|
+
get<T = Record<string, unknown>>(sql: string, ...params: unknown[]): T | undefined;
|
|
66
|
+
close(): void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { ScipDatabase as S, createGitignoreFilter as c };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { S as ScipDatabase } from './db-DdTPetj5.js';
|
|
2
|
+
import { stats } from './queries/stats.js';
|
|
3
|
+
|
|
4
|
+
interface CountLocSummary {
|
|
5
|
+
count: number;
|
|
6
|
+
loc: number;
|
|
7
|
+
}
|
|
8
|
+
interface StaleSummary extends CountLocSummary {
|
|
9
|
+
unused: number;
|
|
10
|
+
singleUse: number;
|
|
11
|
+
}
|
|
12
|
+
interface DriftSummary {
|
|
13
|
+
count: number;
|
|
14
|
+
unusedImports: number;
|
|
15
|
+
layerViolations: number;
|
|
16
|
+
}
|
|
17
|
+
interface ComplexitySummary {
|
|
18
|
+
top: Array<{
|
|
19
|
+
symbol: string;
|
|
20
|
+
score: number;
|
|
21
|
+
}>;
|
|
22
|
+
extremeCount: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface HealthAction {
|
|
26
|
+
category: string;
|
|
27
|
+
description: string;
|
|
28
|
+
effort: 'low' | 'medium' | 'high';
|
|
29
|
+
impact: 'low' | 'medium' | 'high';
|
|
30
|
+
count: number;
|
|
31
|
+
locRecoverable: number;
|
|
32
|
+
}
|
|
33
|
+
interface HealthReport {
|
|
34
|
+
score: number;
|
|
35
|
+
overview: {
|
|
36
|
+
documents: number;
|
|
37
|
+
symbols: number;
|
|
38
|
+
indexSizeBytes: number;
|
|
39
|
+
};
|
|
40
|
+
findings: {
|
|
41
|
+
deadSymbols: number;
|
|
42
|
+
deadLoc: number;
|
|
43
|
+
isolatedSymbols: number;
|
|
44
|
+
isolatedLoc: number;
|
|
45
|
+
cycles: number;
|
|
46
|
+
similarPairs: number;
|
|
47
|
+
extractionCandidates: number;
|
|
48
|
+
wrappers: number;
|
|
49
|
+
passthroughs: number;
|
|
50
|
+
staleTypes: number;
|
|
51
|
+
driftedFiles: number;
|
|
52
|
+
complexityHotspotCount: number;
|
|
53
|
+
};
|
|
54
|
+
actions: HealthAction[];
|
|
55
|
+
topComplexity: Array<{
|
|
56
|
+
symbol: string;
|
|
57
|
+
score: number;
|
|
58
|
+
}>;
|
|
59
|
+
warnings?: string[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare const HEALTH_PHASES: readonly ["overview", "dead", "isolated", "cycles", "similar", "extract-candidates", "wrapper-candidates", "passthrough-candidates", "stale-abstractions", "drift", "complexity-hotspots"];
|
|
63
|
+
type HealthPhaseName = typeof HEALTH_PHASES[number];
|
|
64
|
+
type HealthPhaseResult = {
|
|
65
|
+
phase: 'overview';
|
|
66
|
+
statsResult: ReturnType<typeof stats>;
|
|
67
|
+
warnings: string[];
|
|
68
|
+
} | {
|
|
69
|
+
phase: 'dead';
|
|
70
|
+
dead: CountLocSummary;
|
|
71
|
+
} | {
|
|
72
|
+
phase: 'isolated';
|
|
73
|
+
isolated: CountLocSummary;
|
|
74
|
+
} | {
|
|
75
|
+
phase: 'cycles';
|
|
76
|
+
realCycleCount: number;
|
|
77
|
+
} | {
|
|
78
|
+
phase: 'similar';
|
|
79
|
+
similarCount: number;
|
|
80
|
+
} | {
|
|
81
|
+
phase: 'extract-candidates';
|
|
82
|
+
extractCount: number;
|
|
83
|
+
} | {
|
|
84
|
+
phase: 'wrapper-candidates';
|
|
85
|
+
wrappers: CountLocSummary;
|
|
86
|
+
} | {
|
|
87
|
+
phase: 'passthrough-candidates';
|
|
88
|
+
passthroughs: CountLocSummary;
|
|
89
|
+
} | {
|
|
90
|
+
phase: 'stale-abstractions';
|
|
91
|
+
stale: StaleSummary;
|
|
92
|
+
} | {
|
|
93
|
+
phase: 'drift';
|
|
94
|
+
drift: DriftSummary;
|
|
95
|
+
} | {
|
|
96
|
+
phase: 'complexity-hotspots';
|
|
97
|
+
complexity: ComplexitySummary;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Single composite health report that runs all de-bloat analyses
|
|
101
|
+
* and produces a prioritized action list.
|
|
102
|
+
*
|
|
103
|
+
* The scoring formula accounts for common false positives:
|
|
104
|
+
* - Entry points (CLI, workers, barrels) appearing as "dead code"
|
|
105
|
+
* - Typed result interfaces with 1 consumer (normal for APIs)
|
|
106
|
+
* - Consistent import patterns across sibling modules (not duplication)
|
|
107
|
+
* - Barrel and orchestrator files deviating from sibling patterns (expected)
|
|
108
|
+
*/
|
|
109
|
+
declare function health(db: ScipDatabase, opts?: {
|
|
110
|
+
scope?: string;
|
|
111
|
+
full?: boolean;
|
|
112
|
+
}): HealthReport;
|
|
113
|
+
declare function healthPhase(db: ScipDatabase, phase: HealthPhaseName, opts?: {
|
|
114
|
+
scope?: string;
|
|
115
|
+
full?: boolean;
|
|
116
|
+
}): HealthPhaseResult;
|
|
117
|
+
declare function healthReportFromPhases(phaseResults: HealthPhaseResult[]): HealthReport;
|
|
118
|
+
|
|
119
|
+
export { HEALTH_PHASES as H, type HealthAction as a, type HealthReport as b, healthPhase as c, healthReportFromPhases as d, type HealthPhaseName as e, health as h };
|