pybao-cli 1.4.7 → 1.4.9
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/dist/REPL-C24XFEP6.js +47 -0
- package/dist/{acp-GM5ZLLWL.js → acp-QH2AO2Z7.js} +29 -29
- package/dist/{agentsValidate-WC6LPC2Y.js → agentsValidate-363HO3Y7.js} +7 -7
- package/dist/{ask-ZBM4HNZQ.js → ask-D6443SK7.js} +28 -28
- package/dist/{autoUpdater-HN6KJGNR.js → autoUpdater-Z5BWB7SK.js} +3 -3
- package/dist/{chunk-AULC4JKP.js → chunk-2LIPGEYE.js} +1 -1
- package/dist/{chunk-LSTMIZGW.js → chunk-2S3XVY7W.js} +3 -3
- package/dist/{chunk-JWNACYBV.js → chunk-4IHCUY7U.js} +2 -2
- package/dist/{chunk-NMDSZD6K.js → chunk-56HPU3V3.js} +2 -2
- package/dist/{chunk-IMCASXJK.js → chunk-6NF4EI5N.js} +2 -2
- package/dist/{chunk-CHICDAKI.js → chunk-AKGLH4UH.js} +1 -1
- package/dist/{chunk-JG4BIMZU.js → chunk-BPPTETV3.js} +3 -3
- package/dist/{chunk-C2QGXPD2.js → chunk-CYGWGENL.js} +35 -35
- package/dist/{chunk-SJ2OFXCY.js → chunk-DFET2PYQ.js} +1 -1
- package/dist/{chunk-3HAQPWY6.js → chunk-EFYXFPIK.js} +4 -4
- package/dist/{chunk-KGQCMCA6.js → chunk-G4CZY75R.js} +2 -2
- package/dist/{chunk-HSGTUEP4.js → chunk-GBL67WXT.js} +2 -2
- package/dist/{chunk-FS7LPXXI.js → chunk-I2WNU3WO.js} +3 -3
- package/dist/{chunk-CFACH2CF.js → chunk-IGS37KOP.js} +3 -3
- package/dist/{chunk-VQNZYMYG.js → chunk-JFOCUKC6.js} +16 -16
- package/dist/{chunk-QOQX3GTA.js → chunk-KWQ7GG5W.js} +1 -1
- package/dist/{chunk-ADORAPRT.js → chunk-MWKWMSJS.js} +2 -2
- package/dist/{chunk-XUI3VI56.js → chunk-OQEZE2RG.js} +1 -1
- package/dist/{chunk-4KDI6ZVO.js → chunk-Q3V6WA5W.js} +3 -3
- package/dist/{chunk-QN34G5Z4.js → chunk-Q4TF5Q7J.js} +3 -3
- package/dist/{chunk-S6QV2RGH.js → chunk-Q764S7V2.js} +1 -1
- package/dist/{chunk-TJKOGIK7.js → chunk-SWIZJIUS.js} +1 -1
- package/dist/{chunk-TXBGJHRH.js → chunk-TG2OJPT2.js} +109 -66
- package/dist/chunk-TG2OJPT2.js.map +7 -0
- package/dist/{chunk-63FMMZNX.js → chunk-UV3WW35D.js} +4 -4
- package/dist/{chunk-2EKJ6L6V.js → chunk-VPFEFLAM.js} +1 -1
- package/dist/{chunk-2EKJ6L6V.js.map → chunk-VPFEFLAM.js.map} +1 -1
- package/dist/{chunk-24ZA53JP.js → chunk-VZ6RRYGR.js} +3 -3
- package/dist/{chunk-O75JFEY7.js → chunk-W2UOMAVQ.js} +4 -4
- package/dist/{chunk-6QI4XA7V.js → chunk-ZDRGJEVR.js} +1 -1
- package/dist/{chunk-5XPJRJ3D.js → chunk-ZK6UYBNR.js} +2 -2
- package/dist/{chunk-QATTF57S.js → chunk-ZLBA2Q7J.js} +1 -1
- package/dist/{cli-BXCXHEZ3.js → cli-RWHOOZZI.js} +87 -87
- package/dist/commands-5VRIC5TE.js +51 -0
- package/dist/{config-KDQJTCBE.js → config-CFDHIHJN.js} +4 -4
- package/dist/{context-FU4FKHCQ.js → context-IGAEG6FZ.js} +6 -6
- package/dist/{customCommands-6VDTREIJ.js → customCommands-JO6E5D6T.js} +4 -4
- package/dist/{env-FLTIIVJ4.js → env-HQDBKEF5.js} +2 -2
- package/dist/{file-QALIU4DM.js → file-SC7JXJ27.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-HS5KESAS.js → llm-BDBCIMN2.js} +29 -29
- package/dist/{llmLazy-VB3PC7KK.js → llmLazy-UZQTDOZ5.js} +1 -1
- package/dist/{loader-CFIKHLLM.js → loader-UYGVY5CR.js} +4 -4
- package/dist/{lsp-I3KIEY2I.js → lsp-W5TCXUUB.js} +6 -6
- package/dist/{lspAnchor-UIULTQRE.js → lspAnchor-VMQCMJOP.js} +6 -6
- package/dist/{mcp-XB4BQSEH.js → mcp-UBXRSOM6.js} +7 -7
- package/dist/{mentionProcessor-LPBDBQJJ.js → mentionProcessor-HIGHVPUA.js} +5 -5
- package/dist/{messages-Y74MDYW4.js → messages-GQH5UEOF.js} +1 -1
- package/dist/{model-QWVA7V7X.js → model-NFIKM3GT.js} +5 -5
- package/dist/{openai-WJQZT7M7.js → openai-KWAV44O2.js} +5 -5
- package/dist/{outputStyles-U4LUFQIO.js → outputStyles-JLMNWEST.js} +4 -4
- package/dist/{pluginRuntime-YIGCDPXL.js → pluginRuntime-Y6FS4J6L.js} +6 -6
- package/dist/{pluginValidation-G6JAHP2M.js → pluginValidation-FXRUUXXH.js} +6 -6
- package/dist/prompts-NLTCSNRW.js +53 -0
- package/dist/{pybAgentSessionLoad-2BV43P65.js → pybAgentSessionLoad-AMW7YJ7D.js} +4 -4
- package/dist/{pybAgentSessionResume-JNWIQLZZ.js → pybAgentSessionResume-4ZH3ZVOW.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-KISLGOWY.js → pybAgentStreamJsonSession-A44E3QA3.js} +1 -1
- package/dist/{pybHooks-JAO74GKA.js → pybHooks-SZEGOY2X.js} +4 -4
- package/dist/query-5RIG5OL2.js +55 -0
- package/dist/{registry-W5WUCQRO.js → registry-JC6O7W3B.js} +5 -5
- package/dist/{ripgrep-L3CQA3CA.js → ripgrep-4F22WSCL.js} +3 -3
- package/dist/{skillMarketplace-NHC3THAO.js → skillMarketplace-UVVFWVLB.js} +3 -3
- package/dist/{state-H6YRT5DC.js → state-6NYEDSIP.js} +2 -2
- package/dist/{theme-MZ7YQPQS.js → theme-TMUGKZXA.js} +5 -5
- package/dist/{toolPermissionSettings-STCI353S.js → toolPermissionSettings-OD4RHJMA.js} +6 -6
- package/dist/tools-JM57LWBF.js +52 -0
- package/dist/{userInput-VQ6W3IR7.js → userInput-7JZUCONM.js} +30 -30
- package/package.json +1 -1
- package/dist/REPL-IDBVO23T.js +0 -47
- package/dist/chunk-TXBGJHRH.js.map +0 -7
- package/dist/commands-ZRLP3DJJ.js +0 -51
- package/dist/prompts-722EFDJT.js +0 -53
- package/dist/query-QGQ37WWS.js +0 -55
- package/dist/tools-DRISH452.js +0 -52
- /package/dist/{REPL-IDBVO23T.js.map → REPL-C24XFEP6.js.map} +0 -0
- /package/dist/{acp-GM5ZLLWL.js.map → acp-QH2AO2Z7.js.map} +0 -0
- /package/dist/{agentsValidate-WC6LPC2Y.js.map → agentsValidate-363HO3Y7.js.map} +0 -0
- /package/dist/{ask-ZBM4HNZQ.js.map → ask-D6443SK7.js.map} +0 -0
- /package/dist/{autoUpdater-HN6KJGNR.js.map → autoUpdater-Z5BWB7SK.js.map} +0 -0
- /package/dist/{chunk-AULC4JKP.js.map → chunk-2LIPGEYE.js.map} +0 -0
- /package/dist/{chunk-LSTMIZGW.js.map → chunk-2S3XVY7W.js.map} +0 -0
- /package/dist/{chunk-JWNACYBV.js.map → chunk-4IHCUY7U.js.map} +0 -0
- /package/dist/{chunk-NMDSZD6K.js.map → chunk-56HPU3V3.js.map} +0 -0
- /package/dist/{chunk-IMCASXJK.js.map → chunk-6NF4EI5N.js.map} +0 -0
- /package/dist/{chunk-CHICDAKI.js.map → chunk-AKGLH4UH.js.map} +0 -0
- /package/dist/{chunk-JG4BIMZU.js.map → chunk-BPPTETV3.js.map} +0 -0
- /package/dist/{chunk-C2QGXPD2.js.map → chunk-CYGWGENL.js.map} +0 -0
- /package/dist/{chunk-SJ2OFXCY.js.map → chunk-DFET2PYQ.js.map} +0 -0
- /package/dist/{chunk-3HAQPWY6.js.map → chunk-EFYXFPIK.js.map} +0 -0
- /package/dist/{chunk-KGQCMCA6.js.map → chunk-G4CZY75R.js.map} +0 -0
- /package/dist/{chunk-HSGTUEP4.js.map → chunk-GBL67WXT.js.map} +0 -0
- /package/dist/{chunk-FS7LPXXI.js.map → chunk-I2WNU3WO.js.map} +0 -0
- /package/dist/{chunk-CFACH2CF.js.map → chunk-IGS37KOP.js.map} +0 -0
- /package/dist/{chunk-VQNZYMYG.js.map → chunk-JFOCUKC6.js.map} +0 -0
- /package/dist/{chunk-QOQX3GTA.js.map → chunk-KWQ7GG5W.js.map} +0 -0
- /package/dist/{chunk-ADORAPRT.js.map → chunk-MWKWMSJS.js.map} +0 -0
- /package/dist/{chunk-XUI3VI56.js.map → chunk-OQEZE2RG.js.map} +0 -0
- /package/dist/{chunk-4KDI6ZVO.js.map → chunk-Q3V6WA5W.js.map} +0 -0
- /package/dist/{chunk-QN34G5Z4.js.map → chunk-Q4TF5Q7J.js.map} +0 -0
- /package/dist/{chunk-S6QV2RGH.js.map → chunk-Q764S7V2.js.map} +0 -0
- /package/dist/{chunk-TJKOGIK7.js.map → chunk-SWIZJIUS.js.map} +0 -0
- /package/dist/{chunk-63FMMZNX.js.map → chunk-UV3WW35D.js.map} +0 -0
- /package/dist/{chunk-24ZA53JP.js.map → chunk-VZ6RRYGR.js.map} +0 -0
- /package/dist/{chunk-O75JFEY7.js.map → chunk-W2UOMAVQ.js.map} +0 -0
- /package/dist/{chunk-6QI4XA7V.js.map → chunk-ZDRGJEVR.js.map} +0 -0
- /package/dist/{chunk-5XPJRJ3D.js.map → chunk-ZK6UYBNR.js.map} +0 -0
- /package/dist/{chunk-QATTF57S.js.map → chunk-ZLBA2Q7J.js.map} +0 -0
- /package/dist/{cli-BXCXHEZ3.js.map → cli-RWHOOZZI.js.map} +0 -0
- /package/dist/{commands-ZRLP3DJJ.js.map → commands-5VRIC5TE.js.map} +0 -0
- /package/dist/{config-KDQJTCBE.js.map → config-CFDHIHJN.js.map} +0 -0
- /package/dist/{context-FU4FKHCQ.js.map → context-IGAEG6FZ.js.map} +0 -0
- /package/dist/{customCommands-6VDTREIJ.js.map → customCommands-JO6E5D6T.js.map} +0 -0
- /package/dist/{env-FLTIIVJ4.js.map → env-HQDBKEF5.js.map} +0 -0
- /package/dist/{file-QALIU4DM.js.map → file-SC7JXJ27.js.map} +0 -0
- /package/dist/{llm-HS5KESAS.js.map → llm-BDBCIMN2.js.map} +0 -0
- /package/dist/{llmLazy-VB3PC7KK.js.map → llmLazy-UZQTDOZ5.js.map} +0 -0
- /package/dist/{loader-CFIKHLLM.js.map → loader-UYGVY5CR.js.map} +0 -0
- /package/dist/{lsp-I3KIEY2I.js.map → lsp-W5TCXUUB.js.map} +0 -0
- /package/dist/{lspAnchor-UIULTQRE.js.map → lspAnchor-VMQCMJOP.js.map} +0 -0
- /package/dist/{mcp-XB4BQSEH.js.map → mcp-UBXRSOM6.js.map} +0 -0
- /package/dist/{mentionProcessor-LPBDBQJJ.js.map → mentionProcessor-HIGHVPUA.js.map} +0 -0
- /package/dist/{messages-Y74MDYW4.js.map → messages-GQH5UEOF.js.map} +0 -0
- /package/dist/{model-QWVA7V7X.js.map → model-NFIKM3GT.js.map} +0 -0
- /package/dist/{openai-WJQZT7M7.js.map → openai-KWAV44O2.js.map} +0 -0
- /package/dist/{outputStyles-U4LUFQIO.js.map → outputStyles-JLMNWEST.js.map} +0 -0
- /package/dist/{pluginRuntime-YIGCDPXL.js.map → pluginRuntime-Y6FS4J6L.js.map} +0 -0
- /package/dist/{pluginValidation-G6JAHP2M.js.map → pluginValidation-FXRUUXXH.js.map} +0 -0
- /package/dist/{prompts-722EFDJT.js.map → prompts-NLTCSNRW.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-2BV43P65.js.map → pybAgentSessionLoad-AMW7YJ7D.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-JNWIQLZZ.js.map → pybAgentSessionResume-4ZH3ZVOW.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-KISLGOWY.js.map → pybAgentStreamJsonSession-A44E3QA3.js.map} +0 -0
- /package/dist/{pybHooks-JAO74GKA.js.map → pybHooks-SZEGOY2X.js.map} +0 -0
- /package/dist/{query-QGQ37WWS.js.map → query-5RIG5OL2.js.map} +0 -0
- /package/dist/{registry-W5WUCQRO.js.map → registry-JC6O7W3B.js.map} +0 -0
- /package/dist/{ripgrep-L3CQA3CA.js.map → ripgrep-4F22WSCL.js.map} +0 -0
- /package/dist/{skillMarketplace-NHC3THAO.js.map → skillMarketplace-UVVFWVLB.js.map} +0 -0
- /package/dist/{state-H6YRT5DC.js.map → state-6NYEDSIP.js.map} +0 -0
- /package/dist/{theme-MZ7YQPQS.js.map → theme-TMUGKZXA.js.map} +0 -0
- /package/dist/{toolPermissionSettings-STCI353S.js.map → toolPermissionSettings-OD4RHJMA.js.map} +0 -0
- /package/dist/{tools-DRISH452.js.map → tools-JM57LWBF.js.map} +0 -0
- /package/dist/{userInput-VQ6W3IR7.js.map → userInput-7JZUCONM.js.map} +0 -0
|
@@ -2,15 +2,15 @@ import { createRequire as __pybCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __pybCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
loadSettingsWithLegacyFallback
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OQEZE2RG.js";
|
|
6
6
|
import {
|
|
7
7
|
debug
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DFET2PYQ.js";
|
|
9
9
|
import {
|
|
10
10
|
env,
|
|
11
11
|
getCwd,
|
|
12
12
|
resolveXdgDataPath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AKGLH4UH.js";
|
|
14
14
|
import {
|
|
15
15
|
__require
|
|
16
16
|
} from "./chunk-I3J4JYES.js";
|
|
@@ -20,6 +20,9 @@ import { join as join2, dirname, basename } from "path";
|
|
|
20
20
|
import { fileURLToPath } from "url";
|
|
21
21
|
import { existsSync as existsSync2, mkdirSync, mkdtempSync, rmSync, readdirSync, writeFileSync, chmodSync, renameSync, statSync as statSync2 } from "fs";
|
|
22
22
|
import { tmpdir } from "os";
|
|
23
|
+
import { spawn } from "child_process";
|
|
24
|
+
import { createRequire } from "module";
|
|
25
|
+
import which from "which";
|
|
23
26
|
|
|
24
27
|
// src/tools/search/LspTool/utils.ts
|
|
25
28
|
import { join, relative } from "path";
|
|
@@ -75,11 +78,76 @@ async function findNearestRoot(startDir, markers, options) {
|
|
|
75
78
|
// src/tools/search/LspTool/registry.ts
|
|
76
79
|
var __filename = fileURLToPath(import.meta.url);
|
|
77
80
|
var __dirname = dirname(__filename);
|
|
81
|
+
var nodeRequire = createRequire(import.meta.url);
|
|
78
82
|
var lspInstallDir = getLspBinDir();
|
|
79
83
|
var getEnvPackageRoot = () => {
|
|
80
84
|
const root = process.env.PYB_PACKAGE_ROOT?.trim();
|
|
81
85
|
return root || "";
|
|
82
86
|
};
|
|
87
|
+
var getBunRuntime = () => globalThis.Bun;
|
|
88
|
+
var safeWhich = (cmd) => {
|
|
89
|
+
const bun = getBunRuntime();
|
|
90
|
+
if (bun?.which) return bun.which(cmd);
|
|
91
|
+
try {
|
|
92
|
+
return which.sync(cmd);
|
|
93
|
+
} catch {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var safeResolvePackage = async (name, rootPath) => {
|
|
98
|
+
const bun = getBunRuntime();
|
|
99
|
+
if (bun?.resolve) {
|
|
100
|
+
await bun.resolve(name, rootPath);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
nodeRequire.resolve(name, { paths: [rootPath] });
|
|
105
|
+
return true;
|
|
106
|
+
} catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var spawnProcess = async (cmd, options) => {
|
|
111
|
+
const bun = getBunRuntime();
|
|
112
|
+
if (bun?.spawn) {
|
|
113
|
+
const proc = bun.spawn({
|
|
114
|
+
cmd,
|
|
115
|
+
cwd: options.cwd,
|
|
116
|
+
env: options.env,
|
|
117
|
+
stdout: "pipe",
|
|
118
|
+
stderr: "pipe",
|
|
119
|
+
stdin: "pipe"
|
|
120
|
+
});
|
|
121
|
+
const [stdout, stderr, exitCode] = await Promise.all([
|
|
122
|
+
new Response(proc.stdout).text(),
|
|
123
|
+
new Response(proc.stderr).text(),
|
|
124
|
+
proc.exited
|
|
125
|
+
]);
|
|
126
|
+
return { stdout, stderr, exitCode };
|
|
127
|
+
}
|
|
128
|
+
return await new Promise((resolve) => {
|
|
129
|
+
const [command, ...args] = cmd;
|
|
130
|
+
const child = spawn(command, args, {
|
|
131
|
+
cwd: options.cwd,
|
|
132
|
+
env: options.env,
|
|
133
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
134
|
+
});
|
|
135
|
+
let stdout = "";
|
|
136
|
+
let stderr = "";
|
|
137
|
+
child.stdout?.on("data", (chunk) => {
|
|
138
|
+
stdout += chunk.toString();
|
|
139
|
+
});
|
|
140
|
+
child.stderr?.on("data", (chunk) => {
|
|
141
|
+
stderr += chunk.toString();
|
|
142
|
+
});
|
|
143
|
+
child.on("error", (error) => {
|
|
144
|
+
resolve({ stdout, stderr: `${stderr}${String(error)}`, exitCode: 1 });
|
|
145
|
+
});
|
|
146
|
+
child.on("close", (code) => {
|
|
147
|
+
resolve({ stdout, stderr, exitCode: code ?? 1 });
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
83
151
|
var installNotices = [];
|
|
84
152
|
var HEAVY_LSP_SERVERS = /* @__PURE__ */ new Set([
|
|
85
153
|
"eslint",
|
|
@@ -134,11 +202,11 @@ function resolveRuntimeCommand() {
|
|
|
134
202
|
return process.execPath;
|
|
135
203
|
}
|
|
136
204
|
}
|
|
137
|
-
const nodeBin =
|
|
205
|
+
const nodeBin = safeWhich("node");
|
|
138
206
|
if (nodeBin && existsSync2(nodeBin)) {
|
|
139
207
|
return nodeBin;
|
|
140
208
|
}
|
|
141
|
-
const bunBin =
|
|
209
|
+
const bunBin = safeWhich("bun");
|
|
142
210
|
if (bunBin && existsSync2(bunBin)) {
|
|
143
211
|
return bunBin;
|
|
144
212
|
}
|
|
@@ -150,7 +218,7 @@ function resolveBunRuntimePath() {
|
|
|
150
218
|
if (process.execPath && existsSync2(process.execPath) && isBunExecutablePath(process.execPath)) {
|
|
151
219
|
return process.execPath;
|
|
152
220
|
}
|
|
153
|
-
const bunBin =
|
|
221
|
+
const bunBin = safeWhich("bun");
|
|
154
222
|
if (bunBin && existsSync2(bunBin)) return bunBin;
|
|
155
223
|
return "";
|
|
156
224
|
}
|
|
@@ -264,37 +332,23 @@ async function bunInstall(packages, cwd = lspInstallDir) {
|
|
|
264
332
|
if (!existsSync2(cwd)) {
|
|
265
333
|
mkdirSync(cwd, { recursive: true });
|
|
266
334
|
}
|
|
267
|
-
const
|
|
268
|
-
cmd: [bunBin, "install", ...packages],
|
|
335
|
+
const result = await spawnProcess([bunBin, "install", ...packages], {
|
|
269
336
|
cwd,
|
|
270
337
|
env: {
|
|
271
338
|
...process.env,
|
|
272
339
|
BUN_BE_BUN: "1"
|
|
273
|
-
}
|
|
274
|
-
stdout: "pipe",
|
|
275
|
-
stderr: "pipe",
|
|
276
|
-
stdin: "pipe"
|
|
340
|
+
}
|
|
277
341
|
});
|
|
278
|
-
|
|
279
|
-
return exitCode === 0;
|
|
342
|
+
return result.exitCode === 0;
|
|
280
343
|
}
|
|
281
344
|
async function runBinary(cmd, extraEnv, cwd = lspInstallDir) {
|
|
282
|
-
const
|
|
283
|
-
cmd,
|
|
345
|
+
const { stdout, stderr, exitCode } = await spawnProcess(cmd, {
|
|
284
346
|
cwd,
|
|
285
347
|
env: {
|
|
286
348
|
...process.env,
|
|
287
349
|
...extraEnv
|
|
288
|
-
}
|
|
289
|
-
stdout: "pipe",
|
|
290
|
-
stderr: "pipe",
|
|
291
|
-
stdin: "pipe"
|
|
350
|
+
}
|
|
292
351
|
});
|
|
293
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
294
|
-
new Response(proc.stdout).text(),
|
|
295
|
-
new Response(proc.stderr).text(),
|
|
296
|
-
proc.exited
|
|
297
|
-
]);
|
|
298
352
|
if (exitCode === 0) {
|
|
299
353
|
return { ok: true };
|
|
300
354
|
}
|
|
@@ -316,17 +370,7 @@ async function runBinaryWithTimeout(cmd, extraEnv, cwd, timeoutMs) {
|
|
|
316
370
|
return result;
|
|
317
371
|
}
|
|
318
372
|
async function getJavaMajorVersion() {
|
|
319
|
-
const
|
|
320
|
-
cmd: ["java", "-version"],
|
|
321
|
-
stdout: "pipe",
|
|
322
|
-
stderr: "pipe",
|
|
323
|
-
stdin: "pipe"
|
|
324
|
-
});
|
|
325
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
326
|
-
new Response(proc.stdout).text(),
|
|
327
|
-
new Response(proc.stderr).text(),
|
|
328
|
-
proc.exited
|
|
329
|
-
]);
|
|
373
|
+
const { stdout, stderr, exitCode } = await spawnProcess(["java", "-version"], {});
|
|
330
374
|
if (exitCode !== 0) return null;
|
|
331
375
|
const output = `${stderr}
|
|
332
376
|
${stdout}`;
|
|
@@ -350,6 +394,7 @@ async function installEslintServer(installDir = lspInstallDir) {
|
|
|
350
394
|
if (!existsSync2(installDir)) {
|
|
351
395
|
mkdirSync(installDir, { recursive: true });
|
|
352
396
|
}
|
|
397
|
+
const runtime = getBunRuntime() ? "bun" : "node";
|
|
353
398
|
debug.info("LSP_INSTALL", { server: "eslint", action: "start" });
|
|
354
399
|
try {
|
|
355
400
|
await downloadAndExtractArchive({
|
|
@@ -361,7 +406,7 @@ async function installEslintServer(installDir = lspInstallDir) {
|
|
|
361
406
|
const extractedPath = join2(installDir, "vscode-eslint-main");
|
|
362
407
|
const finalPath = getEslintInstallDir(installDir);
|
|
363
408
|
if (!existsSync2(extractedPath)) {
|
|
364
|
-
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: "extracted path missing" });
|
|
409
|
+
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: "extracted path missing", runtime });
|
|
365
410
|
return false;
|
|
366
411
|
}
|
|
367
412
|
if (existsSync2(finalPath)) {
|
|
@@ -369,29 +414,29 @@ async function installEslintServer(installDir = lspInstallDir) {
|
|
|
369
414
|
}
|
|
370
415
|
renameSync(extractedPath, finalPath);
|
|
371
416
|
const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
372
|
-
if (!
|
|
373
|
-
debug.error("LSP_MISSING_DEP", { server: "eslint", error: `${npmCmd} not found
|
|
417
|
+
if (!safeWhich(npmCmd)) {
|
|
418
|
+
debug.error("LSP_MISSING_DEP", { server: "eslint", error: `${npmCmd} not found`, runtime });
|
|
374
419
|
return false;
|
|
375
420
|
}
|
|
376
421
|
const timeoutMs = getInstallTimeoutMs();
|
|
377
422
|
const installResult = await runBinaryWithTimeout([npmCmd, "install"], void 0, finalPath, timeoutMs);
|
|
378
423
|
if (!installResult.ok) {
|
|
379
|
-
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: installResult.error });
|
|
424
|
+
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: installResult.error, runtime });
|
|
380
425
|
return false;
|
|
381
426
|
}
|
|
382
427
|
const compileResult = await runBinaryWithTimeout([npmCmd, "run", "compile"], void 0, finalPath, timeoutMs);
|
|
383
428
|
if (!compileResult.ok) {
|
|
384
|
-
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: compileResult.error });
|
|
429
|
+
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: compileResult.error, runtime });
|
|
385
430
|
return false;
|
|
386
431
|
}
|
|
387
432
|
if (!existsSync2(serverPath)) {
|
|
388
|
-
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: "eslintServer.js not found" });
|
|
433
|
+
debug.error("LSP_INSTALL_FAILED", { server: "eslint", error: "eslintServer.js not found", runtime });
|
|
389
434
|
return false;
|
|
390
435
|
}
|
|
391
436
|
debug.info("LSP_INSTALL", { server: "eslint", action: "success" });
|
|
392
437
|
return true;
|
|
393
438
|
} catch (e) {
|
|
394
|
-
debug.error("LSP_INSTALL_ERROR", { server: "eslint", error: String(e) });
|
|
439
|
+
debug.error("LSP_INSTALL_ERROR", { server: "eslint", error: String(e), runtime });
|
|
395
440
|
return false;
|
|
396
441
|
}
|
|
397
442
|
}
|
|
@@ -681,7 +726,7 @@ function hasDenoConfig(rootPath) {
|
|
|
681
726
|
return ["deno.json", "deno.jsonc"].some((name) => existsSync2(join2(rootPath, name)));
|
|
682
727
|
}
|
|
683
728
|
function resolveTyBinary(rootPath) {
|
|
684
|
-
const direct =
|
|
729
|
+
const direct = safeWhich("ty");
|
|
685
730
|
if (direct) return direct;
|
|
686
731
|
const venvPaths = [process.env.VIRTUAL_ENV, join2(rootPath, ".venv"), join2(rootPath, "venv")].filter(
|
|
687
732
|
(value) => Boolean(value)
|
|
@@ -794,7 +839,7 @@ function multiResolveBinary(options) {
|
|
|
794
839
|
const cwd = options.cwd ?? process.cwd();
|
|
795
840
|
const localBinDir = join2(cwd, "node_modules", ".bin");
|
|
796
841
|
for (const binName of options.binNames) {
|
|
797
|
-
if (
|
|
842
|
+
if (safeWhich(binName)) {
|
|
798
843
|
return { command: binName, args: options.args ?? [] };
|
|
799
844
|
}
|
|
800
845
|
const localBin = resolveBinInDir(localBinDir, binName);
|
|
@@ -807,7 +852,8 @@ function multiResolveBinary(options) {
|
|
|
807
852
|
}
|
|
808
853
|
}
|
|
809
854
|
if (options.packageName) {
|
|
810
|
-
const bunBin =
|
|
855
|
+
const bunBin = resolveBunRuntimePath();
|
|
856
|
+
if (!bunBin) return null;
|
|
811
857
|
return { command: bunBin, args: ["x", options.packageName, ...options.args ?? []] };
|
|
812
858
|
}
|
|
813
859
|
return null;
|
|
@@ -938,7 +984,7 @@ async function installLuaLs(installDir) {
|
|
|
938
984
|
return true;
|
|
939
985
|
}
|
|
940
986
|
async function installZls(installDir) {
|
|
941
|
-
if (!
|
|
987
|
+
if (!safeWhich("zig")) {
|
|
942
988
|
throw new Error("zig not found");
|
|
943
989
|
}
|
|
944
990
|
const plan = planZlsDownload(installDir);
|
|
@@ -953,7 +999,7 @@ async function installZls(installDir) {
|
|
|
953
999
|
return true;
|
|
954
1000
|
}
|
|
955
1001
|
async function installElixirLs(installDir) {
|
|
956
|
-
if (!
|
|
1002
|
+
if (!safeWhich("elixir") || !safeWhich("mix")) {
|
|
957
1003
|
throw new Error("elixir or mix not found");
|
|
958
1004
|
}
|
|
959
1005
|
const plan = planElixirLsDownload(installDir);
|
|
@@ -973,7 +1019,7 @@ async function installElixirLs(installDir) {
|
|
|
973
1019
|
return true;
|
|
974
1020
|
}
|
|
975
1021
|
async function installJdtls(installDir) {
|
|
976
|
-
if (!
|
|
1022
|
+
if (!safeWhich("java")) {
|
|
977
1023
|
throw new Error("java not found");
|
|
978
1024
|
}
|
|
979
1025
|
const javaMajor = await getJavaMajorVersion();
|
|
@@ -990,13 +1036,13 @@ async function installJdtls(installDir) {
|
|
|
990
1036
|
return true;
|
|
991
1037
|
}
|
|
992
1038
|
function resolveMetalsBinary(installDir) {
|
|
993
|
-
const direct =
|
|
1039
|
+
const direct = safeWhich("metals");
|
|
994
1040
|
if (direct) return direct;
|
|
995
1041
|
const local = resolveBinInDir(installDir, "metals");
|
|
996
1042
|
return local || null;
|
|
997
1043
|
}
|
|
998
1044
|
async function installMetals(installDir) {
|
|
999
|
-
if (!
|
|
1045
|
+
if (!safeWhich("java")) {
|
|
1000
1046
|
throw new Error("java not found");
|
|
1001
1047
|
}
|
|
1002
1048
|
const javaMajor = await getJavaMajorVersion();
|
|
@@ -1004,7 +1050,7 @@ async function installMetals(installDir) {
|
|
|
1004
1050
|
throw new Error("java 17 or newer required");
|
|
1005
1051
|
}
|
|
1006
1052
|
if (resolveMetalsBinary(installDir)) return true;
|
|
1007
|
-
const installer =
|
|
1053
|
+
const installer = safeWhich("cs") ?? safeWhich("coursier");
|
|
1008
1054
|
if (!installer) {
|
|
1009
1055
|
throw new Error("coursier not found");
|
|
1010
1056
|
}
|
|
@@ -1051,7 +1097,7 @@ function getJdtlsConfigDir(installDir) {
|
|
|
1051
1097
|
}
|
|
1052
1098
|
var BaseLspServer = class {
|
|
1053
1099
|
isInPath(cmd) {
|
|
1054
|
-
return Boolean(
|
|
1100
|
+
return Boolean(safeWhich(cmd));
|
|
1055
1101
|
}
|
|
1056
1102
|
getLocalBinPath(binName, npmPackageName) {
|
|
1057
1103
|
const envPackageRoot = getEnvPackageRoot();
|
|
@@ -1441,7 +1487,7 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1441
1487
|
rootMarkers: ["deno.json", "deno.jsonc"],
|
|
1442
1488
|
isEnabled: async (rootPath) => hasDenoConfig(rootPath),
|
|
1443
1489
|
spawn: async (rootPath) => {
|
|
1444
|
-
const deno =
|
|
1490
|
+
const deno = safeWhich("deno");
|
|
1445
1491
|
if (!deno) return null;
|
|
1446
1492
|
return { command: deno, args: ["lsp"] };
|
|
1447
1493
|
},
|
|
@@ -1503,13 +1549,10 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1503
1549
|
spawn: async (rootPath) => {
|
|
1504
1550
|
const serverPath = getEslintServerPath();
|
|
1505
1551
|
if (!existsSync2(serverPath)) return null;
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
}
|
|
1511
|
-
const bunBin = Bun.which("bun") ?? process.execPath;
|
|
1512
|
-
return { command: bunBin, args: [serverPath, "--stdio"] };
|
|
1552
|
+
const hasEslint = await safeResolvePackage("eslint", rootPath);
|
|
1553
|
+
if (!hasEslint) return null;
|
|
1554
|
+
const runtimeCommand = resolveBunRuntimePath() || resolveRuntimeCommand();
|
|
1555
|
+
return { command: runtimeCommand, args: [serverPath, "--stdio"] };
|
|
1513
1556
|
},
|
|
1514
1557
|
priority: -10,
|
|
1515
1558
|
group: "lint"
|
|
@@ -1690,7 +1733,7 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1690
1733
|
}
|
|
1691
1734
|
},
|
|
1692
1735
|
spawn: async () => {
|
|
1693
|
-
const java =
|
|
1736
|
+
const java = safeWhich("java");
|
|
1694
1737
|
if (!java) return null;
|
|
1695
1738
|
const javaMajor = await getJavaMajorVersion();
|
|
1696
1739
|
if (!javaMajor || javaMajor < 21) return null;
|
|
@@ -1754,7 +1797,7 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1754
1797
|
process.platform === "win32" ? "lua-language-server.exe" : "lua-language-server"
|
|
1755
1798
|
);
|
|
1756
1799
|
if (existing) return true;
|
|
1757
|
-
if (
|
|
1800
|
+
if (safeWhich("lua-language-server") || safeWhich("lua-ls")) return true;
|
|
1758
1801
|
const canInstall = await isAutoInstallEnabled();
|
|
1759
1802
|
if (!canInstall) return false;
|
|
1760
1803
|
ensureInstallDir();
|
|
@@ -1806,7 +1849,7 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1806
1849
|
process.platform === "win32" ? "language_server.bat" : "language_server.sh"
|
|
1807
1850
|
);
|
|
1808
1851
|
if (existing) return true;
|
|
1809
|
-
if (
|
|
1852
|
+
if (safeWhich("elixir-ls")) return true;
|
|
1810
1853
|
const canInstall = await isAutoInstallEnabled();
|
|
1811
1854
|
if (!canInstall) return false;
|
|
1812
1855
|
ensureInstallDir();
|
|
@@ -1819,7 +1862,7 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1819
1862
|
}
|
|
1820
1863
|
},
|
|
1821
1864
|
spawn: async (rootPath) => {
|
|
1822
|
-
if (
|
|
1865
|
+
if (safeWhich("elixir-ls")) {
|
|
1823
1866
|
return { command: "elixir-ls", args: [] };
|
|
1824
1867
|
}
|
|
1825
1868
|
const installDir = join2(lspInstallDir, "elixir-ls");
|
|
@@ -1836,7 +1879,7 @@ var LspServerRegistry = class _LspServerRegistry {
|
|
|
1836
1879
|
const installDir = join2(lspInstallDir, "zls");
|
|
1837
1880
|
const existing = findFileRecursive(installDir, process.platform === "win32" ? "zls.exe" : "zls");
|
|
1838
1881
|
if (existing) return true;
|
|
1839
|
-
if (
|
|
1882
|
+
if (safeWhich("zls")) return true;
|
|
1840
1883
|
const canInstall = await isAutoInstallEnabled();
|
|
1841
1884
|
if (!canInstall) return false;
|
|
1842
1885
|
ensureInstallDir();
|