refactor: remove explanatory comment and unspecified mode guard in differ adapter

This commit is contained in:
jiayiyan
2026-05-18 16:11:24 +08:00
parent 9a07418d89
commit 50a6ab9b9f
+1 -5
View File
@@ -23,10 +23,7 @@ export function createDifferAdapter(
throw new Error("differ: office step not found in ctx.steps (invariant violation)");
}
const officeMeta = officeStep.meta as { mode: string; outputDocx: string; sourceDocx: string | null };
if (officeMeta.mode !== "edit" || officeMeta.sourceDocx === null) {
throw new Error("differ: office step is not in edit mode");
}
const officeMeta = officeStep.meta as { outputDocx: string; sourceDocx: string };
const { outputDocx, sourceDocx } = officeMeta;
const reportPath = join(dirname(outputDocx), "diff_report.html");
@@ -40,7 +37,6 @@ export function createDifferAdapter(
if (!result.ok) {
const e = result.error;
if (e.kind === "non_zero_exit" && e.exitCode === 1) {
// exit 1 means "documents differ" — the normal success case for docx-diff
} else if (e.kind === "non_zero_exit") {
throw new Error(`differ: docx-diff failed (exit ${e.exitCode}): ${e.stderr}`);
} else if (e.kind === "timeout") {