♻️ Refactor commit message summarization logic with progress bar and improved handling

This commit is contained in:
2026-04-04 23:03:40 +08:00
parent 5952ee7b8f
commit 93e85146af

View File

@@ -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<string> => {
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