diff --git a/index.ts b/index.ts index e1f0758..eeeae5a 100644 --- a/index.ts +++ b/index.ts @@ -29,8 +29,6 @@ import { getBranchDiff, detectPlatform, getRemoteHostname, - checkCLI, - checkAuth, createPR, } from "./src/pr"; import type { Platform } from "./src/pr"; @@ -489,18 +487,6 @@ async function handlePR(draft: boolean): Promise { platform === "github" ? "GitHub" : platform === "gitlab" ? "GitLab" : "Gitea"; console.log(` Using: ${CYAN}${platformLabel}${RESET}`); - const cliError = checkCLI(platform); - if (cliError) { - console.error(` ${RED}Error: ${cliError}${RESET}`); - process.exit(1); - } - - const authError = await checkAuth(platform); - if (authError) { - console.error(` ${RED}Error: ${authError}${RESET}`); - process.exit(1); - } - const baseBranch = await getDefaultBranch(); const branchName = await getBranchName(); diff --git a/src/pr.ts b/src/pr.ts index e035462..eafd7df 100644 --- a/src/pr.ts +++ b/src/pr.ts @@ -124,50 +124,6 @@ export async function getRemoteHostname(): Promise { } } -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 { - 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,