优化web/server模式下的目录选择,现在支持目录树选择,而不是硬文本写入
This commit is contained in:
@@ -36,6 +36,7 @@ import type {
|
||||
TerminalInfo,
|
||||
PromptInputBlock,
|
||||
FileTreeNode,
|
||||
DirectoryEntry,
|
||||
FilePreviewContent,
|
||||
FileEditContent,
|
||||
FileSaveResult,
|
||||
@@ -1107,6 +1108,18 @@ export async function bootstrapFolderCommandsFromPackageJson(
|
||||
})
|
||||
}
|
||||
|
||||
// Directory browser (for web/server mode)
|
||||
|
||||
export async function getHomeDirectory(): Promise<string> {
|
||||
return getTransport().call("get_home_directory")
|
||||
}
|
||||
|
||||
export async function listDirectoryEntries(
|
||||
path: string
|
||||
): Promise<DirectoryEntry[]> {
|
||||
return getTransport().call("list_directory_entries", { path })
|
||||
}
|
||||
|
||||
// File tree and git log commands
|
||||
|
||||
export async function getFileTree(
|
||||
|
||||
@@ -36,6 +36,7 @@ import type {
|
||||
TerminalInfo,
|
||||
PromptInputBlock,
|
||||
FileTreeNode,
|
||||
DirectoryEntry,
|
||||
FilePreviewContent,
|
||||
FileEditContent,
|
||||
FileSaveResult,
|
||||
@@ -972,6 +973,18 @@ export async function bootstrapFolderCommandsFromPackageJson(
|
||||
})
|
||||
}
|
||||
|
||||
// Directory browser
|
||||
|
||||
export async function getHomeDirectory(): Promise<string> {
|
||||
return invoke("get_home_directory")
|
||||
}
|
||||
|
||||
export async function listDirectoryEntries(
|
||||
path: string
|
||||
): Promise<DirectoryEntry[]> {
|
||||
return invoke("list_directory_entries", { path })
|
||||
}
|
||||
|
||||
// File tree and git log commands
|
||||
|
||||
export async function getFileTree(
|
||||
|
||||
@@ -730,6 +730,12 @@ export type FileTreeNode =
|
||||
| { kind: "file"; name: string; path: string }
|
||||
| { kind: "dir"; name: string; path: string; children: FileTreeNode[] }
|
||||
|
||||
export interface DirectoryEntry {
|
||||
name: string
|
||||
path: string
|
||||
hasChildren: boolean
|
||||
}
|
||||
|
||||
export interface FilePreviewContent {
|
||||
path: string
|
||||
content: string
|
||||
|
||||
Reference in New Issue
Block a user