♻️ refactor(vscode): 代码托管仓库抽成统一接口,Gitea 实现搬到 provider 后面,翻页改看 Link 头

This commit is contained in:
cruldra committed 2026-10-19 07:56:40 +11:00
1 parent c90d84d7f2
commit 14bee9f505
64 files changed
+1881 -2718

No files matched your search

+6 -7
View File
@@ -1,5 +1,5 @@
import type { ForgeContext } from '../../forge/context'
import { deleteLocalBranch } from '../../git/branches'
import { deleteBranch } from '../../gitea/api'
import { logger } from '../../logging/logger'
/**
@@ -20,11 +20,10 @@ export async function cleanupFeatureBranch(opts: {
branch: string
issueNumber: number
devBranch?: string
/** 缺 remote 或 token 时跳过远程删除,只删本地。 */
remote?: { host: string, owner: string, repo: string }
token?: string
/** 没有代码托管仓库时跳过远程删除,只删本地。 */
forge?: ForgeContext
}): Promise<void> {
const { workspaceRoot, branch, issueNumber, devBranch, remote, token } = opts
const { workspaceRoot, branch, issueNumber, devBranch, forge } = opts
if (!branch)
return
@@ -36,9 +35,9 @@ export async function cleanupFeatureBranch(opts: {
return
}
if (remote && token) {
if (forge) {
try {
await deleteBranch({ host: remote.host, token, owner: remote.owner, repo: remote.repo, branch })
await forge.provider.deleteBranch(branch)
logger.add({ level: 'info', source: 'panel', message: `已删除远程 feature 分支 ${branch} (issue #${issueNumber})` })
}
catch (err) {