mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
fix(cli): Use correct defaults for file filtering (#11426)
This commit is contained in:
@@ -8,6 +8,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|||||||
import * as os from 'node:os';
|
import * as os from 'node:os';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import {
|
import {
|
||||||
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
||||||
DEFAULT_GEMINI_MODEL,
|
DEFAULT_GEMINI_MODEL,
|
||||||
DEFAULT_GEMINI_MODEL_AUTO,
|
DEFAULT_GEMINI_MODEL_AUTO,
|
||||||
OutputFormat,
|
OutputFormat,
|
||||||
@@ -583,6 +584,19 @@ describe('loadCliConfig', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should use default fileFilter options when unconfigured', async () => {
|
||||||
|
process.argv = ['node', 'script.js'];
|
||||||
|
const argv = await parseArguments({} as Settings);
|
||||||
|
const settings: Settings = {};
|
||||||
|
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
||||||
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(
|
||||||
|
DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
||||||
|
);
|
||||||
|
expect(config.getFileFilteringRespectGeminiIgnore()).toBe(
|
||||||
|
DEFAULT_FILE_FILTERING_OPTIONS.respectGeminiIgnore,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
|
describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
DEFAULT_GEMINI_MODEL,
|
DEFAULT_GEMINI_MODEL,
|
||||||
DEFAULT_GEMINI_MODEL_AUTO,
|
DEFAULT_GEMINI_MODEL_AUTO,
|
||||||
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
||||||
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
||||||
DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
||||||
FileDiscoveryService,
|
FileDiscoveryService,
|
||||||
WRITE_FILE_TOOL_NAME,
|
WRITE_FILE_TOOL_NAME,
|
||||||
@@ -394,11 +395,16 @@ export async function loadCliConfig(
|
|||||||
|
|
||||||
const fileService = new FileDiscoveryService(cwd);
|
const fileService = new FileDiscoveryService(cwd);
|
||||||
|
|
||||||
const fileFiltering = {
|
const memoryFileFiltering = {
|
||||||
...DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
...DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
||||||
...settings.context?.fileFiltering,
|
...settings.context?.fileFiltering,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fileFiltering = {
|
||||||
|
...DEFAULT_FILE_FILTERING_OPTIONS,
|
||||||
|
...settings.context?.fileFiltering,
|
||||||
|
};
|
||||||
|
|
||||||
const includeDirectories = (settings.context?.includeDirectories || [])
|
const includeDirectories = (settings.context?.includeDirectories || [])
|
||||||
.map(resolvePath)
|
.map(resolvePath)
|
||||||
.concat((argv.includeDirectories || []).map(resolvePath));
|
.concat((argv.includeDirectories || []).map(resolvePath));
|
||||||
@@ -416,7 +422,7 @@ export async function loadCliConfig(
|
|||||||
allExtensions,
|
allExtensions,
|
||||||
trustedFolder,
|
trustedFolder,
|
||||||
memoryImportFormat,
|
memoryImportFormat,
|
||||||
fileFiltering,
|
memoryFileFiltering,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mcpServers = mergeMcpServers(settings, allExtensions);
|
let mcpServers = mergeMcpServers(settings, allExtensions);
|
||||||
|
|||||||
Reference in New Issue
Block a user