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