From 798cdbbadf6bbf88be6daea48c6a9ed5117dc8a7 Mon Sep 17 00:00:00 2001 From: Mplan Date: Tue, 9 Jun 2026 18:14:18 +0800 Subject: [PATCH] feat(cli): add config command and improve menu clearing --- index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index eec1d65..ca545ab 100644 --- a/index.ts +++ b/index.ts @@ -277,6 +277,7 @@ interface MenuAction { const MENU_ACTIONS: MenuAction[] = [ { key: "commit", label: "commit", description: "Generate AI commit message" }, + { key: "config", label: "config", description: "Configure API settings" }, ]; async function showMenu(): Promise { @@ -304,9 +305,9 @@ async function showMenu(): Promise { } function clearMenu() { - process.stdout.write(`\x1b[${totalLines}A`); + process.stdout.write(`\x1b[${headerLines}A`); for (let i = 0; i < totalLines; i++) { - process.stdout.write("\x1b[2K\x1b[1B"); + process.stdout.write("\r\x1b[2K\n"); } process.stdout.write(`\x1b[${totalLines}A`); } @@ -384,6 +385,8 @@ async function showMenu(): Promise { if (selected.key === "commit") { handleCommit(false, false).then(resolve); + } else if (selected.key === "config") { + handleConfig().then(resolve); } else { resolve(); }