From d13e039c19cc7b957c929d35d5a3851cc32e94e7 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 6 Feb 2026 08:53:22 +0000 Subject: [PATCH 1/4] feat: add respectGitIgnore setting to control .gitignore filtering across all file listing Adds a new `codebaseIndexRespectGitIgnore` setting (default: true) that controls whether .gitignore patterns are respected when listing files. This affects: - Code indexer scanner (original issue scope) - list_files tool (AI task file listings) - Environment details (workspace file context) - WorkspaceTracker (workspace file tracking) When disabled (false), only .rooignore is used for filtering, allowing gitignored files (e.g. external API headers) to be discovered and indexed. Changes: - packages/types: Add codebaseIndexRespectGitIgnore to schema and types - src/services/glob/list-files.ts: Add respectGitIgnore parameter - Pass --no-ignore-vcs to ripgrep when false - Skip gitignore patterns in createIgnoreInstance when false - src/services/code-index: Thread setting through manager, factory, scanner - src/core: Thread setting through ListFilesTool, getEnvironmentDetails - src/integrations/workspace: Thread setting through WorkspaceTracker - webview-ui: Add toggle in CodeIndexPopover advanced settings - i18n: Add English translations for new setting Closes #11249 --- packages/types/src/codebase-index.ts | 2 + packages/types/src/vscode-extension-host.ts | 1 + src/core/environment/getEnvironmentDetails.ts | 3 +- src/core/tools/ListFilesTool.ts | 6 +- src/core/webview/ClineProvider.ts | 2 + src/core/webview/webviewMessageHandler.ts | 1 + .../workspace/WorkspaceTracker.ts | 9 ++- .../__tests__/WorkspaceTracker.spec.ts | 2 +- src/services/code-index/manager.ts | 38 ++++++++----- src/services/code-index/processors/scanner.ts | 10 +++- src/services/code-index/service-factory.ts | 14 ++++- src/services/glob/__mocks__/list-files.ts | 3 +- src/services/glob/list-files.ts | 55 ++++++++++++++----- .../src/components/chat/CodeIndexPopover.tsx | 21 +++++++ webview-ui/src/i18n/locales/en/settings.json | 2 + 15 files changed, 132 insertions(+), 37 deletions(-) diff --git a/packages/types/src/codebase-index.ts b/packages/types/src/codebase-index.ts index 61009ba301..1babc7244d 100644 --- a/packages/types/src/codebase-index.ts +++ b/packages/types/src/codebase-index.ts @@ -50,6 +50,8 @@ export const codebaseIndexConfigSchema = z.object({ codebaseIndexBedrockProfile: z.string().optional(), // OpenRouter specific fields codebaseIndexOpenRouterSpecificProvider: z.string().optional(), + // Gitignore behavior + codebaseIndexRespectGitIgnore: z.boolean().optional(), }) export type CodebaseIndexConfig = z.infer diff --git a/packages/types/src/vscode-extension-host.ts b/packages/types/src/vscode-extension-host.ts index fa2f04c0e5..5936fa4190 100644 --- a/packages/types/src/vscode-extension-host.ts +++ b/packages/types/src/vscode-extension-host.ts @@ -695,6 +695,7 @@ export interface WebviewMessage { codebaseIndexSearchMaxResults?: number codebaseIndexSearchMinScore?: number codebaseIndexOpenRouterSpecificProvider?: string // OpenRouter provider routing + codebaseIndexRespectGitIgnore?: boolean // Whether to respect .gitignore when listing files // Secret settings codeIndexOpenAiKey?: string diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index 4de2e20e37..e829df0050 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -270,7 +270,8 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo if (maxFiles === 0) { details += "(Workspace files context disabled. Use list_files to explore if needed.)" } else { - const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles) + const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles, respectGitIgnore) const { showRooIgnoredFiles = false } = state ?? {} const result = formatResponse.formatFilesList( diff --git a/src/core/tools/ListFilesTool.ts b/src/core/tools/ListFilesTool.ts index 716d7ed784..7d92734ba4 100644 --- a/src/core/tools/ListFilesTool.ts +++ b/src/core/tools/ListFilesTool.ts @@ -37,8 +37,10 @@ export class ListFilesTool extends BaseTool<"list_files"> { const absolutePath = path.resolve(task.cwd, relDirPath) const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath) - const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200) - const { showRooIgnoredFiles = false } = (await task.providerRef.deref()?.getState()) ?? {} + const state = await task.providerRef.deref()?.getState() + const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200, respectGitIgnore) + const { showRooIgnoredFiles = false } = state ?? {} const result = formatResponse.formatFilesList( absolutePath, diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 84cc76825f..2245dd6f5c 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2211,6 +2211,7 @@ export class ClineProvider codebaseIndexBedrockRegion: codebaseIndexConfig?.codebaseIndexBedrockRegion, codebaseIndexBedrockProfile: codebaseIndexConfig?.codebaseIndexBedrockProfile, codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider, + codebaseIndexRespectGitIgnore: codebaseIndexConfig?.codebaseIndexRespectGitIgnore, }, // Only set mdmCompliant if there's an actual MDM policy // undefined means no MDM policy, true means compliant, false means non-compliant @@ -2450,6 +2451,7 @@ export class ClineProvider codebaseIndexBedrockProfile: stateValues.codebaseIndexConfig?.codebaseIndexBedrockProfile, codebaseIndexOpenRouterSpecificProvider: stateValues.codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider, + codebaseIndexRespectGitIgnore: stateValues.codebaseIndexConfig?.codebaseIndexRespectGitIgnore, }, profileThresholds: stateValues.profileThresholds ?? {}, includeDiagnosticMessages: stateValues.includeDiagnosticMessages ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 75f1ce0ff4..c81b30db04 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2543,6 +2543,7 @@ export const webviewMessageHandler = async ( codebaseIndexSearchMaxResults: settings.codebaseIndexSearchMaxResults, codebaseIndexSearchMinScore: settings.codebaseIndexSearchMinScore, codebaseIndexOpenRouterSpecificProvider: settings.codebaseIndexOpenRouterSpecificProvider, + codebaseIndexRespectGitIgnore: settings.codebaseIndexRespectGitIgnore, } // Save global state first diff --git a/src/integrations/workspace/WorkspaceTracker.ts b/src/integrations/workspace/WorkspaceTracker.ts index 546cd97cd1..46475efd24 100644 --- a/src/integrations/workspace/WorkspaceTracker.ts +++ b/src/integrations/workspace/WorkspaceTracker.ts @@ -30,7 +30,14 @@ class WorkspaceTracker { return } const tempCwd = this.cwd - const [files, _] = await listFiles(tempCwd, true, MAX_INITIAL_FILES) + let respectGitIgnore = true + try { + const state = await this.providerRef.deref()?.getState() + respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + } catch { + // Fall back to default (respect .gitignore) if state is not available + } + const [files, _] = await listFiles(tempCwd, true, MAX_INITIAL_FILES, respectGitIgnore) if (this.prevWorkSpacePath !== tempCwd) { return } diff --git a/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts b/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts index b0a617d970..a329ef1ab1 100644 --- a/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts +++ b/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts @@ -240,7 +240,7 @@ describe("WorkspaceTracker", () => { vitest.runAllTimers() // Should initialize file paths for new workspace - expect(listFiles).toHaveBeenCalledWith("/test/new-workspace", true, 1000) + expect(listFiles).toHaveBeenCalledWith("/test/new-workspace", true, 1000, true) vitest.runAllTimers() }) diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index dd79a3f161..e606000290 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -312,20 +312,31 @@ export class CodeIndexManager { return } - // Create .gitignore instance - const ignorePath = path.join(workspacePath, ".gitignore") + // Read the respectGitIgnore setting from the codebaseIndexConfig + let respectGitIgnore = true try { - const content = await fs.readFile(ignorePath, "utf8") - ignoreInstance.add(content) - ignoreInstance.add(".gitignore") - } catch (error) { - // Should never happen: reading file failed even though it exists - console.error("Unexpected error loading .gitignore:", error) - TelemetryService.instance.captureEvent(TelemetryEventName.CODE_INDEX_ERROR, { - error: error instanceof Error ? error.message : String(error), - stack: error instanceof Error ? error.stack : undefined, - location: "_recreateServices", - }) + const codebaseIndexConfig = this._configManager!.getContextProxy()?.getGlobalState("codebaseIndexConfig") + respectGitIgnore = codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + } catch { + // Fall back to default (respect .gitignore) if config proxy is not available + } + + // Create .gitignore instance (only when respecting .gitignore) + if (respectGitIgnore) { + const ignorePath = path.join(workspacePath, ".gitignore") + try { + const content = await fs.readFile(ignorePath, "utf8") + ignoreInstance.add(content) + ignoreInstance.add(".gitignore") + } catch (error) { + // Should never happen: reading file failed even though it exists + console.error("Unexpected error loading .gitignore:", error) + TelemetryService.instance.captureEvent(TelemetryEventName.CODE_INDEX_ERROR, { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, + location: "_recreateServices", + }) + } } // Create RooIgnoreController instance @@ -338,6 +349,7 @@ export class CodeIndexManager { this._cacheManager!, ignoreInstance, rooIgnoreController, + respectGitIgnore, ) // Validate embedder configuration before proceeding diff --git a/src/services/code-index/processors/scanner.ts b/src/services/code-index/processors/scanner.ts index 91689a56d7..5c8141c674 100644 --- a/src/services/code-index/processors/scanner.ts +++ b/src/services/code-index/processors/scanner.ts @@ -41,6 +41,7 @@ export class DirectoryScanner implements IDirectoryScanner { private readonly cacheManager: CacheManager, private readonly ignoreInstance: Ignore, batchSegmentThreshold?: number, + private readonly respectGitIgnore: boolean = true, ) { // Get the configurable batch size from VSCode settings, fallback to default // If not provided in constructor, try to get from VSCode settings @@ -76,8 +77,13 @@ export class DirectoryScanner implements IDirectoryScanner { // Capture workspace context at scan start const scanWorkspace = getWorkspacePathForContext(directoryPath) - // Get all files recursively (handles .gitignore automatically) - const [allPaths, _] = await listFiles(directoryPath, true, MAX_LIST_FILES_LIMIT_CODE_INDEX) + // Get all files recursively (handles .gitignore based on respectGitIgnore setting) + const [allPaths, _] = await listFiles( + directoryPath, + true, + MAX_LIST_FILES_LIMIT_CODE_INDEX, + this.respectGitIgnore, + ) // Filter out directories (marked with trailing '/') const filePaths = allPaths.filter((p) => !p.endsWith("/")) diff --git a/src/services/code-index/service-factory.ts b/src/services/code-index/service-factory.ts index d23eff4810..b26c83b4c6 100644 --- a/src/services/code-index/service-factory.ts +++ b/src/services/code-index/service-factory.ts @@ -181,6 +181,7 @@ export class CodeIndexServiceFactory { vectorStore: IVectorStore, parser: ICodeParser, ignoreInstance: Ignore, + respectGitIgnore: boolean = true, ): DirectoryScanner { // Get the configurable batch size from VSCode settings let batchSize: number @@ -192,7 +193,15 @@ export class CodeIndexServiceFactory { // In test environment, vscode.workspace might not be available batchSize = BATCH_SEGMENT_THRESHOLD } - return new DirectoryScanner(embedder, vectorStore, parser, this.cacheManager, ignoreInstance, batchSize) + return new DirectoryScanner( + embedder, + vectorStore, + parser, + this.cacheManager, + ignoreInstance, + batchSize, + respectGitIgnore, + ) } /** @@ -237,6 +246,7 @@ export class CodeIndexServiceFactory { cacheManager: CacheManager, ignoreInstance: Ignore, rooIgnoreController?: RooIgnoreController, + respectGitIgnore: boolean = true, ): { embedder: IEmbedder vectorStore: IVectorStore @@ -251,7 +261,7 @@ export class CodeIndexServiceFactory { const embedder = this.createEmbedder() const vectorStore = this.createVectorStore() const parser = codeParser - const scanner = this.createDirectoryScanner(embedder, vectorStore, parser, ignoreInstance) + const scanner = this.createDirectoryScanner(embedder, vectorStore, parser, ignoreInstance, respectGitIgnore) const fileWatcher = this.createFileWatcher( context, embedder, diff --git a/src/services/glob/__mocks__/list-files.ts b/src/services/glob/__mocks__/list-files.ts index d798762691..c1f58e1158 100644 --- a/src/services/glob/__mocks__/list-files.ts +++ b/src/services/glob/__mocks__/list-files.ts @@ -28,9 +28,10 @@ const mockResolve = (dirPath: string): string => { * @param dirPath - Directory path to list files from * @param recursive - Whether to list files recursively * @param limit - Maximum number of files to return + * @param _respectGitIgnore - Whether to respect .gitignore (ignored in mock) * @returns Promise resolving to [file paths, limit reached flag] */ -export const listFiles = vi.fn((dirPath: string, _recursive: boolean, limit: number) => { +export const listFiles = vi.fn((dirPath: string, _recursive: boolean, limit: number, _respectGitIgnore?: boolean) => { // Early return for limit of 0 - matches the actual implementation if (limit === 0) { return Promise.resolve([[], false]) diff --git a/src/services/glob/list-files.ts b/src/services/glob/list-files.ts index 5366bbb84b..bb5da863f4 100644 --- a/src/services/glob/list-files.ts +++ b/src/services/glob/list-files.ts @@ -28,9 +28,15 @@ interface ScanContext { * @param dirPath - Directory path to list files from * @param recursive - Whether to recursively list files in subdirectories * @param limit - Maximum number of files to return + * @param respectGitIgnore - Whether to respect .gitignore when listing files (default: true) * @returns Tuple of [file paths array, whether the limit was reached] */ -export async function listFiles(dirPath: string, recursive: boolean, limit: number): Promise<[string[], boolean]> { +export async function listFiles( + dirPath: string, + recursive: boolean, + limit: number, + respectGitIgnore: boolean = true, +): Promise<[string[], boolean]> { // Early return for limit of 0 - no need to scan anything if (limit === 0) { return [[], false] @@ -48,8 +54,8 @@ export async function listFiles(dirPath: string, recursive: boolean, limit: numb if (!recursive) { // For non-recursive, use the existing approach - const files = await listFilesWithRipgrep(rgPath, dirPath, false, limit) - const ignoreInstance = await createIgnoreInstance(dirPath) + const files = await listFilesWithRipgrep(rgPath, dirPath, false, limit, respectGitIgnore) + const ignoreInstance = await createIgnoreInstance(dirPath, respectGitIgnore) // Calculate remaining limit for directories const remainingLimit = Math.max(0, limit - files.length) const directories = await listFilteredDirectories(dirPath, false, ignoreInstance, remainingLimit) @@ -57,8 +63,8 @@ export async function listFiles(dirPath: string, recursive: boolean, limit: numb } // For recursive mode, use the original approach but ensure first-level directories are included - const files = await listFilesWithRipgrep(rgPath, dirPath, true, limit) - const ignoreInstance = await createIgnoreInstance(dirPath) + const files = await listFilesWithRipgrep(rgPath, dirPath, true, limit, respectGitIgnore) + const ignoreInstance = await createIgnoreInstance(dirPath, respectGitIgnore) // Calculate remaining limit for directories const remainingLimit = Math.max(0, limit - files.length) const directories = await listFilteredDirectories(dirPath, true, ignoreInstance, remainingLimit) @@ -202,8 +208,9 @@ async function listFilesWithRipgrep( dirPath: string, recursive: boolean, limit: number, + respectGitIgnore: boolean = true, ): Promise { - const rgArgs = buildRipgrepArgs(dirPath, recursive) + const rgArgs = buildRipgrepArgs(dirPath, recursive, respectGitIgnore) const relativePaths = await execRipgrep(rgPath, rgArgs, limit) @@ -216,25 +223,30 @@ async function listFilesWithRipgrep( /** * Build appropriate ripgrep arguments based on whether we're doing a recursive search */ -function buildRipgrepArgs(dirPath: string, recursive: boolean): string[] { +function buildRipgrepArgs(dirPath: string, recursive: boolean, respectGitIgnore: boolean = true): string[] { // Base arguments to list files const args = ["--files", "--hidden", "--follow"] + // When not respecting .gitignore, tell ripgrep to skip VCS ignore files + if (!respectGitIgnore) { + args.push("--no-ignore-vcs") + } + if (recursive) { - return [...args, ...buildRecursiveArgs(dirPath), dirPath] + return [...args, ...buildRecursiveArgs(dirPath, respectGitIgnore), dirPath] } else { - return [...args, ...buildNonRecursiveArgs(), dirPath] + return [...args, ...buildNonRecursiveArgs(respectGitIgnore), dirPath] } } /** * Build ripgrep arguments for recursive directory traversal */ -function buildRecursiveArgs(dirPath: string): string[] { +function buildRecursiveArgs(dirPath: string, respectGitIgnore: boolean = true): string[] { const args: string[] = [] // In recursive mode, respect .gitignore by default - // (ripgrep does this automatically) + // (ripgrep does this automatically when respectGitIgnore is true) // Check if we're explicitly targeting a hidden directory // Normalize the path first to handle edge cases @@ -295,7 +307,7 @@ function buildRecursiveArgs(dirPath: string): string[] { /** * Build ripgrep arguments for non-recursive directory listing */ -function buildNonRecursiveArgs(): string[] { +function buildNonRecursiveArgs(respectGitIgnore: boolean = true): string[] { const args: string[] = [] // For non-recursive, limit to the current directory level @@ -303,7 +315,8 @@ function buildNonRecursiveArgs(): string[] { args.push("--maxdepth", "1") // ripgrep uses maxdepth, not max-depth // Respect .gitignore in non-recursive mode too - // (ripgrep respects .gitignore by default) + // (ripgrep respects .gitignore by default when respectGitIgnore is true; + // --no-ignore-vcs is added at a higher level when respectGitIgnore is false) // Apply directory exclusions for non-recursive searches for (const dir of DIRS_TO_IGNORE) { @@ -326,9 +339,23 @@ function buildNonRecursiveArgs(): string[] { /** * Create an ignore instance that handles .gitignore files properly * This replaces the custom gitignore parsing with the proper ignore library + * + * @param dirPath - Directory path to create ignore instance for + * @param respectGitIgnore - Whether to load .gitignore patterns (default: true). + * When false, returns an empty ignore instance so no gitignore filtering is applied. */ -async function createIgnoreInstance(dirPath: string): Promise> { +async function createIgnoreInstance( + dirPath: string, + respectGitIgnore: boolean = true, +): Promise> { const ignoreInstance = ignore() + + // When not respecting .gitignore, return an empty ignore instance + // so no gitignore-based filtering is applied to directories + if (!respectGitIgnore) { + return ignoreInstance + } + const absolutePath = path.resolve(dirPath) // Find all .gitignore files from the target directory up to the root diff --git a/webview-ui/src/components/chat/CodeIndexPopover.tsx b/webview-ui/src/components/chat/CodeIndexPopover.tsx index 4fcf6406e3..4bcfadfa31 100644 --- a/webview-ui/src/components/chat/CodeIndexPopover.tsx +++ b/webview-ui/src/components/chat/CodeIndexPopover.tsx @@ -81,6 +81,7 @@ interface LocalCodeIndexSettings { codebaseIndexVercelAiGatewayApiKey?: string codebaseIndexOpenRouterApiKey?: string codebaseIndexOpenRouterSpecificProvider?: string + codebaseIndexRespectGitIgnore?: boolean } // Validation schema for codebase index settings @@ -225,6 +226,7 @@ export const CodeIndexPopover: React.FC = ({ codebaseIndexVercelAiGatewayApiKey: "", codebaseIndexOpenRouterApiKey: "", codebaseIndexOpenRouterSpecificProvider: "", + codebaseIndexRespectGitIgnore: true, }) // Initial settings state - stores the settings when popover opens @@ -265,6 +267,7 @@ export const CodeIndexPopover: React.FC = ({ codebaseIndexOpenRouterApiKey: "", codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig.codebaseIndexOpenRouterSpecificProvider || "", + codebaseIndexRespectGitIgnore: codebaseIndexConfig.codebaseIndexRespectGitIgnore ?? true, } setInitialSettings(settings) setCurrentSettings(settings) @@ -1586,6 +1589,24 @@ export const CodeIndexPopover: React.FC = ({ + {/* Respect .gitignore toggle */} +
+
+ + updateSetting("codebaseIndexRespectGitIgnore", e.target.checked) + }> + + {t("settings:codeIndex.respectGitIgnoreLabel")} + + + + + +
+
)} diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index c134268042..1822c41950 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -230,6 +230,8 @@ "searchMaxResultsLabel": "Maximum Search Results", "searchMaxResultsDescription": "Maximum number of search results to return when querying the codebase index. Higher values provide more context but may include less relevant results.", "resetToDefault": "Reset to default", + "respectGitIgnoreLabel": "Respect .gitignore", + "respectGitIgnoreDescription": "When enabled, files listed in .gitignore are excluded from indexing and file listings. When disabled, only .rooignore is used for filtering, allowing gitignored files to be indexed and discovered by Roo Code.", "startIndexingButton": "Start Indexing", "clearIndexDataButton": "Clear Index Data", "unsavedSettingsMessage": "Please save your settings before starting the indexing process.", From 7973a571f514f2ceca1c037d6a5731ebad7e21b9 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 6 Feb 2026 09:11:06 +0000 Subject: [PATCH 2/4] fix: rename setting to respectGitIgnore, add restart tracking, remove dead params --- packages/types/src/codebase-index.ts | 2 +- packages/types/src/vscode-extension-host.ts | 2 +- src/core/environment/getEnvironmentDetails.ts | 2 +- src/core/tools/ListFilesTool.ts | 2 +- src/core/webview/ClineProvider.ts | 4 ++-- src/core/webview/webviewMessageHandler.ts | 2 +- src/integrations/workspace/WorkspaceTracker.ts | 2 +- src/services/code-index/config-manager.ts | 9 +++++++++ src/services/code-index/interfaces/config.ts | 1 + src/services/code-index/manager.ts | 2 +- src/services/glob/list-files.ts | 13 ++++++------- webview-ui/src/components/chat/CodeIndexPopover.tsx | 10 +++++----- 12 files changed, 30 insertions(+), 21 deletions(-) diff --git a/packages/types/src/codebase-index.ts b/packages/types/src/codebase-index.ts index 1babc7244d..90bd42a82d 100644 --- a/packages/types/src/codebase-index.ts +++ b/packages/types/src/codebase-index.ts @@ -51,7 +51,7 @@ export const codebaseIndexConfigSchema = z.object({ // OpenRouter specific fields codebaseIndexOpenRouterSpecificProvider: z.string().optional(), // Gitignore behavior - codebaseIndexRespectGitIgnore: z.boolean().optional(), + respectGitIgnore: z.boolean().optional(), }) export type CodebaseIndexConfig = z.infer diff --git a/packages/types/src/vscode-extension-host.ts b/packages/types/src/vscode-extension-host.ts index 5936fa4190..c293150bfa 100644 --- a/packages/types/src/vscode-extension-host.ts +++ b/packages/types/src/vscode-extension-host.ts @@ -695,7 +695,7 @@ export interface WebviewMessage { codebaseIndexSearchMaxResults?: number codebaseIndexSearchMinScore?: number codebaseIndexOpenRouterSpecificProvider?: string // OpenRouter provider routing - codebaseIndexRespectGitIgnore?: boolean // Whether to respect .gitignore when listing files + respectGitIgnore?: boolean // Whether to respect .gitignore when listing files // Secret settings codeIndexOpenAiKey?: string diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index e829df0050..cb88e00ced 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -270,7 +270,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo if (maxFiles === 0) { details += "(Workspace files context disabled. Use list_files to explore if needed.)" } else { - const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + const respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles, respectGitIgnore) const { showRooIgnoredFiles = false } = state ?? {} diff --git a/src/core/tools/ListFilesTool.ts b/src/core/tools/ListFilesTool.ts index 7d92734ba4..f9e95766a5 100644 --- a/src/core/tools/ListFilesTool.ts +++ b/src/core/tools/ListFilesTool.ts @@ -38,7 +38,7 @@ export class ListFilesTool extends BaseTool<"list_files"> { const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath) const state = await task.providerRef.deref()?.getState() - const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + const respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200, respectGitIgnore) const { showRooIgnoredFiles = false } = state ?? {} diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 2245dd6f5c..153b785d97 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2211,7 +2211,7 @@ export class ClineProvider codebaseIndexBedrockRegion: codebaseIndexConfig?.codebaseIndexBedrockRegion, codebaseIndexBedrockProfile: codebaseIndexConfig?.codebaseIndexBedrockProfile, codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider, - codebaseIndexRespectGitIgnore: codebaseIndexConfig?.codebaseIndexRespectGitIgnore, + respectGitIgnore: codebaseIndexConfig?.respectGitIgnore, }, // Only set mdmCompliant if there's an actual MDM policy // undefined means no MDM policy, true means compliant, false means non-compliant @@ -2451,7 +2451,7 @@ export class ClineProvider codebaseIndexBedrockProfile: stateValues.codebaseIndexConfig?.codebaseIndexBedrockProfile, codebaseIndexOpenRouterSpecificProvider: stateValues.codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider, - codebaseIndexRespectGitIgnore: stateValues.codebaseIndexConfig?.codebaseIndexRespectGitIgnore, + respectGitIgnore: stateValues.codebaseIndexConfig?.respectGitIgnore, }, profileThresholds: stateValues.profileThresholds ?? {}, includeDiagnosticMessages: stateValues.includeDiagnosticMessages ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index c81b30db04..3d9b7a9267 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2543,7 +2543,7 @@ export const webviewMessageHandler = async ( codebaseIndexSearchMaxResults: settings.codebaseIndexSearchMaxResults, codebaseIndexSearchMinScore: settings.codebaseIndexSearchMinScore, codebaseIndexOpenRouterSpecificProvider: settings.codebaseIndexOpenRouterSpecificProvider, - codebaseIndexRespectGitIgnore: settings.codebaseIndexRespectGitIgnore, + respectGitIgnore: settings.respectGitIgnore, } // Save global state first diff --git a/src/integrations/workspace/WorkspaceTracker.ts b/src/integrations/workspace/WorkspaceTracker.ts index 46475efd24..6bd2f2aa3d 100644 --- a/src/integrations/workspace/WorkspaceTracker.ts +++ b/src/integrations/workspace/WorkspaceTracker.ts @@ -33,7 +33,7 @@ class WorkspaceTracker { let respectGitIgnore = true try { const state = await this.providerRef.deref()?.getState() - respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true } catch { // Fall back to default (respect .gitignore) if state is not available } diff --git a/src/services/code-index/config-manager.ts b/src/services/code-index/config-manager.ts index e7f239e621..54769e2dfb 100644 --- a/src/services/code-index/config-manager.ts +++ b/src/services/code-index/config-manager.ts @@ -26,6 +26,7 @@ export class CodeIndexConfigManager { private qdrantApiKey?: string private searchMinScore?: number private searchMaxResults?: number + private respectGitIgnore: boolean = true constructor(private readonly contextProxy: ContextProxy) { // Initialize with current configuration to avoid false restart triggers @@ -86,6 +87,7 @@ export class CodeIndexConfigManager { this.qdrantApiKey = qdrantApiKey ?? "" this.searchMinScore = codebaseIndexSearchMinScore this.searchMaxResults = codebaseIndexSearchMaxResults + this.respectGitIgnore = codebaseIndexConfig.respectGitIgnore ?? true // Validate and set model dimension const rawDimension = codebaseIndexConfig.codebaseIndexEmbedderModelDimension @@ -194,6 +196,7 @@ export class CodeIndexConfigManager { openRouterSpecificProvider: this.openRouterOptions?.specificProvider ?? "", qdrantUrl: this.qdrantUrl ?? "", qdrantApiKey: this.qdrantApiKey ?? "", + respectGitIgnore: this.respectGitIgnore, } // Refresh secrets from VSCode storage to ensure we have the latest values @@ -410,6 +413,12 @@ export class CodeIndexConfigManager { return true } + // respectGitIgnore change + const prevRespectGitIgnore = prev?.respectGitIgnore ?? true + if (prevRespectGitIgnore !== this.respectGitIgnore) { + return true + } + return false } diff --git a/src/services/code-index/interfaces/config.ts b/src/services/code-index/interfaces/config.ts index f52f98aaa0..ec2244c8e6 100644 --- a/src/services/code-index/interfaces/config.ts +++ b/src/services/code-index/interfaces/config.ts @@ -45,4 +45,5 @@ export type PreviousConfigSnapshot = { openRouterSpecificProvider?: string qdrantUrl?: string qdrantApiKey?: string + respectGitIgnore?: boolean } diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index e606000290..3bcfc395be 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -316,7 +316,7 @@ export class CodeIndexManager { let respectGitIgnore = true try { const codebaseIndexConfig = this._configManager!.getContextProxy()?.getGlobalState("codebaseIndexConfig") - respectGitIgnore = codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true + respectGitIgnore = codebaseIndexConfig?.respectGitIgnore ?? true } catch { // Fall back to default (respect .gitignore) if config proxy is not available } diff --git a/src/services/glob/list-files.ts b/src/services/glob/list-files.ts index bb5da863f4..76ed0067d4 100644 --- a/src/services/glob/list-files.ts +++ b/src/services/glob/list-files.ts @@ -233,20 +233,20 @@ function buildRipgrepArgs(dirPath: string, recursive: boolean, respectGitIgnore: } if (recursive) { - return [...args, ...buildRecursiveArgs(dirPath, respectGitIgnore), dirPath] + return [...args, ...buildRecursiveArgs(dirPath), dirPath] } else { - return [...args, ...buildNonRecursiveArgs(respectGitIgnore), dirPath] + return [...args, ...buildNonRecursiveArgs(), dirPath] } } /** * Build ripgrep arguments for recursive directory traversal */ -function buildRecursiveArgs(dirPath: string, respectGitIgnore: boolean = true): string[] { +function buildRecursiveArgs(dirPath: string): string[] { const args: string[] = [] // In recursive mode, respect .gitignore by default - // (ripgrep does this automatically when respectGitIgnore is true) + // (ripgrep does this automatically; --no-ignore-vcs is added at buildRipgrepArgs level when needed) // Check if we're explicitly targeting a hidden directory // Normalize the path first to handle edge cases @@ -307,7 +307,7 @@ function buildRecursiveArgs(dirPath: string, respectGitIgnore: boolean = true): /** * Build ripgrep arguments for non-recursive directory listing */ -function buildNonRecursiveArgs(respectGitIgnore: boolean = true): string[] { +function buildNonRecursiveArgs(): string[] { const args: string[] = [] // For non-recursive, limit to the current directory level @@ -315,8 +315,7 @@ function buildNonRecursiveArgs(respectGitIgnore: boolean = true): string[] { args.push("--maxdepth", "1") // ripgrep uses maxdepth, not max-depth // Respect .gitignore in non-recursive mode too - // (ripgrep respects .gitignore by default when respectGitIgnore is true; - // --no-ignore-vcs is added at a higher level when respectGitIgnore is false) + // (ripgrep respects .gitignore by default; --no-ignore-vcs is added at buildRipgrepArgs level when needed) // Apply directory exclusions for non-recursive searches for (const dir of DIRS_TO_IGNORE) { diff --git a/webview-ui/src/components/chat/CodeIndexPopover.tsx b/webview-ui/src/components/chat/CodeIndexPopover.tsx index 4bcfadfa31..da51f81dd2 100644 --- a/webview-ui/src/components/chat/CodeIndexPopover.tsx +++ b/webview-ui/src/components/chat/CodeIndexPopover.tsx @@ -81,7 +81,7 @@ interface LocalCodeIndexSettings { codebaseIndexVercelAiGatewayApiKey?: string codebaseIndexOpenRouterApiKey?: string codebaseIndexOpenRouterSpecificProvider?: string - codebaseIndexRespectGitIgnore?: boolean + respectGitIgnore?: boolean } // Validation schema for codebase index settings @@ -226,7 +226,7 @@ export const CodeIndexPopover: React.FC = ({ codebaseIndexVercelAiGatewayApiKey: "", codebaseIndexOpenRouterApiKey: "", codebaseIndexOpenRouterSpecificProvider: "", - codebaseIndexRespectGitIgnore: true, + respectGitIgnore: true, }) // Initial settings state - stores the settings when popover opens @@ -267,7 +267,7 @@ export const CodeIndexPopover: React.FC = ({ codebaseIndexOpenRouterApiKey: "", codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig.codebaseIndexOpenRouterSpecificProvider || "", - codebaseIndexRespectGitIgnore: codebaseIndexConfig.codebaseIndexRespectGitIgnore ?? true, + respectGitIgnore: codebaseIndexConfig.respectGitIgnore ?? true, } setInitialSettings(settings) setCurrentSettings(settings) @@ -1593,9 +1593,9 @@ export const CodeIndexPopover: React.FC = ({
- updateSetting("codebaseIndexRespectGitIgnore", e.target.checked) + updateSetting("respectGitIgnore", e.target.checked) }> {t("settings:codeIndex.respectGitIgnoreLabel")} From f8cee2b1e4b785ad35bd98a5b445fdd2de87d00d Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 18 Feb 2026 02:08:45 +0000 Subject: [PATCH 3/4] fix: rename respectGitIgnore back to codebaseIndexRespectGitIgnore for consistency --- packages/types/src/codebase-index.ts | 2 +- packages/types/src/vscode-extension-host.ts | 2 +- src/core/environment/getEnvironmentDetails.ts | 2 +- src/core/tools/ListFilesTool.ts | 2 +- src/core/webview/ClineProvider.ts | 4 ++-- src/core/webview/webviewMessageHandler.ts | 2 +- src/integrations/workspace/WorkspaceTracker.ts | 2 +- src/services/code-index/config-manager.ts | 12 ++++++------ src/services/code-index/interfaces/config.ts | 2 +- src/services/code-index/manager.ts | 2 +- webview-ui/src/components/chat/CodeIndexPopover.tsx | 10 +++++----- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/types/src/codebase-index.ts b/packages/types/src/codebase-index.ts index 90bd42a82d..1babc7244d 100644 --- a/packages/types/src/codebase-index.ts +++ b/packages/types/src/codebase-index.ts @@ -51,7 +51,7 @@ export const codebaseIndexConfigSchema = z.object({ // OpenRouter specific fields codebaseIndexOpenRouterSpecificProvider: z.string().optional(), // Gitignore behavior - respectGitIgnore: z.boolean().optional(), + codebaseIndexRespectGitIgnore: z.boolean().optional(), }) export type CodebaseIndexConfig = z.infer diff --git a/packages/types/src/vscode-extension-host.ts b/packages/types/src/vscode-extension-host.ts index c293150bfa..5936fa4190 100644 --- a/packages/types/src/vscode-extension-host.ts +++ b/packages/types/src/vscode-extension-host.ts @@ -695,7 +695,7 @@ export interface WebviewMessage { codebaseIndexSearchMaxResults?: number codebaseIndexSearchMinScore?: number codebaseIndexOpenRouterSpecificProvider?: string // OpenRouter provider routing - respectGitIgnore?: boolean // Whether to respect .gitignore when listing files + codebaseIndexRespectGitIgnore?: boolean // Whether to respect .gitignore when listing files // Secret settings codeIndexOpenAiKey?: string diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index cb88e00ced..e829df0050 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -270,7 +270,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo if (maxFiles === 0) { details += "(Workspace files context disabled. Use list_files to explore if needed.)" } else { - const respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true + const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles, respectGitIgnore) const { showRooIgnoredFiles = false } = state ?? {} diff --git a/src/core/tools/ListFilesTool.ts b/src/core/tools/ListFilesTool.ts index f9e95766a5..7d92734ba4 100644 --- a/src/core/tools/ListFilesTool.ts +++ b/src/core/tools/ListFilesTool.ts @@ -38,7 +38,7 @@ export class ListFilesTool extends BaseTool<"list_files"> { const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath) const state = await task.providerRef.deref()?.getState() - const respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true + const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200, respectGitIgnore) const { showRooIgnoredFiles = false } = state ?? {} diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 153b785d97..2245dd6f5c 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2211,7 +2211,7 @@ export class ClineProvider codebaseIndexBedrockRegion: codebaseIndexConfig?.codebaseIndexBedrockRegion, codebaseIndexBedrockProfile: codebaseIndexConfig?.codebaseIndexBedrockProfile, codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider, - respectGitIgnore: codebaseIndexConfig?.respectGitIgnore, + codebaseIndexRespectGitIgnore: codebaseIndexConfig?.codebaseIndexRespectGitIgnore, }, // Only set mdmCompliant if there's an actual MDM policy // undefined means no MDM policy, true means compliant, false means non-compliant @@ -2451,7 +2451,7 @@ export class ClineProvider codebaseIndexBedrockProfile: stateValues.codebaseIndexConfig?.codebaseIndexBedrockProfile, codebaseIndexOpenRouterSpecificProvider: stateValues.codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider, - respectGitIgnore: stateValues.codebaseIndexConfig?.respectGitIgnore, + codebaseIndexRespectGitIgnore: stateValues.codebaseIndexConfig?.codebaseIndexRespectGitIgnore, }, profileThresholds: stateValues.profileThresholds ?? {}, includeDiagnosticMessages: stateValues.includeDiagnosticMessages ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 3d9b7a9267..c81b30db04 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2543,7 +2543,7 @@ export const webviewMessageHandler = async ( codebaseIndexSearchMaxResults: settings.codebaseIndexSearchMaxResults, codebaseIndexSearchMinScore: settings.codebaseIndexSearchMinScore, codebaseIndexOpenRouterSpecificProvider: settings.codebaseIndexOpenRouterSpecificProvider, - respectGitIgnore: settings.respectGitIgnore, + codebaseIndexRespectGitIgnore: settings.codebaseIndexRespectGitIgnore, } // Save global state first diff --git a/src/integrations/workspace/WorkspaceTracker.ts b/src/integrations/workspace/WorkspaceTracker.ts index 6bd2f2aa3d..46475efd24 100644 --- a/src/integrations/workspace/WorkspaceTracker.ts +++ b/src/integrations/workspace/WorkspaceTracker.ts @@ -33,7 +33,7 @@ class WorkspaceTracker { let respectGitIgnore = true try { const state = await this.providerRef.deref()?.getState() - respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true + respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true } catch { // Fall back to default (respect .gitignore) if state is not available } diff --git a/src/services/code-index/config-manager.ts b/src/services/code-index/config-manager.ts index 54769e2dfb..ce6e878ec2 100644 --- a/src/services/code-index/config-manager.ts +++ b/src/services/code-index/config-manager.ts @@ -26,7 +26,7 @@ export class CodeIndexConfigManager { private qdrantApiKey?: string private searchMinScore?: number private searchMaxResults?: number - private respectGitIgnore: boolean = true + private codebaseIndexRespectGitIgnore: boolean = true constructor(private readonly contextProxy: ContextProxy) { // Initialize with current configuration to avoid false restart triggers @@ -87,7 +87,7 @@ export class CodeIndexConfigManager { this.qdrantApiKey = qdrantApiKey ?? "" this.searchMinScore = codebaseIndexSearchMinScore this.searchMaxResults = codebaseIndexSearchMaxResults - this.respectGitIgnore = codebaseIndexConfig.respectGitIgnore ?? true + this.codebaseIndexRespectGitIgnore = codebaseIndexConfig.codebaseIndexRespectGitIgnore ?? true // Validate and set model dimension const rawDimension = codebaseIndexConfig.codebaseIndexEmbedderModelDimension @@ -196,7 +196,7 @@ export class CodeIndexConfigManager { openRouterSpecificProvider: this.openRouterOptions?.specificProvider ?? "", qdrantUrl: this.qdrantUrl ?? "", qdrantApiKey: this.qdrantApiKey ?? "", - respectGitIgnore: this.respectGitIgnore, + codebaseIndexRespectGitIgnore: this.codebaseIndexRespectGitIgnore, } // Refresh secrets from VSCode storage to ensure we have the latest values @@ -413,9 +413,9 @@ export class CodeIndexConfigManager { return true } - // respectGitIgnore change - const prevRespectGitIgnore = prev?.respectGitIgnore ?? true - if (prevRespectGitIgnore !== this.respectGitIgnore) { + // codebaseIndexRespectGitIgnore change + const prevRespectGitIgnore = prev?.codebaseIndexRespectGitIgnore ?? true + if (prevRespectGitIgnore !== this.codebaseIndexRespectGitIgnore) { return true } diff --git a/src/services/code-index/interfaces/config.ts b/src/services/code-index/interfaces/config.ts index ec2244c8e6..14fbf3d880 100644 --- a/src/services/code-index/interfaces/config.ts +++ b/src/services/code-index/interfaces/config.ts @@ -45,5 +45,5 @@ export type PreviousConfigSnapshot = { openRouterSpecificProvider?: string qdrantUrl?: string qdrantApiKey?: string - respectGitIgnore?: boolean + codebaseIndexRespectGitIgnore?: boolean } diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index 3bcfc395be..e606000290 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -316,7 +316,7 @@ export class CodeIndexManager { let respectGitIgnore = true try { const codebaseIndexConfig = this._configManager!.getContextProxy()?.getGlobalState("codebaseIndexConfig") - respectGitIgnore = codebaseIndexConfig?.respectGitIgnore ?? true + respectGitIgnore = codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true } catch { // Fall back to default (respect .gitignore) if config proxy is not available } diff --git a/webview-ui/src/components/chat/CodeIndexPopover.tsx b/webview-ui/src/components/chat/CodeIndexPopover.tsx index da51f81dd2..4bcfadfa31 100644 --- a/webview-ui/src/components/chat/CodeIndexPopover.tsx +++ b/webview-ui/src/components/chat/CodeIndexPopover.tsx @@ -81,7 +81,7 @@ interface LocalCodeIndexSettings { codebaseIndexVercelAiGatewayApiKey?: string codebaseIndexOpenRouterApiKey?: string codebaseIndexOpenRouterSpecificProvider?: string - respectGitIgnore?: boolean + codebaseIndexRespectGitIgnore?: boolean } // Validation schema for codebase index settings @@ -226,7 +226,7 @@ export const CodeIndexPopover: React.FC = ({ codebaseIndexVercelAiGatewayApiKey: "", codebaseIndexOpenRouterApiKey: "", codebaseIndexOpenRouterSpecificProvider: "", - respectGitIgnore: true, + codebaseIndexRespectGitIgnore: true, }) // Initial settings state - stores the settings when popover opens @@ -267,7 +267,7 @@ export const CodeIndexPopover: React.FC = ({ codebaseIndexOpenRouterApiKey: "", codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig.codebaseIndexOpenRouterSpecificProvider || "", - respectGitIgnore: codebaseIndexConfig.respectGitIgnore ?? true, + codebaseIndexRespectGitIgnore: codebaseIndexConfig.codebaseIndexRespectGitIgnore ?? true, } setInitialSettings(settings) setCurrentSettings(settings) @@ -1593,9 +1593,9 @@ export const CodeIndexPopover: React.FC = ({
- updateSetting("respectGitIgnore", e.target.checked) + updateSetting("codebaseIndexRespectGitIgnore", e.target.checked) }> {t("settings:codeIndex.respectGitIgnoreLabel")} From 49c8526e9af4eb2a59e2f781337a4b80ba904a82 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 24 Feb 2026 03:00:57 +0000 Subject: [PATCH 4/4] fix: revert respectGitIgnore changes outside the indexer Reverts changes to ListFilesTool.ts, getEnvironmentDetails.ts, WorkspaceTracker.ts, and WorkspaceTracker.spec.ts to keep the respectGitIgnore setting scoped to the code indexer only. --- src/core/environment/getEnvironmentDetails.ts | 32 +------------------ src/core/tools/ListFilesTool.ts | 6 ++-- .../workspace/WorkspaceTracker.ts | 9 +----- .../__tests__/WorkspaceTracker.spec.ts | 2 +- 4 files changed, 5 insertions(+), 44 deletions(-) diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index e829df0050..99b3951cd1 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -226,35 +226,6 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo details += `${modeDetails.name}\n` details += `${modelId}\n` - // Add browser session status - Only show when active to prevent cluttering context - const isBrowserActive = cline.browserSession.isSessionActive() - - if (isBrowserActive) { - // Build viewport info for status (prefer actual viewport if available, else fallback to configured setting) - const configuredViewport = (state?.browserViewportSize as string | undefined) ?? "900x600" - let configuredWidth: number | undefined - let configuredHeight: number | undefined - if (configuredViewport.includes("x")) { - const parts = configuredViewport.split("x").map((v) => Number(v)) - configuredWidth = parts[0] - configuredHeight = parts[1] - } - - let actualWidth: number | undefined - let actualHeight: number | undefined - const vp = cline.browserSession.getViewportSize?.() - if (vp) { - actualWidth = vp.width - actualHeight = vp.height - } - - const width = actualWidth ?? configuredWidth - const height = actualHeight ?? configuredHeight - const viewportInfo = width && height ? `\nCurrent viewport size: ${width}x${height} pixels.` : "" - - details += `\n# Browser Session Status\nActive - A browser session is currently open and ready for browser_action commands${viewportInfo}\n` - } - if (includeFileDetails) { details += `\n\n# Current Workspace Directory (${cline.cwd.toPosix()}) Files\n` const isDesktop = arePathsEqual(cline.cwd, path.join(os.homedir(), "Desktop")) @@ -270,8 +241,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo if (maxFiles === 0) { details += "(Workspace files context disabled. Use list_files to explore if needed.)" } else { - const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true - const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles, respectGitIgnore) + const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles) const { showRooIgnoredFiles = false } = state ?? {} const result = formatResponse.formatFilesList( diff --git a/src/core/tools/ListFilesTool.ts b/src/core/tools/ListFilesTool.ts index 7d92734ba4..716d7ed784 100644 --- a/src/core/tools/ListFilesTool.ts +++ b/src/core/tools/ListFilesTool.ts @@ -37,10 +37,8 @@ export class ListFilesTool extends BaseTool<"list_files"> { const absolutePath = path.resolve(task.cwd, relDirPath) const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath) - const state = await task.providerRef.deref()?.getState() - const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true - const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200, respectGitIgnore) - const { showRooIgnoredFiles = false } = state ?? {} + const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200) + const { showRooIgnoredFiles = false } = (await task.providerRef.deref()?.getState()) ?? {} const result = formatResponse.formatFilesList( absolutePath, diff --git a/src/integrations/workspace/WorkspaceTracker.ts b/src/integrations/workspace/WorkspaceTracker.ts index 46475efd24..546cd97cd1 100644 --- a/src/integrations/workspace/WorkspaceTracker.ts +++ b/src/integrations/workspace/WorkspaceTracker.ts @@ -30,14 +30,7 @@ class WorkspaceTracker { return } const tempCwd = this.cwd - let respectGitIgnore = true - try { - const state = await this.providerRef.deref()?.getState() - respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true - } catch { - // Fall back to default (respect .gitignore) if state is not available - } - const [files, _] = await listFiles(tempCwd, true, MAX_INITIAL_FILES, respectGitIgnore) + const [files, _] = await listFiles(tempCwd, true, MAX_INITIAL_FILES) if (this.prevWorkSpacePath !== tempCwd) { return } diff --git a/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts b/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts index a329ef1ab1..b0a617d970 100644 --- a/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts +++ b/src/integrations/workspace/__tests__/WorkspaceTracker.spec.ts @@ -240,7 +240,7 @@ describe("WorkspaceTracker", () => { vitest.runAllTimers() // Should initialize file paths for new workspace - expect(listFiles).toHaveBeenCalledWith("/test/new-workspace", true, 1000, true) + expect(listFiles).toHaveBeenCalledWith("/test/new-workspace", true, 1000) vitest.runAllTimers() })