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.
Files changed (149) hide show
  1. package/README.md +1 -0
  2. package/dist/{chunk-6FKIA6EI.js → chunk-2F2WH5WQ.js} +12 -12
  3. package/dist/{chunk-C7H5WBTJ.js → chunk-2UISVZGQ.js} +2 -2
  4. package/dist/{chunk-EN2Z2CLO.js → chunk-4ZT7UGWW.js} +16 -19
  5. package/dist/chunk-5AJJGPZE.js +60 -0
  6. package/dist/chunk-5RKYZSQ6.js +75 -0
  7. package/dist/chunk-7YBLWIXY.js +115 -0
  8. package/dist/{chunk-O7Q7FDUJ.js → chunk-A4GWYETB.js} +2 -2
  9. package/dist/{chunk-CHDJXYBG.js → chunk-A5BGEBM7.js} +2 -2
  10. package/dist/{chunk-KKCHYLVI.js → chunk-A7YY7IDA.js} +2 -2
  11. package/dist/chunk-AS7N27JK.js +115 -0
  12. package/dist/{chunk-F7XU27LU.js → chunk-CQRYLK33.js} +26 -2
  13. package/dist/{chunk-NFS5W3PP.js → chunk-CQUNEJYM.js} +2 -2
  14. package/dist/chunk-D4I3ZMN5.js +38 -0
  15. package/dist/{chunk-J3JSOSUO.js → chunk-E7J7Q7UW.js} +2 -2
  16. package/dist/{chunk-GEXE2T6I.js → chunk-EOHPASDV.js} +22 -14
  17. package/dist/chunk-GIBETK3W.js +37 -0
  18. package/dist/{chunk-SMDCNPMK.js → chunk-H3FPW5YN.js} +2 -2
  19. package/dist/{chunk-VMM4SYV4.js → chunk-HNURMDF4.js} +16 -3
  20. package/dist/{chunk-7KIMF5PV.js → chunk-HRDPUTIQ.js} +2 -2
  21. package/dist/{chunk-OIDHN6GD.js → chunk-I2JM34UV.js} +146 -5
  22. package/dist/{chunk-EPWLXXBL.js → chunk-IV6NZ426.js} +27 -29
  23. package/dist/{chunk-VT4JBH6L.js → chunk-KDCQJTYW.js} +2 -2
  24. package/dist/{chunk-5OMVSV6E.js → chunk-LOVDB4C6.js} +2 -2
  25. package/dist/chunk-MA3B3IUT.js +75 -0
  26. package/dist/{chunk-26DOJ63W.js → chunk-N2LH3M2P.js} +13 -2
  27. package/dist/chunk-NWCJWA36.js +162 -0
  28. package/dist/{chunk-NG5F43OU.js → chunk-P3VCDYMJ.js} +70 -1
  29. package/dist/{chunk-P3E6L7KW.js → chunk-P42KQKJZ.js} +83 -3
  30. package/dist/{chunk-YDBXNPYU.js → chunk-PGHN5UTM.js} +2 -2
  31. package/dist/{chunk-UGQKAVCD.js → chunk-QCYR4S6T.js} +2 -2
  32. package/dist/chunk-QGCEAVJD.js +2529 -0
  33. package/dist/{chunk-KBOQX573.js → chunk-RIEA5DOB.js} +19 -2
  34. package/dist/{chunk-VIYSWZCO.js → chunk-SL674KAW.js} +31 -3
  35. package/dist/chunk-SRELHCMG.js +110 -0
  36. package/dist/chunk-UTRKBUCB.js +87 -0
  37. package/dist/{chunk-TRESG7OB.js → chunk-VCOJRQPP.js} +2 -2
  38. package/dist/chunk-VISMEWYP.js +34 -0
  39. package/dist/{chunk-LFJQVJYJ.js → chunk-VU7FDTWV.js} +2 -2
  40. package/dist/{chunk-HLUS2HEB.js → chunk-VUBLUTMU.js} +5 -4
  41. package/dist/{chunk-WGAD3GNR.js → chunk-WNPF2I25.js} +5 -5
  42. package/dist/{chunk-YY4QGUQ5.js → chunk-X3J4VPWM.js} +2 -2
  43. package/dist/{chunk-GSH2FPKV.js → chunk-XH56HXLC.js} +2 -2
  44. package/dist/{chunk-DH7G3DDV.js → chunk-ZU2AQQB5.js} +2 -2
  45. package/dist/cli.js +2607 -805
  46. package/dist/{db-viWlyVtv.d.ts → db-C4rPbKkI.d.ts} +6 -1
  47. package/dist/index.d.ts +4 -4
  48. package/dist/index.js +371 -138
  49. package/dist/postinstall.js +9 -3
  50. package/dist/queries/affected.d.ts +1 -1
  51. package/dist/queries/affected.js +2 -2
  52. package/dist/queries/bottlenecks.d.ts +1 -1
  53. package/dist/queries/bottlenecks.js +2 -1
  54. package/dist/queries/by-kind.d.ts +1 -1
  55. package/dist/queries/by-kind.js +2 -1
  56. package/dist/queries/call-graph.d.ts +1 -1
  57. package/dist/queries/call-graph.js +2 -2
  58. package/dist/queries/change-surface.d.ts +1 -1
  59. package/dist/queries/change-surface.js +2 -2
  60. package/dist/queries/code.d.ts +1 -1
  61. package/dist/queries/code.js +2 -2
  62. package/dist/queries/complexity-hotspots.d.ts +1 -1
  63. package/dist/queries/complexity-hotspots.js +2 -2
  64. package/dist/queries/complexity.d.ts +1 -1
  65. package/dist/queries/complexity.js +2 -2
  66. package/dist/queries/convergence.d.ts +1 -1
  67. package/dist/queries/convergence.js +2 -2
  68. package/dist/queries/coupling.d.ts +1 -1
  69. package/dist/queries/coupling.js +2 -2
  70. package/dist/queries/cycles.d.ts +1 -1
  71. package/dist/queries/cycles.js +2 -2
  72. package/dist/queries/dataflow.d.ts +1 -1
  73. package/dist/queries/dataflow.js +2 -2
  74. package/dist/queries/dead.d.ts +1 -1
  75. package/dist/queries/dead.js +3 -3
  76. package/dist/queries/deep-chains.d.ts +1 -1
  77. package/dist/queries/deep-chains.js +2 -2
  78. package/dist/queries/deps.d.ts +1 -1
  79. package/dist/queries/deps.js +2 -2
  80. package/dist/queries/diff-impact.d.ts +1 -1
  81. package/dist/queries/drift.d.ts +1 -1
  82. package/dist/queries/drift.js +2 -2
  83. package/dist/queries/extract-candidates.d.ts +1 -1
  84. package/dist/queries/extract-candidates.js +2 -2
  85. package/dist/queries/fan.d.ts +1 -1
  86. package/dist/queries/fan.js +2 -2
  87. package/dist/queries/files.d.ts +1 -1
  88. package/dist/queries/health.d.ts +1 -1
  89. package/dist/queries/health.js +13 -13
  90. package/dist/queries/hierarchy.d.ts +1 -1
  91. package/dist/queries/hierarchy.js +2 -2
  92. package/dist/queries/hotspots.d.ts +1 -1
  93. package/dist/queries/hotspots.js +2 -1
  94. package/dist/queries/imports.d.ts +1 -1
  95. package/dist/queries/imports.js +2 -2
  96. package/dist/queries/index.d.ts +1 -1
  97. package/dist/queries/index.js +42 -42
  98. package/dist/queries/isolated.d.ts +3 -4
  99. package/dist/queries/isolated.js +3 -3
  100. package/dist/queries/members.d.ts +1 -1
  101. package/dist/queries/members.js +2 -2
  102. package/dist/queries/methods.d.ts +1 -1
  103. package/dist/queries/methods.js +2 -1
  104. package/dist/queries/outline.d.ts +1 -1
  105. package/dist/queries/outline.js +2 -2
  106. package/dist/queries/passthrough-candidates.d.ts +1 -1
  107. package/dist/queries/passthrough-candidates.js +2 -2
  108. package/dist/queries/redundant-reexports.d.ts +1 -1
  109. package/dist/queries/redundant-reexports.js +3 -3
  110. package/dist/queries/refs.d.ts +1 -1
  111. package/dist/queries/refs.js +2 -2
  112. package/dist/queries/similar-chains.d.ts +1 -1
  113. package/dist/queries/similar-chains.js +2 -2
  114. package/dist/queries/similar-files.d.ts +1 -1
  115. package/dist/queries/similar-files.js +2 -2
  116. package/dist/queries/similar-signatures.d.ts +5 -3
  117. package/dist/queries/similar-signatures.js +2 -1
  118. package/dist/queries/similar.d.ts +1 -1
  119. package/dist/queries/similar.js +2 -2
  120. package/dist/queries/slice.d.ts +1 -1
  121. package/dist/queries/slice.js +2 -2
  122. package/dist/queries/stale-abstractions.d.ts +1 -1
  123. package/dist/queries/stale-abstractions.js +2 -2
  124. package/dist/queries/stats.d.ts +1 -1
  125. package/dist/queries/surface.d.ts +1 -1
  126. package/dist/queries/surface.js +2 -2
  127. package/dist/queries/symbols.d.ts +1 -1
  128. package/dist/queries/symbols.js +2 -2
  129. package/dist/queries/system.d.ts +1 -1
  130. package/dist/queries/system.js +2 -2
  131. package/dist/queries/trace.d.ts +1 -1
  132. package/dist/queries/trace.js +2 -2
  133. package/dist/queries/wrapper-candidates.d.ts +1 -1
  134. package/dist/queries/wrapper-candidates.js +2 -2
  135. package/dist/reindex-worker.js +213 -62
  136. package/package.json +1 -1
  137. package/skills/scip-language-playbook/SKILL.md +371 -0
  138. package/dist/chunk-4JCSOF2O.js +0 -97
  139. package/dist/chunk-AXQKUYKF.js +0 -1442
  140. package/dist/chunk-CPVAQJEC.js +0 -46
  141. package/dist/chunk-EOROMIFO.js +0 -41
  142. package/dist/chunk-GU2H5QRN.js +0 -28
  143. package/dist/chunk-LQJUPXQY.js +0 -109
  144. package/dist/chunk-MPGIHELS.js +0 -39
  145. package/dist/chunk-TOIEB3LG.js +0 -78
  146. package/dist/chunk-UQEQ6AHX.js +0 -60
  147. package/dist/chunk-VJJKSGIX.js +0 -121
  148. package/dist/chunk-YGGFLMTM.js +0 -83
  149. package/dist/chunk-ZEUCXQBN.js +0 -71
