@janvitos/pi-plan-build 0.1.0 → 0.1.2
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 +8 -1
- package/index.ts +2 -5
- package/package.json +1 -1
- package/prompts.ts +13 -2
- package/utils.ts +14 -0
package/README.md
CHANGED
|
@@ -8,11 +8,12 @@ A global [Pi coding agent](https://github.com/badlogic/pi-mono) extension that a
|
|
|
8
8
|
|
|
9
9
|
- New sessions start in **Build** mode.
|
|
10
10
|
- Bare `Tab` cycles **Build → Plan → Build** and replaces normal Tab autocomplete.
|
|
11
|
-
-
|
|
11
|
+
- Fixed-width, bold, color-coded **Build** (blue) and **Plan** (yellow) status badges in Pi's footer.
|
|
12
12
|
- `/plan`, `/build`, and the `--plan` startup flag.
|
|
13
13
|
- Per-session plans at `~/.pi/agent/plans/<session-id>.md`.
|
|
14
14
|
- In Plan mode, built-in `edit` and `write` are restricted to the exact plan file.
|
|
15
15
|
- Interactive `question`, `plan_enter`, and `plan_exit` tools.
|
|
16
|
+
- Informational questions are answered directly in Plan mode, with read-only inspection when needed and no plan or approval ceremony.
|
|
16
17
|
- The complete saved plan is rendered in the transcript before approval—without the built-in write preview's truncation.
|
|
17
18
|
- Three approval actions:
|
|
18
19
|
- **Switch to Build and implement here**
|
|
@@ -90,6 +91,12 @@ Normal tools remain visible so the model can inspect the project. While a Plan r
|
|
|
90
91
|
|
|
91
92
|
This mirrors the intended permission-oriented workflow rather than hiding normal tool schemas.
|
|
92
93
|
|
|
94
|
+
### Informational questions
|
|
95
|
+
|
|
96
|
+
Plan mode distinguishes informational Q&A from implementation planning. If a request only asks for an explanation or information, the agent answers directly and ends normally. It may inspect the project with read-only tools when the answer depends on local context, but it does not create or update a plan, ask planning questions unnecessarily, or call `plan_exit`. Plan mode remains selected for the next request.
|
|
97
|
+
|
|
98
|
+
Requests to change code or produce an implementation plan continue through the normal plan-file and approval workflow.
|
|
99
|
+
|
|
93
100
|
## Design and attribution
|
|
94
101
|
|
|
95
102
|
Pi Plan & Build is an independent extension with its own workflow and UI behavior. Its original mode prompts and transition semantics were informed by OpenCode 1.18.16, while clean-session implementation ideas were informed by the former `pi-plan-mode` extension. Those behaviors have since been adapted and extended for Pi; this project is not affiliated with either project.
|
package/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
buildPlanReviewMessage,
|
|
20
20
|
classifyPlanExitChoice,
|
|
21
21
|
decodeModeState,
|
|
22
|
+
formatModeStatus,
|
|
22
23
|
isAllowedPlanMutation,
|
|
23
24
|
makePlanPath,
|
|
24
25
|
nextMode,
|
|
@@ -94,10 +95,7 @@ export default function planBuildModes(pi: ExtensionAPI): void {
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
function updateStatus(ctx: ExtensionContext): void {
|
|
97
|
-
|
|
98
|
-
? ctx.ui.theme.fg("warning", "Plan")
|
|
99
|
-
: ctx.ui.theme.fg("border", "Build");
|
|
100
|
-
ctx.ui.setStatus(STATUS_KEY, `[${label}]`);
|
|
98
|
+
ctx.ui.setStatus(STATUS_KEY, formatModeStatus(selectedMode));
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
function discoverUnmanagedTools(): void {
|
|
@@ -138,7 +136,6 @@ export default function planBuildModes(pi: ExtensionAPI): void {
|
|
|
138
136
|
}
|
|
139
137
|
updateStatus(ctx);
|
|
140
138
|
persist();
|
|
141
|
-
ctx.ui.notify(`${mode === "plan" ? "Plan" : "Build"} mode selected`, "info");
|
|
142
139
|
}
|
|
143
140
|
|
|
144
141
|
pi.registerCommand("plan", {
|
package/package.json
CHANGED
package/prompts.ts
CHANGED
|
@@ -13,7 +13,17 @@ Plan mode is active. The user indicated that they do not want you to execute yet
|
|
|
13
13
|
|
|
14
14
|
## Plan File Info:
|
|
15
15
|
${planInfo}
|
|
16
|
-
|
|
16
|
+
Only when the current request requires an implementation plan should you build the plan incrementally by writing to or editing this file. NOTE that this is the only file you are allowed to edit - other than this you are only allowed to take READ-ONLY actions.
|
|
17
|
+
|
|
18
|
+
## Informational Questions
|
|
19
|
+
|
|
20
|
+
If the user asks an informational question and does not ask you to make changes or produce an implementation plan, answer the question directly instead of starting the workflow below.
|
|
21
|
+
|
|
22
|
+
- You may use read-only tools to inspect the project when the answer depends on it.
|
|
23
|
+
- Do not create or update the plan file.
|
|
24
|
+
- Do not call the question tool merely because the request is phrased as a question; use it only when clarification is actually needed.
|
|
25
|
+
- Do not call plan_exit.
|
|
26
|
+
- End your response normally after answering. Plan mode remains active for future requests.
|
|
17
27
|
|
|
18
28
|
## Plan Workflow
|
|
19
29
|
|
|
@@ -66,4 +76,5 @@ Call this tool:
|
|
|
66
76
|
Do NOT call this tool:
|
|
67
77
|
- Before you have created or finalized the plan
|
|
68
78
|
- If you still have unanswered questions about the implementation
|
|
69
|
-
- If the user has indicated they want to continue planning
|
|
79
|
+
- If the user has indicated they want to continue planning
|
|
80
|
+
- After directly answering an informational question that did not require an implementation plan`;
|
package/utils.ts
CHANGED
|
@@ -2,6 +2,20 @@ import path from "node:path";
|
|
|
2
2
|
|
|
3
3
|
export type Mode = "build" | "plan";
|
|
4
4
|
|
|
5
|
+
const ANSI_RESET = "\x1b[0m";
|
|
6
|
+
const BOLD_BLACK_FOREGROUND = "1;38;2;0;0;0";
|
|
7
|
+
const MODE_BADGES: Record<Mode, { background: string; text: string; reservedSpace: string }> = {
|
|
8
|
+
// A trailing reset keeps Pi's status sanitizer from trimming the uncolored reserved cell.
|
|
9
|
+
plan: { background: "48;2;255;215;0", text: " PLAN ", reservedSpace: "\u00a0" },
|
|
10
|
+
build: { background: "48;2;59;130;246", text: " BUILD ", reservedSpace: "" },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function formatModeStatus(mode: Mode): string {
|
|
14
|
+
const badge = MODE_BADGES[mode];
|
|
15
|
+
const reservedSuffix = badge.reservedSpace ? `${badge.reservedSpace}${ANSI_RESET}` : "";
|
|
16
|
+
return `\x1b[${BOLD_BLACK_FOREGROUND};${badge.background}m${badge.text}${ANSI_RESET}${reservedSuffix}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
5
19
|
export const PLAN_EXIT_APPROVE_CHOICE = "Switch to Build and implement here";
|
|
6
20
|
export const PLAN_EXIT_FRESH_CHOICE = "Start fresh and implement";
|
|
7
21
|
export const PLAN_EXIT_STAY_CHOICE = "Stay in Plan mode";
|