feat(cli): show commit hash and summary on success

This commit is contained in:
2026-06-09 17:38:00 +08:00
parent 68e98be653
commit 6d007698f9
2 changed files with 36 additions and 8 deletions
+20 -4
View File
@@ -359,8 +359,16 @@ async function main() {
if (action === "y") {
try {
await commit(message);
console.log(`\n ${GREEN}Committed successfully!${RESET}`);
const result = await commit(message);
console.log(
`\n ${GREEN}${BOLD}✔ Committed successfully!${RESET}`,
);
if (result.hash) {
console.log(` ${YELLOW}${result.hash}${RESET} ${message}`);
}
if (result.summary) {
console.log(` ${DIM}${result.summary}${RESET}`);
}
} catch (err) {
console.error(
` ${RED}Commit failed: ${err instanceof Error ? err.message : err}${RESET}`,
@@ -371,8 +379,16 @@ async function main() {
const edited = await editMessage(message);
if (edited) {
try {
await commit(edited);
console.log(`\n ${GREEN}Committed successfully!${RESET}`);
const result = await commit(edited);
console.log(
`\n ${GREEN}${BOLD}✔ Committed successfully!${RESET}`,
);
if (result.hash) {
console.log(` ${YELLOW}${result.hash}${RESET} ${edited}`);
}
if (result.summary) {
console.log(` ${DIM}${result.summary}${RESET}`);
}
} catch (err) {
console.error(
` ${RED}Commit failed: ${err instanceof Error ? err.message : err}${RESET}`,