scip-query 0.2.0 → 0.2.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.
- package/README.md +16 -43
- package/dist/chunk-2UELLEBI.js +1 -0
- package/dist/chunk-34JPTNRN.js +601 -0
- package/dist/{chunk-W4ALF422.js → chunk-3566TKJ5.js} +3 -3
- package/dist/{chunk-Z6YZJ36C.js → chunk-4ACRRQC4.js} +8 -4
- package/dist/{chunk-Z4GHE2HD.js → chunk-4BQFSNFI.js} +6 -2
- package/dist/{chunk-4XHWPRAX.js → chunk-6QSHLFSL.js} +3 -3
- package/dist/{chunk-4EXL2CUA.js → chunk-6WVR5K46.js} +16 -8
- package/dist/{chunk-ZQIIPFD7.js → chunk-75RQSBTK.js} +2 -2
- package/dist/{chunk-KPPHZCZJ.js → chunk-7HK5ZLOE.js} +28 -46
- package/dist/{chunk-MCUX5LA7.js → chunk-7JFZSOJ7.js} +3 -3
- package/dist/{chunk-6SXADWLW.js → chunk-AKMBBKWV.js} +2 -2
- package/dist/{chunk-NHBZIL2J.js → chunk-AMNISGYR.js} +3 -3
- package/dist/{chunk-2CKGIR6G.js → chunk-BFLULBEU.js} +3 -3
- package/dist/{chunk-HPFZLISB.js → chunk-CU62ZDHI.js} +2 -2
- package/dist/{chunk-EQYLEQCW.js → chunk-DY4AFG2W.js} +12 -10
- package/dist/{chunk-5RMYT5WH.js → chunk-F7XU27LU.js} +2 -2
- package/dist/{chunk-KCBMVQL5.js → chunk-GPJVPT3U.js} +2 -2
- package/dist/{chunk-NUZ4OMU3.js → chunk-GU2H5QRN.js} +2 -2
- package/dist/{chunk-UJQN5N3I.js → chunk-H6WCPKCX.js} +6 -3
- package/dist/{chunk-OVPLOMPY.js → chunk-HMYJJ3HY.js} +7 -4
- package/dist/chunk-IJKLB2JW.js +69 -0
- package/dist/{chunk-DGUPQSOR.js → chunk-IXPHLF6K.js} +2 -2
- package/dist/{chunk-7PBOG4YE.js → chunk-KBOQX573.js} +2 -2
- package/dist/{chunk-ZOGY2V3N.js → chunk-LLMPAG56.js} +93 -30
- package/dist/{chunk-BOVXCR46.js → chunk-LTJC5ZQL.js} +2 -2
- package/dist/{chunk-LAWMH22O.js → chunk-M3NPW3FC.js} +2 -2
- package/dist/{chunk-NWCE4CIC.js → chunk-M4QGEKKD.js} +5 -27
- package/dist/{chunk-63G7IQTD.js → chunk-MVH45PYK.js} +20 -40
- package/dist/chunk-N4C3H7LH.js +37 -0
- package/dist/chunk-NG5F43OU.js +200 -0
- package/dist/{chunk-D567NFIF.js → chunk-NVIIM34O.js} +3 -3
- package/dist/{chunk-BNN2RKD2.js → chunk-ORINICIZ.js} +3 -3
- package/dist/{chunk-4PDAL6IL.js → chunk-PMJKOXOT.js} +3 -3
- package/dist/{chunk-QOV2R2WT.js → chunk-QIXNAB5K.js} +42 -2
- package/dist/{chunk-7LLPRPR5.js → chunk-R2I3M5B4.js} +2 -2
- package/dist/{chunk-7RLE5EWE.js → chunk-R56FJU3E.js} +34 -13
- package/dist/{chunk-H2MDONBU.js → chunk-RFMT7UAZ.js} +3 -3
- package/dist/{chunk-SEFSL2GF.js → chunk-TOIEB3LG.js} +2 -2
- package/dist/chunk-VO4QI3LS.js +84 -0
- package/dist/{chunk-ZK6GXM3J.js → chunk-WVK7AASK.js} +3 -3
- package/dist/{chunk-HMLMH7VZ.js → chunk-Y3M323OX.js} +2 -2
- package/dist/{chunk-DCKMSTJ4.js → chunk-Y4JFVQ7C.js} +2 -2
- package/dist/{chunk-7UCKSQRS.js → chunk-YAFWL3RA.js} +3 -3
- package/dist/{chunk-FGXRVW7G.js → chunk-YZ6L7GFO.js} +2 -2
- package/dist/cli.js +1355 -671
- package/dist/{db-BNVVZSfP.d.ts → db-BHYam4BK.d.ts} +6 -18
- package/dist/index.d.ts +15 -15
- package/dist/index.js +260 -231
- package/dist/postinstall.js +5 -76
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +3 -3
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +2 -2
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +2 -2
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +3 -3
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +2 -3
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +3 -3
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +3 -3
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +3 -3
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +3 -3
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +3 -2
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +3 -3
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +4 -3
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +3 -2
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +2 -3
- package/dist/queries/doc-coverage.d.ts +1 -1
- package/dist/queries/doc-coverage.js +2 -2
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +3 -2
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +3 -3
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +2 -2
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +14 -14
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +3 -2
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +2 -2
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +3 -2
- package/dist/queries/index.d.ts +1 -2
- package/dist/queries/index.js +43 -48
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +4 -3
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +3 -2
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +2 -2
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +2 -2
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +3 -3
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +4 -2
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +3 -2
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +3 -2
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +2 -2
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +3 -3
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +3 -3
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +3 -3
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +2 -2
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +2 -2
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +2 -2
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +3 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +3 -3
- package/dist/reindex-worker.js +24 -12
- package/package.json +6 -1
- package/IMPROVEMENTS.md +0 -143
- package/PLAN.md +0 -320
- package/dist/chunk-2CKGIR6G.js.map +0 -1
- package/dist/chunk-3UOUTZQT.js +0 -45
- package/dist/chunk-3UOUTZQT.js.map +0 -1
- package/dist/chunk-4EXL2CUA.js.map +0 -1
- package/dist/chunk-4PDAL6IL.js.map +0 -1
- package/dist/chunk-4TYLS5XX.js.map +0 -1
- package/dist/chunk-4XHWPRAX.js.map +0 -1
- package/dist/chunk-5RMYT5WH.js.map +0 -1
- package/dist/chunk-63G7IQTD.js.map +0 -1
- package/dist/chunk-6SXADWLW.js.map +0 -1
- package/dist/chunk-74RFWB5T.js.map +0 -1
- package/dist/chunk-7LLPRPR5.js.map +0 -1
- package/dist/chunk-7PBOG4YE.js.map +0 -1
- package/dist/chunk-7RLE5EWE.js.map +0 -1
- package/dist/chunk-7UCKSQRS.js.map +0 -1
- package/dist/chunk-BNN2RKD2.js.map +0 -1
- package/dist/chunk-BOVXCR46.js.map +0 -1
- package/dist/chunk-D567NFIF.js.map +0 -1
- package/dist/chunk-DCKMSTJ4.js.map +0 -1
- package/dist/chunk-DEZKCZXD.js +0 -40
- package/dist/chunk-DEZKCZXD.js.map +0 -1
- package/dist/chunk-DGUPQSOR.js.map +0 -1
- package/dist/chunk-DVWGWHFW.js +0 -99
- package/dist/chunk-DVWGWHFW.js.map +0 -1
- package/dist/chunk-EQYLEQCW.js.map +0 -1
- package/dist/chunk-FGXRVW7G.js.map +0 -1
- package/dist/chunk-H2MDONBU.js.map +0 -1
- package/dist/chunk-HB7MRLLL.js +0 -76
- package/dist/chunk-HB7MRLLL.js.map +0 -1
- package/dist/chunk-HDSRORNV.js.map +0 -1
- package/dist/chunk-HMLMH7VZ.js.map +0 -1
- package/dist/chunk-HPFZLISB.js.map +0 -1
- package/dist/chunk-HZBC7PPD.js +0 -88
- package/dist/chunk-HZBC7PPD.js.map +0 -1
- package/dist/chunk-ITZ3DDOG.js.map +0 -1
- package/dist/chunk-JJP7KQND.js +0 -1
- package/dist/chunk-JJP7KQND.js.map +0 -1
- package/dist/chunk-KCBMVQL5.js.map +0 -1
- package/dist/chunk-KPPHZCZJ.js.map +0 -1
- package/dist/chunk-LAWMH22O.js.map +0 -1
- package/dist/chunk-MCUX5LA7.js.map +0 -1
- package/dist/chunk-MGNMHKX3.js.map +0 -1
- package/dist/chunk-N5KEREIA.js.map +0 -1
- package/dist/chunk-NHBZIL2J.js.map +0 -1
- package/dist/chunk-NUZ4OMU3.js.map +0 -1
- package/dist/chunk-NWCE4CIC.js.map +0 -1
- package/dist/chunk-OVPLOMPY.js.map +0 -1
- package/dist/chunk-QOV2R2WT.js.map +0 -1
- package/dist/chunk-SEFSL2GF.js.map +0 -1
- package/dist/chunk-UJQN5N3I.js.map +0 -1
- package/dist/chunk-W4ALF422.js.map +0 -1
- package/dist/chunk-Z4GHE2HD.js.map +0 -1
- package/dist/chunk-Z6YZJ36C.js.map +0 -1
- package/dist/chunk-ZK6GXM3J.js.map +0 -1
- package/dist/chunk-ZOGY2V3N.js.map +0 -1
- package/dist/chunk-ZQIIPFD7.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/postinstall.js.map +0 -1
- package/dist/queries/affected.js.map +0 -1
- package/dist/queries/bottlenecks.js.map +0 -1
- package/dist/queries/by-kind.js.map +0 -1
- package/dist/queries/call-graph.js.map +0 -1
- package/dist/queries/change-surface.js.map +0 -1
- package/dist/queries/clean-signature.js.map +0 -1
- package/dist/queries/code.js.map +0 -1
- package/dist/queries/complexity-hotspots.js.map +0 -1
- package/dist/queries/complexity.js.map +0 -1
- package/dist/queries/convergence.js.map +0 -1
- package/dist/queries/coupling.js.map +0 -1
- package/dist/queries/cycles.js.map +0 -1
- package/dist/queries/dataflow.js.map +0 -1
- package/dist/queries/dead.js.map +0 -1
- package/dist/queries/deep-chains.js.map +0 -1
- package/dist/queries/deps.js.map +0 -1
- package/dist/queries/diff-impact.js.map +0 -1
- package/dist/queries/doc-coverage.js.map +0 -1
- package/dist/queries/drift.js.map +0 -1
- package/dist/queries/extract-candidates.js.map +0 -1
- package/dist/queries/fan.js.map +0 -1
- package/dist/queries/files.js.map +0 -1
- package/dist/queries/health.js.map +0 -1
- package/dist/queries/hierarchy.js.map +0 -1
- package/dist/queries/hotspots.js.map +0 -1
- package/dist/queries/imports.js.map +0 -1
- package/dist/queries/index.js.map +0 -1
- package/dist/queries/isolated.js.map +0 -1
- package/dist/queries/members.js.map +0 -1
- package/dist/queries/methods.js.map +0 -1
- package/dist/queries/outline.js.map +0 -1
- package/dist/queries/passthrough-candidates.js.map +0 -1
- package/dist/queries/redundant-reexports.js.map +0 -1
- package/dist/queries/refs.js.map +0 -1
- package/dist/queries/similar-chains.js.map +0 -1
- package/dist/queries/similar-files.js.map +0 -1
- package/dist/queries/similar-signatures.js.map +0 -1
- package/dist/queries/similar.js.map +0 -1
- package/dist/queries/slice.js.map +0 -1
- package/dist/queries/stale-abstractions.js.map +0 -1
- package/dist/queries/stats.js.map +0 -1
- package/dist/queries/surface.js.map +0 -1
- package/dist/queries/symbols.js.map +0 -1
- package/dist/queries/system.js.map +0 -1
- package/dist/queries/test-coverage.d.ts +0 -22
- package/dist/queries/test-coverage.js +0 -11
- package/dist/queries/test-coverage.js.map +0 -1
- package/dist/queries/trace.js.map +0 -1
- package/dist/queries/wrapper-candidates.js.map +0 -1
- package/dist/reindex-worker.js.map +0 -1
- package/docs/AGENT_GUIDE.md +0 -359
- package/reports/debloat/2026-04-10-scip-query-self-audit.md +0 -161
- package/src/cli.ts +0 -1480
- package/src/config.ts +0 -117
- package/src/db.ts +0 -127
- package/src/gitignore-filter.ts +0 -143
- package/src/index.ts +0 -11
- package/src/postinstall.ts +0 -8
- package/src/queries/affected.ts +0 -86
- package/src/queries/bottlenecks.ts +0 -67
- package/src/queries/by-kind.ts +0 -204
- package/src/queries/call-graph.ts +0 -66
- package/src/queries/change-surface.ts +0 -110
- package/src/queries/clean-signature.ts +0 -22
- package/src/queries/code.ts +0 -101
- package/src/queries/complexity-hotspots.ts +0 -119
- package/src/queries/complexity.ts +0 -152
- package/src/queries/convergence.ts +0 -82
- package/src/queries/coupling.ts +0 -99
- package/src/queries/cycles.ts +0 -78
- package/src/queries/dataflow.ts +0 -128
- package/src/queries/dead.ts +0 -122
- package/src/queries/deep-chains.ts +0 -59
- package/src/queries/deps.ts +0 -46
- package/src/queries/diff-impact.ts +0 -204
- package/src/queries/doc-coverage.ts +0 -86
- package/src/queries/drift.ts +0 -224
- package/src/queries/extract-candidates.ts +0 -167
- package/src/queries/fan.ts +0 -148
- package/src/queries/files.ts +0 -16
- package/src/queries/health.ts +0 -324
- package/src/queries/hierarchy.ts +0 -49
- package/src/queries/hotspots.ts +0 -53
- package/src/queries/imports.ts +0 -95
- package/src/queries/index.ts +0 -45
- package/src/queries/isolated.ts +0 -67
- package/src/queries/members.ts +0 -54
- package/src/queries/methods.ts +0 -27
- package/src/queries/outline.ts +0 -52
- package/src/queries/passthrough-candidates.ts +0 -94
- package/src/queries/redundant-reexports.ts +0 -170
- package/src/queries/refs.ts +0 -27
- package/src/queries/similar-chains.ts +0 -314
- package/src/queries/similar-files.ts +0 -140
- package/src/queries/similar-signatures.ts +0 -151
- package/src/queries/similar.ts +0 -305
- package/src/queries/slice.ts +0 -154
- package/src/queries/stale-abstractions.ts +0 -82
- package/src/queries/stats.ts +0 -22
- package/src/queries/surface.ts +0 -34
- package/src/queries/symbols.ts +0 -39
- package/src/queries/system.ts +0 -86
- package/src/queries/test-coverage.ts +0 -106
- package/src/queries/trace.ts +0 -55
- package/src/queries/wrapper-candidates.ts +0 -112
- package/src/query-support.ts +0 -226
- package/src/reindex/detect.ts +0 -58
- package/src/reindex/index.ts +0 -153
- package/src/reindex/indexers.ts +0 -220
- package/src/reindex/install.ts +0 -125
- package/src/reindex-worker.ts +0 -35
- package/src/setup.ts +0 -202
- package/src/symbol-parser.ts +0 -278
- package/src/types.ts +0 -654
- package/src/watch.ts +0 -274
- package/tests/gitignore-filter.test.ts +0 -48
- package/tests/queries.test.ts +0 -300
- package/tests/symbol-parser.test.ts +0 -157
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -40
- package/vitest.config.ts +0 -7
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isFunctionLikeSymbol,
|
|
3
|
+
isModuleLikeSymbol,
|
|
4
|
+
leafName,
|
|
5
|
+
shortenSymbol
|
|
6
|
+
} from "./chunk-QIXNAB5K.js";
|
|
7
|
+
|
|
1
8
|
// src/query-support.ts
|
|
2
9
|
var TEST_FILE_PATTERNS = [
|
|
3
10
|
"%/__tests__/%",
|
|
@@ -13,9 +20,6 @@ var TEST_FILE_PATTERNS = [
|
|
|
13
20
|
var TEST_SUPPORT_PATH_PATTERNS = [
|
|
14
21
|
"%/test-utils/%"
|
|
15
22
|
];
|
|
16
|
-
function testFileMatchSql(alias, patterns = TEST_FILE_PATTERNS) {
|
|
17
|
-
return `(${patterns.map((pattern) => `${alias}.relative_path LIKE '${pattern}'`).join(" OR ")})`;
|
|
18
|
-
}
|
|
19
23
|
function testFileExclusionSql(alias, extraPatterns = []) {
|
|
20
24
|
const patterns = uniquePatterns([...TEST_FILE_PATTERNS, ...extraPatterns]);
|
|
21
25
|
return patterns.map((pattern) => `${alias}.relative_path NOT LIKE '${pattern}'`).join("\n AND ");
|
|
@@ -74,34 +78,95 @@ function findFirstSymbolMatch(db, symbolPattern) {
|
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
|
-
const cleaned = symbolPattern
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
${noiseClause}
|
|
88
|
-
ORDER BY (der.end_line - der.start_line) DESC
|
|
89
|
-
LIMIT 1`,
|
|
90
|
-
`%${cleaned}%`
|
|
91
|
-
);
|
|
92
|
-
if (row && !db.isIgnored(row.relative_path)) {
|
|
93
|
-
return {
|
|
94
|
-
symbolId: row.id,
|
|
95
|
-
symbol: row.symbol,
|
|
96
|
-
documentId: row.document_id,
|
|
97
|
-
startLine: row.start_line,
|
|
98
|
-
endLine: row.end_line,
|
|
99
|
-
relativePath: row.relative_path
|
|
100
|
-
};
|
|
81
|
+
const cleaned = normalizeLookupPattern(symbolPattern);
|
|
82
|
+
const tokens = lookupTokens(symbolPattern);
|
|
83
|
+
const candidates = getSymbolLookupCandidates(db, tokens);
|
|
84
|
+
let best = null;
|
|
85
|
+
for (const row of candidates) {
|
|
86
|
+
if (db.isIgnored(row.relative_path)) continue;
|
|
87
|
+
const score = scoreSymbolCandidate(row, symbolPattern, cleaned, tokens);
|
|
88
|
+
if (score <= 0) continue;
|
|
89
|
+
if (!best || score > best.score) {
|
|
90
|
+
best = { row, score };
|
|
101
91
|
}
|
|
102
92
|
}
|
|
93
|
+
if (best) {
|
|
94
|
+
return {
|
|
95
|
+
symbolId: best.row.id,
|
|
96
|
+
symbol: best.row.symbol,
|
|
97
|
+
documentId: best.row.document_id,
|
|
98
|
+
startLine: best.row.start_line,
|
|
99
|
+
endLine: best.row.end_line,
|
|
100
|
+
relativePath: best.row.relative_path
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
|
+
function normalizeLookupPattern(symbolPattern) {
|
|
106
|
+
return symbolPattern.trim().replace(/\(\)$/, "").replace(/\(.*$/, "");
|
|
107
|
+
}
|
|
108
|
+
function lookupTokens(symbolPattern) {
|
|
109
|
+
const cleaned = normalizeLookupPattern(symbolPattern);
|
|
110
|
+
const tokens = cleaned.split(/[^A-Za-z0-9_]+/).map((token) => token.trim()).filter((token) => token.length > 0);
|
|
111
|
+
return tokens.length > 0 ? [...new Set(tokens)] : [cleaned];
|
|
112
|
+
}
|
|
113
|
+
function getSymbolLookupCandidates(db, tokens) {
|
|
114
|
+
const tokenClauses = tokens.map(
|
|
115
|
+
() => `(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)`
|
|
116
|
+
);
|
|
117
|
+
const params = tokens.flatMap((token) => {
|
|
118
|
+
const like = `%${token}%`;
|
|
119
|
+
return [like, like, like];
|
|
120
|
+
});
|
|
121
|
+
return db.all(
|
|
122
|
+
`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name
|
|
123
|
+
FROM global_symbols gs
|
|
124
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
125
|
+
JOIN documents d ON der.document_id = d.id
|
|
126
|
+
WHERE ${tokenClauses.join("\n AND ")}
|
|
127
|
+
${db.pathExclusionsFor("d")}
|
|
128
|
+
LIMIT 200`,
|
|
129
|
+
...params
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function scoreSymbolCandidate(row, originalPattern, cleanedPattern, tokens) {
|
|
133
|
+
const original = originalPattern.toLowerCase();
|
|
134
|
+
const cleaned = cleanedPattern.toLowerCase();
|
|
135
|
+
const noParens = cleaned.replace(/\(\)$/, "");
|
|
136
|
+
const raw = row.symbol.toLowerCase();
|
|
137
|
+
const short = shortenSymbol(row.symbol).toLowerCase();
|
|
138
|
+
const leaf = leafName(row.symbol).toLowerCase();
|
|
139
|
+
const display = (row.display_name ?? "").toLowerCase();
|
|
140
|
+
const path = row.relative_path.toLowerCase();
|
|
141
|
+
const looksPathLike = /[/:.]/.test(cleanedPattern);
|
|
142
|
+
let score = 0;
|
|
143
|
+
if (raw === original || raw === cleaned) score += 1e3;
|
|
144
|
+
if (short === original || short === cleaned) score += 950;
|
|
145
|
+
if (path === original || path === cleaned) score += 925;
|
|
146
|
+
if (path.endsWith(`/${cleaned}`) || path.endsWith(`/${original}`)) score += 875;
|
|
147
|
+
if (display === noParens) score += 850;
|
|
148
|
+
if (leaf === noParens) score += 825;
|
|
149
|
+
if (`${leaf}()` === original || `${leaf}()` === cleaned) score += 820;
|
|
150
|
+
if (short.endsWith(`:${cleaned}`) || short.endsWith(`:${noParens}`) || short.endsWith(`:${noParens}()`)) score += 800;
|
|
151
|
+
if (raw.includes(cleaned)) score += 120;
|
|
152
|
+
if (short.includes(cleaned)) score += 140;
|
|
153
|
+
if (path.includes(cleaned)) score += 140;
|
|
154
|
+
if (display.includes(cleaned)) score += 110;
|
|
155
|
+
if (tokens.every((token) => {
|
|
156
|
+
const lower = token.toLowerCase();
|
|
157
|
+
return raw.includes(lower) || short.includes(lower) || path.includes(lower) || display.includes(lower);
|
|
158
|
+
})) {
|
|
159
|
+
score += 100 + tokens.length * 15;
|
|
160
|
+
}
|
|
161
|
+
if (isFunctionLikeSymbol(row.symbol) && leaf === noParens) {
|
|
162
|
+
score += 60;
|
|
163
|
+
}
|
|
164
|
+
if (!looksPathLike && isModuleLikeSymbol(row.symbol)) {
|
|
165
|
+
score -= 160;
|
|
166
|
+
}
|
|
167
|
+
score -= Math.min(50, Math.max(0, row.end_line - row.start_line));
|
|
168
|
+
return score;
|
|
169
|
+
}
|
|
105
170
|
function getCalleeRowsForSymbol(db, symbol, opts = {}) {
|
|
106
171
|
const rows = db.all(
|
|
107
172
|
`SELECT DISTINCT
|
|
@@ -147,12 +212,10 @@ function uniquePatterns(patterns) {
|
|
|
147
212
|
}
|
|
148
213
|
|
|
149
214
|
export {
|
|
150
|
-
TEST_FILE_PATTERNS,
|
|
151
215
|
TEST_SUPPORT_PATH_PATTERNS,
|
|
152
|
-
testFileMatchSql,
|
|
153
216
|
testFileExclusionSql,
|
|
154
217
|
buildFileDepGraph,
|
|
155
218
|
findFirstSymbolMatch,
|
|
156
219
|
getCalleeRowsForSymbol
|
|
157
220
|
};
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
221
|
+
//# sourceMappingURL=chunk-LLMPAG56.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
shortenSymbol
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QIXNAB5K.js";
|
|
4
4
|
|
|
5
5
|
// src/queries/surface.ts
|
|
6
6
|
function surface(db, modulePattern) {
|
|
@@ -30,4 +30,4 @@ function surface(db, modulePattern) {
|
|
|
30
30
|
export {
|
|
31
31
|
surface
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-LTJC5ZQL.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
shortenSymbol
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QIXNAB5K.js";
|
|
4
4
|
|
|
5
5
|
// src/queries/by-kind.ts
|
|
6
6
|
var KIND_NAMES = {
|
|
@@ -169,4 +169,4 @@ export {
|
|
|
169
169
|
byKind,
|
|
170
170
|
kindCounts
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
172
|
+
//# sourceMappingURL=chunk-M3NPW3FC.js.map
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TEST_FILE_PATTERNS,
|
|
3
|
-
testFileMatchSql
|
|
4
|
-
} from "./chunk-ZOGY2V3N.js";
|
|
5
1
|
import {
|
|
6
2
|
shortenSymbol
|
|
7
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QIXNAB5K.js";
|
|
8
4
|
|
|
9
5
|
// src/queries/change-surface.ts
|
|
10
6
|
function changeSurface(db, filePattern) {
|
|
@@ -25,10 +21,8 @@ function changeSurface(db, filePattern) {
|
|
|
25
21
|
ORDER BY der.start_line`,
|
|
26
22
|
doc.id
|
|
27
23
|
);
|
|
28
|
-
const testPatternSql = testFileMatchSql("ref_d", TEST_FILE_PATTERNS);
|
|
29
24
|
const symbols = [];
|
|
30
25
|
let totalExternalConsumers = 0;
|
|
31
|
-
let coveredCount = 0;
|
|
32
26
|
for (const sym of syms) {
|
|
33
27
|
const consumerRow = db.get(
|
|
34
28
|
`SELECT COUNT(DISTINCT c.document_id) AS consumer_count
|
|
@@ -41,23 +35,10 @@ function changeSurface(db, filePattern) {
|
|
|
41
35
|
doc.id
|
|
42
36
|
);
|
|
43
37
|
const externalConsumers = consumerRow?.consumer_count ?? 0;
|
|
44
|
-
const testFiles = db.all(
|
|
45
|
-
`SELECT DISTINCT ref_d.relative_path
|
|
46
|
-
FROM mentions m
|
|
47
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
48
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
49
|
-
WHERE m.symbol_id = ?
|
|
50
|
-
AND m.role != 1
|
|
51
|
-
AND (${testPatternSql})
|
|
52
|
-
ORDER BY ref_d.relative_path`,
|
|
53
|
-
sym.symbol_id
|
|
54
|
-
).map((r) => r.relative_path);
|
|
55
|
-
const hasTests = testFiles.length > 0;
|
|
56
|
-
if (hasTests) coveredCount++;
|
|
57
38
|
let riskLevel;
|
|
58
|
-
if (externalConsumers > 10
|
|
39
|
+
if (externalConsumers > 10) {
|
|
59
40
|
riskLevel = "high";
|
|
60
|
-
} else if (externalConsumers >
|
|
41
|
+
} else if (externalConsumers > 0) {
|
|
61
42
|
riskLevel = "medium";
|
|
62
43
|
} else {
|
|
63
44
|
riskLevel = "low";
|
|
@@ -69,20 +50,17 @@ function changeSurface(db, filePattern) {
|
|
|
69
50
|
startLine: sym.start_line,
|
|
70
51
|
endLine: sym.end_line,
|
|
71
52
|
externalConsumers,
|
|
72
|
-
testFiles,
|
|
73
53
|
riskLevel
|
|
74
54
|
});
|
|
75
55
|
}
|
|
76
|
-
const testCoveragePercent = symbols.length > 0 ? Math.round(coveredCount / symbols.length * 100) : 0;
|
|
77
56
|
return {
|
|
78
57
|
file: doc.relative_path,
|
|
79
58
|
symbols,
|
|
80
|
-
totalExternalConsumers
|
|
81
|
-
testCoveragePercent
|
|
59
|
+
totalExternalConsumers
|
|
82
60
|
};
|
|
83
61
|
}
|
|
84
62
|
|
|
85
63
|
export {
|
|
86
64
|
changeSurface
|
|
87
65
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-M4QGEKKD.js.map
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
2
|
staleAbstractions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ORINICIZ.js";
|
|
4
4
|
import {
|
|
5
5
|
stats
|
|
6
6
|
} from "./chunk-74RFWB5T.js";
|
|
7
|
-
import {
|
|
8
|
-
testCoverageSummary
|
|
9
|
-
} from "./chunk-HZBC7PPD.js";
|
|
10
7
|
import {
|
|
11
8
|
wrapperCandidates
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PMJKOXOT.js";
|
|
13
10
|
import {
|
|
14
11
|
passthroughCandidates
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3566TKJ5.js";
|
|
16
13
|
import {
|
|
17
14
|
similarAll
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-H6WCPKCX.js";
|
|
19
16
|
import {
|
|
20
17
|
isolated
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HMYJJ3HY.js";
|
|
22
19
|
import {
|
|
23
20
|
drift
|
|
24
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-R56FJU3E.js";
|
|
25
22
|
import {
|
|
26
23
|
extractCandidates
|
|
27
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BFLULBEU.js";
|
|
28
25
|
import {
|
|
29
26
|
complexityHotspots
|
|
30
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-WVK7AASK.js";
|
|
31
28
|
import {
|
|
32
29
|
cycles
|
|
33
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-Y3M323OX.js";
|
|
34
31
|
import {
|
|
35
32
|
dead
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6WVR5K46.js";
|
|
34
|
+
import {
|
|
35
|
+
isEntrySurface
|
|
36
|
+
} from "./chunk-VO4QI3LS.js";
|
|
37
37
|
|
|
38
38
|
// src/queries/health.ts
|
|
39
39
|
function health(db, opts = {}) {
|
|
40
40
|
const { scope } = opts;
|
|
41
41
|
const s = stats(db);
|
|
42
|
-
const deadResult = dead(db, { scope, minLoc: 3, skipBarrels:
|
|
42
|
+
const deadResult = dead(db, { scope, minLoc: 3, skipBarrels: true });
|
|
43
43
|
const isolatedResult = isolated(db, { scope, minLoc: 3 });
|
|
44
44
|
const cycleResult = cycles(db, { scope });
|
|
45
45
|
const similarResult = similarAll(db, { scope, minSimilarity: 0.6, limit: 50, minCallees: 4 });
|
|
@@ -49,20 +49,13 @@ function health(db, opts = {}) {
|
|
|
49
49
|
const staleResult = staleAbstractions(db, { scope, minLoc: 3, limit: 50 });
|
|
50
50
|
const driftResult = drift(db, { scope });
|
|
51
51
|
const complexResult = complexityHotspots(db, { scope, minLoc: 10, limit: 10 });
|
|
52
|
-
const testResult = testCoverageSummary(db, { scope, minLoc: 3 });
|
|
53
|
-
const isolatedLoc = isolatedResult.reduce((sum, r) => sum + r.loc, 0);
|
|
54
|
-
const entryPointPatterns = ["/index.ts", "/index.js", "cli.ts", "worker.ts", "postinstall.ts", "/mod.rs", "__init__.py", "main.ts", "main.rs", "main.go", "main.py"];
|
|
55
|
-
const isEntryPoint = (path) => entryPointPatterns.some((p) => path.endsWith(p));
|
|
56
52
|
const trueDeadSymbols = deadResult.symbols.filter(
|
|
57
|
-
(s2) => !
|
|
53
|
+
(s2) => !isEntrySurface(db, s2.relativePath) && s2.kind === "dead-code"
|
|
58
54
|
);
|
|
59
55
|
const trueDeadCount = trueDeadSymbols.length;
|
|
60
56
|
const trueDeadLoc = trueDeadSymbols.reduce((sum, s2) => sum + s2.loc, 0);
|
|
61
|
-
const fileInternalCount = deadResult.symbols.filter(
|
|
62
|
-
(s2) => !isEntryPoint(s2.relativePath) && s2.kind === "file-internal"
|
|
63
|
-
).length;
|
|
64
57
|
const trueIsolatedCount = isolatedResult.filter(
|
|
65
|
-
(s2) => !
|
|
58
|
+
(s2) => !isEntrySurface(db, s2.relativePath)
|
|
66
59
|
).length;
|
|
67
60
|
const filesWithFunctions = new Set(
|
|
68
61
|
db.all(
|
|
@@ -91,16 +84,6 @@ function health(db, opts = {}) {
|
|
|
91
84
|
locRecoverable: trueDeadLoc
|
|
92
85
|
});
|
|
93
86
|
}
|
|
94
|
-
if (testResult.percent < 50) {
|
|
95
|
-
actions.push({
|
|
96
|
-
category: "Test coverage",
|
|
97
|
-
description: `${testResult.percent}% of symbols referenced by tests (${testResult.uncovered} uncovered)`,
|
|
98
|
-
effort: "high",
|
|
99
|
-
impact: "high",
|
|
100
|
-
count: testResult.uncovered,
|
|
101
|
-
locRecoverable: 0
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
87
|
if (trueIsolatedCount > 0) {
|
|
105
88
|
actions.push({
|
|
106
89
|
category: "Isolated symbols",
|
|
@@ -108,7 +91,7 @@ function health(db, opts = {}) {
|
|
|
108
91
|
effort: "low",
|
|
109
92
|
impact: "medium",
|
|
110
93
|
count: trueIsolatedCount,
|
|
111
|
-
locRecoverable: isolatedResult.filter((s2) => !
|
|
94
|
+
locRecoverable: isolatedResult.filter((s2) => !isEntrySurface(db, s2.relativePath)).reduce((sum, s2) => sum + s2.loc, 0)
|
|
112
95
|
});
|
|
113
96
|
}
|
|
114
97
|
if (cycleResult.length > 0) {
|
|
@@ -219,8 +202,6 @@ function health(db, opts = {}) {
|
|
|
219
202
|
score -= Math.min(5, Math.round(driftPercent * 50));
|
|
220
203
|
const extremeComplexity = complexResult.filter((r) => r.score > 50).length;
|
|
221
204
|
score -= Math.min(5, extremeComplexity * 2);
|
|
222
|
-
const coverageDeduction = Math.round(15 * (1 - testResult.percent / 100));
|
|
223
|
-
score -= coverageDeduction;
|
|
224
205
|
score = Math.max(0, Math.min(100, score));
|
|
225
206
|
return {
|
|
226
207
|
score,
|
|
@@ -233,7 +214,7 @@ function health(db, opts = {}) {
|
|
|
233
214
|
deadSymbols: trueDeadCount,
|
|
234
215
|
deadLoc: trueDeadLoc,
|
|
235
216
|
isolatedSymbols: trueIsolatedCount,
|
|
236
|
-
isolatedLoc: isolatedResult.filter((s2) => !
|
|
217
|
+
isolatedLoc: isolatedResult.filter((s2) => !isEntrySurface(db, s2.relativePath)).reduce((sum, s2) => sum + s2.loc, 0),
|
|
237
218
|
cycles: cycleResult.length,
|
|
238
219
|
similarPairs: trueSimilarCount,
|
|
239
220
|
extractionCandidates: extractResult.length,
|
|
@@ -241,8 +222,7 @@ function health(db, opts = {}) {
|
|
|
241
222
|
passthroughs: passthroughResult.length,
|
|
242
223
|
staleTypes: trueStaleCount,
|
|
243
224
|
driftedFiles: trueDriftCount,
|
|
244
|
-
complexityHotspotCount: complexResult.length
|
|
245
|
-
testCoveragePercent: testResult.percent
|
|
225
|
+
complexityHotspotCount: complexResult.length
|
|
246
226
|
},
|
|
247
227
|
actions,
|
|
248
228
|
topComplexity: complexResult.slice(0, 5).map((r) => ({
|
|
@@ -255,4 +235,4 @@ function health(db, opts = {}) {
|
|
|
255
235
|
export {
|
|
256
236
|
health
|
|
257
237
|
};
|
|
258
|
-
//# sourceMappingURL=chunk-
|
|
238
|
+
//# sourceMappingURL=chunk-MVH45PYK.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findFirstSymbolMatch
|
|
3
|
+
} from "./chunk-LLMPAG56.js";
|
|
4
|
+
import {
|
|
5
|
+
isDirectChildSymbol,
|
|
6
|
+
leafSuffix,
|
|
7
|
+
shortenSymbol
|
|
8
|
+
} from "./chunk-QIXNAB5K.js";
|
|
9
|
+
|
|
10
|
+
// src/queries/members.ts
|
|
11
|
+
function members(db, symbolPattern) {
|
|
12
|
+
const parent = findFirstSymbolMatch(db, symbolPattern);
|
|
13
|
+
if (!parent) return [];
|
|
14
|
+
const rows = db.all(
|
|
15
|
+
`SELECT gs.symbol, der.start_line, der.end_line
|
|
16
|
+
FROM global_symbols gs
|
|
17
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
18
|
+
WHERE der.document_id = ?
|
|
19
|
+
AND gs.symbol != ?
|
|
20
|
+
${db.symbolNoiseFor("gs")}
|
|
21
|
+
ORDER BY der.start_line`,
|
|
22
|
+
parent.documentId,
|
|
23
|
+
parent.symbol
|
|
24
|
+
);
|
|
25
|
+
return rows.filter((row) => isDirectChildSymbol(parent.symbol, row.symbol)).map((row) => ({
|
|
26
|
+
symbol: row.symbol,
|
|
27
|
+
shortName: shortenSymbol(row.symbol),
|
|
28
|
+
startLine: row.start_line,
|
|
29
|
+
endLine: row.end_line,
|
|
30
|
+
kind: leafSuffix(row.symbol) ?? "unknown"
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
members
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=chunk-N4C3H7LH.js.map
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// src/reindex/install.ts
|
|
2
|
+
import { execFileSync } from "child_process";
|
|
3
|
+
import { platform } from "os";
|
|
4
|
+
var IS_WINDOWS = platform() === "win32";
|
|
5
|
+
function isBinaryAvailable(name) {
|
|
6
|
+
const cmd = IS_WINDOWS ? "where" : "which";
|
|
7
|
+
try {
|
|
8
|
+
execFileSync(cmd, [name], { stdio: "pipe" });
|
|
9
|
+
return true;
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function getBinaryCandidates(config) {
|
|
15
|
+
return [config.indexerBinary, ...config.binaryAliases ?? []];
|
|
16
|
+
}
|
|
17
|
+
function describeIndexerBinary(config) {
|
|
18
|
+
const candidates = getBinaryCandidates(config);
|
|
19
|
+
return candidates.length === 1 ? candidates[0] : candidates.join(" or ");
|
|
20
|
+
}
|
|
21
|
+
function resolveIndexerBinary(config) {
|
|
22
|
+
for (const candidate of getBinaryCandidates(config)) {
|
|
23
|
+
if (isBinaryAvailable(candidate)) {
|
|
24
|
+
return candidate;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function isIndexerInstalled(config) {
|
|
30
|
+
return resolveIndexerBinary(config) !== null;
|
|
31
|
+
}
|
|
32
|
+
function tryInstallIndexer(config, onStatus) {
|
|
33
|
+
const methods = config.installMethods;
|
|
34
|
+
const binaryLabel = describeIndexerBinary(config);
|
|
35
|
+
if (!methods?.length) {
|
|
36
|
+
onStatus(`No auto-install method available for ${binaryLabel}.`);
|
|
37
|
+
if (config.installUrl) {
|
|
38
|
+
onStatus(`Install manually from: ${config.installUrl}`);
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
for (const method of methods) {
|
|
43
|
+
if (!isBinaryAvailable(method.prerequisite)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
onStatus(`Installing ${binaryLabel} via ${method.label}...`);
|
|
47
|
+
try {
|
|
48
|
+
execFileSync(method.binary, method.args, {
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
timeout: 3e5,
|
|
51
|
+
env: process.env
|
|
52
|
+
});
|
|
53
|
+
const resolvedBinary = resolveIndexerBinary(config);
|
|
54
|
+
if (resolvedBinary) {
|
|
55
|
+
const resolutionNote = resolvedBinary === config.indexerBinary ? "" : ` (using ${resolvedBinary})`;
|
|
56
|
+
onStatus(`Successfully installed ${binaryLabel} via ${method.label}${resolutionNote}`);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
onStatus(`${method.label} command completed but ${binaryLabel} was not found on PATH`);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
62
|
+
onStatus(`${method.label} install failed: ${msg}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
onStatus(`Could not auto-install ${binaryLabel}.`);
|
|
66
|
+
if (config.installUrl) {
|
|
67
|
+
onStatus(`Install manually from: ${config.installUrl}`);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/scip-cli.ts
|
|
73
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
74
|
+
import { platform as platform2, arch } from "os";
|
|
75
|
+
var IS_WINDOWS2 = platform2() === "win32";
|
|
76
|
+
var SCIP_VERSION = "v0.7.0";
|
|
77
|
+
function isScipInstalled() {
|
|
78
|
+
try {
|
|
79
|
+
const cmd = IS_WINDOWS2 ? "where" : "which";
|
|
80
|
+
execFileSync2(cmd, ["scip"], { stdio: "pipe" });
|
|
81
|
+
return true;
|
|
82
|
+
} catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function getScipVersion() {
|
|
87
|
+
try {
|
|
88
|
+
const output = execFileSync2("scip", ["--version"], { stdio: "pipe" }).toString().trim();
|
|
89
|
+
return output;
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function getScipDownloadUrl() {
|
|
95
|
+
const os = platform2();
|
|
96
|
+
const cpu = arch();
|
|
97
|
+
let osName;
|
|
98
|
+
let archName;
|
|
99
|
+
let ext;
|
|
100
|
+
switch (os) {
|
|
101
|
+
case "darwin":
|
|
102
|
+
osName = "darwin";
|
|
103
|
+
ext = "tar.gz";
|
|
104
|
+
break;
|
|
105
|
+
case "linux":
|
|
106
|
+
osName = "linux";
|
|
107
|
+
ext = "tar.gz";
|
|
108
|
+
break;
|
|
109
|
+
case "win32":
|
|
110
|
+
osName = "windows";
|
|
111
|
+
ext = "zip";
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
switch (cpu) {
|
|
117
|
+
case "arm64":
|
|
118
|
+
archName = "arm64";
|
|
119
|
+
break;
|
|
120
|
+
case "x64":
|
|
121
|
+
archName = "amd64";
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const filename = `scip-${osName}-${archName}.${ext}`;
|
|
127
|
+
const url = `https://github.com/sourcegraph/scip/releases/download/${SCIP_VERSION}/${filename}`;
|
|
128
|
+
return { url, filename };
|
|
129
|
+
}
|
|
130
|
+
function printScipInstallInstructions() {
|
|
131
|
+
const download = getScipDownloadUrl();
|
|
132
|
+
console.log("\nThe `scip` CLI is required but not found on PATH.\n");
|
|
133
|
+
if (platform2() === "darwin") {
|
|
134
|
+
console.log("Install via Homebrew:");
|
|
135
|
+
console.log(" brew install sourcegraph/scip/scip\n");
|
|
136
|
+
console.log("Or download manually:");
|
|
137
|
+
} else {
|
|
138
|
+
console.log("Download from:");
|
|
139
|
+
}
|
|
140
|
+
if (download) {
|
|
141
|
+
console.log(` ${download.url}
|
|
142
|
+
`);
|
|
143
|
+
} else {
|
|
144
|
+
console.log(` https://github.com/sourcegraph/scip/releases/tag/${SCIP_VERSION}
|
|
145
|
+
`);
|
|
146
|
+
}
|
|
147
|
+
console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.");
|
|
148
|
+
}
|
|
149
|
+
function tryInstallScipCli(onStatus) {
|
|
150
|
+
if (platform2() === "darwin" && isBinaryAvailable("brew")) {
|
|
151
|
+
onStatus("Installing scip CLI via Homebrew...");
|
|
152
|
+
try {
|
|
153
|
+
execFileSync2("brew", ["install", "sourcegraph/scip/scip"], {
|
|
154
|
+
stdio: "inherit",
|
|
155
|
+
timeout: 3e5,
|
|
156
|
+
env: process.env
|
|
157
|
+
});
|
|
158
|
+
if (isBinaryAvailable("scip")) {
|
|
159
|
+
onStatus("Successfully installed scip CLI via Homebrew");
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
} catch (err) {
|
|
163
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
164
|
+
onStatus(`Homebrew install failed: ${msg}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (isBinaryAvailable("go")) {
|
|
168
|
+
onStatus("Installing scip CLI via go install...");
|
|
169
|
+
try {
|
|
170
|
+
execFileSync2("go", ["install", "github.com/sourcegraph/scip/cmd/scip@latest"], {
|
|
171
|
+
stdio: "inherit",
|
|
172
|
+
timeout: 3e5,
|
|
173
|
+
env: process.env
|
|
174
|
+
});
|
|
175
|
+
if (isBinaryAvailable("scip")) {
|
|
176
|
+
onStatus("Successfully installed scip CLI via go install");
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
} catch (err) {
|
|
180
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
181
|
+
onStatus(`go install failed: ${msg}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
onStatus("Could not auto-install scip CLI.");
|
|
185
|
+
onStatus("Install manually from: https://github.com/sourcegraph/scip/releases");
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
isBinaryAvailable,
|
|
191
|
+
describeIndexerBinary,
|
|
192
|
+
resolveIndexerBinary,
|
|
193
|
+
isIndexerInstalled,
|
|
194
|
+
tryInstallIndexer,
|
|
195
|
+
isScipInstalled,
|
|
196
|
+
getScipVersion,
|
|
197
|
+
printScipInstallInstructions,
|
|
198
|
+
tryInstallScipCli
|
|
199
|
+
};
|
|
200
|
+
//# sourceMappingURL=chunk-NG5F43OU.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findFirstSymbolMatch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LLMPAG56.js";
|
|
4
4
|
import {
|
|
5
5
|
shortenSymbol
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QIXNAB5K.js";
|
|
7
7
|
|
|
8
8
|
// src/queries/affected.ts
|
|
9
9
|
function affected(db, symbolPattern, opts = {}) {
|
|
@@ -62,4 +62,4 @@ function affected(db, symbolPattern, opts = {}) {
|
|
|
62
62
|
export {
|
|
63
63
|
affected
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-NVIIM34O.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
testFileExclusionSql
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LLMPAG56.js";
|
|
4
4
|
import {
|
|
5
5
|
shortenSymbol
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QIXNAB5K.js";
|
|
7
7
|
|
|
8
8
|
// src/queries/stale-abstractions.ts
|
|
9
9
|
function staleAbstractions(db, opts) {
|
|
@@ -61,4 +61,4 @@ function staleAbstractions(db, opts) {
|
|
|
61
61
|
export {
|
|
62
62
|
staleAbstractions
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-ORINICIZ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
testFileExclusionSql
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LLMPAG56.js";
|
|
4
4
|
import {
|
|
5
5
|
shortenSymbol
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QIXNAB5K.js";
|
|
7
7
|
|
|
8
8
|
// src/queries/wrapper-candidates.ts
|
|
9
9
|
function wrapperCandidates(db, opts) {
|
|
@@ -94,4 +94,4 @@ function wrapperCandidates(db, opts) {
|
|
|
94
94
|
export {
|
|
95
95
|
wrapperCandidates
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-PMJKOXOT.js.map
|