oh-my-opencode 4.13.0 → 4.14.0

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.
Files changed (445) hide show
  1. package/.agents/skills/codex-qa/SKILL.md +15 -0
  2. package/.agents/skills/codex-qa/references/logging-debug.md +12 -0
  3. package/.agents/skills/opencode-qa/SKILL.md +17 -0
  4. package/.agents/skills/opencode-qa/references/tui-tmux.md +17 -0
  5. package/.agents/skills/work-with-pr/SKILL.md +18 -10
  6. package/.opencode/skills/work-with-pr/SKILL.md +18 -10
  7. package/README.md +2 -2
  8. package/dist/cli/doctor/checks/telemetry.d.ts +2 -0
  9. package/dist/cli/doctor/framework/constants.d.ts +1 -0
  10. package/dist/cli/doctor/framework/doctor-target.d.ts +1 -1
  11. package/dist/cli/index.js +24651 -16452
  12. package/dist/cli-node/index.js +24651 -16452
  13. package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
  14. package/dist/features/team-mode/test-support/async-test-helpers.d.ts +19 -0
  15. package/dist/hooks/atlas/final-wave-approval-gate.d.ts +1 -0
  16. package/dist/hooks/atlas/subagent-completion-reminder.d.ts +30 -0
  17. package/dist/hooks/atlas/types.d.ts +2 -0
  18. package/dist/hooks/atlas/verification-reminders.d.ts +3 -0
  19. package/dist/hooks/team-session-events/team-idle-wake-hint.d.ts +1 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +33232 -19559
  22. package/dist/mcp/context7.d.ts +9 -8
  23. package/dist/oh-my-opencode.schema.json +4 -0
  24. package/dist/shared/posthog.d.ts +17 -10
  25. package/dist/shared/telemetry-product-identity.d.ts +2 -0
  26. package/dist/skills/coding-agent-sessions/SKILL.md +128 -0
  27. package/dist/skills/coding-agent-sessions/agents/openai.yaml +4 -0
  28. package/dist/skills/coding-agent-sessions/references/all-platforms.md +71 -0
  29. package/dist/skills/coding-agent-sessions/references/claude.md +32 -0
  30. package/dist/skills/coding-agent-sessions/references/codex.md +30 -0
  31. package/dist/skills/coding-agent-sessions/references/opencode.md +43 -0
  32. package/dist/skills/coding-agent-sessions/references/senpi.md +17 -0
  33. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
  34. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
  35. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
  36. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
  37. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
  38. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
  39. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
  40. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
  41. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
  42. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
  43. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
  44. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
  45. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
  46. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
  47. package/dist/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
  48. package/dist/skills/frontend/ATTRIBUTION.md +52 -8
  49. package/dist/skills/frontend/SKILL.md +29 -8
  50. package/dist/skills/frontend/references/design/README.md +29 -12
  51. package/dist/skills/frontend/references/design/_INDEX.md +3 -3
  52. package/dist/skills/frontend/references/design/design-system-architecture.md +22 -19
  53. package/dist/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
  54. package/dist/skills/frontend/references/designpowers/README.md +48 -0
  55. package/dist/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
  56. package/dist/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
  57. package/dist/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
  58. package/dist/skills/frontend/references/designpowers/lane-c-review.md +65 -0
  59. package/dist/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
  60. package/dist/skills/frontend/references/designpowers/orchestration.md +80 -0
  61. package/dist/skills/frontend/references/designpowers/routing.md +79 -0
  62. package/dist/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
  63. package/dist/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
  64. package/dist/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
  65. package/dist/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
  66. package/dist/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
  67. package/dist/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
  68. package/dist/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
  69. package/dist/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
  70. package/dist/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
  71. package/dist/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
  72. package/dist/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
  73. package/dist/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
  74. package/dist/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
  75. package/dist/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
  76. package/dist/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
  77. package/dist/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
  78. package/dist/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
  79. package/dist/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
  80. package/dist/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
  81. package/dist/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
  82. package/dist/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
  83. package/dist/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
  84. package/dist/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
  85. package/dist/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
  86. package/dist/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
  87. package/dist/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
  88. package/dist/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
  89. package/dist/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
  90. package/dist/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
  91. package/dist/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
  92. package/dist/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
  93. package/dist/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
  94. package/dist/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
  95. package/dist/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
  96. package/dist/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
  97. package/dist/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
  98. package/dist/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
  99. package/dist/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
  100. package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
  101. package/dist/skills/git-master/SKILL.md +4 -0
  102. package/dist/skills/review-work/SKILL.md +3 -3
  103. package/dist/skills/start-work/SKILL.md +7 -5
  104. package/dist/skills/ultraresearch/SKILL.md +4 -252
  105. package/dist/skills/ulw-plan/SKILL.md +8 -6
  106. package/dist/skills/ulw-plan/references/full-workflow.md +11 -6
  107. package/dist/skills/ulw-plan/references/intent-clear.md +3 -3
  108. package/dist/skills/ulw-plan/references/intent-unclear.md +1 -1
  109. package/dist/skills/{ultraresearch → ulw-research}/ATTRIBUTION.md +1 -1
  110. package/dist/skills/ulw-research/SKILL.md +260 -0
  111. package/dist/skills/visual-qa/SKILL.md +105 -14
  112. package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +120 -1
  113. package/dist/testing/create-plugin-module.d.ts +2 -0
  114. package/dist/tui.js +23917 -16117
  115. package/docs/reference/github-attachment-upload.md +51 -0
  116. package/docs/reference/web-terminal-visual-qa.md +81 -0
  117. package/package.json +20 -14
  118. package/packages/lsp-core/src/lsp/process.ts +4 -1
  119. package/packages/lsp-core/src/mcp.ts +1 -0
  120. package/packages/lsp-daemon/dist/cli.js +5 -1
  121. package/packages/lsp-daemon/dist/index.js +5 -1
  122. package/packages/lsp-daemon/dist/proxy.js +1 -0
  123. package/packages/lsp-tools-mcp/dist/cli.js +5 -1
  124. package/packages/lsp-tools-mcp/dist/lsp/manager.js +4 -1
  125. package/packages/lsp-tools-mcp/dist/mcp.js +5 -1
  126. package/packages/lsp-tools-mcp/dist/tools.js +4 -1
  127. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  128. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +323 -62
  129. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  130. package/packages/omo-codex/plugin/components/bootstrap/scripts/bootstrap.ps1 +37 -68
  131. package/packages/omo-codex/plugin/components/bootstrap/scripts/node-dispatch.ps1 +75 -0
  132. package/packages/omo-codex/plugin/components/bootstrap/src/cli.ts +1 -1
  133. package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +2 -18
  134. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +575 -334
  135. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +204 -39
  136. package/packages/omo-codex/plugin/components/codegraph/package.json +2 -2
  137. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +7 -1
  138. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +103 -3
  139. package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +114 -0
  140. package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +29 -0
  141. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +31 -57
  142. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +7 -4
  143. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +43 -9
  144. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +146 -0
  145. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +12 -7
  146. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +71 -1
  147. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  148. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  149. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  150. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +4 -1
  151. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  152. package/packages/omo-codex/plugin/components/rules/dist/cli.js +2 -2
  153. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  154. package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +2 -2
  155. package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +11 -2
  156. package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +6 -6
  157. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
  158. package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +23 -0
  159. package/packages/omo-codex/plugin/components/teammode/dist/cli.js +22 -4
  160. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  161. package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +40 -2
  162. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +32 -5
  163. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +7 -3
  164. package/packages/omo-codex/plugin/components/teammode/src/codex-hook.ts +19 -4
  165. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +32 -2
  166. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  167. package/packages/omo-codex/plugin/components/ultrawork/README.md +1 -1
  168. package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
  169. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +2 -2
  170. package/packages/omo-codex/plugin/components/ultrawork/directive.md +23 -7
  171. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +1 -1
  172. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  173. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +6 -4
  174. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +11 -6
  175. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +3 -3
  176. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +1 -1
  177. package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +1 -1
  178. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +24 -0
  179. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +6 -1
  180. package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +1 -1
  181. package/packages/omo-codex/plugin/components/ulw-loop/README.md +25 -21
  182. package/packages/omo-codex/plugin/components/ulw-loop/biome.json +1 -1
  183. package/packages/omo-codex/plugin/components/ulw-loop/directive.md +381 -0
  184. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +14 -1
  185. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +145 -14
  186. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +6 -3
  187. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +16 -6
  188. package/packages/omo-codex/plugin/components/ulw-loop/dist/ultrawork-directive.d.ts +5 -0
  189. package/packages/omo-codex/plugin/components/ulw-loop/dist/ultrawork-directive.js +104 -0
  190. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +1 -1
  191. package/packages/omo-codex/plugin/components/ulw-loop/package.json +2 -1
  192. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +19 -11
  193. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-steering.ts +14 -1
  194. package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +4 -2
  195. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +28 -6
  196. package/packages/omo-codex/plugin/components/ulw-loop/src/ultrawork-directive.ts +113 -0
  197. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +33 -2
  198. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-steering-kind-guidance.test.ts +31 -0
  199. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +13 -0
  200. package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +36 -0
  201. package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +12 -0
  202. package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +64 -0
  203. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +2 -1
  204. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +2 -1
  205. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +2 -1
  206. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +2 -1
  207. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +2 -1
  208. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +2 -1
  209. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +2 -1
  210. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +2 -1
  211. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +2 -1
  212. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +2 -1
  213. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +2 -1
  214. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +2 -1
  215. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +2 -1
  216. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +2 -1
  217. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +2 -1
  218. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +2 -1
  219. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +2 -1
  220. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +2 -1
  221. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +2 -1
  222. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +2 -1
  223. package/packages/omo-codex/plugin/package-lock.json +13 -13
  224. package/packages/omo-codex/plugin/package.json +1 -1
  225. package/packages/omo-codex/plugin/scripts/auto-update.mjs +9 -5
  226. package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +1 -0
  227. package/packages/omo-codex/plugin/scripts/migrate-codex-config/context7-placeholder-guard.mjs +131 -0
  228. package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-mode-guard.mjs +60 -0
  229. package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +3 -10
  230. package/packages/omo-codex/plugin/scripts/migrate-codex-config/root-settings.mjs +31 -1
  231. package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +73 -0
  232. package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +20 -3
  233. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +30 -8
  234. package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +128 -0
  235. package/packages/omo-codex/plugin/skills/coding-agent-sessions/agents/openai.yaml +4 -0
  236. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +71 -0
  237. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/claude.md +32 -0
  238. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/codex.md +30 -0
  239. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/opencode.md +43 -0
  240. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +17 -0
  241. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
  242. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
  243. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
  244. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
  245. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
  246. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
  247. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
  248. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
  249. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
  250. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
  251. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
  252. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
  253. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
  254. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
  255. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
  256. package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +52 -8
  257. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +29 -8
  258. package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +29 -12
  259. package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +3 -3
  260. package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +22 -19
  261. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
  262. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/README.md +48 -0
  263. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
  264. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
  265. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
  266. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-c-review.md +65 -0
  267. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
  268. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/orchestration.md +80 -0
  269. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/routing.md +79 -0
  270. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
  271. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
  272. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
  273. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
  274. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
  275. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
  276. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
  277. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
  278. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
  279. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
  280. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
  281. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
  282. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
  283. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
  284. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
  285. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
  286. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
  287. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
  288. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
  289. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
  290. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
  291. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
  292. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
  293. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
  294. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
  295. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
  296. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
  297. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
  298. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
  299. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
  300. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
  301. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
  302. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
  303. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
  304. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
  305. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
  306. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
  307. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
  308. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
  309. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +4 -0
  310. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +4 -0
  311. package/packages/omo-codex/plugin/skills/refactor/SKILL.md +4 -0
  312. package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +4 -0
  313. package/packages/omo-codex/plugin/skills/review-work/SKILL.md +12 -4
  314. package/packages/omo-codex/plugin/skills/start-work/SKILL.md +14 -8
  315. package/packages/omo-codex/plugin/skills/teammode/SKILL.md +40 -2
  316. package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +32 -5
  317. package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +7 -3
  318. package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +4 -250
  319. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +19 -11
  320. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +6 -4
  321. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +11 -6
  322. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +3 -3
  323. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +1 -1
  324. package/packages/{shared-skills/skills/ultraresearch → omo-codex/plugin/skills/ulw-research}/ATTRIBUTION.md +1 -1
  325. package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +262 -0
  326. package/packages/omo-codex/plugin/skills/ulw-research/agents/openai.yaml +2 -0
  327. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +109 -14
  328. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +23 -0
  329. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -0
  330. package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +1 -0
  331. package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +24 -1
  332. package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +23 -5
  333. package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +38 -0
  334. package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +25 -0
  335. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +1 -7
  336. package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +206 -6
  337. package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +44 -0
  338. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +50 -1
  339. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +10 -7
  340. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +28 -2
  341. package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +20 -0
  342. package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +117 -0
  343. package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +5 -2
  344. package/packages/omo-codex/plugin/test/ulw-research-skill-contract.test.mjs +285 -0
  345. package/packages/omo-codex/scripts/install-bin-links.test.mjs +6 -1
  346. package/packages/omo-codex/scripts/install-cache-copy.test.mjs +51 -0
  347. package/packages/omo-codex/scripts/install-config.test.mjs +198 -17
  348. package/packages/omo-codex/scripts/install-dist/install-local.mjs +701 -282
  349. package/packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs +24 -15
  350. package/packages/omo-codex/scripts/install-local.test.mjs +5 -1
  351. package/packages/omo-codex/scripts/install-mcp-context7-runtime.test.mjs +84 -0
  352. package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +128 -0
  353. package/packages/shared-skills/skills/coding-agent-sessions/agents/openai.yaml +4 -0
  354. package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +71 -0
  355. package/packages/shared-skills/skills/coding-agent-sessions/references/claude.md +32 -0
  356. package/packages/shared-skills/skills/coding-agent-sessions/references/codex.md +30 -0
  357. package/packages/shared-skills/skills/coding-agent-sessions/references/opencode.md +43 -0
  358. package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +17 -0
  359. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
  360. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
  361. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
  362. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
  363. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
  364. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
  365. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
  366. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
  367. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
  368. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
  369. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
  370. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
  371. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
  372. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
  373. package/packages/shared-skills/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
  374. package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +52 -8
  375. package/packages/shared-skills/skills/frontend/SKILL.md +29 -8
  376. package/packages/shared-skills/skills/frontend/references/design/README.md +29 -12
  377. package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +3 -3
  378. package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +22 -19
  379. package/packages/shared-skills/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
  380. package/packages/shared-skills/skills/frontend/references/designpowers/README.md +48 -0
  381. package/packages/shared-skills/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
  382. package/packages/shared-skills/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
  383. package/packages/shared-skills/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
  384. package/packages/shared-skills/skills/frontend/references/designpowers/lane-c-review.md +65 -0
  385. package/packages/shared-skills/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
  386. package/packages/shared-skills/skills/frontend/references/designpowers/orchestration.md +80 -0
  387. package/packages/shared-skills/skills/frontend/references/designpowers/routing.md +79 -0
  388. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
  389. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
  390. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
  391. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
  392. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
  393. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
  394. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
  395. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
  396. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
  397. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
  398. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
  399. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
  400. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
  401. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
  402. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
  403. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
  404. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
  405. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
  406. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
  407. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
  408. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
  409. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
  410. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
  411. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
  412. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
  413. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
  414. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
  415. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
  416. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
  417. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
  418. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
  419. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
  420. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
  421. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
  422. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
  423. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
  424. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
  425. package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
  426. package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
  427. package/packages/shared-skills/skills/git-master/SKILL.md +4 -0
  428. package/packages/shared-skills/skills/review-work/SKILL.md +3 -3
  429. package/packages/shared-skills/skills/start-work/SKILL.md +7 -5
  430. package/packages/shared-skills/skills/ultraresearch/SKILL.md +4 -252
  431. package/packages/shared-skills/skills/ulw-plan/SKILL.md +8 -6
  432. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +11 -6
  433. package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +3 -3
  434. package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +1 -1
  435. package/packages/{omo-codex/plugin/skills/ultraresearch → shared-skills/skills/ulw-research}/ATTRIBUTION.md +1 -1
  436. package/packages/shared-skills/skills/ulw-research/SKILL.md +260 -0
  437. package/packages/shared-skills/skills/visual-qa/SKILL.md +105 -14
  438. package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +120 -1
  439. package/script/qa/web-terminal-redaction.d.mts +13 -0
  440. package/script/qa/web-terminal-redaction.mjs +43 -0
  441. package/script/qa/web-terminal-renderer.mjs +218 -0
  442. package/script/qa/web-terminal-visual-qa.mjs +264 -0
  443. package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_cookie_domain_filter.py +0 -110
  444. package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_extract_cookies.py +0 -245
  445. 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 homedir2 } from "node:os";
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 join(homeDir, ".omo", "codegraph");
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 ?? homedir());
121
+ const dataRoot = codegraphDataRoot(options.homeDir ?? homedir2());
49
122
  return {
50
- dataDir: join(dataRoot, "projects", workspaceStorageName(resolvedWorkspace)),
123
+ dataDir: join2(dataRoot, "projects", workspaceStorageName(resolvedWorkspace)),
51
124
  dataRoot,
52
- projectLink: join(resolvedWorkspace, ".codegraph")
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 = join(workspace, ".git");
173
+ const gitDir = join2(workspace, ".git");
101
174
  if (!existsSync(gitDir))
102
175
  return false;
103
- const excludePath = join(gitDir, "info", "exclude");
176
+ const excludePath = join2(gitDir, "info", "exclude");
104
177
  try {
105
- mkdirSync(join(gitDir, "info"), { recursive: true });
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 ?? homedir2()
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
- // shared/src/config-loader.ts
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 existsSync3, readFileSync as readFileSync2 } from "node:fs";
212
- import { homedir as homedir3 } from "node:os";
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 existsSync2 } from "node:fs";
1169
- import { dirname, isAbsolute, join as join2, relative, resolve as resolve2 } from "node:path";
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 = join2(currentDir, ".omo", "config.jsonc");
1183
- if (existsSync2(configPath)) {
1488
+ const configPath = join5(currentDir, ".omo", "config.jsonc");
1489
+ if (existsSync3(configPath)) {
1184
1490
  paths.push(configPath);
1185
1491
  }
1186
- const parentDir = dirname(currentDir);
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 = join2(resolve2(options.homeDir), ".omo", "config.jsonc");
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"] ?? homedir3();
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 (!existsSync3(candidate.path)) {
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"] ?? homedir4();
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 existsSync4 } from "node:fs";
1520
- import { homedir as homedir6, hostname } from "node:os";
1521
- import { basename as basename2, join as join4 } from "node:path";
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 join4(installDir, ".provisioned", `codegraph-${version}.json`);
1830
+ return join6(installDir, ".provisioned", `codegraph-${version}.json`);
1571
1831
  }
