feat: 开发者面板页面git工具支持推送远程仓库

This commit is contained in:
2026-01-30 12:01:44 +08:00
parent 37f9faf2a4
commit 796ffcfe00
3 changed files with 72 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ import {
resetToCommit,
getCurrentBranch,
hasUncommittedChanges,
pushToRemote,
} from '@/server/utils/git-helper'
@@ -224,6 +225,25 @@ export const devPanelRouter = createTRPCRouter({
})
}
}),
/**
* 推送分支到远程仓库
*/
pushToRemote: permissionRequiredProcedure('SUPER_ADMIN_ONLY')
.input(z.object({
branchName: z.string().min(1, '分支名称不能为空'),
}))
.mutation(async ({ input }) => {
try {
await pushToRemote(input.branchName)
return { success: true, message: `已推送分支 ${input.branchName} 到远程仓库` }
} catch (error: any) {
throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
message: `推送失败: ${error.message}`,
})
}
}),
})
export type DevPanelRouter = typeof devPanelRouter