mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 17:11:04 -07:00
fix(trust): Update config.isTrustedFolder (#7373)
This commit is contained in:
@@ -107,6 +107,7 @@ import { appEvents, AppEvent } from '../utils/events.js';
|
||||
import { isNarrowWidth } from './utils/isNarrowWidth.js';
|
||||
import { useWorkspaceMigration } from './hooks/useWorkspaceMigration.js';
|
||||
import { WorkspaceMigrationDialog } from './components/WorkspaceMigrationDialog.js';
|
||||
import { isWorkspaceTrusted } from '../config/trustedFolders.js';
|
||||
|
||||
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
|
||||
// Maximum number of queued messages to display in UI to prevent performance issues
|
||||
@@ -204,7 +205,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||
const [footerHeight, setFooterHeight] = useState<number>(0);
|
||||
const [corgiMode, setCorgiMode] = useState(false);
|
||||
const [isTrustedFolderState, setIsTrustedFolder] = useState(
|
||||
config.isTrustedFolder(),
|
||||
isWorkspaceTrusted(settings.merged),
|
||||
);
|
||||
const [currentModel, setCurrentModel] = useState(config.getModel());
|
||||
const [shellModeActive, setShellModeActive] = useState(false);
|
||||
|
||||
@@ -143,24 +143,6 @@ describe('ToolConfirmationMessage', () => {
|
||||
expect(lastFrame()).toContain(alwaysAllowText);
|
||||
});
|
||||
|
||||
it('should show "allow always" when folder trust is undefined', () => {
|
||||
const mockConfig = {
|
||||
isTrustedFolder: () => undefined,
|
||||
getIdeMode: () => false,
|
||||
} as unknown as Config;
|
||||
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<ToolConfirmationMessage
|
||||
confirmationDetails={details}
|
||||
config={mockConfig}
|
||||
availableTerminalHeight={30}
|
||||
terminalWidth={80}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(lastFrame()).toContain(alwaysAllowText);
|
||||
});
|
||||
|
||||
it('should NOT show "allow always" when folder is untrusted', () => {
|
||||
const mockConfig = {
|
||||
isTrustedFolder: () => false,
|
||||
|
||||
@@ -56,7 +56,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
onConfirm(outcome);
|
||||
};
|
||||
|
||||
const isTrustedFolder = config.isTrustedFolder() !== false;
|
||||
const isTrustedFolder = config.isTrustedFolder();
|
||||
|
||||
useKeypress(
|
||||
(key) => {
|
||||
|
||||
Reference in New Issue
Block a user