1572
1832
  function defaultInstallDir() {
1573
- return join4(homedir6(), ".omo", "codegraph");
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 ?? join4(options.lockDir, "codegraph-force-bad-checksum"),
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 (!existsSync4(path))
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" && existsSync4(value) ? value : null;
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(join4(lockPath, ".."), { recursive: true });
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 = join4(extractDir, roots[0] ?? "");
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(join4(installDir, entry), { force: true, recursive: true });
1665
- await rename(join4(bundleDir, entry), join4(installDir, entry));
1924
+ await rm(join6(installDir, entry), { force: true, recursive: true });
1925
+ await rename(join6(bundleDir, entry), join6(installDir, entry));
1666
1926
  }
1667
- const destination = join4(installDir, "bin", executableName);
1668
- if (!existsSync4(destination))
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 = join4(installDir, ".staging", randomUUID());
1676
- const archivePath = join4(stagingDir, basename2(asset.url));
1677
- const extractDir = join4(stagingDir, "extract");
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 ${basename2(asset.url)}: expected ${asset.sha256}, got ${actualChecksum}`);
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 ${basename2(asset.url)}`);
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(join4(installDir, ".provisioned"), { recursive: true });
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(join4(installDir, ".staging"));
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 = join4(options.lockDir, `codegraph-${hostname()}.lock`);
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: { ...process.env, ...options.env }, maxBuffer: 1024 * 1024, timeout: options.timeoutMs, windowsHide: true }, (error, stdout, stderr) => {
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
- if (!WINDOWS_CMD_EXTENSIONS.has(extname(command).toLowerCase()))
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: { ...env, [SESSION_START_CWD_ENV]: projectRoot }
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, extname as extname2, join as join8, resolve as resolve3 } from "node:path";
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,114 @@ 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
+ async function runBridgedCodegraphProcess(command, args, options) {
2593
+ const invocation = resolveServeProcessInvocation(command, args);
2594
+ const child = spawn2(invocation.command, invocation.args, {
2595
+ cwd: options.cwd,
2596
+ env: options.env,
2597
+ stdio: ["pipe", "pipe", "inherit"]
2598
+ });
2599
+ const childInput = child.stdin;
2600
+ const childOutput = child.stdout;
2601
+ if (childInput === null)
2602
+ throw new CodegraphBridgeStdioError("stdin");
2603
+ if (childOutput === null)
2604
+ throw new CodegraphBridgeStdioError("stdout");
2605
+ const responseModes = new Map;
2606
+ let defaultResponseMode = "framed";
2607
+ const childExit = new Promise((resolveExit, reject) => {
2608
+ child.once("error", reject);
2609
+ child.once("exit", (code, signal) => {
2610
+ if (code !== null) {
2611
+ resolveExit(code);
2612
+ return;
2613
+ }
2614
+ resolveExit(signal === null ? 0 : 1);
2615
+ });
2616
+ });
2617
+ const bridgeDone = Promise.all([
2618
+ forwardClientToCodegraph(options.input, childInput, responseModes, (mode) => {
2619
+ defaultResponseMode = mode;
2620
+ }),
2621
+ forwardCodegraphToClient(childOutput, options.output, responseModes, () => defaultResponseMode)
2622
+ ]);
2623
+ const destroyChildPipes = () => {
2624
+ childInput.destroy();
2625
+ childOutput.destroy();
2626
+ };
2627
+ childExit.then(destroyChildPipes, destroyChildPipes);
2628
+ return Promise.race([childExit, bridgeDone.then(() => childExit)]);
2629
+ }
2630
+ async function forwardClientToCodegraph(input, childInput, responseModes, setDefaultResponseMode) {
2631
+ for await (const message of readStdioJsonRpcMessages(input)) {
2632
+ if (message.kind === "parse_error") {
2633
+ continue;
2634
+ }
2635
+ const responseMode = message.responseMode;
2636
+ setDefaultResponseMode(responseMode);
2637
+ const key = responseModeKey(message.payload);
2638
+ if (key !== null)
2639
+ responseModes.set(key, responseMode);
2640
+ await writeLine(childInput, JSON.stringify(message.payload));
2641
+ }
2642
+ childInput.end();
2643
+ }
2644
+ async function forwardCodegraphToClient(childOutput, output, responseModes, defaultResponseMode) {
2645
+ for await (const message of readStdioJsonRpcMessages(childOutput)) {
2646
+ if (message.kind === "parse_error") {
2647
+ writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
2648
+ continue;
2649
+ }
2650
+ const key = responseModeKey(message.payload);
2651
+ const responseMode = key === null ? defaultResponseMode() : responseModes.get(key) ?? defaultResponseMode();
2652
+ if (key !== null)
2653
+ responseModes.delete(key);
2654
+ writeStdioJsonRpcResponse(output, message.payload, responseMode);
2655
+ }
2656
+ }
2657
+ function responseModeKey(payload) {
2658
+ if (!isPlainRecord(payload) || !("id" in payload))
2659
+ return null;
2660
+ const id = jsonRpcId(payload["id"]);
2661
+ return `${typeof id}:${String(id)}`;
2662
+ }
2663
+ async function writeLine(output, line) {
2664
+ if (output.write(`${line}
2665
+ `))
2666
+ return;
2667
+ await new Promise((resolveDrain, reject) => {
2668
+ output.once("drain", resolveDrain);
2669
+ output.once("error", reject);
2670
+ });
2671
+ }
2672
+
2419
2673
  // components/codegraph/src/mcp-unavailable.ts
