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
|
@@ -8,9 +8,9 @@ import { argv, execPath as execPath2, stderr } from "node:process";
|
|
|
8
8
|
import { stdin as processStdin } from "node:process";
|
|
9
9
|
|
|
10
10
|
// src/codex-hook.ts
|
|
11
|
-
import { readFileSync as readFileSync9, realpathSync as
|
|
11
|
+
import { readFileSync as readFileSync9, realpathSync as realpathSync8 } from "node:fs";
|
|
12
12
|
import { homedir as homedir3 } from "node:os";
|
|
13
|
-
import { join as
|
|
13
|
+
import { join as join12, resolve as resolve11 } from "node:path";
|
|
14
14
|
|
|
15
15
|
// ../../../../lsp-daemon/dist/client.js
|
|
16
16
|
import { connect } from "node:net";
|
|
@@ -42,8 +42,8 @@ import * as path from "node:path";
|
|
|
42
42
|
import { fileURLToPath } from "node:url";
|
|
43
43
|
import { statSync as statSync2 } from "node:fs";
|
|
44
44
|
import { isAbsolute as isAbsolute2 } from "node:path";
|
|
45
|
-
import { existsSync as
|
|
46
|
-
import { dirname as
|
|
45
|
+
import { existsSync as existsSync11, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
|
|
46
|
+
import { basename as basename3, dirname as dirname9, join as join5, resolve as resolve7 } from "node:path";
|
|
47
47
|
import { basename as basename2, extname } from "node:path";
|
|
48
48
|
import { resolve as resolve6 } from "node:path";
|
|
49
49
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
@@ -62,16 +62,18 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
62
62
|
import { dirname as dirname5, relative as relative4, resolve as resolve4 } from "node:path";
|
|
63
63
|
import { existsSync as existsSync6, lstatSync as lstatSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
64
64
|
import { dirname as dirname6, resolve as resolve5 } from "node:path";
|
|
65
|
-
import { existsSync as existsSync7,
|
|
66
|
-
import { dirname as dirname7 } from "node:path";
|
|
67
|
-
import { existsSync as existsSync8, readFileSync as
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import { existsSync as
|
|
71
|
-
import {
|
|
65
|
+
import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
|
|
66
|
+
import { dirname as dirname7, join as join3 } from "node:path";
|
|
67
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
68
|
+
import { dirname as dirname8 } from "node:path";
|
|
69
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
|
|
70
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
71
|
+
import { delimiter as delimiter3, join as join4 } from "node:path";
|
|
72
|
+
import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
|
|
73
|
+
import { join as join6, resolve as resolve8 } from "node:path";
|
|
72
74
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
73
75
|
import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
|
|
74
|
-
import { join as
|
|
76
|
+
import { join as join7 } from "node:path";
|
|
75
77
|
import { statSync as statSync5 } from "node:fs";
|
|
76
78
|
import { isAbsolute as isAbsolute5 } from "node:path";
|
|
77
79
|
|
|
@@ -3606,12 +3608,41 @@ function getLspManager() {
|
|
|
3606
3608
|
}
|
|
3607
3609
|
return _defaultInstance;
|
|
3608
3610
|
}
|
|
3611
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
3612
|
+
function findWorkspaceRootOutsideContext(directory) {
|
|
3613
|
+
const marked = nearestMarkedAncestor(directory);
|
|
3614
|
+
if (marked !== undefined)
|
|
3615
|
+
return marked;
|
|
3616
|
+
return realpathSync4(nearestExistingAncestor(directory));
|
|
3617
|
+
}
|
|
3618
|
+
function nearestMarkedAncestor(directory) {
|
|
3619
|
+
let current = directory;
|
|
3620
|
+
for (;; ) {
|
|
3621
|
+
if (existsSync7(current) && WORKSPACE_MARKERS.some((marker) => existsSync7(join3(current, marker)))) {
|
|
3622
|
+
return realpathSync4(current);
|
|
3623
|
+
}
|
|
3624
|
+
const parent = dirname7(current);
|
|
3625
|
+
if (parent === current)
|
|
3626
|
+
return;
|
|
3627
|
+
current = parent;
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
function nearestExistingAncestor(directory) {
|
|
3631
|
+
let current = directory;
|
|
3632
|
+
while (!existsSync7(current)) {
|
|
3633
|
+
const parent = dirname7(current);
|
|
3634
|
+
if (parent === current)
|
|
3635
|
+
return current;
|
|
3636
|
+
current = parent;
|
|
3637
|
+
}
|
|
3638
|
+
return current;
|
|
3639
|
+
}
|
|
3609
3640
|
function getInstallDecisionsPath() {
|
|
3610
3641
|
return lspRequestContext().installDecisionsPath;
|
|
3611
3642
|
}
|
|
3612
3643
|
function loadInstallDecisions() {
|
|
3613
3644
|
const path2 = getInstallDecisionsPath();
|
|
3614
|
-
if (!
|
|
3645
|
+
if (!existsSync8(path2))
|
|
3615
3646
|
return {};
|
|
3616
3647
|
try {
|
|
3617
3648
|
const parsed = JSON.parse(readFileSync4(path2, "utf8"));
|
|
@@ -3633,7 +3664,7 @@ function isInstallDecision(value) {
|
|
|
3633
3664
|
}
|
|
3634
3665
|
function writeInstallDecisions(decisions) {
|
|
3635
3666
|
const path2 = getInstallDecisionsPath();
|
|
3636
|
-
mkdirSync3(
|
|
3667
|
+
mkdirSync3(dirname8(path2), { recursive: true });
|
|
3637
3668
|
const tmpPath = `${path2}.tmp`;
|
|
3638
3669
|
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
3639
3670
|
`, "utf8");
|
|
@@ -3802,7 +3833,7 @@ function getUserConfigPath() {
|
|
|
3802
3833
|
return lspRequestContext().userConfigPath;
|
|
3803
3834
|
}
|
|
3804
3835
|
function loadJsonFile(path2) {
|
|
3805
|
-
if (!
|
|
3836
|
+
if (!existsSync9(path2))
|
|
3806
3837
|
return null;
|
|
3807
3838
|
try {
|
|
3808
3839
|
const parsed = JSON.parse(readFileSync5(path2, "utf-8"));
|
|
@@ -3995,7 +4026,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3995
4026
|
if (!cmd)
|
|
3996
4027
|
return false;
|
|
3997
4028
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
3998
|
-
if (
|
|
4029
|
+
if (existsSync10(cmd))
|
|
3999
4030
|
return true;
|
|
4000
4031
|
}
|
|
4001
4032
|
const isWindows = process.platform === "win32";
|
|
@@ -4016,7 +4047,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
4016
4047
|
const paths = pathEnv.split(delimiter3);
|
|
4017
4048
|
for (const p of paths) {
|
|
4018
4049
|
for (const suffix of exts) {
|
|
4019
|
-
if (
|
|
4050
|
+
if (existsSync10(join4(p, cmd + suffix))) {
|
|
4020
4051
|
return true;
|
|
4021
4052
|
}
|
|
4022
4053
|
}
|
|
@@ -4108,7 +4139,6 @@ function getAllServers() {
|
|
|
4108
4139
|
}
|
|
4109
4140
|
return result;
|
|
4110
4141
|
}
|
|
4111
|
-
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4112
4142
|
function isDirectoryPath(filePath) {
|
|
4113
4143
|
try {
|
|
4114
4144
|
return statSync4(filePath).isDirectory();
|
|
@@ -4117,32 +4147,85 @@ function isDirectoryPath(filePath) {
|
|
|
4117
4147
|
}
|
|
4118
4148
|
}
|
|
4119
4149
|
function findWorkspaceRoot(filePath) {
|
|
4120
|
-
const
|
|
4150
|
+
const cwd = contextCwd();
|
|
4151
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4121
4152
|
let dir = abs;
|
|
4122
4153
|
if (!isDirectoryPath(dir)) {
|
|
4123
|
-
dir =
|
|
4124
|
-
}
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4154
|
+
dir = dirname9(dir);
|
|
4155
|
+
}
|
|
4156
|
+
if (!isPathInside(cwd, abs))
|
|
4157
|
+
return findWorkspaceRootOutsideContext(dir);
|
|
4158
|
+
const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
|
|
4159
|
+
while (isPathInside(cwd, dir)) {
|
|
4160
|
+
const canonicalDir = existingDirectoryInsideContext(dir, cwd);
|
|
4161
|
+
if (canonicalDir !== undefined) {
|
|
4162
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
4163
|
+
if (existsSync11(join5(dir, marker))) {
|
|
4164
|
+
return canonicalDir;
|
|
4165
|
+
}
|
|
4130
4166
|
}
|
|
4131
4167
|
}
|
|
4132
|
-
|
|
4133
|
-
|
|
4168
|
+
if (dir === cwd)
|
|
4169
|
+
break;
|
|
4170
|
+
dir = dirname9(dir);
|
|
4134
4171
|
}
|
|
4135
|
-
return
|
|
4172
|
+
return fallbackRoot;
|
|
4136
4173
|
}
|
|
4137
|
-
function
|
|
4174
|
+
function resolveReadablePathInsideContext(filePath) {
|
|
4138
4175
|
const cwd = contextCwd();
|
|
4139
4176
|
const abs = resolve7(cwd, filePath);
|
|
4177
|
+
if (isPathInside(cwd, abs))
|
|
4178
|
+
return abs;
|
|
4179
|
+
const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
|
|
4180
|
+
if (rebased !== undefined)
|
|
4181
|
+
return rebased;
|
|
4182
|
+
return canonicalizeExistingOrNearestAncestor(abs);
|
|
4183
|
+
}
|
|
4184
|
+
function resolvePathInsideContext(filePath) {
|
|
4185
|
+
const cwd = contextCwd();
|
|
4186
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4140
4187
|
const canonical = canonicalizeExistingOrNearestAncestor(abs);
|
|
4141
4188
|
if (!isPathInside(cwd, canonical)) {
|
|
4142
4189
|
throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
|
|
4143
4190
|
}
|
|
4144
4191
|
return canonical;
|
|
4145
4192
|
}
|
|
4193
|
+
function rebaseThroughCanonicalAncestor(path2, cwd) {
|
|
4194
|
+
let current = path2;
|
|
4195
|
+
const suffix = [];
|
|
4196
|
+
while (true) {
|
|
4197
|
+
if (existsSync11(current)) {
|
|
4198
|
+
const canonical = realpathSync5(current);
|
|
4199
|
+
if (isPathInside(cwd, canonical))
|
|
4200
|
+
return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
|
|
4201
|
+
}
|
|
4202
|
+
const parent = dirname9(current);
|
|
4203
|
+
if (parent === current)
|
|
4204
|
+
return;
|
|
4205
|
+
suffix.unshift(basename3(current));
|
|
4206
|
+
current = parent;
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
function existingDirectoryInsideContext(directory, cwd) {
|
|
4210
|
+
if (!existsSync11(directory))
|
|
4211
|
+
return;
|
|
4212
|
+
const canonical = realpathSync5(directory);
|
|
4213
|
+
if (!statSync4(canonical).isDirectory())
|
|
4214
|
+
return;
|
|
4215
|
+
return isPathInside(cwd, canonical) ? canonical : undefined;
|
|
4216
|
+
}
|
|
4217
|
+
function nearestExistingDirectoryInsideContext(directory, cwd) {
|
|
4218
|
+
let current = directory;
|
|
4219
|
+
while (isPathInside(cwd, current)) {
|
|
4220
|
+
const canonical = existingDirectoryInsideContext(current, cwd);
|
|
4221
|
+
if (canonical !== undefined)
|
|
4222
|
+
return canonical;
|
|
4223
|
+
if (current === cwd)
|
|
4224
|
+
return;
|
|
4225
|
+
current = dirname9(current);
|
|
4226
|
+
}
|
|
4227
|
+
return;
|
|
4228
|
+
}
|
|
4146
4229
|
function formatServerLookupError(result) {
|
|
4147
4230
|
if (result.status === "not_installed") {
|
|
4148
4231
|
return formatNotInstalled(result);
|
|
@@ -4213,7 +4296,7 @@ function formatNotInstalled(result) {
|
|
|
4213
4296
|
].join(`
|
|
4214
4297
|
`);
|
|
4215
4298
|
}
|
|
4216
|
-
var
|
|
4299
|
+
var READ_ONLY_TOOLS = new Set([
|
|
4217
4300
|
"diagnostics",
|
|
4218
4301
|
"definition",
|
|
4219
4302
|
"references",
|
|
@@ -4222,7 +4305,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
4222
4305
|
"prepareRename"
|
|
4223
4306
|
]);
|
|
4224
4307
|
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
4225
|
-
const absPath = resolvePathInsideContext(filePath);
|
|
4308
|
+
const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
|
|
4226
4309
|
if (isDirectoryPath(absPath)) {
|
|
4227
4310
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
4228
4311
|
}
|
|
@@ -4237,9 +4320,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4237
4320
|
const acquireAndCall = async (allowRetry) => {
|
|
4238
4321
|
const client = await manager.getClient(root, server2, options.signal);
|
|
4239
4322
|
try {
|
|
4240
|
-
return await fn(client, root);
|
|
4323
|
+
return await fn(client, root, absPath);
|
|
4241
4324
|
} catch (err) {
|
|
4242
|
-
if (allowRetry &&
|
|
4325
|
+
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
4243
4326
|
manager.invalidateClient(root, server2.id, client);
|
|
4244
4327
|
return acquireAndCall(false);
|
|
4245
4328
|
}
|
|
@@ -4379,7 +4462,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
4379
4462
|
for (const entry of entries) {
|
|
4380
4463
|
if (files.length >= maxFiles)
|
|
4381
4464
|
return;
|
|
4382
|
-
const fullPath =
|
|
4465
|
+
const fullPath = join6(currentDir, entry);
|
|
4383
4466
|
let stat;
|
|
4384
4467
|
try {
|
|
4385
4468
|
stat = lstatSync5(fullPath);
|
|
@@ -4405,7 +4488,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4405
4488
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
4406
4489
|
}
|
|
4407
4490
|
const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
|
|
4408
|
-
if (!
|
|
4491
|
+
if (!existsSync12(absDir)) {
|
|
4409
4492
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
4410
4493
|
}
|
|
4411
4494
|
const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
|
|
@@ -4506,7 +4589,7 @@ function inferExtensionFromDirectory(directory) {
|
|
|
4506
4589
|
for (const entry of entries) {
|
|
4507
4590
|
if (scanned >= MAX_SCAN_ENTRIES)
|
|
4508
4591
|
return;
|
|
4509
|
-
const fullPath =
|
|
4592
|
+
const fullPath = join7(dir, entry);
|
|
4510
4593
|
let stat;
|
|
4511
4594
|
try {
|
|
4512
4595
|
stat = lstatSync6(fullPath);
|
|
@@ -4669,7 +4752,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4669
4752
|
const filePath = requireString(params, "filePath");
|
|
4670
4753
|
const severity = severityFilter(params);
|
|
4671
4754
|
try {
|
|
4672
|
-
const absPath =
|
|
4755
|
+
const absPath = resolveReadablePathInsideContext(filePath);
|
|
4673
4756
|
if (isDirectoryPath(absPath)) {
|
|
4674
4757
|
const extension = inferExtensionFromDirectory(absPath);
|
|
4675
4758
|
if (!extension) {
|
|
@@ -4698,7 +4781,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4698
4781
|
};
|
|
4699
4782
|
return text(output2.output, details2);
|
|
4700
4783
|
}
|
|
4701
|
-
const result = await withLspClient(filePath, async (client) => client.diagnostics(
|
|
4784
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
4702
4785
|
if (result.transientError) {
|
|
4703
4786
|
const message = result.transientError.message;
|
|
4704
4787
|
const details2 = {
|
|
@@ -4770,7 +4853,7 @@ async function executeLspGotoDefinition(params, signal) {
|
|
|
4770
4853
|
const line = requireNumber(params, "line");
|
|
4771
4854
|
const character = requireNumber(params, "character");
|
|
4772
4855
|
try {
|
|
4773
|
-
const result = await withLspClient(filePath, async (client) => client.definition(
|
|
4856
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
|
|
4774
4857
|
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
4775
4858
|
const details = { filePath, line, character, locations };
|
|
4776
4859
|
if (locations.length === 0)
|
|
@@ -4795,7 +4878,7 @@ async function executeLspFindReferences(params, signal) {
|
|
|
4795
4878
|
const character = requireNumber(params, "character");
|
|
4796
4879
|
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
4797
4880
|
try {
|
|
4798
|
-
const result = await withLspClient(filePath, async (client) => client.references(
|
|
4881
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
|
|
4799
4882
|
const references = Array.isArray(result) ? result : [];
|
|
4800
4883
|
const total = references.length;
|
|
4801
4884
|
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
@@ -4835,7 +4918,7 @@ async function executeLspPrepareRename(params, signal) {
|
|
|
4835
4918
|
const line = requireNumber(params, "line");
|
|
4836
4919
|
const character = requireNumber(params, "character");
|
|
4837
4920
|
try {
|
|
4838
|
-
const result = await withLspClient(filePath, async (client) => client.prepareRename(
|
|
4921
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
|
|
4839
4922
|
const details = { filePath, line, character, result };
|
|
4840
4923
|
return text(formatPrepareRenameResult(result), details);
|
|
4841
4924
|
} catch (error) {
|
|
@@ -4856,7 +4939,7 @@ async function executeLspRename(params, signal) {
|
|
|
4856
4939
|
const character = requireNumber(params, "character");
|
|
4857
4940
|
const newName = requireString(params, "newName");
|
|
4858
4941
|
try {
|
|
4859
|
-
const result = await withLspClient(filePath, async (client) => client.rename(
|
|
4942
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
|
|
4860
4943
|
const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
|
|
4861
4944
|
return text(formatApplyResult(result.apply), details, !result.apply.success);
|
|
4862
4945
|
} catch (error) {
|
|
@@ -4930,7 +5013,7 @@ async function executeLspSymbols(params, signal) {
|
|
|
4930
5013
|
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
4931
5014
|
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
4932
5015
|
}
|
|
4933
|
-
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(
|
|
5016
|
+
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
4934
5017
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
4935
5018
|
} catch (error) {
|
|
4936
5019
|
const query = optionalString(params, "query");
|
|
@@ -5400,8 +5483,8 @@ function extensionKey(filePath) {
|
|
|
5400
5483
|
}
|
|
5401
5484
|
// ../../../../lsp-core/src/request-context.ts
|
|
5402
5485
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
5403
|
-
import { existsSync as
|
|
5404
|
-
import { basename as
|
|
5486
|
+
import { existsSync as existsSync13, realpathSync as realpathSync6, statSync as statSync6 } from "node:fs";
|
|
5487
|
+
import { basename as basename4, delimiter as delimiter4, dirname as dirname2, isAbsolute as isAbsolute6, join as join8, relative as relative5, resolve as resolve9 } from "node:path";
|
|
5405
5488
|
|
|
5406
5489
|
class LspRequestContextParseError2 extends Error {
|
|
5407
5490
|
code;
|
|
@@ -5444,25 +5527,25 @@ function parseLspRequestContext2(value) {
|
|
|
5444
5527
|
}
|
|
5445
5528
|
function canonicalCwd2(cwd) {
|
|
5446
5529
|
const resolved = resolve9(cwd);
|
|
5447
|
-
if (!
|
|
5530
|
+
if (!existsSync13(resolved) || !statSync6(resolved).isDirectory()) {
|
|
5448
5531
|
throw new LspRequestContextParseError2("invalid_cwd", `LSP request cwd must be an existing directory: ${cwd}`);
|
|
5449
5532
|
}
|
|
5450
|
-
return
|
|
5533
|
+
return realpathSync6(resolved);
|
|
5451
5534
|
}
|
|
5452
5535
|
function canonicalizeExistingOrNearestAncestor2(path2) {
|
|
5453
5536
|
let current = resolve9(path2);
|
|
5454
5537
|
const suffix = [];
|
|
5455
5538
|
while (true) {
|
|
5456
5539
|
try {
|
|
5457
|
-
const existing =
|
|
5458
|
-
return suffix.length === 0 ? existing :
|
|
5540
|
+
const existing = realpathSync6(current);
|
|
5541
|
+
return suffix.length === 0 ? existing : join8(existing, ...suffix);
|
|
5459
5542
|
} catch (error) {
|
|
5460
5543
|
if (!isMissingPathError2(error))
|
|
5461
5544
|
throw error;
|
|
5462
5545
|
const parent = dirname2(current);
|
|
5463
5546
|
if (parent === current)
|
|
5464
5547
|
throw error;
|
|
5465
|
-
suffix.unshift(
|
|
5548
|
+
suffix.unshift(basename4(current));
|
|
5466
5549
|
current = parent;
|
|
5467
5550
|
}
|
|
5468
5551
|
}
|
|
@@ -5523,9 +5606,9 @@ function errorCode2(error) {
|
|
|
5523
5606
|
}
|
|
5524
5607
|
|
|
5525
5608
|
// src/daemon-cli-path.ts
|
|
5526
|
-
import { existsSync as
|
|
5609
|
+
import { existsSync as existsSync15, readFileSync as readFileSync6 } from "node:fs";
|
|
5527
5610
|
import { createRequire as createRequire2 } from "node:module";
|
|
5528
|
-
import { dirname as
|
|
5611
|
+
import { dirname as dirname10, join as join10 } from "node:path";
|
|
5529
5612
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
5530
5613
|
var requireFromHere2 = createRequire2(import.meta.url);
|
|
5531
5614
|
var PACKAGE_LSP_DAEMON_CLI = "@code-yeongyu/lsp-daemon/cli";
|
|
@@ -5547,7 +5630,7 @@ function resolveLspDaemonCli() {
|
|
|
5547
5630
|
if (packageCli !== null)
|
|
5548
5631
|
return resolveConfiguredLspDaemonCli(packageCli);
|
|
5549
5632
|
const bundledCli = fileURLToPath4(new URL("../../lsp-daemon/dist/cli.js", import.meta.url));
|
|
5550
|
-
if (
|
|
5633
|
+
if (existsSync15(bundledCli))
|
|
5551
5634
|
return resolveConfiguredLspDaemonCli(bundledCli);
|
|
5552
5635
|
return resolveConfiguredLspDaemonCli(bundledCli);
|
|
5553
5636
|
}
|
|
@@ -5572,7 +5655,7 @@ function resolveConfiguredLspDaemonCli(cliPath) {
|
|
|
5572
5655
|
}
|
|
5573
5656
|
function readDaemonPackageVersion(cliPath) {
|
|
5574
5657
|
try {
|
|
5575
|
-
const parsed = JSON.parse(readFileSync6(
|
|
5658
|
+
const parsed = JSON.parse(readFileSync6(join10(dirname10(cliPath), "package.json"), "utf8"));
|
|
5576
5659
|
if (isRecord9(parsed) && typeof parsed["version"] === "string" && parsed["version"].length > 0) {
|
|
5577
5660
|
return parsed["version"];
|
|
5578
5661
|
}
|
|
@@ -5589,7 +5672,7 @@ function isRecord9(value) {
|
|
|
5589
5672
|
// src/lsp-session-state.ts
|
|
5590
5673
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5591
5674
|
import { homedir } from "node:os";
|
|
5592
|
-
import { dirname as
|
|
5675
|
+
import { dirname as dirname12, join as join11 } from "node:path";
|
|
5593
5676
|
function sessionIdFrom(input) {
|
|
5594
5677
|
return typeof input.session_id === "string" && input.session_id.length > 0 ? input.session_id : undefined;
|
|
5595
5678
|
}
|
|
@@ -5615,8 +5698,8 @@ function isLspDaemonUnreachableDiagnostics(diagnostics) {
|
|
|
5615
5698
|
return diagnostics.includes("LSP daemon unreachable");
|
|
5616
5699
|
}
|
|
5617
5700
|
function sessionStatePath(sessionId) {
|
|
5618
|
-
const root = process.env["PLUGIN_DATA"] ??
|
|
5619
|
-
return
|
|
5701
|
+
const root = process.env["PLUGIN_DATA"] ?? join11(homedir(), ".codex", "codex-lsp");
|
|
5702
|
+
return join11(root, "sessions", `${safePathSegment(sessionId)}.json`);
|
|
5620
5703
|
}
|
|
5621
5704
|
function readSessionState(path2) {
|
|
5622
5705
|
try {
|
|
@@ -5631,7 +5714,7 @@ function readSessionState(path2) {
|
|
|
5631
5714
|
}
|
|
5632
5715
|
}
|
|
5633
5716
|
function writeSessionState(path2, state) {
|
|
5634
|
-
mkdirSync4(
|
|
5717
|
+
mkdirSync4(dirname12(path2), { recursive: true });
|
|
5635
5718
|
writeFileSync3(path2, `${JSON.stringify(state)}
|
|
5636
5719
|
`);
|
|
5637
5720
|
}
|
|
@@ -5775,13 +5858,13 @@ function notConfiguredAvailability(details) {
|
|
|
5775
5858
|
return typeof extension === "string" && extension.length > 0 ? { extension } : undefined;
|
|
5776
5859
|
}
|
|
5777
5860
|
function codexLspRequestContext(env = process.env, cwd = process.cwd()) {
|
|
5778
|
-
const canonicalCwd3 =
|
|
5779
|
-
const codexHome = resolve11(env["CODEX_HOME"]?.trim() ||
|
|
5861
|
+
const canonicalCwd3 = realpathSync8(resolve11(cwd));
|
|
5862
|
+
const codexHome = resolve11(env["CODEX_HOME"]?.trim() || join12(homedir3(), ".codex"));
|
|
5780
5863
|
return parseLspRequestContext2({
|
|
5781
5864
|
cwd: canonicalCwd3,
|
|
5782
|
-
projectConfigPaths: [
|
|
5783
|
-
userConfigPath:
|
|
5784
|
-
installDecisionsPath:
|
|
5865
|
+
projectConfigPaths: [join12(canonicalCwd3, ".codex", "lsp-client.json")],
|
|
5866
|
+
userConfigPath: join12(codexHome, "lsp-client.json"),
|
|
5867
|
+
installDecisionsPath: join12(codexHome, "lsp-install-decisions.json"),
|
|
5785
5868
|
capabilities: { installDecisionTool: true }
|
|
5786
5869
|
});
|
|
5787
5870
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "command",
|
|
9
9
|
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
|
|
10
10
|
"timeout": 60,
|
|
11
|
-
"statusMessage": "(OmO 5.0.0-beta.
|
|
11
|
+
"statusMessage": "(OmO 5.0.0-beta.11) Checking LSP Diagnostics"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
14
14
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"type": "command",
|
|
22
22
|
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
|
|
23
23
|
"timeout": 5,
|
|
24
|
-
"statusMessage": "(OmO 5.0.0-beta.
|
|
24
|
+
"statusMessage": "(OmO 5.0.0-beta.11) Resetting LSP Diagnostics Cache"
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
27
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "command",
|
|
8
8
|
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
|
|
9
9
|
"timeout": 10,
|
|
10
|
-
"statusMessage": "(OmO 5.0.0-beta.
|
|
10
|
+
"statusMessage": "(OmO 5.0.0-beta.11) Loading Project Rules"
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"type": "command",
|
|
20
20
|
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
|
|
21
21
|
"timeout": 10,
|
|
22
|
-
"statusMessage": "(OmO 5.0.0-beta.
|
|
22
|
+
"statusMessage": "(OmO 5.0.0-beta.11) Loading Project Rules"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"type": "command",
|
|
33
33
|
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
|
|
34
34
|
"timeout": 10,
|
|
35
|
-
"statusMessage": "(OmO 5.0.0-beta.
|
|
35
|
+
"statusMessage": "(OmO 5.0.0-beta.11) Matching Project Rules"
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"type": "command",
|
|
46
46
|
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
|
|
47
47
|
"timeout": 10,
|
|
48
|
-
"statusMessage": "(OmO 5.0.0-beta.
|
|
48
|
+
"statusMessage": "(OmO 5.0.0-beta.11) Resetting Project Rule Cache"
|
|
49
49
|
}
|
|
50
50
|
]
|
|
51
51
|
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import type { RuleCandidate } from "@oh-my-opencode/rules-engine/engine";
|
|
5
|
+
import {
|
|
6
|
+
createEngine,
|
|
7
|
+
defaultConfig,
|
|
8
|
+
type EngineDeps,
|
|
9
|
+
resolvePluginRulesRoot,
|
|
10
|
+
SOURCE_PRIORITY,
|
|
11
|
+
} from "@oh-my-opencode/rules-engine/engine";
|
|
4
12
|
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
-
|
|
6
13
|
import { configFromEnvironment } from "../src/config.js";
|
|
7
|
-
import { SOURCE_PRIORITY } from "@oh-my-opencode/rules-engine/engine";
|
|
8
|
-
import { createEngine, defaultConfig, type EngineDeps } from "@oh-my-opencode/rules-engine/engine";
|
|
9
|
-
import { resolvePluginRulesRoot } from "@oh-my-opencode/rules-engine/engine";
|
|
10
|
-
import type { RuleCandidate } from "@oh-my-opencode/rules-engine/engine";
|
|
11
14
|
|
|
12
15
|
const projectRoot = "/tmp/codex-rules-bundled-priority";
|
|
13
16
|
const bundledPath = join(projectRoot, "bundled-rules", "hephaestus.md");
|
|
14
17
|
const homePath = join(projectRoot, "home", ".opencode", "rules", "hephaestus.md");
|
|
15
|
-
const bundledBody = "
|
|
16
|
-
const homeBody = "
|
|
18
|
+
const bundledBody = "BUNDLED_BASELINE_SENTINEL";
|
|
19
|
+
const homeBody = "HOME_OVERRIDE_SENTINEL";
|
|
17
20
|
const tempDirectories: string[] = [];
|
|
18
21
|
|
|
19
22
|
afterEach(() => {
|
|
@@ -35,14 +38,7 @@ function globalCandidate(source: "plugin-bundled" | "~/.opencode/rules", path: s
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
function ruleMarkdown(body: string): string {
|
|
38
|
-
return [
|
|
39
|
-
"---",
|
|
40
|
-
"description: OMO Hephaestus baseline discipline for Codex",
|
|
41
|
-
"alwaysApply: true",
|
|
42
|
-
"---",
|
|
43
|
-
"",
|
|
44
|
-
body,
|
|
45
|
-
].join("\n");
|
|
41
|
+
return ["---", "description: Fixture", "alwaysApply: true", "---", "", body].join("\n");
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
describe("plugin bundled rule priority", () => {
|
|
@@ -85,7 +81,6 @@ describe("plugin bundled rule priority", () => {
|
|
|
85
81
|
// then
|
|
86
82
|
expect(formatted).toContain(homePath);
|
|
87
83
|
expect(formatted).toContain(homeBody);
|
|
88
|
-
expect(formatted).not.toContain(`- [hephaestus.md]{${homePath}}`);
|
|
89
84
|
expect(formatted).not.toContain(bundledPath);
|
|
90
85
|
expect(formatted).not.toContain(bundledBody);
|
|
91
86
|
});
|