scip-query 0.3.5 → 0.4.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 +2 -1
- package/dist/{chunk-VMM4SYV4.js → chunk-24LF6IZB.js} +17 -4
- package/dist/{chunk-EPWLXXBL.js → chunk-3NJSJ7TE.js} +28 -30
- package/dist/{chunk-SMDCNPMK.js → chunk-43A4UCS7.js} +3 -3
- package/dist/{chunk-CHDJXYBG.js → chunk-5GCORUNV.js} +3 -3
- package/dist/{chunk-OIDHN6GD.js → chunk-6CH23IAS.js} +148 -7
- package/dist/chunk-6ECR2FLR.js +60 -0
- package/dist/{chunk-C7H5WBTJ.js → chunk-6UZU7DFL.js} +3 -3
- package/dist/chunk-7BS4CPJX.js +162 -0
- package/dist/{chunk-UGQKAVCD.js → chunk-A6XLXV6W.js} +3 -3
- package/dist/chunk-ALUFWH3U.js +2695 -0
- package/dist/{chunk-F7XU27LU.js → chunk-CBIWNZZZ.js} +27 -3
- package/dist/{chunk-26DOJ63W.js → chunk-DUJNJQPO.js} +14 -3
- package/dist/{chunk-GSH2FPKV.js → chunk-EAGKJFDX.js} +3 -3
- package/dist/{chunk-VIYSWZCO.js → chunk-ELFGD5EW.js} +32 -4
- package/dist/chunk-FVJE4MQL.js +37 -0
- package/dist/{chunk-NFS5W3PP.js → chunk-GNAMV3JC.js} +3 -3
- package/dist/{chunk-TRESG7OB.js → chunk-J47VSL6I.js} +3 -3
- package/dist/chunk-J6QXMYAQ.js +115 -0
- package/dist/{chunk-6FKIA6EI.js → chunk-JHVQB4Y5.js} +12 -12
- package/dist/{chunk-YY4QGUQ5.js → chunk-JKXHHV4B.js} +2 -2
- package/dist/{chunk-EN2Z2CLO.js → chunk-KG4OFQEN.js} +17 -20
- package/dist/chunk-KLNKDX6A.js +110 -0
- package/dist/{chunk-5OMVSV6E.js → chunk-KYPXKV64.js} +3 -3
- package/dist/chunk-NXUIWD6K.js +87 -0
- package/dist/{chunk-LFJQVJYJ.js → chunk-OXX3QF24.js} +2 -2
- package/dist/{chunk-NG5F43OU.js → chunk-P3VCDYMJ.js} +70 -1
- package/dist/{chunk-7HK5ZLOE.js → chunk-PCU455MX.js} +2 -2
- package/dist/{chunk-O7Q7FDUJ.js → chunk-POLELLNM.js} +3 -3
- package/dist/chunk-PU2254N2.js +115 -0
- package/dist/{chunk-WGAD3GNR.js → chunk-QMXSLHZP.js} +5 -5
- package/dist/{chunk-YDBXNPYU.js → chunk-R7HPHMRZ.js} +3 -3
- package/dist/{chunk-HLUS2HEB.js → chunk-RE7POFGI.js} +5 -4
- package/dist/{chunk-VT4JBH6L.js → chunk-RJ5GULL6.js} +2 -2
- package/dist/{chunk-7KIMF5PV.js → chunk-RL74LF47.js} +2 -2
- package/dist/chunk-SVLUJSY7.js +75 -0
- package/dist/chunk-SYQR4QGK.js +38 -0
- package/dist/{chunk-QIXNAB5K.js → chunk-TO3L4YNK.js} +1 -2
- package/dist/{chunk-P3E6L7KW.js → chunk-TWVXFKJA.js} +84 -4
- package/dist/chunk-UJWI5CBB.js +75 -0
- package/dist/{chunk-J3JSOSUO.js → chunk-VKBOLNYN.js} +3 -3
- package/dist/{chunk-KBOQX573.js → chunk-VY2L4TP6.js} +20 -3
- package/dist/{chunk-KKCHYLVI.js → chunk-W46L2BXT.js} +2 -2
- package/dist/chunk-XUVPQDXW.js +34 -0
- package/dist/{chunk-DH7G3DDV.js → chunk-Z5VSUOEE.js} +2 -2
- package/dist/{chunk-GEXE2T6I.js → chunk-ZVZAIIB5.js} +23 -15
- package/dist/cli.js +2838 -870
- package/dist/{db-viWlyVtv.d.ts → db-C4rPbKkI.d.ts} +6 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +376 -142
- package/dist/postinstall.js +9 -3
- 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 +3 -2
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +3 -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 +1 -1
- package/dist/queries/change-surface.js +3 -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/coupling.js +3 -3
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +3 -3
- 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 -4
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +3 -3
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +3 -3
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +2 -2
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +3 -3
- 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 +3 -3
- 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 -3
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +3 -2
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +3 -3
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +44 -44
- package/dist/queries/isolated.d.ts +3 -4
- package/dist/queries/isolated.js +4 -4
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +3 -3
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +3 -2
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +3 -3
- 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 -4
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +3 -3
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +3 -3
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +3 -3
- package/dist/queries/similar-signatures.d.ts +5 -3
- package/dist/queries/similar-signatures.js +3 -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 +3 -3
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +3 -3
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +3 -3
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +3 -3
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +3 -3
- package/dist/reindex-worker.js +216 -64
- package/package.json +5 -1
- package/skills/scip-language-playbook/SKILL.md +371 -0
- 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-TOIEB3LG.js +0 -78
- package/dist/chunk-UQEQ6AHX.js +0 -60
- package/dist/chunk-VJJKSGIX.js +0 -121
- package/dist/chunk-YGGFLMTM.js +0 -83
- package/dist/chunk-ZEUCXQBN.js +0 -71
package/dist/index.js
CHANGED
|
@@ -1,150 +1,150 @@
|
|
|
1
1
|
import "./chunk-FVH3Y44U.js";
|
|
2
2
|
import {
|
|
3
3
|
surface
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UJWI5CBB.js";
|
|
5
5
|
import {
|
|
6
6
|
symbols
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SYQR4QGK.js";
|
|
8
8
|
import {
|
|
9
9
|
system
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-POLELLNM.js";
|
|
11
11
|
import {
|
|
12
12
|
trace
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZVZAIIB5.js";
|
|
14
14
|
import {
|
|
15
15
|
redundantReexports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TWVXFKJA.js";
|
|
17
17
|
import {
|
|
18
18
|
refs
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-J6QXMYAQ.js";
|
|
20
20
|
import {
|
|
21
21
|
similarChains
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QMXSLHZP.js";
|
|
23
23
|
import {
|
|
24
24
|
similarFiles
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RE7POFGI.js";
|
|
26
26
|
import {
|
|
27
27
|
similarSignatures
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-7BS4CPJX.js";
|
|
29
29
|
import {
|
|
30
30
|
slice
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5GCORUNV.js";
|
|
32
32
|
import {
|
|
33
33
|
hotspots
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-VY2L4TP6.js";
|
|
35
35
|
import {
|
|
36
36
|
importedBy,
|
|
37
37
|
imports,
|
|
38
38
|
unusedImports
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-DUJNJQPO.js";
|
|
40
40
|
import {
|
|
41
41
|
members
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-GNAMV3JC.js";
|
|
43
43
|
import {
|
|
44
44
|
methods
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-FVJE4MQL.js";
|
|
46
46
|
import {
|
|
47
47
|
outline
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-KYPXKV64.js";
|
|
49
49
|
import {
|
|
50
50
|
deps,
|
|
51
51
|
rdeps
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-RJ5GULL6.js";
|
|
53
53
|
import {
|
|
54
54
|
diffImpact
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-PCU455MX.js";
|
|
56
56
|
import {
|
|
57
57
|
fanIn,
|
|
58
58
|
fanOut,
|
|
59
59
|
topFanIn,
|
|
60
60
|
topFanOut
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-24LF6IZB.js";
|
|
62
62
|
import {
|
|
63
63
|
files
|
|
64
64
|
} from "./chunk-MGNMHKX3.js";
|
|
65
65
|
import {
|
|
66
66
|
health
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-JHVQB4Y5.js";
|
|
68
68
|
import {
|
|
69
69
|
stats
|
|
70
70
|
} from "./chunk-74RFWB5T.js";
|
|
71
71
|
import {
|
|
72
72
|
wrapperCandidates
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-PU2254N2.js";
|
|
74
74
|
import {
|
|
75
75
|
similar,
|
|
76
76
|
similarAll
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-6CH23IAS.js";
|
|
78
78
|
import {
|
|
79
79
|
staleAbstractions
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-SVLUJSY7.js";
|
|
81
81
|
import {
|
|
82
82
|
isolated
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-XUVPQDXW.js";
|
|
84
84
|
import {
|
|
85
85
|
passthroughCandidates
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-6ECR2FLR.js";
|
|
87
87
|
import {
|
|
88
88
|
drift
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-RL74LF47.js";
|
|
90
90
|
import {
|
|
91
91
|
extractCandidates
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-3NJSJ7TE.js";
|
|
93
93
|
import {
|
|
94
94
|
hierarchy
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-R7HPHMRZ.js";
|
|
96
96
|
import {
|
|
97
97
|
complexityHotspots
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-ELFGD5EW.js";
|
|
99
99
|
import {
|
|
100
100
|
complexity
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-A6XLXV6W.js";
|
|
102
102
|
import {
|
|
103
103
|
convergence
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-J47VSL6I.js";
|
|
105
105
|
import {
|
|
106
106
|
coupling,
|
|
107
107
|
topCoupling
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-W46L2BXT.js";
|
|
109
109
|
import {
|
|
110
110
|
cycles
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-OXX3QF24.js";
|
|
112
112
|
import {
|
|
113
113
|
dataflow
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-EAGKJFDX.js";
|
|
115
115
|
import {
|
|
116
116
|
dead
|
|
117
|
-
} from "./chunk-
|
|
118
|
-
import "./chunk-
|
|
117
|
+
} from "./chunk-KLNKDX6A.js";
|
|
118
|
+
import "./chunk-JKXHHV4B.js";
|
|
119
119
|
import {
|
|
120
120
|
deepChains
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-Z5VSUOEE.js";
|
|
122
122
|
import {
|
|
123
123
|
affected
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-NXUIWD6K.js";
|
|
125
125
|
import {
|
|
126
126
|
bottlenecks
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-CBIWNZZZ.js";
|
|
128
128
|
import {
|
|
129
129
|
byKind,
|
|
130
130
|
kindCounts
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-KG4OFQEN.js";
|
|
132
132
|
import {
|
|
133
133
|
callGraph
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-6UZU7DFL.js";
|
|
135
135
|
import {
|
|
136
136
|
changeSurface
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-43A4UCS7.js";
|
|
138
138
|
import "./chunk-4TYLS5XX.js";
|
|
139
139
|
import {
|
|
140
140
|
code
|
|
141
|
-
} from "./chunk-
|
|
142
|
-
import "./chunk-
|
|
141
|
+
} from "./chunk-VKBOLNYN.js";
|
|
142
|
+
import "./chunk-ALUFWH3U.js";
|
|
143
143
|
import {
|
|
144
144
|
leafName,
|
|
145
145
|
parseSymbol,
|
|
146
146
|
shortenSymbol
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-TO3L4YNK.js";
|
|
148
148
|
|
|
149
149
|
// src/db.ts
|
|
150
150
|
import Database from "better-sqlite3";
|
|
@@ -181,12 +181,23 @@ var ScipDatabase = class {
|
|
|
181
181
|
* that need SQL-level filtering, use excludedPathPatterns().
|
|
182
182
|
*/
|
|
183
183
|
get localSymbolPredicate() {
|
|
184
|
-
return `
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
+
)
|
|
190
201
|
)`;
|
|
191
202
|
}
|
|
192
203
|
/**
|
|
@@ -344,8 +355,8 @@ Thumbs.db
|
|
|
344
355
|
|
|
345
356
|
// src/reindex/index.ts
|
|
346
357
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
347
|
-
import { existsSync as
|
|
348
|
-
import { join as
|
|
358
|
+
import { existsSync as existsSync5, renameSync } from "fs";
|
|
359
|
+
import { join as join5 } from "path";
|
|
349
360
|
|
|
350
361
|
// src/scip-cli.ts
|
|
351
362
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -353,7 +364,9 @@ import { platform as platform2, arch } from "os";
|
|
|
353
364
|
|
|
354
365
|
// src/reindex/install.ts
|
|
355
366
|
import { execFileSync } from "child_process";
|
|
367
|
+
import { existsSync as existsSync2 } from "fs";
|
|
356
368
|
import { platform } from "os";
|
|
369
|
+
import { join as join2 } from "path";
|
|
357
370
|
var IS_WINDOWS = platform() === "win32";
|
|
358
371
|
function isBinaryAvailable(name) {
|
|
359
372
|
const cmd = IS_WINDOWS ? "where" : "which";
|
|
@@ -382,6 +395,31 @@ function resolveIndexerBinary(config) {
|
|
|
382
395
|
function isIndexerInstalled(config) {
|
|
383
396
|
return resolveIndexerBinary(config) !== null;
|
|
384
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
|
+
}
|
|
385
423
|
function tryInstallIndexer(config, onStatus) {
|
|
386
424
|
const methods2 = config.installMethods;
|
|
387
425
|
const binaryLabel = describeIndexerBinary(config);
|
|
@@ -421,6 +459,46 @@ function tryInstallIndexer(config, onStatus) {
|
|
|
421
459
|
}
|
|
422
460
|
return false;
|
|
423
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
|
+
}
|
|
424
502
|
|
|
425
503
|
// src/scip-cli.ts
|
|
426
504
|
var IS_WINDOWS2 = platform2() === "win32";
|
|
@@ -538,46 +616,151 @@ function tryInstallScipCli(onStatus) {
|
|
|
538
616
|
}
|
|
539
617
|
|
|
540
618
|
// src/reindex/detect.ts
|
|
541
|
-
import { existsSync as
|
|
542
|
-
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
|
+
]);
|
|
543
641
|
var LANGUAGE_MARKERS = [
|
|
544
|
-
{ language: "typescript", files: ["tsconfig.json", "tsconfig.base.json"] },
|
|
545
|
-
{ language: "rust", files: ["Cargo.toml"] },
|
|
546
|
-
{ language: "go", files: ["go.mod"] },
|
|
547
|
-
{ language: "java", files: ["pom.xml", "build.gradle", "build.gradle.kts"] },
|
|
548
|
-
{ language: "kotlin", files: ["build.gradle.kts"] },
|
|
549
|
-
{ language: "scala", files: ["build.sbt"] },
|
|
550
|
-
{ language: "python", files: ["pyproject.toml", "setup.py", "setup.cfg", "Pipfile"] },
|
|
551
|
-
{ language: "ruby", files: ["Gemfile"] },
|
|
552
|
-
{ language: "
|
|
553
|
-
{ language: "
|
|
554
|
-
{ language: "
|
|
555
|
-
{ language: "
|
|
556
|
-
|
|
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
|
|
557
658
|
];
|
|
558
659
|
function detectLanguages(projectRoot) {
|
|
559
660
|
const detected = [];
|
|
661
|
+
const rootEntries = safeReadDir(projectRoot);
|
|
662
|
+
const extensionSet = collectExtensions(projectRoot);
|
|
560
663
|
for (const marker of LANGUAGE_MARKERS) {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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
|
+
}
|
|
564
732
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
733
|
+
const fullPath = join3(current, entry.name);
|
|
734
|
+
if (entry.isDirectory()) {
|
|
735
|
+
if (!IGNORED_DIRS.has(entry.name)) {
|
|
736
|
+
stack.push(fullPath);
|
|
568
737
|
}
|
|
569
|
-
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
const extension = extname(entry.name).toLowerCase();
|
|
741
|
+
if (extension) {
|
|
742
|
+
found.add(extension);
|
|
570
743
|
}
|
|
571
744
|
}
|
|
572
745
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
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);
|
|
576
758
|
}
|
|
577
|
-
return detected;
|
|
578
759
|
}
|
|
579
760
|
|
|
580
761
|
// src/reindex/indexers.ts
|
|
762
|
+
import { existsSync as existsSync4, readdirSync as readdirSync2 } from "fs";
|
|
763
|
+
import { join as join4 } from "path";
|
|
581
764
|
var INDEXER_CONFIGS = {
|
|
582
765
|
typescript: {
|
|
583
766
|
language: "typescript",
|
|
@@ -617,9 +800,7 @@ var INDEXER_CONFIGS = {
|
|
|
617
800
|
args: ["index", "--output", outputPath]
|
|
618
801
|
}),
|
|
619
802
|
markerFiles: ["pom.xml", "build.gradle"],
|
|
620
|
-
installMethods: [
|
|
621
|
-
{ label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
|
|
622
|
-
],
|
|
803
|
+
installMethods: [],
|
|
623
804
|
installUrl: "https://github.com/sourcegraph/scip-java/releases"
|
|
624
805
|
},
|
|
625
806
|
scala: {
|
|
@@ -631,9 +812,7 @@ var INDEXER_CONFIGS = {
|
|
|
631
812
|
args: ["index", "--output", outputPath]
|
|
632
813
|
}),
|
|
633
814
|
markerFiles: ["build.sbt"],
|
|
634
|
-
installMethods: [
|
|
635
|
-
{ label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
|
|
636
|
-
],
|
|
815
|
+
installMethods: [],
|
|
637
816
|
installUrl: "https://github.com/sourcegraph/scip-java/releases"
|
|
638
817
|
},
|
|
639
818
|
kotlin: {
|
|
@@ -645,9 +824,7 @@ var INDEXER_CONFIGS = {
|
|
|
645
824
|
args: ["index", "--output", outputPath]
|
|
646
825
|
}),
|
|
647
826
|
markerFiles: ["build.gradle.kts"],
|
|
648
|
-
installMethods: [
|
|
649
|
-
{ label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
|
|
650
|
-
],
|
|
827
|
+
installMethods: [],
|
|
651
828
|
installUrl: "https://github.com/sourcegraph/scip-java/releases"
|
|
652
829
|
},
|
|
653
830
|
rust: {
|
|
@@ -683,10 +860,11 @@ var INDEXER_CONFIGS = {
|
|
|
683
860
|
language: "ruby",
|
|
684
861
|
indexerBinary: "scip-ruby",
|
|
685
862
|
checkCommand: "scip-ruby --version",
|
|
686
|
-
indexArgs: ({
|
|
687
|
-
binary:
|
|
688
|
-
args: ["--
|
|
863
|
+
indexArgs: ({ indexerBinary }) => ({
|
|
864
|
+
binary: indexerBinary,
|
|
865
|
+
args: ["--dir", "."]
|
|
689
866
|
}),
|
|
867
|
+
defaultOutputPath: "index.scip",
|
|
690
868
|
markerFiles: ["Gemfile"],
|
|
691
869
|
installMethods: [],
|
|
692
870
|
installUrl: "https://github.com/sourcegraph/scip-ruby/releases"
|
|
@@ -711,7 +889,7 @@ var INDEXER_CONFIGS = {
|
|
|
711
889
|
checkCommand: "scip-clang --version",
|
|
712
890
|
indexArgs: ({ outputPath }) => ({
|
|
713
891
|
binary: "scip-clang",
|
|
714
|
-
args: ["--output", outputPath]
|
|
892
|
+
args: ["--compdb-path", "compile_commands.json", "--index-output-path", outputPath]
|
|
715
893
|
}),
|
|
716
894
|
markerFiles: ["CMakeLists.txt", "Makefile"],
|
|
717
895
|
installMethods: [],
|
|
@@ -723,7 +901,7 @@ var INDEXER_CONFIGS = {
|
|
|
723
901
|
checkCommand: "scip-clang --version",
|
|
724
902
|
indexArgs: ({ outputPath }) => ({
|
|
725
903
|
binary: "scip-clang",
|
|
726
|
-
args: ["--output", outputPath]
|
|
904
|
+
args: ["--compdb-path", "compile_commands.json", "--index-output-path", outputPath]
|
|
727
905
|
}),
|
|
728
906
|
markerFiles: ["CMakeLists.txt", "Makefile"],
|
|
729
907
|
installMethods: [],
|
|
@@ -733,11 +911,25 @@ var INDEXER_CONFIGS = {
|
|
|
733
911
|
language: "csharp",
|
|
734
912
|
indexerBinary: "scip-dotnet",
|
|
735
913
|
checkCommand: "scip-dotnet --version",
|
|
736
|
-
indexArgs: ({ outputPath }) => ({
|
|
914
|
+
indexArgs: ({ projectRoot, outputPath }) => ({
|
|
737
915
|
binary: "scip-dotnet",
|
|
738
|
-
args: ["index", "--output", outputPath]
|
|
916
|
+
args: ["index", resolveDotnetProject(projectRoot, [".sln", ".csproj"]) ?? projectRoot, "--output", outputPath, "--working-directory", projectRoot]
|
|
739
917
|
}),
|
|
740
|
-
markerFiles: [],
|
|
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]
|
|
931
|
+
}),
|
|
932
|
+
markerFiles: ["*.vbproj", "*.sln"],
|
|
741
933
|
installMethods: [
|
|
742
934
|
{ label: "dotnet", prerequisite: "dotnet", binary: "dotnet", args: ["tool", "install", "--global", "scip-dotnet"] }
|
|
743
935
|
],
|
|
@@ -747,9 +939,9 @@ var INDEXER_CONFIGS = {
|
|
|
747
939
|
language: "dart",
|
|
748
940
|
indexerBinary: "scip-dart",
|
|
749
941
|
checkCommand: "scip-dart --version",
|
|
750
|
-
indexArgs: ({ outputPath }) => ({
|
|
751
|
-
binary:
|
|
752
|
-
args: ["
|
|
942
|
+
indexArgs: ({ indexerBinary, outputPath }) => ({
|
|
943
|
+
binary: indexerBinary,
|
|
944
|
+
args: ["--output", outputPath]
|
|
753
945
|
}),
|
|
754
946
|
markerFiles: ["pubspec.yaml"],
|
|
755
947
|
installMethods: [
|
|
@@ -760,21 +952,44 @@ var INDEXER_CONFIGS = {
|
|
|
760
952
|
php: {
|
|
761
953
|
language: "php",
|
|
762
954
|
indexerBinary: "scip-php",
|
|
955
|
+
projectLocalBinaries: ["vendor/davidrjenni/scip-php/bin/scip-php", "vendor/bin/scip-php"],
|
|
763
956
|
checkCommand: "scip-php --version",
|
|
764
|
-
indexArgs: ({
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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",
|
|
768
971
|
markerFiles: ["composer.json"],
|
|
769
|
-
installMethods: [
|
|
770
|
-
{ label: "composer", prerequisite: "composer", binary: "composer", args: ["global", "require", "davidrjenni/scip-php"] }
|
|
771
|
-
],
|
|
972
|
+
installMethods: [],
|
|
772
973
|
installUrl: "https://github.com/davidrjenni/scip-php/releases"
|
|
773
974
|
}
|
|
774
975
|
};
|
|
775
976
|
function getIndexerConfig(language) {
|
|
776
977
|
return INDEXER_CONFIGS[language];
|
|
777
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
|
+
}
|
|
778
993
|
|
|
779
994
|
// src/reindex/index.ts
|
|
780
995
|
async function reindex(opts) {
|
|
@@ -784,8 +999,8 @@ async function reindex(opts) {
|
|
|
784
999
|
onStatus = console.log,
|
|
785
1000
|
skipAutoInstall = false
|
|
786
1001
|
} = opts;
|
|
787
|
-
const outputScip = opts.outputScip ??
|
|
788
|
-
const outputDb = opts.outputDb ??
|
|
1002
|
+
const outputScip = opts.outputScip ?? join5(projectRoot, "index.scip");
|
|
1003
|
+
const outputDb = opts.outputDb ?? join5(projectRoot, "index.db");
|
|
789
1004
|
const start = Date.now();
|
|
790
1005
|
const languages = opts.languages ?? detectLanguages(projectRoot);
|
|
791
1006
|
if (languages.length === 0) {
|
|
@@ -814,7 +1029,8 @@ async function reindex(opts) {
|
|
|
814
1029
|
for (const lang of languages) {
|
|
815
1030
|
const config = getIndexerConfig(lang);
|
|
816
1031
|
const binaryLabel = describeIndexerBinary(config);
|
|
817
|
-
|
|
1032
|
+
const projectLocalBinary = resolveProjectLocalIndexerBinary(config, projectRoot);
|
|
1033
|
+
if (!projectLocalBinary && !isIndexerInstalled(config)) {
|
|
818
1034
|
if (skipAutoInstall) {
|
|
819
1035
|
throw new Error(
|
|
820
1036
|
`${binaryLabel} is required to index ${lang} but not found on PATH.
|
|
@@ -829,7 +1045,7 @@ async function reindex(opts) {
|
|
|
829
1045
|
);
|
|
830
1046
|
}
|
|
831
1047
|
}
|
|
832
|
-
const resolvedBinary = resolveIndexerBinary(config);
|
|
1048
|
+
const resolvedBinary = projectLocalBinary ?? resolveIndexerBinary(config);
|
|
833
1049
|
if (!resolvedBinary) {
|
|
834
1050
|
throw new Error(
|
|
835
1051
|
`${binaryLabel} is required to index ${lang} but was not found on PATH after installation checks.
|
|
@@ -837,6 +1053,7 @@ async function reindex(opts) {
|
|
|
837
1053
|
);
|
|
838
1054
|
}
|
|
839
1055
|
onStatus(`Indexing ${lang} with ${resolvedBinary}...`);
|
|
1056
|
+
const indexerEnv = getIndexerExecutionEnv(config, env, resolvedBinary);
|
|
840
1057
|
const { binary, args } = config.indexArgs({
|
|
841
1058
|
projectRoot,
|
|
842
1059
|
outputPath: outputScip,
|
|
@@ -846,7 +1063,7 @@ async function reindex(opts) {
|
|
|
846
1063
|
try {
|
|
847
1064
|
execFileSync3(binary, args, {
|
|
848
1065
|
cwd: projectRoot,
|
|
849
|
-
env,
|
|
1066
|
+
env: indexerEnv,
|
|
850
1067
|
stdio: "pipe",
|
|
851
1068
|
maxBuffer: 50 * 1024 * 1024
|
|
852
1069
|
});
|
|
@@ -854,12 +1071,14 @@ async function reindex(opts) {
|
|
|
854
1071
|
const msg = err instanceof Error ? err.message : String(err);
|
|
855
1072
|
throw new Error(
|
|
856
1073
|
`Failed to index ${lang} with ${resolvedBinary}: ${msg}
|
|
857
|
-
Make sure ${binaryLabel} is installed and available on PATH
|
|
1074
|
+
Make sure ${binaryLabel} is installed and available on PATH.`,
|
|
1075
|
+
{ cause: err }
|
|
858
1076
|
);
|
|
859
1077
|
}
|
|
1078
|
+
moveDefaultOutputIfNeeded(config, projectRoot, outputScip);
|
|
860
1079
|
}
|
|
861
1080
|
onStatus("Converting to SQLite...");
|
|
862
|
-
if (!
|
|
1081
|
+
if (!existsSync5(outputScip)) {
|
|
863
1082
|
throw new Error(`SCIP index not found at ${outputScip} after indexing`);
|
|
864
1083
|
}
|
|
865
1084
|
try {
|
|
@@ -870,16 +1089,25 @@ Make sure ${binaryLabel} is installed and available on PATH.`
|
|
|
870
1089
|
});
|
|
871
1090
|
} catch (err) {
|
|
872
1091
|
const msg = err instanceof Error ? err.message : String(err);
|
|
873
|
-
throw new Error(`Failed to convert SCIP index to SQLite: ${msg}
|
|
1092
|
+
throw new Error(`Failed to convert SCIP index to SQLite: ${msg}`, { cause: err });
|
|
874
1093
|
}
|
|
875
1094
|
const durationMs = Date.now() - start;
|
|
876
1095
|
onStatus(`Done in ${(durationMs / 1e3).toFixed(1)}s`);
|
|
877
1096
|
return { languages, indexPath: outputScip, dbPath: outputDb, durationMs };
|
|
878
1097
|
}
|
|
1098
|
+
function moveDefaultOutputIfNeeded(config, projectRoot, outputScip) {
|
|
1099
|
+
if (!config.defaultOutputPath) {
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
const defaultOutputPath = join5(projectRoot, config.defaultOutputPath);
|
|
1103
|
+
if (outputScip !== defaultOutputPath && existsSync5(defaultOutputPath)) {
|
|
1104
|
+
renameSync(defaultOutputPath, outputScip);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
879
1107
|
|
|
880
1108
|
// src/config.ts
|
|
881
|
-
import { readFileSync as readFileSync2, writeFileSync, existsSync as
|
|
882
|
-
import { join as
|
|
1109
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync6, mkdirSync } from "fs";
|
|
1110
|
+
import { join as join6, resolve } from "path";
|
|
883
1111
|
import { createHash } from "crypto";
|
|
884
1112
|
import { homedir } from "os";
|
|
885
1113
|
var CONFIG_FILENAME = ".scipquery.json";
|
|
@@ -890,8 +1118,8 @@ var DEFAULT_WATCH = {
|
|
|
890
1118
|
ignore: []
|
|
891
1119
|
};
|
|
892
1120
|
function loadProjectConfig(projectRoot) {
|
|
893
|
-
const configPath =
|
|
894
|
-
if (!
|
|
1121
|
+
const configPath = join6(projectRoot, CONFIG_FILENAME);
|
|
1122
|
+
if (!existsSync6(configPath)) {
|
|
895
1123
|
return {};
|
|
896
1124
|
}
|
|
897
1125
|
try {
|
|
@@ -912,23 +1140,23 @@ function resolveCacheDir(projectRoot, config) {
|
|
|
912
1140
|
if (envOverride) return ensureDir(envOverride);
|
|
913
1141
|
if (config?.dbPath) return ensureDir(resolve(projectRoot, config.dbPath));
|
|
914
1142
|
const xdgCache = process.env["XDG_CACHE_HOME"];
|
|
915
|
-
const cacheBase = xdgCache ||
|
|
1143
|
+
const cacheBase = xdgCache || join6(homedir(), ".cache");
|
|
916
1144
|
const projectHash = createHash("sha256").update(resolve(projectRoot)).digest("hex").slice(0, 12);
|
|
917
|
-
const dir =
|
|
1145
|
+
const dir = join6(cacheBase, "scip-query", "projects", projectHash);
|
|
918
1146
|
return ensureDir(dir);
|
|
919
1147
|
}
|
|
920
1148
|
function resolveIndexPaths(projectRoot, config) {
|
|
921
1149
|
const cacheDir = resolveCacheDir(projectRoot, config);
|
|
922
1150
|
return {
|
|
923
1151
|
cacheDir,
|
|
924
|
-
dbPath:
|
|
925
|
-
indexPath:
|
|
926
|
-
metaPath:
|
|
1152
|
+
dbPath: join6(cacheDir, "index.db"),
|
|
1153
|
+
indexPath: join6(cacheDir, "index.scip"),
|
|
1154
|
+
metaPath: join6(cacheDir, "meta.json")
|
|
927
1155
|
};
|
|
928
1156
|
}
|
|
929
1157
|
function initProjectConfig(projectRoot, languages) {
|
|
930
|
-
const configPath =
|
|
931
|
-
if (
|
|
1158
|
+
const configPath = join6(projectRoot, CONFIG_FILENAME);
|
|
1159
|
+
if (existsSync6(configPath)) {
|
|
932
1160
|
return configPath;
|
|
933
1161
|
}
|
|
934
1162
|
const config = {
|
|
@@ -949,8 +1177,8 @@ function ensureDir(dir) {
|
|
|
949
1177
|
|
|
950
1178
|
// src/watch.ts
|
|
951
1179
|
import { watch } from "fs";
|
|
952
|
-
import { existsSync as
|
|
953
|
-
import { join as
|
|
1180
|
+
import { existsSync as existsSync7, renameSync as renameSync2 } from "fs";
|
|
1181
|
+
import { join as join7, relative } from "path";
|
|
954
1182
|
import { fork } from "child_process";
|
|
955
1183
|
import ignore2 from "ignore";
|
|
956
1184
|
var Watcher = class {
|
|
@@ -1028,7 +1256,7 @@ var Watcher = class {
|
|
|
1028
1256
|
}
|
|
1029
1257
|
// ── Internal ─────────────────────────────────────────────
|
|
1030
1258
|
handleFileChange(filename) {
|
|
1031
|
-
const rel = relative(this.projectRoot,
|
|
1259
|
+
const rel = relative(this.projectRoot, join7(this.projectRoot, filename));
|
|
1032
1260
|
if (this.gitignoreFilter.isIgnored(rel)) return;
|
|
1033
1261
|
if (this.extraIgnore.ignores(rel)) return;
|
|
1034
1262
|
if (filename.endsWith("index.db") || filename.endsWith("index.scip") || filename.endsWith("index.db.tmp") || filename.endsWith(".scipquery.json")) {
|
|
@@ -1131,11 +1359,11 @@ var Watcher = class {
|
|
|
1131
1359
|
child.on("exit", (code2) => {
|
|
1132
1360
|
if (code2 === 0) {
|
|
1133
1361
|
try {
|
|
1134
|
-
if (
|
|
1135
|
-
|
|
1362
|
+
if (existsSync7(tmpDb)) {
|
|
1363
|
+
renameSync2(tmpDb, this.indexPaths.dbPath);
|
|
1136
1364
|
}
|
|
1137
|
-
if (
|
|
1138
|
-
|
|
1365
|
+
if (existsSync7(tmpScip)) {
|
|
1366
|
+
renameSync2(tmpScip, this.indexPaths.indexPath);
|
|
1139
1367
|
}
|
|
1140
1368
|
resolve3(Date.now() - start);
|
|
1141
1369
|
} catch (err) {
|
|
@@ -1159,25 +1387,31 @@ function tempScipPath(indexPath) {
|
|
|
1159
1387
|
|
|
1160
1388
|
// src/setup.ts
|
|
1161
1389
|
import {
|
|
1162
|
-
existsSync as
|
|
1390
|
+
existsSync as existsSync8,
|
|
1163
1391
|
mkdirSync as mkdirSync2,
|
|
1164
1392
|
symlinkSync,
|
|
1165
1393
|
readlinkSync,
|
|
1166
1394
|
unlinkSync
|
|
1167
1395
|
} from "fs";
|
|
1168
|
-
import { join as
|
|
1396
|
+
import { join as join8, dirname as dirname2, resolve as resolve2 } from "path";
|
|
1169
1397
|
import { homedir as homedir2, platform as platform3 } from "os";
|
|
1170
1398
|
import { fileURLToPath } from "url";
|
|
1171
1399
|
var IS_WINDOWS3 = platform3() === "win32";
|
|
1172
|
-
var
|
|
1400
|
+
var BUILTIN_SKILLS = [
|
|
1401
|
+
"concrete-plan",
|
|
1402
|
+
"scip-explore",
|
|
1403
|
+
"scip-debloat",
|
|
1404
|
+
"scip-verify",
|
|
1405
|
+
"scip-language-playbook"
|
|
1406
|
+
];
|
|
1173
1407
|
function installSkills(opts = {}) {
|
|
1174
1408
|
const log = opts.quiet ? () => {
|
|
1175
1409
|
} : console.log;
|
|
1176
1410
|
const thisFile = fileURLToPath(import.meta.url);
|
|
1177
1411
|
const skillsSource = resolve2(dirname2(thisFile), "..", "skills");
|
|
1178
1412
|
const targets = [
|
|
1179
|
-
|
|
1180
|
-
|
|
1413
|
+
join8(homedir2(), ".claude", "skills"),
|
|
1414
|
+
join8(homedir2(), ".codex", "skills")
|
|
1181
1415
|
];
|
|
1182
1416
|
const result = {
|
|
1183
1417
|
installed: [],
|
|
@@ -1186,19 +1420,19 @@ function installSkills(opts = {}) {
|
|
|
1186
1420
|
};
|
|
1187
1421
|
for (const targetDir of targets) {
|
|
1188
1422
|
const parentDir = dirname2(targetDir);
|
|
1189
|
-
if (!
|
|
1423
|
+
if (!existsSync8(parentDir)) {
|
|
1190
1424
|
continue;
|
|
1191
1425
|
}
|
|
1192
1426
|
mkdirSync2(targetDir, { recursive: true });
|
|
1193
1427
|
const toolName = targetDir.includes(".codex") ? "Codex" : "Claude";
|
|
1194
|
-
for (const skill of
|
|
1195
|
-
const source =
|
|
1196
|
-
const target =
|
|
1197
|
-
if (!
|
|
1428
|
+
for (const skill of BUILTIN_SKILLS) {
|
|
1429
|
+
const source = join8(skillsSource, skill);
|
|
1430
|
+
const target = join8(targetDir, skill);
|
|
1431
|
+
if (!existsSync8(source)) {
|
|
1198
1432
|
result.skipped.push(`${toolName}/${skill}`);
|
|
1199
1433
|
continue;
|
|
1200
1434
|
}
|
|
1201
|
-
if (
|
|
1435
|
+
if (existsSync8(target)) {
|
|
1202
1436
|
try {
|
|
1203
1437
|
const existing = readlinkSync(target);
|
|
1204
1438
|
if (resolve2(existing) === resolve2(source)) {
|