@@ -1,58 +1,165 @@
1
1
  import {
2
2
  describeIndexerBinary,
3
+ getIndexerExecutionEnv,
3
4
  isBinaryAvailable,
4
5
  isIndexerInstalled,
5
6
  resolveIndexerBinary,
7
+ resolveProjectLocalIndexerBinary,
6
8
  tryInstallIndexer,
7
9
  tryInstallScipCli
8
- } from "./chunk-NG5F43OU.js";
10
+ } from "./chunk-P3VCDYMJ.js";
9
11
 
10
12
  // src/reindex/index.ts
11
13
  import { execFileSync } from "child_process";
12
- import { existsSync as existsSync2 } from "fs";
13
- import { join as join2 } from "path";
14
+ import { existsSync as existsSync3, renameSync } from "fs";
15
+ import { join as join3 } from "path";
14
16
 
15
17
  // src/reindex/detect.ts
16
- import { existsSync } from "fs";
17
- import { join } from "path";
18
+ import { existsSync, readdirSync } from "fs";
19
+ import { extname, join } from "path";
20
+ var IGNORED_DIRS = /* @__PURE__ */ new Set([
21
+ ".git",
22
+ ".hg",
23
+ ".svn",
24
+ ".idea",
25
+ ".vscode",
26
+ "node_modules",
27
+ "vendor",
28
+ "dist",
29
+ "build",
30
+ "target",
31
+ "bin",
32
+ "obj",
33
+ ".dart_tool",
34
+ ".gradle",
35
+ ".next",
36
+ ".venv",
37
+ "venv",
38
+ "__pycache__"
39
+ ]);
18
40
  var LANGUAGE_MARKERS = [
19
- { language: "typescript", files: ["tsconfig.json", "tsconfig.base.json"] },
20
- { language: "rust", files: ["Cargo.toml"] },
21
- { language: "go", files: ["go.mod"] },
22
- { language: "java", files: ["pom.xml", "build.gradle", "build.gradle.kts"] },
23
- { language: "kotlin", files: ["build.gradle.kts"] },
24
- { language: "scala", files: ["build.sbt"] },
25
- { language: "python", files: ["pyproject.toml", "setup.py", "setup.cfg", "Pipfile"] },
26
- { language: "ruby", files: ["Gemfile"] },
27
- { language: "csharp", files: ["*.csproj", "*.sln"] },
28
- { language: "dart", files: ["pubspec.yaml"] },
29
- { language: "php", files: ["composer.json"] },
30
- { language: "javascript", files: ["package.json"] }
31
- // Last very common, low specificity
41
+ { language: "typescript", files: ["tsconfig.json", "tsconfig.base.json"], extensions: [".ts", ".tsx", ".mts", ".cts"] },
42
+ { language: "rust", files: ["Cargo.toml"], extensions: [".rs"] },
43
+ { language: "go", files: ["go.mod"], extensions: [".go"] },
44
+ { language: "java", files: ["pom.xml", "build.gradle", "build.gradle.kts"], extensions: [".java"] },
45
+ { language: "kotlin", files: ["build.gradle.kts"], extensions: [".kt", ".kts"] },
46
+ { language: "scala", files: ["build.sbt"], extensions: [".scala"] },
47
+ { language: "python", files: ["pyproject.toml", "setup.py", "setup.cfg", "Pipfile"], extensions: [".py", ".pyi"] },
48
+ { language: "ruby", files: ["Gemfile"], extensions: [".rb"] },
49
+ { language: "cpp", files: ["compile_commands.json", "CMakeLists.txt", "Makefile"], extensions: [".cc", ".cpp", ".cxx", ".hpp", ".hh", ".hxx"] },
50
+ { language: "c", files: ["compile_commands.json", "CMakeLists.txt", "Makefile"], extensions: [".c", ".h"] },
51
+ { language: "csharp", globs: ["*.csproj", "*.sln"], extensions: [".cs"] },
52
+ { language: "vb", globs: ["*.vbproj"], extensions: [".vb"] },
53
+ { language: "dart", files: ["pubspec.yaml"], extensions: [".dart"] },
54
+ { language: "php", files: ["composer.json"], extensions: [".php"] },
55
+ { language: "javascript", files: ["package.json"], extensions: [".js", ".jsx", ".mjs", ".cjs"] }
56
+ // Last — very common
32
57
  ];
