feat(plan): update cycling order of approval modes (#17622)

This commit is contained in:
Adib234
2026-01-26 21:20:51 -05:00
committed by GitHub
parent 8e8e7b33ed
commit ad0bece6d6
3 changed files with 16 additions and 16 deletions

View File

@@ -90,7 +90,7 @@ export const INFORMATIVE_TIPS = [
'Toggle the todo list display with Ctrl+T…',
'See full, untruncated responses with Ctrl+O…',
'Toggle auto-approval (YOLO mode) for all tools with Ctrl+Y…',
'Cycle through approval modes (Default, Plan, Auto-Edit) with Shift+Tab…',
'Cycle through approval modes (Default, Auto-Edit, Plan) with Shift+Tab…',
'Toggle Markdown rendering (raw markdown mode) with Alt+M…',
'Toggle shell mode by typing ! in an empty prompt…',
'Insert a newline with a backslash (\\) followed by Enter…',

View File

@@ -237,15 +237,7 @@ describe('useApprovalModeIndicator', () => {
}),
);
// DEFAULT -> PLAN
act(() => {
capturedUseKeypressHandler({ name: 'tab', shift: true } as Key);
});
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.PLAN,
);
// PLAN -> AUTO_EDIT
// DEFAULT -> AUTO_EDIT
act(() => {
capturedUseKeypressHandler({ name: 'tab', shift: true } as Key);
});
@@ -253,7 +245,15 @@ describe('useApprovalModeIndicator', () => {
ApprovalMode.AUTO_EDIT,
);
// AUTO_EDIT -> DEFAULT
// AUTO_EDIT -> PLAN
act(() => {
capturedUseKeypressHandler({ name: 'tab', shift: true } as Key);
});
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.PLAN,
);
// PLAN -> DEFAULT
act(() => {
capturedUseKeypressHandler({ name: 'tab', shift: true } as Key);
});

View File

@@ -59,14 +59,14 @@ export function useApprovalModeIndicator({
const currentMode = config.getApprovalMode();
switch (currentMode) {
case ApprovalMode.DEFAULT:
nextApprovalMode = config.isPlanEnabled()
? ApprovalMode.PLAN
: ApprovalMode.AUTO_EDIT;
break;
case ApprovalMode.PLAN:
nextApprovalMode = ApprovalMode.AUTO_EDIT;
break;
case ApprovalMode.AUTO_EDIT:
nextApprovalMode = config.isPlanEnabled()
? ApprovalMode.PLAN
: ApprovalMode.DEFAULT;
break;
case ApprovalMode.PLAN:
nextApprovalMode = ApprovalMode.DEFAULT;
break;
case ApprovalMode.YOLO: