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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/// <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)
|
||||
})
|
||||
})
|
||||
@@ -3,7 +3,7 @@ import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { normalizeSDKResponse } from "../../shared"
|
||||
import { log } from "../../shared/logger"
|
||||
|
||||
const PLAN_PATH_PATTERN = /[A-Za-z0-9_./\\:-]*\.sisyphus[\\/]plans[\\/][A-Za-z0-9._/\\-]+\.md/gi
|
||||
const PLAN_PATH_PATTERN = /[A-Za-z0-9_./\\:-]*\.(?:sisyphus|omo)[\\/]plans[\\/][A-Za-z0-9._/\\-]+\.md/gi
|
||||
|
||||
interface SessionMessagePart {
|
||||
text?: string
|
||||
|
||||
Reference in New Issue
Block a user