mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 09:30:58 -07:00
Shorten temp directory (#17901)
This commit is contained in:
@@ -11,6 +11,7 @@ import * as path from 'node:path';
|
||||
vi.mock('@google/gemini-cli-core', () => ({
|
||||
Storage: vi.fn().mockImplementation(() => ({
|
||||
getProjectTempDir: vi.fn().mockReturnValue('/tmp/project'),
|
||||
initialize: vi.fn().mockResolvedValue(undefined),
|
||||
})),
|
||||
shutdownTelemetry: vi.fn(),
|
||||
isTelemetrySdkInitialized: vi.fn().mockReturnValue(false),
|
||||
|
||||
@@ -102,6 +102,7 @@ async function drainStdin() {
|
||||
|
||||
export async function cleanupCheckpoints() {
|
||||
const storage = new Storage(process.cwd());
|
||||
await storage.initialize();
|
||||
const tempDir = storage.getProjectTempDir();
|
||||
const checkpointsDir = join(tempDir, 'checkpoints');
|
||||
try {
|
||||
|
||||
@@ -362,8 +362,12 @@ export async function cleanupToolOutputFiles(
|
||||
}
|
||||
|
||||
const retentionConfig = settings.general.sessionRetention;
|
||||
const tempDir =
|
||||
projectTempDir ?? new Storage(process.cwd()).getProjectTempDir();
|
||||
let tempDir = projectTempDir;
|
||||
if (!tempDir) {
|
||||
const storage = new Storage(process.cwd());
|
||||
await storage.initialize();
|
||||
tempDir = storage.getProjectTempDir();
|
||||
}
|
||||
const toolOutputDir = path.join(tempDir, TOOL_OUTPUTS_DIR);
|
||||
|
||||
// Check if directory exists
|
||||
|
||||
Reference in New Issue
Block a user