oh-my-opencode 5.0.0-beta.33 → 5.0.0-beta.35

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 (221) hide show
  1. package/.agents/skills/codex-qa/scripts/lsp-e2e.sh +1 -3
  2. package/.agents/skills/opencode-qa/scripts/lsp-e2e.sh +1 -1
  3. package/.agents/skills/tech-debt-audit/SKILL.md +6 -76
  4. package/README.ja.md +1 -1
  5. package/README.ko.md +1 -1
  6. package/README.md +1 -1
  7. package/README.ru.md +1 -1
  8. package/README.zh-cn.md +1 -1
  9. package/THIRD-PARTY-NOTICES.md +27 -99
  10. package/dist/cli/index.js +48350 -48559
  11. package/dist/cli-node/index.js +48480 -48689
  12. package/dist/config/index.d.ts +1 -1
  13. package/dist/config/schema/hooks.d.ts +0 -1
  14. package/dist/config/schema/oh-my-opencode-config.d.ts +0 -10
  15. package/dist/config/schema.d.ts +0 -1
  16. package/dist/create-hooks.d.ts +0 -1
  17. package/dist/hooks/index.d.ts +0 -1
  18. package/dist/index.js +11675 -13742
  19. package/dist/mcp/index.d.ts +0 -4
  20. package/dist/mcp/types.d.ts +0 -1
  21. package/dist/oh-my-opencode.schema.json +1 -45
  22. package/dist/plugin/hooks/create-core-hooks.d.ts +0 -1
  23. package/dist/plugin/hooks/create-session-hooks.d.ts +1 -2
  24. package/dist/shared/omo-process-sweep.d.ts +2 -4
  25. package/dist/skills/init-deep/SKILL.md +13 -13
  26. package/dist/skills/ulw-plan/SKILL.md +0 -1
  27. package/dist/tui.js +44809 -44910
  28. package/package.json +16 -18
  29. package/packages/omo-codex/THIRD-PARTY-NOTICES.md +0 -17
  30. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -3
  31. package/packages/omo-codex/plugin/.mcp.json +0 -6
  32. package/packages/omo-codex/plugin/AGENTS.md +5 -5
  33. package/packages/omo-codex/plugin/README.md +1 -1
  34. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +1 -15
  35. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  36. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  37. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  38. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  39. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  40. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  41. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  42. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  43. package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +1 -1
  44. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  45. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  46. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  47. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  48. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  49. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  50. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  51. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +1 -1
  52. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  53. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  54. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +2 -2
  55. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  56. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  57. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +0 -1
  58. package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +1 -1
  59. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +2 -2
  60. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  61. package/packages/omo-codex/plugin/components/ulw-loop/README.md +11 -1
  62. package/packages/omo-codex/plugin/components/ulw-loop/directive.md +2 -2
  63. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.d.ts +12 -0
  64. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.js +45 -0
  65. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +1 -0
  66. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +5 -0
  67. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +10 -3
  68. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +35 -38
  69. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +278 -193
  70. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.d.ts +5 -0
  71. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.js +7 -51
  72. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.js +39 -22
  73. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +13 -1
  74. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +64 -8
  75. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +5 -1
  76. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +37 -18
  77. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
  78. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  79. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +2 -1
  80. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-codex-validation.ts +81 -0
  81. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +6 -0
  82. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +10 -3
  83. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +32 -63
  84. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-aggregate.ts +7 -53
  85. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-artifacts.ts +50 -31
  86. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +67 -14
  87. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +6 -1
  88. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +36 -17
  89. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +26 -0
  90. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +47 -2
  91. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate-basics.test.ts +258 -0
  92. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-cap-and-dedupe.test.ts +22 -0
  93. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-poisoning-cascades.test.ts +97 -0
  94. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-single-report.test.ts +241 -0
  95. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  96. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  97. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  98. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  99. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  100. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  101. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  102. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  103. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  104. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  105. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  106. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  107. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  108. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  109. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  110. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  111. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-ulw-execute-continuation.json +1 -1
  112. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  113. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  114. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  115. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  116. package/packages/omo-codex/plugin/package-lock.json +12 -146
  117. package/packages/omo-codex/plugin/package.json +1 -2
  118. package/packages/omo-codex/plugin/scripts/AGENTS.md +0 -1
  119. package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +0 -1
  120. package/packages/omo-codex/plugin/scripts/auto-update.mjs +0 -9
  121. package/packages/omo-codex/plugin/scripts/canonical-ultrawork-directive.mjs +17 -0
  122. package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +0 -1
  123. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +2 -8
  124. package/packages/omo-codex/plugin/shared/src/config-loader.ts +2 -102
  125. package/packages/omo-codex/plugin/shared/src/config-migration.ts +0 -1
  126. package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +41 -130
  127. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +13 -13
  128. package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +1 -1
  129. package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +2 -2
  130. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +2 -1
  131. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +0 -1
  132. package/packages/omo-codex/plugin/test/AGENTS.md +2 -2
  133. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +2 -21
  134. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -2
  135. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +2 -7
  136. package/packages/omo-codex/plugin/test/auto-update.test.mjs +0 -25
  137. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +0 -31
  138. package/packages/omo-codex/plugin/test/canonical-ultrawork-directive.test.mjs +53 -0
  139. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +0 -50
  140. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +0 -1
  141. package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -3
  142. package/packages/omo-codex/scripts/install-cache-copy.test.mjs +27 -1
  143. package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +0 -23
  144. package/packages/omo-codex/scripts/install-dist/install-local.mjs +238 -431
  145. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +1 -25
  146. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +0 -36
  147. package/packages/shared-skills/skills/init-deep/SKILL.md +13 -13
  148. package/packages/shared-skills/skills/ulw-plan/SKILL.md +0 -1
  149. package/dist/config/schema/codegraph.d.ts +0 -12
  150. package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +0 -17
  151. package/dist/hooks/codegraph-bootstrap/hook.d.ts +0 -35
  152. package/dist/hooks/codegraph-bootstrap/index.d.ts +0 -1
  153. package/dist/hooks/codegraph-bootstrap/project-root.d.ts +0 -1
  154. package/dist/hooks/codegraph-bootstrap/status.d.ts +0 -11
  155. package/dist/mcp/codegraph.d.ts +0 -16
  156. package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +0 -58
  157. package/packages/omo-codex/plugin/components/codegraph/LICENSE +0 -21
  158. package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +0 -2951
  159. package/packages/omo-codex/plugin/components/codegraph/NOTICE +0 -16
  160. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +0 -12326
  161. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +0 -9908
  162. package/packages/omo-codex/plugin/components/codegraph/package.json +0 -33
  163. package/packages/omo-codex/plugin/components/codegraph/src/cache-gc.ts +0 -29
  164. package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +0 -79
  165. package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +0 -33
  166. package/packages/omo-codex/plugin/components/codegraph/src/hook-sweep.ts +0 -25
  167. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +0 -131
  168. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +0 -258
  169. package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +0 -310
  170. package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +0 -92
  171. package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +0 -34
  172. package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +0 -29
  173. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +0 -263
  174. package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +0 -106
  175. package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +0 -145
  176. package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +0 -22
  177. package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +0 -139
  178. package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +0 -15
  179. package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +0 -32
  180. package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +0 -109
  181. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +0 -148
  182. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +0 -175
  183. package/packages/omo-codex/plugin/components/codegraph/src/sweep-cli.ts +0 -81
  184. package/packages/omo-codex/plugin/components/codegraph/test/cache-gc.test.ts +0 -34
  185. package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +0 -112
  186. package/packages/omo-codex/plugin/components/codegraph/test/hook-registration.test.ts +0 -26
  187. package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +0 -160
  188. package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +0 -50
  189. package/packages/omo-codex/plugin/components/codegraph/test/hook-sweep.test.ts +0 -29
  190. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +0 -320
  191. package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +0 -172
  192. package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +0 -91
  193. package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +0 -100
  194. package/packages/omo-codex/plugin/components/codegraph/test/serve-built-wrapper.test.ts +0 -76
  195. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +0 -133
  196. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +0 -245
  197. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +0 -69
  198. package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +0 -43
  199. package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +0 -147
  200. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable-idle.test.ts +0 -47
  201. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +0 -175
  202. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +0 -385
  203. package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +0 -206
  204. package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +0 -58
  205. package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +0 -104
  206. package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +0 -65
  207. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +0 -106
  208. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +0 -116
  209. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +0 -258
  210. package/packages/omo-codex/plugin/components/codegraph/test/sweep-cli.test.ts +0 -56
  211. package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +0 -13
  212. package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +0 -25
  213. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate.test.ts +0 -101
  214. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +0 -18
  215. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +0 -17
  216. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +0 -125
  217. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +0 -43
  218. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +0 -29
  219. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +0 -121
  220. package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +0 -76
  221. package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +0 -179
