diff options
Diffstat (limited to 'packages/cli/src/ui/hooks/atCommandProcessor.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/atCommandProcessor.ts | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.ts b/packages/cli/src/ui/hooks/atCommandProcessor.ts index ac56ab75..c534207c 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor.ts @@ -134,9 +134,14 @@ export async function handleAtCommand({ addItem({ type: 'user', text: query }, userMessageTimestamp); + // Get centralized file discovery service + const fileDiscovery = await config.getFileService(); + const respectGitIgnore = config.getFileFilteringRespectGitIgnore(); + const pathSpecsToRead: string[] = []; const atPathToResolvedSpecMap = new Map<string, string>(); const contentLabelsForDisplay: string[] = []; + const ignoredPaths: string[] = []; const toolRegistry = await config.getToolRegistry(); const readManyFilesTool = toolRegistry.getTool('read_many_files'); @@ -176,6 +181,16 @@ export async function handleAtCommand({ return { processedQuery: null, shouldProceed: false }; } + // Check if path should be ignored by git + if (fileDiscovery.shouldIgnoreFile(pathName)) { + const reason = respectGitIgnore + ? 'git-ignored and will be skipped' + : 'ignored by custom patterns'; + onDebugMessage(`Path ${pathName} is ${reason}.`); + ignoredPaths.push(pathName); + continue; + } + let currentPathSpec = pathName; let resolvedSuccessfully = false; @@ -305,6 +320,14 @@ export async function handleAtCommand({ } initialQueryText = initialQueryText.trim(); + // Inform user about ignored paths + if (ignoredPaths.length > 0) { + const ignoreType = respectGitIgnore ? 'git-ignored' : 'custom-ignored'; + onDebugMessage( + `Ignored ${ignoredPaths.length} ${ignoreType} files: ${ignoredPaths.join(', ')}`, + ); + } + // Fallback for lone "@" or completely invalid @-commands resulting in empty initialQueryText if (pathSpecsToRead.length === 0) { onDebugMessage('No valid file paths found in @ commands to read.'); @@ -324,7 +347,10 @@ export async function handleAtCommand({ const processedQueryParts: PartUnion[] = [{ text: initialQueryText }]; - const toolArgs = { paths: pathSpecsToRead }; + const toolArgs = { + paths: pathSpecsToRead, + respectGitIgnore, // Use configuration setting + }; let toolCallDisplay: IndividualToolCallDisplay; try { |
