Skip to content

Commit d361074

Browse files
authored
Merge pull request #40 from narumiruna/feat/plan-mode-statusline
feat(plan-mode): show statusline state
2 parents 89e1758 + b944b46 commit d361074

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

extensions/pi-plan-mode/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Pi core intentionally does not ship a built-in plan mode; this package provides
1414
- Blocks mutating bash commands such as `rm`, `git commit`, dependency installs, redirects, and editor launches.
1515
- Injects Codex-like Plan mode instructions: explore first, ask only non-discoverable questions, do not mutate files, and finish with `<proposed_plan>`.
1616
- Detects proposed plan blocks and prompts you to implement, revise, or stay in Plan mode.
17+
- Shows Plan mode state in Pi's statusline as `📝 plan active` or `📝 plan ready`.
1718
- Persists Plan mode state in the Pi session so resume restores the mode.
1819

1920
## 📦 Install
@@ -67,6 +68,11 @@ A complete Plan mode answer should include exactly one block like this:
6768

6869
After a proposed plan is detected, `/plan` lets you choose whether to implement the plan, revise it, stay in Plan mode, or exit Plan mode. Choosing implementation disables Plan mode, restores full tool access, and immediately starts an implementation turn with the proposed plan.
6970

71+
While Plan mode is enabled, the extension also publishes a compact status for Pi statuslines. With `@narumitw/pi-statusline`, this appears in the extension status area:
72+
73+
- `📝 plan active`: Plan mode is enabled and still gathering context or drafting a plan.
74+
- `📝 plan ready`: A `<proposed_plan>` was detected and is waiting for your next `/plan` action.
75+
7076
You can also exit directly:
7177

7278
```text

extensions/pi-plan-mode/src/plan-mode.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export default function planMode(pi: ExtensionAPI) {
305305
}
306306

307307
function updateUi(ctx: ExtensionContext) {
308-
ctx.ui.setStatus(STATUS_KEY, state.enabled ? "plan: active" : undefined);
308+
ctx.ui.setStatus(STATUS_KEY, formatStatus());
309309
if (state.enabled && state.latestPlan) {
310310
ctx.ui.setWidget(PLAN_WIDGET_KEY, [
311311
"Proposed plan ready",
@@ -318,6 +318,12 @@ export default function planMode(pi: ExtensionAPI) {
318318
}
319319
}
320320

321+
function formatStatus() {
322+
if (!state.enabled) return undefined;
323+
if (state.awaitingAction || state.latestPlan) return "📝 plan ready";
324+
return "📝 plan active";
325+
}
326+
321327
function clearUi(ctx: ExtensionContext) {
322328
ctx.ui.setStatus(STATUS_KEY, undefined);
323329
ctx.ui.setWidget(PLAN_WIDGET_KEY, undefined);

0 commit comments

Comments
 (0)