mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 13:04:49 -07:00
feat(cleanup): enable 30-day session retention by default (#18854)
This commit is contained in:
@@ -137,6 +137,7 @@ import { useSessionBrowser } from './hooks/useSessionBrowser.js';
|
||||
import { persistentState } from '../utils/persistentState.js';
|
||||
import { useSessionResume } from './hooks/useSessionResume.js';
|
||||
import { useIncludeDirsTrust } from './hooks/useIncludeDirsTrust.js';
|
||||
import { useSessionRetentionCheck } from './hooks/useSessionRetentionCheck.js';
|
||||
import { isWorkspaceTrusted } from '../config/trustedFolders.js';
|
||||
import { useAlternateBuffer } from './hooks/useAlternateBuffer.js';
|
||||
import { useSettings } from './contexts/SettingsContext.js';
|
||||
@@ -1422,6 +1423,28 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
|
||||
useIncludeDirsTrust(config, isTrustedFolder, historyManager, setCustomDialog);
|
||||
|
||||
const handleAutoEnableRetention = useCallback(() => {
|
||||
const userSettings = settings.forScope(SettingScope.User).settings;
|
||||
const currentRetention = userSettings.general?.sessionRetention ?? {};
|
||||
|
||||
settings.setValue(SettingScope.User, 'general.sessionRetention', {
|
||||
...currentRetention,
|
||||
enabled: true,
|
||||
maxAge: '30d',
|
||||
warningAcknowledged: true,
|
||||
});
|
||||
}, [settings]);
|
||||
|
||||
const {
|
||||
shouldShowWarning: shouldShowRetentionWarning,
|
||||
checkComplete: retentionCheckComplete,
|
||||
sessionsToDeleteCount,
|
||||
} = useSessionRetentionCheck(
|
||||
config,
|
||||
settings.merged,
|
||||
handleAutoEnableRetention,
|
||||
);
|
||||
|
||||
const tabFocusTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -1900,6 +1923,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
const nightly = props.version.includes('nightly');
|
||||
|
||||
const dialogsVisible =
|
||||
(shouldShowRetentionWarning && retentionCheckComplete) ||
|
||||
shouldShowIdePrompt ||
|
||||
isFolderTrustDialogOpen ||
|
||||
adminSettingsChanged ||
|
||||
@@ -2012,6 +2036,9 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
history: historyManager.history,
|
||||
historyManager,
|
||||
isThemeDialogOpen,
|
||||
shouldShowRetentionWarning:
|
||||
shouldShowRetentionWarning && retentionCheckComplete,
|
||||
sessionsToDeleteCount: sessionsToDeleteCount ?? 0,
|
||||
themeError,
|
||||
isAuthenticating,
|
||||
isConfigInitialized,
|
||||
@@ -2125,6 +2152,9 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
}),
|
||||
[
|
||||
isThemeDialogOpen,
|
||||
shouldShowRetentionWarning,
|
||||
retentionCheckComplete,
|
||||
sessionsToDeleteCount,
|
||||
themeError,
|
||||
isAuthenticating,
|
||||
isConfigInitialized,
|
||||
|
||||
Reference in New Issue
Block a user