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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/client.ts
|
|
2
|
-
import { statSync as
|
|
2
|
+
import { statSync as statSync6 } from "node:fs";
|
|
3
3
|
import { isAbsolute as isAbsolute6 } from "node:path";
|
|
4
4
|
|
|
5
5
|
// src/daemon-client.ts
|
|
6
6
|
import { connect } from "node:net";
|
|
7
|
-
import { homedir as
|
|
8
|
-
import { join as
|
|
7
|
+
import { homedir as homedir4 } from "node:os";
|
|
8
|
+
import { join as join9 } from "node:path";
|
|
9
9
|
import { setTimeout as delay } from "node:timers/promises";
|
|
10
10
|
|
|
11
11
|
// ../lsp-core/src/request-context.ts
|
|
@@ -5606,6 +5606,321 @@ function missingDependencyAvailability(error) {
|
|
|
5606
5606
|
}
|
|
5607
5607
|
}
|
|
5608
5608
|
|
|
5609
|
+
// ../lsp-core/src/lsp/bun-command-output.ts
|
|
5610
|
+
import { resolve as resolve10 } from "node:path";
|
|
5611
|
+
var TSC_LINE = /^(.+?)\((\d+),(\d+)\): (error|warning|message) (TS\d+): (.*)$/;
|
|
5612
|
+
var TSC_SEVERITY = { error: 1, warning: 2, message: 3 };
|
|
5613
|
+
function parseBunCheckOutput(stdout, cwd) {
|
|
5614
|
+
const results = [];
|
|
5615
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
5616
|
+
const match = TSC_LINE.exec(line);
|
|
5617
|
+
if (match) {
|
|
5618
|
+
const [, path, lineNumber, column, severity, code, message] = match;
|
|
5619
|
+
const start = { line: Number(lineNumber) - 1, character: Number(column) - 1 };
|
|
5620
|
+
results.push({
|
|
5621
|
+
file: resolve10(cwd, path ?? ""),
|
|
5622
|
+
diagnostic: {
|
|
5623
|
+
range: { start, end: start },
|
|
5624
|
+
severity: TSC_SEVERITY[severity ?? "error"] ?? 1,
|
|
5625
|
+
code: code ?? "",
|
|
5626
|
+
source: "bun check",
|
|
5627
|
+
message: message ?? ""
|
|
5628
|
+
}
|
|
5629
|
+
});
|
|
5630
|
+
continue;
|
|
5631
|
+
}
|
|
5632
|
+
const previous = results[results.length - 1];
|
|
5633
|
+
if (previous !== undefined && /^\s+\S/.test(line)) {
|
|
5634
|
+
previous.diagnostic.message = `${previous.diagnostic.message}
|
|
5635
|
+
${line.trim()}`;
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
return results;
|
|
5639
|
+
}
|
|
5640
|
+
function parseBunLintJson(stdout) {
|
|
5641
|
+
let parsed;
|
|
5642
|
+
try {
|
|
5643
|
+
parsed = JSON.parse(stdout);
|
|
5644
|
+
} catch {
|
|
5645
|
+
return;
|
|
5646
|
+
}
|
|
5647
|
+
if (!Array.isArray(parsed))
|
|
5648
|
+
return;
|
|
5649
|
+
const results = [];
|
|
5650
|
+
for (const entry of parsed) {
|
|
5651
|
+
if (entry === null || typeof entry !== "object")
|
|
5652
|
+
continue;
|
|
5653
|
+
const filePath = entry.filePath;
|
|
5654
|
+
const messages = entry.messages;
|
|
5655
|
+
if (typeof filePath !== "string" || !Array.isArray(messages))
|
|
5656
|
+
continue;
|
|
5657
|
+
for (const raw of messages) {
|
|
5658
|
+
const start = { line: Math.max(0, (raw.line ?? 1) - 1), character: Math.max(0, (raw.column ?? 1) - 1) };
|
|
5659
|
+
const end = {
|
|
5660
|
+
line: raw.endLine === undefined ? start.line : Math.max(0, raw.endLine - 1),
|
|
5661
|
+
character: raw.endColumn === undefined ? start.character : Math.max(0, raw.endColumn - 1)
|
|
5662
|
+
};
|
|
5663
|
+
results.push({
|
|
5664
|
+
file: filePath,
|
|
5665
|
+
diagnostic: {
|
|
5666
|
+
range: { start, end },
|
|
5667
|
+
severity: raw.severity === 2 ? 1 : 2,
|
|
5668
|
+
...raw.ruleId ? { code: raw.ruleId } : {},
|
|
5669
|
+
source: "bun lint",
|
|
5670
|
+
message: raw.message ?? ""
|
|
5671
|
+
}
|
|
5672
|
+
});
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
return results;
|
|
5676
|
+
}
|
|
5677
|
+
|
|
5678
|
+
// ../lsp-core/src/lsp/bun-project-checks.ts
|
|
5679
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
5680
|
+
import { existsSync as existsSync13, mkdtempSync, readFileSync as readFileSync6, rmSync as rmSync2, statSync as statSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5681
|
+
import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
|
|
5682
|
+
import { dirname as dirname11, join as join8, resolve as resolve11 } from "node:path";
|
|
5683
|
+
var BUN_LOCKFILES = ["bun.lock", "bun.lockb", "bunfig.toml"];
|
|
5684
|
+
var RUNNABLE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".cts", ".cjs", ".js", ".mjs", ".mts"];
|
|
5685
|
+
var BIN_SUFFIXES = process.platform === "win32" ? [".exe", ".bunx", ".cmd", ""] : [""];
|
|
5686
|
+
var PROBE_TIMEOUT_MS2 = 1e4;
|
|
5687
|
+
var UNFORMATTED_PROBE = `const a=1
|
|
5688
|
+
`;
|
|
5689
|
+
var probeCache = new Map;
|
|
5690
|
+
function findBunProjectRoot(start, home = homedir3()) {
|
|
5691
|
+
const stopAt = resolve11(home);
|
|
5692
|
+
let dir = resolve11(start);
|
|
5693
|
+
for (;; ) {
|
|
5694
|
+
if (dir === stopAt)
|
|
5695
|
+
return;
|
|
5696
|
+
if (BUN_LOCKFILES.some((name) => existsSync13(join8(dir, name))))
|
|
5697
|
+
return dir;
|
|
5698
|
+
if (packageManagerIsBun(join8(dir, "package.json")))
|
|
5699
|
+
return dir;
|
|
5700
|
+
if (existsSync13(join8(dir, ".git")))
|
|
5701
|
+
return;
|
|
5702
|
+
const parent = dirname11(dir);
|
|
5703
|
+
if (parent === dir)
|
|
5704
|
+
return;
|
|
5705
|
+
dir = parent;
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
function packageManagerIsBun(packageJsonPath) {
|
|
5709
|
+
const manifest = readJsonObject(packageJsonPath);
|
|
5710
|
+
const packageManager = manifest?.["packageManager"];
|
|
5711
|
+
return typeof packageManager === "string" && packageManager.startsWith("bun@");
|
|
5712
|
+
}
|
|
5713
|
+
function readJsonObject(path) {
|
|
5714
|
+
if (!existsSync13(path))
|
|
5715
|
+
return;
|
|
5716
|
+
try {
|
|
5717
|
+
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
5718
|
+
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
|
|
5719
|
+
} catch {
|
|
5720
|
+
return;
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
function isFile(path) {
|
|
5724
|
+
try {
|
|
5725
|
+
return statSync5(path).isFile();
|
|
5726
|
+
} catch {
|
|
5727
|
+
return false;
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5730
|
+
function isDirectory(path) {
|
|
5731
|
+
try {
|
|
5732
|
+
return statSync5(path).isDirectory();
|
|
5733
|
+
} catch {
|
|
5734
|
+
return false;
|
|
5735
|
+
}
|
|
5736
|
+
}
|
|
5737
|
+
function projectShadowsBunCommand(command, cwd) {
|
|
5738
|
+
const packageJsonDir = nearestPackageJsonDir(cwd);
|
|
5739
|
+
if (packageJsonDir !== undefined) {
|
|
5740
|
+
const scripts = readJsonObject(join8(packageJsonDir, "package.json"))?.["scripts"];
|
|
5741
|
+
if (scripts !== null && typeof scripts === "object" && typeof scripts[command] === "string") {
|
|
5742
|
+
return true;
|
|
5743
|
+
}
|
|
5744
|
+
}
|
|
5745
|
+
if (command === "check")
|
|
5746
|
+
return false;
|
|
5747
|
+
const base = join8(cwd, command);
|
|
5748
|
+
if (isFile(base) || RUNNABLE_EXTENSIONS.some((extension) => isFile(`${base}${extension}`)))
|
|
5749
|
+
return true;
|
|
5750
|
+
if (isDirectory(base) && (isFile(join8(base, "package.json")) || RUNNABLE_EXTENSIONS.some((extension) => isFile(join8(base, `index${extension}`))))) {
|
|
5751
|
+
return true;
|
|
5752
|
+
}
|
|
5753
|
+
let dir = resolve11(cwd);
|
|
5754
|
+
for (;; ) {
|
|
5755
|
+
if (BIN_SUFFIXES.some((suffix) => existsSync13(join8(dir, "node_modules", ".bin", `${command}${suffix}`))))
|
|
5756
|
+
return true;
|
|
5757
|
+
const parent = dirname11(dir);
|
|
5758
|
+
if (parent === dir)
|
|
5759
|
+
return false;
|
|
5760
|
+
dir = parent;
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5763
|
+
function nearestPackageJsonDir(start) {
|
|
5764
|
+
let dir = resolve11(start);
|
|
5765
|
+
for (;; ) {
|
|
5766
|
+
if (existsSync13(join8(dir, "package.json")))
|
|
5767
|
+
return dir;
|
|
5768
|
+
const parent = dirname11(dir);
|
|
5769
|
+
if (parent === dir)
|
|
5770
|
+
return;
|
|
5771
|
+
dir = parent;
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
function binaryIdentity(bunPath) {
|
|
5775
|
+
try {
|
|
5776
|
+
const stats = statSync5(bunPath);
|
|
5777
|
+
return `${stats.mtimeMs}:${stats.size}`;
|
|
5778
|
+
} catch {
|
|
5779
|
+
return "missing";
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
function bunHasCommand(bunPath, command, timeoutMs = PROBE_TIMEOUT_MS2) {
|
|
5783
|
+
const key = `${bunPath}\x00${binaryIdentity(bunPath)}\x00${command}`;
|
|
5784
|
+
const cached = probeCache.get(key);
|
|
5785
|
+
if (cached !== undefined)
|
|
5786
|
+
return cached;
|
|
5787
|
+
const probe = probeOnce(bunPath, command, timeoutMs).then((answer) => {
|
|
5788
|
+
if (answer === undefined)
|
|
5789
|
+
probeCache.delete(key);
|
|
5790
|
+
return answer === true;
|
|
5791
|
+
});
|
|
5792
|
+
probeCache.set(key, probe);
|
|
5793
|
+
return probe;
|
|
5794
|
+
}
|
|
5795
|
+
async function probeOnce(bunPath, command, timeoutMs) {
|
|
5796
|
+
const emptyDir = mkdtempSync(join8(tmpdir2(), "omo-bun-probe-"));
|
|
5797
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
5798
|
+
try {
|
|
5799
|
+
const help = await runBunCommand(bunPath, [command, "--help"], emptyDir, timeout);
|
|
5800
|
+
if (help.exitCode === null)
|
|
5801
|
+
return;
|
|
5802
|
+
if (help.exitCode !== 0)
|
|
5803
|
+
return false;
|
|
5804
|
+
if (command !== "format")
|
|
5805
|
+
return true;
|
|
5806
|
+
const probeFile = join8(emptyDir, "probe.ts");
|
|
5807
|
+
writeFileSync3(probeFile, UNFORMATTED_PROBE);
|
|
5808
|
+
const write = await runBunCommand(bunPath, ["format", "--write", "probe.ts"], emptyDir, timeout);
|
|
5809
|
+
if (write.exitCode === null)
|
|
5810
|
+
return;
|
|
5811
|
+
return write.exitCode === 0 && readFileSync6(probeFile, "utf8") !== UNFORMATTED_PROBE;
|
|
5812
|
+
} catch {
|
|
5813
|
+
return;
|
|
5814
|
+
} finally {
|
|
5815
|
+
rmSync2(emptyDir, { recursive: true, force: true });
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5818
|
+
async function resolveBunProjectCommand(command, cwd, options = {}) {
|
|
5819
|
+
if (findBunProjectRoot(cwd, options.homeDir) === undefined)
|
|
5820
|
+
return;
|
|
5821
|
+
if (projectShadowsBunCommand(command, cwd))
|
|
5822
|
+
return;
|
|
5823
|
+
const bunPath = (options.resolveBun ?? defaultResolveBun)(cwd);
|
|
5824
|
+
if (!bunPath)
|
|
5825
|
+
return;
|
|
5826
|
+
return await bunHasCommand(bunPath, command) ? bunPath : undefined;
|
|
5827
|
+
}
|
|
5828
|
+
function defaultResolveBun(cwd) {
|
|
5829
|
+
return resolveServerBinary(["bun"], cwd);
|
|
5830
|
+
}
|
|
5831
|
+
function runBunCommand(bunPath, args, cwd, signal) {
|
|
5832
|
+
signal?.throwIfAborted();
|
|
5833
|
+
const prepared = createSpawnCommand([bunPath, ...args]);
|
|
5834
|
+
return new Promise((resolvePromise, reject) => {
|
|
5835
|
+
const child = spawn3(prepared.command, prepared.args, {
|
|
5836
|
+
cwd,
|
|
5837
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
5838
|
+
shell: prepared.shell,
|
|
5839
|
+
windowsHide: true,
|
|
5840
|
+
detached: process.platform !== "win32"
|
|
5841
|
+
});
|
|
5842
|
+
const stdout = [];
|
|
5843
|
+
const stderr = [];
|
|
5844
|
+
const onAbort = () => killProcessTree(child, "SIGKILL");
|
|
5845
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
5846
|
+
child.stdout?.on("data", (chunk) => stdout.push(chunk));
|
|
5847
|
+
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
5848
|
+
child.once("error", (error) => {
|
|
5849
|
+
signal?.removeEventListener("abort", onAbort);
|
|
5850
|
+
reject(error);
|
|
5851
|
+
});
|
|
5852
|
+
child.once("close", (exitCode) => {
|
|
5853
|
+
signal?.removeEventListener("abort", onAbort);
|
|
5854
|
+
if (signal?.aborted) {
|
|
5855
|
+
reject(signal.reason);
|
|
5856
|
+
return;
|
|
5857
|
+
}
|
|
5858
|
+
resolvePromise({
|
|
5859
|
+
exitCode,
|
|
5860
|
+
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
5861
|
+
stderr: Buffer.concat(stderr).toString("utf8")
|
|
5862
|
+
});
|
|
5863
|
+
});
|
|
5864
|
+
});
|
|
5865
|
+
}
|
|
5866
|
+
|
|
5867
|
+
// ../lsp-core/src/tools/bun-directory-diagnostics.ts
|
|
5868
|
+
var TYPESCRIPT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
5869
|
+
async function runBunDirectoryDiagnostics(absDir, extension, severity, signal, options = {}) {
|
|
5870
|
+
if (!TYPESCRIPT_EXTENSIONS.has(extension))
|
|
5871
|
+
return;
|
|
5872
|
+
const checkBun = await resolveBunProjectCommand("check", absDir, options);
|
|
5873
|
+
if (checkBun === undefined)
|
|
5874
|
+
return;
|
|
5875
|
+
let typecheck;
|
|
5876
|
+
try {
|
|
5877
|
+
const run = await runBunCommand(checkBun, ["check", "--no-pretty", "."], absDir, signal);
|
|
5878
|
+
typecheck = parseBunCheckOutput(run.stdout, absDir);
|
|
5879
|
+
const failedWithoutDiagnostics = run.exitCode === 1 && typecheck.length === 0;
|
|
5880
|
+
if (run.exitCode !== 0 && run.exitCode !== 1 || failedWithoutDiagnostics)
|
|
5881
|
+
return;
|
|
5882
|
+
} catch (error) {
|
|
5883
|
+
if (signal?.aborted)
|
|
5884
|
+
throw error;
|
|
5885
|
+
return;
|
|
5886
|
+
}
|
|
5887
|
+
const header = [`Directory: ${absDir}`, "Typecheck: bun check (files in this directory and everything they import)"];
|
|
5888
|
+
const projectCommands = ["bun check"];
|
|
5889
|
+
const collected = [...typecheck];
|
|
5890
|
+
const lintBun = await resolveBunProjectCommand("lint", absDir, options);
|
|
5891
|
+
if (lintBun !== undefined) {
|
|
5892
|
+
const lint = await runBunLint(lintBun, absDir, signal);
|
|
5893
|
+
header.push(lint.status);
|
|
5894
|
+
projectCommands.push("bun lint");
|
|
5895
|
+
collected.push(...lint.diagnostics);
|
|
5896
|
+
}
|
|
5897
|
+
const diagnostics = collected.filter(({ diagnostic }) => filterDiagnosticsBySeverity([diagnostic], severity).length > 0);
|
|
5898
|
+
const lines = [...header, `Total diagnostics: ${diagnostics.length}`];
|
|
5899
|
+
const shown = diagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
|
|
5900
|
+
if (shown.length > 0) {
|
|
5901
|
+
lines.push("", ...shown.map(({ file, diagnostic }) => `${file}: ${formatDiagnostic(diagnostic)}`));
|
|
5902
|
+
if (diagnostics.length > shown.length) {
|
|
5903
|
+
lines.push("", `... (${diagnostics.length - shown.length} more diagnostics not shown)`);
|
|
5904
|
+
}
|
|
5905
|
+
}
|
|
5906
|
+
return { output: lines.join(`
|
|
5907
|
+
`), diagnostics, projectCommands };
|
|
5908
|
+
}
|
|
5909
|
+
async function runBunLint(bunPath, absDir, signal) {
|
|
5910
|
+
try {
|
|
5911
|
+
const run = await runBunCommand(bunPath, ["lint", "-f", "json", "."], absDir, signal);
|
|
5912
|
+
const diagnostics = run.exitCode === 0 || run.exitCode === 1 ? parseBunLintJson(run.stdout) : undefined;
|
|
5913
|
+
if (diagnostics !== undefined)
|
|
5914
|
+
return { status: "Lint: bun lint", diagnostics };
|
|
5915
|
+
const reason = run.stderr.trim().split(/\r?\n/)[0] ?? "";
|
|
5916
|
+
return { status: `Lint: bun lint could not lint (exit ${run.exitCode ?? "signal"})${reason ? `: ${reason}` : ""}`, diagnostics: [] };
|
|
5917
|
+
} catch (error) {
|
|
5918
|
+
if (signal?.aborted)
|
|
5919
|
+
throw error;
|
|
5920
|
+
return { status: `Lint: bun lint could not run: ${error instanceof Error ? error.message : String(error)}`, diagnostics: [] };
|
|
5921
|
+
}
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5609
5924
|
// ../lsp-core/src/tools/parameters.ts
|
|
5610
5925
|
function isRecord7(value) {
|
|
5611
5926
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -5660,7 +5975,7 @@ function asDiagnosticArray(result) {
|
|
|
5660
5975
|
return result;
|
|
5661
5976
|
return result.items ?? [];
|
|
5662
5977
|
}
|
|
5663
|
-
async function executeLspDiagnostics(params, signal) {
|
|
5978
|
+
async function executeLspDiagnostics(params, signal, bunOptions = {}) {
|
|
5664
5979
|
const filePath = requireString(params, "filePath");
|
|
5665
5980
|
const severity = severityFilter(params);
|
|
5666
5981
|
try {
|
|
@@ -5681,6 +5996,19 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5681
5996
|
};
|
|
5682
5997
|
return text(message, details);
|
|
5683
5998
|
}
|
|
5999
|
+
const bun = await runBunDirectoryDiagnostics(absPath, extension, severity, signal, bunOptions);
|
|
6000
|
+
if (bun !== undefined) {
|
|
6001
|
+
const details = {
|
|
6002
|
+
filePath,
|
|
6003
|
+
severity,
|
|
6004
|
+
mode: "directory",
|
|
6005
|
+
diagnostics: [...bun.diagnostics],
|
|
6006
|
+
totalDiagnostics: bun.diagnostics.length,
|
|
6007
|
+
truncated: bun.diagnostics.length > DEFAULT_MAX_DIAGNOSTICS,
|
|
6008
|
+
projectCommands: [...bun.projectCommands]
|
|
6009
|
+
};
|
|
6010
|
+
return text(bun.output, details);
|
|
6011
|
+
}
|
|
5684
6012
|
const output = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
|
|
5685
6013
|
const details = {
|
|
5686
6014
|
filePath,
|
|
@@ -5741,7 +6069,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5741
6069
|
}
|
|
5742
6070
|
}
|
|
5743
6071
|
// ../lsp-core/src/lsp/format-document.ts
|
|
5744
|
-
import { readFileSync as
|
|
6072
|
+
import { readFileSync as readFileSync7, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
5745
6073
|
var DEFAULT_FORMATTING_OPTIONS = {
|
|
5746
6074
|
tabSize: 4,
|
|
5747
6075
|
insertSpaces: false,
|
|
@@ -5756,7 +6084,7 @@ async function formatDocumentWithClient(client, filePath, options = {}) {
|
|
|
5756
6084
|
return { status: "unavailable", reason: "capability_not_advertised" };
|
|
5757
6085
|
if (edits.length === 0)
|
|
5758
6086
|
return UNCHANGED;
|
|
5759
|
-
const before =
|
|
6087
|
+
const before = readFileSync7(filePath, "utf-8");
|
|
5760
6088
|
const normalized = normalizeTextEdits(before, edits, 0);
|
|
5761
6089
|
if (normalized.text === before)
|
|
5762
6090
|
return UNCHANGED;
|
|
@@ -5779,7 +6107,7 @@ function lineDelta(edits) {
|
|
|
5779
6107
|
}
|
|
5780
6108
|
function writeAtomically(filePath, content) {
|
|
5781
6109
|
const tempPath = `${filePath}.omo-format.tmp`;
|
|
5782
|
-
|
|
6110
|
+
writeFileSync4(tempPath, content, "utf-8");
|
|
5783
6111
|
try {
|
|
5784
6112
|
renameSync3(tempPath, filePath);
|
|
5785
6113
|
} catch (error) {
|
|
@@ -6084,7 +6412,7 @@ var LSP_MCP_TOOLS = [
|
|
|
6084
6412
|
name: "diagnostics",
|
|
6085
6413
|
aliases: ["lsp_diagnostics"],
|
|
6086
6414
|
title: "LSP Diagnostics",
|
|
6087
|
-
description: "Get errors, warnings, and hints for a source file or directory.",
|
|
6415
|
+
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.",
|
|
6088
6416
|
inputSchema: objectSchema({
|
|
6089
6417
|
filePath: { type: "string", description: "File or directory path to check." },
|
|
6090
6418
|
severity: {
|
|
@@ -6411,12 +6739,12 @@ function callFormatViaDaemon(filePath, options) {
|
|
|
6411
6739
|
}
|
|
6412
6740
|
function currentRequestContext(env = process.env) {
|
|
6413
6741
|
const cwd = process.cwd();
|
|
6414
|
-
const home = env["HOME"] ??
|
|
6742
|
+
const home = env["HOME"] ?? homedir4();
|
|
6415
6743
|
return parseLspRequestContext({
|
|
6416
6744
|
cwd,
|
|
6417
|
-
projectConfigPaths: [
|
|
6418
|
-
userConfigPath:
|
|
6419
|
-
installDecisionsPath:
|
|
6745
|
+
projectConfigPaths: [join9(cwd, ".codex", "lsp-client.json")],
|
|
6746
|
+
userConfigPath: join9(home, ".codex", "lsp-client.json"),
|
|
6747
|
+
installDecisionsPath: join9(home, ".codex", "lsp-install-decisions.json"),
|
|
6420
6748
|
capabilities: { installDecisionTool: true }
|
|
6421
6749
|
});
|
|
6422
6750
|
}
|
|
@@ -6585,7 +6913,7 @@ function resolveDaemonRuntime2(env, defaults) {
|
|
|
6585
6913
|
if (!isAbsolute6(cliOverride)) {
|
|
6586
6914
|
throw new InvalidRuntimeOverrideError2("cli_must_be_absolute", `${OMO_LSP_DAEMON_CLI2} must be an absolute path to an existing regular file`);
|
|
6587
6915
|
}
|
|
6588
|
-
const stat =
|
|
6916
|
+
const stat = statSync6(cliOverride, { throwIfNoEntry: false });
|
|
6589
6917
|
if (!stat) {
|
|
6590
6918
|
throw new InvalidRuntimeOverrideError2("cli_not_found", `${OMO_LSP_DAEMON_CLI2} points to a missing file`);
|
|
6591
6919
|
}
|