feat: allow custom filename for context files (#654)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Allen Hutchison
2025-05-31 12:49:28 -07:00
committed by GitHub
parent cbc1614b84
commit 53bf778497
15 changed files with 1710 additions and 888 deletions

View File

@@ -46,15 +46,29 @@ Do NOT use this tool:
`;
export const GEMINI_CONFIG_DIR = '.gemini';
export const GEMINI_MD_FILENAME = 'GEMINI.md';
export const DEFAULT_CONTEXT_FILENAME = 'GEMINI.md';
export const MEMORY_SECTION_HEADER = '## Gemini Added Memories';
// This variable will hold the currently configured filename for GEMINI.md context files.
// It defaults to DEFAULT_CONTEXT_FILENAME but can be overridden by setGeminiMdFilename.
let currentGeminiMdFilename = DEFAULT_CONTEXT_FILENAME;
export function setGeminiMdFilename(newFilename: string): void {
if (newFilename && newFilename.trim() !== '') {
currentGeminiMdFilename = newFilename.trim();
}
}
export function getCurrentGeminiMdFilename(): string {
return currentGeminiMdFilename;
}
interface SaveMemoryParams {
fact: string;
}
function getGlobalMemoryFilePath(): string {
return path.join(homedir(), GEMINI_CONFIG_DIR, GEMINI_MD_FILENAME);
return path.join(homedir(), GEMINI_CONFIG_DIR, getCurrentGeminiMdFilename());
}
/**