oh-my-opencode 5.0.0-beta.1 → 5.0.0-beta.11
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/.agents/command/publish.md +44 -16
- package/.agents/skills/publish/SKILL.md +44 -16
- package/.agents/skills/work-with-pr/SKILL.md +37 -23
- package/.opencode/command/publish.md +44 -16
- package/.opencode/skills/work-with-pr/SKILL.md +37 -23
- package/README.md +12 -1
- package/dist/agents/atlas/agent.d.ts +0 -1
- package/dist/agents/sisyphus/grok-4.d.ts +20 -0
- package/dist/agents/sisyphus/index.d.ts +2 -0
- package/dist/agents/sisyphus-agent-config.d.ts +6 -0
- package/dist/agents/sisyphus-agent-factory.d.ts +1 -1
- package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +15 -4
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/index.js +805 -534
- package/dist/cli/run/on-complete-hook.d.ts +2 -0
- package/dist/cli-node/index.js +805 -534
- package/dist/hooks/atlas/final-wave-approval-gate.test-support.d.ts +50 -0
- package/dist/hooks/atlas/system-reminder-templates.d.ts +0 -1
- package/dist/index.js +1566 -1217
- package/dist/shared/normalize-sdk-response.d.ts +1 -0
- package/dist/shared/shell-env.d.ts +1 -1
- package/dist/skills/coding-agent-sessions/SKILL.md +3 -2
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/dist/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/dist/skills/frontend/SKILL.md +10 -7
- package/dist/skills/frontend/references/design/_INDEX.md +1 -0
- package/dist/skills/frontend/references/design/stylegallery.md +80 -0
- package/dist/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/dist/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/dist/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/dist/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
- package/dist/skills/ulw-plan/SKILL.md +2 -2
- package/dist/skills/ulw-plan/references/full-workflow.md +27 -3
- package/dist/skills/ulw-plan/references/intent-clear.md +2 -1
- package/dist/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
- package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
- package/dist/tools/delegate-task/tool-description.d.ts +3 -1
- package/dist/tui.js +184 -83
- package/package.json +21 -19
- package/packages/lsp-core/src/lsp/client-diagnostics-concurrency.integration.test.ts +44 -0
- package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +0 -28
- package/packages/lsp-core/src/lsp/client-wrapper-outside-cwd.test.ts +78 -0
- package/packages/lsp-core/src/lsp/client-wrapper.test.ts +66 -13
- package/packages/lsp-core/src/lsp/client-wrapper.ts +70 -18
- package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -0
- package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +20 -1
- package/packages/lsp-core/src/lsp/workspace-markers.ts +1 -0
- package/packages/lsp-core/src/tools/diagnostics.ts +3 -3
- package/packages/lsp-core/src/tools/navigation.ts +4 -2
- package/packages/lsp-core/src/tools/rename.ts +4 -2
- package/packages/lsp-core/src/tools/symbols.ts +1 -1
- package/packages/lsp-daemon/dist/cli.js +160 -71
- package/packages/lsp-daemon/dist/client.js +135 -46
- package/packages/lsp-daemon/dist/index.js +143 -54
- package/packages/lsp-tools-mcp/dist/cli.js +131 -42
- package/packages/lsp-tools-mcp/dist/mcp.js +131 -42
- package/packages/lsp-tools-mcp/dist/tools.js +131 -42
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- 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/codegraph/dist/cli.js +118 -8
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +118 -8
- package/packages/omo-codex/plugin/components/codegraph/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/lazycodex-executor-verify/test/codex-hook.test.ts +3 -17
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +147 -64
- 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/rules/test/bundled-rules-priority.test.ts +11 -16
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +16 -23
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +9 -7
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +6 -4
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +12 -9
- package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +28 -37
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +37 -69
- package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +2 -3
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +1 -15
- package/packages/omo-codex/plugin/components/start-work-continuation/AGENTS.md +3 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/cli.test.ts +0 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +2 -16
- 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/teammode/test/thread-title-hook.test.ts +3 -9
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +24 -12
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +24 -12
- 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/directive.md +6 -0
- 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/ultrawork/skills/ultrawork/SKILL.md +6 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +27 -3
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +0 -136
- package/packages/omo-codex/plugin/components/ultrawork/test/skill-pointer.test.ts +0 -2
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +3 -2
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/define-goal.md +108 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-continuation.test.ts +0 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +0 -3
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +2 -35
- package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +4 -5
- 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-codegraph-init-guidance.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/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-checking-codegraph-bootstrap.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-start-work-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-checking-start-work-continuation.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 +20 -20
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +10 -7
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +1 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stylegallery.md +80 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +6 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/ulw-loop/references/define-goal.md +108 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +27 -3
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +19 -173
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +4 -24
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +175 -13
- package/packages/omo-codex/plugin/test/aggregate.test.mjs +78 -2
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +19 -33
- package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +21 -27
- package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +0 -36
- package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +101 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +1 -119
- package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +0 -40
- package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +6 -62
- package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +3 -36
- package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +0 -44
- package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +2 -6
- package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +0 -3
- package/packages/omo-codex/plugin/test/ulw-plan-review-state-contract.test.mjs +0 -3
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +57 -19
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +7 -2
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/shared-skills/skills/frontend/SKILL.md +10 -7
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +1 -0
- package/packages/shared-skills/skills/frontend/references/design/stylegallery.md +80 -0
- package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +2 -2
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +27 -3
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/dist/tools/call-omo-agent/background-agent-executor.d.ts +0 -5
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +0 -92
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +0 -314
- package/packages/omo-codex/plugin/test/ulw-plan-scope-contract.test.mjs +0 -24
|
@@ -3320,8 +3320,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
|
|
|
3320
3320
|
};
|
|
3321
3321
|
}
|
|
3322
3322
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
3323
|
-
import { existsSync as
|
|
3324
|
-
import { dirname as
|
|
3323
|
+
import { existsSync as existsSync10, realpathSync as realpathSync5, statSync as statSync3 } from "node:fs";
|
|
3324
|
+
import { basename as basename3, dirname as dirname7, join as join5, resolve as resolve7 } from "node:path";
|
|
3325
3325
|
|
|
3326
3326
|
// ../lsp-core/src/request-context.ts
|
|
3327
3327
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -3502,15 +3502,52 @@ function errorCode(error) {
|
|
|
3502
3502
|
return typeof code === "string" ? code : undefined;
|
|
3503
3503
|
}
|
|
3504
3504
|
|
|
3505
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
3506
|
+
import { existsSync as existsSync6, realpathSync as realpathSync4 } from "node:fs";
|
|
3507
|
+
import { dirname as dirname5, join as join3 } from "node:path";
|
|
3508
|
+
|
|
3509
|
+
// ../lsp-core/src/lsp/workspace-markers.ts
|
|
3510
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
3511
|
+
|
|
3512
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
3513
|
+
function findWorkspaceRootOutsideContext(directory) {
|
|
3514
|
+
const marked = nearestMarkedAncestor(directory);
|
|
3515
|
+
if (marked !== undefined)
|
|
3516
|
+
return marked;
|
|
3517
|
+
return realpathSync4(nearestExistingAncestor(directory));
|
|
3518
|
+
}
|
|
3519
|
+
function nearestMarkedAncestor(directory) {
|
|
3520
|
+
let current = directory;
|
|
3521
|
+
for (;; ) {
|
|
3522
|
+
if (existsSync6(current) && WORKSPACE_MARKERS.some((marker) => existsSync6(join3(current, marker)))) {
|
|
3523
|
+
return realpathSync4(current);
|
|
3524
|
+
}
|
|
3525
|
+
const parent = dirname5(current);
|
|
3526
|
+
if (parent === current)
|
|
3527
|
+
return;
|
|
3528
|
+
current = parent;
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
function nearestExistingAncestor(directory) {
|
|
3532
|
+
let current = directory;
|
|
3533
|
+
while (!existsSync6(current)) {
|
|
3534
|
+
const parent = dirname5(current);
|
|
3535
|
+
if (parent === current)
|
|
3536
|
+
return current;
|
|
3537
|
+
current = parent;
|
|
3538
|
+
}
|
|
3539
|
+
return current;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3505
3542
|
// ../lsp-core/src/lsp/server-install-state.ts
|
|
3506
|
-
import { existsSync as
|
|
3507
|
-
import { dirname as
|
|
3543
|
+
import { existsSync as existsSync7, mkdirSync, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3544
|
+
import { dirname as dirname6 } from "node:path";
|
|
3508
3545
|
function getInstallDecisionsPath() {
|
|
3509
3546
|
return lspRequestContext().installDecisionsPath;
|
|
3510
3547
|
}
|
|
3511
3548
|
function loadInstallDecisions() {
|
|
3512
3549
|
const path = getInstallDecisionsPath();
|
|
3513
|
-
if (!
|
|
3550
|
+
if (!existsSync7(path))
|
|
3514
3551
|
return {};
|
|
3515
3552
|
try {
|
|
3516
3553
|
const parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
@@ -3532,7 +3569,7 @@ function isInstallDecision(value) {
|
|
|
3532
3569
|
}
|
|
3533
3570
|
function writeInstallDecisions(decisions) {
|
|
3534
3571
|
const path = getInstallDecisionsPath();
|
|
3535
|
-
mkdirSync(
|
|
3572
|
+
mkdirSync(dirname6(path), { recursive: true });
|
|
3536
3573
|
const tmpPath = `${path}.tmp`;
|
|
3537
3574
|
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
3538
3575
|
`, "utf8");
|
|
@@ -3551,7 +3588,7 @@ function isRecord5(value) {
|
|
|
3551
3588
|
}
|
|
3552
3589
|
|
|
3553
3590
|
// ../lsp-core/src/lsp/config-loader.ts
|
|
3554
|
-
import { existsSync as
|
|
3591
|
+
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
3555
3592
|
|
|
3556
3593
|
// ../lsp-core/src/lsp/server-definitions.ts
|
|
3557
3594
|
var LSP_INSTALL_HINTS = {
|
|
@@ -3708,7 +3745,7 @@ function getUserConfigPath() {
|
|
|
3708
3745
|
return lspRequestContext().userConfigPath;
|
|
3709
3746
|
}
|
|
3710
3747
|
function loadJsonFile(path) {
|
|
3711
|
-
if (!
|
|
3748
|
+
if (!existsSync8(path))
|
|
3712
3749
|
return null;
|
|
3713
3750
|
try {
|
|
3714
3751
|
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
@@ -3896,8 +3933,8 @@ function getDisabledServerIds() {
|
|
|
3896
3933
|
}
|
|
3897
3934
|
|
|
3898
3935
|
// ../lsp-core/src/lsp/server-installation.ts
|
|
3899
|
-
import { existsSync as
|
|
3900
|
-
import { delimiter as delimiter3, join as
|
|
3936
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
3937
|
+
import { delimiter as delimiter3, join as join4 } from "node:path";
|
|
3901
3938
|
function isServerInstalled(command, _workingDirectory) {
|
|
3902
3939
|
if (command.length === 0)
|
|
3903
3940
|
return false;
|
|
@@ -3905,7 +3942,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3905
3942
|
if (!cmd)
|
|
3906
3943
|
return false;
|
|
3907
3944
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
3908
|
-
if (
|
|
3945
|
+
if (existsSync9(cmd))
|
|
3909
3946
|
return true;
|
|
3910
3947
|
}
|
|
3911
3948
|
const isWindows = process.platform === "win32";
|
|
@@ -3926,7 +3963,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3926
3963
|
const paths = pathEnv.split(delimiter3);
|
|
3927
3964
|
for (const p of paths) {
|
|
3928
3965
|
for (const suffix of exts) {
|
|
3929
|
-
if (
|
|
3966
|
+
if (existsSync9(join4(p, cmd + suffix))) {
|
|
3930
3967
|
return true;
|
|
3931
3968
|
}
|
|
3932
3969
|
}
|
|
@@ -4022,7 +4059,6 @@ function getAllServers() {
|
|
|
4022
4059
|
}
|
|
4023
4060
|
|
|
4024
4061
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
4025
|
-
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4026
4062
|
function isDirectoryPath(filePath) {
|
|
4027
4063
|
try {
|
|
4028
4064
|
return statSync3(filePath).isDirectory();
|
|
@@ -4031,32 +4067,85 @@ function isDirectoryPath(filePath) {
|
|
|
4031
4067
|
}
|
|
4032
4068
|
}
|
|
4033
4069
|
function findWorkspaceRoot(filePath) {
|
|
4034
|
-
const
|
|
4070
|
+
const cwd = contextCwd();
|
|
4071
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4035
4072
|
let dir = abs;
|
|
4036
4073
|
if (!isDirectoryPath(dir)) {
|
|
4037
|
-
dir =
|
|
4038
|
-
}
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4074
|
+
dir = dirname7(dir);
|
|
4075
|
+
}
|
|
4076
|
+
if (!isPathInside(cwd, abs))
|
|
4077
|
+
return findWorkspaceRootOutsideContext(dir);
|
|
4078
|
+
const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
|
|
4079
|
+
while (isPathInside(cwd, dir)) {
|
|
4080
|
+
const canonicalDir = existingDirectoryInsideContext(dir, cwd);
|
|
4081
|
+
if (canonicalDir !== undefined) {
|
|
4082
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
4083
|
+
if (existsSync10(join5(dir, marker))) {
|
|
4084
|
+
return canonicalDir;
|
|
4085
|
+
}
|
|
4044
4086
|
}
|
|
4045
4087
|
}
|
|
4046
|
-
|
|
4047
|
-
|
|
4088
|
+
if (dir === cwd)
|
|
4089
|
+
break;
|
|
4090
|
+
dir = dirname7(dir);
|
|
4048
4091
|
}
|
|
4049
|
-
return
|
|
4092
|
+
return fallbackRoot;
|
|
4050
4093
|
}
|
|
4051
|
-
function
|
|
4094
|
+
function resolveReadablePathInsideContext(filePath) {
|
|
4052
4095
|
const cwd = contextCwd();
|
|
4053
4096
|
const abs = resolve7(cwd, filePath);
|
|
4097
|
+
if (isPathInside(cwd, abs))
|
|
4098
|
+
return abs;
|
|
4099
|
+
const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
|
|
4100
|
+
if (rebased !== undefined)
|
|
4101
|
+
return rebased;
|
|
4102
|
+
return canonicalizeExistingOrNearestAncestor(abs);
|
|
4103
|
+
}
|
|
4104
|
+
function resolvePathInsideContext(filePath) {
|
|
4105
|
+
const cwd = contextCwd();
|
|
4106
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4054
4107
|
const canonical = canonicalizeExistingOrNearestAncestor(abs);
|
|
4055
4108
|
if (!isPathInside(cwd, canonical)) {
|
|
4056
4109
|
throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
|
|
4057
4110
|
}
|
|
4058
4111
|
return canonical;
|
|
4059
4112
|
}
|
|
4113
|
+
function rebaseThroughCanonicalAncestor(path, cwd) {
|
|
4114
|
+
let current = path;
|
|
4115
|
+
const suffix = [];
|
|
4116
|
+
while (true) {
|
|
4117
|
+
if (existsSync10(current)) {
|
|
4118
|
+
const canonical = realpathSync5(current);
|
|
4119
|
+
if (isPathInside(cwd, canonical))
|
|
4120
|
+
return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
|
|
4121
|
+
}
|
|
4122
|
+
const parent = dirname7(current);
|
|
4123
|
+
if (parent === current)
|
|
4124
|
+
return;
|
|
4125
|
+
suffix.unshift(basename3(current));
|
|
4126
|
+
current = parent;
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
function existingDirectoryInsideContext(directory, cwd) {
|
|
4130
|
+
if (!existsSync10(directory))
|
|
4131
|
+
return;
|
|
4132
|
+
const canonical = realpathSync5(directory);
|
|
4133
|
+
if (!statSync3(canonical).isDirectory())
|
|
4134
|
+
return;
|
|
4135
|
+
return isPathInside(cwd, canonical) ? canonical : undefined;
|
|
4136
|
+
}
|
|
4137
|
+
function nearestExistingDirectoryInsideContext(directory, cwd) {
|
|
4138
|
+
let current = directory;
|
|
4139
|
+
while (isPathInside(cwd, current)) {
|
|
4140
|
+
const canonical = existingDirectoryInsideContext(current, cwd);
|
|
4141
|
+
if (canonical !== undefined)
|
|
4142
|
+
return canonical;
|
|
4143
|
+
if (current === cwd)
|
|
4144
|
+
return;
|
|
4145
|
+
current = dirname7(current);
|
|
4146
|
+
}
|
|
4147
|
+
return;
|
|
4148
|
+
}
|
|
4060
4149
|
function formatServerLookupError(result) {
|
|
4061
4150
|
if (result.status === "not_installed") {
|
|
4062
4151
|
return formatNotInstalled(result);
|
|
@@ -4127,7 +4216,7 @@ function formatNotInstalled(result) {
|
|
|
4127
4216
|
].join(`
|
|
4128
4217
|
`);
|
|
4129
4218
|
}
|
|
4130
|
-
var
|
|
4219
|
+
var READ_ONLY_TOOLS = new Set([
|
|
4131
4220
|
"diagnostics",
|
|
4132
4221
|
"definition",
|
|
4133
4222
|
"references",
|
|
@@ -4136,7 +4225,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
4136
4225
|
"prepareRename"
|
|
4137
4226
|
]);
|
|
4138
4227
|
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
4139
|
-
const absPath = resolvePathInsideContext(filePath);
|
|
4228
|
+
const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
|
|
4140
4229
|
if (isDirectoryPath(absPath)) {
|
|
4141
4230
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
4142
4231
|
}
|
|
@@ -4151,9 +4240,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4151
4240
|
const acquireAndCall = async (allowRetry) => {
|
|
4152
4241
|
const client = await manager2.getClient(root, server2, options.signal);
|
|
4153
4242
|
try {
|
|
4154
|
-
return await fn(client, root);
|
|
4243
|
+
return await fn(client, root, absPath);
|
|
4155
4244
|
} catch (err) {
|
|
4156
|
-
if (allowRetry &&
|
|
4245
|
+
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
4157
4246
|
manager2.invalidateClient(root, server2.id, client);
|
|
4158
4247
|
return acquireAndCall(false);
|
|
4159
4248
|
}
|
|
@@ -4171,8 +4260,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4171
4260
|
}
|
|
4172
4261
|
|
|
4173
4262
|
// ../lsp-core/src/lsp/directory-diagnostics.ts
|
|
4174
|
-
import { existsSync as
|
|
4175
|
-
import { join as
|
|
4263
|
+
import { existsSync as existsSync11, lstatSync as lstatSync4, readdirSync as readdirSync3 } from "node:fs";
|
|
4264
|
+
import { join as join6, resolve as resolve8 } from "node:path";
|
|
4176
4265
|
|
|
4177
4266
|
// ../lsp-core/src/lsp/formatters.ts
|
|
4178
4267
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -4302,7 +4391,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
4302
4391
|
for (const entry of entries) {
|
|
4303
4392
|
if (files.length >= maxFiles)
|
|
4304
4393
|
return;
|
|
4305
|
-
const fullPath =
|
|
4394
|
+
const fullPath = join6(currentDir, entry);
|
|
4306
4395
|
let stat;
|
|
4307
4396
|
try {
|
|
4308
4397
|
stat = lstatSync4(fullPath);
|
|
@@ -4328,7 +4417,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4328
4417
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
4329
4418
|
}
|
|
4330
4419
|
const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
|
|
4331
|
-
if (!
|
|
4420
|
+
if (!existsSync11(absDir)) {
|
|
4332
4421
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
4333
4422
|
}
|
|
4334
4423
|
const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
|
|
@@ -4415,7 +4504,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4415
4504
|
|
|
4416
4505
|
// ../lsp-core/src/lsp/infer-extension.ts
|
|
4417
4506
|
import { lstatSync as lstatSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
4418
|
-
import { join as
|
|
4507
|
+
import { join as join7 } from "node:path";
|
|
4419
4508
|
var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
4420
4509
|
var MAX_SCAN_ENTRIES = 500;
|
|
4421
4510
|
function inferExtensionFromDirectory(directory) {
|
|
@@ -4433,7 +4522,7 @@ function inferExtensionFromDirectory(directory) {
|
|
|
4433
4522
|
for (const entry of entries) {
|
|
4434
4523
|
if (scanned >= MAX_SCAN_ENTRIES)
|
|
4435
4524
|
return;
|
|
4436
|
-
const fullPath =
|
|
4525
|
+
const fullPath = join7(dir, entry);
|
|
4437
4526
|
let stat;
|
|
4438
4527
|
try {
|
|
4439
4528
|
stat = lstatSync5(fullPath);
|
|
@@ -4608,7 +4697,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4608
4697
|
const filePath = requireString(params, "filePath");
|
|
4609
4698
|
const severity = severityFilter(params);
|
|
4610
4699
|
try {
|
|
4611
|
-
const absPath =
|
|
4700
|
+
const absPath = resolveReadablePathInsideContext(filePath);
|
|
4612
4701
|
if (isDirectoryPath(absPath)) {
|
|
4613
4702
|
const extension = inferExtensionFromDirectory(absPath);
|
|
4614
4703
|
if (!extension) {
|
|
@@ -4637,7 +4726,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4637
4726
|
};
|
|
4638
4727
|
return text(output2.output, details2);
|
|
4639
4728
|
}
|
|
4640
|
-
const result = await withLspClient(filePath, async (client) => client.diagnostics(
|
|
4729
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
4641
4730
|
if (result.transientError) {
|
|
4642
4731
|
const message = result.transientError.message;
|
|
4643
4732
|
const details2 = {
|
|
@@ -4712,7 +4801,7 @@ async function executeLspGotoDefinition(params, signal) {
|
|
|
4712
4801
|
const line = requireNumber(params, "line");
|
|
4713
4802
|
const character = requireNumber(params, "character");
|
|
4714
4803
|
try {
|
|
4715
|
-
const result = await withLspClient(filePath, async (client) => client.definition(
|
|
4804
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
|
|
4716
4805
|
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
4717
4806
|
const details = { filePath, line, character, locations };
|
|
4718
4807
|
if (locations.length === 0)
|
|
@@ -4737,7 +4826,7 @@ async function executeLspFindReferences(params, signal) {
|
|
|
4737
4826
|
const character = requireNumber(params, "character");
|
|
4738
4827
|
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
4739
4828
|
try {
|
|
4740
|
-
const result = await withLspClient(filePath, async (client) => client.references(
|
|
4829
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
|
|
4741
4830
|
const references = Array.isArray(result) ? result : [];
|
|
4742
4831
|
const total = references.length;
|
|
4743
4832
|
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
@@ -4779,7 +4868,7 @@ async function executeLspPrepareRename(params, signal) {
|
|
|
4779
4868
|
const line = requireNumber(params, "line");
|
|
4780
4869
|
const character = requireNumber(params, "character");
|
|
4781
4870
|
try {
|
|
4782
|
-
const result = await withLspClient(filePath, async (client) => client.prepareRename(
|
|
4871
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
|
|
4783
4872
|
const details = { filePath, line, character, result };
|
|
4784
4873
|
return text(formatPrepareRenameResult(result), details);
|
|
4785
4874
|
} catch (error) {
|
|
@@ -4800,7 +4889,7 @@ async function executeLspRename(params, signal) {
|
|
|
4800
4889
|
const character = requireNumber(params, "character");
|
|
4801
4890
|
const newName = requireString(params, "newName");
|
|
4802
4891
|
try {
|
|
4803
|
-
const result = await withLspClient(filePath, async (client) => client.rename(
|
|
4892
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
|
|
4804
4893
|
const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
|
|
4805
4894
|
return text(formatApplyResult(result.apply), details, !result.apply.success);
|
|
4806
4895
|
} catch (error) {
|
|
@@ -4880,7 +4969,7 @@ async function executeLspSymbols(params, signal) {
|
|
|
4880
4969
|
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
4881
4970
|
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
4882
4971
|
}
|
|
4883
|
-
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(
|
|
4972
|
+
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
4884
4973
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
4885
4974
|
} catch (error) {
|
|
4886
4975
|
const query = optionalString(params, "query");
|