@janvitos/pi-plan-build 0.1.38 → 0.1.39

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.
package/README.md CHANGED
@@ -99,7 +99,7 @@ The passive 64-column right panel reserves terminal columns, so the transcript a
99
99
  - “Pause the plan,” “hide the plan,” or “show the plan.”
100
100
  - “Cancel this plan” at any point to end step-by-step execution immediately.
101
101
 
102
- The extension exposes these actions to the agent through `plan_step_control`; project mutations remain blocked until the user clearly approves a ready step or explicitly indicates that it is already complete. A ready step may be marked complete without implementation when the user says they already handled or verified it. An implemented step is marked completed immediately after verification, and the next step becomes ready without a review or acceptance phase. The agent interprets intent contextually rather than requiring exact phrases, while the extension validates every resulting state transition. Step tool results identify the affected step, for example `Step 2: complete`, rather than presenting a plan-wide completion label. When the final step is completed or skipped, the panel and execution guards are removed immediately and the main window receives a completion confirmation with a concise plan summary. Cancelling removes the panel and execution guards immediately, restores the full-width layout, and preserves the saved plan file for reference. The agent implements only that step, calls `plan_step_complete`, and waits for the user's next prompt. Progress, revisions, summaries, and panel visibility survive reload/resume. If such a session is opened in regular mode, progress is retained but cannot advance until fullscreen mode is restored; no overlay fallback is used.
102
+ The extension exposes these actions to the agent through `plan_step_control`; project mutations remain blocked until the user clearly approves a ready step or explicitly indicates that it is already complete. A ready step may be marked complete without implementation when the user says they already handled or verified it. An implemented step is marked completed immediately after verification, and the next step becomes ready without a review or acceptance phase. The agent interprets intent contextually rather than requiring exact phrases, while the extension validates every resulting state transition. Step tool results identify the affected step, for example `Step 2: complete`, rather than presenting a plan-wide completion label. When the final step is completed or skipped, the panel and execution guards are removed immediately and the main window receives a Markdown-formatted completion summary with plan-style headings, spacing, and colors. Cancelling removes the panel and execution guards immediately, restores the full-width layout, and preserves the saved plan file for reference. The agent implements only that step, calls `plan_step_complete`, and waits for the user's next prompt. Progress, revisions, summaries, and panel visibility survive reload/resume. If such a session is opened in regular mode, progress is retained but cannot advance until fullscreen mode is restored; no overlay fallback is used.
103
103
 
104
104
  Enable fullscreen in `~/.pi/agent/settings.json` and restart Pi:
105
105
 
package/index.ts CHANGED
@@ -417,9 +417,9 @@ export default function planBuildModes(pi: ExtensionAPI): void {
417
417
  const target = params.step === undefined
418
418
  ? execution.steps.find((step) => step.status === "ready")
419
419
  : execution.steps[Math.floor(params.step) - 1];
420
- const finish = (message: string) => ({
420
+ const finish = (message: string, extraDetails?: { planCompleted?: boolean }) => ({
421
421
  content: [{ type: "text" as const, text: message }],
422
- details: { action: params.action, stepId: target?.id },
422
+ details: { action: params.action, stepId: target?.id, ...extraDetails },
423
423
  terminate: true,
424
424
  });
425
425
 
@@ -448,11 +448,17 @@ export default function planBuildModes(pi: ExtensionAPI): void {
448
448
  }
449
449
  if (params.action === "complete") {
450
450
  const completion = applyExecutionTransition(completePlanStep(execution, target.id));
451
- return finish(completion ?? "The step was marked complete. The next step is ready and awaits user instruction.");
451
+ return finish(
452
+ completion ?? "The step was marked complete. The next step is ready and awaits user instruction.",
453
+ { planCompleted: completion !== undefined },
454
+ );
452
455
  }
453
456
  if (params.action === "skip") {
454
457
  const completion = applyExecutionTransition(skipPlanStep(execution, target.id));
455
- return finish(completion ?? "The step was skipped. The next step awaits user instruction.");
458
+ return finish(
459
+ completion ?? "The step was skipped. The next step awaits user instruction.",
460
+ { planCompleted: completion !== undefined },
461
+ );
456
462
  }
457
463
  if (!params.instruction?.trim()) throw new Error("Revising a step requires a replacement instruction");
458
464
  const plan = await fs.promises.readFile(planPath, "utf8");
@@ -471,6 +477,8 @@ export default function planBuildModes(pi: ExtensionAPI): void {
471
477
  },
472
478
  renderResult(result, _options, theme, context) {
473
479
  const text = result.content.find((item) => item.type === "text")?.text ?? "Plan state updated";
480
+ const details = result.details as { planCompleted?: boolean } | undefined;
481
+ if (details?.planCompleted && !context.isError) return new Markdown(text, 0, 0, getMarkdownTheme());
474
482
  return new Text(theme.fg(context.isError ? "error" : "success", text), 0, 0);
475
483
  },
476
484
  });
@@ -489,7 +497,7 @@ export default function planBuildModes(pi: ExtensionAPI): void {
489
497
  const completion = applyExecutionTransition(completePlanStep(execution, step.id, params.summary));
490
498
  return {
491
499
  content: [{ type: "text", text: completion ?? "The step was completed. The next step is ready and awaits user instruction." }],
492
- details: { stepId: step.id, completed: true },
500
+ details: { stepId: step.id, completed: true, planCompleted: completion !== undefined },
493
501
  terminate: true,
494
502
  };
495
503
  },
@@ -498,6 +506,8 @@ export default function planBuildModes(pi: ExtensionAPI): void {
498
506
  },
499
507
  renderResult(result, _options, theme, context) {
500
508
  const text = result.content.find((item) => item.type === "text")?.text ?? "Plan step completed";
509
+ const details = result.details as { planCompleted?: boolean } | undefined;
510
+ if (details?.planCompleted && !context.isError) return new Markdown(text, 0, 0, getMarkdownTheme());
501
511
  return new Text(theme.fg(context.isError ? "error" : "success", text), 0, 0);
502
512
  },
503
513
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janvitos/pi-plan-build",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "Plan safely, approve explicitly, then implement here or in a clean session.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/plan-execution.ts CHANGED
@@ -114,11 +114,12 @@ function makeNextReady(state: PlanExecutionState, afterId: string): void {
114
114
  }
115
115
 
116
116
  export function formatPlanCompletionSummary(state: PlanExecutionState): string {
117
- const lines = ["Plan complete.", "", "Summary:"];
117
+ const lines = ["# Plan complete", "", "## Summary", ""];
118
118
  for (const [index, step] of state.steps.entries()) {
119
119
  const outcome = step.status === "skipped" ? "Skipped" : "Completed";
120
- lines.push(`${index + 1}. ${outcome}: ${step.text}`);
121
- if (step.summary?.trim()) lines.push(` ${step.summary.trim()}`);
120
+ lines.push(`${index + 1}. **${outcome}:** ${step.text}`);
121
+ if (step.summary?.trim()) lines.push("", ` ${step.summary.trim()}`);
122
+ if (index < state.steps.length - 1) lines.push("");
122
123
  }
123
124
  return lines.join("\n");
124
125
  }