2420
2674
  async function runUnavailableCodegraphMcpServer(options) {
2421
2675
  await runJsonRpcStdioServer({
@@ -2468,12 +2722,13 @@ var CODEGRAPH_SKIP_HINT = `CodeGraph MCP skipped: codegraph binary not found. In
2468
2722
  var CODEGRAPH_DISABLED_HINT = `CodeGraph MCP skipped: disabled by OMO SOT config. Set [codex].codegraph.enabled=true to enable it.
2469
2723
  `;
2470
2724
  var CODEGRAPH_VERSION2 = "1.0.1";
2471
- var WINDOWS_CMD_EXTENSIONS2 = new Set([".bat", ".cmd"]);
2472
- var WINDOWS_NODE_SCRIPT_EXTENSIONS = new Set([".cjs", ".js", ".mjs"]);
2725
+ var PROJECT_CWD_ENV_KEYS = ["OMO_CODEGRAPH_PROJECT_CWD", SESSION_START_CWD_ENV, "PWD"];
2473
2726
  async function runCodegraphServe(options = {}) {
2474
2727
  const env = options.env ?? processEnv3;
2475
2728
  const homeDir = options.homeDir ?? homedir10();
2476
- const config = options.config ?? getCodexOmoConfig({ cwd: options.cwd ?? processCwd3(), env, homeDir });
2729
+ const wrapperCwd = options.cwd ?? processCwd3();
2730
+ const projectCwd = resolveProjectCwd(env, wrapperCwd);
2731
+ const config = options.config ?? getCodexOmoConfig({ cwd: projectCwd, env, homeDir });
2477
2732
  const codegraphConfig = config.codegraph ?? {};
2478
2733
  if (codegraphConfig.enabled === false) {
2479
2734
  return runUnavailableMcp(CODEGRAPH_DISABLED_HINT, options);
@@ -2482,7 +2737,7 @@ async function runCodegraphServe(options = {}) {
2482
2737
  const resolutionOptions = {
2483
2738
  env,
2484
2739
  homeDir,
2485
- provisioned: () => provisionedBinFromInstallDir2(trustedInstallDir)
2740
+ provisioned: () => provisionedBinFromInstallDir3(trustedInstallDir)
2486
2741
  };
2487
2742
  let resolution = options.resolve?.(resolutionOptions) ?? resolveCodegraphCommand(resolutionOptions);
2488
2743
  const nodeSupport = evaluateCodegraphNodeSupport({ env, nodeVersion: options.nodeVersion });
@@ -2505,15 +2760,16 @@ async function runCodegraphServe(options = {}) {
2505
2760
  if (codegraphCommandRequiresSupportedLocalNode(resolution) && !nodeSupport.supported) {
2506
2761
  return runUnavailableMcp(buildCodegraphNodeSkipHint(nodeSupport), options);
2507
2762
  }
2508
- const runProcess = options.runProcess ?? runChildProcess;
2763
+ const runProcess = options.runProcess ?? runBridgedCodegraphProcess;
2509
2764
  const codegraphEnv = codegraphEnvForConfig2(trustedInstallDir, homeDir, options.buildEnv);
2510
- const mergedEnv = {
2511
- ...env,
2512
- ...codegraphEnv
2513
- };
2765
+ const mergedEnv = buildCodegraphChildEnv({ ambientEnv: env, codegraphEnv, runtimeEnv: env });
2514
2766
  return runProcess(resolution.command, [...resolution.argsPrefix, "serve", "--mcp"], {
2767
+ cwd: projectCwd,
2515
2768
  env: mergedEnv,
2516
- stdio: "inherit"
2769
+ input: options.stdin ?? processStdin2,
2770
+ output: options.stdout ?? processStdout2,
2771
+ stderr: options.stderr ?? processStderr2,
2772
+ stdio: "pipe"
2517
2773
  });
2518
2774
  }
2519
2775
  async function runUnavailableMcp(reason, options) {
@@ -2531,10 +2787,10 @@ async function provisionMissingCodegraph(options) {
2531
2787
  return null;
2532
2788
  if (options.config.auto_provision === false)
2533
2789
  return null;
2534
- const installDir = options.trustedInstallDir ?? join8(options.homeDir, ".omo", "codegraph");
2790
+ const installDir = options.trustedInstallDir ?? join9(options.homeDir, ".omo", "codegraph");
2535
2791
  const result = await options.ensureProvisioned({
2536
2792
  installDir,
2537
- lockDir: join8(installDir, ".locks"),
2793
+ lockDir: join9(installDir, ".locks"),
2538
2794
  version: CODEGRAPH_VERSION2
2539
2795
  });
2540
2796
  if (!result.provisioned || result.binPath === undefined)
@@ -2555,41 +2811,26 @@ function codegraphEnvForConfig2(trustedInstallDir, homeDir, buildEnv) {
2555
2811
  const env = buildEnv?.({ homeDir }) ?? buildCodegraphEnv({ homeDir });
2556
2812
  return trustedInstallDir === undefined ? env : { ...env, CODEGRAPH_INSTALL_DIR: trustedInstallDir };
2557
2813
  }
2558
- function provisionedBinFromInstallDir2(installDir) {
2814
+ function resolveProjectCwd(env, fallback) {
2815
+ for (const key of PROJECT_CWD_ENV_KEYS) {
2816
+ const candidate = env[key]?.trim();
2817
+ if (candidate === undefined || candidate.length === 0)
2818
+ continue;
2819
+ const resolved = resolve3(candidate);
2820
+ if (existsSync7(resolved))
2821
+ return resolved;
2822
+ }
2823
+ return resolve3(fallback);
2824
+ }
2825
+ function provisionedBinFromInstallDir3(installDir) {
2559
2826
  if (installDir === undefined)
2560
2827
  return null;
2561
- const candidate = join8(installDir, "bin", process.platform === "win32" ? "codegraph.cmd" : "codegraph");
2828
+ const candidate = join9(installDir, "bin", process.platform === "win32" ? "codegraph.cmd" : "codegraph");
2562
2829
  return existsSync7(candidate) ? candidate : null;
2563
2830
  }
2564
2831
  async function runCodegraphServeCli() {
2565
2832
  process.exitCode = await runCodegraphServe();
2566
2833
  }
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
2834
  if (isDirectInvocation(process.argv[1])) {
2594
2835
  runCodegraphServeCli().catch((error) => {
2595
2836
  processStderr2.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}