oh-my-opencode 4.13.0 → 4.14.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/.agents/skills/codex-qa/SKILL.md +15 -0
- package/.agents/skills/codex-qa/references/isolation.md +1 -1
- package/.agents/skills/codex-qa/references/logging-debug.md +12 -0
- package/.agents/skills/opencode-qa/SKILL.md +17 -0
- package/.agents/skills/opencode-qa/references/tui-tmux.md +17 -0
- package/.agents/skills/work-with-pr/SKILL.md +18 -10
- package/.opencode/skills/work-with-pr/SKILL.md +18 -10
- package/README.md +3 -3
- package/dist/cli/doctor/checks/telemetry.d.ts +2 -0
- package/dist/cli/doctor/framework/constants.d.ts +1 -0
- package/dist/cli/doctor/framework/doctor-target.d.ts +1 -1
- package/dist/cli/doctor/framework/types.d.ts +2 -0
- package/dist/cli/index.js +24779 -17857
- package/dist/cli-node/index.js +24779 -17857
- package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
- package/dist/features/team-mode/test-support/async-test-helpers.d.ts +19 -0
- package/dist/hooks/atlas/final-wave-approval-gate.d.ts +1 -0
- package/dist/hooks/atlas/subagent-completion-reminder.d.ts +30 -0
- package/dist/hooks/atlas/types.d.ts +2 -0
- package/dist/hooks/atlas/verification-reminders.d.ts +3 -0
- package/dist/hooks/team-session-events/team-idle-wake-hint.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43845 -26631
- package/dist/mcp/context7.d.ts +9 -8
- package/dist/oh-my-opencode.schema.json +4 -0
- package/dist/plugin/native-skills.d.ts +9 -0
- package/dist/plugin/system-transform.d.ts +1 -1
- package/dist/shared/posthog.d.ts +17 -10
- package/dist/shared/telemetry-product-identity.d.ts +2 -0
- package/dist/skills/coding-agent-sessions/SKILL.md +128 -0
- package/dist/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +71 -0
- package/dist/skills/coding-agent-sessions/references/claude.md +32 -0
- package/dist/skills/coding-agent-sessions/references/codex.md +30 -0
- package/dist/skills/coding-agent-sessions/references/opencode.md +43 -0
- package/dist/skills/coding-agent-sessions/references/senpi.md +17 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/dist/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/dist/skills/frontend/ATTRIBUTION.md +52 -8
- package/dist/skills/frontend/SKILL.md +29 -8
- package/dist/skills/frontend/references/design/README.md +29 -12
- package/dist/skills/frontend/references/design/_INDEX.md +3 -3
- package/dist/skills/frontend/references/design/design-system-architecture.md +22 -19
- package/dist/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
- package/dist/skills/frontend/references/designpowers/README.md +48 -0
- package/dist/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
- package/dist/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
- package/dist/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
- package/dist/skills/frontend/references/designpowers/lane-c-review.md +65 -0
- package/dist/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
- package/dist/skills/frontend/references/designpowers/orchestration.md +80 -0
- package/dist/skills/frontend/references/designpowers/routing.md +79 -0
- package/dist/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
- package/dist/skills/git-master/SKILL.md +4 -0
- package/dist/skills/lcx-contribute-bug-fix/SKILL.md +44 -13
- package/dist/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/dist/skills/lcx-doctor/SKILL.md +48 -13
- package/dist/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/dist/skills/lcx-report-bug/SKILL.md +44 -13
- package/dist/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/dist/skills/review-work/SKILL.md +3 -3
- package/dist/skills/start-work/SKILL.md +7 -5
- package/dist/skills/ultraresearch/SKILL.md +4 -252
- package/dist/skills/ulw-plan/SKILL.md +8 -6
- package/dist/skills/ulw-plan/references/full-workflow.md +11 -6
- package/dist/skills/ulw-plan/references/intent-clear.md +3 -3
- package/dist/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/{packages/shared-skills/skills/ultraresearch → dist/skills/ulw-research}/ATTRIBUTION.md +1 -1
- package/dist/skills/ulw-research/SKILL.md +260 -0
- package/dist/skills/visual-qa/SKILL.md +109 -18
- package/dist/skills/visual-qa/references/agent-browser-setup.md +5 -4
- package/dist/skills/visual-qa/scripts/cli.test.ts +7 -2
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +130 -3
- package/dist/skills/visual-qa/scripts/visual-qa.mjs +530 -0
- package/dist/testing/create-plugin-module.d.ts +2 -0
- package/dist/tools/delegate-task/skill-resolver.d.ts +1 -0
- package/dist/tools/delegate-task/types.d.ts +2 -0
- package/dist/tools/skill/types.d.ts +1 -0
- package/dist/tui.js +23917 -16117
- package/docs/reference/github-attachment-upload.md +51 -0
- package/docs/reference/web-terminal-visual-qa.md +81 -0
- package/package.json +33 -14
- package/packages/git-bash-mcp/dist/cli.js +2 -0
- package/packages/lsp-core/src/lsp/process.ts +4 -1
- package/packages/lsp-core/src/mcp.ts +1 -0
- package/packages/lsp-daemon/dist/cli.js +20 -5
- package/packages/lsp-daemon/dist/ensure-daemon.d.ts +1 -0
- package/packages/lsp-daemon/dist/ensure-daemon.js +9 -3
- package/packages/lsp-daemon/dist/index.js +20 -5
- package/packages/lsp-daemon/dist/paths.d.ts +1 -0
- package/packages/lsp-daemon/dist/paths.js +6 -1
- package/packages/lsp-daemon/dist/proxy.js +1 -0
- package/packages/lsp-tools-mcp/dist/cli.js +5 -1
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +4 -1
- package/packages/lsp-tools-mcp/dist/mcp.js +5 -1
- package/packages/lsp-tools-mcp/dist/tools.js +4 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +327 -69
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/scripts/bootstrap.ps1 +37 -68
- package/packages/omo-codex/plugin/components/bootstrap/scripts/node-dispatch.ps1 +75 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +3 -19
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +688 -334
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +317 -39
- package/packages/omo-codex/plugin/components/codegraph/package.json +2 -2
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +7 -1
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +103 -3
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +231 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +29 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +31 -57
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +7 -4
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +43 -9
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +287 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +12 -7
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +71 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +94 -26
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.js +56 -0
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +2 -5
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/src/daemon-cli-path.ts +65 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +6 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +8 -106
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +4 -17
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +6 -6
- 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 +23 -0
- package/packages/omo-codex/plugin/components/teammode/dist/cli.js +22 -4
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +57 -7
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +32 -5
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +63 -1
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +87 -53
- package/packages/omo-codex/plugin/components/teammode/src/codex-hook.ts +19 -4
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +32 -2
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/README.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +18 -10
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +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 +6 -4
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +11 -6
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +24 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +7 -28
- package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +25 -21
- package/packages/omo-codex/plugin/components/ulw-loop/biome.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +373 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +14 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +145 -14
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +6 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +16 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/ultrawork-directive.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/ultrawork-directive.js +104 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +5 -2
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +22 -14
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-steering.ts +14 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +28 -6
- package/packages/omo-codex/plugin/components/ulw-loop/src/ultrawork-directive.ts +113 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +33 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-steering-kind-guidance.test.ts +31 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-quality-gate.json +7 -7
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +39 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-doc.test.ts +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +7 -6
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +64 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +2 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +2 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +2 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +2 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +2 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +2 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +2 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +2 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +2 -1
- package/packages/omo-codex/plugin/package-lock.json +16 -56
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +9 -5
- package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +1 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/context7-placeholder-guard.mjs +131 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-mode-guard.mjs +60 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +3 -10
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/root-settings.mjs +31 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +73 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +20 -3
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +30 -8
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +128 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +71 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/claude.md +32 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/codex.md +30 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/opencode.md +43 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +17 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +52 -8
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +29 -8
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +29 -12
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +3 -3
- package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +22 -19
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/README.md +48 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-c-review.md +65 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/orchestration.md +80 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/routing.md +79 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
- package/packages/omo-codex/plugin/skills/git-master/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +44 -13
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +48 -13
- package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +44 -13
- package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +12 -4
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +14 -8
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +57 -7
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +32 -5
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +63 -1
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +87 -53
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +4 -250
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +22 -14
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +6 -4
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +11 -6
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +3 -3
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/{dist/skills/ultraresearch → packages/omo-codex/plugin/skills/ulw-research}/ATTRIBUTION.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +262 -0
- package/packages/omo-codex/plugin/skills/ulw-research/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +113 -18
- package/packages/omo-codex/plugin/skills/visual-qa/references/agent-browser-setup.md +5 -4
- package/packages/omo-codex/plugin/skills/visual-qa/scripts/visual-qa.mjs +530 -0
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +23 -0
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +24 -1
- package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +61 -7
- package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +38 -0
- package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +25 -0
- package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +1 -7
- package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +12 -11
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +99 -1
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +62 -8
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +206 -6
- package/packages/omo-codex/plugin/test/node-install-surface.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +44 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +50 -1
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +10 -7
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +28 -2
- package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +102 -0
- package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +20 -0
- package/packages/omo-codex/plugin/test/teammode-safety-fixture.mjs +41 -1
- package/packages/omo-codex/plugin/test/teammode-safety.test.mjs +93 -0
- package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +117 -0
- package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +5 -2
- package/packages/omo-codex/plugin/test/ulw-research-skill-contract.test.mjs +285 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +12 -1
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +79 -0
- package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +43 -3
- package/packages/omo-codex/scripts/install-config.test.mjs +198 -17
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +803 -309
- package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +21 -2
- package/packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs +24 -15
- package/packages/omo-codex/scripts/install-local.test.mjs +5 -2
- package/packages/omo-codex/scripts/install-mcp-context7-runtime.test.mjs +84 -0
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +128 -0
- package/packages/shared-skills/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +71 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/claude.md +32 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/codex.md +30 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/opencode.md +43 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +17 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +52 -8
- package/packages/shared-skills/skills/frontend/SKILL.md +29 -8
- package/packages/shared-skills/skills/frontend/references/design/README.md +29 -12
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +3 -3
- package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +22 -19
- package/packages/shared-skills/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/README.md +48 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-c-review.md +65 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/orchestration.md +80 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/routing.md +79 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
- package/packages/shared-skills/skills/git-master/SKILL.md +4 -0
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +44 -13
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/lcx-doctor/SKILL.md +48 -13
- package/packages/shared-skills/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +44 -13
- package/packages/shared-skills/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/review-work/SKILL.md +3 -3
- package/packages/shared-skills/skills/start-work/SKILL.md +7 -5
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +4 -252
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +8 -6
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +11 -6
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +3 -3
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/packages/{omo-codex/plugin/skills/ultraresearch → shared-skills/skills/ulw-research}/ATTRIBUTION.md +1 -1
- package/packages/shared-skills/skills/ulw-research/SKILL.md +260 -0
- package/packages/shared-skills/skills/visual-qa/SKILL.md +109 -18
- package/packages/shared-skills/skills/visual-qa/references/agent-browser-setup.md +5 -4
- package/packages/shared-skills/skills/visual-qa/scripts/cli.test.ts +7 -2
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +130 -3
- package/packages/shared-skills/skills/visual-qa/scripts/visual-qa.mjs +530 -0
- package/script/qa/web-terminal-redaction.d.mts +13 -0
- package/script/qa/web-terminal-redaction.mjs +43 -0
- package/script/qa/web-terminal-renderer.mjs +218 -0
- package/script/qa/web-terminal-visual-qa.mjs +264 -0
- package/dist/cli/sparkshell-appserver-websocket.d.ts +0 -4
- package/dist/cli/sparkshell-appserver.d.ts +0 -16
- package/dist/cli/sparkshell-condense.d.ts +0 -10
- package/dist/cli/sparkshell-parse.d.ts +0 -24
- package/dist/cli/sparkshell-session-context.d.ts +0 -20
- package/dist/cli/sparkshell-spark.d.ts +0 -23
- package/dist/cli/sparkshell.d.ts +0 -33
- package/dist/shared/sparkshell-awareness.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +0 -106
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +0 -346
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_cookie_domain_filter.py +0 -110
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_extract_cookies.py +0 -245
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +0 -204
|
@@ -7,13 +7,86 @@ import { stderr as processStderr3 } from "node:process";
|
|
|
7
7
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8
8
|
|
|
9
9
|
// components/codegraph/src/hook.ts
|
|
10
|
-
import { spawn } from "node:child_process";
|
|
10
|
+
import { execFile as execFile3, spawn } from "node:child_process";
|
|
11
11
|
import { homedir as homedir9 } from "node:os";
|
|
12
|
+
import { join as join8 } from "node:path";
|
|
12
13
|
import { cwd as processCwd2, env as processEnv2, stdin as processStdin, stdout as processStdout } from "node:process";
|
|
13
14
|
import { fileURLToPath } from "node:url";
|
|
14
15
|
|
|
16
|
+
// ../../utils/src/codegraph/env.ts
|
|
17
|
+
import { homedir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
var CODEGRAPH_INSTALL_DIR_ENV = "CODEGRAPH_INSTALL_DIR";
|
|
20
|
+
var CODEGRAPH_NO_DOWNLOAD_ENV = "CODEGRAPH_NO_DOWNLOAD";
|
|
21
|
+
var CODEGRAPH_TELEMETRY_ENV = "CODEGRAPH_TELEMETRY";
|
|
22
|
+
var DO_NOT_TRACK_ENV = "DO_NOT_TRACK";
|
|
23
|
+
var SAFE_AMBIENT_ENV_KEYS = new Set([
|
|
24
|
+
"APPDATA",
|
|
25
|
+
"CI",
|
|
26
|
+
"CODEX_HOME",
|
|
27
|
+
"ComSpec",
|
|
28
|
+
"HOME",
|
|
29
|
+
"HOMEDRIVE",
|
|
30
|
+
"HOMEPATH",
|
|
31
|
+
"LANG",
|
|
32
|
+
"LC_ALL",
|
|
33
|
+
"LC_CTYPE",
|
|
34
|
+
"LOCALAPPDATA",
|
|
35
|
+
"PATH",
|
|
36
|
+
"PATHEXT",
|
|
37
|
+
"Path",
|
|
38
|
+
"SystemRoot",
|
|
39
|
+
"TEMP",
|
|
40
|
+
"TMP",
|
|
41
|
+
"TMPDIR",
|
|
42
|
+
"USERPROFILE",
|
|
43
|
+
"WINDIR",
|
|
44
|
+
"XDG_CACHE_HOME",
|
|
45
|
+
"XDG_CONFIG_HOME",
|
|
46
|
+
"XDG_DATA_HOME",
|
|
47
|
+
"XDG_STATE_HOME"
|
|
48
|
+
]);
|
|
49
|
+
var SAFE_CODEGRAPH_RUNTIME_ENV_KEYS = new Set([
|
|
50
|
+
"CODEGRAPH_ALLOW_UNSAFE_NODE",
|
|
51
|
+
"CODEGRAPH_BIN",
|
|
52
|
+
"CODEGRAPH_FAKE_LOG",
|
|
53
|
+
"CODEGRAPH_NODE_BIN",
|
|
54
|
+
"OMO_CODEGRAPH_BIN",
|
|
55
|
+
"OMO_CODEGRAPH_PROJECT_CWD",
|
|
56
|
+
"OMO_CODEGRAPH_SESSION_START_CWD"
|
|
57
|
+
]);
|
|
58
|
+
function buildCodegraphEnv(options = {}) {
|
|
59
|
+
const homeDir = options.homeDir ?? homedir();
|
|
60
|
+
return {
|
|
61
|
+
[CODEGRAPH_INSTALL_DIR_ENV]: join(homeDir, ".omo", "codegraph"),
|
|
62
|
+
[CODEGRAPH_NO_DOWNLOAD_ENV]: "1",
|
|
63
|
+
[CODEGRAPH_TELEMETRY_ENV]: "0",
|
|
64
|
+
[DO_NOT_TRACK_ENV]: "1"
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function copyDefinedEnvKeys(output, input, allowedKeys) {
|
|
68
|
+
for (const key of allowedKeys) {
|
|
69
|
+
const value = input[key];
|
|
70
|
+
if (value !== undefined)
|
|
71
|
+
output[key] = value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function copyDefinedEnv(output, input) {
|
|
75
|
+
for (const [key, value] of Object.entries(input)) {
|
|
76
|
+
if (value !== undefined)
|
|
77
|
+
output[key] = value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function buildCodegraphChildEnv(options = {}) {
|
|
81
|
+
const env = {};
|
|
82
|
+
copyDefinedEnvKeys(env, options.ambientEnv ?? {}, SAFE_AMBIENT_ENV_KEYS);
|
|
83
|
+
copyDefinedEnvKeys(env, options.runtimeEnv ?? {}, SAFE_CODEGRAPH_RUNTIME_ENV_KEYS);
|
|
84
|
+
copyDefinedEnv(env, options.codegraphEnv ?? {});
|
|
85
|
+
return env;
|
|
86
|
+
}
|
|
87
|
+
|
|
15
88
|
// ../../utils/src/codegraph/guidance.ts
|
|
16
|
-
import { homedir as
|
|
89
|
+
import { homedir as homedir3 } from "node:os";
|
|
17
90
|
|
|
18
91
|
// ../../utils/src/codegraph/workspace.ts
|
|
19
92
|
import { createHash } from "node:crypto";
|
|
@@ -29,14 +102,14 @@ import {
|
|
|
29
102
|
statSync,
|
|
30
103
|
symlinkSync
|
|
31
104
|
} from "node:fs";
|
|
32
|
-
import { homedir } from "node:os";
|
|
33
|
-
import { basename, join, resolve } from "node:path";
|
|
105
|
+
import { homedir as homedir2 } from "node:os";
|
|
106
|
+
import { basename, join as join2, resolve } from "node:path";
|
|
34
107
|
function sanitizeBase(value) {
|
|
35
108
|
const sanitized = value.replace(/[^A-Za-z0-9._-]/g, "-").replace(/-+/g, "-");
|
|
36
109
|
return sanitized.length > 0 ? sanitized : "workspace";
|
|
37
110
|
}
|
|
38
111
|
function codegraphDataRoot(homeDir) {
|
|
39
|
-
return
|
|
112
|
+
return join2(homeDir, ".omo", "codegraph");
|
|
40
113
|
}
|
|
41
114
|
function workspaceStorageName(workspace) {
|
|
42
115
|
const resolved = resolve(workspace);
|
|
@@ -45,11 +118,11 @@ function workspaceStorageName(workspace) {
|
|
|
45
118
|
}
|
|
46
119
|
function resolveCodegraphWorkspacePaths(workspace, options = {}) {
|
|
47
120
|
const resolvedWorkspace = resolve(workspace);
|
|
48
|
-
const dataRoot = codegraphDataRoot(options.homeDir ??
|
|
121
|
+
const dataRoot = codegraphDataRoot(options.homeDir ?? homedir2());
|
|
49
122
|
return {
|
|
50
|
-
dataDir:
|
|
123
|
+
dataDir: join2(dataRoot, "projects", workspaceStorageName(resolvedWorkspace)),
|
|
51
124
|
dataRoot,
|
|
52
|
-
projectLink:
|
|
125
|
+
projectLink: join2(resolvedWorkspace, ".codegraph")
|
|
53
126
|
};
|
|
54
127
|
}
|
|
55
128
|
function fallbackResult(dataRoot, projectLink, reason) {
|
|
@@ -97,12 +170,12 @@ function prepareCodegraphWorkspace(workspace, options = {}) {
|
|
|
97
170
|
}
|
|
98
171
|
}
|
|
99
172
|
function ensureCodegraphGitignored(workspace) {
|
|
100
|
-
const gitDir =
|
|
173
|
+
const gitDir = join2(workspace, ".git");
|
|
101
174
|
if (!existsSync(gitDir))
|
|
102
175
|
return false;
|
|
103
|
-
const excludePath =
|
|
176
|
+
const excludePath = join2(gitDir, "info", "exclude");
|
|
104
177
|
try {
|
|
105
|
-
mkdirSync(
|
|
178
|
+
mkdirSync(join2(gitDir, "info"), { recursive: true });
|
|
106
179
|
const existing = existsSync(excludePath) ? readFileSync(excludePath, "utf8") : "";
|
|
107
180
|
if (existing.split(/\r?\n/).includes(".codegraph"))
|
|
108
181
|
return true;
|
|
@@ -137,7 +210,7 @@ function getCodegraphUninitializedProject(input) {
|
|
|
137
210
|
}
|
|
138
211
|
function buildCodegraphInitGuidance(projectPath, options = {}) {
|
|
139
212
|
const { dataDir, dataRoot, projectLink } = resolveCodegraphWorkspacePaths(projectPath, {
|
|
140
|
-
homeDir: options.homeDir ??
|
|
213
|
+
homeDir: options.homeDir ?? homedir3()
|
|
141
214
|
});
|
|
142
215
|
const displayProjectPath = formatDisplayPath(projectPath);
|
|
143
216
|
const displayProjectLink = formatDisplayPath(projectLink);
|
|
@@ -204,12 +277,245 @@ function isRecord(value) {
|
|
|
204
277
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
205
278
|
}
|
|
206
279
|
|
|
207
|
-
//
|
|
280
|
+
// ../../utils/src/codegraph/resolve.ts
|
|
281
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
208
282
|
import { homedir as homedir4 } from "node:os";
|
|
283
|
+
import { spawnSync } from "node:child_process";
|
|
284
|
+
import { basename as basename2, dirname, join as join4 } from "node:path";
|
|
285
|
+
import { createRequire } from "node:module";
|
|
286
|
+
|
|
287
|
+
// ../../utils/src/runtime/which.ts
|
|
288
|
+
import { accessSync, constants } from "node:fs";
|
|
289
|
+
import { delimiter, join as join3 } from "node:path";
|
|
290
|
+
var runtime = globalThis;
|
|
291
|
+
function isUnsafeCommandName(commandName) {
|
|
292
|
+
if (commandName.includes("/") || commandName.includes("\\"))
|
|
293
|
+
return true;
|
|
294
|
+
if (commandName === "." || commandName === ".." || commandName.includes(".."))
|
|
295
|
+
return true;
|
|
296
|
+
if (/^[a-zA-Z]:/.test(commandName))
|
|
297
|
+
return true;
|
|
298
|
+
if (commandName.includes("\x00"))
|
|
299
|
+
return true;
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
function isExecutable(filePath) {
|
|
303
|
+
try {
|
|
304
|
+
accessSync(filePath, process.platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
305
|
+
return true;
|
|
306
|
+
} catch (error) {
|
|
307
|
+
if (!(error instanceof Error) && Object.prototype.toString.call(error) !== "[object Error]") {
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function resolvePathValue() {
|
|
314
|
+
if (process.platform === "win32")
|
|
315
|
+
return process.env["Path"] ?? process.env["PATH"];
|
|
316
|
+
return process.env["PATH"];
|
|
317
|
+
}
|
|
318
|
+
function getWindowsCandidates(commandName) {
|
|
319
|
+
if (process.platform !== "win32")
|
|
320
|
+
return [commandName];
|
|
321
|
+
if (/\.[^\\/]+$/.test(commandName))
|
|
322
|
+
return [commandName];
|
|
323
|
+
return [commandName, `${commandName}.exe`, `${commandName}.cmd`, `${commandName}.bat`, `${commandName}.com`];
|
|
324
|
+
}
|
|
325
|
+
function bunWhich(commandName) {
|
|
326
|
+
if (!commandName)
|
|
327
|
+
return null;
|
|
328
|
+
if (isUnsafeCommandName(commandName))
|
|
329
|
+
return null;
|
|
330
|
+
const candidateNames = getWindowsCandidates(commandName);
|
|
331
|
+
for (const candidateName of candidateNames) {
|
|
332
|
+
const resolvedPath = runtime.Bun?.which(candidateName) ?? null;
|
|
333
|
+
if (resolvedPath !== null)
|
|
334
|
+
return resolvedPath;
|
|
335
|
+
}
|
|
336
|
+
const pathValue = resolvePathValue();
|
|
337
|
+
if (!pathValue)
|
|
338
|
+
return null;
|
|
339
|
+
const pathEntries = pathValue.split(delimiter).filter((pathEntry) => pathEntry.length > 0);
|
|
340
|
+
if (pathEntries.length === 0)
|
|
341
|
+
return null;
|
|
342
|
+
for (const pathEntry of pathEntries) {
|
|
343
|
+
for (const candidateName of candidateNames) {
|
|
344
|
+
const candidatePath = join3(pathEntry, candidateName);
|
|
345
|
+
if (isExecutable(candidatePath))
|
|
346
|
+
return candidatePath;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ../../utils/src/codegraph/node-support.ts
|
|
353
|
+
var CODEGRAPH_MIN_NODE_MAJOR = 20;
|
|
354
|
+
var CODEGRAPH_BLOCKED_NODE_MAJOR = 25;
|
|
355
|
+
var CODEGRAPH_UNSAFE_NODE_ENV = "CODEGRAPH_ALLOW_UNSAFE_NODE";
|
|
356
|
+
var CODEGRAPH_NODE_BIN_ENV = "CODEGRAPH_NODE_BIN";
|
|
357
|
+
function evaluateCodegraphNodeSupport(options = {}) {
|
|
358
|
+
const nodeVersion = options.nodeVersion ?? process.versions.node;
|
|
359
|
+
const env = options.env ?? process.env;
|
|
360
|
+
const override = (env[CODEGRAPH_UNSAFE_NODE_ENV]?.trim().length ?? 0) > 0;
|
|
361
|
+
const major = parseNodeMajor(nodeVersion);
|
|
362
|
+
if (major >= CODEGRAPH_BLOCKED_NODE_MAJOR) {
|
|
363
|
+
return { major, override, reason: "too-new", supported: override };
|
|
364
|
+
}
|
|
365
|
+
if (major < CODEGRAPH_MIN_NODE_MAJOR) {
|
|
366
|
+
return { major, override, reason: "too-old", supported: override };
|
|
367
|
+
}
|
|
368
|
+
return { major, override, supported: true };
|
|
369
|
+
}
|
|
370
|
+
function buildCodegraphNodeSkipHint(support) {
|
|
371
|
+
const detail = support.reason === "too-new" ? `Node ${support.major} is unsupported (>= ${CODEGRAPH_BLOCKED_NODE_MAJOR} crashes CodeGraph mid-indexing)` : `Node ${support.major} is too old (CodeGraph requires >= ${CODEGRAPH_MIN_NODE_MAJOR})`;
|
|
372
|
+
return `CodeGraph MCP skipped: ${detail}. Use Node ${CODEGRAPH_MIN_NODE_MAJOR}-${CODEGRAPH_BLOCKED_NODE_MAJOR - 1} (e.g. Node 22 LTS) or set ${CODEGRAPH_UNSAFE_NODE_ENV}=1 to override.
|
|
373
|
+
`;
|
|
374
|
+
}
|
|
375
|
+
function parseNodeMajor(version) {
|
|
376
|
+
const normalized = version.startsWith("v") ? version.slice(1) : version;
|
|
377
|
+
const major = Number.parseInt(normalized.split(".")[0] ?? "", 10);
|
|
378
|
+
return Number.isNaN(major) ? 0 : major;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// ../../utils/src/codegraph/resolve.ts
|
|
382
|
+
function codegraphCommandRequiresSupportedLocalNode(resolution) {
|
|
383
|
+
return resolution.source !== "bundled" && resolution.source !== "env" && resolution.source !== "provisioned";
|
|
384
|
+
}
|
|
385
|
+
var CODEGRAPH_PACKAGE = "@colbymchenry/codegraph";
|
|
386
|
+
var CODEGRAPH_ENV_BIN = "OMO_CODEGRAPH_BIN";
|
|
387
|
+
var CODEGRAPH_LEGACY_ENV_BIN = "CODEGRAPH_BIN";
|
|
388
|
+
var CODEGRAPH_NODE_CANDIDATES = ["node24", "node22", "node20", "node"];
|
|
389
|
+
var CODEGRAPH_NODE_PATH_CANDIDATES = [
|
|
390
|
+
"/opt/homebrew/opt/node@24/bin/node",
|
|
391
|
+
"/opt/homebrew/opt/node@22/bin/node",
|
|
392
|
+
"/opt/homebrew/opt/node@20/bin/node",
|
|
393
|
+
"/usr/local/opt/node@24/bin/node",
|
|
394
|
+
"/usr/local/opt/node@22/bin/node",
|
|
395
|
+
"/usr/local/opt/node@20/bin/node"
|
|
396
|
+
];
|
|
397
|
+
var requireFromHere = createRequire(import.meta.url);
|
|
398
|
+
function defaultRequireResolve(specifier) {
|
|
399
|
+
return requireFromHere.resolve(specifier);
|
|
400
|
+
}
|
|
401
|
+
function defaultNodeVersion(nodePath) {
|
|
402
|
+
if (nodePath === process.execPath && isNodeExecutableName(nodePath))
|
|
403
|
+
return process.versions.node;
|
|
404
|
+
try {
|
|
405
|
+
const result = spawnSync(nodePath, ["--version"], {
|
|
406
|
+
encoding: "utf8",
|
|
407
|
+
timeout: 2000,
|
|
408
|
+
windowsHide: true
|
|
409
|
+
});
|
|
410
|
+
if (result.error !== undefined || result.status !== 0)
|
|
411
|
+
return null;
|
|
412
|
+
const version = `${result.stdout}
|
|
413
|
+
${result.stderr}`.trim().split(/\s+/)[0];
|
|
414
|
+
return version === undefined || version.length === 0 ? null : version;
|
|
415
|
+
} catch (error) {
|
|
416
|
+
if (error instanceof Error)
|
|
417
|
+
return null;
|
|
418
|
+
throw error;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function isNodeExecutableName(filePath) {
|
|
422
|
+
const executable = basename2(filePath).toLowerCase();
|
|
423
|
+
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
424
|
+
}
|
|
425
|
+
function looksLikePath(command) {
|
|
426
|
+
return command.includes("/") || command.includes("\\") || /^[a-zA-Z]:/.test(command);
|
|
427
|
+
}
|
|
428
|
+
function resolveConfiguredNodeRuntime(configured, fileExists, which) {
|
|
429
|
+
if (looksLikePath(configured))
|
|
430
|
+
return fileExists(configured) ? configured : null;
|
|
431
|
+
return which(configured);
|
|
432
|
+
}
|
|
433
|
+
function supportsCodegraphNodeRuntime(nodePath, env, nodeVersion) {
|
|
434
|
+
const version = nodeVersion(nodePath);
|
|
435
|
+
if (version === null)
|
|
436
|
+
return false;
|
|
437
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: version }).supported;
|
|
438
|
+
}
|
|
439
|
+
function defaultNodeRuntime(env, fileExists, which, nodeVersion) {
|
|
440
|
+
const configured = env[CODEGRAPH_NODE_BIN_ENV]?.trim();
|
|
441
|
+
if (configured !== undefined && configured.length > 0) {
|
|
442
|
+
const resolved = resolveConfiguredNodeRuntime(configured, fileExists, which);
|
|
443
|
+
return resolved !== null && supportsCodegraphNodeRuntime(resolved, env, nodeVersion) ? resolved : null;
|
|
444
|
+
}
|
|
445
|
+
const candidates = [
|
|
446
|
+
...isNodeExecutableName(process.execPath) ? [process.execPath] : [],
|
|
447
|
+
...CODEGRAPH_NODE_CANDIDATES.map((commandName) => which(commandName)).filter((candidate) => candidate !== null),
|
|
448
|
+
...CODEGRAPH_NODE_PATH_CANDIDATES.filter((candidate) => fileExists(candidate))
|
|
449
|
+
];
|
|
450
|
+
const seen = new Set;
|
|
451
|
+
for (const candidate of candidates) {
|
|
452
|
+
if (seen.has(candidate))
|
|
453
|
+
continue;
|
|
454
|
+
seen.add(candidate);
|
|
455
|
+
if (supportsCodegraphNodeRuntime(candidate, env, nodeVersion))
|
|
456
|
+
return candidate;
|
|
457
|
+
}
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
function defaultProvisionedBin(homeDir, fileExists) {
|
|
461
|
+
const binaryName = process.platform === "win32" ? "codegraph.cmd" : "codegraph";
|
|
462
|
+
const candidates = [
|
|
463
|
+
join4(homeDir, ".omo", "codegraph", "bin", binaryName),
|
|
464
|
+
join4(homeDir, ".omo", "codegraph", "node-servers", "node_modules", ".bin", binaryName)
|
|
465
|
+
];
|
|
466
|
+
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
467
|
+
}
|
|
468
|
+
function resolveBundledShim(requireResolve, fileExists) {
|
|
469
|
+
try {
|
|
470
|
+
const packageJson = requireResolve(`${CODEGRAPH_PACKAGE}/package.json`);
|
|
471
|
+
const packageRoot = dirname(packageJson);
|
|
472
|
+
const candidates = [join4(packageRoot, "bin", "codegraph.js"), join4(packageRoot, "npm-shim.js")];
|
|
473
|
+
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
474
|
+
} catch (error) {
|
|
475
|
+
if (error instanceof Error)
|
|
476
|
+
return null;
|
|
477
|
+
if (error === null || error === undefined)
|
|
478
|
+
return null;
|
|
479
|
+
if (typeof error === "object" || typeof error === "string" || typeof error === "number")
|
|
480
|
+
return null;
|
|
481
|
+
if (typeof error === "boolean" || typeof error === "bigint" || typeof error === "symbol")
|
|
482
|
+
return null;
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function resolveCodegraphCommand(options = {}) {
|
|
487
|
+
const env = options.env ?? process.env;
|
|
488
|
+
const fileExists = options.fileExists ?? existsSync2;
|
|
489
|
+
const configuredBin = env[CODEGRAPH_ENV_BIN]?.trim() || env[CODEGRAPH_LEGACY_ENV_BIN]?.trim();
|
|
490
|
+
if (configuredBin !== undefined && configuredBin.length > 0) {
|
|
491
|
+
return { argsPrefix: [], command: configuredBin, exists: fileExists(configuredBin), source: "env" };
|
|
492
|
+
}
|
|
493
|
+
const which = options.which ?? bunWhich;
|
|
494
|
+
const nodeRuntime = options.nodeRuntime ?? (() => defaultNodeRuntime(env, fileExists, which, options.nodeVersion ?? defaultNodeVersion));
|
|
495
|
+
const bundled = resolveBundledShim(options.requireResolve ?? defaultRequireResolve, fileExists);
|
|
496
|
+
const runtime2 = nodeRuntime();
|
|
497
|
+
if (bundled !== null && runtime2 !== null) {
|
|
498
|
+
return { argsPrefix: [bundled], command: runtime2, exists: true, source: "bundled" };
|
|
499
|
+
}
|
|
500
|
+
const provisioned = options.provisioned?.() ?? defaultProvisionedBin(options.homeDir ?? homedir4(), fileExists);
|
|
501
|
+
if (provisioned !== null && fileExists(provisioned)) {
|
|
502
|
+
return { argsPrefix: [], command: provisioned, exists: true, source: "provisioned" };
|
|
503
|
+
}
|
|
504
|
+
const pathCommand = which("codegraph");
|
|
505
|
+
return {
|
|
506
|
+
argsPrefix: [],
|
|
507
|
+
command: pathCommand ?? "codegraph",
|
|
508
|
+
exists: pathCommand !== null,
|
|
509
|
+
source: "path"
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// shared/src/config-loader.ts
|
|
514
|
+
import { homedir as homedir6 } from "node:os";
|
|
209
515
|
|
|
210
516
|
// ../../utils/src/omo-config/loader.ts
|
|
211
|
-
import { existsSync as
|
|
212
|
-
import { homedir as
|
|
517
|
+
import { existsSync as existsSync4, readFileSync as readFileSync2 } from "node:fs";
|
|
518
|
+
import { homedir as homedir5 } from "node:os";
|
|
213
519
|
|
|
214
520
|
// ../../utils/src/deep-merge.ts
|
|
215
521
|
var DANGEROUS_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
@@ -1165,8 +1471,8 @@ function buildEnvOverrides(harness, env, warnings, merge) {
|
|
|
1165
1471
|
}
|
|
1166
1472
|
|
|
1167
1473
|
// ../../utils/src/omo-config/resolve.ts
|
|
1168
|
-
import { existsSync as
|
|
1169
|
-
import { dirname, isAbsolute, join as
|
|
1474
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
1475
|
+
import { dirname as dirname2, isAbsolute, join as join5, relative, resolve as resolve2 } from "node:path";
|
|
1170
1476
|
function containsPath(parent, child) {
|
|
1171
1477
|
const pathToChild = relative(parent, child);
|
|
1172
1478
|
return pathToChild === "" || !pathToChild.startsWith("..") && !isAbsolute(pathToChild);
|
|
@@ -1179,11 +1485,11 @@ function findProjectConfigPathsNearestFirst(cwd, homeDir) {
|
|
|
1179
1485
|
while (true) {
|
|
1180
1486
|
if (stopBeforeDir !== null && currentDir === stopBeforeDir)
|
|
1181
1487
|
break;
|
|
1182
|
-
const configPath =
|
|
1183
|
-
if (
|
|
1488
|
+
const configPath = join5(currentDir, ".omo", "config.jsonc");
|
|
1489
|
+
if (existsSync3(configPath)) {
|
|
1184
1490
|
paths.push(configPath);
|
|
1185
1491
|
}
|
|
1186
|
-
const parentDir =
|
|
1492
|
+
const parentDir = dirname2(currentDir);
|
|
1187
1493
|
if (parentDir === currentDir)
|
|
1188
1494
|
break;
|
|
1189
1495
|
currentDir = parentDir;
|
|
@@ -1191,7 +1497,7 @@ function findProjectConfigPathsNearestFirst(cwd, homeDir) {
|
|
|
1191
1497
|
return paths;
|
|
1192
1498
|
}
|
|
1193
1499
|
function resolveOmoConfigPaths(options) {
|
|
1194
|
-
const globalPath =
|
|
1500
|
+
const globalPath = join5(resolve2(options.homeDir), ".omo", "config.jsonc");
|
|
1195
1501
|
const projectPathsFarthestFirst = findProjectConfigPathsNearestFirst(options.cwd, options.homeDir).reverse();
|
|
1196
1502
|
return [
|
|
1197
1503
|
{ path: globalPath, scope: "global" },
|
|
@@ -1402,13 +1708,13 @@ function validateHarnessApplicability(config, harness) {
|
|
|
1402
1708
|
}
|
|
1403
1709
|
function loadOmoConfig(options) {
|
|
1404
1710
|
const cwd = options.cwd ?? process.cwd();
|
|
1405
|
-
const homeDir = options.homeDir ?? process.env["HOME"] ?? process.env["USERPROFILE"] ??
|
|
1711
|
+
const homeDir = options.homeDir ?? process.env["HOME"] ?? process.env["USERPROFILE"] ?? homedir5();
|
|
1406
1712
|
const env = options.env ?? process.env;
|
|
1407
1713
|
let config = BUILT_IN_DEFAULTS;
|
|
1408
1714
|
const sources = [];
|
|
1409
1715
|
const warnings = [];
|
|
1410
1716
|
for (const candidate of resolveOmoConfigPaths({ cwd, homeDir })) {
|
|
1411
|
-
if (!
|
|
1717
|
+
if (!existsSync4(candidate.path)) {
|
|
1412
1718
|
if (candidate.scope === "global") {
|
|
1413
1719
|
sources.push(toMissingSource(candidate));
|
|
1414
1720
|
}
|
|
@@ -1456,7 +1762,7 @@ function getCodexOmoConfig(options = {}) {
|
|
|
1456
1762
|
}
|
|
1457
1763
|
function resolveHomeDir(options) {
|
|
1458
1764
|
const env = options.env ?? process.env;
|
|
1459
|
-
return options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
1765
|
+
return options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir6();
|
|
1460
1766
|
}
|
|
1461
1767
|
|
|
1462
1768
|
// components/codegraph/src/session-start-worker.ts
|
|
@@ -1464,61 +1770,15 @@ import { execFile as execFile2 } from "node:child_process";
|
|
|
1464
1770
|
import { appendFileSync as appendFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync2 } from "node:fs";
|
|
1465
1771
|
import { homedir as homedir8 } from "node:os";
|
|
1466
1772
|
import { extname, join as join7 } from "node:path";
|
|
1467
|
-
import { cwd as processCwd, env as processEnv, stderr as processStderr } from "node:process";
|
|
1468
|
-
|
|
1469
|
-
// ../../utils/src/codegraph/env.ts
|
|
1470
|
-
import { homedir as homedir5 } from "node:os";
|
|
1471
|
-
import { join as join3 } from "node:path";
|
|
1472
|
-
var CODEGRAPH_INSTALL_DIR_ENV = "CODEGRAPH_INSTALL_DIR";
|
|
1473
|
-
var CODEGRAPH_NO_DOWNLOAD_ENV = "CODEGRAPH_NO_DOWNLOAD";
|
|
1474
|
-
var CODEGRAPH_TELEMETRY_ENV = "CODEGRAPH_TELEMETRY";
|
|
1475
|
-
var DO_NOT_TRACK_ENV = "DO_NOT_TRACK";
|
|
1476
|
-
function buildCodegraphEnv(options = {}) {
|
|
1477
|
-
const homeDir = options.homeDir ?? homedir5();
|
|
1478
|
-
return {
|
|
1479
|
-
[CODEGRAPH_INSTALL_DIR_ENV]: join3(homeDir, ".omo", "codegraph"),
|
|
1480
|
-
[CODEGRAPH_NO_DOWNLOAD_ENV]: "1",
|
|
1481
|
-
[CODEGRAPH_TELEMETRY_ENV]: "0",
|
|
1482
|
-
[DO_NOT_TRACK_ENV]: "1"
|
|
1483
|
-
};
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
// ../../utils/src/codegraph/node-support.ts
|
|
1487
|
-
var CODEGRAPH_MIN_NODE_MAJOR = 20;
|
|
1488
|
-
var CODEGRAPH_BLOCKED_NODE_MAJOR = 25;
|
|
1489
|
-
var CODEGRAPH_UNSAFE_NODE_ENV = "CODEGRAPH_ALLOW_UNSAFE_NODE";
|
|
1490
|
-
var CODEGRAPH_NODE_BIN_ENV = "CODEGRAPH_NODE_BIN";
|
|
1491
|
-
function evaluateCodegraphNodeSupport(options = {}) {
|
|
1492
|
-
const nodeVersion = options.nodeVersion ?? process.versions.node;
|
|
1493
|
-
const env = options.env ?? process.env;
|
|
1494
|
-
const override = (env[CODEGRAPH_UNSAFE_NODE_ENV]?.trim().length ?? 0) > 0;
|
|
1495
|
-
const major = parseNodeMajor(nodeVersion);
|
|
1496
|
-
if (major >= CODEGRAPH_BLOCKED_NODE_MAJOR) {
|
|
1497
|
-
return { major, override, reason: "too-new", supported: override };
|
|
1498
|
-
}
|
|
1499
|
-
if (major < CODEGRAPH_MIN_NODE_MAJOR) {
|
|
1500
|
-
return { major, override, reason: "too-old", supported: override };
|
|
1501
|
-
}
|
|
1502
|
-
return { major, override, supported: true };
|
|
1503
|
-
}
|
|
1504
|
-
function buildCodegraphNodeSkipHint(support) {
|
|
1505
|
-
const detail = support.reason === "too-new" ? `Node ${support.major} is unsupported (>= ${CODEGRAPH_BLOCKED_NODE_MAJOR} crashes CodeGraph mid-indexing)` : `Node ${support.major} is too old (CodeGraph requires >= ${CODEGRAPH_MIN_NODE_MAJOR})`;
|
|
1506
|
-
return `CodeGraph MCP skipped: ${detail}. Use Node ${CODEGRAPH_MIN_NODE_MAJOR}-${CODEGRAPH_BLOCKED_NODE_MAJOR - 1} (e.g. Node 22 LTS) or set ${CODEGRAPH_UNSAFE_NODE_ENV}=1 to override.
|
|
1507
|
-
`;
|
|
1508
|
-
}
|
|
1509
|
-
function parseNodeMajor(version) {
|
|
1510
|
-
const normalized = version.startsWith("v") ? version.slice(1) : version;
|
|
1511
|
-
const major = Number.parseInt(normalized.split(".")[0] ?? "", 10);
|
|
1512
|
-
return Number.isNaN(major) ? 0 : major;
|
|
1513
|
-
}
|
|
1773
|
+
import { cwd as processCwd, env as processEnv, execPath as processExecPath, stderr as processStderr } from "node:process";
|
|
1514
1774
|
|
|
1515
1775
|
// ../../utils/src/codegraph/provision.ts
|
|
1516
1776
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
1517
1777
|
import { execFile } from "node:child_process";
|
|
1518
1778
|
import { chmod, mkdir, readdir, readFile, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
1519
|
-
import { existsSync as
|
|
1520
|
-
import { homedir as
|
|
1521
|
-
import { basename as
|
|
1779
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1780
|
+
import { homedir as homedir7, hostname } from "node:os";
|
|
1781
|
+
import { basename as basename3, join as join6 } from "node:path";
|
|
1522
1782
|
import { promisify } from "node:util";
|
|
1523
1783
|
|
|
1524
1784
|
// ../../utils/src/codegraph/manifest.ts
|
|
@@ -1567,10 +1827,10 @@ function platformKey() {
|
|
|
1567
1827
|
return `${process.platform}-${process.arch}`;
|
|
1568
1828
|
}
|
|
1569
1829
|
function markerPath(installDir, version) {
|
|
1570
|
-
return
|
|
1830
|
+
return join6(installDir, ".provisioned", `codegraph-${version}.json`);
|
|
1571
1831
|
}
|
|
1572
1832
|
function defaultInstallDir() {
|
|
1573
|
-
return
|
|
1833
|
+
return join6(homedir7(), ".omo", "codegraph");
|
|
1574
1834
|
}
|
|
1575
1835
|
function sha256(bytes) {
|
|
1576
1836
|
return createHash2("sha256").update(bytes).digest("hex");
|
|
@@ -1604,7 +1864,7 @@ function forcedBadChecksumOptions(options) {
|
|
|
1604
1864
|
const key = options.platformKey ?? platformKey();
|
|
1605
1865
|
return {
|
|
1606
1866
|
downloader: async () => new TextEncoder().encode("checksum mismatch"),
|
|
1607
|
-
installDir: options.installDir ??
|
|
1867
|
+
installDir: options.installDir ?? join6(options.lockDir, "codegraph-force-bad-checksum"),
|
|
1608
1868
|
manifest: {
|
|
1609
1869
|
assets: {
|
|
1610
1870
|
[key]: { executableName: process.platform === "win32" ? "codegraph.cmd" : "codegraph", sha256: "0000", url: "memory://bad" }
|
|
@@ -1615,13 +1875,13 @@ function forcedBadChecksumOptions(options) {
|
|
|
1615
1875
|
};
|
|
1616
1876
|
}
|
|
1617
1877
|
async function readMarker(path) {
|
|
1618
|
-
if (!
|
|
1878
|
+
if (!existsSync5(path))
|
|
1619
1879
|
return null;
|
|
1620
1880
|
try {
|
|
1621
1881
|
const raw = JSON.parse(await readFile(path, "utf8"));
|
|
1622
1882
|
if (typeof raw === "object" && raw !== null && "binPath" in raw) {
|
|
1623
1883
|
const value = raw.binPath;
|
|
1624
|
-
return typeof value === "string" &&
|
|
1884
|
+
return typeof value === "string" && existsSync5(value) ? value : null;
|
|
1625
1885
|
}
|
|
1626
1886
|
return null;
|
|
1627
1887
|
} catch (error) {
|
|
@@ -1632,7 +1892,7 @@ async function readMarker(path) {
|
|
|
1632
1892
|
}
|
|
1633
1893
|
async function acquireLock(lockPath, waitMs, staleMs) {
|
|
1634
1894
|
const startedAt = Date.now();
|
|
1635
|
-
await mkdir(
|
|
1895
|
+
await mkdir(join6(lockPath, ".."), { recursive: true });
|
|
1636
1896
|
while (Date.now() - startedAt <= waitMs) {
|
|
1637
1897
|
try {
|
|
1638
1898
|
await mkdir(lockPath);
|
|
@@ -1657,44 +1917,44 @@ async function installExtractedBundle(extractDir, installDir, executableName) {
|
|
|
1657
1917
|
const roots = await readdir(extractDir);
|
|
1658
1918
|
if (roots.length !== 1)
|
|
1659
1919
|
throw new Error(`CodeGraph archive should contain one root directory, found ${roots.length}`);
|
|
1660
|
-
const bundleDir =
|
|
1920
|
+
const bundleDir = join6(extractDir, roots[0] ?? "");
|
|
1661
1921
|
const bundleEntries = await readdir(bundleDir);
|
|
1662
1922
|
await mkdir(installDir, { recursive: true });
|
|
1663
1923
|
for (const entry of bundleEntries) {
|
|
1664
|
-
await rm(
|
|
1665
|
-
await rename(
|
|
1924
|
+
await rm(join6(installDir, entry), { force: true, recursive: true });
|
|
1925
|
+
await rename(join6(bundleDir, entry), join6(installDir, entry));
|
|
1666
1926
|
}
|
|
1667
|
-
const destination =
|
|
1668
|
-
if (!
|
|
1927
|
+
const destination = join6(installDir, "bin", executableName);
|
|
1928
|
+
if (!existsSync5(destination))
|
|
1669
1929
|
throw new Error(`CodeGraph archive did not contain bin/${executableName}`);
|
|
1670
1930
|
await chmod(destination, 493);
|
|
1671
1931
|
return destination;
|
|
1672
1932
|
}
|
|
1673
1933
|
async function installAsset(layout) {
|
|
1674
1934
|
const { asset, downloader, installDir, version } = layout;
|
|
1675
|
-
const stagingDir =
|
|
1676
|
-
const archivePath =
|
|
1677
|
-
const extractDir =
|
|
1935
|
+
const stagingDir = join6(installDir, ".staging", randomUUID());
|
|
1936
|
+
const archivePath = join6(stagingDir, basename3(asset.url));
|
|
1937
|
+
const extractDir = join6(stagingDir, "extract");
|
|
1678
1938
|
try {
|
|
1679
1939
|
await mkdir(extractDir, { recursive: true });
|
|
1680
1940
|
const bytes = await downloader(asset);
|
|
1681
1941
|
const actualChecksum = sha256(bytes);
|
|
1682
1942
|
if (actualChecksum !== asset.sha256) {
|
|
1683
|
-
throw new Error(`checksum mismatch for ${
|
|
1943
|
+
throw new Error(`checksum mismatch for ${basename3(asset.url)}: expected ${asset.sha256}, got ${actualChecksum}`);
|
|
1684
1944
|
}
|
|
1685
1945
|
if (!asset.url.endsWith(".tar.gz") && !asset.url.endsWith(".tgz")) {
|
|
1686
|
-
throw new Error(`unsupported CodeGraph archive type for ${
|
|
1946
|
+
throw new Error(`unsupported CodeGraph archive type for ${basename3(asset.url)}`);
|
|
1687
1947
|
}
|
|
1688
1948
|
await writeFile(archivePath, bytes);
|
|
1689
1949
|
await extractTarGz(archivePath, extractDir);
|
|
1690
1950
|
const destination = await installExtractedBundle(extractDir, installDir, asset.executableName);
|
|
1691
|
-
await mkdir(
|
|
1951
|
+
await mkdir(join6(installDir, ".provisioned"), { recursive: true });
|
|
1692
1952
|
await writeFile(markerPath(installDir, version), `${JSON.stringify({ binPath: destination, version })}
|
|
1693
1953
|
`);
|
|
1694
1954
|
return destination;
|
|
1695
1955
|
} finally {
|
|
1696
1956
|
await rm(stagingDir, { force: true, recursive: true });
|
|
1697
|
-
await removeEmptyDirectory(
|
|
1957
|
+
await removeEmptyDirectory(join6(installDir, ".staging"));
|
|
1698
1958
|
}
|
|
1699
1959
|
}
|
|
1700
1960
|
async function ensureCodegraphProvisioned(options) {
|
|
@@ -1707,7 +1967,7 @@ async function ensureCodegraphProvisioned(options) {
|
|
|
1707
1967
|
const existing = await readMarker(marker);
|
|
1708
1968
|
if (existing !== null)
|
|
1709
1969
|
return { binPath: existing, provisioned: true };
|
|
1710
|
-
const lockPath =
|
|
1970
|
+
const lockPath = join6(options.lockDir, `codegraph-${hostname()}.lock`);
|
|
1711
1971
|
const release = await acquireLock(lockPath, options.lockWaitMs ?? DEFAULT_LOCK_WAIT_MS, options.lockStaleMs ?? DEFAULT_LOCK_STALE_MS);
|
|
1712
1972
|
if (release === null)
|
|
1713
1973
|
return { error: "timed out waiting for codegraph provisioning lock", provisioned: false };
|
|
@@ -1731,206 +1991,12 @@ async function ensureCodegraphProvisioned(options) {
|
|
|
1731
1991
|
}
|
|
1732
1992
|
}
|
|
1733
1993
|
|
|
1734
|
-
// ../../utils/src/codegraph/resolve.ts
|
|
1735
|
-
import { existsSync as existsSync5 } from "node:fs";
|
|
1736
|
-
import { homedir as homedir7 } from "node:os";
|
|
1737
|
-
import { spawnSync } from "node:child_process";
|
|
1738
|
-
import { basename as basename3, dirname as dirname2, join as join6 } from "node:path";
|
|
1739
|
-
import { createRequire } from "node:module";
|
|
1740
|
-
|
|
1741
|
-
// ../../utils/src/runtime/which.ts
|
|
1742
|
-
import { accessSync, constants } from "node:fs";
|
|
1743
|
-
import { delimiter, join as join5 } from "node:path";
|
|
1744
|
-
var runtime = globalThis;
|
|
1745
|
-
function isUnsafeCommandName(commandName) {
|
|
1746
|
-
if (commandName.includes("/") || commandName.includes("\\"))
|
|
1747
|
-
return true;
|
|
1748
|
-
if (commandName === "." || commandName === ".." || commandName.includes(".."))
|
|
1749
|
-
return true;
|
|
1750
|
-
if (/^[a-zA-Z]:/.test(commandName))
|
|
1751
|
-
return true;
|
|
1752
|
-
if (commandName.includes("\x00"))
|
|
1753
|
-
return true;
|
|
1754
|
-
return false;
|
|
1755
|
-
}
|
|
1756
|
-
function isExecutable(filePath) {
|
|
1757
|
-
try {
|
|
1758
|
-
accessSync(filePath, process.platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
1759
|
-
return true;
|
|
1760
|
-
} catch (error) {
|
|
1761
|
-
if (!(error instanceof Error) && Object.prototype.toString.call(error) !== "[object Error]") {
|
|
1762
|
-
throw error;
|
|
1763
|
-
}
|
|
1764
|
-
return false;
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
function resolvePathValue() {
|
|
1768
|
-
if (process.platform === "win32")
|
|
1769
|
-
return process.env["Path"] ?? process.env["PATH"];
|
|
1770
|
-
return process.env["PATH"];
|
|
1771
|
-
}
|
|
1772
|
-
function getWindowsCandidates(commandName) {
|
|
1773
|
-
if (process.platform !== "win32")
|
|
1774
|
-
return [commandName];
|
|
1775
|
-
if (/\.[^\\/]+$/.test(commandName))
|
|
1776
|
-
return [commandName];
|
|
1777
|
-
return [commandName, `${commandName}.exe`, `${commandName}.cmd`, `${commandName}.bat`, `${commandName}.com`];
|
|
1778
|
-
}
|
|
1779
|
-
function bunWhich(commandName) {
|
|
1780
|
-
if (!commandName)
|
|
1781
|
-
return null;
|
|
1782
|
-
if (isUnsafeCommandName(commandName))
|
|
1783
|
-
return null;
|
|
1784
|
-
const candidateNames = getWindowsCandidates(commandName);
|
|
1785
|
-
for (const candidateName of candidateNames) {
|
|
1786
|
-
const resolvedPath = runtime.Bun?.which(candidateName) ?? null;
|
|
1787
|
-
if (resolvedPath !== null)
|
|
1788
|
-
return resolvedPath;
|
|
1789
|
-
}
|
|
1790
|
-
const pathValue = resolvePathValue();
|
|
1791
|
-
if (!pathValue)
|
|
1792
|
-
return null;
|
|
1793
|
-
const pathEntries = pathValue.split(delimiter).filter((pathEntry) => pathEntry.length > 0);
|
|
1794
|
-
if (pathEntries.length === 0)
|
|
1795
|
-
return null;
|
|
1796
|
-
for (const pathEntry of pathEntries) {
|
|
1797
|
-
for (const candidateName of candidateNames) {
|
|
1798
|
-
const candidatePath = join5(pathEntry, candidateName);
|
|
1799
|
-
if (isExecutable(candidatePath))
|
|
1800
|
-
return candidatePath;
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
return null;
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
// ../../utils/src/codegraph/resolve.ts
|
|
1807
|
-
function codegraphCommandRequiresSupportedLocalNode(resolution) {
|
|
1808
|
-
return resolution.source !== "bundled" && resolution.source !== "env" && resolution.source !== "provisioned";
|
|
1809
|
-
}
|
|
1810
|
-
var CODEGRAPH_PACKAGE = "@colbymchenry/codegraph";
|
|
1811
|
-
var CODEGRAPH_ENV_BIN = "OMO_CODEGRAPH_BIN";
|
|
1812
|
-
var CODEGRAPH_LEGACY_ENV_BIN = "CODEGRAPH_BIN";
|
|
1813
|
-
var CODEGRAPH_NODE_CANDIDATES = ["node24", "node22", "node20", "node"];
|
|
1814
|
-
var requireFromHere = createRequire(import.meta.url);
|
|
1815
|
-
function defaultRequireResolve(specifier) {
|
|
1816
|
-
return requireFromHere.resolve(specifier);
|
|
1817
|
-
}
|
|
1818
|
-
function defaultNodeVersion(nodePath) {
|
|
1819
|
-
if (nodePath === process.execPath && isNodeExecutableName(nodePath))
|
|
1820
|
-
return process.versions.node;
|
|
1821
|
-
try {
|
|
1822
|
-
const result = spawnSync(nodePath, ["--version"], {
|
|
1823
|
-
encoding: "utf8",
|
|
1824
|
-
timeout: 2000,
|
|
1825
|
-
windowsHide: true
|
|
1826
|
-
});
|
|
1827
|
-
if (result.error !== undefined || result.status !== 0)
|
|
1828
|
-
return null;
|
|
1829
|
-
const version = `${result.stdout}
|
|
1830
|
-
${result.stderr}`.trim().split(/\s+/)[0];
|
|
1831
|
-
return version === undefined || version.length === 0 ? null : version;
|
|
1832
|
-
} catch (error) {
|
|
1833
|
-
if (error instanceof Error)
|
|
1834
|
-
return null;
|
|
1835
|
-
throw error;
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
function isNodeExecutableName(filePath) {
|
|
1839
|
-
const executable = basename3(filePath).toLowerCase();
|
|
1840
|
-
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
1841
|
-
}
|
|
1842
|
-
function looksLikePath(command) {
|
|
1843
|
-
return command.includes("/") || command.includes("\\") || /^[a-zA-Z]:/.test(command);
|
|
1844
|
-
}
|
|
1845
|
-
function resolveConfiguredNodeRuntime(configured, fileExists, which) {
|
|
1846
|
-
if (looksLikePath(configured))
|
|
1847
|
-
return fileExists(configured) ? configured : null;
|
|
1848
|
-
return which(configured);
|
|
1849
|
-
}
|
|
1850
|
-
function supportsCodegraphNodeRuntime(nodePath, env, nodeVersion) {
|
|
1851
|
-
const version = nodeVersion(nodePath);
|
|
1852
|
-
if (version === null)
|
|
1853
|
-
return false;
|
|
1854
|
-
return evaluateCodegraphNodeSupport({ env, nodeVersion: version }).supported;
|
|
1855
|
-
}
|
|
1856
|
-
function defaultNodeRuntime(env, fileExists, which, nodeVersion) {
|
|
1857
|
-
const configured = env[CODEGRAPH_NODE_BIN_ENV]?.trim();
|
|
1858
|
-
if (configured !== undefined && configured.length > 0) {
|
|
1859
|
-
const resolved = resolveConfiguredNodeRuntime(configured, fileExists, which);
|
|
1860
|
-
return resolved !== null && supportsCodegraphNodeRuntime(resolved, env, nodeVersion) ? resolved : null;
|
|
1861
|
-
}
|
|
1862
|
-
const candidates = [
|
|
1863
|
-
...isNodeExecutableName(process.execPath) ? [process.execPath] : [],
|
|
1864
|
-
...CODEGRAPH_NODE_CANDIDATES.map((commandName) => which(commandName)).filter((candidate) => candidate !== null)
|
|
1865
|
-
];
|
|
1866
|
-
const seen = new Set;
|
|
1867
|
-
for (const candidate of candidates) {
|
|
1868
|
-
if (seen.has(candidate))
|
|
1869
|
-
continue;
|
|
1870
|
-
seen.add(candidate);
|
|
1871
|
-
if (supportsCodegraphNodeRuntime(candidate, env, nodeVersion))
|
|
1872
|
-
return candidate;
|
|
1873
|
-
}
|
|
1874
|
-
return null;
|
|
1875
|
-
}
|
|
1876
|
-
function defaultProvisionedBin(homeDir, fileExists) {
|
|
1877
|
-
const binaryName = process.platform === "win32" ? "codegraph.cmd" : "codegraph";
|
|
1878
|
-
const candidates = [
|
|
1879
|
-
join6(homeDir, ".omo", "codegraph", "bin", binaryName),
|
|
1880
|
-
join6(homeDir, ".omo", "codegraph", "node-servers", "node_modules", ".bin", binaryName)
|
|
1881
|
-
];
|
|
1882
|
-
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
1883
|
-
}
|
|
1884
|
-
function resolveBundledShim(requireResolve, fileExists) {
|
|
1885
|
-
try {
|
|
1886
|
-
const packageJson = requireResolve(`${CODEGRAPH_PACKAGE}/package.json`);
|
|
1887
|
-
const packageRoot = dirname2(packageJson);
|
|
1888
|
-
const candidates = [join6(packageRoot, "bin", "codegraph.js"), join6(packageRoot, "npm-shim.js")];
|
|
1889
|
-
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
1890
|
-
} catch (error) {
|
|
1891
|
-
if (error instanceof Error)
|
|
1892
|
-
return null;
|
|
1893
|
-
if (error === null || error === undefined)
|
|
1894
|
-
return null;
|
|
1895
|
-
if (typeof error === "object" || typeof error === "string" || typeof error === "number")
|
|
1896
|
-
return null;
|
|
1897
|
-
if (typeof error === "boolean" || typeof error === "bigint" || typeof error === "symbol")
|
|
1898
|
-
return null;
|
|
1899
|
-
return null;
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
function resolveCodegraphCommand(options = {}) {
|
|
1903
|
-
const env = options.env ?? process.env;
|
|
1904
|
-
const fileExists = options.fileExists ?? existsSync5;
|
|
1905
|
-
const configuredBin = env[CODEGRAPH_ENV_BIN]?.trim() || env[CODEGRAPH_LEGACY_ENV_BIN]?.trim();
|
|
1906
|
-
if (configuredBin !== undefined && configuredBin.length > 0) {
|
|
1907
|
-
return { argsPrefix: [], command: configuredBin, exists: fileExists(configuredBin), source: "env" };
|
|
1908
|
-
}
|
|
1909
|
-
const which = options.which ?? bunWhich;
|
|
1910
|
-
const nodeRuntime = options.nodeRuntime ?? (() => defaultNodeRuntime(env, fileExists, which, options.nodeVersion ?? defaultNodeVersion));
|
|
1911
|
-
const bundled = resolveBundledShim(options.requireResolve ?? defaultRequireResolve, fileExists);
|
|
1912
|
-
const runtime2 = nodeRuntime();
|
|
1913
|
-
if (bundled !== null && runtime2 !== null) {
|
|
1914
|
-
return { argsPrefix: [bundled], command: runtime2, exists: true, source: "bundled" };
|
|
1915
|
-
}
|
|
1916
|
-
const provisioned = options.provisioned?.() ?? defaultProvisionedBin(options.homeDir ?? homedir7(), fileExists);
|
|
1917
|
-
if (provisioned !== null && fileExists(provisioned)) {
|
|
1918
|
-
return { argsPrefix: [], command: provisioned, exists: true, source: "provisioned" };
|
|
1919
|
-
}
|
|
1920
|
-
const pathCommand = which("codegraph");
|
|
1921
|
-
return {
|
|
1922
|
-
argsPrefix: [],
|
|
1923
|
-
command: pathCommand ?? "codegraph",
|
|
1924
|
-
exists: pathCommand !== null,
|
|
1925
|
-
source: "path"
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
1994
|
// components/codegraph/src/session-start-worker.ts
|
|
1930
1995
|
var SESSION_START_CWD_ENV = "OMO_CODEGRAPH_SESSION_START_CWD";
|
|
1931
1996
|
var CODEGRAPH_VERSION = "1.0.1";
|
|
1932
1997
|
var COMMAND_TIMEOUT_MS = 60000;
|
|
1933
1998
|
var WINDOWS_CMD_EXTENSIONS = new Set([".bat", ".cmd"]);
|
|
1999
|
+
var WINDOWS_NODE_SCRIPT_EXTENSIONS = new Set([".cjs", ".js", ".mjs"]);
|
|
1934
2000
|
var defaultDeps = {
|
|
1935
2001
|
ensureGitignored: ensureCodegraphGitignored,
|
|
1936
2002
|
ensureProvisioned: ensureCodegraphProvisioned,
|
|
@@ -2040,7 +2106,7 @@ function jsonSaysInitialized(value) {
|
|
|
2040
2106
|
async function runCodegraphCommand(projectRoot, command, args, options) {
|
|
2041
2107
|
const invocation = resolveCodegraphCommandInvocation(command, args);
|
|
2042
2108
|
return new Promise((resolvePromise) => {
|
|
2043
|
-
execFile2(invocation.command, [...invocation.args], { cwd: projectRoot, encoding: "utf8", env: {
|
|
2109
|
+
execFile2(invocation.command, [...invocation.args], { cwd: projectRoot, encoding: "utf8", env: buildCodegraphChildEnv({ ambientEnv: processEnv, codegraphEnv: options.env }), maxBuffer: 1024 * 1024, timeout: options.timeoutMs, windowsHide: true }, (error, stdout, stderr) => {
|
|
2044
2110
|
if (error === null) {
|
|
2045
2111
|
resolvePromise({ exitCode: 0, stderr: toOutputText(stderr), stdout: toOutputText(stdout), timedOut: false });
|
|
2046
2112
|
return;
|
|
@@ -2052,7 +2118,10 @@ async function runCodegraphCommand(projectRoot, command, args, options) {
|
|
|
2052
2118
|
function resolveCodegraphCommandInvocation(command, args, platform = process.platform) {
|
|
2053
2119
|
if (platform !== "win32")
|
|
2054
2120
|
return { args: [...args], command };
|
|
2055
|
-
|
|
2121
|
+
const extension = extname(command).toLowerCase();
|
|
2122
|
+
if (WINDOWS_NODE_SCRIPT_EXTENSIONS.has(extension))
|
|
2123
|
+
return { args: [command, ...args], command: processExecPath };
|
|
2124
|
+
if (!WINDOWS_CMD_EXTENSIONS.has(extension))
|
|
2056
2125
|
return { args: [...args], command };
|
|
2057
2126
|
return { args: ["/d", "/s", "/c", command, ...args], command: "cmd.exe" };
|
|
2058
2127
|
}
|
|
@@ -2105,6 +2174,7 @@ function isRecord3(value) {
|
|
|
2105
2174
|
|
|
2106
2175
|
// components/codegraph/src/hook.ts
|
|
2107
2176
|
var CODEGRAPH_SESSION_START_NOTICE = "LazyCodex CodeGraph bootstrap scheduled in background";
|
|
2177
|
+
var STATUS_PROBE_TIMEOUT_MS = 2000;
|
|
2108
2178
|
async function runCodegraphSessionStartHook(options = {}) {
|
|
2109
2179
|
return (await executeCodegraphSessionStartHook(options)).exitCode;
|
|
2110
2180
|
}
|
|
@@ -2120,14 +2190,81 @@ async function executeCodegraphSessionStartHook(options = {}) {
|
|
|
2120
2190
|
if (config.codegraph?.enabled === false) {
|
|
2121
2191
|
return { action: "skipped-disabled", exitCode: 0 };
|
|
2122
2192
|
}
|
|
2193
|
+
const isInitialized = await (options.statusProbe ?? isCodegraphProjectInitialized)({
|
|
2194
|
+
env,
|
|
2195
|
+
homeDir,
|
|
2196
|
+
projectRoot,
|
|
2197
|
+
...config.trustedCodegraphInstallDir === undefined ? {} : { trustedCodegraphInstallDir: config.trustedCodegraphInstallDir }
|
|
2198
|
+
});
|
|
2199
|
+
if (isInitialized) {
|
|
2200
|
+
return { action: "skipped-initialized", exitCode: 0 };
|
|
2201
|
+
}
|
|
2123
2202
|
(options.spawnWorker ?? spawnDetachedWorker)({
|
|
2124
2203
|
args: [options.workerCliPath ?? defaultWorkerCliPath(), "hook", "session-start-worker"],
|
|
2125
2204
|
command: process.execPath,
|
|
2126
|
-
env: {
|
|
2205
|
+
env: buildCodegraphChildEnv({
|
|
2206
|
+
ambientEnv: env,
|
|
2207
|
+
codegraphEnv: { [SESSION_START_CWD_ENV]: projectRoot },
|
|
2208
|
+
runtimeEnv: env
|
|
2209
|
+
})
|
|
2127
2210
|
});
|
|
2128
2211
|
writeHookJson(options.stdout ?? processStdout);
|
|
2129
2212
|
return { action: "spawned", exitCode: 0 };
|
|
2130
2213
|
}
|
|
2214
|
+
async function isCodegraphProjectInitialized(options) {
|
|
2215
|
+
const resolved = resolveCodegraphCommand({
|
|
2216
|
+
env: options.env,
|
|
2217
|
+
homeDir: options.homeDir,
|
|
2218
|
+
provisioned: () => provisionedBinFromInstallDir2(options.trustedCodegraphInstallDir)
|
|
2219
|
+
});
|
|
2220
|
+
if (!resolved.exists)
|
|
2221
|
+
return false;
|
|
2222
|
+
const invocation = resolveCodegraphCommandInvocation(resolved.command, [...resolved.argsPrefix, "status", "--json"]);
|
|
2223
|
+
const codegraphEnv = {
|
|
2224
|
+
...buildCodegraphEnv({ homeDir: options.homeDir }),
|
|
2225
|
+
...options.trustedCodegraphInstallDir === undefined ? {} : { CODEGRAPH_INSTALL_DIR: options.trustedCodegraphInstallDir }
|
|
2226
|
+
};
|
|
2227
|
+
const status = await runStatusProbe(options.projectRoot, invocation.command, invocation.args, buildCodegraphChildEnv({ ambientEnv: options.env, codegraphEnv, runtimeEnv: options.env }));
|
|
2228
|
+
if (status.exitCode !== 0 || status.timedOut)
|
|
2229
|
+
return false;
|
|
2230
|
+
return codegraphStatusSaysInitialized(status.stdout);
|
|
2231
|
+
}
|
|
2232
|
+
function runStatusProbe(projectRoot, command, args, env) {
|
|
2233
|
+
return new Promise((resolveProbe) => {
|
|
2234
|
+
execFile3(command, [...args], {
|
|
2235
|
+
cwd: projectRoot,
|
|
2236
|
+
encoding: "utf8",
|
|
2237
|
+
env,
|
|
2238
|
+
maxBuffer: 1024 * 1024,
|
|
2239
|
+
timeout: STATUS_PROBE_TIMEOUT_MS,
|
|
2240
|
+
windowsHide: true
|
|
2241
|
+
}, (error, stdout) => {
|
|
2242
|
+
if (error === null) {
|
|
2243
|
+
resolveProbe({ exitCode: 0, stdout: toOutputText2(stdout), timedOut: false });
|
|
2244
|
+
return;
|
|
2245
|
+
}
|
|
2246
|
+
resolveProbe({ exitCode: resolveExitCode2(error), stdout: toOutputText2(stdout), timedOut: error.killed === true });
|
|
2247
|
+
});
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
function codegraphStatusSaysInitialized(stdout) {
|
|
2251
|
+
const parsed = parseJson2(stdout);
|
|
2252
|
+
if (!isRecord4(parsed))
|
|
2253
|
+
return false;
|
|
2254
|
+
const initialized = parsed["initialized"] ?? parsed["isInitialized"] ?? parsed["ready"];
|
|
2255
|
+
if (typeof initialized === "boolean")
|
|
2256
|
+
return initialized;
|
|
2257
|
+
const status = parsed["status"];
|
|
2258
|
+
if (typeof status !== "string")
|
|
2259
|
+
return false;
|
|
2260
|
+
const normalized = status.toLowerCase();
|
|
2261
|
+
return (normalized.includes("initialized") || normalized.includes("ready")) && !normalized.includes("not initialized") && !normalized.includes("uninitialized");
|
|
2262
|
+
}
|
|
2263
|
+
function provisionedBinFromInstallDir2(installDir) {
|
|
2264
|
+
if (installDir === undefined)
|
|
2265
|
+
return null;
|
|
2266
|
+
return join8(installDir, "bin", process.platform === "win32" ? "codegraph.cmd" : "codegraph");
|
|
2267
|
+
}
|
|
2131
2268
|
async function executeCodegraphPostToolUseHook(options = {}) {
|
|
2132
2269
|
const env = options.env ?? processEnv2;
|
|
2133
2270
|
const input = await readHookInput(options.stdin ?? processStdin);
|
|
@@ -2169,6 +2306,14 @@ function spawnDetachedWorker(invocation) {
|
|
|
2169
2306
|
function resolveHomeDir3(env) {
|
|
2170
2307
|
return env["HOME"] ?? env["USERPROFILE"] ?? homedir9();
|
|
2171
2308
|
}
|
|
2309
|
+
function resolveExitCode2(error) {
|
|
2310
|
+
if ("code" in error && typeof error.code === "number")
|
|
2311
|
+
return error.code;
|
|
2312
|
+
return 1;
|
|
2313
|
+
}
|
|
2314
|
+
function toOutputText2(value) {
|
|
2315
|
+
return Buffer.isBuffer(value) ? value.toString("utf8") : value;
|
|
2316
|
+
}
|
|
2172
2317
|
function resolveProjectRoot(input, fallback) {
|
|
2173
2318
|
if (!isRecord4(input))
|
|
2174
2319
|
return fallback;
|
|
@@ -2202,20 +2347,21 @@ function defaultWorkerCliPath() {
|
|
|
2202
2347
|
}
|
|
2203
2348
|
|
|
2204
2349
|
// components/codegraph/src/serve.ts
|
|
2205
|
-
import { spawn as spawn2 } from "node:child_process";
|
|
2206
2350
|
import { existsSync as existsSync7, realpathSync as realpathSync2 } from "node:fs";
|
|
2207
2351
|
import { homedir as homedir10 } from "node:os";
|
|
2208
|
-
import { basename as basename4,
|
|
2352
|
+
import { basename as basename4, join as join9, resolve as resolve3 } from "node:path";
|
|
2209
2353
|
import {
|
|
2210
2354
|
cwd as processCwd3,
|
|
2211
2355
|
env as processEnv3,
|
|
2212
|
-
execPath as processExecPath,
|
|
2213
2356
|
stdin as processStdin2,
|
|
2214
2357
|
stderr as processStderr2,
|
|
2215
2358
|
stdout as processStdout2
|
|
2216
2359
|
} from "node:process";
|
|
2217
2360
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2218
2361
|
|
|
2362
|
+
// components/codegraph/src/mcp-bridge.ts
|
|
2363
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
2364
|
+
|
|
2219
2365
|
// ../../mcp-stdio-core/src/record.ts
|
|
2220
2366
|
function isPlainRecord(value) {
|
|
2221
2367
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -2416,6 +2562,227 @@ function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
|
|
|
2416
2562
|
closed: () => isClosed
|
|
2417
2563
|
};
|
|
2418
2564
|
}
|
|
2565
|
+
// components/codegraph/src/serve-invocation.ts
|
|
2566
|
+
import { extname as extname2 } from "node:path";
|
|
2567
|
+
import { execPath as processExecPath2 } from "node:process";
|
|
2568
|
+
var WINDOWS_CMD_EXTENSIONS2 = new Set([".bat", ".cmd"]);
|
|
2569
|
+
var WINDOWS_NODE_SCRIPT_EXTENSIONS2 = new Set([".cjs", ".js", ".mjs"]);
|
|
2570
|
+
function resolveServeProcessInvocation(command, args, platform = process.platform) {
|
|
2571
|
+
if (platform !== "win32")
|
|
2572
|
+
return { args: [...args], command };
|
|
2573
|
+
const extension = extname2(command).toLowerCase();
|
|
2574
|
+
if (WINDOWS_NODE_SCRIPT_EXTENSIONS2.has(extension)) {
|
|
2575
|
+
return { args: [command, ...args], command: processExecPath2 };
|
|
2576
|
+
}
|
|
2577
|
+
if (WINDOWS_CMD_EXTENSIONS2.has(extension)) {
|
|
2578
|
+
return { args: ["/d", "/s", "/c", command, ...args], command: "cmd.exe" };
|
|
2579
|
+
}
|
|
2580
|
+
return { args: [...args], command };
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
// components/codegraph/src/mcp-bridge.ts
|
|
2584
|
+
class CodegraphBridgeStdioError extends Error {
|
|
2585
|
+
streamName;
|
|
2586
|
+
name = "CodegraphBridgeStdioError";
|
|
2587
|
+
constructor(streamName) {
|
|
2588
|
+
super(`CodeGraph MCP bridge missing child ${streamName}`);
|
|
2589
|
+
this.streamName = streamName;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
var CODEGRAPH_NODE_DESCRIPTION = "Inspect one named symbol or file. In symbol mode, includeCode=true includes leaf-symbol source when available. Container symbols such as classes, interfaces, structs, enums, modules, and namespaces return structural outlines with member lists by design. For container source, request a specific member symbol or use file mode with symbolsOnly=false plus offset/limit.";
|
|
2593
|
+
var CODEGRAPH_NODE_INCLUDE_CODE_DESCRIPTION = "Symbol mode: include leaf-symbol source when available. Container symbols such as classes, interfaces, structs, enums, modules, and namespaces intentionally return structural outlines with members; request a specific member symbol or use file mode with symbolsOnly=false plus offset/limit for source.";
|
|
2594
|
+
var CODEGRAPH_CONTAINER_OUTLINE_GUIDANCE = "Container symbols intentionally return structural outlines with members. For source, request a specific member symbol or call codegraph_node in file mode with symbolsOnly=false plus offset/limit around the symbol location.";
|
|
2595
|
+
async function runBridgedCodegraphProcess(command, args, options) {
|
|
2596
|
+
const invocation = resolveServeProcessInvocation(command, args);
|
|
2597
|
+
const child = spawn2(invocation.command, invocation.args, {
|
|
2598
|
+
cwd: options.cwd,
|
|
2599
|
+
env: options.env,
|
|
2600
|
+
stdio: ["pipe", "pipe", "inherit"]
|
|
2601
|
+
});
|
|
2602
|
+
const childInput = child.stdin;
|
|
2603
|
+
const childOutput = child.stdout;
|
|
2604
|
+
if (childInput === null)
|
|
2605
|
+
throw new CodegraphBridgeStdioError("stdin");
|
|
2606
|
+
if (childOutput === null)
|
|
2607
|
+
throw new CodegraphBridgeStdioError("stdout");
|
|
2608
|
+
const pendingResponses = new Map;
|
|
2609
|
+
let defaultResponseMode = "framed";
|
|
2610
|
+
const childExit = new Promise((resolveExit, reject) => {
|
|
2611
|
+
child.once("error", reject);
|
|
2612
|
+
child.once("exit", (code, signal) => {
|
|
2613
|
+
if (code !== null) {
|
|
2614
|
+
resolveExit(code);
|
|
2615
|
+
return;
|
|
2616
|
+
}
|
|
2617
|
+
resolveExit(signal === null ? 0 : 1);
|
|
2618
|
+
});
|
|
2619
|
+
});
|
|
2620
|
+
const bridgeDone = Promise.all([
|
|
2621
|
+
forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
|
|
2622
|
+
defaultResponseMode = mode;
|
|
2623
|
+
}),
|
|
2624
|
+
forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode)
|
|
2625
|
+
]);
|
|
2626
|
+
const destroyChildPipes = () => {
|
|
2627
|
+
childInput.destroy();
|
|
2628
|
+
childOutput.destroy();
|
|
2629
|
+
};
|
|
2630
|
+
childExit.then(destroyChildPipes, destroyChildPipes);
|
|
2631
|
+
return Promise.race([childExit, bridgeDone.then(() => childExit)]);
|
|
2632
|
+
}
|
|
2633
|
+
async function forwardClientToCodegraph(input, childInput, pendingResponses, setDefaultResponseMode) {
|
|
2634
|
+
for await (const message of readStdioJsonRpcMessages(input)) {
|
|
2635
|
+
if (message.kind === "parse_error") {
|
|
2636
|
+
continue;
|
|
2637
|
+
}
|
|
2638
|
+
const responseMode = message.responseMode;
|
|
2639
|
+
setDefaultResponseMode(responseMode);
|
|
2640
|
+
const key = responseModeKey(message.payload);
|
|
2641
|
+
if (key !== null) {
|
|
2642
|
+
pendingResponses.set(key, {
|
|
2643
|
+
method: jsonRpcMethod(message.payload),
|
|
2644
|
+
responseMode,
|
|
2645
|
+
toolName: jsonRpcToolName(message.payload)
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
await writeLine(childInput, JSON.stringify(message.payload));
|
|
2649
|
+
}
|
|
2650
|
+
childInput.end();
|
|
2651
|
+
}
|
|
2652
|
+
async function forwardCodegraphToClient(childOutput, output, pendingResponses, defaultResponseMode) {
|
|
2653
|
+
for await (const message of readStdioJsonRpcMessages(childOutput)) {
|
|
2654
|
+
if (message.kind === "parse_error") {
|
|
2655
|
+
writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
|
|
2656
|
+
continue;
|
|
2657
|
+
}
|
|
2658
|
+
const key = responseModeKey(message.payload);
|
|
2659
|
+
const pendingResponse = key === null ? undefined : pendingResponses.get(key);
|
|
2660
|
+
const responseMode = pendingResponse?.responseMode ?? defaultResponseMode();
|
|
2661
|
+
if (key !== null)
|
|
2662
|
+
pendingResponses.delete(key);
|
|
2663
|
+
writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
function responseModeKey(payload) {
|
|
2667
|
+
if (!isPlainRecord(payload) || !("id" in payload))
|
|
2668
|
+
return null;
|
|
2669
|
+
const id = jsonRpcId(payload["id"]);
|
|
2670
|
+
return `${typeof id}:${String(id)}`;
|
|
2671
|
+
}
|
|
2672
|
+
function jsonRpcMethod(payload) {
|
|
2673
|
+
if (!isPlainRecord(payload))
|
|
2674
|
+
return null;
|
|
2675
|
+
const method = payload["method"];
|
|
2676
|
+
return typeof method === "string" ? method : null;
|
|
2677
|
+
}
|
|
2678
|
+
function jsonRpcToolName(payload) {
|
|
2679
|
+
if (jsonRpcMethod(payload) !== "tools/call" || !isPlainRecord(payload))
|
|
2680
|
+
return null;
|
|
2681
|
+
const params = payload["params"];
|
|
2682
|
+
if (!isPlainRecord(params))
|
|
2683
|
+
return null;
|
|
2684
|
+
const name = params["name"];
|
|
2685
|
+
return typeof name === "string" ? name : null;
|
|
2686
|
+
}
|
|
2687
|
+
function clarifyCodegraphResponse(payload, pendingResponse) {
|
|
2688
|
+
if (pendingResponse?.method === "tools/list")
|
|
2689
|
+
return clarifyCodegraphToolsList(payload);
|
|
2690
|
+
if (pendingResponse?.method === "tools/call" && pendingResponse.toolName === "codegraph_node") {
|
|
2691
|
+
return clarifyCodegraphNodeCallResult(payload);
|
|
2692
|
+
}
|
|
2693
|
+
return payload;
|
|
2694
|
+
}
|
|
2695
|
+
function clarifyCodegraphToolsList(payload) {
|
|
2696
|
+
if (!isPlainRecord(payload))
|
|
2697
|
+
return payload;
|
|
2698
|
+
const result = payload["result"];
|
|
2699
|
+
if (!isPlainRecord(result) || !Array.isArray(result["tools"]))
|
|
2700
|
+
return payload;
|
|
2701
|
+
let changed = false;
|
|
2702
|
+
const tools = result["tools"].map((tool) => {
|
|
2703
|
+
if (!isPlainRecord(tool) || tool["name"] !== "codegraph_node")
|
|
2704
|
+
return tool;
|
|
2705
|
+
if (!hasCodegraphNodeContractMetadata(tool))
|
|
2706
|
+
return tool;
|
|
2707
|
+
changed = true;
|
|
2708
|
+
return clarifyCodegraphNodeTool(tool);
|
|
2709
|
+
});
|
|
2710
|
+
if (!changed)
|
|
2711
|
+
return payload;
|
|
2712
|
+
return { ...payload, result: { ...result, tools } };
|
|
2713
|
+
}
|
|
2714
|
+
function clarifyCodegraphNodeTool(tool) {
|
|
2715
|
+
const clarified = {
|
|
2716
|
+
...tool,
|
|
2717
|
+
description: CODEGRAPH_NODE_DESCRIPTION
|
|
2718
|
+
};
|
|
2719
|
+
const inputSchema = tool["inputSchema"];
|
|
2720
|
+
if (isPlainRecord(inputSchema))
|
|
2721
|
+
clarified["inputSchema"] = clarifyCodegraphNodeInputSchema(inputSchema);
|
|
2722
|
+
return clarified;
|
|
2723
|
+
}
|
|
2724
|
+
function hasCodegraphNodeContractMetadata(tool) {
|
|
2725
|
+
if (typeof tool["description"] === "string")
|
|
2726
|
+
return true;
|
|
2727
|
+
const inputSchema = tool["inputSchema"];
|
|
2728
|
+
if (!isPlainRecord(inputSchema))
|
|
2729
|
+
return false;
|
|
2730
|
+
const properties = inputSchema["properties"];
|
|
2731
|
+
return isPlainRecord(properties) && isPlainRecord(properties["includeCode"]);
|
|
2732
|
+
}
|
|
2733
|
+
function clarifyCodegraphNodeInputSchema(inputSchema) {
|
|
2734
|
+
const properties = inputSchema["properties"];
|
|
2735
|
+
if (!isPlainRecord(properties))
|
|
2736
|
+
return inputSchema;
|
|
2737
|
+
const includeCode = properties["includeCode"];
|
|
2738
|
+
if (!isPlainRecord(includeCode))
|
|
2739
|
+
return inputSchema;
|
|
2740
|
+
return {
|
|
2741
|
+
...inputSchema,
|
|
2742
|
+
properties: {
|
|
2743
|
+
...properties,
|
|
2744
|
+
includeCode: {
|
|
2745
|
+
...includeCode,
|
|
2746
|
+
description: CODEGRAPH_NODE_INCLUDE_CODE_DESCRIPTION
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
};
|
|
2750
|
+
}
|
|
2751
|
+
function clarifyCodegraphNodeCallResult(payload) {
|
|
2752
|
+
if (!isPlainRecord(payload))
|
|
2753
|
+
return payload;
|
|
2754
|
+
const result = payload["result"];
|
|
2755
|
+
if (!isPlainRecord(result) || !Array.isArray(result["content"]))
|
|
2756
|
+
return payload;
|
|
2757
|
+
let changed = false;
|
|
2758
|
+
const content = result["content"].map((item) => {
|
|
2759
|
+
if (!isPlainRecord(item) || item["type"] !== "text" || typeof item["text"] !== "string")
|
|
2760
|
+
return item;
|
|
2761
|
+
const text = clarifyContainerOutlineGuidance(item["text"]);
|
|
2762
|
+
if (text === item["text"])
|
|
2763
|
+
return item;
|
|
2764
|
+
changed = true;
|
|
2765
|
+
return { ...item, text };
|
|
2766
|
+
});
|
|
2767
|
+
if (!changed)
|
|
2768
|
+
return payload;
|
|
2769
|
+
return { ...payload, result: { ...result, content } };
|
|
2770
|
+
}
|
|
2771
|
+
function clarifyContainerOutlineGuidance(text) {
|
|
2772
|
+
if (!text.includes("Structural outline only"))
|
|
2773
|
+
return text;
|
|
2774
|
+
return text.replace(/Structural outline only[^\n]*(?:\n[^\n]*(?:Read|read)[^\n]*)?/g, CODEGRAPH_CONTAINER_OUTLINE_GUIDANCE);
|
|
2775
|
+
}
|
|
2776
|
+
async function writeLine(output, line) {
|
|
2777
|
+
if (output.write(`${line}
|
|
2778
|
+
`))
|
|
2779
|
+
return;
|
|
2780
|
+
await new Promise((resolveDrain, reject) => {
|
|
2781
|
+
output.once("drain", resolveDrain);
|
|
2782
|
+
output.once("error", reject);
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2419
2786
|
// components/codegraph/src/mcp-unavailable.ts
|
|
2420
2787
|
async function runUnavailableCodegraphMcpServer(options) {
|
|
2421
2788
|
await runJsonRpcStdioServer({
|
|
@@ -2468,12 +2835,13 @@ var CODEGRAPH_SKIP_HINT = `CodeGraph MCP skipped: codegraph binary not found. In
|
|
|
2468
2835
|
var CODEGRAPH_DISABLED_HINT = `CodeGraph MCP skipped: disabled by OMO SOT config. Set [codex].codegraph.enabled=true to enable it.
|
|
2469
2836
|
`;
|
|
2470
2837
|
var CODEGRAPH_VERSION2 = "1.0.1";
|
|
2471
|
-
var
|
|
2472
|
-
var WINDOWS_NODE_SCRIPT_EXTENSIONS = new Set([".cjs", ".js", ".mjs"]);
|
|
2838
|
+
var PROJECT_CWD_ENV_KEYS = ["OMO_CODEGRAPH_PROJECT_CWD", SESSION_START_CWD_ENV, "PWD"];
|
|
2473
2839
|
async function runCodegraphServe(options = {}) {
|
|
2474
2840
|
const env = options.env ?? processEnv3;
|
|
2475
2841
|
const homeDir = options.homeDir ?? homedir10();
|
|
2476
|
-
const
|
|
2842
|
+
const wrapperCwd = options.cwd ?? processCwd3();
|
|
2843
|
+
const projectCwd = resolveProjectCwd(env, wrapperCwd);
|
|
2844
|
+
const config = options.config ?? getCodexOmoConfig({ cwd: projectCwd, env, homeDir });
|
|
2477
2845
|
const codegraphConfig = config.codegraph ?? {};
|
|
2478
2846
|
if (codegraphConfig.enabled === false) {
|
|
2479
2847
|
return runUnavailableMcp(CODEGRAPH_DISABLED_HINT, options);
|
|
@@ -2482,7 +2850,7 @@ async function runCodegraphServe(options = {}) {
|
|
|
2482
2850
|
const resolutionOptions = {
|
|
2483
2851
|
env,
|
|
2484
2852
|
homeDir,
|
|
2485
|
-
provisioned: () =>
|
|
2853
|
+
provisioned: () => provisionedBinFromInstallDir3(trustedInstallDir)
|
|
2486
2854
|
};
|
|
2487
2855
|
let resolution = options.resolve?.(resolutionOptions) ?? resolveCodegraphCommand(resolutionOptions);
|
|
2488
2856
|
const nodeSupport = evaluateCodegraphNodeSupport({ env, nodeVersion: options.nodeVersion });
|
|
@@ -2505,15 +2873,16 @@ async function runCodegraphServe(options = {}) {
|
|
|
2505
2873
|
if (codegraphCommandRequiresSupportedLocalNode(resolution) && !nodeSupport.supported) {
|
|
2506
2874
|
return runUnavailableMcp(buildCodegraphNodeSkipHint(nodeSupport), options);
|
|
2507
2875
|
}
|
|
2508
|
-
const runProcess = options.runProcess ??
|
|
2876
|
+
const runProcess = options.runProcess ?? runBridgedCodegraphProcess;
|
|
2509
2877
|
const codegraphEnv = codegraphEnvForConfig2(trustedInstallDir, homeDir, options.buildEnv);
|
|
2510
|
-
const mergedEnv = {
|
|
2511
|
-
...env,
|
|
2512
|
-
...codegraphEnv
|
|
2513
|
-
};
|
|
2878
|
+
const mergedEnv = buildCodegraphChildEnv({ ambientEnv: env, codegraphEnv, runtimeEnv: env });
|
|
2514
2879
|
return runProcess(resolution.command, [...resolution.argsPrefix, "serve", "--mcp"], {
|
|
2880
|
+
cwd: projectCwd,
|
|
2515
2881
|
env: mergedEnv,
|
|
2516
|
-
|
|
2882
|
+
input: options.stdin ?? processStdin2,
|
|
2883
|
+
output: options.stdout ?? processStdout2,
|
|
2884
|
+
stderr: options.stderr ?? processStderr2,
|
|
2885
|
+
stdio: "pipe"
|
|
2517
2886
|
});
|
|
2518
2887
|
}
|
|
2519
2888
|
async function runUnavailableMcp(reason, options) {
|
|
@@ -2531,10 +2900,10 @@ async function provisionMissingCodegraph(options) {
|
|
|
2531
2900
|
return null;
|
|
2532
2901
|
if (options.config.auto_provision === false)
|
|
2533
2902
|
return null;
|
|
2534
|
-
const installDir = options.trustedInstallDir ??
|
|
2903
|
+
const installDir = options.trustedInstallDir ?? join9(options.homeDir, ".omo", "codegraph");
|
|
2535
2904
|
const result = await options.ensureProvisioned({
|
|
2536
2905
|
installDir,
|
|
2537
|
-
lockDir:
|
|
2906
|
+
lockDir: join9(installDir, ".locks"),
|
|
2538
2907
|
version: CODEGRAPH_VERSION2
|
|
2539
2908
|
});
|
|
2540
2909
|
if (!result.provisioned || result.binPath === undefined)
|
|
@@ -2555,41 +2924,26 @@ function codegraphEnvForConfig2(trustedInstallDir, homeDir, buildEnv) {
|
|
|
2555
2924
|
const env = buildEnv?.({ homeDir }) ?? buildCodegraphEnv({ homeDir });
|
|
2556
2925
|
return trustedInstallDir === undefined ? env : { ...env, CODEGRAPH_INSTALL_DIR: trustedInstallDir };
|
|
2557
2926
|
}
|
|
2558
|
-
function
|
|
2927
|
+
function resolveProjectCwd(env, fallback) {
|
|
2928
|
+
for (const key of PROJECT_CWD_ENV_KEYS) {
|
|
2929
|
+
const candidate = env[key]?.trim();
|
|
2930
|
+
if (candidate === undefined || candidate.length === 0)
|
|
2931
|
+
continue;
|
|
2932
|
+
const resolved = resolve3(candidate);
|
|
2933
|
+
if (existsSync7(resolved))
|
|
2934
|
+
return resolved;
|
|
2935
|
+
}
|
|
2936
|
+
return resolve3(fallback);
|
|
2937
|
+
}
|
|
2938
|
+
function provisionedBinFromInstallDir3(installDir) {
|
|
2559
2939
|
if (installDir === undefined)
|
|
2560
2940
|
return null;
|
|
2561
|
-
const candidate =
|
|
2941
|
+
const candidate = join9(installDir, "bin", process.platform === "win32" ? "codegraph.cmd" : "codegraph");
|
|
2562
2942
|
return existsSync7(candidate) ? candidate : null;
|
|
2563
2943
|
}
|
|
2564
2944
|
async function runCodegraphServeCli() {
|
|
2565
2945
|
process.exitCode = await runCodegraphServe();
|
|
2566
2946
|
}
|
|
2567
|
-
async function runChildProcess(command, args, options) {
|
|
2568
|
-
const invocation = resolveServeProcessInvocation(command, args);
|
|
2569
|
-
const child = spawn2(invocation.command, invocation.args, { env: options.env, stdio: options.stdio });
|
|
2570
|
-
return new Promise((resolve4, reject) => {
|
|
2571
|
-
child.once("error", reject);
|
|
2572
|
-
child.once("exit", (code, signal) => {
|
|
2573
|
-
if (code !== null) {
|
|
2574
|
-
resolve4(code);
|
|
2575
|
-
return;
|
|
2576
|
-
}
|
|
2577
|
-
resolve4(signal === null ? 0 : 1);
|
|
2578
|
-
});
|
|
2579
|
-
});
|
|
2580
|
-
}
|
|
2581
|
-
function resolveServeProcessInvocation(command, args, platform = process.platform) {
|
|
2582
|
-
if (platform !== "win32")
|
|
2583
|
-
return { args: [...args], command };
|
|
2584
|
-
const extension = extname2(command).toLowerCase();
|
|
2585
|
-
if (WINDOWS_NODE_SCRIPT_EXTENSIONS.has(extension)) {
|
|
2586
|
-
return { args: [command, ...args], command: processExecPath };
|
|
2587
|
-
}
|
|
2588
|
-
if (WINDOWS_CMD_EXTENSIONS2.has(extension)) {
|
|
2589
|
-
return { args: ["/d", "/s", "/c", command, ...args], command: "cmd.exe" };
|
|
2590
|
-
}
|
|
2591
|
-
return { args: [...args], command };
|
|
2592
|
-
}
|
|
2593
2947
|
if (isDirectInvocation(process.argv[1])) {
|
|
2594
2948
|
runCodegraphServeCli().catch((error) => {
|
|
2595
2949
|
processStderr2.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}
|