scip-query 0.3.4 → 0.4.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 +2 -26
- package/dist/{chunk-FYYOWQXK.js → chunk-2F2WH5WQ.js} +19 -36
- package/dist/{chunk-C7H5WBTJ.js → chunk-2UISVZGQ.js} +2 -2
- package/dist/{chunk-HLKAFWWJ.js → chunk-4ZT7UGWW.js} +56 -91
- package/dist/chunk-5AJJGPZE.js +60 -0
- package/dist/chunk-5RKYZSQ6.js +75 -0
- package/dist/chunk-7YBLWIXY.js +115 -0
- package/dist/{chunk-O7Q7FDUJ.js → chunk-A4GWYETB.js} +2 -2
- package/dist/{chunk-CHDJXYBG.js → chunk-A5BGEBM7.js} +2 -2
- package/dist/{chunk-KKCHYLVI.js → chunk-A7YY7IDA.js} +2 -2
- package/dist/chunk-AS7N27JK.js +115 -0
- package/dist/{chunk-F7XU27LU.js → chunk-CQRYLK33.js} +26 -2
- package/dist/{chunk-NFS5W3PP.js → chunk-CQUNEJYM.js} +2 -2
- package/dist/chunk-D4I3ZMN5.js +38 -0
- package/dist/{chunk-J3JSOSUO.js → chunk-E7J7Q7UW.js} +2 -2
- package/dist/{chunk-GEXE2T6I.js → chunk-EOHPASDV.js} +22 -14
- package/dist/chunk-FVH3Y44U.js +1 -0
- package/dist/chunk-GIBETK3W.js +37 -0
- package/dist/{chunk-SMDCNPMK.js → chunk-H3FPW5YN.js} +2 -2
- package/dist/{chunk-GJDHTTR2.js → chunk-HNURMDF4.js} +32 -17
- package/dist/{chunk-7KIMF5PV.js → chunk-HRDPUTIQ.js} +2 -2
- package/dist/{chunk-OIDHN6GD.js → chunk-I2JM34UV.js} +146 -5
- package/dist/{chunk-EPWLXXBL.js → chunk-IV6NZ426.js} +27 -29
- package/dist/{chunk-VT4JBH6L.js → chunk-KDCQJTYW.js} +2 -2
- package/dist/{chunk-5OMVSV6E.js → chunk-LOVDB4C6.js} +2 -2
- package/dist/chunk-MA3B3IUT.js +75 -0
- package/dist/{chunk-26DOJ63W.js → chunk-N2LH3M2P.js} +13 -2
- package/dist/chunk-NWCJWA36.js +162 -0
- package/dist/{chunk-NG5F43OU.js → chunk-P3VCDYMJ.js} +70 -1
- package/dist/{chunk-P3E6L7KW.js → chunk-P42KQKJZ.js} +83 -3
- package/dist/{chunk-YDBXNPYU.js → chunk-PGHN5UTM.js} +2 -2
- package/dist/{chunk-UGQKAVCD.js → chunk-QCYR4S6T.js} +2 -2
- package/dist/chunk-QGCEAVJD.js +2529 -0
- package/dist/{chunk-KBOQX573.js → chunk-RIEA5DOB.js} +19 -2
- package/dist/{chunk-VIYSWZCO.js → chunk-SL674KAW.js} +31 -3
- package/dist/chunk-SRELHCMG.js +110 -0
- package/dist/chunk-UTRKBUCB.js +87 -0
- package/dist/{chunk-HJZUSUPU.js → chunk-VCOJRQPP.js} +5 -5
- package/dist/chunk-VISMEWYP.js +34 -0
- package/dist/{chunk-LFJQVJYJ.js → chunk-VU7FDTWV.js} +2 -2
- package/dist/{chunk-HLUS2HEB.js → chunk-VUBLUTMU.js} +5 -4
- package/dist/{chunk-WGAD3GNR.js → chunk-WNPF2I25.js} +5 -5
- package/dist/{chunk-YY4QGUQ5.js → chunk-X3J4VPWM.js} +2 -2
- package/dist/{chunk-GSH2FPKV.js → chunk-XH56HXLC.js} +2 -2
- package/dist/{chunk-DH7G3DDV.js → chunk-ZU2AQQB5.js} +2 -2
- package/dist/cli.js +2722 -1036
- package/dist/{db-ShvwGDKf.d.ts → db-C4rPbKkI.d.ts} +7 -14
- package/dist/index.d.ts +4 -5
- package/dist/index.js +378 -149
- package/dist/postinstall.js +9 -3
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +2 -2
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +2 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +2 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +2 -2
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +2 -2
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +2 -2
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +2 -2
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +2 -2
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +2 -2
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +2 -2
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +2 -2
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +2 -2
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +3 -3
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +2 -2
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +2 -2
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +2 -2
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +2 -2
- 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 +13 -13
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +2 -2
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +2 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +2 -2
- package/dist/queries/index.d.ts +1 -2
- package/dist/queries/index.js +49 -53
- package/dist/queries/isolated.d.ts +3 -4
- package/dist/queries/isolated.js +3 -3
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +2 -2
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +2 -1
- 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 +2 -2
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +3 -3
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +2 -2
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +2 -2
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +2 -2
- package/dist/queries/similar-signatures.d.ts +5 -3
- package/dist/queries/similar-signatures.js +2 -1
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +2 -2
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +2 -2
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +2 -2
- 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 +2 -2
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +2 -2
- package/dist/reindex-worker.js +213 -62
- package/package.json +1 -1
- package/skills/scip-language-playbook/SKILL.md +371 -0
- package/dist/chunk-2UELLEBI.js +0 -1
- package/dist/chunk-4JCSOF2O.js +0 -97
- package/dist/chunk-AXQKUYKF.js +0 -1442
- package/dist/chunk-CPVAQJEC.js +0 -46
- package/dist/chunk-EOROMIFO.js +0 -41
- package/dist/chunk-GU2H5QRN.js +0 -28
- package/dist/chunk-LQJUPXQY.js +0 -109
- package/dist/chunk-MPGIHELS.js +0 -39
- package/dist/chunk-P4WO3BBW.js +0 -64
- package/dist/chunk-TOIEB3LG.js +0 -78
- package/dist/chunk-UQEQ6AHX.js +0 -60
- package/dist/chunk-VJJKSGIX.js +0 -121
- package/dist/chunk-YZ6L7GFO.js +0 -73
- package/dist/chunk-ZEUCXQBN.js +0 -71
- package/dist/queries/doc-coverage.d.ts +0 -14
- package/dist/queries/doc-coverage.js +0 -8
package/dist/index.js
CHANGED
|
@@ -1,148 +1,145 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-FVH3Y44U.js";
|
|
2
2
|
import {
|
|
3
3
|
surface
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MA3B3IUT.js";
|
|
5
5
|
import {
|
|
6
6
|
symbols
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-D4I3ZMN5.js";
|
|
8
8
|
import {
|
|
9
9
|
system
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A4GWYETB.js";
|
|
11
11
|
import {
|
|
12
12
|
trace
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EOHPASDV.js";
|
|
14
14
|
import {
|
|
15
15
|
redundantReexports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-P42KQKJZ.js";
|
|
17
17
|
import {
|
|
18
18
|
refs
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-7YBLWIXY.js";
|
|
20
20
|
import {
|
|
21
21
|
similarChains
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WNPF2I25.js";
|
|
23
23
|
import {
|
|
24
24
|
similarFiles
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-VUBLUTMU.js";
|
|
26
26
|
import {
|
|
27
27
|
similarSignatures
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-NWCJWA36.js";
|
|
29
29
|
import {
|
|
30
30
|
slice
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import {
|
|
33
|
-
hierarchy
|
|
34
|
-
} from "./chunk-YDBXNPYU.js";
|
|
31
|
+
} from "./chunk-A5BGEBM7.js";
|
|
35
32
|
import {
|
|
36
33
|
hotspots
|
|
37
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-RIEA5DOB.js";
|
|
38
35
|
import {
|
|
39
36
|
importedBy,
|
|
40
37
|
imports,
|
|
41
38
|
unusedImports
|
|
42
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-N2LH3M2P.js";
|
|
43
40
|
import {
|
|
44
41
|
members
|
|
45
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-CQUNEJYM.js";
|
|
46
43
|
import {
|
|
47
44
|
methods
|
|
48
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-GIBETK3W.js";
|
|
49
46
|
import {
|
|
50
47
|
outline
|
|
51
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-LOVDB4C6.js";
|
|
52
49
|
import {
|
|
53
50
|
deps,
|
|
54
51
|
rdeps
|
|
55
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-KDCQJTYW.js";
|
|
56
53
|
import {
|
|
57
54
|
diffImpact
|
|
58
55
|
} from "./chunk-7HK5ZLOE.js";
|
|
59
|
-
import {
|
|
60
|
-
docCoverage
|
|
61
|
-
} from "./chunk-YZ6L7GFO.js";
|
|
62
56
|
import {
|
|
63
57
|
fanIn,
|
|
64
58
|
fanOut,
|
|
65
59
|
topFanIn,
|
|
66
60
|
topFanOut
|
|
67
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-HNURMDF4.js";
|
|
68
62
|
import {
|
|
69
63
|
files
|
|
70
64
|
} from "./chunk-MGNMHKX3.js";
|
|
71
65
|
import {
|
|
72
66
|
health
|
|
73
|
-
} from "./chunk-
|
|
74
|
-
import {
|
|
75
|
-
staleAbstractions
|
|
76
|
-
} from "./chunk-P4WO3BBW.js";
|
|
67
|
+
} from "./chunk-2F2WH5WQ.js";
|
|
77
68
|
import {
|
|
78
69
|
stats
|
|
79
70
|
} from "./chunk-74RFWB5T.js";
|
|
80
71
|
import {
|
|
81
72
|
wrapperCandidates
|
|
82
|
-
} from "./chunk-
|
|
83
|
-
import {
|
|
84
|
-
passthroughCandidates
|
|
85
|
-
} from "./chunk-ZEUCXQBN.js";
|
|
73
|
+
} from "./chunk-AS7N27JK.js";
|
|
86
74
|
import {
|
|
87
75
|
similar,
|
|
88
76
|
similarAll
|
|
89
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-I2JM34UV.js";
|
|
78
|
+
import {
|
|
79
|
+
staleAbstractions
|
|
80
|
+
} from "./chunk-5RKYZSQ6.js";
|
|
90
81
|
import {
|
|
91
82
|
isolated
|
|
92
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-VISMEWYP.js";
|
|
84
|
+
import {
|
|
85
|
+
passthroughCandidates
|
|
86
|
+
} from "./chunk-5AJJGPZE.js";
|
|
93
87
|
import {
|
|
94
88
|
drift
|
|
95
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-HRDPUTIQ.js";
|
|
96
90
|
import {
|
|
97
91
|
extractCandidates
|
|
98
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-IV6NZ426.js";
|
|
93
|
+
import {
|
|
94
|
+
hierarchy
|
|
95
|
+
} from "./chunk-PGHN5UTM.js";
|
|
99
96
|
import {
|
|
100
97
|
complexityHotspots
|
|
101
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-SL674KAW.js";
|
|
102
99
|
import {
|
|
103
100
|
complexity
|
|
104
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-QCYR4S6T.js";
|
|
105
102
|
import {
|
|
106
103
|
convergence
|
|
107
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-VCOJRQPP.js";
|
|
108
105
|
import {
|
|
109
106
|
coupling,
|
|
110
107
|
topCoupling
|
|
111
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-A7YY7IDA.js";
|
|
112
109
|
import {
|
|
113
110
|
cycles
|
|
114
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-VU7FDTWV.js";
|
|
115
112
|
import {
|
|
116
113
|
dataflow
|
|
117
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-XH56HXLC.js";
|
|
118
115
|
import {
|
|
119
116
|
dead
|
|
120
|
-
} from "./chunk-
|
|
121
|
-
import "./chunk-
|
|
117
|
+
} from "./chunk-SRELHCMG.js";
|
|
118
|
+
import "./chunk-X3J4VPWM.js";
|
|
122
119
|
import {
|
|
123
120
|
deepChains
|
|
124
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-ZU2AQQB5.js";
|
|
125
122
|
import {
|
|
126
123
|
affected
|
|
127
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-UTRKBUCB.js";
|
|
128
125
|
import {
|
|
129
126
|
bottlenecks
|
|
130
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-CQRYLK33.js";
|
|
131
128
|
import {
|
|
132
129
|
byKind,
|
|
133
130
|
kindCounts
|
|
134
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-4ZT7UGWW.js";
|
|
135
132
|
import {
|
|
136
133
|
callGraph
|
|
137
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-2UISVZGQ.js";
|
|
138
135
|
import {
|
|
139
136
|
changeSurface
|
|
140
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-H3FPW5YN.js";
|
|
141
138
|
import "./chunk-4TYLS5XX.js";
|
|
142
139
|
import {
|
|
143
140
|
code
|
|
144
|
-
} from "./chunk-
|
|
145
|
-
import "./chunk-
|
|
141
|
+
} from "./chunk-E7J7Q7UW.js";
|
|
142
|
+
import "./chunk-QGCEAVJD.js";
|
|
146
143
|
import {
|
|
147
144
|
leafName,
|
|
148
145
|
parseSymbol,
|
|
@@ -184,12 +181,23 @@ var ScipDatabase = class {
|
|
|
184
181
|
* that need SQL-level filtering, use excludedPathPatterns().
|
|
185
182
|
*/
|
|
186
183
|
get localSymbolPredicate() {
|
|
187
|
-
return `
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
return `(
|
|
185
|
+
EXISTS (
|
|
186
|
+
SELECT 1
|
|
187
|
+
FROM defn_enclosing_ranges local_der
|
|
188
|
+
JOIN documents local_d ON local_der.document_id = local_d.id
|
|
189
|
+
WHERE local_der.symbol_id = gs.id
|
|
190
|
+
${this.pathExclusionsFor("local_d").trimStart()}
|
|
191
|
+
)
|
|
192
|
+
OR EXISTS (
|
|
193
|
+
SELECT 1
|
|
194
|
+
FROM mentions local_m
|
|
195
|
+
JOIN chunks local_c ON local_m.chunk_id = local_c.id
|
|
196
|
+
JOIN documents local_d ON local_c.document_id = local_d.id
|
|
197
|
+
WHERE local_m.symbol_id = gs.id
|
|
198
|
+
AND local_m.role = 1
|
|
199
|
+
${this.pathExclusionsFor("local_d").trimStart()}
|
|
200
|
+
)
|
|
193
201
|
)`;
|
|
194
202
|
}
|
|
195
203
|
/**
|
|
@@ -347,8 +355,8 @@ Thumbs.db
|
|
|
347
355
|
|
|
348
356
|
// src/reindex/index.ts
|
|
349
357
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
350
|
-
import { existsSync as
|
|
351
|
-
import { join as
|
|
358
|
+
import { existsSync as existsSync5, renameSync } from "fs";
|
|
359
|
+
import { join as join5 } from "path";
|
|
352
360
|
|
|
353
361
|
// src/scip-cli.ts
|
|
354
362
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -356,7 +364,9 @@ import { platform as platform2, arch } from "os";
|
|
|
356
364
|
|
|
357
365
|
// src/reindex/install.ts
|
|
358
366
|
import { execFileSync } from "child_process";
|
|
367
|
+
import { existsSync as existsSync2 } from "fs";
|
|
359
368
|
import { platform } from "os";
|
|
369
|
+
import { join as join2 } from "path";
|
|
360
370
|
var IS_WINDOWS = platform() === "win32";
|
|
361
371
|
function isBinaryAvailable(name) {
|
|
362
372
|
const cmd = IS_WINDOWS ? "where" : "which";
|
|
@@ -385,6 +395,31 @@ function resolveIndexerBinary(config) {
|
|
|
385
395
|
function isIndexerInstalled(config) {
|
|
386
396
|
return resolveIndexerBinary(config) !== null;
|
|
387
397
|
}
|
|
398
|
+
function resolveProjectLocalIndexerBinary(config, projectRoot) {
|
|
399
|
+
for (const relativePath of config.projectLocalBinaries ?? []) {
|
|
400
|
+
const candidate = join2(projectRoot, relativePath);
|
|
401
|
+
if (existsSync2(candidate)) {
|
|
402
|
+
return candidate;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
function getIndexerExecutionEnv(config, baseEnv = process.env, binary = config.indexerBinary) {
|
|
408
|
+
if (config.indexerBinary !== "scip-dotnet") {
|
|
409
|
+
return baseEnv;
|
|
410
|
+
}
|
|
411
|
+
if (canRunDotnetIndexer(binary, baseEnv)) {
|
|
412
|
+
return baseEnv;
|
|
413
|
+
}
|
|
414
|
+
const dotnetRoot = resolveWorkingDotnetRoot(binary, baseEnv);
|
|
415
|
+
if (!dotnetRoot) {
|
|
416
|
+
return baseEnv;
|
|
417
|
+
}
|
|
418
|
+
return {
|
|
419
|
+
...baseEnv,
|
|
420
|
+
DOTNET_ROOT: dotnetRoot
|
|
421
|
+
};
|
|
422
|
+
}
|
|
388
423
|
function tryInstallIndexer(config, onStatus) {
|
|
389
424
|
const methods2 = config.installMethods;
|
|
390
425
|
const binaryLabel = describeIndexerBinary(config);
|
|
@@ -424,6 +459,46 @@ function tryInstallIndexer(config, onStatus) {
|
|
|
424
459
|
}
|
|
425
460
|
return false;
|
|
426
461
|
}
|
|
462
|
+
function resolveWorkingDotnetRoot(binary, env) {
|
|
463
|
+
for (const dotnetRoot of getDotnetRootCandidates(env)) {
|
|
464
|
+
if (canRunDotnetIndexer(binary, { ...env, DOTNET_ROOT: dotnetRoot })) {
|
|
465
|
+
return dotnetRoot;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
function getDotnetRootCandidates(env) {
|
|
471
|
+
const candidates = [];
|
|
472
|
+
const configured = env["DOTNET_ROOT"];
|
|
473
|
+
if (configured && existsSync2(configured)) {
|
|
474
|
+
candidates.push(configured);
|
|
475
|
+
}
|
|
476
|
+
if (platform() === "darwin" && isBinaryAvailable("brew")) {
|
|
477
|
+
try {
|
|
478
|
+
const prefix = execFileSync("brew", ["--prefix", "dotnet@9"], {
|
|
479
|
+
stdio: "pipe",
|
|
480
|
+
env
|
|
481
|
+
}).toString().trim();
|
|
482
|
+
const candidate = join2(prefix, "libexec");
|
|
483
|
+
if (existsSync2(candidate) && !candidates.includes(candidate)) {
|
|
484
|
+
candidates.push(candidate);
|
|
485
|
+
}
|
|
486
|
+
} catch {
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return candidates;
|
|
490
|
+
}
|
|
491
|
+
function canRunDotnetIndexer(binary, env) {
|
|
492
|
+
try {
|
|
493
|
+
execFileSync(binary, ["--version"], {
|
|
494
|
+
stdio: "pipe",
|
|
495
|
+
env
|
|
496
|
+
});
|
|
497
|
+
return true;
|
|
498
|
+
} catch {
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
427
502
|
|
|
428
503
|
// src/scip-cli.ts
|
|
429
504
|
var IS_WINDOWS2 = platform2() === "win32";
|
|
@@ -541,46 +616,151 @@ function tryInstallScipCli(onStatus) {
|
|
|
541
616
|
}
|
|
542
617
|
|
|
543
618
|
// src/reindex/detect.ts
|
|
544
|
-
import { existsSync as
|
|
545
|
-
import { join as
|
|
619
|
+
import { existsSync as existsSync3, readdirSync } from "fs";
|
|
620
|
+
import { extname, join as join3 } from "path";
|
|
621
|
+
var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
622
|
+
".git",
|
|
623
|
+
".hg",
|
|
624
|
+
".svn",
|
|
625
|
+
".idea",
|
|
626
|
+
".vscode",
|
|
627
|
+
"node_modules",
|
|
628
|
+
"vendor",
|
|
629
|
+
"dist",
|
|
630
|
+
"build",
|
|
631
|
+
"target",
|
|
632
|
+
"bin",
|
|
633
|
+
"obj",
|
|
634
|
+
".dart_tool",
|
|
635
|
+
".gradle",
|
|
636
|
+
".next",
|
|
637
|
+
".venv",
|
|
638
|
+
"venv",
|
|
639
|
+
"__pycache__"
|
|
640
|
+
]);
|
|
546
641
|
var LANGUAGE_MARKERS = [
|
|
547
|
-
{ language: "typescript", files: ["tsconfig.json", "tsconfig.base.json"] },
|
|
548
|
-
{ language: "rust", files: ["Cargo.toml"] },
|
|
549
|
-
{ language: "go", files: ["go.mod"] },
|
|
550
|
-
{ language: "java", files: ["pom.xml", "build.gradle", "build.gradle.kts"] },
|
|
551
|
-
{ language: "kotlin", files: ["build.gradle.kts"] },
|
|
552
|
-
{ language: "scala", files: ["build.sbt"] },
|
|
553
|
-
{ language: "python", files: ["pyproject.toml", "setup.py", "setup.cfg", "Pipfile"] },
|
|
554
|
-
{ language: "ruby", files: ["Gemfile"] },
|
|
555
|
-
{ language: "
|
|
556
|
-
{ language: "
|
|
557
|
-
{ language: "
|
|
558
|
-
{ language: "
|
|
559
|
-
|
|
642
|
+
{ language: "typescript", files: ["tsconfig.json", "tsconfig.base.json"], extensions: [".ts", ".tsx", ".mts", ".cts"] },
|
|
643
|
+
{ language: "rust", files: ["Cargo.toml"], extensions: [".rs"] },
|
|
644
|
+
{ language: "go", files: ["go.mod"], extensions: [".go"] },
|
|
645
|
+
{ language: "java", files: ["pom.xml", "build.gradle", "build.gradle.kts"], extensions: [".java"] },
|
|
646
|
+
{ language: "kotlin", files: ["build.gradle.kts"], extensions: [".kt", ".kts"] },
|
|
647
|
+
{ language: "scala", files: ["build.sbt"], extensions: [".scala"] },
|
|
648
|
+
{ language: "python", files: ["pyproject.toml", "setup.py", "setup.cfg", "Pipfile"], extensions: [".py", ".pyi"] },
|
|
649
|
+
{ language: "ruby", files: ["Gemfile"], extensions: [".rb"] },
|
|
650
|
+
{ language: "cpp", files: ["compile_commands.json", "CMakeLists.txt", "Makefile"], extensions: [".cc", ".cpp", ".cxx", ".hpp", ".hh", ".hxx"] },
|
|
651
|
+
{ language: "c", files: ["compile_commands.json", "CMakeLists.txt", "Makefile"], extensions: [".c", ".h"] },
|
|
652
|
+
{ language: "csharp", globs: ["*.csproj", "*.sln"], extensions: [".cs"] },
|
|
653
|
+
{ language: "vb", globs: ["*.vbproj"], extensions: [".vb"] },
|
|
654
|
+
{ language: "dart", files: ["pubspec.yaml"], extensions: [".dart"] },
|
|
655
|
+
{ language: "php", files: ["composer.json"], extensions: [".php"] },
|
|
656
|
+
{ language: "javascript", files: ["package.json"], extensions: [".js", ".jsx", ".mjs", ".cjs"] }
|
|
657
|
+
// Last — very common
|
|
560
658
|
];
|
|
561
659
|
function detectLanguages(projectRoot) {
|
|
562
660
|
const detected = [];
|
|
661
|
+
const rootEntries = safeReadDir(projectRoot);
|
|
662
|
+
const extensionSet = collectExtensions(projectRoot);
|
|
563
663
|
for (const marker of LANGUAGE_MARKERS) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
664
|
+
if (hasMarkerFile(projectRoot, marker.files)) {
|
|
665
|
+
detected.push(marker.language);
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
if (matchesRootGlob(rootEntries, marker.globs)) {
|
|
669
|
+
detected.push(marker.language);
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
if (hasExtension(extensionSet, marker.extensions)) {
|
|
673
|
+
detected.push(marker.language);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (detected.includes("typescript")) {
|
|
677
|
+
removeLanguage(detected, "javascript");
|
|
678
|
+
}
|
|
679
|
+
if (detected.includes("cpp") && !extensionSet.has(".c")) {
|
|
680
|
+
removeLanguage(detected, "c");
|
|
681
|
+
}
|
|
682
|
+
return detected;
|
|
683
|
+
}
|
|
684
|
+
function safeReadDir(projectRoot) {
|
|
685
|
+
try {
|
|
686
|
+
return readdirSync(projectRoot);
|
|
687
|
+
} catch {
|
|
688
|
+
return [];
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function hasMarkerFile(projectRoot, files2) {
|
|
692
|
+
if (!files2?.length) {
|
|
693
|
+
return false;
|
|
694
|
+
}
|
|
695
|
+
return files2.some((file) => existsSync3(join3(projectRoot, file)));
|
|
696
|
+
}
|
|
697
|
+
function matchesRootGlob(entries, globs) {
|
|
698
|
+
if (!globs?.length) {
|
|
699
|
+
return false;
|
|
700
|
+
}
|
|
701
|
+
return entries.some((entry) => globs.some((glob) => matchesSimpleGlob(entry, glob)));
|
|
702
|
+
}
|
|
703
|
+
function matchesSimpleGlob(entry, pattern) {
|
|
704
|
+
if (pattern === "*") {
|
|
705
|
+
return true;
|
|
706
|
+
}
|
|
707
|
+
if (!pattern.includes("*")) {
|
|
708
|
+
return entry === pattern;
|
|
709
|
+
}
|
|
710
|
+
const [prefix, suffix] = pattern.split("*");
|
|
711
|
+
return entry.startsWith(prefix ?? "") && entry.endsWith(suffix ?? "");
|
|
712
|
+
}
|
|
713
|
+
function collectExtensions(projectRoot) {
|
|
714
|
+
const found = /* @__PURE__ */ new Set();
|
|
715
|
+
const stack = [projectRoot];
|
|
716
|
+
while (stack.length > 0) {
|
|
717
|
+
const current = stack.pop();
|
|
718
|
+
if (!current) {
|
|
719
|
+
continue;
|
|
720
|
+
}
|
|
721
|
+
let entries;
|
|
722
|
+
try {
|
|
723
|
+
entries = readdirSync(current, { withFileTypes: true });
|
|
724
|
+
} catch {
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
for (const entry of entries) {
|
|
728
|
+
if (entry.name.startsWith(".") && !entry.name.endsWith("proj") && !entry.name.endsWith("sln")) {
|
|
729
|
+
if (entry.isDirectory()) {
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
567
732
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
733
|
+
const fullPath = join3(current, entry.name);
|
|
734
|
+
if (entry.isDirectory()) {
|
|
735
|
+
if (!IGNORED_DIRS.has(entry.name)) {
|
|
736
|
+
stack.push(fullPath);
|
|
571
737
|
}
|
|
572
|
-
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
const extension = extname(entry.name).toLowerCase();
|
|
741
|
+
if (extension) {
|
|
742
|
+
found.add(extension);
|
|
573
743
|
}
|
|
574
744
|
}
|
|
575
745
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
746
|
+
return found;
|
|
747
|
+
}
|
|
748
|
+
function hasExtension(extensionSet, extensions) {
|
|
749
|
+
if (!extensions?.length) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
return extensions.some((extension) => extensionSet.has(extension));
|
|
753
|
+
}
|
|
754
|
+
function removeLanguage(detected, language) {
|
|
755
|
+
const index = detected.indexOf(language);
|
|
756
|
+
if (index !== -1) {
|
|
757
|
+
detected.splice(index, 1);
|
|
579
758
|
}
|
|
580
|
-
return detected;
|
|
581
759
|
}
|
|
582
760
|
|
|
583
761
|
// src/reindex/indexers.ts
|
|
762
|
+
import { existsSync as existsSync4, readdirSync as readdirSync2 } from "fs";
|
|
763
|
+
import { join as join4 } from "path";
|
|
584
764
|
var INDEXER_CONFIGS = {
|
|
585
765
|
typescript: {
|
|
586
766
|
language: "typescript",
|
|
@@ -620,9 +800,7 @@ var INDEXER_CONFIGS = {
|
|
|
620
800
|
args: ["index", "--output", outputPath]
|
|
621
801
|
}),
|
|
622
802
|
markerFiles: ["pom.xml", "build.gradle"],
|
|
623
|
-
installMethods: [
|
|
624
|
-
{ label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
|
|
625
|
-
],
|
|
803
|
+
installMethods: [],
|
|
626
804
|
installUrl: "https://github.com/sourcegraph/scip-java/releases"
|
|
627
805
|
},
|
|
628
806
|
scala: {
|
|
@@ -634,9 +812,7 @@ var INDEXER_CONFIGS = {
|
|
|
634
812
|
args: ["index", "--output", outputPath]
|
|
635
813
|
}),
|
|
636
814
|
markerFiles: ["build.sbt"],
|
|
637
|
-
installMethods: [
|
|
638
|
-
{ label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
|
|
639
|
-
],
|
|
815
|
+
installMethods: [],
|
|
640
816
|
installUrl: "https://github.com/sourcegraph/scip-java/releases"
|
|
641
817
|
},
|
|
642
818
|
kotlin: {
|
|
@@ -648,9 +824,7 @@ var INDEXER_CONFIGS = {
|
|
|
648
824
|
args: ["index", "--output", outputPath]
|
|
649
825
|
}),
|
|
650
826
|
markerFiles: ["build.gradle.kts"],
|
|
651
|
-
installMethods: [
|
|
652
|
-
{ label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
|
|
653
|
-
],
|
|
827
|
+
installMethods: [],
|
|
654
828
|
installUrl: "https://github.com/sourcegraph/scip-java/releases"
|
|
655
829
|
},
|
|
656
830
|
rust: {
|
|
@@ -686,10 +860,11 @@ var INDEXER_CONFIGS = {
|
|
|
686
860
|
language: "ruby",
|
|
687
861
|
indexerBinary: "scip-ruby",
|
|
688
862
|
checkCommand: "scip-ruby --version",
|
|
689
|
-
indexArgs: ({
|
|
690
|
-
binary:
|
|
691
|
-
args: ["--
|
|
863
|
+
indexArgs: ({ indexerBinary }) => ({
|
|
864
|
+
binary: indexerBinary,
|
|
865
|
+
args: ["--dir", "."]
|
|
692
866
|
}),
|
|
867
|
+
defaultOutputPath: "index.scip",
|
|
693
868
|
markerFiles: ["Gemfile"],
|
|
694
869
|
installMethods: [],
|
|
695
870
|
installUrl: "https://github.com/sourcegraph/scip-ruby/releases"
|
|
@@ -714,7 +889,7 @@ var INDEXER_CONFIGS = {
|
|
|
714
889
|
checkCommand: "scip-clang --version",
|
|
715
890
|
indexArgs: ({ outputPath }) => ({
|
|
716
891
|
binary: "scip-clang",
|
|
717
|
-
args: ["--output", outputPath]
|
|
892
|
+
args: ["--compdb-path", "compile_commands.json", "--index-output-path", outputPath]
|
|
718
893
|
}),
|
|
719
894
|
markerFiles: ["CMakeLists.txt", "Makefile"],
|
|
720
895
|
installMethods: [],
|
|
@@ -726,7 +901,7 @@ var INDEXER_CONFIGS = {
|
|
|
726
901
|
checkCommand: "scip-clang --version",
|
|
727
902
|
indexArgs: ({ outputPath }) => ({
|
|
728
903
|
binary: "scip-clang",
|
|
729
|
-
args: ["--output", outputPath]
|
|
904
|
+
args: ["--compdb-path", "compile_commands.json", "--index-output-path", outputPath]
|
|
730
905
|
}),
|
|
731
906
|
markerFiles: ["CMakeLists.txt", "Makefile"],
|
|
732
907
|
installMethods: [],
|
|
@@ -736,11 +911,25 @@ var INDEXER_CONFIGS = {
|
|
|
736
911
|
language: "csharp",
|
|
737
912
|
indexerBinary: "scip-dotnet",
|
|
738
913
|
checkCommand: "scip-dotnet --version",
|
|
739
|
-
indexArgs: ({ outputPath }) => ({
|
|
914
|
+
indexArgs: ({ projectRoot, outputPath }) => ({
|
|
740
915
|
binary: "scip-dotnet",
|
|
741
|
-
args: ["index", "--output", outputPath]
|
|
916
|
+
args: ["index", resolveDotnetProject(projectRoot, [".sln", ".csproj"]) ?? projectRoot, "--output", outputPath, "--working-directory", projectRoot]
|
|
917
|
+
}),
|
|
918
|
+
markerFiles: ["*.csproj", "*.sln"],
|
|
919
|
+
installMethods: [
|
|
920
|
+
{ label: "dotnet", prerequisite: "dotnet", binary: "dotnet", args: ["tool", "install", "--global", "scip-dotnet"] }
|
|
921
|
+
],
|
|
922
|
+
installUrl: "https://github.com/sourcegraph/scip-dotnet/releases"
|
|
923
|
+
},
|
|
924
|
+
vb: {
|
|
925
|
+
language: "vb",
|
|
926
|
+
indexerBinary: "scip-dotnet",
|
|
927
|
+
checkCommand: "scip-dotnet --version",
|
|
928
|
+
indexArgs: ({ projectRoot, outputPath }) => ({
|
|
929
|
+
binary: "scip-dotnet",
|
|
930
|
+
args: ["index", resolveDotnetProject(projectRoot, [".sln", ".vbproj"]) ?? projectRoot, "--output", outputPath, "--working-directory", projectRoot]
|
|
742
931
|
}),
|
|
743
|
-
markerFiles: [],
|
|
932
|
+
markerFiles: ["*.vbproj", "*.sln"],
|
|
744
933
|
installMethods: [
|
|
745
934
|
{ label: "dotnet", prerequisite: "dotnet", binary: "dotnet", args: ["tool", "install", "--global", "scip-dotnet"] }
|
|
746
935
|
],
|
|
@@ -750,9 +939,9 @@ var INDEXER_CONFIGS = {
|
|
|
750
939
|
language: "dart",
|
|
751
940
|
indexerBinary: "scip-dart",
|
|
752
941
|
checkCommand: "scip-dart --version",
|
|
753
|
-
indexArgs: ({ outputPath }) => ({
|
|
754
|
-
binary:
|
|
755
|
-
args: ["
|
|
942
|
+
indexArgs: ({ indexerBinary, outputPath }) => ({
|
|
943
|
+
binary: indexerBinary,
|
|
944
|
+
args: ["--output", outputPath]
|
|
756
945
|
}),
|
|
757
946
|
markerFiles: ["pubspec.yaml"],
|
|
758
947
|
installMethods: [
|
|
@@ -763,21 +952,44 @@ var INDEXER_CONFIGS = {
|
|
|
763
952
|
php: {
|
|
764
953
|
language: "php",
|
|
765
954
|
indexerBinary: "scip-php",
|
|
955
|
+
projectLocalBinaries: ["vendor/davidrjenni/scip-php/bin/scip-php", "vendor/bin/scip-php"],
|
|
766
956
|
checkCommand: "scip-php --version",
|
|
767
|
-
indexArgs: ({
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
957
|
+
indexArgs: ({ projectRoot, indexerBinary }) => {
|
|
958
|
+
const localBinary = join4(projectRoot, "vendor", "bin", "scip-php");
|
|
959
|
+
const nestedLocalBinary = join4(projectRoot, "vendor", "davidrjenni", "scip-php", "bin", "scip-php");
|
|
960
|
+
const targetBinary = existsSync4(nestedLocalBinary) ? nestedLocalBinary : existsSync4(localBinary) ? localBinary : indexerBinary;
|
|
961
|
+
return {
|
|
962
|
+
binary: "php",
|
|
963
|
+
args: [
|
|
964
|
+
"-d",
|
|
965
|
+
"error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",
|
|
966
|
+
targetBinary
|
|
967
|
+
]
|
|
968
|
+
};
|
|
969
|
+
},
|
|
970
|
+
defaultOutputPath: "index.scip",
|
|
771
971
|
markerFiles: ["composer.json"],
|
|
772
|
-
installMethods: [
|
|
773
|
-
{ label: "composer", prerequisite: "composer", binary: "composer", args: ["global", "require", "davidrjenni/scip-php"] }
|
|
774
|
-
],
|
|
972
|
+
installMethods: [],
|
|
775
973
|
installUrl: "https://github.com/davidrjenni/scip-php/releases"
|
|
776
974
|
}
|
|
777
975
|
};
|
|
778
976
|
function getIndexerConfig(language) {
|
|
779
977
|
return INDEXER_CONFIGS[language];
|
|
780
978
|
}
|
|
979
|
+
function resolveDotnetProject(projectRoot, suffixes) {
|
|
980
|
+
let entries;
|
|
981
|
+
try {
|
|
982
|
+
entries = readdirSync2(projectRoot);
|
|
983
|
+
} catch {
|
|
984
|
+
return null;
|
|
985
|
+
}
|
|
986
|
+
for (const entry of entries) {
|
|
987
|
+
if (suffixes.some((suffix) => entry.endsWith(suffix))) {
|
|
988
|
+
return join4(projectRoot, entry);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
781
993
|
|
|
782
994
|
// src/reindex/index.ts
|
|
783
995
|
async function reindex(opts) {
|
|
@@ -787,8 +999,8 @@ async function reindex(opts) {
|
|
|
787
999
|
onStatus = console.log,
|
|
788
1000
|
skipAutoInstall = false
|
|
789
1001
|
} = opts;
|
|
790
|
-
const outputScip = opts.outputScip ??
|
|
791
|
-
const outputDb = opts.outputDb ??
|
|
1002
|
+
const outputScip = opts.outputScip ?? join5(projectRoot, "index.scip");
|
|
1003
|
+
const outputDb = opts.outputDb ?? join5(projectRoot, "index.db");
|
|
792
1004
|
const start = Date.now();
|
|
793
1005
|
const languages = opts.languages ?? detectLanguages(projectRoot);
|
|
794
1006
|
if (languages.length === 0) {
|
|
@@ -817,7 +1029,8 @@ async function reindex(opts) {
|
|
|
817
1029
|
for (const lang of languages) {
|
|
818
1030
|
const config = getIndexerConfig(lang);
|
|
819
1031
|
const binaryLabel = describeIndexerBinary(config);
|
|
820
|
-
|
|
1032
|
+
const projectLocalBinary = resolveProjectLocalIndexerBinary(config, projectRoot);
|
|
1033
|
+
if (!projectLocalBinary && !isIndexerInstalled(config)) {
|
|
821
1034
|
if (skipAutoInstall) {
|
|
822
1035
|
throw new Error(
|
|
823
1036
|
`${binaryLabel} is required to index ${lang} but not found on PATH.
|
|
@@ -832,7 +1045,7 @@ async function reindex(opts) {
|
|
|
832
1045
|
);
|
|
833
1046
|
}
|
|
834
1047
|
}
|
|
835
|
-
const resolvedBinary = resolveIndexerBinary(config);
|
|
1048
|
+
const resolvedBinary = projectLocalBinary ?? resolveIndexerBinary(config);
|
|
836
1049
|
if (!resolvedBinary) {
|
|
837
1050
|
throw new Error(
|
|
838
1051
|
`${binaryLabel} is required to index ${lang} but was not found on PATH after installation checks.
|
|
@@ -840,6 +1053,7 @@ async function reindex(opts) {
|
|
|
840
1053
|
);
|
|
841
1054
|
}
|
|
842
1055
|
onStatus(`Indexing ${lang} with ${resolvedBinary}...`);
|
|
1056
|
+
const indexerEnv = getIndexerExecutionEnv(config, env, resolvedBinary);
|
|
843
1057
|
const { binary, args } = config.indexArgs({
|
|
844
1058
|
projectRoot,
|
|
845
1059
|
outputPath: outputScip,
|
|
@@ -849,7 +1063,7 @@ async function reindex(opts) {
|
|
|
849
1063
|
try {
|
|
850
1064
|
execFileSync3(binary, args, {
|
|
851
1065
|
cwd: projectRoot,
|
|
852
|
-
env,
|
|
1066
|
+
env: indexerEnv,
|
|
853
1067
|
stdio: "pipe",
|
|
854
1068
|
maxBuffer: 50 * 1024 * 1024
|
|
855
1069
|
});
|
|
@@ -860,9 +1074,10 @@ async function reindex(opts) {
|
|
|
860
1074
|
Make sure ${binaryLabel} is installed and available on PATH.`
|
|
861
1075
|
);
|
|
862
1076
|
}
|
|
1077
|
+
moveDefaultOutputIfNeeded(config, projectRoot, outputScip);
|
|
863
1078
|
}
|
|
864
1079
|
onStatus("Converting to SQLite...");
|
|
865
|
-
if (!
|
|
1080
|
+
if (!existsSync5(outputScip)) {
|
|
866
1081
|
throw new Error(`SCIP index not found at ${outputScip} after indexing`);
|
|
867
1082
|
}
|
|
868
1083
|
try {
|
|
@@ -879,10 +1094,19 @@ Make sure ${binaryLabel} is installed and available on PATH.`
|
|
|
879
1094
|
onStatus(`Done in ${(durationMs / 1e3).toFixed(1)}s`);
|
|
880
1095
|
return { languages, indexPath: outputScip, dbPath: outputDb, durationMs };
|
|
881
1096
|
}
|
|
1097
|
+
function moveDefaultOutputIfNeeded(config, projectRoot, outputScip) {
|
|
1098
|
+
if (!config.defaultOutputPath) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
const defaultOutputPath = join5(projectRoot, config.defaultOutputPath);
|
|
1102
|
+
if (outputScip !== defaultOutputPath && existsSync5(defaultOutputPath)) {
|
|
1103
|
+
renameSync(defaultOutputPath, outputScip);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
882
1106
|
|
|
883
1107
|
// src/config.ts
|
|
884
|
-
import { readFileSync as readFileSync2, writeFileSync, existsSync as
|
|
885
|
-
import { join as
|
|
1108
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync6, mkdirSync } from "fs";
|
|
1109
|
+
import { join as join6, resolve } from "path";
|
|
886
1110
|
import { createHash } from "crypto";
|
|
887
1111
|
import { homedir } from "os";
|
|
888
1112
|
var CONFIG_FILENAME = ".scipquery.json";
|
|
@@ -893,8 +1117,8 @@ var DEFAULT_WATCH = {
|
|
|
893
1117
|
ignore: []
|
|
894
1118
|
};
|
|
895
1119
|
function loadProjectConfig(projectRoot) {
|
|
896
|
-
const configPath =
|
|
897
|
-
if (!
|
|
1120
|
+
const configPath = join6(projectRoot, CONFIG_FILENAME);
|
|
1121
|
+
if (!existsSync6(configPath)) {
|
|
898
1122
|
return {};
|
|
899
1123
|
}
|
|
900
1124
|
try {
|
|
@@ -915,23 +1139,23 @@ function resolveCacheDir(projectRoot, config) {
|
|
|
915
1139
|
if (envOverride) return ensureDir(envOverride);
|
|
916
1140
|
if (config?.dbPath) return ensureDir(resolve(projectRoot, config.dbPath));
|
|
917
1141
|
const xdgCache = process.env["XDG_CACHE_HOME"];
|
|
918
|
-
const cacheBase = xdgCache ||
|
|
1142
|
+
const cacheBase = xdgCache || join6(homedir(), ".cache");
|
|
919
1143
|
const projectHash = createHash("sha256").update(resolve(projectRoot)).digest("hex").slice(0, 12);
|
|
920
|
-
const dir =
|
|
1144
|
+
const dir = join6(cacheBase, "scip-query", "projects", projectHash);
|
|
921
1145
|
return ensureDir(dir);
|
|
922
1146
|
}
|
|
923
1147
|
function resolveIndexPaths(projectRoot, config) {
|
|
924
1148
|
const cacheDir = resolveCacheDir(projectRoot, config);
|
|
925
1149
|
return {
|
|
926
1150
|
cacheDir,
|
|
927
|
-
dbPath:
|
|
928
|
-
indexPath:
|
|
929
|
-
metaPath:
|
|
1151
|
+
dbPath: join6(cacheDir, "index.db"),
|
|
1152
|
+
indexPath: join6(cacheDir, "index.scip"),
|
|
1153
|
+
metaPath: join6(cacheDir, "meta.json")
|
|
930
1154
|
};
|
|
931
1155
|
}
|
|
932
1156
|
function initProjectConfig(projectRoot, languages) {
|
|
933
|
-
const configPath =
|
|
934
|
-
if (
|
|
1157
|
+
const configPath = join6(projectRoot, CONFIG_FILENAME);
|
|
1158
|
+
if (existsSync6(configPath)) {
|
|
935
1159
|
return configPath;
|
|
936
1160
|
}
|
|
937
1161
|
const config = {
|
|
@@ -952,8 +1176,8 @@ function ensureDir(dir) {
|
|
|
952
1176
|
|
|
953
1177
|
// src/watch.ts
|
|
954
1178
|
import { watch } from "fs";
|
|
955
|
-
import { existsSync as
|
|
956
|
-
import { join as
|
|
1179
|
+
import { existsSync as existsSync7, renameSync as renameSync2 } from "fs";
|
|
1180
|
+
import { join as join7, relative } from "path";
|
|
957
1181
|
import { fork } from "child_process";
|
|
958
1182
|
import ignore2 from "ignore";
|
|
959
1183
|
var Watcher = class {
|
|
@@ -1031,7 +1255,7 @@ var Watcher = class {
|
|
|
1031
1255
|
}
|
|
1032
1256
|
// ── Internal ─────────────────────────────────────────────
|
|
1033
1257
|
handleFileChange(filename) {
|
|
1034
|
-
const rel = relative(this.projectRoot,
|
|
1258
|
+
const rel = relative(this.projectRoot, join7(this.projectRoot, filename));
|
|
1035
1259
|
if (this.gitignoreFilter.isIgnored(rel)) return;
|
|
1036
1260
|
if (this.extraIgnore.ignores(rel)) return;
|
|
1037
1261
|
if (filename.endsWith("index.db") || filename.endsWith("index.scip") || filename.endsWith("index.db.tmp") || filename.endsWith(".scipquery.json")) {
|
|
@@ -1134,11 +1358,11 @@ var Watcher = class {
|
|
|
1134
1358
|
child.on("exit", (code2) => {
|
|
1135
1359
|
if (code2 === 0) {
|
|
1136
1360
|
try {
|
|
1137
|
-
if (
|
|
1138
|
-
|
|
1361
|
+
if (existsSync7(tmpDb)) {
|
|
1362
|
+
renameSync2(tmpDb, this.indexPaths.dbPath);
|
|
1139
1363
|
}
|
|
1140
|
-
if (
|
|
1141
|
-
|
|
1364
|
+
if (existsSync7(tmpScip)) {
|
|
1365
|
+
renameSync2(tmpScip, this.indexPaths.indexPath);
|
|
1142
1366
|
}
|
|
1143
1367
|
resolve3(Date.now() - start);
|
|
1144
1368
|
} catch (err) {
|
|
@@ -1162,25 +1386,31 @@ function tempScipPath(indexPath) {
|
|
|
1162
1386
|
|
|
1163
1387
|
// src/setup.ts
|
|
1164
1388
|
import {
|
|
1165
|
-
existsSync as
|
|
1389
|
+
existsSync as existsSync8,
|
|
1166
1390
|
mkdirSync as mkdirSync2,
|
|
1167
1391
|
symlinkSync,
|
|
1168
1392
|
readlinkSync,
|
|
1169
1393
|
unlinkSync
|
|
1170
1394
|
} from "fs";
|
|
1171
|
-
import { join as
|
|
1395
|
+
import { join as join8, dirname as dirname2, resolve as resolve2 } from "path";
|
|
1172
1396
|
import { homedir as homedir2, platform as platform3 } from "os";
|
|
1173
1397
|
import { fileURLToPath } from "url";
|
|
1174
1398
|
var IS_WINDOWS3 = platform3() === "win32";
|
|
1175
|
-
var
|
|
1399
|
+
var BUILTIN_SKILLS = [
|
|
1400
|
+
"concrete-plan",
|
|
1401
|
+
"scip-explore",
|
|
1402
|
+
"scip-debloat",
|
|
1403
|
+
"scip-verify",
|
|
1404
|
+
"scip-language-playbook"
|
|
1405
|
+
];
|
|
1176
1406
|
function installSkills(opts = {}) {
|
|
1177
1407
|
const log = opts.quiet ? () => {
|
|
1178
1408
|
} : console.log;
|
|
1179
1409
|
const thisFile = fileURLToPath(import.meta.url);
|
|
1180
1410
|
const skillsSource = resolve2(dirname2(thisFile), "..", "skills");
|
|
1181
1411
|
const targets = [
|
|
1182
|
-
|
|
1183
|
-
|
|
1412
|
+
join8(homedir2(), ".claude", "skills"),
|
|
1413
|
+
join8(homedir2(), ".codex", "skills")
|
|
1184
1414
|
];
|
|
1185
1415
|
const result = {
|
|
1186
1416
|
installed: [],
|
|
@@ -1189,19 +1419,19 @@ function installSkills(opts = {}) {
|
|
|
1189
1419
|
};
|
|
1190
1420
|
for (const targetDir of targets) {
|
|
1191
1421
|
const parentDir = dirname2(targetDir);
|
|
1192
|
-
if (!
|
|
1422
|
+
if (!existsSync8(parentDir)) {
|
|
1193
1423
|
continue;
|
|
1194
1424
|
}
|
|
1195
1425
|
mkdirSync2(targetDir, { recursive: true });
|
|
1196
1426
|
const toolName = targetDir.includes(".codex") ? "Codex" : "Claude";
|
|
1197
|
-
for (const skill of
|
|
1198
|
-
const source =
|
|
1199
|
-
const target =
|
|
1200
|
-
if (!
|
|
1427
|
+
for (const skill of BUILTIN_SKILLS) {
|
|
1428
|
+
const source = join8(skillsSource, skill);
|
|
1429
|
+
const target = join8(targetDir, skill);
|
|
1430
|
+
if (!existsSync8(source)) {
|
|
1201
1431
|
result.skipped.push(`${toolName}/${skill}`);
|
|
1202
1432
|
continue;
|
|
1203
1433
|
}
|
|
1204
|
-
if (
|
|
1434
|
+
if (existsSync8(target)) {
|
|
1205
1435
|
try {
|
|
1206
1436
|
const existing = readlinkSync(target);
|
|
1207
1437
|
if (resolve2(existing) === resolve2(source)) {
|
|
@@ -1245,7 +1475,6 @@ export {
|
|
|
1245
1475
|
deps,
|
|
1246
1476
|
detectLanguages,
|
|
1247
1477
|
diffImpact,
|
|
1248
|
-
docCoverage,
|
|
1249
1478
|
drift,
|
|
1250
1479
|
extractCandidates,
|
|
1251
1480
|
fanIn,
|