33
58
  function detectLanguages(projectRoot2) {
34
59
  const detected = [];
60
+ const rootEntries = safeReadDir(projectRoot2);
61
+ const extensionSet = collectExtensions(projectRoot2);
35
62
  for (const marker of LANGUAGE_MARKERS) {
36
- for (const file of marker.files) {
37
- if (file.includes("*")) {
38
- continue;
63
+ if (hasMarkerFile(projectRoot2, marker.files)) {
64
+ detected.push(marker.language);
65
+ continue;
66
+ }
67
+ if (matchesRootGlob(rootEntries, marker.globs)) {
68
+ detected.push(marker.language);
69
+ continue;
70
+ }
71
+ if (hasExtension(extensionSet, marker.extensions)) {
72
+ detected.push(marker.language);
73
+ }
74
+ }
75
+ if (detected.includes("typescript")) {
76
+ removeLanguage(detected, "javascript");
77
+ }
78
+ if (detected.includes("cpp") && !extensionSet.has(".c")) {
79
+ removeLanguage(detected, "c");
80
+ }
81
+ return detected;
82
+ }
83
+ function safeReadDir(projectRoot2) {
84
+ try {
85
+ return readdirSync(projectRoot2);
86
+ } catch {
87
+ return [];
88
+ }
89
+ }
90
+ function hasMarkerFile(projectRoot2, files) {
91
+ if (!files?.length) {
92
+ return false;
93
+ }
94
+ return files.some((file) => existsSync(join(projectRoot2, file)));
95
+ }
96
+ function matchesRootGlob(entries, globs) {
97
+ if (!globs?.length) {
98
+ return false;
99
+ }
100
+ return entries.some((entry) => globs.some((glob) => matchesSimpleGlob(entry, glob)));
101
+ }
102
+ function matchesSimpleGlob(entry, pattern) {
103
+ if (pattern === "*") {
104
+ return true;
105
+ }
106
+ if (!pattern.includes("*")) {
107
+ return entry === pattern;
108
+ }
109
+ const [prefix, suffix] = pattern.split("*");
110
+ return entry.startsWith(prefix ?? "") && entry.endsWith(suffix ?? "");
111
+ }
112
+ function collectExtensions(projectRoot2) {
113
+ const found = /* @__PURE__ */ new Set();
114
+ const stack = [projectRoot2];
115
+ while (stack.length > 0) {
116
+ const current = stack.pop();
117
+ if (!current) {
118
+ continue;
119
+ }
120
+ let entries;
121
+ try {
122
+ entries = readdirSync(current, { withFileTypes: true });
123
+ } catch {
124
+ continue;
125
+ }
126
+ for (const entry of entries) {
127
+ if (entry.name.startsWith(".") && !entry.name.endsWith("proj") && !entry.name.endsWith("sln")) {
128
+ if (entry.isDirectory()) {
129
+ continue;
130
+ }
39
131
  }
40
- if (existsSync(join(projectRoot2, file))) {
41
- if (!detected.includes(marker.language)) {
42
- detected.push(marker.language);
132
+ const fullPath = join(current, entry.name);
133
+ if (entry.isDirectory()) {
134
+ if (!IGNORED_DIRS.has(entry.name)) {
135
+ stack.push(fullPath);
43
136
  }
44
- break;
137
+ continue;
138
+ }
139
+ const extension = extname(entry.name).toLowerCase();
140
+ if (extension) {
141
+ found.add(extension);
45
142
  }
46
143
  }
47
144
  }
48
- if (detected.includes("typescript")) {
49
- const jsIdx = detected.indexOf("javascript");
50
- if (jsIdx !== -1) detected.splice(jsIdx, 1);
145
+ return found;
146
+ }
147
+ function hasExtension(extensionSet, extensions) {
148
+ if (!extensions?.length) {
149
+ return false;
150
+ }
151
+ return extensions.some((extension) => extensionSet.has(extension));
152
+ }
153
+ function removeLanguage(detected, language) {
154
+ const index = detected.indexOf(language);
155
+ if (index !== -1) {
156
+ detected.splice(index, 1);
51
157
  }
52
- return detected;
53
158
  }
54
159
 
55
160
  // src/reindex/indexers.ts
161
+ import { existsSync as existsSync2, readdirSync as readdirSync2 } from "fs";
162
+ import { join as join2 } from "path";
56
163
  var INDEXER_CONFIGS = {
57
164
  typescript: {
58
165
  language: "typescript",
@@ -92,9 +199,7 @@ var INDEXER_CONFIGS = {
92
199
  args: ["index", "--output", outputPath]
93
200
  }),
94
201
  markerFiles: ["pom.xml", "build.gradle"],
95
- installMethods: [
96
- { label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
97
- ],
202
+ installMethods: [],
98
203
  installUrl: "https://github.com/sourcegraph/scip-java/releases"
99
204
  },
100
205
  scala: {
@@ -106,9 +211,7 @@ var INDEXER_CONFIGS = {
106
211
  args: ["index", "--output", outputPath]
107
212
  }),
108
213
  markerFiles: ["build.sbt"],
109
- installMethods: [
110
- { label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
111
- ],
214
+ installMethods: [],
112
215
  installUrl: "https://github.com/sourcegraph/scip-java/releases"
113
216
  },
114
217
  kotlin: {
@@ -120,9 +223,7 @@ var INDEXER_CONFIGS = {
120
223
  args: ["index", "--output", outputPath]
121
224
  }),
122
225
  markerFiles: ["build.gradle.kts"],
123
- installMethods: [
124
- { label: "coursier", prerequisite: "cs", binary: "cs", args: ["install", "scip-java"] }
125
- ],
226
+ installMethods: [],
126
227
  installUrl: "https://github.com/sourcegraph/scip-java/releases"
127
228
  },
128
229
  rust: {
@@ -158,10 +259,11 @@ var INDEXER_CONFIGS = {
158
259
  language: "ruby",
159
260
  indexerBinary: "scip-ruby",
160
261
  checkCommand: "scip-ruby --version",
161
- indexArgs: ({ outputPath }) => ({
162
- binary: "scip-ruby",
163
- args: ["--output", outputPath]
262
+ indexArgs: ({ indexerBinary }) => ({
263
+ binary: indexerBinary,
264
+ args: ["--dir", "."]
164
265
  }),
266
+ defaultOutputPath: "index.scip",
165
267
  markerFiles: ["Gemfile"],
166
268
  installMethods: [],
167
269
  installUrl: "https://github.com/sourcegraph/scip-ruby/releases"
@@ -186,7 +288,7 @@ var INDEXER_CONFIGS = {
186
288
  checkCommand: "scip-clang --version",
187
289
  indexArgs: ({ outputPath }) => ({
188
290
  binary: "scip-clang",
189
- args: ["--output", outputPath]
291
+ args: ["--compdb-path", "compile_commands.json", "--index-output-path", outputPath]
190
292
  }),
191
293
  markerFiles: ["CMakeLists.txt", "Makefile"],
192
294
  installMethods: [],
@@ -198,7 +300,7 @@ var INDEXER_CONFIGS = {
198
300
  checkCommand: "scip-clang --version",
199
301
  indexArgs: ({ outputPath }) => ({
200
302
  binary: "scip-clang",
201
- args: ["--output", outputPath]
303
+ args: ["--compdb-path", "compile_commands.json", "--index-output-path", outputPath]
202
304
  }),
203
305
  markerFiles: ["CMakeLists.txt", "Makefile"],
204
306
  installMethods: [],
@@ -208,11 +310,25 @@ var INDEXER_CONFIGS = {
208
310
  language: "csharp",
209
311
  indexerBinary: "scip-dotnet",
210
312
  checkCommand: "scip-dotnet --version",
211
- indexArgs: ({ outputPath }) => ({
313
+ indexArgs: ({ projectRoot: projectRoot2, outputPath }) => ({
212
314
  binary: "scip-dotnet",
213
- args: ["index", "--output", outputPath]
315
+ args: ["index", resolveDotnetProject(projectRoot2, [".sln", ".csproj"]) ?? projectRoot2, "--output", outputPath, "--working-directory", projectRoot2]
316
+ }),
317
+ markerFiles: ["*.csproj", "*.sln"],
318
+ installMethods: [
319
+ { label: "dotnet", prerequisite: "dotnet", binary: "dotnet", args: ["tool", "install", "--global", "scip-dotnet"] }
320
+ ],
321
+ installUrl: "https://github.com/sourcegraph/scip-dotnet/releases"
322
+ },
323
+ vb: {
324
+ language: "vb",
325
+ indexerBinary: "scip-dotnet",
326
+ checkCommand: "scip-dotnet --version",
327
+ indexArgs: ({ projectRoot: projectRoot2, outputPath }) => ({
328
+ binary: "scip-dotnet",
329
+ args: ["index", resolveDotnetProject(projectRoot2, [".sln", ".vbproj"]) ?? projectRoot2, "--output", outputPath, "--working-directory", projectRoot2]
214
330
  }),
215
- markerFiles: [],
331
+ markerFiles: ["*.vbproj", "*.sln"],
216
332
  installMethods: [
217
333
  { label: "dotnet", prerequisite: "dotnet", binary: "dotnet", args: ["tool", "install", "--global", "scip-dotnet"] }
218
334
  ],
@@ -222,9 +338,9 @@ var INDEXER_CONFIGS = {
222
338
  language: "dart",
223
339
  indexerBinary: "scip-dart",
224
340
  checkCommand: "scip-dart --version",
225
- indexArgs: ({ outputPath }) => ({
226
- binary: "scip-dart",
227
- args: ["index", "--output", outputPath]
341
+ indexArgs: ({ indexerBinary, outputPath }) => ({
342
+ binary: indexerBinary,
343
+ args: ["--output", outputPath]
228
344
  }),
229
345
  markerFiles: ["pubspec.yaml"],
230
346
  installMethods: [
@@ -235,21 +351,44 @@ var INDEXER_CONFIGS = {
235
351
  php: {
236
352
  language: "php",
237
353
  indexerBinary: "scip-php",
354
+ projectLocalBinaries: ["vendor/davidrjenni/scip-php/bin/scip-php", "vendor/bin/scip-php"],
238
355
  checkCommand: "scip-php --version",
239
- indexArgs: ({ outputPath }) => ({
240
- binary: "scip-php",
241
- args: ["index", "--output", outputPath]
242
- }),
356
+ indexArgs: ({ projectRoot: projectRoot2, indexerBinary }) => {
357
+ const localBinary = join2(projectRoot2, "vendor", "bin", "scip-php");
358
+ const nestedLocalBinary = join2(projectRoot2, "vendor", "davidrjenni", "scip-php", "bin", "scip-php");
359
+ const targetBinary = existsSync2(nestedLocalBinary) ? nestedLocalBinary : existsSync2(localBinary) ? localBinary : indexerBinary;
360
+ return {
361
+ binary: "php",
362
+ args: [
363
+ "-d",
364
+ "error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",
365
+ targetBinary
366
+ ]
367
+ };
368
+ },
369
+ defaultOutputPath: "index.scip",
243
370
  markerFiles: ["composer.json"],
244
- installMethods: [
245
- { label: "composer", prerequisite: "composer", binary: "composer", args: ["global", "require", "davidrjenni/scip-php"] }
246
- ],
371
+ installMethods: [],
247
372
  installUrl: "https://github.com/davidrjenni/scip-php/releases"
248
373
  }
249
374
  };
250
375
  function getIndexerConfig(language) {
251
376
  return INDEXER_CONFIGS[language];
252
377
  }
378
+ function resolveDotnetProject(projectRoot2, suffixes) {
379
+ let entries;
380
+ try {
381
+ entries = readdirSync2(projectRoot2);
382
+ } catch {
383
+ return null;
384
+ }
385
+ for (const entry of entries) {
386
+ if (suffixes.some((suffix) => entry.endsWith(suffix))) {
387
+ return join2(projectRoot2, entry);
388
+ }
389
+ }
390
+ return null;
391
+ }
253
392
 
254
393
  // src/reindex/index.ts
255
394
  async function reindex(opts) {
@@ -259,8 +398,8 @@ async function reindex(opts) {
259
398
  onStatus = console.log,
260
399
  skipAutoInstall = false
261
400
  } = opts;
262
- const outputScip2 = opts.outputScip ?? join2(projectRoot2, "index.scip");
263
- const outputDb2 = opts.outputDb ?? join2(projectRoot2, "index.db");
401
+ const outputScip2 = opts.outputScip ?? join3(projectRoot2, "index.scip");
402
+ const outputDb2 = opts.outputDb ?? join3(projectRoot2, "index.db");
264
403
  const start = Date.now();
265
404
  const languages2 = opts.languages ?? detectLanguages(projectRoot2);
266
405
  if (languages2.length === 0) {
@@ -289,7 +428,8 @@ async function reindex(opts) {
289
428
  for (const lang of languages2) {
290
429
  const config = getIndexerConfig(lang);
291
430
  const binaryLabel = describeIndexerBinary(config);
292
- if (!isIndexerInstalled(config)) {
431
+ const projectLocalBinary = resolveProjectLocalIndexerBinary(config, projectRoot2);
432
+ if (!projectLocalBinary && !isIndexerInstalled(config)) {
293
433
  if (skipAutoInstall) {
294
434
  throw new Error(
295
435
  `${binaryLabel} is required to index ${lang} but not found on PATH.
@@ -304,7 +444,7 @@ async function reindex(opts) {
304
444
  );
305
445
  }
306
446
  }
307
- const resolvedBinary = resolveIndexerBinary(config);
447
+ const resolvedBinary = projectLocalBinary ?? resolveIndexerBinary(config);
308
448
  if (!resolvedBinary) {
309
449
  throw new Error(
310
450
  `${binaryLabel} is required to index ${lang} but was not found on PATH after installation checks.
@@ -312,6 +452,7 @@ async function reindex(opts) {
312
452
  );
313
453
  }
314
454
  onStatus(`Indexing ${lang} with ${resolvedBinary}...`);
455
+ const indexerEnv = getIndexerExecutionEnv(config, env, resolvedBinary);
315
456
  const { binary, args } = config.indexArgs({
316
457
  projectRoot: projectRoot2,
317
458
  outputPath: outputScip2,
@@ -321,7 +462,7 @@ async function reindex(opts) {
321
462
  try {
322
463
  execFileSync(binary, args, {
323
464
  cwd: projectRoot2,
324
- env,
465
+ env: indexerEnv,
325
466
  stdio: "pipe",
326
467
  maxBuffer: 50 * 1024 * 1024
327
468
  });
@@ -332,9 +473,10 @@ async function reindex(opts) {
332
473
  Make sure ${binaryLabel} is installed and available on PATH.`
333
474
  );
334
475
  }
476
+ moveDefaultOutputIfNeeded(config, projectRoot2, outputScip2);
335
477
  }
336
478
  onStatus("Converting to SQLite...");
337
- if (!existsSync2(outputScip2)) {
479
+ if (!existsSync3(outputScip2)) {
338
480
  throw new Error(`SCIP index not found at ${outputScip2} after indexing`);
339
481
  }
340
482
  try {
@@ -351,6 +493,15 @@ Make sure ${binaryLabel} is installed and available on PATH.`
351
493
  onStatus(`Done in ${(durationMs / 1e3).toFixed(1)}s`);
352
494
  return { languages: languages2, indexPath: outputScip2, dbPath: outputDb2, durationMs };
353
495
  }
496
+ function moveDefaultOutputIfNeeded(config, projectRoot2, outputScip2) {
497
+ if (!config.defaultOutputPath) {
498
+ return;
499
+ }
500
+ const defaultOutputPath = join3(projectRoot2, config.defaultOutputPath);
501
+ if (outputScip2 !== defaultOutputPath && existsSync3(defaultOutputPath)) {
502
+ renameSync(defaultOutputPath, outputScip2);
503
+ }
504
+ }
354
505
 
355
506
  // src/reindex-worker.ts
356
507
  var projectRoot = process.env["SCIP_REINDEX_PROJECT_ROOT"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scip-query",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Language-agnostic code intelligence CLI powered by SCIP indexes",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",