mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
Move temp dir from system prompt to first user msg (#12895)
This commit is contained in:
committed by
GitHub
parent
c1076512d1
commit
2e2b066713
@@ -18,6 +18,7 @@ import {
|
||||
getDirectoryContextString,
|
||||
} from './environmentContext.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { Storage } from '../config/storage.js';
|
||||
import { getFolderStructure } from './getFolderStructure.js';
|
||||
|
||||
vi.mock('../config/config.js');
|
||||
@@ -35,6 +36,9 @@ describe('getDirectoryContextString', () => {
|
||||
getDirectories: vi.fn().mockReturnValue(['/test/dir']),
|
||||
}),
|
||||
getFileService: vi.fn(),
|
||||
storage: {
|
||||
getProjectTempDir: vi.fn().mockReturnValue('/tmp/project-temp'),
|
||||
} as unknown as Storage,
|
||||
};
|
||||
vi.mocked(getFolderStructure).mockResolvedValue('Mock Folder Structure');
|
||||
});
|
||||
@@ -90,6 +94,9 @@ describe('getEnvironmentContext', () => {
|
||||
getFileService: vi.fn(),
|
||||
|
||||
getToolRegistry: vi.fn().mockReturnValue(mockToolRegistry),
|
||||
storage: {
|
||||
getProjectTempDir: vi.fn().mockReturnValue('/tmp/project-temp'),
|
||||
} as unknown as Storage,
|
||||
};
|
||||
|
||||
vi.mocked(getFolderStructure).mockResolvedValue('Mock Folder Structure');
|
||||
|
||||
@@ -59,11 +59,13 @@ export async function getEnvironmentContext(config: Config): Promise<Part[]> {
|
||||
});
|
||||
const platform = process.platform;
|
||||
const directoryContext = await getDirectoryContextString(config);
|
||||
const tempDir = config.storage.getProjectTempDir();
|
||||
|
||||
const context = `
|
||||
This is the Gemini CLI. We are setting up the context for our chat.
|
||||
Today's date is ${today} (formatted according to the user's locale).
|
||||
My operating system is: ${platform}
|
||||
The project's temporary directory is: ${tempDir}
|
||||
${directoryContext}
|
||||
`.trim();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user