Add support for an additional exclusion file besides .gitignore and .geminiignore (#16487)

Co-authored-by: Adam Weidman <adamfweidman@google.com>
This commit is contained in:
Alisa
2026-01-27 17:19:13 -08:00
committed by GitHub
parent bde29518cd
commit 3b9af4b813
40 changed files with 1394 additions and 612 deletions
@@ -13,12 +13,12 @@ import { crawl } from './crawler.js';
import type { FzfResultItem } from 'fzf';
import { AsyncFzf } from 'fzf';
import { unescapePath } from '../paths.js';
import type { FileDiscoveryService } from '../../services/fileDiscoveryService.js';
export interface FileSearchOptions {
projectRoot: string;
ignoreDirs: string[];
useGitignore: boolean;
useGeminiignore: boolean;
fileDiscoveryService: FileDiscoveryService;
cache: boolean;
cacheTtl: number;
enableRecursiveFileSearch: boolean;
@@ -101,7 +101,10 @@ class RecursiveFileSearch implements FileSearch {
constructor(private readonly options: FileSearchOptions) {}
async initialize(): Promise<void> {
this.ignore = loadIgnoreRules(this.options);
this.ignore = loadIgnoreRules(
this.options.fileDiscoveryService,
this.options.ignoreDirs,
);
this.allFiles = await crawl({
crawlDirectory: this.options.projectRoot,
@@ -200,7 +203,10 @@ class DirectoryFileSearch implements FileSearch {
constructor(private readonly options: FileSearchOptions) {}
async initialize(): Promise<void> {
this.ignore = loadIgnoreRules(this.options);
this.ignore = loadIgnoreRules(
this.options.fileDiscoveryService,
this.options.ignoreDirs,
);
}
async search(