scip-query 0.3.5 → 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 +1 -0
- package/dist/{chunk-6FKIA6EI.js → chunk-2F2WH5WQ.js} +12 -12
- package/dist/{chunk-C7H5WBTJ.js → chunk-2UISVZGQ.js} +2 -2
- package/dist/{chunk-EN2Z2CLO.js → chunk-4ZT7UGWW.js} +16 -19
- 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-GIBETK3W.js +37 -0
- package/dist/{chunk-SMDCNPMK.js → chunk-H3FPW5YN.js} +2 -2
- package/dist/{chunk-VMM4SYV4.js → chunk-HNURMDF4.js} +16 -3
- 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-TRESG7OB.js → chunk-VCOJRQPP.js} +2 -2
- 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 +2607 -805
- package/dist/{db-viWlyVtv.d.ts → db-C4rPbKkI.d.ts} +6 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +371 -138
- 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 -1
- package/dist/queries/index.js +42 -42
- 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-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,55 +1,55 @@
|
|
|
1
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-
|
|
31
|
+
} from "./chunk-A5BGEBM7.js";
|
|
32
32
|
import {
|
|
33
33
|
hotspots
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-RIEA5DOB.js";
|
|
35
35
|
import {
|
|
36
36
|
importedBy,
|
|
37
37
|
imports,
|
|
38
38
|
unusedImports
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-N2LH3M2P.js";
|
|
40
40
|
import {
|
|
41
41
|
members
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-CQUNEJYM.js";
|
|
43
43
|
import {
|
|
44
44
|
methods
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-GIBETK3W.js";
|
|
46
46
|
import {
|
|
47
47
|
outline
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-LOVDB4C6.js";
|
|
49
49
|
import {
|
|
50
50
|
deps,
|
|
51
51
|
rdeps
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-KDCQJTYW.js";
|
|
53
53
|
import {
|
|
54
54
|
diffImpact
|
|
55
55
|
} from "./chunk-7HK5ZLOE.js";
|
|
@@ -58,88 +58,88 @@ import {
|
|
|
58
58
|
fanOut,
|
|
59
59
|
topFanIn,
|
|
60
60
|
topFanOut
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-HNURMDF4.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-2F2WH5WQ.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-AS7N27JK.js";
|
|
74
74
|
import {
|
|
75
75
|
similar,
|
|
76
76
|
similarAll
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-I2JM34UV.js";
|
|
78
78
|
import {
|
|
79
79
|
staleAbstractions
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-5RKYZSQ6.js";
|
|
81
81
|
import {
|
|
82
82
|
isolated
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-VISMEWYP.js";
|
|
84
84
|
import {
|
|
85
85
|
passthroughCandidates
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-5AJJGPZE.js";
|
|
87
87
|
import {
|
|
88
88
|
drift
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-HRDPUTIQ.js";
|
|
90
90
|
import {
|
|
91
91
|
extractCandidates
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-IV6NZ426.js";
|
|
93
93
|
import {
|
|
94
94
|
hierarchy
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-PGHN5UTM.js";
|
|
96
96
|
import {
|
|
97
97
|
complexityHotspots
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-SL674KAW.js";
|
|
99
99
|
import {
|
|
100
100
|
complexity
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-QCYR4S6T.js";
|
|
102
102
|
import {
|
|
103
103
|
convergence
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-VCOJRQPP.js";
|
|
105
105
|
import {
|
|
106
106
|
coupling,
|
|
107
107
|
topCoupling
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-A7YY7IDA.js";
|
|
109
109
|
import {
|
|
110
110
|
cycles
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-VU7FDTWV.js";
|
|
112
112
|
import {
|
|
113
113
|
dataflow
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-XH56HXLC.js";
|
|
115
115
|
import {
|
|
116
116
|
dead
|
|
117
|
-
} from "./chunk-
|
|
118
|
-
import "./chunk-
|
|
117
|
+
} from "./chunk-SRELHCMG.js";
|
|
118
|
+
import "./chunk-X3J4VPWM.js";
|
|
119
119
|
import {
|
|
120
120
|
deepChains
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-ZU2AQQB5.js";
|
|
122
122
|
import {
|
|
123
123
|
affected
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-UTRKBUCB.js";
|
|
125
125
|
import {
|
|
126
126
|
bottlenecks
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-CQRYLK33.js";
|
|
128
128
|
import {
|
|
129
129
|
byKind,
|
|
130
130
|
kindCounts
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-4ZT7UGWW.js";
|
|
132
132
|
import {
|
|
133
133
|
callGraph
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-2UISVZGQ.js";
|
|
135
135
|
import {
|
|
136
136
|
changeSurface
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-H3FPW5YN.js";
|
|
138
138
|
import "./chunk-4TYLS5XX.js";
|
|
139
139
|
import {
|
|
140
140
|
code
|
|
141
|
-
} from "./chunk-
|
|
142
|
-
import "./chunk-
|
|
141
|
+
} from "./chunk-E7J7Q7UW.js";
|
|
142
|
+
import "./chunk-QGCEAVJD.js";
|
|
143
143
|
import {
|
|
144
144
|
leafName,
|
|
145
145
|
parseSymbol,
|
|
@@ -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
|
});
|
|
@@ -857,9 +1074,10 @@ async function reindex(opts) {
|
|
|
857
1074
|
Make sure ${binaryLabel} is installed and available on PATH.`
|
|
858
1075
|
);
|
|
859
1076
|
}
|
|
1077
|
+
moveDefaultOutputIfNeeded(config, projectRoot, outputScip);
|
|
860
1078
|
}
|
|
861
1079
|
onStatus("Converting to SQLite...");
|
|
862
|
-
if (!
|
|
1080
|
+
if (!existsSync5(outputScip)) {
|
|
863
1081
|
throw new Error(`SCIP index not found at ${outputScip} after indexing`);
|
|
864
1082
|
}
|
|
865
1083
|
try {
|
|
@@ -876,10 +1094,19 @@ Make sure ${binaryLabel} is installed and available on PATH.`
|
|
|
876
1094
|
onStatus(`Done in ${(durationMs / 1e3).toFixed(1)}s`);
|
|
877
1095
|
return { languages, indexPath: outputScip, dbPath: outputDb, durationMs };
|
|
878
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
|
+
}
|
|
879
1106
|
|
|
880
1107
|
// src/config.ts
|
|
881
|
-
import { readFileSync as readFileSync2, writeFileSync, existsSync as
|
|
882
|
-
import { join as
|
|
1108
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync6, mkdirSync } from "fs";
|
|
1109
|
+
import { join as join6, resolve } from "path";
|
|
883
1110
|
import { createHash } from "crypto";
|
|
884
1111
|
import { homedir } from "os";
|
|
885
1112
|
var CONFIG_FILENAME = ".scipquery.json";
|
|
@@ -890,8 +1117,8 @@ var DEFAULT_WATCH = {
|
|
|
890
1117
|
ignore: []
|
|
891
1118
|
};
|
|
892
1119
|
function loadProjectConfig(projectRoot) {
|
|
893
|
-
const configPath =
|
|
894
|
-
if (!
|
|
1120
|
+
const configPath = join6(projectRoot, CONFIG_FILENAME);
|
|
1121
|
+
if (!existsSync6(configPath)) {
|
|
895
1122
|
return {};
|
|
896
1123
|
}
|
|
897
1124
|
try {
|
|
@@ -912,23 +1139,23 @@ function resolveCacheDir(projectRoot, config) {
|
|
|
912
1139
|
if (envOverride) return ensureDir(envOverride);
|
|
913
1140
|
if (config?.dbPath) return ensureDir(resolve(projectRoot, config.dbPath));
|
|
914
1141
|
const xdgCache = process.env["XDG_CACHE_HOME"];
|
|
915
|
-
const cacheBase = xdgCache ||
|
|
1142
|
+
const cacheBase = xdgCache || join6(homedir(), ".cache");
|
|
916
1143
|
const projectHash = createHash("sha256").update(resolve(projectRoot)).digest("hex").slice(0, 12);
|
|
917
|
-
const dir =
|
|
1144
|
+
const dir = join6(cacheBase, "scip-query", "projects", projectHash);
|
|
918
1145
|
return ensureDir(dir);
|
|
919
1146
|
}
|
|
920
1147
|
function resolveIndexPaths(projectRoot, config) {
|
|
921
1148
|
const cacheDir = resolveCacheDir(projectRoot, config);
|
|
922
1149
|
return {
|
|
923
1150
|
cacheDir,
|
|
924
|
-
dbPath:
|
|
925
|
-
indexPath:
|
|
926
|
-
metaPath:
|
|
1151
|
+
dbPath: join6(cacheDir, "index.db"),
|
|
1152
|
+
indexPath: join6(cacheDir, "index.scip"),
|
|
1153
|
+
metaPath: join6(cacheDir, "meta.json")
|
|
927
1154
|
};
|
|
928
1155
|
}
|
|
929
1156
|
function initProjectConfig(projectRoot, languages) {
|
|
930
|
-
const configPath =
|
|
931
|
-
if (
|
|
1157
|
+
const configPath = join6(projectRoot, CONFIG_FILENAME);
|
|
1158
|
+
if (existsSync6(configPath)) {
|
|
932
1159
|
return configPath;
|
|
933
1160
|
}
|
|
934
1161
|
const config = {
|
|
@@ -949,8 +1176,8 @@ function ensureDir(dir) {
|
|
|
949
1176
|
|
|
950
1177
|
// src/watch.ts
|
|
951
1178
|
import { watch } from "fs";
|
|
952
|
-
import { existsSync as
|
|
953
|
-
import { join as
|
|
1179
|
+
import { existsSync as existsSync7, renameSync as renameSync2 } from "fs";
|
|
1180
|
+
import { join as join7, relative } from "path";
|
|
954
1181
|
import { fork } from "child_process";
|
|
955
1182
|
import ignore2 from "ignore";
|
|
956
1183
|
var Watcher = class {
|
|
@@ -1028,7 +1255,7 @@ var Watcher = class {
|
|
|
1028
1255
|
}
|
|
1029
1256
|
// ── Internal ─────────────────────────────────────────────
|
|
1030
1257
|
handleFileChange(filename) {
|
|
1031
|
-
const rel = relative(this.projectRoot,
|
|
1258
|
+
const rel = relative(this.projectRoot, join7(this.projectRoot, filename));
|
|
1032
1259
|
if (this.gitignoreFilter.isIgnored(rel)) return;
|
|
1033
1260
|
if (this.extraIgnore.ignores(rel)) return;
|
|
1034
1261
|
if (filename.endsWith("index.db") || filename.endsWith("index.scip") || filename.endsWith("index.db.tmp") || filename.endsWith(".scipquery.json")) {
|
|
@@ -1131,11 +1358,11 @@ var Watcher = class {
|
|
|
1131
1358
|
child.on("exit", (code2) => {
|
|
1132
1359
|
if (code2 === 0) {
|
|
1133
1360
|
try {
|
|
1134
|
-
if (
|
|
1135
|
-
|
|
1361
|
+
if (existsSync7(tmpDb)) {
|
|
1362
|
+
renameSync2(tmpDb, this.indexPaths.dbPath);
|
|
1136
1363
|
}
|
|
1137
|
-
if (
|
|
1138
|
-
|
|
1364
|
+
if (existsSync7(tmpScip)) {
|
|
1365
|
+
renameSync2(tmpScip, this.indexPaths.indexPath);
|
|
1139
1366
|
}
|
|
1140
1367
|
resolve3(Date.now() - start);
|
|
1141
1368
|
} catch (err) {
|
|
@@ -1159,25 +1386,31 @@ function tempScipPath(indexPath) {
|
|
|
1159
1386
|
|
|
1160
1387
|
// src/setup.ts
|
|
1161
1388
|
import {
|
|
1162
|
-
existsSync as
|
|
1389
|
+
existsSync as existsSync8,
|
|
1163
1390
|
mkdirSync as mkdirSync2,
|
|
1164
1391
|
symlinkSync,
|
|
1165
1392
|
readlinkSync,
|
|
1166
1393
|
unlinkSync
|
|
1167
1394
|
} from "fs";
|
|
1168
|
-
import { join as
|
|
1395
|
+
import { join as join8, dirname as dirname2, resolve as resolve2 } from "path";
|
|
1169
1396
|
import { homedir as homedir2, platform as platform3 } from "os";
|
|
1170
1397
|
import { fileURLToPath } from "url";
|
|
1171
1398
|
var IS_WINDOWS3 = platform3() === "win32";
|
|
1172
|
-
var
|
|
1399
|
+
var BUILTIN_SKILLS = [
|
|
1400
|
+
"concrete-plan",
|
|
1401
|
+
"scip-explore",
|
|
1402
|
+
"scip-debloat",
|
|
1403
|
+
"scip-verify",
|
|
1404
|
+
"scip-language-playbook"
|
|
1405
|
+
];
|
|
1173
1406
|
function installSkills(opts = {}) {
|
|
1174
1407
|
const log = opts.quiet ? () => {
|
|
1175
1408
|
} : console.log;
|
|
1176
1409
|
const thisFile = fileURLToPath(import.meta.url);
|
|
1177
1410
|
const skillsSource = resolve2(dirname2(thisFile), "..", "skills");
|
|
1178
1411
|
const targets = [
|
|
1179
|
-
|
|
1180
|
-
|
|
1412
|
+
join8(homedir2(), ".claude", "skills"),
|
|
1413
|
+
join8(homedir2(), ".codex", "skills")
|
|
1181
1414
|
];
|
|
1182
1415
|
const result = {
|
|
1183
1416
|
installed: [],
|
|
@@ -1186,19 +1419,19 @@ function installSkills(opts = {}) {
|
|
|
1186
1419
|
};
|
|
1187
1420
|
for (const targetDir of targets) {
|
|
1188
1421
|
const parentDir = dirname2(targetDir);
|
|
1189
|
-
if (!
|
|
1422
|
+
if (!existsSync8(parentDir)) {
|
|
1190
1423
|
continue;
|
|
1191
1424
|
}
|
|
1192
1425
|
mkdirSync2(targetDir, { recursive: true });
|
|
1193
1426
|
const toolName = targetDir.includes(".codex") ? "Codex" : "Claude";
|
|
1194
|
-
for (const skill of
|
|
1195
|
-
const source =
|
|
1196
|
-
const target =
|
|
1197
|
-
if (!
|
|
1427
|
+
for (const skill of BUILTIN_SKILLS) {
|
|
1428
|
+
const source = join8(skillsSource, skill);
|
|
1429
|
+
const target = join8(targetDir, skill);
|
|
1430
|
+
if (!existsSync8(source)) {
|
|
1198
1431
|
result.skipped.push(`${toolName}/${skill}`);
|
|
1199
1432
|
continue;
|
|
1200
1433
|
}
|
|
1201
|
-
if (
|
|
1434
|
+
if (existsSync8(target)) {
|
|
1202
1435
|
try {
|
|
1203
1436
|
const existing = readlinkSync(target);
|
|
1204
1437
|
if (resolve2(existing) === resolve2(source)) {
|