refactor: fix exit-1 comment, remove JSON round-trip, use OfficeMeta cast

This commit is contained in:
jiayiyan
2026-05-18 16:41:37 +08:00
parent 6d069c955f
commit ed728b2ad9
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -37,6 +37,7 @@ export function createDifferAdapter(
if (!result.ok) {
const e = result.error;
if (e.kind === "non_zero_exit" && e.exitCode === 1) {
// docx-diff exits 1 when documents have differences — this is a success path
} else if (e.kind === "non_zero_exit") {
throw new Error(`differ: docx-diff failed (exit ${e.exitCode}): ${e.stderr}`);
} else if (e.kind === "timeout") {
@@ -52,8 +53,7 @@ export function createDifferAdapter(
throw new Error(`differ: report file not found: ${reportPath}`);
}
const raw = JSON.stringify({ outputDocx, sourceDocx, diffReport: reportPath });
const meta = schema.parse(JSON.parse(raw)) as T;
const meta = schema.parse({ outputDocx, sourceDocx, diffReport: reportPath });
return { meta, childThread: null };
};
}