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
Showing only changes of commit 962b76d20f - Show all commits
+13 -13
View File
@@ -611,14 +611,11 @@ async function showMenu(): Promise<void> {
if (selected === null || selected === BACK) return;
const result =
selected === "commit"
? await handleCommit(false, false)
: selected === "pr"
? await handlePR(false)
: await handleConfig();
if (selected === "commit") await handleCommit(false, false);
else if (selected === "pr") await handlePR(false);
else await handleConfig();
if (result !== "back") return;
return;
}
}
@@ -663,8 +660,9 @@ async function handleCommit(
const unstagedFiles = await getUnstagedFiles();
if (stagedFiles.length === 0 && unstagedFiles.length === 0) {
console.log(" Nothing to commit.");
return "done";
console.log(`\n ${YELLOW}Nothing to commit.${RESET}`);
await ask(` ${DIM}Press Enter to exit...${RESET}`);
process.exit(0);
}
if (unstagedFiles.length > 0) {
@@ -687,8 +685,9 @@ async function handleCommit(
const diff = await getStagedDiff();
if (!diff) {
console.log(" No staged changes to commit.");
return "done";
console.log(`\n ${YELLOW}No staged changes to commit.${RESET}`);
await ask(` ${DIM}Press Enter to exit...${RESET}`);
process.exit(0);
}
const MAX_DIFF_SIZE = 15000;
@@ -817,9 +816,10 @@ async function handlePR(draft: boolean): Promise<"done" | "back"> {
if (commits.length === 0) {
console.error(
` ${RED}Error: No commits on ${branchName} compared to ${baseBranch}. Commit something first.${RESET}`,
`\n ${YELLOW}No commits on ${branchName} compared to ${baseBranch}. Commit something first.${RESET}`,
);
process.exit(1);
await ask(` ${DIM}Press Enter to exit...${RESET}`);
process.exit(0);
}
console.log(