commit 68355e3962257e1c63674b8d0eca392dfe590b5d
parent 982d1a7789a58e13a625545bf43b4b4b1cc665bf
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 17 Oct 2026 17:29:51 -0400
umtool: the take maker uses M3's mergePatch (report-to-video exports montage-styles)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/umtool/lib/report/takeMaker.mjs b/umtool/lib/report/takeMaker.mjs
@@ -41,6 +41,7 @@ import { createHash } from "node:crypto";
import { lstat, mkdir, readFile, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
import path from "node:path";
import { pathToFileURL } from "node:url";
+import { mergePatch } from "umtool-report-to-video/montage-styles";
import { PIPELINE_DIR, UMTOOL_DIR } from "./driver.mjs";
import { replaceManifest } from "./manifest.mjs";
import { withEditNotes } from "./edit-guard.mjs";
@@ -73,27 +74,14 @@ const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
const clone = (v) => (v === undefined ? undefined : JSON.parse(JSON.stringify(v)));
// ---------------------------------------------------------------------------
-// RFC 7386 JSON merge patch, and the words for what one changes.
+// The words for what a merge patch changes.
// ---------------------------------------------------------------------------
-/**
- * Apply a JSON merge patch (RFC 7386): an object patch merges key by key, a
- * `null` member removes the key, anything else -- an array included --
- * replaces the value whole. Never mutates either argument.
- *
- * @param {unknown} target
- * @param {unknown} patch
- * @returns {unknown}
- */
-export function mergePatch(target, patch) {
- if (!isObj(patch)) return clone(patch);
- const out = isObj(target) ? clone(target) : {};
- for (const [k, v] of Object.entries(patch)) {
- if (v === null) delete out[k];
- else out[k] = mergePatch(out[k], v);
- }
- return out;
-}
+// mergePatch is lane M3's (report-to-video/montage-styles.mjs): the same
+// RFC 7386 the styles are written for -- objects merge, `null` removes a key,
+// anything else (an array included) replaces the value whole -- one
+// implementation, re-exported here for the take maker's callers.
+export { mergePatch };
/**
* Every leaf a merge patch sets, as a dotted path: a non-object value, a
diff --git a/umtool/report-to-video/package.json b/umtool/report-to-video/package.json
@@ -28,6 +28,7 @@
"./factcheck": "./factcheck.mjs",
"./frames-cut": "./frames-cut.mjs",
"./ledger-totals": "./ledger-totals.mjs",
+ "./montage-styles": "./montage-styles.mjs",
"./lint": "./lint.mjs",
"./local-media": "./local-media.mjs",
"./mute": "./mute.mjs",