Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/cli/plan-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ structure, and consultation level are proportional to the task's complexity:
[preferred external editor]. This allows you to manually refine the plan
steps before approval. The CLI will automatically refresh and show the
updated plan after you save and close the editor.
- **Review edits:** If you added inline annotations or feedback for the
agent to consider in the plan file, you can select the **"No, review plan
edits as feedback"** option to send the plan back to the agent for
iteration.

For more complex or specialized planning tasks, you can
[customize the planning workflow with skills](#customizing-planning-with-skills).
Expand Down
28 changes: 28 additions & 0 deletions packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,28 @@ Implement a comprehensive authentication system with multiple providers.
});
});

it('calls onFeedback with the review message when Review is selected', async () => {
const { stdin, lastFrame } = renderDialog({ useAlternateBuffer });

await act(async () => {
vi.runAllTimers();
});

await waitFor(() => {
expect(lastFrame()).toContain('Add user authentication');
});

writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\r');

await waitFor(() => {
expect(onFeedback).toHaveBeenCalledWith(
'I have annotated the plan with feedback. Please review the edited plan file and update the plan accordingly.',
);
});
});

it('calls onFeedback when feedback is typed and submitted', async () => {
const { stdin, lastFrame } = renderDialog({ useAlternateBuffer });

Expand All @@ -249,6 +271,7 @@ Implement a comprehensive authentication system with multiple providers.
// Navigate to feedback option
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow

// Type feedback
for (const char of 'Add tests') {
Expand Down Expand Up @@ -376,6 +399,7 @@ Implement a comprehensive authentication system with multiple providers.
// Navigate to feedback option and start typing
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\r'); // Select to focus input

// Type some feedback
Expand Down Expand Up @@ -460,6 +484,7 @@ Implement a comprehensive authentication system with multiple providers.
// Navigate to feedback option
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow

// Type some feedback
for (const char of 'test') {
Expand Down Expand Up @@ -501,6 +526,7 @@ Implement a comprehensive authentication system with multiple providers.
// Navigate to feedback option
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow

// Press Enter without typing anything
writeKey(stdin, '\r');
Expand Down Expand Up @@ -528,6 +554,7 @@ Implement a comprehensive authentication system with multiple providers.
// Navigate to feedback option and start typing
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow
writeKey(stdin, '\x1b[B'); // Down arrow

// Type some feedback
for (const char of 'test') {
Expand All @@ -536,6 +563,7 @@ Implement a comprehensive authentication system with multiple providers.

// Now use up arrow to navigate back to a different option
writeKey(stdin, '\x1b[A'); // Up arrow
writeKey(stdin, '\x1b[A'); // Up arrow

// Press Enter to select the second option (manually accept edits)
writeKey(stdin, '\r');
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/ui/components/ExitPlanModeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface PlanContentState {
enum ApprovalOption {
Auto = 'Yes, automatically accept edits',
Manual = 'Yes, manually accept edits',
Review = 'No, review plan edits as feedback',
}

/**
Expand Down Expand Up @@ -240,6 +241,11 @@ export const ExitPlanModeDialog: React.FC<ExitPlanModeDialogProps> = ({
description:
'Approves plan but requires confirmation for each tool',
},
{
label: ApprovalOption.Review,
description:
'Return plan with annotations to the agent for iteration',
},
],
placeholder: 'Type your feedback...',
multiSelect: false,
Expand All @@ -251,6 +257,10 @@ export const ExitPlanModeDialog: React.FC<ExitPlanModeDialogProps> = ({
onApprove(ApprovalMode.AUTO_EDIT);
} else if (answer === ApprovalOption.Manual) {
onApprove(ApprovalMode.DEFAULT);
} else if (answer === ApprovalOption.Review) {
onFeedback(
'I have annotated the plan with feedback. Please review the edited plan file and update the plan accordingly.',
);
} else if (answer) {
onFeedback(answer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ Files to Modify
- src/index.ts - Add auth middleware
- src/config.ts - Add auth configuration options

1. Yes, automatically accept edits
Approves plan and allows tools to run automatically
● 2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand All @@ -44,11 +47,14 @@ Files to Modify
- src/index.ts - Add auth middleware
- src/config.ts - Add auth configuration options

● 1. Yes, automatically accept edits
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand Down Expand Up @@ -76,11 +82,14 @@ Implementation Steps
8. Add multi-factor authentication in src/auth/MFAService.ts
... last 22 lines hidden (Ctrl+O to show) ...

● 1. Yes, automatically accept edits
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand All @@ -103,11 +112,14 @@ Files to Modify
- src/index.ts - Add auth middleware
- src/config.ts - Add auth configuration options

● 1. Yes, automatically accept edits
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand All @@ -134,7 +146,9 @@ Files to Modify
Approves plan and allows tools to run automatically
● 2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration
4. Type your feedback...

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand All @@ -161,7 +175,9 @@ Files to Modify
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration
4. Type your feedback...

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand Down Expand Up @@ -214,7 +230,9 @@ Testing Strategy
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration
4. Type your feedback...

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand All @@ -241,7 +259,9 @@ Files to Modify
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...
3. No, review plan edits as feedback
Return plan with annotations to the agent for iteration
4. Type your feedback...

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ exports[`ToolConfirmationQueue > renders ExitPlanMode tool confirmation with Suc
│ Approves plan and allows tools to run automatically │
│ 2. Yes, manually accept edits │
│ Approves plan but requires confirmation for each tool │
│ 3. Type your feedback... │
│ 3. No, review plan edits as feedback │
│ Return plan with annotations to the agent for iteration │
│ 4. Type your feedback... │
│ │
│ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel │
╰──────────────────────────────────────────────────────────────────────────────╯
Expand Down
Loading