refactor: Remove deprecated --all-files flag (#11228)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Allen Hutchison
2025-10-16 12:09:21 -07:00
committed by GitHub
parent bec2bfcadb
commit 937c15c66e
19 changed files with 31 additions and 130 deletions
@@ -168,7 +168,7 @@ describe('editCorrector', () => {
targetDir: '/test',
debugMode: false,
question: undefined as string | undefined,
fullContext: false,
coreTools: undefined as string[] | undefined,
toolDiscoveryCommand: undefined as string | undefined,
toolCallCommand: undefined as string | undefined,
@@ -188,7 +188,7 @@ describe('editCorrector', () => {
getToolRegistry: vi.fn(() => mockToolRegistry),
getDebugMode: vi.fn(() => configParams.debugMode),
getQuestion: vi.fn(() => configParams.question),
getFullContext: vi.fn(() => configParams.fullContext),
getCoreTools: vi.fn(() => configParams.coreTools),
getToolDiscoveryCommand: vi.fn(() => configParams.toolDiscoveryCommand),
getToolCallCommand: vi.fn(() => configParams.toolCallCommand),
@@ -88,7 +88,7 @@ describe('getEnvironmentContext', () => {
getDirectories: vi.fn().mockReturnValue(['/test/dir']),
}),
getFileService: vi.fn(),
getFullContext: vi.fn().mockReturnValue(false),
getToolRegistry: vi.fn().mockReturnValue(mockToolRegistry),
};
@@ -142,32 +142,7 @@ describe('getEnvironmentContext', () => {
expect(getFolderStructure).toHaveBeenCalledTimes(2);
});
it('should include full file context when getFullContext is true', async () => {
mockConfig.getFullContext = vi.fn().mockReturnValue(true);
const mockReadManyFilesTool = {
build: vi.fn().mockReturnValue({
execute: vi
.fn()
.mockResolvedValue({ llmContent: 'Full file content here' }),
}),
};
mockToolRegistry.getTool.mockReturnValue(mockReadManyFilesTool);
const parts = await getEnvironmentContext(mockConfig as Config);
expect(parts.length).toBe(2);
expect(parts[1].text).toBe(
'\n--- Full File Context ---\nFull file content here',
);
expect(mockToolRegistry.getTool).toHaveBeenCalledWith('read_many_files');
expect(mockReadManyFilesTool.build).toHaveBeenCalledWith({
paths: ['**/*'],
useDefaultExcludes: true,
});
});
it('should handle read_many_files returning no content', async () => {
mockConfig.getFullContext = vi.fn().mockReturnValue(true);
const mockReadManyFilesTool = {
build: vi.fn().mockReturnValue({
execute: vi.fn().mockResolvedValue({ llmContent: '' }),
@@ -181,26 +156,10 @@ describe('getEnvironmentContext', () => {
});
it('should handle read_many_files tool not being found', async () => {
mockConfig.getFullContext = vi.fn().mockReturnValue(true);
mockToolRegistry.getTool.mockReturnValue(null);
const parts = await getEnvironmentContext(mockConfig as Config);
expect(parts.length).toBe(1); // No extra part added
});
it('should handle errors when reading full file context', async () => {
mockConfig.getFullContext = vi.fn().mockReturnValue(true);
const mockReadManyFilesTool = {
build: vi.fn().mockReturnValue({
execute: vi.fn().mockRejectedValue(new Error('Read error')),
}),
};
mockToolRegistry.getTool.mockReturnValue(mockReadManyFilesTool);
const parts = await getEnvironmentContext(mockConfig as Config);
expect(parts.length).toBe(2);
expect(parts[1].text).toBe('\n--- Error reading full file context ---');
});
});
@@ -68,42 +68,6 @@ ${directoryContext}
`.trim();
const initialParts: Part[] = [{ text: context }];
const toolRegistry = config.getToolRegistry();
// Add full file context if the flag is set
if (config.getFullContext()) {
try {
const readManyFilesTool = toolRegistry.getTool('read_many_files');
if (readManyFilesTool) {
const invocation = readManyFilesTool.build({
paths: ['**/*'], // Read everything recursively
useDefaultExcludes: true, // Use default excludes
});
// Read all files in the target directory
const result = await invocation.execute(AbortSignal.timeout(30000));
if (result.llmContent) {
initialParts.push({
text: `\n--- Full File Context ---\n${result.llmContent}`,
});
} else {
console.warn(
'Full context requested, but read_many_files returned no content.',
);
}
} else {
console.warn(
'Full context requested, but read_many_files tool not found.',
);
}
} catch (error) {
// Not using reportError here as it's a startup/config phase, not a chat/generation phase error.
console.error('Error reading full file context:', error);
initialParts.push({
text: '\n--- Error reading full file context ---',
});
}
}
return initialParts;
}