oh-my-opencode 5.0.0-beta.34 → 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 (217) 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 +48342 -48539
  11. package/dist/cli-node/index.js +49017 -49214
  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 -13715
  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 -44883
  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/hook-status-message.mjs +0 -1
  122. package/packages/omo-codex/plugin/shared/src/config-loader.ts +2 -102
  123. package/packages/omo-codex/plugin/shared/src/config-migration.ts +0 -1
  124. package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +41 -130
  125. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +13 -13
  126. package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +1 -1
  127. package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +2 -2
  128. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +2 -1
  129. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +0 -1
  130. package/packages/omo-codex/plugin/test/AGENTS.md +2 -2
  131. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +2 -21
  132. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -2
  133. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +2 -7
  134. package/packages/omo-codex/plugin/test/auto-update.test.mjs +0 -25
  135. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +0 -31
  136. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +0 -50
  137. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +0 -1
  138. package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -3
  139. package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +0 -23
  140. package/packages/omo-codex/scripts/install-dist/install-local.mjs +227 -435
  141. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +1 -25
  142. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +0 -36
  143. package/packages/shared-skills/skills/init-deep/SKILL.md +13 -13
  144. package/packages/shared-skills/skills/ulw-plan/SKILL.md +0 -1
  145. package/dist/config/schema/codegraph.d.ts +0 -12
  146. package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +0 -17
  147. package/dist/hooks/codegraph-bootstrap/hook.d.ts +0 -35
  148. package/dist/hooks/codegraph-bootstrap/index.d.ts +0 -1
  149. package/dist/hooks/codegraph-bootstrap/project-root.d.ts +0 -1
  150. package/dist/hooks/codegraph-bootstrap/status.d.ts +0 -11
  151. package/dist/mcp/codegraph.d.ts +0 -16
  152. package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +0 -58
  153. package/packages/omo-codex/plugin/components/codegraph/LICENSE +0 -21
  154. package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +0 -2951
  155. package/packages/omo-codex/plugin/components/codegraph/NOTICE +0 -16
  156. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +0 -12326
  157. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +0 -9908
  158. package/packages/omo-codex/plugin/components/codegraph/package.json +0 -33
  159. package/packages/omo-codex/plugin/components/codegraph/src/cache-gc.ts +0 -29
  160. package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +0 -79
  161. package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +0 -33
  162. package/packages/omo-codex/plugin/components/codegraph/src/hook-sweep.ts +0 -25
  163. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +0 -131
  164. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +0 -258
  165. package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +0 -310
  166. package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +0 -92
  167. package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +0 -34
  168. package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +0 -29
  169. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +0 -263
  170. package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +0 -106
  171. package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +0 -145
  172. package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +0 -22
  173. package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +0 -139
  174. package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +0 -15
  175. package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +0 -32
  176. package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +0 -109
  177. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +0 -148
  178. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +0 -175
  179. package/packages/omo-codex/plugin/components/codegraph/src/sweep-cli.ts +0 -81
  180. package/packages/omo-codex/plugin/components/codegraph/test/cache-gc.test.ts +0 -34
  181. package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +0 -112
  182. package/packages/omo-codex/plugin/components/codegraph/test/hook-registration.test.ts +0 -26
  183. package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +0 -160
  184. package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +0 -50
  185. package/packages/omo-codex/plugin/components/codegraph/test/hook-sweep.test.ts +0 -29
  186. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +0 -320
  187. package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +0 -172
  188. package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +0 -91
  189. package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +0 -100
  190. package/packages/omo-codex/plugin/components/codegraph/test/serve-built-wrapper.test.ts +0 -76
  191. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +0 -133
  192. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +0 -245
  193. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +0 -69
  194. package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +0 -43
  195. package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +0 -147
  196. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable-idle.test.ts +0 -47
  197. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +0 -175
  198. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +0 -385
  199. package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +0 -206
  200. package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +0 -58
  201. package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +0 -104
  202. package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +0 -65
  203. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +0 -106
  204. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +0 -116
  205. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +0 -258
  206. package/packages/omo-codex/plugin/components/codegraph/test/sweep-cli.test.ts +0 -56
  207. package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +0 -13
  208. package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +0 -25
  209. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate.test.ts +0 -101
  210. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +0 -18
  211. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +0 -17
  212. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +0 -125
  213. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +0 -43
  214. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +0 -29
  215. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +0 -121
  216. package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +0 -76
  217. package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +0 -179
