mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
fix(core,cli): enable recursive directory access for (#17094)
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { type Config } from '@google/gemini-cli-core';
|
||||
import { loadTrustedFolders } from '../../config/trustedFolders.js';
|
||||
import { expandHomeDir } from '../utils/directoryUtils.js';
|
||||
import { expandHomeDir, batchAddDirectories } from '../utils/directoryUtils.js';
|
||||
import {
|
||||
debugLogger,
|
||||
refreshServerHierarchicalMemory,
|
||||
@@ -79,15 +79,10 @@ export function useIncludeDirsTrust(
|
||||
const added: string[] = [];
|
||||
const errors: string[] = [];
|
||||
const workspaceContext = config.getWorkspaceContext();
|
||||
for (const pathToAdd of pendingDirs) {
|
||||
try {
|
||||
workspaceContext.addDirectory(expandHomeDir(pathToAdd.trim()));
|
||||
added.push(pathToAdd.trim());
|
||||
} catch (e) {
|
||||
const error = e as Error;
|
||||
errors.push(`Error adding '${pathToAdd.trim()}': ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const result = batchAddDirectories(workspaceContext, pendingDirs);
|
||||
added.push(...result.added);
|
||||
errors.push(...result.errors);
|
||||
|
||||
if (added.length > 0 || errors.length > 0) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
@@ -125,14 +120,10 @@ export function useIncludeDirsTrust(
|
||||
}
|
||||
|
||||
const workspaceContext = config.getWorkspaceContext();
|
||||
for (const pathToAdd of trustedDirs) {
|
||||
try {
|
||||
workspaceContext.addDirectory(expandHomeDir(pathToAdd));
|
||||
added.push(pathToAdd);
|
||||
} catch (e) {
|
||||
const error = e as Error;
|
||||
errors.push(`Error adding '${pathToAdd}': ${error.message}`);
|
||||
}
|
||||
if (trustedDirs.length > 0) {
|
||||
const result = batchAddDirectories(workspaceContext, trustedDirs);
|
||||
added.push(...result.added);
|
||||
errors.push(...result.errors);
|
||||
}
|
||||
|
||||
if (undefinedTrustDirs.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user