Sync upstream Gemini-CLI v0.8.2 (#838)

This commit is contained in:
tanzhenxin
2025-10-23 09:27:04 +08:00
committed by GitHub
parent 096fabb5d6
commit eb95c131be
644 changed files with 70389 additions and 23709 deletions

View File

@@ -118,7 +118,6 @@ ${result.llmContent}`;
lines,
mimetype,
path.extname(this.params.absolute_path),
undefined,
programming_language,
),
);
@@ -182,9 +181,16 @@ export class ReadFileTool extends BaseDeclarativeTool<
}
const workspaceContext = this.config.getWorkspaceContext();
if (!workspaceContext.isPathWithinWorkspace(filePath)) {
const projectTempDir = this.config.storage.getProjectTempDir();
const resolvedFilePath = path.resolve(filePath);
const resolvedProjectTempDir = path.resolve(projectTempDir);
const isWithinTempDir =
resolvedFilePath.startsWith(resolvedProjectTempDir + path.sep) ||
resolvedFilePath === resolvedProjectTempDir;
if (!workspaceContext.isPathWithinWorkspace(filePath) && !isWithinTempDir) {
const directories = workspaceContext.getDirectories();
return `File path must be within one of the workspace directories: ${directories.join(', ')}`;
return `File path must be within one of the workspace directories: ${directories.join(', ')} or within the project temp directory: ${projectTempDir}`;
}
if (params.offset !== undefined && params.offset < 0) {
return 'Offset must be a non-negative number';
@@ -194,7 +200,7 @@ export class ReadFileTool extends BaseDeclarativeTool<
}
const fileService = this.config.getFileService();
if (fileService.shouldGeminiIgnoreFile(params.absolute_path)) {
if (fileService.shouldQwenIgnoreFile(params.absolute_path)) {
return `File path '${filePath}' is ignored by .qwenignore pattern(s).`;
}