fix plan mode when not in git worktree

This commit is contained in:
Dax Raad
2026-01-14 08:21:17 -05:00
parent ee6ca104e5
commit fcc561ebb7
4 changed files with 14 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ import { Snapshot } from "@/snapshot"
import type { Provider } from "@/provider/provider"
import { PermissionNext } from "@/permission/next"
import path from "path"
import { Global } from "@/global"
export namespace Session {
const log = Log.create({ service: "session" })
@@ -233,7 +234,10 @@ export namespace Session {
}
export function plan(input: { slug: string; time: { created: number } }) {
return path.join(Instance.worktree, ".opencode", "plans", [input.time.created, input.slug].join("-") + ".md")
const base = Instance.project.vcs
? path.join(Instance.worktree, ".opencode", "plans")
: path.join(Global.Path.data, "plans")
return path.join(base, [input.time.created, input.slug].join("-") + ".md")
}
export const get = fn(Identifier.schema("session"), async (id) => {