oh-my-opencode 4.8.1 → 4.9.1
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/dist/agents/prometheus/system-prompt.d.ts +1 -1
- package/dist/agents/sisyphus/claude-fable-5.d.ts +19 -0
- package/dist/agents/sisyphus/claude-opus-4-7.d.ts +3 -1
- package/dist/agents/sisyphus/claude-opus-4-8.d.ts +19 -0
- package/dist/agents/sisyphus/index.d.ts +4 -0
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/doctor/checks/codex.d.ts +1 -0
- package/dist/cli/doctor/checks/dependencies.d.ts +2 -2
- package/dist/cli/doctor/checks/tools-gh.d.ts +8 -1
- package/dist/cli/doctor/index.d.ts +1 -0
- package/dist/cli/doctor/types.d.ts +2 -0
- package/dist/cli/index.js +1908 -787
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-plugins.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-toml.d.ts +1 -0
- package/dist/cli/install-codex/codex-installer-bin-dir.d.ts +8 -0
- package/dist/cli/install-codex/install-codex.d.ts +1 -8
- package/dist/cli/install-codex/lsp-daemon-reaper.d.ts +5 -0
- package/dist/cli/sparkshell-condense.d.ts +10 -0
- package/dist/cli/sparkshell-parse.d.ts +3 -0
- package/dist/cli/sparkshell-session-context.d.ts +20 -0
- package/dist/cli/sparkshell-spark.d.ts +23 -0
- package/dist/cli/sparkshell.d.ts +8 -1
- package/dist/cli-node/index.js +92564 -0
- package/dist/config/schema/agent-names.d.ts +2 -0
- package/dist/config/schema/hooks.d.ts +0 -2
- package/dist/config/schema/keyword-detector.d.ts +0 -6
- package/dist/config/schema/oh-my-opencode-config.d.ts +2 -4
- package/dist/create-hooks.d.ts +0 -2
- package/dist/features/background-agent/parent-wake-dedupe.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-flush-runner.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-session-history.d.ts +4 -0
- package/dist/features/background-agent/parent-wake-session-inspector.d.ts +1 -0
- package/dist/features/builtin-commands/templates/handoff.d.ts +1 -1
- package/dist/features/builtin-skills/index.d.ts +1 -1
- package/dist/features/builtin-skills/skills.d.ts +4 -0
- package/dist/features/opencode-runtime-skills/source-server.d.ts +16 -1
- package/dist/features/opencode-skill-loader/skill-definition-record.d.ts +2 -0
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +2 -0
- package/dist/features/team-mode/types.d.ts +1 -0
- package/dist/features/tmux-subagent/failed-readiness-cache.d.ts +28 -0
- package/dist/features/tmux-subagent/manager.d.ts +1 -9
- package/dist/features/tmux-subagent/resolve-server-url.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/executor.d.ts +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/constants.d.ts +0 -4
- package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +1 -1
- package/dist/index.js +9001 -1795
- package/dist/oh-my-opencode.schema.json +2 -4
- package/dist/plugin/chat-params.d.ts +1 -8
- package/dist/plugin/hooks/create-core-hooks.d.ts +0 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts +0 -2
- package/dist/plugin/hooks/create-transform-hooks.d.ts +1 -2
- package/dist/plugin/messages-transform.d.ts +0 -1
- package/dist/shared/model-availability.d.ts +10 -2
- package/dist/shared/module-resolution-failure.d.ts +7 -0
- package/package.json +25 -18
- package/packages/ast-grep-mcp/dist/cli.js +2 -10
- package/packages/git-bash-mcp/dist/cli.js +11 -4
- package/packages/lsp-daemon/dist/cli.d.ts +2 -0
- package/packages/lsp-daemon/dist/cli.js +3711 -0
- package/packages/lsp-daemon/dist/daemon-client.d.ts +19 -0
- package/packages/lsp-daemon/dist/daemon-client.js +114 -0
- package/packages/lsp-daemon/dist/daemon-server.d.ts +12 -0
- package/packages/lsp-daemon/dist/daemon-server.js +106 -0
- package/packages/lsp-daemon/dist/ensure-daemon.d.ts +21 -0
- package/packages/lsp-daemon/dist/ensure-daemon.js +97 -0
- package/packages/lsp-daemon/dist/index.d.ts +5 -0
- package/packages/lsp-daemon/dist/index.js +3573 -0
- package/packages/lsp-daemon/dist/lock.d.ts +7 -0
- package/packages/lsp-daemon/dist/lock.js +61 -0
- package/packages/lsp-daemon/dist/package.json +6 -0
- package/packages/lsp-daemon/dist/paths.d.ts +11 -0
- package/packages/lsp-daemon/dist/paths.js +49 -0
- package/packages/lsp-daemon/dist/proxy.d.ts +10 -0
- package/packages/lsp-daemon/dist/proxy.js +61 -0
- package/packages/lsp-daemon/dist/request-routing.d.ts +9 -0
- package/packages/lsp-daemon/dist/request-routing.js +44 -0
- package/packages/lsp-daemon/dist/run-daemon.d.ts +1 -0
- package/packages/lsp-daemon/dist/run-daemon.js +11 -0
- package/packages/lsp-daemon/dist/socket-jsonrpc.d.ts +5 -0
- package/packages/lsp-daemon/dist/socket-jsonrpc.js +25 -0
- package/packages/lsp-daemon/package.json +38 -0
- package/packages/lsp-tools-mcp/dist/cli.js +0 -0
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +40 -17
- package/packages/lsp-tools-mcp/dist/lsp/client.js +11 -9
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +5 -5
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.js +5 -3
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.d.ts +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.js +8 -0
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.js +3 -2
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.js +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.js +12 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.d.ts +12 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.js +51 -0
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +2 -1
- package/packages/lsp-tools-mcp/dist/request-context.d.ts +7 -0
- package/packages/lsp-tools-mcp/dist/request-context.js +14 -0
- package/packages/lsp-tools-mcp/dist/tools.js +44 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +46 -33
- package/packages/omo-codex/plugin/.mcp.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.d.ts +7 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.js +173 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +10 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +22 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +165 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.d.ts +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.js +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +5 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +4 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.d.ts +6 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.js +10 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.d.ts +2 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.js +11 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.d.ts +3 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.js +104 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +26 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +144 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.d.ts +43 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.js +1 -0
- 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/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +29 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.d.ts +28 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.js +137 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/index.d.ts +1 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/index.js +1 -0
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +5 -2
- package/packages/omo-codex/plugin/components/lsp/.mcp.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +42 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.js +40 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.d.ts +16 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +180 -0
- package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.d.ts +12 -0
- package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.js +95 -0
- package/packages/omo-codex/plugin/components/lsp/dist/mutated-file-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/lsp/dist/mutated-file-paths.js +79 -0
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +7 -7
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-daemon.mjs +68 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.mjs +45 -22
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +6 -2
- package/packages/omo-codex/plugin/components/lsp/src/lsp-session-state.ts +4 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +68 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +8 -20
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +69 -96
- package/packages/omo-codex/plugin/components/rules/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +118 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +47 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +127 -0
- package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/config.js +100 -0
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +26 -0
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +8 -0
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +36 -0
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +65 -0
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.js +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +24 -0
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +24 -0
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +172 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +74 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.js +32 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +29 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +9 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +51 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +70 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +101 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.js +60 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.js +61 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.js +60 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.d.ts +11 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.js +75 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.js +29 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.d.ts +44 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.js +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +85 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +12 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +51 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +33 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +40 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +28 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +146 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +112 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +18 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +93 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +27 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.js +30 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.js +237 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +31 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +48 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +23 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +111 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.js +9 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +18 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +59 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +126 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +8 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +20 -0
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +41 -0
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.d.ts +10 -0
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.js +90 -0
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +128 -0
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +168 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +49 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +91 -0
- 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/src/codex-hook.ts +4 -2
- package/packages/omo-codex/plugin/components/rules/src/config.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/src/event-budget.ts +17 -0
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +4 -1
- package/packages/omo-codex/plugin/components/rules/src/post-compact-directive.ts +39 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +16 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +8 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +53 -4
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +127 -7
- package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +9 -1
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +4 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +7 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +9 -9
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +10 -4
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +241 -0
- package/packages/omo-codex/plugin/components/rules/test/event-budget.test.ts +168 -0
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +86 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +15 -15
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +16 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +146 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +49 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +80 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +3 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +20 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +1 -0
- 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/codex-hook.test.ts +24 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +1 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +18 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +62 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +15 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +42 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +10 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +35 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.d.ts +12 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.js +108 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +4 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +31 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +8 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +68 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +21 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +133 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +8 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +29 -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/agents/explorer.toml +5 -13
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +61 -185
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +122 -117
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +48 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +7 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +122 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +2 -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/ulw-plan/SKILL.md +20 -11
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +17 -11
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +2 -5
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +0 -71
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +200 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.d.ts +17 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.js +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.d.ts +4 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +183 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +55 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +39 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +100 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +26 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +28 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/command-types.d.ts +34 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/command-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.js +41 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +31 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +119 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +69 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +59 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +119 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +89 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +123 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +70 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/runtime.d.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/runtime.js +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.d.ts +63 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.js +292 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.js +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- 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 +14 -14
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +24 -25
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +17 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +2 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +0 -96
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +23 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +46 -0
- package/packages/omo-codex/plugin/hooks/hooks.json +16 -16
- package/packages/omo-codex/plugin/package-lock.json +10 -9
- package/packages/omo-codex/plugin/package.json +27 -26
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +64 -15
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +16 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +82 -18
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +2 -2
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +23 -11
- package/packages/omo-codex/plugin/scripts/sync-version.mjs +94 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +9 -9
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +16 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +93 -0
- package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +17 -13
- package/packages/omo-codex/plugin/skills/lsp-setup/SKILL.md +139 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/bash/README.md +60 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/csharp/README.md +71 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/dart/README.md +48 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/elixir/README.md +51 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/go/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/haskell/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/java/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/julia/README.md +60 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/lua/README.md +66 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/php/README.md +62 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/python/README.md +71 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/ruby/README.md +53 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/rust/README.md +59 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/swift/README.md +51 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/terraform/README.md +62 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/typescript/README.md +77 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/yaml/README.md +70 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/zig/README.md +49 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +9 -9
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +10 -10
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +20 -22
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +38 -61
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +135 -677
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +14 -14
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +24 -25
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +20 -11
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +17 -11
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +9 -9
- package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -1
- package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +5 -5
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +6 -6
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +194 -0
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +17 -0
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +15 -44
- package/packages/omo-codex/plugin/test/lsp-prebuild-layouts.test.mjs +140 -0
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +189 -7
- package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +9 -31
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +68 -4
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +119 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +11 -112
- package/packages/omo-codex/plugin/test/sync-version.test.mjs +68 -0
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +126 -0
- package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +2 -2
- package/packages/omo-codex/scripts/install/bin-dir.mjs +20 -0
- package/packages/omo-codex/scripts/install/bin-links.mjs +43 -6
- package/packages/omo-codex/scripts/install/cache.mjs +4 -0
- package/packages/omo-codex/scripts/install/config.mjs +4 -4
- package/packages/omo-codex/scripts/install/delegated-command.mjs +5 -1
- package/packages/omo-codex/scripts/install/git-bash-mcp-env.mjs +28 -0
- package/packages/omo-codex/scripts/install/git-bash.mjs +12 -4
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +39 -4
- package/packages/omo-codex/scripts/install/hook-targets.mjs +46 -0
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +12 -2
- package/packages/omo-codex/scripts/install/process.mjs +1 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +131 -3
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +91 -0
- package/packages/omo-codex/scripts/install-config.test.mjs +50 -44
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +78 -0
- package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-hook-targets.test.mjs +100 -0
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +3 -1
- package/packages/omo-codex/scripts/install-local.mjs +7 -18
- package/packages/omo-codex/scripts/install-local.test.mjs +34 -1
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +16 -1
- package/packages/shared-skills/skills/lcx-doctor/SKILL.md +93 -0
- package/packages/shared-skills/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +17 -13
- package/packages/shared-skills/skills/lsp-setup/SKILL.md +139 -0
- package/packages/shared-skills/skills/lsp-setup/references/bash/README.md +60 -0
- package/packages/shared-skills/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/packages/shared-skills/skills/lsp-setup/references/csharp/README.md +71 -0
- package/packages/shared-skills/skills/lsp-setup/references/dart/README.md +48 -0
- package/packages/shared-skills/skills/lsp-setup/references/elixir/README.md +51 -0
- package/packages/shared-skills/skills/lsp-setup/references/go/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/haskell/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/java/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/julia/README.md +60 -0
- package/packages/shared-skills/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/packages/shared-skills/skills/lsp-setup/references/lua/README.md +66 -0
- package/packages/shared-skills/skills/lsp-setup/references/php/README.md +62 -0
- package/packages/shared-skills/skills/lsp-setup/references/python/README.md +71 -0
- package/packages/shared-skills/skills/lsp-setup/references/ruby/README.md +53 -0
- package/packages/shared-skills/skills/lsp-setup/references/rust/README.md +59 -0
- package/packages/shared-skills/skills/lsp-setup/references/swift/README.md +51 -0
- package/packages/shared-skills/skills/lsp-setup/references/terraform/README.md +62 -0
- package/packages/shared-skills/skills/lsp-setup/references/typescript/README.md +77 -0
- package/packages/shared-skills/skills/lsp-setup/references/yaml/README.md +70 -0
- package/packages/shared-skills/skills/lsp-setup/references/zig/README.md +49 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +1 -1
- package/packages/shared-skills/skills/review-work/SKILL.md +10 -14
- package/packages/shared-skills/skills/start-work/SKILL.md +30 -59
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +126 -667
- package/dist/hooks/anthropic-effort/hook.d.ts +0 -26
- package/dist/hooks/anthropic-effort/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/analyze/default.d.ts +0 -12
- package/dist/hooks/keyword-detector/analyze/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/search/default.d.ts +0 -12
- package/dist/hooks/keyword-detector/search/index.d.ts +0 -1
- package/dist/hooks/thinking-block-validator/hook.d.ts +0 -12
- package/dist/hooks/thinking-block-validator/index.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/directive-contract.test.ts +0 -18
- package/packages/omo-codex/plugin/test/global-review-debug-gate.test.mjs +0 -29
- package/packages/omo-codex/plugin/test/subagent-guidance.test.mjs +0 -151
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface LockHandle {
|
|
2
|
+
release(): void;
|
|
3
|
+
}
|
|
4
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
5
|
+
export declare function readLockPid(lockPath: string): number | null;
|
|
6
|
+
export declare function tryAcquireLock(lockPath: string, ownerPid?: number): LockHandle | null;
|
|
7
|
+
export declare function unlinkQuietly(path: string): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { closeSync, mkdirSync, openSync, readFileSync, unlinkSync, writeSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
export function isProcessAlive(pid) {
|
|
4
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
5
|
+
return false;
|
|
6
|
+
try {
|
|
7
|
+
process.kill(pid, 0);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return error.code === "EPERM";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function readLockPid(lockPath) {
|
|
15
|
+
try {
|
|
16
|
+
const pid = Number.parseInt(readFileSync(lockPath, "utf8").trim(), 10);
|
|
17
|
+
return Number.isInteger(pid) ? pid : null;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function tryAcquireLock(lockPath, ownerPid = process.pid) {
|
|
24
|
+
mkdirSync(dirname(lockPath), { recursive: true });
|
|
25
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
26
|
+
const handle = writeLockFile(lockPath, ownerPid);
|
|
27
|
+
if (handle)
|
|
28
|
+
return handle;
|
|
29
|
+
if (!reapStaleLock(lockPath))
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function writeLockFile(lockPath, ownerPid) {
|
|
35
|
+
try {
|
|
36
|
+
const fd = openSync(lockPath, "wx");
|
|
37
|
+
writeSync(fd, `${ownerPid}\n`);
|
|
38
|
+
closeSync(fd);
|
|
39
|
+
return { release: () => unlinkQuietly(lockPath) };
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error.code === "EEXIST")
|
|
43
|
+
return null;
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function reapStaleLock(lockPath) {
|
|
48
|
+
const pid = readLockPid(lockPath);
|
|
49
|
+
if (pid !== null && isProcessAlive(pid))
|
|
50
|
+
return false;
|
|
51
|
+
unlinkQuietly(lockPath);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
export function unlinkQuietly(path) {
|
|
55
|
+
try {
|
|
56
|
+
unlinkSync(path);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
void error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DaemonPaths {
|
|
2
|
+
version: string;
|
|
3
|
+
dir: string;
|
|
4
|
+
socket: string;
|
|
5
|
+
lock: string;
|
|
6
|
+
pid: string;
|
|
7
|
+
log: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveDaemonVersion(requireFn?: (id: string) => unknown): string;
|
|
10
|
+
export declare function daemonBaseDir(env?: NodeJS.ProcessEnv): string;
|
|
11
|
+
export declare function daemonPaths(env?: NodeJS.ProcessEnv, version?: string): DaemonPaths;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { homedir, tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
6
|
+
const MAX_SOCKET_PATH_LENGTH = 100;
|
|
7
|
+
export function resolveDaemonVersion(requireFn = requireFromHere) {
|
|
8
|
+
for (const candidate of ["./package.json", "../package.json"]) {
|
|
9
|
+
try {
|
|
10
|
+
const pkg = requireFn(candidate);
|
|
11
|
+
if (typeof pkg.version === "string" && pkg.version.length > 0)
|
|
12
|
+
return pkg.version;
|
|
13
|
+
}
|
|
14
|
+
catch { }
|
|
15
|
+
}
|
|
16
|
+
return "0";
|
|
17
|
+
}
|
|
18
|
+
export function daemonBaseDir(env = process.env) {
|
|
19
|
+
const explicit = env["CODEX_LSP_DAEMON_DIR"]?.trim();
|
|
20
|
+
if (explicit)
|
|
21
|
+
return explicit;
|
|
22
|
+
const pluginData = env["PLUGIN_DATA"]?.trim();
|
|
23
|
+
if (pluginData)
|
|
24
|
+
return join(pluginData, "daemon");
|
|
25
|
+
const codexHome = env["CODEX_HOME"]?.trim();
|
|
26
|
+
const home = codexHome && codexHome.length > 0 ? codexHome : join(homedir(), ".codex");
|
|
27
|
+
return join(home, "codex-lsp", "daemon");
|
|
28
|
+
}
|
|
29
|
+
export function daemonPaths(env = process.env, version = resolveDaemonVersion()) {
|
|
30
|
+
const dir = join(daemonBaseDir(env), `v${version}`);
|
|
31
|
+
return {
|
|
32
|
+
version,
|
|
33
|
+
dir,
|
|
34
|
+
socket: resolveSocketPath(dir, version),
|
|
35
|
+
lock: join(dir, "daemon.lock"),
|
|
36
|
+
pid: join(dir, "daemon.pid"),
|
|
37
|
+
log: join(dir, "daemon.log"),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function resolveSocketPath(dir, version) {
|
|
41
|
+
const digest = createHash("sha256").update(dir).digest("hex").slice(0, 16);
|
|
42
|
+
if (process.platform === "win32") {
|
|
43
|
+
return `\\\\.\\pipe\\omo-lsp-${version}-${digest}`;
|
|
44
|
+
}
|
|
45
|
+
const natural = join(dir, "daemon.sock");
|
|
46
|
+
if (natural.length < MAX_SOCKET_PATH_LENGTH)
|
|
47
|
+
return natural;
|
|
48
|
+
return join(tmpdir(), `omo-lsp-${version}-${digest}.sock`);
|
|
49
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CallToolOptions, type DaemonToolContext } from "./daemon-client.js";
|
|
2
|
+
import { type DaemonPaths } from "./paths.js";
|
|
3
|
+
export interface ProxyOptions {
|
|
4
|
+
input?: NodeJS.ReadableStream;
|
|
5
|
+
output?: NodeJS.WritableStream;
|
|
6
|
+
paths?: DaemonPaths;
|
|
7
|
+
context?: DaemonToolContext;
|
|
8
|
+
ensure?: CallToolOptions["ensure"];
|
|
9
|
+
}
|
|
10
|
+
export declare function runMcpStdioProxy(options?: ProxyOptions): Promise<void>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createInterface } from "node:readline";
|
|
2
|
+
import { handleLspMcpRequest } from "@code-yeongyu/lsp-tools-mcp/dist/mcp.js";
|
|
3
|
+
import { callToolViaDaemon, currentRequestContext, } from "./daemon-client.js";
|
|
4
|
+
import { daemonPaths } from "./paths.js";
|
|
5
|
+
export async function runMcpStdioProxy(options = {}) {
|
|
6
|
+
const input = options.input ?? process.stdin;
|
|
7
|
+
const output = options.output ?? process.stdout;
|
|
8
|
+
const paths = options.paths ?? daemonPaths();
|
|
9
|
+
const context = options.context ?? currentRequestContext();
|
|
10
|
+
const callOptions = { paths, context, ...(options.ensure ? { ensure: options.ensure } : {}) };
|
|
11
|
+
const lines = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY });
|
|
12
|
+
for await (const line of lines) {
|
|
13
|
+
if (!line.trim())
|
|
14
|
+
continue;
|
|
15
|
+
try {
|
|
16
|
+
const response = await handleLine(line, callOptions);
|
|
17
|
+
if (response)
|
|
18
|
+
output.write(`${JSON.stringify(response)}\n`);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
process.stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function handleLine(line, callOptions) {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(line);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return parseErrorResponse(error);
|
|
32
|
+
}
|
|
33
|
+
const toolCall = asToolCall(parsed);
|
|
34
|
+
if (!toolCall)
|
|
35
|
+
return handleLspMcpRequest(parsed);
|
|
36
|
+
const result = await callToolViaDaemon(toolCall.name, toolCall.args, callOptions);
|
|
37
|
+
return {
|
|
38
|
+
jsonrpc: "2.0",
|
|
39
|
+
id: toolCall.id,
|
|
40
|
+
result: { content: result.content, isError: result.isError ?? false, details: result.details },
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function asToolCall(parsed) {
|
|
44
|
+
if (!isRecord(parsed) || parsed["method"] !== "tools/call")
|
|
45
|
+
return null;
|
|
46
|
+
const params = parsed["params"];
|
|
47
|
+
if (!isRecord(params) || typeof params["name"] !== "string")
|
|
48
|
+
return null;
|
|
49
|
+
const args = params["arguments"];
|
|
50
|
+
return { id: jsonRpcId(parsed["id"]), name: params["name"], args: isRecord(args) ? args : {} };
|
|
51
|
+
}
|
|
52
|
+
function jsonRpcId(value) {
|
|
53
|
+
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
|
|
54
|
+
}
|
|
55
|
+
function parseErrorResponse(error) {
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
return { jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error", data: message } };
|
|
58
|
+
}
|
|
59
|
+
function isRecord(value) {
|
|
60
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
61
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type JsonRpcResponse } from "@code-yeongyu/lsp-tools-mcp/dist/mcp.js";
|
|
2
|
+
import { type RequestContext } from "@code-yeongyu/lsp-tools-mcp/dist/request-context.js";
|
|
3
|
+
export declare const CONTEXT_KEY = "_context";
|
|
4
|
+
export interface RoutedRequest {
|
|
5
|
+
input: unknown;
|
|
6
|
+
context: RequestContext | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function extractRequestContext(raw: unknown): RoutedRequest;
|
|
9
|
+
export declare function handleDaemonMessage(raw: unknown): Promise<JsonRpcResponse | undefined>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { handleLspMcpRequest } from "@code-yeongyu/lsp-tools-mcp/dist/mcp.js";
|
|
2
|
+
import { runWithRequestContext } from "@code-yeongyu/lsp-tools-mcp/dist/request-context.js";
|
|
3
|
+
export const CONTEXT_KEY = "_context";
|
|
4
|
+
export function extractRequestContext(raw) {
|
|
5
|
+
if (!isRecord(raw) || raw["method"] !== "tools/call")
|
|
6
|
+
return { input: raw, context: undefined };
|
|
7
|
+
const params = raw["params"];
|
|
8
|
+
if (!isRecord(params))
|
|
9
|
+
return { input: raw, context: undefined };
|
|
10
|
+
const args = params["arguments"];
|
|
11
|
+
if (!isRecord(args))
|
|
12
|
+
return { input: raw, context: undefined };
|
|
13
|
+
const context = parseContext(args[CONTEXT_KEY]);
|
|
14
|
+
if (!context)
|
|
15
|
+
return { input: raw, context: undefined };
|
|
16
|
+
const cleanedArgs = { ...args };
|
|
17
|
+
delete cleanedArgs[CONTEXT_KEY];
|
|
18
|
+
const cleaned = { ...raw, params: { ...params, arguments: cleanedArgs } };
|
|
19
|
+
return { input: cleaned, context };
|
|
20
|
+
}
|
|
21
|
+
export function handleDaemonMessage(raw) {
|
|
22
|
+
const { input, context } = extractRequestContext(raw);
|
|
23
|
+
if (context)
|
|
24
|
+
return runWithRequestContext(context, () => handleLspMcpRequest(input));
|
|
25
|
+
return handleLspMcpRequest(input);
|
|
26
|
+
}
|
|
27
|
+
function parseContext(value) {
|
|
28
|
+
if (!isRecord(value))
|
|
29
|
+
return undefined;
|
|
30
|
+
const context = {};
|
|
31
|
+
const cwd = value["cwd"];
|
|
32
|
+
if (typeof cwd === "string")
|
|
33
|
+
context.cwd = cwd;
|
|
34
|
+
const env = value["env"];
|
|
35
|
+
if (isStringRecord(env))
|
|
36
|
+
context.env = env;
|
|
37
|
+
return context.cwd === undefined && context.env === undefined ? undefined : context;
|
|
38
|
+
}
|
|
39
|
+
function isRecord(value) {
|
|
40
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41
|
+
}
|
|
42
|
+
function isStringRecord(value) {
|
|
43
|
+
return isRecord(value) && Object.values(value).every((item) => typeof item === "string");
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runDaemon(): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { startDaemonServer } from "./daemon-server.js";
|
|
2
|
+
import { daemonPaths } from "./paths.js";
|
|
3
|
+
export async function runDaemon() {
|
|
4
|
+
process.on("uncaughtException", (error) => logNonFatal("uncaughtException", error));
|
|
5
|
+
process.on("unhandledRejection", (reason) => logNonFatal("unhandledRejection", reason));
|
|
6
|
+
await startDaemonServer(daemonPaths());
|
|
7
|
+
}
|
|
8
|
+
function logNonFatal(kind, error) {
|
|
9
|
+
const message = error instanceof Error ? (error.stack ?? error.message) : String(error);
|
|
10
|
+
process.stderr.write(`[lsp-daemon] ${kind}: ${message}\n`);
|
|
11
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function encodeJsonLine(message: unknown): string;
|
|
2
|
+
export interface LineDecoder {
|
|
3
|
+
push(chunk: Buffer | string): void;
|
|
4
|
+
}
|
|
5
|
+
export declare function createLineDecoder(onMessage: (value: unknown) => void, onParseError?: (raw: string, error: unknown) => void): LineDecoder;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function encodeJsonLine(message) {
|
|
2
|
+
return `${JSON.stringify(message)}\n`;
|
|
3
|
+
}
|
|
4
|
+
export function createLineDecoder(onMessage, onParseError) {
|
|
5
|
+
let buffer = "";
|
|
6
|
+
return {
|
|
7
|
+
push(chunk) {
|
|
8
|
+
buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
9
|
+
let index = buffer.indexOf("\n");
|
|
10
|
+
while (index !== -1) {
|
|
11
|
+
const raw = buffer.slice(0, index).trim();
|
|
12
|
+
buffer = buffer.slice(index + 1);
|
|
13
|
+
if (raw.length > 0) {
|
|
14
|
+
try {
|
|
15
|
+
onMessage(JSON.parse(raw));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
onParseError?.(raw, error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
index = buffer.indexOf("\n");
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@code-yeongyu/lsp-daemon",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared per-user Language Server Protocol daemon over a unix socket, with a stdio MCP proxy and a tool client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "npm@11.16.0",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"omo-lsp-daemon": "./dist/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"NOTICE",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.build.json && bun build src/cli.ts src/index.ts --outdir dist --target node --format esm && node scripts/stamp-dist-version.mjs",
|
|
21
|
+
"test": "vitest --run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"lint": "biome check .",
|
|
25
|
+
"lint:fix": "biome check --write .",
|
|
26
|
+
"check": "tsc --noEmit && biome check . && npm run build"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@biomejs/biome": "2.4.16",
|
|
30
|
+
"@code-yeongyu/lsp-tools-mcp": "file:../lsp-tools-mcp",
|
|
31
|
+
"@types/node": "^25.9.2",
|
|
32
|
+
"typescript": "^6.0.3",
|
|
33
|
+
"vitest": "^4.1.8"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
File without changes
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { existsSync, statSync } from "node:fs";
|
|
2
|
-
import { dirname,
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { contextCwd } from "../request-context.js";
|
|
4
|
+
import { effectiveExtension } from "./effective-extension.js";
|
|
3
5
|
import { isLspDeadConnectionError, LspInvalidPathError, LspRequestTimeoutError, LspServerInitializingError, LspServerLookupError, } from "./errors.js";
|
|
4
6
|
import { getLspManager } from "./manager.js";
|
|
7
|
+
import { loadInstallDecision } from "./server-install-state.js";
|
|
5
8
|
import { findServerForExtension } from "./server-resolution.js";
|
|
6
9
|
const WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
7
10
|
export function isDirectoryPath(filePath) {
|
|
@@ -13,7 +16,7 @@ export function isDirectoryPath(filePath) {
|
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
export function findWorkspaceRoot(filePath) {
|
|
16
|
-
const abs = resolve(filePath);
|
|
19
|
+
const abs = resolve(contextCwd(), filePath);
|
|
17
20
|
let dir = abs;
|
|
18
21
|
if (!isDirectoryPath(dir)) {
|
|
19
22
|
dir = dirname(dir);
|
|
@@ -32,19 +35,7 @@ export function findWorkspaceRoot(filePath) {
|
|
|
32
35
|
}
|
|
33
36
|
export function formatServerLookupError(result) {
|
|
34
37
|
if (result.status === "not_installed") {
|
|
35
|
-
|
|
36
|
-
return [
|
|
37
|
-
`LSP server '${server.id}' is configured but NOT INSTALLED.`,
|
|
38
|
-
"",
|
|
39
|
-
`Command not found: ${server.command[0]}`,
|
|
40
|
-
"",
|
|
41
|
-
"To install:",
|
|
42
|
-
` ${installHint}`,
|
|
43
|
-
"",
|
|
44
|
-
`Supported extensions: ${server.extensions.join(", ")}`,
|
|
45
|
-
"",
|
|
46
|
-
"After installation, the server will be available automatically.",
|
|
47
|
-
].join("\n");
|
|
38
|
+
return formatNotInstalled(result);
|
|
48
39
|
}
|
|
49
40
|
return [
|
|
50
41
|
`No LSP server configured for extension: ${result.extension}`,
|
|
@@ -62,6 +53,38 @@ export function formatServerLookupError(result) {
|
|
|
62
53
|
" }",
|
|
63
54
|
].join("\n");
|
|
64
55
|
}
|
|
56
|
+
function formatNotInstalled(result) {
|
|
57
|
+
const { server, installHint } = result;
|
|
58
|
+
const extensions = server.extensions.join(", ");
|
|
59
|
+
const decision = loadInstallDecision(server.id)?.decision;
|
|
60
|
+
if (decision === "declined") {
|
|
61
|
+
return `LSP server '${server.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
|
|
62
|
+
}
|
|
63
|
+
const header = [
|
|
64
|
+
`LSP server '${server.id}' for ${extensions} is NOT INSTALLED.`,
|
|
65
|
+
"",
|
|
66
|
+
`Command not found: ${server.command[0]}`,
|
|
67
|
+
"",
|
|
68
|
+
];
|
|
69
|
+
if (decision === "allowed") {
|
|
70
|
+
return [
|
|
71
|
+
...header,
|
|
72
|
+
"The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
|
|
73
|
+
` ${installHint}`,
|
|
74
|
+
].join("\n");
|
|
75
|
+
}
|
|
76
|
+
return [
|
|
77
|
+
...header,
|
|
78
|
+
"To install, run:",
|
|
79
|
+
` ${installHint}`,
|
|
80
|
+
"",
|
|
81
|
+
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
82
|
+
"- If the user agrees: run the install command above, then retry this tool.",
|
|
83
|
+
"- If the user declines, OR has NOT explicitly asked for LSP installation:",
|
|
84
|
+
` call lsp_install_decision { server_id: "${server.id}", decision: "declined" },`,
|
|
85
|
+
" then ignore this message and proceed WITHOUT LSP.",
|
|
86
|
+
].join("\n");
|
|
87
|
+
}
|
|
65
88
|
const READ_ONLY_RETRY_TOOLS = new Set([
|
|
66
89
|
"diagnostics",
|
|
67
90
|
"definition",
|
|
@@ -71,12 +94,12 @@ const READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
71
94
|
"prepareRename",
|
|
72
95
|
]);
|
|
73
96
|
export async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
74
|
-
const absPath = resolve(filePath);
|
|
97
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
75
98
|
if (isDirectoryPath(absPath)) {
|
|
76
99
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " +
|
|
77
100
|
"Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
78
101
|
}
|
|
79
|
-
const ext =
|
|
102
|
+
const ext = effectiveExtension(absPath);
|
|
80
103
|
const result = findServerForExtension(ext);
|
|
81
104
|
if (result.status !== "found") {
|
|
82
105
|
throw new LspServerLookupError(formatServerLookupError(result));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { contextCwd } from "../request-context.js";
|
|
4
5
|
import { LspClientConnection } from "./connection.js";
|
|
6
|
+
import { effectiveExtension } from "./effective-extension.js";
|
|
5
7
|
import { getLanguageId } from "./language-mappings.js";
|
|
6
8
|
const POST_OPEN_DELAY_MS = 1000;
|
|
7
9
|
const POST_DIAGNOSTICS_WAIT_MS = 500;
|
|
@@ -17,11 +19,11 @@ export class LspClient extends LspClientConnection {
|
|
|
17
19
|
return this.diagnosticPullErrors;
|
|
18
20
|
}
|
|
19
21
|
async openFile(filePath) {
|
|
20
|
-
const absPath = resolve(filePath);
|
|
22
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
21
23
|
const uri = pathToFileURL(absPath).href;
|
|
22
24
|
const text = readFileSync(absPath, "utf-8");
|
|
23
25
|
if (!this.openedFiles.has(absPath)) {
|
|
24
|
-
const ext =
|
|
26
|
+
const ext = effectiveExtension(absPath);
|
|
25
27
|
const languageId = getLanguageId(ext);
|
|
26
28
|
const version = 1;
|
|
27
29
|
await this.sendNotification("textDocument/didOpen", {
|
|
@@ -55,7 +57,7 @@ export class LspClient extends LspClientConnection {
|
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
59
|
async definition(filePath, line, character) {
|
|
58
|
-
const absPath = resolve(filePath);
|
|
60
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
59
61
|
await this.openFile(absPath);
|
|
60
62
|
return this.sendRequest("textDocument/definition", {
|
|
61
63
|
textDocument: { uri: pathToFileURL(absPath).href },
|
|
@@ -63,7 +65,7 @@ export class LspClient extends LspClientConnection {
|
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
async references(filePath, line, character, includeDeclaration = true) {
|
|
66
|
-
const absPath = resolve(filePath);
|
|
68
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
67
69
|
await this.openFile(absPath);
|
|
68
70
|
return this.sendRequest("textDocument/references", {
|
|
69
71
|
textDocument: { uri: pathToFileURL(absPath).href },
|
|
@@ -72,7 +74,7 @@ export class LspClient extends LspClientConnection {
|
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
async documentSymbols(filePath) {
|
|
75
|
-
const absPath = resolve(filePath);
|
|
77
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
76
78
|
await this.openFile(absPath);
|
|
77
79
|
return this.sendRequest("textDocument/documentSymbol", {
|
|
78
80
|
textDocument: { uri: pathToFileURL(absPath).href },
|
|
@@ -90,7 +92,7 @@ export class LspClient extends LspClientConnection {
|
|
|
90
92
|
return /unsupported|not supported|method not found|unknown request/i.test(error.message);
|
|
91
93
|
}
|
|
92
94
|
async diagnostics(filePath) {
|
|
93
|
-
const absPath = resolve(filePath);
|
|
95
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
94
96
|
const uri = pathToFileURL(absPath).href;
|
|
95
97
|
await this.openFile(absPath);
|
|
96
98
|
await new Promise((r) => setTimeout(r, POST_DIAGNOSTICS_WAIT_MS));
|
|
@@ -110,7 +112,7 @@ export class LspClient extends LspClientConnection {
|
|
|
110
112
|
return { items: this.getStoredDiagnostics(uri) };
|
|
111
113
|
}
|
|
112
114
|
async prepareRename(filePath, line, character) {
|
|
113
|
-
const absPath = resolve(filePath);
|
|
115
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
114
116
|
await this.openFile(absPath);
|
|
115
117
|
return this.sendRequest("textDocument/prepareRename", {
|
|
116
118
|
textDocument: { uri: pathToFileURL(absPath).href },
|
|
@@ -118,7 +120,7 @@ export class LspClient extends LspClientConnection {
|
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
122
|
async rename(filePath, line, character, newName) {
|
|
121
|
-
const absPath = resolve(filePath);
|
|
123
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
122
124
|
await this.openFile(absPath);
|
|
123
125
|
return this.sendRequest("textDocument/rename", {
|
|
124
126
|
textDocument: { uri: pathToFileURL(absPath).href },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { delimiter, isAbsolute, join } from "node:path";
|
|
4
|
+
import { contextCwd, contextEnv } from "../request-context.js";
|
|
4
5
|
import { BUILTIN_SERVERS } from "./server-definitions.js";
|
|
5
6
|
export function getConfigPaths() {
|
|
6
7
|
return {
|
|
@@ -9,18 +10,17 @@ export function getConfigPaths() {
|
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
function resolveProjectConfigPath(path) {
|
|
12
|
-
|
|
13
|
-
return isAbsolute(path) ? path : join(cwd, path);
|
|
13
|
+
return isAbsolute(path) ? path : join(contextCwd(), path);
|
|
14
14
|
}
|
|
15
15
|
function getProjectConfigPaths() {
|
|
16
|
-
const projectOverride =
|
|
16
|
+
const projectOverride = contextEnv("LSP_TOOLS_MCP_PROJECT_CONFIG");
|
|
17
17
|
if (projectOverride) {
|
|
18
18
|
return projectOverride.split(delimiter).filter(Boolean).map(resolveProjectConfigPath);
|
|
19
19
|
}
|
|
20
|
-
return [join(
|
|
20
|
+
return [join(contextCwd(), ".codex", "lsp-client.json")];
|
|
21
21
|
}
|
|
22
22
|
function getUserConfigPath() {
|
|
23
|
-
const userOverride =
|
|
23
|
+
const userOverride = contextEnv("LSP_TOOLS_MCP_USER_CONFIG");
|
|
24
24
|
if (!userOverride)
|
|
25
25
|
return join(homedir(), ".codex", "lsp-client.json");
|
|
26
26
|
return isAbsolute(userOverride) ? userOverride : join(homedir(), userOverride);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { contextCwd } from "../request-context.js";
|
|
3
4
|
import { findWorkspaceRoot, formatServerLookupError } from "./client-wrapper.js";
|
|
4
5
|
import { DEFAULT_MAX_DIAGNOSTICS, DEFAULT_MAX_DIRECTORY_FILES } from "./constants.js";
|
|
6
|
+
import { effectiveExtension } from "./effective-extension.js";
|
|
5
7
|
import { LspInvalidPathError, LspServerLookupError } from "./errors.js";
|
|
6
8
|
import { filterDiagnosticsBySeverity, formatDiagnostic } from "./formatters.js";
|
|
7
9
|
import { getLspManager } from "./manager.js";
|
|
@@ -37,7 +39,7 @@ export function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
37
39
|
walk(fullPath);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
else if (stat.isFile() &&
|
|
42
|
+
else if (stat.isFile() && effectiveExtension(fullPath) === extension) {
|
|
41
43
|
files.push(fullPath);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -49,7 +51,7 @@ export async function aggregateDiagnosticsForDirectory(directory, extension, sev
|
|
|
49
51
|
if (!extension.startsWith(".")) {
|
|
50
52
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
51
53
|
}
|
|
52
|
-
const absDir = resolve(directory);
|
|
54
|
+
const absDir = resolve(contextCwd(), directory);
|
|
53
55
|
if (!existsSync(absDir)) {
|
|
54
56
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
55
57
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function effectiveExtension(filePath: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { basename, extname } from "node:path";
|
|
2
|
+
const BASENAME_EXTENSIONS = {
|
|
3
|
+
Dockerfile: ".dockerfile",
|
|
4
|
+
Containerfile: ".dockerfile",
|
|
5
|
+
};
|
|
6
|
+
export function effectiveExtension(filePath) {
|
|
7
|
+
return BASENAME_EXTENSIONS[basename(filePath)] ?? extname(filePath);
|
|
8
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lstatSync, readdirSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { effectiveExtension } from "./effective-extension.js";
|
|
3
4
|
import { EXT_TO_LANG } from "./language-mappings.js";
|
|
4
5
|
const SKIP_DIRECTORIES = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
5
6
|
const MAX_SCAN_ENTRIES = 500;
|
|
@@ -36,7 +37,7 @@ export function inferExtensionFromDirectory(directory) {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
else if (stat.isFile()) {
|
|
39
|
-
const ext =
|
|
40
|
+
const ext = effectiveExtension(fullPath);
|
|
40
41
|
if (ext && ext in EXT_TO_LANG) {
|
|
41
42
|
extensionCounts.set(ext, (extensionCounts.get(ext) ?? 0) + 1);
|
|
42
43
|
}
|