refactor(pr): rely on selected CLI for PR creation

This commit is contained in:
2026-06-11 19:43:19 +08:00
parent 5bb2dc8e8a
commit 7e662b25cc
2 changed files with 0 additions and 58 deletions
-44
View File
@@ -124,50 +124,6 @@ export async function getRemoteHostname(): Promise<string | null> {
}
}
export function checkCLI(platform: Platform): string | null {
const bin =
platform === "github" ? "gh" : platform === "gitlab" ? "glab" : "tea";
const path = Bun.which(bin);
if (!path) {
if (platform === "github") {
return "GitHub CLI (gh) not found. Install: brew install gh";
}
if (platform === "gitlab") {
return "GitLab CLI (glab) not found. Install: brew install glab";
}
return "Gitea CLI (tea) not found. Install from: https://gitea.com/gitea/tea";
}
return null;
}
export async function checkAuth(platform: Platform): Promise<string | null> {
if (platform === "github") {
try {
await Bun.$`gh auth status`.quiet();
return null;
} catch {
return "Not authenticated with GitHub CLI. Run: gh auth login";
}
}
if (platform === "gitlab") {
try {
await Bun.$`glab auth status`.quiet();
return null;
} catch {
return "Not authenticated with GitLab CLI. Run: glab auth login";
}
}
try {
const result = await Bun.$`tea logins list`.quiet().text();
if (result.trim()) return null;
return "Not authenticated with Gitea CLI. Run: tea login add";
} catch {
return "Not authenticated with Gitea CLI. Run: tea login add";
}
}
export async function createPR(
platform: Platform,
title: string,