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
|
@@ -3158,8 +3158,8 @@ async function disposeDefaultLspManager() {
|
|
|
3158
3158
|
}
|
|
3159
3159
|
// src/daemon-client.ts
|
|
3160
3160
|
import { connect } from "node:net";
|
|
3161
|
-
import { homedir as
|
|
3162
|
-
import { join as
|
|
3161
|
+
import { homedir as homedir4 } from "node:os";
|
|
3162
|
+
import { join as join9 } from "node:path";
|
|
3163
3163
|
import { setTimeout as delay } from "node:timers/promises";
|
|
3164
3164
|
|
|
3165
3165
|
// ../lsp-core/src/request-context.ts
|
|
@@ -5601,6 +5601,321 @@ function missingDependencyAvailability(error) {
|
|
|
5601
5601
|
}
|
|
5602
5602
|
}
|
|
5603
5603
|
|
|
5604
|
+
// ../lsp-core/src/lsp/bun-command-output.ts
|
|
5605
|
+
import { resolve as resolve10 } from "node:path";
|
|
5606
|
+
var TSC_LINE = /^(.+?)\((\d+),(\d+)\): (error|warning|message) (TS\d+): (.*)$/;
|
|
5607
|
+
var TSC_SEVERITY = { error: 1, warning: 2, message: 3 };
|
|
5608
|
+
function parseBunCheckOutput(stdout, cwd) {
|
|
5609
|
+
const results = [];
|
|
5610
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
5611
|
+
const match = TSC_LINE.exec(line);
|
|
5612
|
+
if (match) {
|
|
5613
|
+
const [, path, lineNumber, column, severity, code, message] = match;
|
|
5614
|
+
const start = { line: Number(lineNumber) - 1, character: Number(column) - 1 };
|
|
5615
|
+
results.push({
|
|
5616
|
+
file: resolve10(cwd, path ?? ""),
|
|
5617
|
+
diagnostic: {
|
|
5618
|
+
range: { start, end: start },
|
|
5619
|
+
severity: TSC_SEVERITY[severity ?? "error"] ?? 1,
|
|
5620
|
+
code: code ?? "",
|
|
5621
|
+
source: "bun check",
|
|
5622
|
+
message: message ?? ""
|
|
5623
|
+
}
|
|
5624
|
+
});
|
|
5625
|
+
continue;
|
|
5626
|
+
}
|
|
5627
|
+
const previous = results[results.length - 1];
|
|
5628
|
+
if (previous !== undefined && /^\s+\S/.test(line)) {
|
|
5629
|
+
previous.diagnostic.message = `${previous.diagnostic.message}
|
|
5630
|
+
${line.trim()}`;
|
|
5631
|
+
}
|
|
5632
|
+
}
|
|
5633
|
+
return results;
|
|
5634
|
+
}
|
|
5635
|
+
function parseBunLintJson(stdout) {
|
|
5636
|
+
let parsed;
|
|
5637
|
+
try {
|
|
5638
|
+
parsed = JSON.parse(stdout);
|
|
5639
|
+
} catch {
|
|
5640
|
+
return;
|
|
5641
|
+
}
|
|
5642
|
+
if (!Array.isArray(parsed))
|
|
5643
|
+
return;
|
|
5644
|
+
const results = [];
|
|
5645
|
+
for (const entry of parsed) {
|
|
5646
|
+
if (entry === null || typeof entry !== "object")
|
|
5647
|
+
continue;
|
|
5648
|
+
const filePath = entry.filePath;
|
|
5649
|
+
const messages = entry.messages;
|
|
5650
|
+
if (typeof filePath !== "string" || !Array.isArray(messages))
|
|
5651
|
+
continue;
|
|
5652
|
+
for (const raw of messages) {
|
|
5653
|
+
const start = { line: Math.max(0, (raw.line ?? 1) - 1), character: Math.max(0, (raw.column ?? 1) - 1) };
|
|
5654
|
+
const end = {
|
|
5655
|
+
line: raw.endLine === undefined ? start.line : Math.max(0, raw.endLine - 1),
|
|
5656
|
+
character: raw.endColumn === undefined ? start.character : Math.max(0, raw.endColumn - 1)
|
|
5657
|
+
};
|
|
5658
|
+
results.push({
|
|
5659
|
+
file: filePath,
|
|
5660
|
+
diagnostic: {
|
|
5661
|
+
range: { start, end },
|
|
5662
|
+
severity: raw.severity === 2 ? 1 : 2,
|
|
5663
|
+
...raw.ruleId ? { code: raw.ruleId } : {},
|
|
5664
|
+
source: "bun lint",
|
|
5665
|
+
message: raw.message ?? ""
|
|
5666
|
+
}
|
|
5667
|
+
});
|
|
5668
|
+
}
|
|
5669
|
+
}
|
|
5670
|
+
return results;
|
|
5671
|
+
}
|
|
5672
|
+
|
|
5673
|
+
// ../lsp-core/src/lsp/bun-project-checks.ts
|
|
5674
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
5675
|
+
import { existsSync as existsSync13, mkdtempSync, readFileSync as readFileSync6, rmSync as rmSync2, statSync as statSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5676
|
+
import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
|
|
5677
|
+
import { dirname as dirname11, join as join8, resolve as resolve11 } from "node:path";
|
|
5678
|
+
var BUN_LOCKFILES = ["bun.lock", "bun.lockb", "bunfig.toml"];
|
|
5679
|
+
var RUNNABLE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".cts", ".cjs", ".js", ".mjs", ".mts"];
|
|
5680
|
+
var BIN_SUFFIXES = process.platform === "win32" ? [".exe", ".bunx", ".cmd", ""] : [""];
|
|
5681
|
+
var PROBE_TIMEOUT_MS2 = 1e4;
|
|
5682
|
+
var UNFORMATTED_PROBE = `const a=1
|
|
5683
|
+
`;
|
|
5684
|
+
var probeCache = new Map;
|
|
5685
|
+
function findBunProjectRoot(start, home = homedir3()) {
|
|
5686
|
+
const stopAt = resolve11(home);
|
|
5687
|
+
let dir = resolve11(start);
|
|
5688
|
+
for (;; ) {
|
|
5689
|
+
if (dir === stopAt)
|
|
5690
|
+
return;
|
|
5691
|
+
if (BUN_LOCKFILES.some((name) => existsSync13(join8(dir, name))))
|
|
5692
|
+
return dir;
|
|
5693
|
+
if (packageManagerIsBun(join8(dir, "package.json")))
|
|
5694
|
+
return dir;
|
|
5695
|
+
if (existsSync13(join8(dir, ".git")))
|
|
5696
|
+
return;
|
|
5697
|
+
const parent = dirname11(dir);
|
|
5698
|
+
if (parent === dir)
|
|
5699
|
+
return;
|
|
5700
|
+
dir = parent;
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
function packageManagerIsBun(packageJsonPath) {
|
|
5704
|
+
const manifest = readJsonObject(packageJsonPath);
|
|
5705
|
+
const packageManager = manifest?.["packageManager"];
|
|
5706
|
+
return typeof packageManager === "string" && packageManager.startsWith("bun@");
|
|
5707
|
+
}
|
|
5708
|
+
function readJsonObject(path) {
|
|
5709
|
+
if (!existsSync13(path))
|
|
5710
|
+
return;
|
|
5711
|
+
try {
|
|
5712
|
+
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
5713
|
+
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
|
|
5714
|
+
} catch {
|
|
5715
|
+
return;
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
function isFile(path) {
|
|
5719
|
+
try {
|
|
5720
|
+
return statSync5(path).isFile();
|
|
5721
|
+
} catch {
|
|
5722
|
+
return false;
|
|
5723
|
+
}
|
|
5724
|
+
}
|
|
5725
|
+
function isDirectory(path) {
|
|
5726
|
+
try {
|
|
5727
|
+
return statSync5(path).isDirectory();
|
|
5728
|
+
} catch {
|
|
5729
|
+
return false;
|
|
5730
|
+
}
|
|
5731
|
+
}
|
|
5732
|
+
function projectShadowsBunCommand(command, cwd) {
|
|
5733
|
+
const packageJsonDir = nearestPackageJsonDir(cwd);
|
|
5734
|
+
if (packageJsonDir !== undefined) {
|
|
5735
|
+
const scripts = readJsonObject(join8(packageJsonDir, "package.json"))?.["scripts"];
|
|
5736
|
+
if (scripts !== null && typeof scripts === "object" && typeof scripts[command] === "string") {
|
|
5737
|
+
return true;
|
|
5738
|
+
}
|
|
5739
|
+
}
|
|
5740
|
+
if (command === "check")
|
|
5741
|
+
return false;
|
|
5742
|
+
const base = join8(cwd, command);
|
|
5743
|
+
if (isFile(base) || RUNNABLE_EXTENSIONS.some((extension) => isFile(`${base}${extension}`)))
|
|
5744
|
+
return true;
|
|
5745
|
+
if (isDirectory(base) && (isFile(join8(base, "package.json")) || RUNNABLE_EXTENSIONS.some((extension) => isFile(join8(base, `index${extension}`))))) {
|
|
5746
|
+
return true;
|
|
5747
|
+
}
|
|
5748
|
+
let dir = resolve11(cwd);
|
|
5749
|
+
for (;; ) {
|
|
5750
|
+
if (BIN_SUFFIXES.some((suffix) => existsSync13(join8(dir, "node_modules", ".bin", `${command}${suffix}`))))
|
|
5751
|
+
return true;
|
|
5752
|
+
const parent = dirname11(dir);
|
|
5753
|
+
if (parent === dir)
|
|
5754
|
+
return false;
|
|
5755
|
+
dir = parent;
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
function nearestPackageJsonDir(start) {
|
|
5759
|
+
let dir = resolve11(start);
|
|
5760
|
+
for (;; ) {
|
|
5761
|
+
if (existsSync13(join8(dir, "package.json")))
|
|
5762
|
+
return dir;
|
|
5763
|
+
const parent = dirname11(dir);
|
|
5764
|
+
if (parent === dir)
|
|
5765
|
+
return;
|
|
5766
|
+
dir = parent;
|
|
5767
|
+
}
|
|
5768
|
+
}
|
|
5769
|
+
function binaryIdentity(bunPath) {
|
|
5770
|
+
try {
|
|
5771
|
+
const stats = statSync5(bunPath);
|
|
5772
|
+
return `${stats.mtimeMs}:${stats.size}`;
|
|
5773
|
+
} catch {
|
|
5774
|
+
return "missing";
|
|
5775
|
+
}
|
|
5776
|
+
}
|
|
5777
|
+
function bunHasCommand(bunPath, command, timeoutMs = PROBE_TIMEOUT_MS2) {
|
|
5778
|
+
const key = `${bunPath}\x00${binaryIdentity(bunPath)}\x00${command}`;
|
|
5779
|
+
const cached = probeCache.get(key);
|
|
5780
|
+
if (cached !== undefined)
|
|
5781
|
+
return cached;
|
|
5782
|
+
const probe = probeOnce(bunPath, command, timeoutMs).then((answer) => {
|
|
5783
|
+
if (answer === undefined)
|
|
5784
|
+
probeCache.delete(key);
|
|
5785
|
+
return answer === true;
|
|
5786
|
+
});
|
|
5787
|
+
probeCache.set(key, probe);
|
|
5788
|
+
return probe;
|
|
5789
|
+
}
|
|
5790
|
+
async function probeOnce(bunPath, command, timeoutMs) {
|
|
5791
|
+
const emptyDir = mkdtempSync(join8(tmpdir2(), "omo-bun-probe-"));
|
|
5792
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
5793
|
+
try {
|
|
5794
|
+
const help = await runBunCommand(bunPath, [command, "--help"], emptyDir, timeout);
|
|
5795
|
+
if (help.exitCode === null)
|
|
5796
|
+
return;
|
|
5797
|
+
if (help.exitCode !== 0)
|
|
5798
|
+
return false;
|
|
5799
|
+
if (command !== "format")
|
|
5800
|
+
return true;
|
|
5801
|
+
const probeFile = join8(emptyDir, "probe.ts");
|
|
5802
|
+
writeFileSync3(probeFile, UNFORMATTED_PROBE);
|
|
5803
|
+
const write = await runBunCommand(bunPath, ["format", "--write", "probe.ts"], emptyDir, timeout);
|
|
5804
|
+
if (write.exitCode === null)
|
|
5805
|
+
return;
|
|
5806
|
+
return write.exitCode === 0 && readFileSync6(probeFile, "utf8") !== UNFORMATTED_PROBE;
|
|
5807
|
+
} catch {
|
|
5808
|
+
return;
|
|
5809
|
+
} finally {
|
|
5810
|
+
rmSync2(emptyDir, { recursive: true, force: true });
|
|
5811
|
+
}
|
|
5812
|
+
}
|
|
5813
|
+
async function resolveBunProjectCommand(command, cwd, options = {}) {
|
|
5814
|
+
if (findBunProjectRoot(cwd, options.homeDir) === undefined)
|
|
5815
|
+
return;
|
|
5816
|
+
if (projectShadowsBunCommand(command, cwd))
|
|
5817
|
+
return;
|
|
5818
|
+
const bunPath = (options.resolveBun ?? defaultResolveBun)(cwd);
|
|
5819
|
+
if (!bunPath)
|
|
5820
|
+
return;
|
|
5821
|
+
return await bunHasCommand(bunPath, command) ? bunPath : undefined;
|
|
5822
|
+
}
|
|
5823
|
+
function defaultResolveBun(cwd) {
|
|
5824
|
+
return resolveServerBinary(["bun"], cwd);
|
|
5825
|
+
}
|
|
5826
|
+
function runBunCommand(bunPath, args, cwd, signal) {
|
|
5827
|
+
signal?.throwIfAborted();
|
|
5828
|
+
const prepared = createSpawnCommand([bunPath, ...args]);
|
|
5829
|
+
return new Promise((resolvePromise, reject) => {
|
|
5830
|
+
const child = spawn3(prepared.command, prepared.args, {
|
|
5831
|
+
cwd,
|
|
5832
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
5833
|
+
shell: prepared.shell,
|
|
5834
|
+
windowsHide: true,
|
|
5835
|
+
detached: process.platform !== "win32"
|
|
5836
|
+
});
|
|
5837
|
+
const stdout = [];
|
|
5838
|
+
const stderr = [];
|
|
5839
|
+
const onAbort = () => killProcessTree(child, "SIGKILL");
|
|
5840
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
5841
|
+
child.stdout?.on("data", (chunk) => stdout.push(chunk));
|
|
5842
|
+
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
5843
|
+
child.once("error", (error) => {
|
|
5844
|
+
signal?.removeEventListener("abort", onAbort);
|
|
5845
|
+
reject(error);
|
|
5846
|
+
});
|
|
5847
|
+
child.once("close", (exitCode) => {
|
|
5848
|
+
signal?.removeEventListener("abort", onAbort);
|
|
5849
|
+
if (signal?.aborted) {
|
|
5850
|
+
reject(signal.reason);
|
|
5851
|
+
return;
|
|
5852
|
+
}
|
|
5853
|
+
resolvePromise({
|
|
5854
|
+
exitCode,
|
|
5855
|
+
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
5856
|
+
stderr: Buffer.concat(stderr).toString("utf8")
|
|
5857
|
+
});
|
|
5858
|
+
});
|
|
5859
|
+
});
|
|
5860
|
+
}
|
|
5861
|
+
|
|
5862
|
+
// ../lsp-core/src/tools/bun-directory-diagnostics.ts
|
|
5863
|
+
var TYPESCRIPT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
5864
|
+
async function runBunDirectoryDiagnostics(absDir, extension, severity, signal, options = {}) {
|
|
5865
|
+
if (!TYPESCRIPT_EXTENSIONS.has(extension))
|
|
5866
|
+
return;
|
|
5867
|
+
const checkBun = await resolveBunProjectCommand("check", absDir, options);
|
|
5868
|
+
if (checkBun === undefined)
|
|
5869
|
+
return;
|
|
5870
|
+
let typecheck;
|
|
5871
|
+
try {
|
|
5872
|
+
const run = await runBunCommand(checkBun, ["check", "--no-pretty", "."], absDir, signal);
|
|
5873
|
+
typecheck = parseBunCheckOutput(run.stdout, absDir);
|
|
5874
|
+
const failedWithoutDiagnostics = run.exitCode === 1 && typecheck.length === 0;
|
|
5875
|
+
if (run.exitCode !== 0 && run.exitCode !== 1 || failedWithoutDiagnostics)
|
|
5876
|
+
return;
|
|
5877
|
+
} catch (error) {
|
|
5878
|
+
if (signal?.aborted)
|
|
5879
|
+
throw error;
|
|
5880
|
+
return;
|
|
5881
|
+
}
|
|
5882
|
+
const header = [`Directory: ${absDir}`, "Typecheck: bun check (files in this directory and everything they import)"];
|
|
5883
|
+
const projectCommands = ["bun check"];
|
|
5884
|
+
const collected = [...typecheck];
|
|
5885
|
+
const lintBun = await resolveBunProjectCommand("lint", absDir, options);
|
|
5886
|
+
if (lintBun !== undefined) {
|
|
5887
|
+
const lint = await runBunLint(lintBun, absDir, signal);
|
|
5888
|
+
header.push(lint.status);
|
|
5889
|
+
projectCommands.push("bun lint");
|
|
5890
|
+
collected.push(...lint.diagnostics);
|
|
5891
|
+
}
|
|
5892
|
+
const diagnostics = collected.filter(({ diagnostic }) => filterDiagnosticsBySeverity([diagnostic], severity).length > 0);
|
|
5893
|
+
const lines = [...header, `Total diagnostics: ${diagnostics.length}`];
|
|
5894
|
+
const shown = diagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
|
|
5895
|
+
if (shown.length > 0) {
|
|
5896
|
+
lines.push("", ...shown.map(({ file, diagnostic }) => `${file}: ${formatDiagnostic(diagnostic)}`));
|
|
5897
|
+
if (diagnostics.length > shown.length) {
|
|
5898
|
+
lines.push("", `... (${diagnostics.length - shown.length} more diagnostics not shown)`);
|
|
5899
|
+
}
|
|
5900
|
+
}
|
|
5901
|
+
return { output: lines.join(`
|
|
5902
|
+
`), diagnostics, projectCommands };
|
|
5903
|
+
}
|
|
5904
|
+
async function runBunLint(bunPath, absDir, signal) {
|
|
5905
|
+
try {
|
|
5906
|
+
const run = await runBunCommand(bunPath, ["lint", "-f", "json", "."], absDir, signal);
|
|
5907
|
+
const diagnostics = run.exitCode === 0 || run.exitCode === 1 ? parseBunLintJson(run.stdout) : undefined;
|
|
5908
|
+
if (diagnostics !== undefined)
|
|
5909
|
+
return { status: "Lint: bun lint", diagnostics };
|
|
5910
|
+
const reason = run.stderr.trim().split(/\r?\n/)[0] ?? "";
|
|
5911
|
+
return { status: `Lint: bun lint could not lint (exit ${run.exitCode ?? "signal"})${reason ? `: ${reason}` : ""}`, diagnostics: [] };
|
|
5912
|
+
} catch (error) {
|
|
5913
|
+
if (signal?.aborted)
|
|
5914
|
+
throw error;
|
|
5915
|
+
return { status: `Lint: bun lint could not run: ${error instanceof Error ? error.message : String(error)}`, diagnostics: [] };
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5918
|
+
|
|
5604
5919
|
// ../lsp-core/src/tools/parameters.ts
|
|
5605
5920
|
function isRecord7(value) {
|
|
5606
5921
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -5655,7 +5970,7 @@ function asDiagnosticArray(result) {
|
|
|
5655
5970
|
return result;
|
|
5656
5971
|
return result.items ?? [];
|
|
5657
5972
|
}
|
|
5658
|
-
async function executeLspDiagnostics(params, signal) {
|
|
5973
|
+
async function executeLspDiagnostics(params, signal, bunOptions = {}) {
|
|
5659
5974
|
const filePath = requireString(params, "filePath");
|
|
5660
5975
|
const severity = severityFilter(params);
|
|
5661
5976
|
try {
|
|
@@ -5676,6 +5991,19 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5676
5991
|
};
|
|
5677
5992
|
return text(message, details);
|
|
5678
5993
|
}
|
|
5994
|
+
const bun = await runBunDirectoryDiagnostics(absPath, extension, severity, signal, bunOptions);
|
|
5995
|
+
if (bun !== undefined) {
|
|
5996
|
+
const details = {
|
|
5997
|
+
filePath,
|
|
5998
|
+
severity,
|
|
5999
|
+
mode: "directory",
|
|
6000
|
+
diagnostics: [...bun.diagnostics],
|
|
6001
|
+
totalDiagnostics: bun.diagnostics.length,
|
|
6002
|
+
truncated: bun.diagnostics.length > DEFAULT_MAX_DIAGNOSTICS,
|
|
6003
|
+
projectCommands: [...bun.projectCommands]
|
|
6004
|
+
};
|
|
6005
|
+
return text(bun.output, details);
|
|
6006
|
+
}
|
|
5679
6007
|
const output = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
|
|
5680
6008
|
const details = {
|
|
5681
6009
|
filePath,
|
|
@@ -5736,7 +6064,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5736
6064
|
}
|
|
5737
6065
|
}
|
|
5738
6066
|
// ../lsp-core/src/lsp/format-document.ts
|
|
5739
|
-
import { readFileSync as
|
|
6067
|
+
import { readFileSync as readFileSync7, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
5740
6068
|
var DEFAULT_FORMATTING_OPTIONS = {
|
|
5741
6069
|
tabSize: 4,
|
|
5742
6070
|
insertSpaces: false,
|
|
@@ -5751,7 +6079,7 @@ async function formatDocumentWithClient(client, filePath, options = {}) {
|
|
|
5751
6079
|
return { status: "unavailable", reason: "capability_not_advertised" };
|
|
5752
6080
|
if (edits.length === 0)
|
|
5753
6081
|
return UNCHANGED;
|
|
5754
|
-
const before =
|
|
6082
|
+
const before = readFileSync7(filePath, "utf-8");
|
|
5755
6083
|
const normalized = normalizeTextEdits(before, edits, 0);
|
|
5756
6084
|
if (normalized.text === before)
|
|
5757
6085
|
return UNCHANGED;
|
|
@@ -5774,7 +6102,7 @@ function lineDelta(edits) {
|
|
|
5774
6102
|
}
|
|
5775
6103
|
function writeAtomically(filePath, content) {
|
|
5776
6104
|
const tempPath = `${filePath}.omo-format.tmp`;
|
|
5777
|
-
|
|
6105
|
+
writeFileSync4(tempPath, content, "utf-8");
|
|
5778
6106
|
try {
|
|
5779
6107
|
renameSync3(tempPath, filePath);
|
|
5780
6108
|
} catch (error) {
|
|
@@ -6079,7 +6407,7 @@ var LSP_MCP_TOOLS = [
|
|
|
6079
6407
|
name: "diagnostics",
|
|
6080
6408
|
aliases: ["lsp_diagnostics"],
|
|
6081
6409
|
title: "LSP Diagnostics",
|
|
6082
|
-
description: "Get errors, warnings, and hints for a source file or directory.",
|
|
6410
|
+
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.",
|
|
6083
6411
|
inputSchema: objectSchema({
|
|
6084
6412
|
filePath: { type: "string", description: "File or directory path to check." },
|
|
6085
6413
|
severity: {
|
|
@@ -6406,12 +6734,12 @@ function callFormatViaDaemon(filePath, options) {
|
|
|
6406
6734
|
}
|
|
6407
6735
|
function currentRequestContext(env = process.env) {
|
|
6408
6736
|
const cwd = process.cwd();
|
|
6409
|
-
const home = env["HOME"] ??
|
|
6737
|
+
const home = env["HOME"] ?? homedir4();
|
|
6410
6738
|
return parseLspRequestContext({
|
|
6411
6739
|
cwd,
|
|
6412
|
-
projectConfigPaths: [
|
|
6413
|
-
userConfigPath:
|
|
6414
|
-
installDecisionsPath:
|
|
6740
|
+
projectConfigPaths: [join9(cwd, ".codex", "lsp-client.json")],
|
|
6741
|
+
userConfigPath: join9(home, ".codex", "lsp-client.json"),
|
|
6742
|
+
installDecisionsPath: join9(home, ".codex", "lsp-install-decisions.json"),
|
|
6415
6743
|
capabilities: { installDecisionTool: true }
|
|
6416
6744
|
});
|
|
6417
6745
|
}
|
|
@@ -6543,8 +6871,8 @@ function isRetryableTool(name) {
|
|
|
6543
6871
|
return name !== "rename" && name !== "lsp_rename";
|
|
6544
6872
|
}
|
|
6545
6873
|
// src/proxy.ts
|
|
6546
|
-
import { existsSync as
|
|
6547
|
-
import { basename as basename4, delimiter as delimiter4, dirname as
|
|
6874
|
+
import { existsSync as existsSync14, realpathSync as realpathSync6 } from "node:fs";
|
|
6875
|
+
import { basename as basename4, delimiter as delimiter4, dirname as dirname12, isAbsolute as isAbsolute6 } from "node:path";
|
|
6548
6876
|
var DEFAULT_STARTUP_TIMEOUT_MS = 1e4;
|
|
6549
6877
|
async function runMcpStdioProxy(options = {}) {
|
|
6550
6878
|
const input = options.input ?? process.stdin;
|
|
@@ -6667,18 +6995,18 @@ function canonicalizePathList(value) {
|
|
|
6667
6995
|
return value.split(delimiter4).map((entry) => canonicalizePath(entry) ?? entry).join(delimiter4);
|
|
6668
6996
|
}
|
|
6669
6997
|
function canonicalizePath(value) {
|
|
6670
|
-
if (value === undefined || !isAbsolute6(value) || !
|
|
6998
|
+
if (value === undefined || !isAbsolute6(value) || !existsSync14(value))
|
|
6671
6999
|
return value;
|
|
6672
7000
|
return realpathSync6(value);
|
|
6673
7001
|
}
|
|
6674
7002
|
function projectRootFromOpenCodeConfigPath(path) {
|
|
6675
7003
|
if (basename4(path) !== "lsp.json" && basename4(path) !== "lsp-client.json")
|
|
6676
7004
|
return;
|
|
6677
|
-
const configDir =
|
|
7005
|
+
const configDir = dirname12(path);
|
|
6678
7006
|
const configDirName = basename4(configDir);
|
|
6679
7007
|
if (configDirName !== ".opencode" && configDirName !== ".omo")
|
|
6680
7008
|
return;
|
|
6681
|
-
return
|
|
7009
|
+
return dirname12(configDir);
|
|
6682
7010
|
}
|
|
6683
7011
|
export {
|
|
6684
7012
|
InvalidDaemonDirectoryError,
|