cleanup unused `allowBuildArtifacts` (#1010)
This commit is contained in:
parent
c886f08525
commit
34e0d9c0b6
|
@ -49,12 +49,10 @@ When you create a `.gemini/settings.json` file for project-specific settings, or
|
||||||
- **Description:** Controls git-aware file filtering behavior for @ commands and file discovery tools.
|
- **Description:** Controls git-aware file filtering behavior for @ commands and file discovery tools.
|
||||||
- **Properties:**
|
- **Properties:**
|
||||||
- **`respectGitIgnore`** (boolean, default: `true`): Whether to respect .gitignore patterns when discovering files. When enabled, git-ignored files (like `node_modules/`, `dist/`, `.env`) are automatically excluded from @ commands and file listing operations.
|
- **`respectGitIgnore`** (boolean, default: `true`): Whether to respect .gitignore patterns when discovering files. When enabled, git-ignored files (like `node_modules/`, `dist/`, `.env`) are automatically excluded from @ commands and file listing operations.
|
||||||
- **`allowBuildArtifacts`** (boolean, default: `false`): Whether to include build artifacts and generated files in file discovery operations.
|
|
||||||
- **Example:**
|
- **Example:**
|
||||||
```json
|
```json
|
||||||
"fileFiltering": {
|
"fileFiltering": {
|
||||||
"respectGitIgnore": true,
|
"respectGitIgnore": true,
|
||||||
"allowBuildArtifacts": false
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,6 @@ These are timestamped records of specific events.
|
||||||
- `code_assist_enabled` (boolean)
|
- `code_assist_enabled` (boolean)
|
||||||
- `log_user_prompts_enabled` (boolean)
|
- `log_user_prompts_enabled` (boolean)
|
||||||
- `file_filtering_respect_git_ignore` (boolean)
|
- `file_filtering_respect_git_ignore` (boolean)
|
||||||
- `file_filtering_allow_build_artifacts` (boolean)
|
|
||||||
- `debug_mode` (boolean)
|
- `debug_mode` (boolean)
|
||||||
- `mcp_servers` (string)
|
- `mcp_servers` (string)
|
||||||
|
|
||||||
|
|
|
@ -60,13 +60,11 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: undefined, // Should default to true
|
fileFilteringRespectGitIgnore: undefined, // Should default to true
|
||||||
fileFilteringAllowBuildArtifacts: undefined, // Should default to false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should load custom file filtering settings from configuration', async () => {
|
it('should load custom file filtering settings from configuration', async () => {
|
||||||
|
@ -78,13 +76,11 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: false,
|
fileFilteringRespectGitIgnore: false,
|
||||||
fileFilteringAllowBuildArtifacts: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should merge user and workspace file filtering settings', async () => {
|
it('should merge user and workspace file filtering settings', async () => {
|
||||||
|
@ -96,12 +92,10 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: true,
|
fileFilteringRespectGitIgnore: true,
|
||||||
fileFilteringAllowBuildArtifacts: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(true);
|
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -116,16 +110,12 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: false,
|
fileFilteringRespectGitIgnore: false,
|
||||||
fileFilteringAllowBuildArtifacts: undefined, // Should default to false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
// Specified settings should be applied
|
// Specified settings should be applied
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
||||||
|
|
||||||
// Missing settings should use defaults
|
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle empty configuration objects gracefully', async () => {
|
it('should handle empty configuration objects gracefully', async () => {
|
||||||
|
@ -137,14 +127,12 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: undefined,
|
fileFilteringRespectGitIgnore: undefined,
|
||||||
fileFilteringAllowBuildArtifacts: undefined,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
// All settings should use defaults
|
// All settings should use defaults
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle missing configuration sections gracefully', async () => {
|
it('should handle missing configuration sections gracefully', async () => {
|
||||||
|
@ -162,7 +150,6 @@ describe('Configuration Integration Tests', () => {
|
||||||
|
|
||||||
// All git-aware settings should use defaults
|
// All git-aware settings should use defaults
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(false);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -176,30 +163,11 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: true,
|
fileFilteringRespectGitIgnore: true,
|
||||||
fileFilteringAllowBuildArtifacts: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle a development-focused configuration', async () => {
|
|
||||||
const configParams: ConfigParameters = {
|
|
||||||
cwd: '/tmp',
|
|
||||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
|
||||||
embeddingModel: 'test-embedding-model',
|
|
||||||
sandbox: false,
|
|
||||||
targetDir: tempDir,
|
|
||||||
debugMode: false,
|
|
||||||
fileFilteringRespectGitIgnore: true,
|
|
||||||
fileFilteringAllowBuildArtifacts: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
const config = new Config(configParams);
|
|
||||||
|
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle a CI/CD environment configuration', async () => {
|
it('should handle a CI/CD environment configuration', async () => {
|
||||||
|
@ -211,13 +179,11 @@ describe('Configuration Integration Tests', () => {
|
||||||
targetDir: tempDir,
|
targetDir: tempDir,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
fileFilteringRespectGitIgnore: false, // CI might need to see all files
|
fileFilteringRespectGitIgnore: false, // CI might need to see all files
|
||||||
fileFilteringAllowBuildArtifacts: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = new Config(configParams);
|
const config = new Config(configParams);
|
||||||
|
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -195,8 +195,6 @@ export async function loadCliConfig(
|
||||||
: (settings.telemetry ?? false),
|
: (settings.telemetry ?? false),
|
||||||
// Git-aware file filtering settings
|
// Git-aware file filtering settings
|
||||||
fileFilteringRespectGitIgnore: settings.fileFiltering?.respectGitIgnore,
|
fileFilteringRespectGitIgnore: settings.fileFiltering?.respectGitIgnore,
|
||||||
fileFilteringAllowBuildArtifacts:
|
|
||||||
settings.fileFiltering?.allowBuildArtifacts,
|
|
||||||
checkpoint: argv.checkpoint,
|
checkpoint: argv.checkpoint,
|
||||||
proxy:
|
proxy:
|
||||||
process.env.HTTPS_PROXY ||
|
process.env.HTTPS_PROXY ||
|
||||||
|
|
|
@ -43,7 +43,6 @@ export interface Settings {
|
||||||
// Git-aware file filtering settings
|
// Git-aware file filtering settings
|
||||||
fileFiltering?: {
|
fileFiltering?: {
|
||||||
respectGitIgnore?: boolean;
|
respectGitIgnore?: boolean;
|
||||||
allowBuildArtifacts?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// UI setting. Does not display the ANSI-controlled terminal title.
|
// UI setting. Does not display the ANSI-controlled terminal title.
|
||||||
|
|
|
@ -21,7 +21,6 @@ const mockConfig = {
|
||||||
isSandboxed: vi.fn(() => false),
|
isSandboxed: vi.fn(() => false),
|
||||||
getFileService: vi.fn(),
|
getFileService: vi.fn(),
|
||||||
getFileFilteringRespectGitIgnore: vi.fn(() => true),
|
getFileFilteringRespectGitIgnore: vi.fn(() => true),
|
||||||
getFileFilteringAllowBuildArtifacts: vi.fn(() => false),
|
|
||||||
} as unknown as Config;
|
} as unknown as Config;
|
||||||
|
|
||||||
const mockReadManyFilesExecute = vi.fn();
|
const mockReadManyFilesExecute = vi.fn();
|
||||||
|
|
|
@ -47,7 +47,6 @@ describe('useCompletion git-aware filtering integration', () => {
|
||||||
|
|
||||||
mockConfig = {
|
mockConfig = {
|
||||||
getFileFilteringRespectGitIgnore: vi.fn(() => true),
|
getFileFilteringRespectGitIgnore: vi.fn(() => true),
|
||||||
getFileFilteringAllowBuildArtifacts: vi.fn(() => false),
|
|
||||||
getFileService: vi.fn().mockResolvedValue(mockFileDiscoveryService),
|
getFileService: vi.fn().mockResolvedValue(mockFileDiscoveryService),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,18 +106,15 @@ describe('Server Config (config.ts)', () => {
|
||||||
it('should set default file filtering settings when not provided', () => {
|
it('should set default file filtering settings when not provided', () => {
|
||||||
const config = new Config(baseParams);
|
const config = new Config(baseParams);
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set custom file filtering settings when provided', () => {
|
it('should set custom file filtering settings when provided', () => {
|
||||||
const paramsWithFileFiltering: ConfigParameters = {
|
const paramsWithFileFiltering: ConfigParameters = {
|
||||||
...baseParams,
|
...baseParams,
|
||||||
fileFilteringRespectGitIgnore: false,
|
fileFilteringRespectGitIgnore: false,
|
||||||
fileFilteringAllowBuildArtifacts: true,
|
|
||||||
};
|
};
|
||||||
const config = new Config(paramsWithFileFiltering);
|
const config = new Config(paramsWithFileFiltering);
|
||||||
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
||||||
expect(config.getFileFilteringAllowBuildArtifacts()).toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Config constructor should set telemetry to true when provided as true', () => {
|
it('Config constructor should set telemetry to true when provided as true', () => {
|
||||||
|
|
|
@ -81,7 +81,6 @@ export interface ConfigParameters {
|
||||||
telemetryLogUserPromptsEnabled?: boolean;
|
telemetryLogUserPromptsEnabled?: boolean;
|
||||||
telemetryOtlpEndpoint?: string;
|
telemetryOtlpEndpoint?: string;
|
||||||
fileFilteringRespectGitIgnore?: boolean;
|
fileFilteringRespectGitIgnore?: boolean;
|
||||||
fileFilteringAllowBuildArtifacts?: boolean;
|
|
||||||
checkpoint?: boolean;
|
checkpoint?: boolean;
|
||||||
proxy?: string;
|
proxy?: string;
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
@ -114,7 +113,6 @@ export class Config {
|
||||||
private readonly geminiClient: GeminiClient;
|
private readonly geminiClient: GeminiClient;
|
||||||
private readonly geminiIgnorePatterns: string[] = [];
|
private readonly geminiIgnorePatterns: string[] = [];
|
||||||
private readonly fileFilteringRespectGitIgnore: boolean;
|
private readonly fileFilteringRespectGitIgnore: boolean;
|
||||||
private readonly fileFilteringAllowBuildArtifacts: boolean;
|
|
||||||
private fileDiscoveryService: FileDiscoveryService | null = null;
|
private fileDiscoveryService: FileDiscoveryService | null = null;
|
||||||
private gitService: GitService | undefined = undefined;
|
private gitService: GitService | undefined = undefined;
|
||||||
private readonly checkpoint: boolean;
|
private readonly checkpoint: boolean;
|
||||||
|
@ -148,8 +146,6 @@ export class Config {
|
||||||
this.telemetryOtlpEndpoint = params.telemetryOtlpEndpoint ?? '';
|
this.telemetryOtlpEndpoint = params.telemetryOtlpEndpoint ?? '';
|
||||||
this.fileFilteringRespectGitIgnore =
|
this.fileFilteringRespectGitIgnore =
|
||||||
params.fileFilteringRespectGitIgnore ?? true;
|
params.fileFilteringRespectGitIgnore ?? true;
|
||||||
this.fileFilteringAllowBuildArtifacts =
|
|
||||||
params.fileFilteringAllowBuildArtifacts ?? false;
|
|
||||||
this.checkpoint = params.checkpoint ?? false;
|
this.checkpoint = params.checkpoint ?? false;
|
||||||
this.proxy = params.proxy;
|
this.proxy = params.proxy;
|
||||||
this.cwd = params.cwd ?? process.cwd();
|
this.cwd = params.cwd ?? process.cwd();
|
||||||
|
@ -296,10 +292,6 @@ export class Config {
|
||||||
return this.fileFilteringRespectGitIgnore;
|
return this.fileFilteringRespectGitIgnore;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileFilteringAllowBuildArtifacts(): boolean {
|
|
||||||
return this.fileFilteringAllowBuildArtifacts;
|
|
||||||
}
|
|
||||||
|
|
||||||
getCheckpointEnabled(): boolean {
|
getCheckpointEnabled(): boolean {
|
||||||
return this.checkpoint;
|
return this.checkpoint;
|
||||||
}
|
}
|
||||||
|
@ -317,7 +309,6 @@ export class Config {
|
||||||
this.fileDiscoveryService = new FileDiscoveryService(this.targetDir);
|
this.fileDiscoveryService = new FileDiscoveryService(this.targetDir);
|
||||||
await this.fileDiscoveryService.initialize({
|
await this.fileDiscoveryService.initialize({
|
||||||
respectGitIgnore: this.fileFilteringRespectGitIgnore,
|
respectGitIgnore: this.fileFilteringRespectGitIgnore,
|
||||||
includeBuildArtifacts: this.fileFilteringAllowBuildArtifacts,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this.fileDiscoveryService;
|
return this.fileDiscoveryService;
|
||||||
|
|
|
@ -62,7 +62,6 @@ describe('loggers', () => {
|
||||||
}),
|
}),
|
||||||
getTelemetryLogUserPromptsEnabled: () => true,
|
getTelemetryLogUserPromptsEnabled: () => true,
|
||||||
getFileFilteringRespectGitIgnore: () => true,
|
getFileFilteringRespectGitIgnore: () => true,
|
||||||
getFileFilteringAllowBuildArtifacts: () => false,
|
|
||||||
getDebugMode: () => true,
|
getDebugMode: () => true,
|
||||||
getMcpServers: () => ({
|
getMcpServers: () => ({
|
||||||
'test-server': {
|
'test-server': {
|
||||||
|
@ -90,7 +89,6 @@ describe('loggers', () => {
|
||||||
code_assist_enabled: false,
|
code_assist_enabled: false,
|
||||||
log_user_prompts_enabled: true,
|
log_user_prompts_enabled: true,
|
||||||
file_filtering_respect_git_ignore: true,
|
file_filtering_respect_git_ignore: true,
|
||||||
file_filtering_allow_build_artifacts: false,
|
|
||||||
debug_mode: true,
|
debug_mode: true,
|
||||||
mcp_servers: 'test-server',
|
mcp_servers: 'test-server',
|
||||||
},
|
},
|
||||||
|
|
|
@ -89,8 +89,6 @@ export function logCliConfiguration(config: Config): void {
|
||||||
log_user_prompts_enabled: config.getTelemetryLogUserPromptsEnabled(),
|
log_user_prompts_enabled: config.getTelemetryLogUserPromptsEnabled(),
|
||||||
file_filtering_respect_git_ignore:
|
file_filtering_respect_git_ignore:
|
||||||
config.getFileFilteringRespectGitIgnore(),
|
config.getFileFilteringRespectGitIgnore(),
|
||||||
file_filtering_allow_build_artifacts:
|
|
||||||
config.getFileFilteringAllowBuildArtifacts(),
|
|
||||||
debug_mode: config.getDebugMode(),
|
debug_mode: config.getDebugMode(),
|
||||||
mcp_servers: mcpServers ? Object.keys(mcpServers).join(',') : '',
|
mcp_servers: mcpServers ? Object.keys(mcpServers).join(',') : '',
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,7 +67,6 @@ export interface CliConfigEvent {
|
||||||
vertex_ai_enabled: boolean;
|
vertex_ai_enabled: boolean;
|
||||||
log_user_prompts_enabled: boolean;
|
log_user_prompts_enabled: boolean;
|
||||||
file_filtering_respect_git_ignore: boolean;
|
file_filtering_respect_git_ignore: boolean;
|
||||||
file_filtering_allow_build_artifacts: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TelemetryEvent =
|
export type TelemetryEvent =
|
||||||
|
|
|
@ -26,7 +26,6 @@ describe('GlobTool', () => {
|
||||||
return service;
|
return service;
|
||||||
},
|
},
|
||||||
getFileFilteringRespectGitIgnore: () => true,
|
getFileFilteringRespectGitIgnore: () => true,
|
||||||
getFileFilteringAllowBuildArtifacts: () => false,
|
|
||||||
} as Partial<Config> as Config;
|
} as Partial<Config> as Config;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|
|
@ -29,7 +29,6 @@ describe('ReadManyFilesTool', () => {
|
||||||
return service;
|
return service;
|
||||||
},
|
},
|
||||||
getFileFilteringRespectGitIgnore: () => true,
|
getFileFilteringRespectGitIgnore: () => true,
|
||||||
getFileFilteringAllowBuildArtifacts: () => false,
|
|
||||||
getGeminiIgnorePatterns: () => ['**/foo.bar', 'foo.baz', 'foo.*'],
|
getGeminiIgnorePatterns: () => ['**/foo.bar', 'foo.baz', 'foo.*'],
|
||||||
} as Partial<Config> as Config;
|
} as Partial<Config> as Config;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue