lazycodex-ai 5.1.41 → 5.1.43
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.de.md +118 -0
- package/README.es.md +118 -0
- package/README.fr.md +118 -0
- package/README.it.md +118 -0
- package/README.ja.md +2 -1
- package/README.ko.md +2 -1
- package/README.md +3 -2
- package/README.pt-br.md +118 -0
- package/README.ru.md +2 -1
- package/README.zh-cn.md +2 -1
- package/dist/cli/index.js +187 -39
- package/dist/cli/service-auth/cli-keystore.fixture.d.ts +1 -7
- package/dist/cli/service-auth/index.d.ts +3 -0
- package/dist/cli/service-auth/keystore.d.ts +8 -2
- package/dist/cli/service-auth/secret-service-lock.d.ts +4 -0
- package/dist/cli/service-auth/session.d.ts +7 -1
- package/dist/cli-node/index.js +187 -39
- package/package.json +1 -1
- package/packages/lsp-daemon/dist/cli.js +363 -35
- package/packages/lsp-daemon/dist/client.js +341 -13
- package/packages/lsp-daemon/dist/index.js +344 -16
- package/packages/lsp-tools-mcp/dist/cli.js +333 -5
- package/packages/lsp-tools-mcp/dist/mcp.js +333 -5
- package/packages/lsp-tools-mcp/dist/tools.js +333 -5
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +68 -9
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +358 -36
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +2 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +2 -0
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +17 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +72 -11
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
|
@@ -4939,6 +4939,321 @@ function missingDependencyAvailability(error) {
|
|
|
4939
4939
|
}
|
|
4940
4940
|
}
|
|
4941
4941
|
|
|
4942
|
+
// ../lsp-core/src/lsp/bun-command-output.ts
|
|
4943
|
+
import { resolve as resolve10 } from "node:path";
|
|
4944
|
+
var TSC_LINE = /^(.+?)\((\d+),(\d+)\): (error|warning|message) (TS\d+): (.*)$/;
|
|
4945
|
+
var TSC_SEVERITY = { error: 1, warning: 2, message: 3 };
|
|
4946
|
+
function parseBunCheckOutput(stdout, cwd) {
|
|
4947
|
+
const results = [];
|
|
4948
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
4949
|
+
const match = TSC_LINE.exec(line);
|
|
4950
|
+
if (match) {
|
|
4951
|
+
const [, path, lineNumber, column, severity, code, message] = match;
|
|
4952
|
+
const start = { line: Number(lineNumber) - 1, character: Number(column) - 1 };
|
|
4953
|
+
results.push({
|
|
4954
|
+
file: resolve10(cwd, path ?? ""),
|
|
4955
|
+
diagnostic: {
|
|
4956
|
+
range: { start, end: start },
|
|
4957
|
+
severity: TSC_SEVERITY[severity ?? "error"] ?? 1,
|
|
4958
|
+
code: code ?? "",
|
|
4959
|
+
source: "bun check",
|
|
4960
|
+
message: message ?? ""
|
|
4961
|
+
}
|
|
4962
|
+
});
|
|
4963
|
+
continue;
|
|
4964
|
+
}
|
|
4965
|
+
const previous = results[results.length - 1];
|
|
4966
|
+
if (previous !== undefined && /^\s+\S/.test(line)) {
|
|
4967
|
+
previous.diagnostic.message = `${previous.diagnostic.message}
|
|
4968
|
+
${line.trim()}`;
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
return results;
|
|
4972
|
+
}
|
|
4973
|
+
function parseBunLintJson(stdout) {
|
|
4974
|
+
let parsed;
|
|
4975
|
+
try {
|
|
4976
|
+
parsed = JSON.parse(stdout);
|
|
4977
|
+
} catch {
|
|
4978
|
+
return;
|
|
4979
|
+
}
|
|
4980
|
+
if (!Array.isArray(parsed))
|
|
4981
|
+
return;
|
|
4982
|
+
const results = [];
|
|
4983
|
+
for (const entry of parsed) {
|
|
4984
|
+
if (entry === null || typeof entry !== "object")
|
|
4985
|
+
continue;
|
|
4986
|
+
const filePath = entry.filePath;
|
|
4987
|
+
const messages = entry.messages;
|
|
4988
|
+
if (typeof filePath !== "string" || !Array.isArray(messages))
|
|
4989
|
+
continue;
|
|
4990
|
+
for (const raw of messages) {
|
|
4991
|
+
const start = { line: Math.max(0, (raw.line ?? 1) - 1), character: Math.max(0, (raw.column ?? 1) - 1) };
|
|
4992
|
+
const end = {
|
|
4993
|
+
line: raw.endLine === undefined ? start.line : Math.max(0, raw.endLine - 1),
|
|
4994
|
+
character: raw.endColumn === undefined ? start.character : Math.max(0, raw.endColumn - 1)
|
|
4995
|
+
};
|
|
4996
|
+
results.push({
|
|
4997
|
+
file: filePath,
|
|
4998
|
+
diagnostic: {
|
|
4999
|
+
range: { start, end },
|
|
5000
|
+
severity: raw.severity === 2 ? 1 : 2,
|
|
5001
|
+
...raw.ruleId ? { code: raw.ruleId } : {},
|
|
5002
|
+
source: "bun lint",
|
|
5003
|
+
message: raw.message ?? ""
|
|
5004
|
+
}
|
|
5005
|
+
});
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
return results;
|
|
5009
|
+
}
|
|
5010
|
+
|
|
5011
|
+
// ../lsp-core/src/lsp/bun-project-checks.ts
|
|
5012
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
5013
|
+
import { existsSync as existsSync12, mkdtempSync, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5014
|
+
import { homedir as homedir2, tmpdir } from "node:os";
|
|
5015
|
+
import { dirname as dirname9, join as join8, resolve as resolve11 } from "node:path";
|
|
5016
|
+
var BUN_LOCKFILES = ["bun.lock", "bun.lockb", "bunfig.toml"];
|
|
5017
|
+
var RUNNABLE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".cts", ".cjs", ".js", ".mjs", ".mts"];
|
|
5018
|
+
var BIN_SUFFIXES = process.platform === "win32" ? [".exe", ".bunx", ".cmd", ""] : [""];
|
|
5019
|
+
var PROBE_TIMEOUT_MS = 1e4;
|
|
5020
|
+
var UNFORMATTED_PROBE = `const a=1
|
|
5021
|
+
`;
|
|
5022
|
+
var probeCache = new Map;
|
|
5023
|
+
function findBunProjectRoot(start, home = homedir2()) {
|
|
5024
|
+
const stopAt = resolve11(home);
|
|
5025
|
+
let dir = resolve11(start);
|
|
5026
|
+
for (;; ) {
|
|
5027
|
+
if (dir === stopAt)
|
|
5028
|
+
return;
|
|
5029
|
+
if (BUN_LOCKFILES.some((name) => existsSync12(join8(dir, name))))
|
|
5030
|
+
return dir;
|
|
5031
|
+
if (packageManagerIsBun(join8(dir, "package.json")))
|
|
5032
|
+
return dir;
|
|
5033
|
+
if (existsSync12(join8(dir, ".git")))
|
|
5034
|
+
return;
|
|
5035
|
+
const parent = dirname9(dir);
|
|
5036
|
+
if (parent === dir)
|
|
5037
|
+
return;
|
|
5038
|
+
dir = parent;
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
function packageManagerIsBun(packageJsonPath) {
|
|
5042
|
+
const manifest = readJsonObject(packageJsonPath);
|
|
5043
|
+
const packageManager = manifest?.["packageManager"];
|
|
5044
|
+
return typeof packageManager === "string" && packageManager.startsWith("bun@");
|
|
5045
|
+
}
|
|
5046
|
+
function readJsonObject(path) {
|
|
5047
|
+
if (!existsSync12(path))
|
|
5048
|
+
return;
|
|
5049
|
+
try {
|
|
5050
|
+
const parsed = JSON.parse(readFileSync5(path, "utf8"));
|
|
5051
|
+
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
|
|
5052
|
+
} catch {
|
|
5053
|
+
return;
|
|
5054
|
+
}
|
|
5055
|
+
}
|
|
5056
|
+
function isFile(path) {
|
|
5057
|
+
try {
|
|
5058
|
+
return statSync4(path).isFile();
|
|
5059
|
+
} catch {
|
|
5060
|
+
return false;
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
function isDirectory(path) {
|
|
5064
|
+
try {
|
|
5065
|
+
return statSync4(path).isDirectory();
|
|
5066
|
+
} catch {
|
|
5067
|
+
return false;
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
function projectShadowsBunCommand(command, cwd) {
|
|
5071
|
+
const packageJsonDir = nearestPackageJsonDir(cwd);
|
|
5072
|
+
if (packageJsonDir !== undefined) {
|
|
5073
|
+
const scripts = readJsonObject(join8(packageJsonDir, "package.json"))?.["scripts"];
|
|
5074
|
+
if (scripts !== null && typeof scripts === "object" && typeof scripts[command] === "string") {
|
|
5075
|
+
return true;
|
|
5076
|
+
}
|
|
5077
|
+
}
|
|
5078
|
+
if (command === "check")
|
|
5079
|
+
return false;
|
|
5080
|
+
const base = join8(cwd, command);
|
|
5081
|
+
if (isFile(base) || RUNNABLE_EXTENSIONS.some((extension) => isFile(`${base}${extension}`)))
|
|
5082
|
+
return true;
|
|
5083
|
+
if (isDirectory(base) && (isFile(join8(base, "package.json")) || RUNNABLE_EXTENSIONS.some((extension) => isFile(join8(base, `index${extension}`))))) {
|
|
5084
|
+
return true;
|
|
5085
|
+
}
|
|
5086
|
+
let dir = resolve11(cwd);
|
|
5087
|
+
for (;; ) {
|
|
5088
|
+
if (BIN_SUFFIXES.some((suffix) => existsSync12(join8(dir, "node_modules", ".bin", `${command}${suffix}`))))
|
|
5089
|
+
return true;
|
|
5090
|
+
const parent = dirname9(dir);
|
|
5091
|
+
if (parent === dir)
|
|
5092
|
+
return false;
|
|
5093
|
+
dir = parent;
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
function nearestPackageJsonDir(start) {
|
|
5097
|
+
let dir = resolve11(start);
|
|
5098
|
+
for (;; ) {
|
|
5099
|
+
if (existsSync12(join8(dir, "package.json")))
|
|
5100
|
+
return dir;
|
|
5101
|
+
const parent = dirname9(dir);
|
|
5102
|
+
if (parent === dir)
|
|
5103
|
+
return;
|
|
5104
|
+
dir = parent;
|
|
5105
|
+
}
|
|
5106
|
+
}
|
|
5107
|
+
function binaryIdentity(bunPath) {
|
|
5108
|
+
try {
|
|
5109
|
+
const stats = statSync4(bunPath);
|
|
5110
|
+
return `${stats.mtimeMs}:${stats.size}`;
|
|
5111
|
+
} catch {
|
|
5112
|
+
return "missing";
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
function bunHasCommand(bunPath, command, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
5116
|
+
const key = `${bunPath}\x00${binaryIdentity(bunPath)}\x00${command}`;
|
|
5117
|
+
const cached = probeCache.get(key);
|
|
5118
|
+
if (cached !== undefined)
|
|
5119
|
+
return cached;
|
|
5120
|
+
const probe = probeOnce(bunPath, command, timeoutMs).then((answer) => {
|
|
5121
|
+
if (answer === undefined)
|
|
5122
|
+
probeCache.delete(key);
|
|
5123
|
+
return answer === true;
|
|
5124
|
+
});
|
|
5125
|
+
probeCache.set(key, probe);
|
|
5126
|
+
return probe;
|
|
5127
|
+
}
|
|
5128
|
+
async function probeOnce(bunPath, command, timeoutMs) {
|
|
5129
|
+
const emptyDir = mkdtempSync(join8(tmpdir(), "omo-bun-probe-"));
|
|
5130
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
5131
|
+
try {
|
|
5132
|
+
const help = await runBunCommand(bunPath, [command, "--help"], emptyDir, timeout);
|
|
5133
|
+
if (help.exitCode === null)
|
|
5134
|
+
return;
|
|
5135
|
+
if (help.exitCode !== 0)
|
|
5136
|
+
return false;
|
|
5137
|
+
if (command !== "format")
|
|
5138
|
+
return true;
|
|
5139
|
+
const probeFile = join8(emptyDir, "probe.ts");
|
|
5140
|
+
writeFileSync3(probeFile, UNFORMATTED_PROBE);
|
|
5141
|
+
const write = await runBunCommand(bunPath, ["format", "--write", "probe.ts"], emptyDir, timeout);
|
|
5142
|
+
if (write.exitCode === null)
|
|
5143
|
+
return;
|
|
5144
|
+
return write.exitCode === 0 && readFileSync5(probeFile, "utf8") !== UNFORMATTED_PROBE;
|
|
5145
|
+
} catch {
|
|
5146
|
+
return;
|
|
5147
|
+
} finally {
|
|
5148
|
+
rmSync2(emptyDir, { recursive: true, force: true });
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
async function resolveBunProjectCommand(command, cwd, options = {}) {
|
|
5152
|
+
if (findBunProjectRoot(cwd, options.homeDir) === undefined)
|
|
5153
|
+
return;
|
|
5154
|
+
if (projectShadowsBunCommand(command, cwd))
|
|
5155
|
+
return;
|
|
5156
|
+
const bunPath = (options.resolveBun ?? defaultResolveBun)(cwd);
|
|
5157
|
+
if (!bunPath)
|
|
5158
|
+
return;
|
|
5159
|
+
return await bunHasCommand(bunPath, command) ? bunPath : undefined;
|
|
5160
|
+
}
|
|
5161
|
+
function defaultResolveBun(cwd) {
|
|
5162
|
+
return resolveServerBinary(["bun"], cwd);
|
|
5163
|
+
}
|
|
5164
|
+
function runBunCommand(bunPath, args, cwd, signal) {
|
|
5165
|
+
signal?.throwIfAborted();
|
|
5166
|
+
const prepared = createSpawnCommand([bunPath, ...args]);
|
|
5167
|
+
return new Promise((resolvePromise, reject) => {
|
|
5168
|
+
const child = spawn2(prepared.command, prepared.args, {
|
|
5169
|
+
cwd,
|
|
5170
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
5171
|
+
shell: prepared.shell,
|
|
5172
|
+
windowsHide: true,
|
|
5173
|
+
detached: process.platform !== "win32"
|
|
5174
|
+
});
|
|
5175
|
+
const stdout = [];
|
|
5176
|
+
const stderr = [];
|
|
5177
|
+
const onAbort = () => killProcessTree(child, "SIGKILL");
|
|
5178
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
5179
|
+
child.stdout?.on("data", (chunk) => stdout.push(chunk));
|
|
5180
|
+
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
5181
|
+
child.once("error", (error) => {
|
|
5182
|
+
signal?.removeEventListener("abort", onAbort);
|
|
5183
|
+
reject(error);
|
|
5184
|
+
});
|
|
5185
|
+
child.once("close", (exitCode) => {
|
|
5186
|
+
signal?.removeEventListener("abort", onAbort);
|
|
5187
|
+
if (signal?.aborted) {
|
|
5188
|
+
reject(signal.reason);
|
|
5189
|
+
return;
|
|
5190
|
+
}
|
|
5191
|
+
resolvePromise({
|
|
5192
|
+
exitCode,
|
|
5193
|
+
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
5194
|
+
stderr: Buffer.concat(stderr).toString("utf8")
|
|
5195
|
+
});
|
|
5196
|
+
});
|
|
5197
|
+
});
|
|
5198
|
+
}
|
|
5199
|
+
|
|
5200
|
+
// ../lsp-core/src/tools/bun-directory-diagnostics.ts
|
|
5201
|
+
var TYPESCRIPT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
5202
|
+
async function runBunDirectoryDiagnostics(absDir, extension, severity, signal, options = {}) {
|
|
5203
|
+
if (!TYPESCRIPT_EXTENSIONS.has(extension))
|
|
5204
|
+
return;
|
|
5205
|
+
const checkBun = await resolveBunProjectCommand("check", absDir, options);
|
|
5206
|
+
if (checkBun === undefined)
|
|
5207
|
+
return;
|
|
5208
|
+
let typecheck;
|
|
5209
|
+
try {
|
|
5210
|
+
const run = await runBunCommand(checkBun, ["check", "--no-pretty", "."], absDir, signal);
|
|
5211
|
+
typecheck = parseBunCheckOutput(run.stdout, absDir);
|
|
5212
|
+
const failedWithoutDiagnostics = run.exitCode === 1 && typecheck.length === 0;
|
|
5213
|
+
if (run.exitCode !== 0 && run.exitCode !== 1 || failedWithoutDiagnostics)
|
|
5214
|
+
return;
|
|
5215
|
+
} catch (error) {
|
|
5216
|
+
if (signal?.aborted)
|
|
5217
|
+
throw error;
|
|
5218
|
+
return;
|
|
5219
|
+
}
|
|
5220
|
+
const header = [`Directory: ${absDir}`, "Typecheck: bun check (files in this directory and everything they import)"];
|
|
5221
|
+
const projectCommands = ["bun check"];
|
|
5222
|
+
const collected = [...typecheck];
|
|
5223
|
+
const lintBun = await resolveBunProjectCommand("lint", absDir, options);
|
|
5224
|
+
if (lintBun !== undefined) {
|
|
5225
|
+
const lint = await runBunLint(lintBun, absDir, signal);
|
|
5226
|
+
header.push(lint.status);
|
|
5227
|
+
projectCommands.push("bun lint");
|
|
5228
|
+
collected.push(...lint.diagnostics);
|
|
5229
|
+
}
|
|
5230
|
+
const diagnostics = collected.filter(({ diagnostic }) => filterDiagnosticsBySeverity([diagnostic], severity).length > 0);
|
|
5231
|
+
const lines = [...header, `Total diagnostics: ${diagnostics.length}`];
|
|
5232
|
+
const shown = diagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
|
|
5233
|
+
if (shown.length > 0) {
|
|
5234
|
+
lines.push("", ...shown.map(({ file, diagnostic }) => `${file}: ${formatDiagnostic(diagnostic)}`));
|
|
5235
|
+
if (diagnostics.length > shown.length) {
|
|
5236
|
+
lines.push("", `... (${diagnostics.length - shown.length} more diagnostics not shown)`);
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5239
|
+
return { output: lines.join(`
|
|
5240
|
+
`), diagnostics, projectCommands };
|
|
5241
|
+
}
|
|
5242
|
+
async function runBunLint(bunPath, absDir, signal) {
|
|
5243
|
+
try {
|
|
5244
|
+
const run = await runBunCommand(bunPath, ["lint", "-f", "json", "."], absDir, signal);
|
|
5245
|
+
const diagnostics = run.exitCode === 0 || run.exitCode === 1 ? parseBunLintJson(run.stdout) : undefined;
|
|
5246
|
+
if (diagnostics !== undefined)
|
|
5247
|
+
return { status: "Lint: bun lint", diagnostics };
|
|
5248
|
+
const reason = run.stderr.trim().split(/\r?\n/)[0] ?? "";
|
|
5249
|
+
return { status: `Lint: bun lint could not lint (exit ${run.exitCode ?? "signal"})${reason ? `: ${reason}` : ""}`, diagnostics: [] };
|
|
5250
|
+
} catch (error) {
|
|
5251
|
+
if (signal?.aborted)
|
|
5252
|
+
throw error;
|
|
5253
|
+
return { status: `Lint: bun lint could not run: ${error instanceof Error ? error.message : String(error)}`, diagnostics: [] };
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
|
|
4942
5257
|
// ../lsp-core/src/tools/parameters.ts
|
|
4943
5258
|
function isRecord7(value) {
|
|
4944
5259
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -4993,7 +5308,7 @@ function asDiagnosticArray(result) {
|
|
|
4993
5308
|
return result;
|
|
4994
5309
|
return result.items ?? [];
|
|
4995
5310
|
}
|
|
4996
|
-
async function executeLspDiagnostics(params, signal) {
|
|
5311
|
+
async function executeLspDiagnostics(params, signal, bunOptions = {}) {
|
|
4997
5312
|
const filePath = requireString(params, "filePath");
|
|
4998
5313
|
const severity = severityFilter(params);
|
|
4999
5314
|
try {
|
|
@@ -5014,6 +5329,19 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5014
5329
|
};
|
|
5015
5330
|
return text(message, details);
|
|
5016
5331
|
}
|
|
5332
|
+
const bun = await runBunDirectoryDiagnostics(absPath, extension, severity, signal, bunOptions);
|
|
5333
|
+
if (bun !== undefined) {
|
|
5334
|
+
const details = {
|
|
5335
|
+
filePath,
|
|
5336
|
+
severity,
|
|
5337
|
+
mode: "directory",
|
|
5338
|
+
diagnostics: [...bun.diagnostics],
|
|
5339
|
+
totalDiagnostics: bun.diagnostics.length,
|
|
5340
|
+
truncated: bun.diagnostics.length > DEFAULT_MAX_DIAGNOSTICS,
|
|
5341
|
+
projectCommands: [...bun.projectCommands]
|
|
5342
|
+
};
|
|
5343
|
+
return text(bun.output, details);
|
|
5344
|
+
}
|
|
5017
5345
|
const output = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
|
|
5018
5346
|
const details = {
|
|
5019
5347
|
filePath,
|
|
@@ -5074,7 +5402,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5074
5402
|
}
|
|
5075
5403
|
}
|
|
5076
5404
|
// ../lsp-core/src/lsp/format-document.ts
|
|
5077
|
-
import { readFileSync as
|
|
5405
|
+
import { readFileSync as readFileSync6, renameSync as renameSync3, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
5078
5406
|
var DEFAULT_FORMATTING_OPTIONS = {
|
|
5079
5407
|
tabSize: 4,
|
|
5080
5408
|
insertSpaces: false,
|
|
@@ -5089,7 +5417,7 @@ async function formatDocumentWithClient(client, filePath, options = {}) {
|
|
|
5089
5417
|
return { status: "unavailable", reason: "capability_not_advertised" };
|
|
5090
5418
|
if (edits.length === 0)
|
|
5091
5419
|
return UNCHANGED;
|
|
5092
|
-
const before =
|
|
5420
|
+
const before = readFileSync6(filePath, "utf-8");
|
|
5093
5421
|
const normalized = normalizeTextEdits(before, edits, 0);
|
|
5094
5422
|
if (normalized.text === before)
|
|
5095
5423
|
return UNCHANGED;
|
|
@@ -5112,7 +5440,7 @@ function lineDelta(edits) {
|
|
|
5112
5440
|
}
|
|
5113
5441
|
function writeAtomically(filePath, content) {
|
|
5114
5442
|
const tempPath = `${filePath}.omo-format.tmp`;
|
|
5115
|
-
|
|
5443
|
+
writeFileSync4(tempPath, content, "utf-8");
|
|
5116
5444
|
try {
|
|
5117
5445
|
renameSync3(tempPath, filePath);
|
|
5118
5446
|
} catch (error) {
|
|
@@ -5417,7 +5745,7 @@ var LSP_MCP_TOOLS = [
|
|
|
5417
5745
|
name: "diagnostics",
|
|
5418
5746
|
aliases: ["lsp_diagnostics"],
|
|
5419
5747
|
title: "LSP Diagnostics",
|
|
5420
|
-
description: "Get errors, warnings, and hints for a source file or directory.",
|
|
5748
|
+
description: "Get errors, warnings, and hints for a source file or directory. In a Bun project, a TypeScript directory is typechecked with `bun check`, plus `bun lint` when the installed Bun has it.",
|
|
5421
5749
|
inputSchema: objectSchema({
|
|
5422
5750
|
filePath: { type: "string", description: "File or directory path to check." },
|
|
5423
5751
|
severity: {
|