初步支持远程Git管理

This commit is contained in:
xintaofei
2026-03-13 22:55:55 +08:00
parent 0720aa930b
commit 767d43b0cf
16 changed files with 535 additions and 10 deletions

View File

@@ -25,6 +25,7 @@ import type {
GitPushResult,
GitMergeResult,
GitCommitResult,
GitRemote,
PreflightResult,
FolderCommand,
TerminalInfo,
@@ -522,6 +523,40 @@ export async function gitStashPop(path: string): Promise<string> {
return invoke("git_stash_pop", { path })
}
export async function gitListRemotes(path: string): Promise<GitRemote[]> {
return invoke("git_list_remotes", { path })
}
export async function gitFetchRemote(
path: string,
name: string
): Promise<string> {
return invoke("git_fetch_remote", { path, name })
}
export async function gitAddRemote(
path: string,
name: string,
url: string
): Promise<void> {
return invoke("git_add_remote", { path, name, url })
}
export async function gitRemoveRemote(
path: string,
name: string
): Promise<void> {
return invoke("git_remove_remote", { path, name })
}
export async function gitSetRemoteUrl(
path: string,
name: string,
url: string
): Promise<void> {
return invoke("git_set_remote_url", { path, name, url })
}
export async function gitStatus(path: string): Promise<GitStatusEntry[]> {
return invoke("git_status", { path })
}

View File

@@ -683,6 +683,11 @@ export interface GitCommitResult {
committed_files: number
}
export interface GitRemote {
name: string
url: string
}
export type FileTreeNode =
| { kind: "file"; name: string; path: string }
| { kind: "dir"; name: string; path: string; children: FileTreeNode[] }