Skip to content

Commit 0c03414

Browse files
committed
fix(plan): show plan content as markdown in exit prompt, guard empty plan
1 parent 25ab9ba commit 0c03414

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

packages/opencode/src/tool/plan.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,24 @@ export const PlanExitTool = Tool.define(
3030
execute: (_params: {}, ctx: Tool.Context) =>
3131
Effect.gen(function* () {
3232
const info = yield* session.get(ctx.sessionID)
33-
const plan = path.relative(Instance.worktree, Session.plan(info))
33+
const abs = Session.plan(info)
34+
const plan = path.relative(Instance.worktree, abs)
35+
const content = yield* Effect.promise(() =>
36+
Bun.file(abs)
37+
.text()
38+
.catch(() => ""),
39+
)
40+
if (!content.trim())
41+
return {
42+
title: "Plan is empty",
43+
output: "The plan file is empty. Write the plan first before calling plan_exit.",
44+
metadata: {},
45+
}
3446
const answers = yield* question.ask({
3547
sessionID: ctx.sessionID,
3648
questions: [
3749
{
38-
question: `Plan at ${plan} is complete. Would you like to switch to the build agent and start implementing?`,
50+
question: `Plan at ${plan} is complete. Would you like to switch to the build agent and start implementing?\n\n---\n\n${content}`,
3951
header: "Build Agent",
4052
custom: false,
4153
options: [

0 commit comments

Comments
 (0)