mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-13 23:11:10 +00:00
Merge b7fd2dc936 into 96d6e43643
This commit is contained in:
commit
27438ad024
3 changed files with 17 additions and 9 deletions
|
|
@ -192,6 +192,14 @@ describe("getEnvironmentDetails", () => {
|
|||
expect(listFiles).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("should handle home directory specially", async () => {
|
||||
// First call is for desktop check (return false), second is for home dir check (return true)
|
||||
;(arePathsEqual as Mock).mockReturnValueOnce(false).mockReturnValueOnce(true)
|
||||
const result = await getEnvironmentDetails(mockCline as Task, true)
|
||||
expect(result).toContain("Home directory files not shown automatically")
|
||||
expect(listFiles).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("should skip file listing when maxWorkspaceFiles is 0", async () => {
|
||||
mockProvider.getState.mockResolvedValue({
|
||||
...mockState,
|
||||
|
|
|
|||
|
|
@ -229,11 +229,16 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
|
|||
if (includeFileDetails) {
|
||||
details += `\n\n# Current Workspace Directory (${cline.cwd.toPosix()}) Files\n`
|
||||
const isDesktop = arePathsEqual(cline.cwd, path.join(os.homedir(), "Desktop"))
|
||||
const isHomeDir = arePathsEqual(cline.cwd, os.homedir())
|
||||
|
||||
if (isDesktop) {
|
||||
// Don't want to immediately access desktop since it would show
|
||||
// permission popup.
|
||||
details += "(Desktop files not shown automatically. Use list_files to explore if needed.)"
|
||||
} else if (isHomeDir) {
|
||||
// Home directory can contain a huge number of files; skip automatic
|
||||
// listing but allow explicit list_files tool calls to work.
|
||||
details += "(Home directory files not shown automatically. Use list_files to explore if needed.)"
|
||||
} else {
|
||||
const maxFiles = maxWorkspaceFiles ?? 200
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import os from "os"
|
||||
import * as path from "path"
|
||||
import * as fs from "fs"
|
||||
import * as childProcess from "child_process"
|
||||
|
|
@ -158,7 +157,10 @@ function ensureFirstLevelDirectoriesIncluded(
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle special directories (root, home) that should not be fully listed
|
||||
* Handle special directories (root) that should not be fully listed.
|
||||
* Note: The home directory is no longer blocked here. Instead, the home
|
||||
* directory is handled in getEnvironmentDetails() to skip automatic listing
|
||||
* while still allowing explicit list_files tool calls to work correctly.
|
||||
*/
|
||||
async function handleSpecialDirectories(dirPath: string): Promise<[string[], boolean] | null> {
|
||||
const absolutePath = path.resolve(dirPath)
|
||||
|
|
@ -170,13 +172,6 @@ async function handleSpecialDirectories(dirPath: string): Promise<[string[], boo
|
|||
return [[root], false]
|
||||
}
|
||||
|
||||
// Do not allow listing files in home directory
|
||||
const homeDir = os.homedir()
|
||||
const isHomeDir = arePathsEqual(absolutePath, homeDir)
|
||||
if (isHomeDir) {
|
||||
return [[homeDir], false]
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue