feat: overhaul CLI with new AI commands and mole-style menu #6

Merged
Mplan merged 24 commits from v0.1.3 into main 2026-06-17 00:17:31 +08:00
2 changed files with 0 additions and 58 deletions
Showing only changes of commit 7e662b25cc - Show all commits
-14
View File
@@ -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<void> {
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();
-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,