Files
oh-my-opencode/src/hooks/start-work/session-plan-affinity.test.ts
T
YeonGyu-Kim 7cce0ad230 fix(notepad-guard,start-work): wire dispatch and match .omo paths
notepad-write-guard:
- The hook was created by create-tool-guard-hooks but tool-execute-before
  never invoked it, so the guard was inert.
- It also only matched .sisyphus/notepads, missing the current
  .omo/notepads layout introduced by the workspace migration.
- Add the dispatch call alongside writeExistingFileGuard, and extend
  NOTEPAD_ROOTS to cover both paths via normalize() + sep. New
  integration test pins the wire and the .omo block; the existing unit
  test now asserts both paths.

start-work session-plan-affinity:
- PLAN_PATH_PATTERN only matched .sisyphus/plans, so sessions referring
  to plans under .omo/plans returned null and start-work missed the
  current session's own plan.
- Extend the regex to .(sisyphus|omo)/plans and add findPrometheusPlans
  in packages/boulder-state to scan both directories during the
  transition. New regression test pins .omo/plans matching; legacy
  .sisyphus/plans coverage preserved.
2026-05-22 00:07:46 +09:00

41 lines
1.2 KiB
TypeScript

/// <reference types="bun-types" />
import { describe, expect, test } from "bun:test"
import { join } from "node:path"
import { tmpdir } from "node:os"
import { findRecentSessionPlanPath } from "./session-plan-affinity"
import { unsafeTestValue } from "../../../test-support/unsafe-test-value"
type FindRecentSessionPlanPathInput = Parameters<typeof findRecentSessionPlanPath>[0]
describe("findRecentSessionPlanPath", () => {
test("#given session history references omo plan path #when finding recent plan #then returns matching plan", async () => {
const directory = join(tmpdir(), "session-plan-affinity-test")
const planPath = join(directory, ".omo", "plans", "foo-bar.md")
const client = unsafeTestValue<FindRecentSessionPlanPathInput["client"]>({
session: {
messages: async () => ({
data: [
{
parts: [
{
text: "Plan saved to .omo/plans/foo-bar.md",
},
],
},
],
}),
},
})
const result = await findRecentSessionPlanPath({
client,
directory,
sessionID: "session-123",
availablePlans: [planPath],
})
expect(result).toBe(planPath)
})
})