@@ -1,112 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
3
- import { join, resolve } from "node:path";
4
- import { Readable } from "node:stream";
5
- import { fileURLToPath } from "node:url";
6
-
7
- import {
8
- executeCodegraphSessionStartHook,
9
- type WorkerSpawnInvocation,
10
- } from "../src/hook.ts";
11
-
12
- const pluginRoot = resolve(fileURLToPath(new URL("../../..", import.meta.url)));
13
-
14
- function createAllowedWorkspace(prefix: string): string {
15
- return mkdtempSync(join(pluginRoot, `.tmp-${prefix}-`));
16
- }
17
-
18
- describe("CodeGraph SessionStart exclusion policy", () => {
19
- it("#given project root is inside an OMO state directory #when SessionStart fires #then it skips before probing or spawning", async () => {
20
- // given
21
- const stdout: string[] = [];
22
- const spawned: WorkerSpawnInvocation[] = [];
23
- let sweepCalls = 0;
24
- const stateRoot = createAllowedWorkspace("codegraph-omo-state");
25
- const workspace = join(stateRoot, ".omo", "ulw-research", "run", "clones", "repo");
26
- mkdirSync(workspace, { recursive: true });
27
-
28
- try {
29
- // when
30
- const result = await executeCodegraphSessionStartHook({
31
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
32
- cwd: workspace,
33
- env: { HOME: "/tmp/home" },
34
- stdin: Readable.from(["{}"]),
35
- stdout: { write: (chunk) => stdout.push(chunk) },
36
- spawnWorker: (invocation) => spawned.push(invocation),
37
- ancestorProbe: () => {
38
- throw new Error("excluded projects must not probe CodeGraph ancestors");
39
- },
40
- sweepZombies: () => {
41
- sweepCalls += 1;
42
- },
43
- });
44
-
45
- // then
46
- expect(result).toEqual({ action: "skipped-excluded", exitCode: 0 });
47
- expect(sweepCalls).toBe(0);
48
- expect(spawned).toEqual([]);
49
- expect(stdout.join("")).toBe("");
50
- } finally {
51
- rmSync(stateRoot, { recursive: true, force: true });
52
- }
53
- });
54
-
55
- it("#given project root is under a configured excluded root #when SessionStart fires #then it skips before spawning", async () => {
56
- // given
57
- const stdout: string[] = [];
58
- const spawned: WorkerSpawnInvocation[] = [];
59
- const excludedRoot = createAllowedWorkspace("codegraph-custom-excluded");
60
- const workspace = join(excludedRoot, "repo");
61
- mkdirSync(workspace, { recursive: true });
62
-
63
- try {
64
- // when
65
- const result = await executeCodegraphSessionStartHook({
66
- config: { codegraph: { enabled: true, excluded_roots: [excludedRoot] }, sources: [], warnings: [] },
67
- cwd: workspace,
68
- env: { HOME: "/tmp/home" },
69
- stdin: Readable.from(["{}"]),
70
- stdout: { write: (chunk) => stdout.push(chunk) },
71
- ancestorProbe: () => ({ kind: "uninitialized" }),
72
- spawnWorker: (invocation) => spawned.push(invocation),
73
- });
74
-
75
- // then
76
- expect(result).toEqual({ action: "skipped-excluded", exitCode: 0 });
77
- expect(spawned).toEqual([]);
78
- expect(stdout.join("")).toBe("");
79
- } finally {
80
- rmSync(excludedRoot, { recursive: true, force: true });
81
- }
82
- });
83
-
84
- it("#given project root is under /tmp #when SessionStart fires on POSIX #then it skips before spawning", async () => {
85
- if (process.platform === "win32") return;
86
-
87
- // given
88
- const stdout: string[] = [];
89
- const spawned: WorkerSpawnInvocation[] = [];
90
- const workspace = mkdtempSync(join("/tmp", "omo-codegraph-excluded-"));
91
-
92
- try {
93
- // when
94
- const result = await executeCodegraphSessionStartHook({
95
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
96
- cwd: workspace,
97
- env: { HOME: "/tmp/home" },
98
- stdin: Readable.from(["{}"]),
99
- stdout: { write: (chunk) => stdout.push(chunk) },
100
- ancestorProbe: () => ({ kind: "uninitialized" }),
101
- spawnWorker: (invocation) => spawned.push(invocation),
102
- });
103
-
104
- // then
105
- expect(result).toEqual({ action: "skipped-excluded", exitCode: 0 });
106
- expect(spawned).toEqual([]);
107
- expect(stdout.join("")).toBe("");
108
- } finally {
109
- rmSync(workspace, { recursive: true, force: true });
110
- }
111
- });
112
- });
@@ -1,26 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { readFileSync } from "node:fs";
3
- import { resolve } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
-
6
- const pluginRoot = resolve(fileURLToPath(new URL("../../..", import.meta.url)));
7
- const pluginConfigPath = resolve(pluginRoot, ".codex-plugin/plugin.json");
8
-
9
- describe("CodeGraph hook registration", () => {
10
- it("#given plugin hook config #when inspected #then CodeGraph is registered after bootstrap SessionStart", () => {
11
- // given
12
- const pluginConfig: unknown = JSON.parse(readFileSync(pluginConfigPath, "utf8"));
13
-
14
- // when
15
- const hookPaths =
16
- typeof pluginConfig === "object" && pluginConfig !== null && "hooks" in pluginConfig && Array.isArray(pluginConfig.hooks)
17
- ? pluginConfig.hooks.filter((hookPath): hookPath is string => typeof hookPath === "string")
18
- : [];
19
-
20
- // then
21
- expect(hookPaths).toContain("./hooks/session-start-checking-codegraph-bootstrap.json");
22
- expect(hookPaths.indexOf("./hooks/session-start-checking-bootstrap-provisioning.json")).toBeLessThan(
23
- hookPaths.indexOf("./hooks/session-start-checking-codegraph-bootstrap.json"),
24
- );
25
- });
26
- });
@@ -1,160 +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, resolve } from "node:path";
5
- import { Readable } from "node:stream";
6
- import { fileURLToPath } from "node:url";
7
-
8
- import {
9
- executeCodegraphSessionStartHook,
10
- type CodegraphSessionStartOutcome,
11
- type WorkerSpawnInvocation,
12
- } from "../src/hook.ts";
13
- import { recordSessionStartFailure } from "../src/session-start-cooldown.ts";
14
-
15
- const pluginRoot = resolve(fileURLToPath(new URL("../../..", import.meta.url)));
16
-
17
- function createAllowedWorkspace(prefix: string): string {
18
- return mkdtempSync(join(pluginRoot, `.tmp-${prefix}-`));
19
- }
20
-
21
- describe("CodeGraph SessionStart spawn guards", () => {
22
- it("#given an inconclusive probe timeout #when SessionStart runs #then timeout is not treated as uninitialized", async () => {
23
- // given
24
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-timeout-home-"));
25
- const workspace = createAllowedWorkspace("codegraph-timeout-workspace");
26
- const spawned: WorkerSpawnInvocation[] = [];
27
- try {
28
- // when
29
- const result = await executeCodegraphSessionStartHook({
30
- ancestorProbe: () => ({ kind: "inconclusive", reason: "status timed out" }),
31
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
32
- cwd: workspace,
33
- env: { HOME: homeDir },
34
- spawnWorker: (invocation) => spawned.push(invocation),
35
- stdin: Readable.from(["{}"]),
36
- sweepZombies: () => undefined,
37
- });
38
-
39
- // then
40
- expect(result).toEqual({ action: "skipped-inconclusive", exitCode: 0 });
41
- expect(spawned).toEqual([]);
42
- } finally {
43
- rmSync(homeDir, { recursive: true, force: true });
44
- rmSync(workspace, { recursive: true, force: true });
45
- }
46
- });
47
-
48
- it("#given one hook already owns the project lock #when a second SessionStart runs #then it records skipped-locked without spawning", async () => {
49
- // given
50
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-dedup-home-"));
51
- const workspace = createAllowedWorkspace("codegraph-dedup-workspace");
52
- const outcomes: CodegraphSessionStartOutcome[] = [];
53
- const spawned: WorkerSpawnInvocation[] = [];
54
- const options = {
55
- ancestorProbe: () => ({ kind: "uninitialized" } as const),
56
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
57
- cwd: workspace,
58
- env: { HOME: homeDir },
59
- logOutcome: (outcome: CodegraphSessionStartOutcome) => outcomes.push(outcome),
60
- spawnWorker: (invocation: WorkerSpawnInvocation) => {
61
- spawned.push(invocation);
62
- },
63
- stdin: Readable.from(["{}"]),
64
- sweepZombies: () => undefined,
65
- };
66
- try {
67
- await executeCodegraphSessionStartHook(options);
68
-
69
- // when
70
- const second = await executeCodegraphSessionStartHook({ ...options, stdin: Readable.from(["{}"]) });
71
-
72
- // then
73
- expect(second).toEqual({ action: "skipped-locked", exitCode: 0 });
74
- expect(spawned).toHaveLength(1);
75
- expect(outcomes).toContainEqual({ action: "skipped-locked", projectRoot: workspace });
76
- } finally {
77
- rmSync(homeDir, { recursive: true, force: true });
78
- rmSync(workspace, { recursive: true, force: true });
79
- }
80
- });
81
-
82
- it("#given a failed worker cooldown #when SessionStart retries before and after expiry #then only the expired retry spawns", async () => {
83
- // given
84
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-cooldown-hook-home-"));
85
- const workspace = createAllowedWorkspace("codegraph-cooldown-hook-workspace");
86
- const outcomes: CodegraphSessionStartOutcome[] = [];
87
- const spawned: WorkerSpawnInvocation[] = [];
88
- try {
89
- recordSessionStartFailure({
90
- action: "failed",
91
- baseCooldownMs: 60_000,
92
- homeDir,
93
- nowMs: 1_000,
94
- projectRoot: workspace,
95
- });
96
- const baseOptions = {
97
- ancestorProbe: () => ({ kind: "uninitialized" } as const),
98
- config: { codegraph: { enabled: true, session_start_cooldown_ms: 60_000 }, sources: [], warnings: [] },
99
- cwd: workspace,
100
- env: { HOME: homeDir },
101
- logOutcome: (outcome: CodegraphSessionStartOutcome) => outcomes.push(outcome),
102
- spawnWorker: (invocation: WorkerSpawnInvocation) => {
103
- spawned.push(invocation);
104
- },
105
- sweepZombies: () => undefined,
106
- };
107
-
108
- // when
109
- const suppressed = await executeCodegraphSessionStartHook({ ...baseOptions, nowMs: 60_999, stdin: Readable.from(["{}"]) });
110
- const expired = await executeCodegraphSessionStartHook({ ...baseOptions, nowMs: 61_000, stdin: Readable.from(["{}"]) });
111
-
112
- // then
113
- expect(suppressed).toEqual({ action: "skipped-cooldown", exitCode: 0 });
114
- expect(expired).toEqual({ action: "spawned", exitCode: 0 });
115
- expect(spawned).toHaveLength(1);
116
- expect(outcomes).toContainEqual({
117
- action: "skipped-cooldown",
118
- cooldownUntil: 61_000,
119
- failureCount: 1,
120
- projectRoot: workspace,
121
- });
122
- } finally {
123
- rmSync(homeDir, { recursive: true, force: true });
124
- rmSync(workspace, { recursive: true, force: true });
125
- }
126
- });
127
-
128
- it("#given an ancestor has a CodeGraph database #when SessionStart runs in a nested project #then it records skipped-nested-root", async () => {
129
- // given
130
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-nested-home-"));
131
- const ancestorRoot = createAllowedWorkspace("codegraph-nested-ancestor");
132
- const workspace = join(ancestorRoot, "apps", "server");
133
- const outcomes: CodegraphSessionStartOutcome[] = [];
134
- const spawned: WorkerSpawnInvocation[] = [];
135
- try {
136
- mkdirSync(join(ancestorRoot, ".codegraph"), { recursive: true });
137
- mkdirSync(workspace, { recursive: true });
138
- writeFileSync(join(ancestorRoot, ".codegraph", "codegraph.db"), "fixture");
139
-
140
- // when
141
- const result = await executeCodegraphSessionStartHook({
142
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
143
- cwd: workspace,
144
- env: { HOME: homeDir },
145
- logOutcome: (outcome) => outcomes.push(outcome),
146
- spawnWorker: (invocation) => spawned.push(invocation),
147
- stdin: Readable.from(["{}"]),
148
- sweepZombies: () => undefined,
149
- });
150
-
151
- // then
152
- expect(result).toEqual({ action: "skipped-nested-root", exitCode: 0 });
153
- expect(spawned).toEqual([]);
154
- expect(outcomes).toContainEqual({ action: "skipped-nested-root", ancestorRoot, projectRoot: workspace });
155
- } finally {
156
- rmSync(homeDir, { recursive: true, force: true });
157
- rmSync(ancestorRoot, { recursive: true, force: true });
158
- }
159
- });
160
- });
@@ -1,50 +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, resolve } from "node:path";
5
- import { Readable } from "node:stream";
6
- import { fileURLToPath } from "node:url";
7
-
8
- import { executeCodegraphSessionStartHook, type WorkerSpawnInvocation } from "../src/hook.ts";
9
-
10
- const pluginRoot = resolve(fileURLToPath(new URL("../../..", import.meta.url)));
11
-
12
- function createAllowedWorkspace(prefix: string): string {
13
- return mkdtempSync(join(pluginRoot, `.tmp-${prefix}-`));
14
- }
15
-
16
- describe("CodeGraph SessionStart hook with a migrated 1.0.1 project store under CodeGraph 1.5.0", () => {
17
- it("#given the migrated store has an exact database #when SessionStart runs #then it never invokes the CodeGraph CLI", async () => {
18
- // given
19
- const stdout: string[] = [];
20
- const spawned: WorkerSpawnInvocation[] = [];
21
- const homeDir = mkdtempSync(join(tmpdir(), "omo-codegraph-upgrade-home-"));
22
- const workspace = createAllowedWorkspace("codegraph-upgrade-workspace");
23
- try {
24
- mkdirSync(join(workspace, ".codegraph"), { recursive: true });
25
- writeFileSync(join(workspace, ".codegraph", "codegraph.db"), "migrated-store");
26
-
27
- // when
28
- const result = await executeCodegraphSessionStartHook({
29
- ancestorProbe: () => {
30
- throw new Error("the exact database check must be the complete fast path");
31
- },
32
- config: { codegraph: { enabled: true }, sources: [], warnings: [] },
33
- cwd: workspace,
34
- env: { HOME: homeDir },
35
- stdin: Readable.from(["{}"]),
36
- stdout: { write: (chunk) => stdout.push(chunk) },
37
- spawnWorker: (invocation) => spawned.push(invocation),
38
- sweepZombies: () => undefined,
39
- });
40
-
41
- // then
42
- expect(result).toEqual({ action: "skipped-initialized", exitCode: 0 });
43
- expect(spawned).toEqual([]);
44
- expect(stdout.join("")).toBe("");
45
- } finally {
46
- rmSync(homeDir, { recursive: true, force: true });
47
- rmSync(workspace, { recursive: true, force: true });
48
- }
49
- });
50
- });
@@ -1,29 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { Readable } from "node:stream";
3
-
4
- import { executeCodegraphSessionStartHook, type WorkerSpawnInvocation } from "../src/hook.ts";
5
-
6
- describe("CodeGraph SessionStart zombie sweep", () => {
7
- it("#given the zombie sweep fails #when SessionStart fires #then the hook still exits zero", async () => {
8
- // given
9
- const stdout: string[] = [];
10
- const spawned: WorkerSpawnInvocation[] = [];
11
-
12
- // when
13
- const result = await executeCodegraphSessionStartHook({
14
- config: { codegraph: { enabled: false }, sources: [], warnings: [] },
15
- env: { HOME: "/tmp/home" },
16
- stdin: Readable.from(["{}"]),
17
- stdout: { write: (chunk) => stdout.push(chunk) },
18
- spawnWorker: (invocation) => spawned.push(invocation),
19
- sweepZombies: () => {
20
- throw new Error("ps unavailable");
21
- },
22
- });
23
-
24
- // then
25
- expect(result).toEqual({ action: "skipped-disabled", exitCode: 0 });
26
- expect(spawned).toEqual([]);
27
- expect(stdout.join("")).toBe("");
28
- });
29
- });