Shorten temp directory (#17901)

This commit is contained in:
joshualitt
2026-02-06 08:10:17 -08:00
committed by GitHub
parent 30354892b3
commit 6fb3b09003
24 changed files with 989 additions and 27 deletions

View File

@@ -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),

View File

@@ -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 {

View File

@@ -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