From 93e85146affa8b37806d4d8c2a6e07e92492014f Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 4 Apr 2026 23:03:40 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20commit=20messag?= =?UTF-8?q?e=20summarization=20logic=20with=20progress=20bar=20and=20impro?= =?UTF-8?q?ved=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- single-scripts/commit.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/single-scripts/commit.ts b/single-scripts/commit.ts index 8e1e38a..52e2fdc 100755 --- a/single-scripts/commit.ts +++ b/single-scripts/commit.ts @@ -66,8 +66,14 @@ async function main() { } log.info("Git status:", gitStatus); - const summary = await summarize(); - log.success(`Git commit message: ${summary}`); + const summary = await new ProcessBar("AI summarizing").call( + async (): Promise => { + return await summarize(); + }, + ); + if (summary != null) { + log.success(`AI summarized git commit message: ${summary}`); + } let emptyCount = 0; let message = "empty message"; @@ -82,7 +88,7 @@ async function main() { "Input your commit message (Enter for AI summary) > ", ); if (message.trim().length == 0) { - message = summary; + message = summary ?? ""; } } while (message.length == 0); readline.close(); @@ -122,5 +128,5 @@ main().catch((err) => { process.exit(0); }).then(() => process.exit(0)); -// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260404T225757+08:00.MEUCIQCp3myuHQTK17ZHS3zW -// Z7Wg/+Mgd0CasaV+FX34BHFB9gIgG8qRbLKxD1PD4jMrkGVucgT91xU1JLIwfVM6xwxh1Os= +// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260404T230316+08:00.MEYCIQDPcT9WH0J7pH4eZ+3v +// eShmOZRyUpCu268LAvn08Y5AoQIhAK+zj3K5SuBmtRrz+6TpIZPv/C8L8VSj8FsdhZdMn8rL