mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-28 15:01:14 -07:00
chore: Extract '.gemini' to GEMINI_DIR constant (#10540)
Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
This commit is contained in:
committed by
GitHub
parent
7beaa368a9
commit
518caae62e
@@ -18,6 +18,7 @@ import * as path from 'node:path';
|
||||
import * as os from 'node:os';
|
||||
import { ToolConfirmationOutcome } from './tools.js';
|
||||
import { ToolErrorType } from './tool-error.js';
|
||||
import { GEMINI_DIR } from '../utils/paths.js';
|
||||
|
||||
// Mock dependencies
|
||||
vi.mock(import('node:fs/promises'), async (importOriginal) => {
|
||||
@@ -105,7 +106,7 @@ describe('MemoryTool', () => {
|
||||
beforeEach(() => {
|
||||
testFilePath = path.join(
|
||||
os.homedir(),
|
||||
'.gemini',
|
||||
GEMINI_DIR,
|
||||
DEFAULT_CONTEXT_FILENAME,
|
||||
);
|
||||
});
|
||||
@@ -237,7 +238,7 @@ describe('MemoryTool', () => {
|
||||
// Use getCurrentGeminiMdFilename for the default expectation before any setGeminiMdFilename calls in a test
|
||||
const expectedFilePath = path.join(
|
||||
os.homedir(),
|
||||
'.gemini',
|
||||
GEMINI_DIR,
|
||||
getCurrentGeminiMdFilename(), // This will be DEFAULT_CONTEXT_FILENAME unless changed by a test
|
||||
);
|
||||
|
||||
@@ -317,9 +318,11 @@ describe('MemoryTool', () => {
|
||||
expect(result).not.toBe(false);
|
||||
|
||||
if (result && result.type === 'edit') {
|
||||
const expectedPath = path.join('~', '.gemini', 'GEMINI.md');
|
||||
const expectedPath = path.join('~', GEMINI_DIR, 'GEMINI.md');
|
||||
expect(result.title).toBe(`Confirm Memory Save: ${expectedPath}`);
|
||||
expect(result.fileName).toContain(path.join('mock', 'home', '.gemini'));
|
||||
expect(result.fileName).toContain(
|
||||
path.join('mock', 'home', GEMINI_DIR),
|
||||
);
|
||||
expect(result.fileName).toContain('GEMINI.md');
|
||||
expect(result.fileDiff).toContain('Index: GEMINI.md');
|
||||
expect(result.fileDiff).toContain('+## Gemini Added Memories');
|
||||
@@ -334,7 +337,7 @@ describe('MemoryTool', () => {
|
||||
const params = { fact: 'Test fact' };
|
||||
const memoryFilePath = path.join(
|
||||
os.homedir(),
|
||||
'.gemini',
|
||||
GEMINI_DIR,
|
||||
getCurrentGeminiMdFilename(),
|
||||
);
|
||||
|
||||
@@ -352,7 +355,7 @@ describe('MemoryTool', () => {
|
||||
const params = { fact: 'Test fact' };
|
||||
const memoryFilePath = path.join(
|
||||
os.homedir(),
|
||||
'.gemini',
|
||||
GEMINI_DIR,
|
||||
getCurrentGeminiMdFilename(),
|
||||
);
|
||||
|
||||
@@ -378,7 +381,7 @@ describe('MemoryTool', () => {
|
||||
const params = { fact: 'Test fact' };
|
||||
const memoryFilePath = path.join(
|
||||
os.homedir(),
|
||||
'.gemini',
|
||||
GEMINI_DIR,
|
||||
getCurrentGeminiMdFilename(),
|
||||
);
|
||||
|
||||
@@ -415,7 +418,7 @@ describe('MemoryTool', () => {
|
||||
expect(result).not.toBe(false);
|
||||
|
||||
if (result && result.type === 'edit') {
|
||||
const expectedPath = path.join('~', '.gemini', 'GEMINI.md');
|
||||
const expectedPath = path.join('~', GEMINI_DIR, 'GEMINI.md');
|
||||
expect(result.title).toBe(`Confirm Memory Save: ${expectedPath}`);
|
||||
expect(result.fileDiff).toContain('Index: GEMINI.md');
|
||||
expect(result.fileDiff).toContain('+- New fact');
|
||||
|
||||
@@ -60,7 +60,6 @@ Do NOT use this tool:
|
||||
- \`fact\` (string, required): The specific fact or piece of information to remember. This should be a clear, self-contained statement. For example, if the user says "My favorite color is blue", the fact would be "My favorite color is blue".
|
||||
`;
|
||||
|
||||
export const GEMINI_CONFIG_DIR = '.gemini';
|
||||
export const DEFAULT_CONTEXT_FILENAME = 'GEMINI.md';
|
||||
export const MEMORY_SECTION_HEADER = '## Gemini Added Memories';
|
||||
|
||||
@@ -98,7 +97,7 @@ interface SaveMemoryParams {
|
||||
modified_content?: string;
|
||||
}
|
||||
|
||||
function getGlobalMemoryFilePath(): string {
|
||||
export function getGlobalMemoryFilePath(): string {
|
||||
return path.join(Storage.getGlobalGeminiDir(), getCurrentGeminiMdFilename());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user