fix(export): split bulk-export toast across success / partial / all-failed

The Phase 9 bulk export utility had a single success toast that was emitted
even when zero of N writes succeeded — "Exported 0 of 5 transcripts to
folder/" reading like the user just deliberately exported nothing.

Branch on the result count:
- 0 of N: error toast pointing at the console for write failures.
- N of N: success toast.
- M of N: warn toast — partial export, with the same console pointer.

Single-file save (`saveTranscriptAsMarkdown`) was already correct:
explicit success on save, error on failure, silent on user-cancelled —
left untouched.

https://claude.ai/code/session_0189xUb6ie6t9qHkzatGZ9Rb
This commit is contained in:
Claude
2026-04-25 09:37:13 +00:00
parent fd48f55edb
commit 38da407942

View File

@@ -90,11 +90,24 @@ export async function exportTranscriptsToDir(
console.error("exportTranscriptsToDir write failed", path, err);
}
}
toasts.success(
written === items.length
? `Exported ${written} transcript${written === 1 ? "" : "s"} to ${basename(dir)}`
: `Exported ${written} of ${items.length} transcripts to ${basename(dir)}`,
);
if (written === 0) {
// All writes failed — surface as an error instead of "Exported 0
// transcripts" success toast which reads like the user just bulk-
// exported nothing on purpose.
toasts.error(
"Couldn't export transcripts",
`0 of ${items.length} written to ${basename(dir)}. Check the console for details.`,
);
} else if (written === items.length) {
toasts.success(
`Exported ${written} transcript${written === 1 ? "" : "s"} to ${basename(dir)}`,
);
} else {
toasts.warn(
`Partial export to ${basename(dir)}`,
`${written} of ${items.length} transcripts written. Check the console for the failures.`,
);
}
return written;
}