Repository navigation
Description
Agent Brief
Type: Task
Summary: Move the pretty-printed JSON file write that five video-digest watch scripts repeat into one writeJsonFile, exported beside readJsonFile from plugins/knowledge/skills/video-digest/extraction/lib/watch-frame-index.js (part of restructuring pass #14622).
Current behavior:
Five scripts under plugins/knowledge/skills/video-digest/extraction/watch/ write JSON as fs.writeFileSync(<file>, ${JSON.stringify(, null, 2)}\n, "utf8"):
repair-synthesis-promotions.js:30-36andsanitize-slice-temp-paths.js:30-36each define an identical localwriteJson(file, value), called atrepair-synthesis-promotions.js:185,186,263andsanitize-slice-temp-paths.js:50,72,95,104.export-sheet-frame-index.js:57,merge-triage-json.js:74andvision-gated-promote.js:164write the same expression inline.
All five import readJsonFile from ../lib/watch-frame-index.js (repair-synthesis-promotions.js:24, sanitize-slice-temp-paths.js:16, export-sheet-frame-index.js:16, merge-triage-json.js:15, vision-gated-promote.js:21), which defines it at lib/watch-frame-index.js:13-21.
Desired behavior:
lib/watch-frame-index.jsexportswriteJsonFile(filePath, value), with JSDoc types, next toreadJsonFile, writing the same bytes; its header "Shared slice-artifact JSON reads" (:2) says "reads and writes".- The two local
writeJsonhelpers go, and their 7 calls callwriteJsonFile; the 3 inline writes call it too. Each script addswriteJsonFileto its existingwatch-frame-index.jsimport. - Each
fsimport stays, since every script usesfsfor other calls (repair-synthesis-promotions.js:53,sanitize-slice-temp-paths.js:46,export-sheet-frame-index.js:30,merge-triage-json.js:30,vision-gated-promote.js:47), and thefs.mkdirSynccalls before the inline writes stay (export-sheet-frame-index.js:56,merge-triage-json.js:72). - No test file is added. No repository check pairs a file under
extraction/with a test:scripts/affected-tests-no-suite.txt:122-128records the whole tree as covered by thetest-nodelane, which runsplugins/knowledge/skills/video-digest/scripts/run-tests.shinstall,build(typecheck) andtestwhen a file under the package changes (scripts/node-subprojects.txt:10,scripts/plan-test-lanes.sh:54-55);extraction/vitest.config.ts:5sets no coverage gate;lib/watch-frame-index.jshas no suite today (git ls-files); and noscripts/check-*.shnamesvideo-digest(git grep).
Dependencies: this item shares no file with the change that adds extraction/lib/run-main.js for the seven CLI tails (run-harvest.js, run-transcript.js, caption-recheck.js, recover-watch-bootstrap.js, run-resume.js, run-watch.js, run-watching-pipeline.js); each adds its own fragment. If both come to touch one file, rebase on whichever lands first.
Files:
plugins/knowledge/skills/video-digest/extraction/lib/watch-frame-index.jsplugins/knowledge/skills/video-digest/extraction/watch/repair-synthesis-promotions.jsplugins/knowledge/skills/video-digest/extraction/watch/sanitize-slice-temp-paths.jsplugins/knowledge/skills/video-digest/extraction/watch/export-sheet-frame-index.jsplugins/knowledge/skills/video-digest/extraction/watch/merge-triage-json.jsplugins/knowledge/skills/video-digest/extraction/watch/vision-gated-promote.js- a new
patchfragment in.changes/knowledge/:### Changed, "Internal restructuring, no behavior change."
Key interfaces:
- Each script's exported functions, written files, stdout, stderr and exit codes: unchanged.
- Three writes stay as they are:
watch/queue-claim.js:103-104writes to anopenSync(..., "wx")descriptor,watching/write-watching-manifest.js:36-38is async, andplugins/knowledge/skills/course-digest/extraction/extract-course.js:53-55writes no trailing newline. - No test names
writeJson, which is file-local today, and no eval or fixture names the helpers.
Acceptance criteria:
- The pretty-printed JSON file write exists once, in
writeJsonFileinlib/watch-frame-index.js, and the five scripts call it. - Behavior is unchanged: the same outputs, exit codes and printed results for the same inputs.
- The diff edits only the listed files and the lines of a test that assert on them when the change breaks that assertion.
- The pull request stays within 400 changed lines and 15 hand-edited files.
-
plugins/knowledge/skills/video-digest/scripts/run-tests.sh allpasses, includingrepair-synthesis-promotions.test.js,sanitize-slice-temp-paths.test.js,export-sheet-frame-index.test.jsandvision-gated-cli.test.js, which importsmerge-triage-json.jsandvision-gated-promote.js(:10,16). - ci-status is green.
Out of scope:
queue-claim.js,write-watching-manifest.js, course-digest, a new test file, other duplication, eval cases, fixtures, and skill and agent text.
Metadata
Metadata
Assignees
Labels
Type
Fields
Work status
Priority
Activity
melodic-automation-lanes commentedon Nov 12, 2026
{"v":1,"actor_id":337595936,"title_sha256":"ce6bba83fba19048271eecfeb92a9290cec7044e57e807c284d1cc6a849de55f","body_sha256":"90107f4ad8e755a7800c6c4abd83030814c570a7efa74b242a9f6ed9f9cddcd0"}
github-actions commentedon Nov 12, 2026