@@ -1,147 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { join } from "node:path";
5
-
6
- import { runCodegraphServe } from "../src/serve.ts";
7
-
8
- describe("runCodegraphServe provisioning", () => {
9
- it("#given CodeGraph is unresolved and daemon is omitted #when serving MCP #then provisions CodeGraph with daemon-on", async () => {
10
- // given
11
- const binPath = join("/tmp/home/.omo/codegraph", "bin", "codegraph");
12
- const calls: Array<{
13
- readonly args: readonly string[];
14
- readonly command: string;
15
- readonly env: Record<string, string | undefined>;
16
- }> = [];
17
- const stderr: string[] = [];
18
-
19
- // when
20
- const exitCode = await runCodegraphServe({
21
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
22
- env: { PATH: "/bin" },
23
- homeDir: "/tmp/home",
24
- nodeVersion: "22.14.0",
25
- resolve: () => ({ argsPrefix: [], command: "codegraph", exists: false, source: "path" }),
26
- ensureProvisioned: (options) =>
27
- Promise.resolve({
28
- binPath: join(options.installDir ?? "/tmp/home/.omo/codegraph", "bin", "codegraph"),
29
- provisioned: true,
30
- }),
31
- runProcess: (command, args, options) => {
32
- calls.push({ args, command, env: options.env });
33
- return Promise.resolve(0);
34
- },
35
- stderr: { write: (chunk: string) => stderr.push(chunk) },
36
- });
37
-
38
- // then
39
- expect(exitCode).toBe(0);
40
- expect(stderr).toEqual([]);
41
- expect(calls).toEqual([
42
- {
43
- args: ["serve", "--mcp"],
44
- command: binPath,
45
- env: {
46
- CODEGRAPH_INSTALL_DIR: join("/tmp/home", ".omo", "codegraph"),
47
- CODEGRAPH_NO_DOWNLOAD: "1",
48
- CODEGRAPH_TELEMETRY: "0",
49
- DO_NOT_TRACK: "1",
50
- PATH: "/bin",
51
- },
52
- },
53
- ]);
54
- });
55
-
56
- it("#given a bundled runtime and a stale managed install #when serving MCP #then it upgrades and uses the managed runtime", async () => {
57
- // given
58
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-serve-managed-upgrade-"));
59
- const installDir = join(homeDir, ".omo", "codegraph");
60
- const binPath = join(installDir, "bin", "codegraph");
61
- mkdirSync(join(installDir, "bin"), { recursive: true });
62
- mkdirSync(join(installDir, ".provisioned"), { recursive: true });
63
- writeFileSync(binPath, "stale codegraph\n");
64
- writeFileSync(
65
- join(installDir, ".provisioned", "codegraph-1.4.1.json"),
66
- `${JSON.stringify({ binPath, version: "1.4.1" })}\n`,
67
- );
68
- const provisionCalls: unknown[] = [];
69
- const processCalls: Array<{ readonly args: readonly string[]; readonly command: string }> = [];
70
-
71
- try {
72
- // when
73
- const exitCode = await runCodegraphServe({
74
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
75
- homeDir,
76
- managedInstallExists: () => true,
77
- nodeVersion: "22.14.0",
78
- resolve: () => ({ argsPrefix: ["codegraph.js"], command: "/opt/node22/bin/node", exists: true, source: "bundled" }),
79
- resolveManagedBin: () => null,
80
- ensureProvisioned: (options) => {
81
- provisionCalls.push(options);
82
- return Promise.resolve({ binPath, provisioned: true });
83
- },
84
- runProcess: (command, args) => {
85
- processCalls.push({ args, command });
86
- return Promise.resolve(0);
87
- },
88
- });
89
-
90
- // then
91
- expect(exitCode).toBe(0);
92
- expect(provisionCalls).toEqual([{ installDir, lockDir: join(installDir, ".locks"), version: "1.5.0" }]);
93
- expect(processCalls).toEqual([{ args: ["serve", "--mcp"], command: binPath }]);
94
- } finally {
95
- rmSync(homeDir, { force: true, recursive: true });
96
- }
97
- });
98
-
99
- it("#given CodeGraph is unresolved and codegraph.daemon=false #when serving MCP #then provisions CodeGraph with daemon-off", async () => {
100
- // given
101
- const binPath = join("/tmp/home/.omo/codegraph", "bin", "codegraph");
102
- const calls: Array<{
103
- readonly args: readonly string[];
104
- readonly command: string;
105
- readonly env: Record<string, string | undefined>;
106
- }> = [];
107
- const stderr: string[] = [];
108
-
109
- // when
110
- const exitCode = await runCodegraphServe({
111
- config: { codegraph: { daemon: false, enabled: true }, sources: [], warnings: [] },
112
- env: { PATH: "/bin" },
113
- homeDir: "/tmp/home",
114
- nodeVersion: "22.14.0",
115
- resolve: () => ({ argsPrefix: [], command: "codegraph", exists: false, source: "path" }),
116
- ensureProvisioned: (options) =>
117
- Promise.resolve({
118
- binPath: join(options.installDir ?? "/tmp/home/.omo/codegraph", "bin", "codegraph"),
119
- provisioned: true,
120
- }),
121
- runProcess: (command, args, options) => {
122
- calls.push({ args, command, env: options.env });
123
- return Promise.resolve(0);
124
- },
125
- stderr: { write: (chunk: string) => stderr.push(chunk) },
126
- });
127
-
128
- // then
129
- expect(exitCode).toBe(0);
130
- expect(stderr).toEqual([]);
131
- expect(calls).toEqual([
132
- {
133
- args: ["serve", "--mcp"],
134
- command: binPath,
135
- env: {
136
- CODEGRAPH_INSTALL_DIR: join("/tmp/home", ".omo", "codegraph"),
137
- CODEGRAPH_NO_DAEMON: "1",
138
- CODEGRAPH_NO_DOWNLOAD: "1",
139
- CODEGRAPH_TELEMETRY: "0",
140
- DO_NOT_TRACK: "1",
141
- PATH: "/bin",
142
- },
143
- },
144
- ]);
145
- expect(calls[0]?.env["CODEGRAPH_NO_DAEMON"]).toBe("1");
146
- });
147
- });
@@ -1,47 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { PassThrough } from "node:stream";
3
-
4
- import { runUnavailableCodegraphMcpServer } from "../src/mcp-unavailable.ts";
5
-
6
- describe("unavailable codegraph MCP idle teardown", () => {
7
- it("#given the codex host (no respawn for exited stdio servers) #when the unavailable stub starts #then the idle timeout is disabled", async () => {
8
- // given — codex never respawns a user-configured stdio MCP server
9
- // (codex-rs reconnects only its own codex_apps server), so if the stub
10
- // inherited the mcp-stdio-core default idle timeout it would destroy its
11
- // own stdin after 10 idle minutes and every later codegraph tool call in
12
- // a long-lived session would fail on a dead connection instead of
13
- // answering with the skip reason.
14
- const stdin = new PassThrough();
15
- const stdout = new PassThrough();
16
- stdout.resume();
17
- const lifecycle: Array<{ readonly event: string; readonly data?: unknown }> = [];
18
-
19
- try {
20
- // when
21
- const served = runUnavailableCodegraphMcpServer({
22
- input: stdin,
23
- output: stdout,
24
- reason: "CodeGraph MCP skipped: test reason",
25
- serverVersion: "0.0.0-test",
26
- lifecycleLog: (event, data) => {
27
- lifecycle.push({ event, data });
28
- },
29
- });
30
- const outcome = await Promise.race([
31
- served.then(() => "settled" as const),
32
- Bun.sleep(500).then(() => "parked" as const),
33
- ]);
34
-
35
- // then — the server must park on the held-open pipe (no idle timer
36
- // tore it down) and must have started with the timeout disabled.
37
- expect(outcome).toBe("parked");
38
- expect(lifecycle).toContainEqual({
39
- event: "stdio_started",
40
- data: expect.objectContaining({ idle_timeout_ms: 0 }),
41
- });
42
- } finally {
43
- stdin.destroy();
44
- stdout.destroy();
45
- }
46
- });
47
- });
@@ -1,175 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { join } from "node:path";
5
- import { PassThrough } from "node:stream";
6
-
7
- import { runCodegraphServe } from "../src/serve.ts";
8
-
9
- describe("runCodegraphServe unavailable CodeGraph paths", () => {
10
- it("#given CodeGraph is unresolved #when serving MCP #then exposes an empty facade with a skip hint", async () => {
11
- // given
12
- const stderr: string[] = [];
13
- const spawned: string[] = [];
14
-
15
- // when
16
- const exitCode = await runCodegraphServe({
17
- ...closedMcpStdio(),
18
- config: { codegraph: { auto_provision: false, enabled: true }, sources: [], warnings: [] },
19
- env: { PATH: "/bin" },
20
- nodeVersion: "22.14.0",
21
- buildEnv: () => ({}),
22
- resolve: () => ({ argsPrefix: [], command: "codegraph", exists: false, source: "path" }),
23
- runProcess: (command: string) => {
24
- spawned.push(command);
25
- return Promise.resolve(0);
26
- },
27
- stderr: { write: (chunk: string) => stderr.push(chunk) },
28
- });
29
-
30
- // then
31
- expect(exitCode).toBe(0);
32
- expect(spawned).toEqual([]);
33
- expect(stderr).toEqual([
34
- "CodeGraph MCP skipped: codegraph binary not found. Install CodeGraph or set OMO_CODEGRAPH_BIN.\n",
35
- ]);
36
- });
37
-
38
- it("#given an unsupported local Node #when serving MCP #then exposes an empty facade without spawning codegraph", async () => {
39
- // given
40
- const stderr: string[] = [];
41
- const spawned: string[] = [];
42
-
43
- // when
44
- const exitCode = await runCodegraphServe({
45
- ...closedMcpStdio(),
46
- env: {},
47
- nodeVersion: "26.3.0",
48
- buildEnv: () => ({}),
49
- resolve: () => ({ argsPrefix: [], command: "codegraph", exists: true, source: "path" }),
50
- runProcess: (command: string) => {
51
- spawned.push(command);
52
- return Promise.resolve(0);
53
- },
54
- stderr: { write: (chunk: string) => stderr.push(chunk) },
55
- });
56
-
57
- // then
58
- expect(exitCode).toBe(0);
59
- expect(spawned).toEqual([]);
60
- expect(stderr).toHaveLength(1);
61
- expect(stderr[0]).toContain("CodeGraph MCP skipped");
62
- expect(stderr[0]).toContain("CODEGRAPH_ALLOW_UNSAFE_NODE");
63
- });
64
-
65
- it("#given OMO_CODEGRAPH_BIN points at a missing path #when serving MCP #then exposes an empty facade before spawn", async () => {
66
- // given
67
- const stderr: string[] = [];
68
- const spawned: string[] = [];
69
-
70
- // when
71
- const exitCode = await runCodegraphServe({
72
- ...closedMcpStdio(),
73
- buildEnv: () => ({}),
74
- commandExists: () => false,
75
- resolve: () => ({ argsPrefix: [], command: "/nonexistent", exists: true, source: "env" }),
76
- runProcess: (command: string) => {
77
- spawned.push(command);
78
- return Promise.resolve(0);
79
- },
80
- stderr: { write: (chunk: string) => stderr.push(chunk) },
81
- });
82
-
83
- // then
84
- expect(exitCode).toBe(0);
85
- expect(spawned).toEqual([]);
86
- expect(stderr).toEqual([
87
- "CodeGraph MCP skipped: codegraph binary not found. Install CodeGraph or set OMO_CODEGRAPH_BIN.\n",
88
- ]);
89
- });
90
-
91
- it("#given Codex SOT disables CodeGraph #when serving MCP #then exposes an empty facade with a disabled hint", async () => {
92
- // given
93
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-serve-disabled-home-"));
94
- const workspace = mkdtempSync(join(tmpdir(), "omo-codegraph-serve-disabled-workspace-"));
95
- const stderr: string[] = [];
96
- const spawned: string[] = [];
97
- try {
98
- mkdirSync(join(homeDir, ".omo"), { recursive: true });
99
- mkdirSync(join(workspace, ".omo"), { recursive: true });
100
- writeFileSync(join(homeDir, ".omo", "omo.jsonc"), '{ "codegraph": { "enabled": true } }\n');
101
- writeFileSync(join(workspace, ".omo", "omo.jsonc"), '{ "[codex]": { "codegraph": { "enabled": false } } }\n');
102
-
103
- // when
104
- const exitCode = await runCodegraphServe({
105
- ...closedMcpStdio(),
106
- cwd: workspace,
107
- env: { HOME: homeDir },
108
- runProcess: (command: string) => {
109
- spawned.push(command);
110
- return Promise.resolve(0);
111
- },
112
- stderr: { write: (chunk: string) => stderr.push(chunk) },
113
- });
114
-
115
- // then
116
- expect(exitCode).toBe(0);
117
- expect(spawned).toEqual([]);
118
- expect(stderr).toEqual([
119
- "CodeGraph MCP skipped: disabled by OMO SOT config. Set [codex].codegraph.enabled=true to enable it.\n",
120
- ]);
121
- } finally {
122
- rmSync(homeDir, { recursive: true, force: true });
123
- rmSync(workspace, { recursive: true, force: true });
124
- }
125
- });
126
-
127
- it("#given the unavailable facade with held-open stdio and a dead parent #when the watchdog polls #then the placeholder server settles without waiting for stdin EOF", async () => {
128
- // given
129
- // win32: the real-timer watchdog + PassThrough.destroy() teardown race leaves
130
- // the read loop's async iterator pending on Windows, so this held-open-stdin
131
- // case cannot settle under bun:test (which has no fake timers). The watchdog
132
- // settle path IS covered deterministically by mcp-stdio-core's fake-timer test
133
- // (passes on win32) and by real-process QA (task-13-*); production settles via
134
- // stdin EOF, exercised by the other tests in this file that run on win32.
135
- if (process.platform === "win32") return;
136
- // Client stdio is held open and never sees EOF, so the parent-liveness
137
- // watchdog is the only settle path for the placeholder server.
138
- const stdin = new PassThrough();
139
- const stdout = new PassThrough();
140
- stdout.resume();
141
- const stderr: string[] = [];
142
-
143
- try {
144
- // when
145
- const exitCode = await runCodegraphServe({
146
- config: { codegraph: { enabled: false }, sources: [], warnings: [] },
147
- env: {},
148
- stdin,
149
- stdout,
150
- stderr: { write: (chunk: string) => stderr.push(chunk) },
151
- parentWatchdog: { pollIntervalMs: 10, probeAlive: () => false },
152
- });
153
-
154
- // then
155
- expect(exitCode).toBe(0);
156
- expect(stderr).toEqual([
157
- "CodeGraph MCP skipped: disabled by OMO SOT config. Set [codex].codegraph.enabled=true to enable it.\n",
158
- ]);
159
- } finally {
160
- // The held-open streams are never ended by the test; destroy them so the
161
- // bun test runner's event loop can drain and exit (an undestroyed
162
- // PassThrough keeps the process alive on win32 and hangs the suite).
163
- stdin.destroy();
164
- stdout.destroy();
165
- }
166
- });
167
- });
168
-
169
- function closedMcpStdio(): { readonly stdin: PassThrough; readonly stdout: PassThrough } {
170
- const stdin = new PassThrough();
171
- const stdout = new PassThrough();
172
- stdout.resume();
173
- stdin.end();
174
- return { stdin, stdout };
175
- }