♻️ Refactor commit message summarization logic with progress bar and improved handling
This commit is contained in:
@@ -66,8 +66,14 @@ async function main() {
|
|||||||
}
|
}
|
||||||
log.info("Git status:", gitStatus);
|
log.info("Git status:", gitStatus);
|
||||||
|
|
||||||
const summary = await summarize();
|
const summary = await new ProcessBar("AI summarizing").call(
|
||||||
log.success(`Git commit message: ${summary}`);
|
async (): Promise<string> => {
|
||||||
|
return await summarize();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (summary != null) {
|
||||||
|
log.success(`AI summarized git commit message: ${summary}`);
|
||||||
|
}
|
||||||
|
|
||||||
let emptyCount = 0;
|
let emptyCount = 0;
|
||||||
let message = "empty message";
|
let message = "empty message";
|
||||||
@@ -82,7 +88,7 @@ async function main() {
|
|||||||
"Input your commit message (Enter for AI summary) > ",
|
"Input your commit message (Enter for AI summary) > ",
|
||||||
);
|
);
|
||||||
if (message.trim().length == 0) {
|
if (message.trim().length == 0) {
|
||||||
message = summary;
|
message = summary ?? "";
|
||||||
}
|
}
|
||||||
} while (message.length == 0);
|
} while (message.length == 0);
|
||||||
readline.close();
|
readline.close();
|
||||||
@@ -122,5 +128,5 @@ main().catch((err) => {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}).then(() => process.exit(0));
|
}).then(() => process.exit(0));
|
||||||
|
|
||||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260404T225757+08:00.MEUCIQCp3myuHQTK17ZHS3zW
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260404T230316+08:00.MEYCIQDPcT9WH0J7pH4eZ+3v
|
||||||
// Z7Wg/+Mgd0CasaV+FX34BHFB9gIgG8qRbLKxD1PD4jMrkGVucgT91xU1JLIwfVM6xwxh1Os=
|
// eShmOZRyUpCu268LAvn08Y5AoQIhAK+zj3K5SuBmtRrz+6TpIZPv/C8L8VSj8FsdhZdMn8rL
|
||||||
|
|||||||
Reference in New Issue
Block a user