feat(web): show hidden directories in workspace browser (#1331)

* feat(web): show hidden directories in workspace browser

Add optional includeHidden param to the machine list-directory RPC so the
WorkspaceBrowser can toggle hidden (dot-prefixed) entries. Default remains
filtered for backward compatibility; the toggle persists via localStorage.

* fix(web): disable show-hidden toggle while directory loading

Prevent overlapping list-directory requests with opposite includeHidden
values; the toggle is now disabled while a directory load is active.
This commit is contained in:
weixiang1862
2026-08-03 12:32:50 +08:00
committed by GitHub
parent a111d0bc82
commit cc39021abc
10 changed files with 138 additions and 21 deletions
+4 -1
View File
@@ -56,6 +56,7 @@ interface PathExistsRequest {
interface ListMachineDirectoryRequest {
path: string
includeHidden?: boolean
}
interface CursorChatStoreStatusRequest {
@@ -168,6 +169,8 @@ export class ApiMachineClient {
return { success: false, error: 'Path is required' }
}
const includeHidden = params?.includeHidden === true
const targetPath = await this.resolveForWorkspaceCheck(rawPath)
if (!this.isWithinWorkspaceRoots(targetPath)) {
return { success: false, error: 'Path is outside workspace roots' }
@@ -183,7 +186,7 @@ export class ApiMachineClient {
const entries: MachineDirectoryEntry[] = []
await Promise.all(dirEntries.map(async (entry) => {
if (entry.name.startsWith('.')) return
if (!includeHidden && entry.name.startsWith('.')) return
const fullPath = join(targetPath, entry.name)
let type: 'file' | 'directory' | 'other' = 'other'