diff --git a/packages/types/src/codebase-index.ts b/packages/types/src/codebase-index.ts index 61009ba3011..09e5ab6b917 100644 --- a/packages/types/src/codebase-index.ts +++ b/packages/types/src/codebase-index.ts @@ -14,6 +14,35 @@ export const CODEBASE_INDEX_DEFAULTS = { SEARCH_SCORE_STEP: 0.05, } as const +/** + * List of directories that are excluded from codebase indexing. + * These directories are typically large and would slow down indexing. + * The list is shared between the indexer and the UI to provide transparency. + */ +export const EXCLUDED_INDEXING_DIRECTORIES = [ + "node_modules", + "__pycache__", + "env", + "venv", + "target/dependency", + "build/dependencies", + "dist", + "out", + "bundle", + "vendor", + "tmp", + "temp", + "deps", + "pkg", + "Pods", + ".git", +] as const + +/** + * Pattern for hidden directories (directories starting with a dot) + */ +export const EXCLUDED_HIDDEN_DIRECTORY_PATTERN = ".*" as const + /** * CodebaseIndexConfig */ diff --git a/webview-ui/src/components/chat/CodeIndexPopover.tsx b/webview-ui/src/components/chat/CodeIndexPopover.tsx index 368f0395eaf..d8c218e5f89 100644 --- a/webview-ui/src/components/chat/CodeIndexPopover.tsx +++ b/webview-ui/src/components/chat/CodeIndexPopover.tsx @@ -12,7 +12,11 @@ import { import * as ProgressPrimitive from "@radix-ui/react-progress" import { AlertTriangle } from "lucide-react" -import { CODEBASE_INDEX_DEFAULTS } from "@roo-code/types" +import { + CODEBASE_INDEX_DEFAULTS, + EXCLUDED_INDEXING_DIRECTORIES, + EXCLUDED_HIDDEN_DIRECTORY_PATTERN, +} from "@roo-code/types" import type { EmbedderProvider } from "@roo/embeddingModels" import type { IndexingStatus } from "@roo/ExtensionMessage" @@ -194,6 +198,7 @@ export const CodeIndexPopover: React.FC = ({ const [open, setOpen] = useState(false) const [isAdvancedSettingsOpen, setIsAdvancedSettingsOpen] = useState(false) const [isSetupSettingsOpen, setIsSetupSettingsOpen] = useState(false) + const [isExcludedDirsOpen, setIsExcludedDirsOpen] = useState(false) const [indexingStatus, setIndexingStatus] = useState(externalIndexingStatus) @@ -1593,6 +1598,41 @@ export const CodeIndexPopover: React.FC = ({ )} + {/* Excluded Directories Info Section */} +
+ + + {isExcludedDirsOpen && ( +
+

+ {t("settings:codeIndex.excludedDirectories.description")} +

+
+ {EXCLUDED_INDEXING_DIRECTORIES.map((dir) => ( + + {dir} + + ))} +
+

+ {t("settings:codeIndex.excludedDirectories.hiddenDirectoriesNote")} ( + {EXCLUDED_HIDDEN_DIRECTORY_PATTERN}) +

+
+ )} +
+ {/* Action Buttons */}
diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index b836ecbfc87..197c6bce08f 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -179,7 +179,12 @@ "baseUrlRequired": "Base URL is required", "modelDimensionMinValue": "Model dimension must be greater than 0" }, - "optional": "optional" + "optional": "optional", + "excludedDirectories": { + "title": "Excluded Directories", + "description": "These directories are automatically excluded from indexing to improve performance. Files in these directories will not be indexed or searchable.", + "hiddenDirectoriesNote": "Additionally, all hidden directories (starting with a dot) are excluded." + } }, "autoApprove": { "description": "Run these actions without asking for permission. Only enable for actions you fully trust and if you understand the security risks.",