fix(policy): address review feedback for wildcard policy

- add checkExhaustive to switch block in ApprovalModeIndicator.tsx
- add test coverage for wildcard styling in InputPrompt.test.tsx
- update lingering YOLO comment in exit-plan-mode.ts
This commit is contained in:
Spencer
2026-03-20 13:20:40 +00:00
parent 9a4ead65e7
commit c361970215
4 changed files with 24 additions and 2 deletions
@@ -7,7 +7,7 @@
import type React from 'react';
import { Box, Text } from 'ink';
import { theme } from '../semantic-colors.js';
import { ApprovalMode } from '@google/gemini-cli-core';
import { ApprovalMode, checkExhaustive } from '@google/gemini-cli-core';
import { formatCommand } from '../key/keybindingUtils.js';
import { Command } from '../key/keyBindings.js';
@@ -47,7 +47,12 @@ export const ApprovalModeIndicator: React.FC<ApprovalModeIndicatorProps> = ({
subText = `${cycleHint} to manual`;
break;
case ApprovalMode.DEFAULT:
textColor = theme.text.accent;
textContent = '';
subText = `${cycleHint} to accept edits`;
break;
default:
checkExhaustive(approvalMode);
textColor = theme.text.accent;
textContent = '';
subText = `${cycleHint} to accept edits`;
@@ -4033,6 +4033,16 @@ describe('InputPrompt', () => {
unmount();
});
it('should render correctly with wildcard policy enabled', async () => {
props.isWildcardPolicyEnabled = true;
const { stdout, unmount } = await renderWithProviders(
<InputPrompt {...props} />,
);
await waitFor(() => expect(stdout.lastFrame()).toContain('*'));
expect(stdout.lastFrame()).toMatchSnapshot();
unmount();
});
it('should not show inverted cursor when shell is focused', async () => {
props.isEmbeddedShellFocused = true;
props.focus = false;
@@ -195,3 +195,10 @@ exports[`InputPrompt > snapshots > should render correctly when accepting edits
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
"
`;
exports[`InputPrompt > snapshots > should render correctly with wildcard policy enabled 1`] = `
"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
* Type your message or @path/to/file
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
"
`;
+1 -1
View File
@@ -259,7 +259,7 @@ Ask the user for specific feedback on how to improve the plan.`,
// For non-interactive environment requires minimal user action, exit as AUTO_EDIT mode for plan implementation.
return ApprovalMode.AUTO_EDIT;
}
// By default, YOLO mode in interactive environment cannot enter/exit plan mode.
// By default, wildcard policies in interactive environment cannot enter/exit plan mode.
// Always exit plan mode and move to default approval mode if exit_plan_mode tool is configured with allow decision.
return ApprovalMode.DEFAULT;
}