mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 06:25:16 -07:00
feat(context): add configurable memoryBoundaryMarkers setting (#24020)
This commit is contained in:
@@ -46,6 +46,7 @@ describe('ContextManager', () => {
|
||||
getMcpInstructions: vi.fn().mockReturnValue('MCP Instructions'),
|
||||
}),
|
||||
isTrustedFolder: vi.fn().mockReturnValue(true),
|
||||
getMemoryBoundaryMarkers: vi.fn().mockReturnValue(['.git']),
|
||||
} as unknown as Config;
|
||||
|
||||
contextManager = new ContextManager(mockConfig);
|
||||
@@ -81,12 +82,14 @@ describe('ContextManager', () => {
|
||||
await contextManager.refresh();
|
||||
|
||||
expect(memoryDiscovery.getGlobalMemoryPaths).toHaveBeenCalled();
|
||||
expect(memoryDiscovery.getEnvironmentMemoryPaths).toHaveBeenCalledWith([
|
||||
'/app',
|
||||
]);
|
||||
expect(memoryDiscovery.getEnvironmentMemoryPaths).toHaveBeenCalledWith(
|
||||
['/app'],
|
||||
['.git'],
|
||||
);
|
||||
expect(memoryDiscovery.readGeminiMdFiles).toHaveBeenCalledWith(
|
||||
expect.arrayContaining([...globalPaths, ...envPaths]),
|
||||
'tree',
|
||||
['.git'],
|
||||
);
|
||||
|
||||
expect(contextManager.getGlobalMemory()).toContain('Global Content');
|
||||
@@ -172,6 +175,7 @@ describe('ContextManager', () => {
|
||||
expect(memoryDiscovery.readGeminiMdFiles).toHaveBeenCalledWith(
|
||||
['/home/user/.gemini/GEMINI.md', '/app/gemini.md'],
|
||||
'tree',
|
||||
['.git'],
|
||||
);
|
||||
expect(contextManager.getEnvironmentMemory()).toContain(
|
||||
'Project Content',
|
||||
@@ -197,6 +201,7 @@ describe('ContextManager', () => {
|
||||
['/app'],
|
||||
expect.any(Set),
|
||||
expect.any(Set),
|
||||
['.git'],
|
||||
);
|
||||
expect(result).toMatch(/--- Context from: \/app\/src\/GEMINI\.md ---/);
|
||||
expect(result).toContain('Src Content');
|
||||
@@ -226,5 +231,25 @@ describe('ContextManager', () => {
|
||||
expect(memoryDiscovery.loadJitSubdirectoryMemory).not.toHaveBeenCalled();
|
||||
expect(result).toBe('');
|
||||
});
|
||||
|
||||
it('should pass custom boundary markers from config', async () => {
|
||||
const customMarkers = ['.monorepo-root', 'package.json'];
|
||||
vi.mocked(mockConfig.getMemoryBoundaryMarkers).mockReturnValue(
|
||||
customMarkers,
|
||||
);
|
||||
vi.mocked(memoryDiscovery.loadJitSubdirectoryMemory).mockResolvedValue({
|
||||
files: [],
|
||||
});
|
||||
|
||||
await contextManager.discoverContext('/app/src/file.ts', ['/app']);
|
||||
|
||||
expect(memoryDiscovery.loadJitSubdirectoryMemory).toHaveBeenCalledWith(
|
||||
'/app/src/file.ts',
|
||||
['/app'],
|
||||
expect.any(Set),
|
||||
expect.any(Set),
|
||||
customMarkers,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user