Extensibility: Gemini.md files (#944)

This commit is contained in:
matt korwel
2025-06-11 13:34:35 -07:00
committed by GitHub
parent 24c61147b8
commit 4160d904da
7 changed files with 139 additions and 27 deletions

View File

@@ -58,8 +58,11 @@ vi.mock('@gemini-cli/core', async () => {
setUserMemory: vi.fn(),
setGeminiMdFileCount: vi.fn(),
})),
loadServerHierarchicalMemory: vi.fn(() =>
Promise.resolve({ memoryContent: '', fileCount: 0 }),
loadServerHierarchicalMemory: vi.fn((cwd, debug, extensionPaths) =>
Promise.resolve({
memoryContent: extensionPaths?.join(',') || '',
fileCount: extensionPaths?.length || 0,
}),
),
};
});
@@ -228,15 +231,31 @@ describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
vi.restoreAllMocks();
});
it('should have a placeholder test to ensure test file validity', () => {
// This test suite is currently a placeholder.
// Tests for loadHierarchicalGeminiMemory were removed due to persistent
// and complex mocking issues with Node.js built-in modules (like 'os')
// in the Vitest environment. These issues prevented consistent and reliable
// testing of file system interactions dependent on os.homedir().
// The core logic was implemented as per specification, but the tests
// could not be stabilized.
expect(true).toBe(true);
it('should pass extension context file paths to loadServerHierarchicalMemory', async () => {
process.argv = ['node', 'script.js'];
const settings: Settings = {};
const extensions = [
{
name: 'ext1',
version: '1.0.0',
contextFileName: '/path/to/ext1/gemini.md',
},
{
name: 'ext2',
version: '1.0.0',
},
{
name: 'ext3',
version: '1.0.0',
contextFileName: '/path/to/ext3/gemini.md',
},
];
await loadCliConfig(settings, extensions, [], 'session-id');
expect(ServerConfig.loadServerHierarchicalMemory).toHaveBeenCalledWith(
expect.any(String),
false,
['/path/to/ext1/gemini.md', '/path/to/ext3/gemini.md'],
);
});
// NOTE TO FUTURE DEVELOPERS: