Skip to content

refactor(knowledge): run video-digest async CLIs through one runMain helper - #15628

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15623-43269211628-1
Nov 12, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15623-43269211628-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #15623

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Seven video-digest extraction CLIs ended in the same 10-line main-module tail. That tail now lives once, in extraction/lib/run-main.js as runMain(moduleUrl, cli), and each script calls runMain(import.meta.url, <cli>). runMain takes the caller's import.meta.url so isMainModule still judges the calling module. It imports isMainModule and writeStderr from the same melodic/video-digestion/shared/* specifiers the callers used, so stdout, stderr text and exit codes stay the same. Design choice: the new import goes in each file's relative-import group, in sorted position, rather than in the package-import line it replaces, to keep the files' existing import grouping. analyze-harvested-repos.js and watch-state.js keep their own tails, as the issue requires.

Not verified

  • plugins/knowledge/skills/video-digest/scripts/run-tests.sh all (install, build/typecheck, vitest) was not run: the lane allows no interpreter or test runner. It is left to the PR's test-node CI lane
  • ci-status is green: a PR CI check, left to the PR's CI
  • tidy pass 5 (ai-slop:audit fix): the deterministic detector (detect.sh) is not runnable in this lane, so only the rubric read ran over the 7-line changelog fragment, which found nothing to fix

Fix

  • plugins/knowledge/skills/video-digest/extraction/lib/run-main.js: new helper exporting runMain(moduleUrl, cli), with JSDoc types for checkJs; runs the CLI when isMainModule(moduleUrl), sets process.exitCode from its result, and on a rejection writes the error message to stderr and sets exit code 1
  • plugins/knowledge/skills/video-digest/extraction/harvesting/run-harvest.js: tail replaced with runMain(import.meta.url, runHarvestCli); isMainModule import replaced by the runMain import
  • plugins/knowledge/skills/video-digest/extraction/transcript/run-transcript.js: tail replaced with runMain(import.meta.url, runTranscriptCli); isMainModule import replaced by the runMain import
  • plugins/knowledge/skills/video-digest/extraction/watch/caption-recheck.js: tail replaced with runMain(import.meta.url, main); isMainModule import replaced by the runMain import
  • plugins/knowledge/skills/video-digest/extraction/watch/recover-watch-bootstrap.js: tail replaced with runMain(import.meta.url, recoverWatchBootstrapCli); isMainModule import replaced by the runMain import
  • plugins/knowledge/skills/video-digest/extraction/watch/run-resume.js: tail replaced with runMain(import.meta.url, runResumeCli); isMainModule import replaced by the runMain import
  • plugins/knowledge/skills/video-digest/extraction/watch/run-watch.js: tail replaced with runMain(import.meta.url, runWatchCli); isMainModule import replaced by the runMain import
  • plugins/knowledge/skills/video-digest/extraction/watching/run-watching-pipeline.js: tail replaced with runMain(import.meta.url, runWatchingPipelineCli); isMainModule import replaced by the runMain import
  • .changes/knowledge/work-resolve-issue-issue-15623-43269211628-1-f06705d4.md: new patch fragment, ### Changed, 'Internal restructuring, no behavior change.'

Verification

The runner ran each check from the base copy against ca9af22:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 6 fragments valid (run before and after tidy)
  • check-changed-skills: video-digest PASS, 0 errors, 5 pre-existing warnings unrelated to this change (run before and after tidy)
  • check-affected: 12 passed, 7 skipped, over 9 changed files (run before and after tidy)
  • Grep over the seven scripts: no isMainModule reference is left, and each file still uses writeStderr elsewhere (1 to 21 calls per file)
  • Grep over .test. under video-digest: no test mocks isMainModule, asserts 'process.exitCode = code', or reads the source of the seven scripts
  • Grep for line-number citations into the seven scripts (name.js:<n>): none, so the CI line-citations check is unaffected
  • Fresh-context review subagent over the whole diff: no problems. It confirmed that call timing, exit codes, stderr text, exports, the module judged as main, the writeStderr mocks in tests, run-watch-signal.test.js's child-process run, and the checkJs types of every CLI (each returns…
  • tidy-diff over 16 hunk rows: no edits needed in any pass
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43269211628

Left out: the items under Not verified.

Related

#15623

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed ca9af228414dd61d4667414bfbf94e02245263d1: read 9 of 9 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of all 9 changed files.

The PR moves the async main-module tail, repeated in seven video-digest extraction CLIs, into one helper: extraction/lib/run-main.js exporting runMain(moduleUrl, cli). Each of the seven scripts now calls runMain(import.meta.url, <cli>).

What I checked

  • Same behavior. The helper's body is the old tail copied token for token: the isMainModule guard, process.exitCode = code on resolve, and on reject writeStderr(message) then exit code 1. It still receives the caller's import.meta.url. isMainModule compares process.argv[1] against the URL it is given, so it still judges the calling script, not run-main.js. Each tail sat at the end of its module, so the order of top-level code is unchanged.
  • Test mocks. Twelve test files replace @melodic/video-digestion/shared/terminal with vi.mock. That mock applies to the module everywhere it is imported, so run-main.js gets the mocked writeStderr just as the scripts did. The scripts already imported writeStderr themselves, so every mock already supplies it.
  • Issue Run the video-digest async CLIs through one main-module helper #15623 criteria.
    • The tail now exists once, and all seven scripts call runMain.
    • The diff touches only the files the issue lists, plus the patch changelog fragment.
    • The PR is about 100 changed lines across 9 files, well under the 400-line and 15-file limits.
    • analyze-harvested-repos.js and watch-state.js keep their own tails, as the issue requires.
    • watch/run-watch-signal.test.js runs run-watch.js as a child process and checks its exit codes, so a test exists that would fail if runMain broke.
  • Not verified by me. Two criteria are open: "run-tests.sh all passes" (install, typecheck, vitest) and "ci-status green". The PR lists both as not verified and leaves them to CI. I had no shell, so I ran neither.

No plugin manifest changed, so there are no manifest lines. No prior findings or settled threads applied. No embedded instructions appeared in the PR context.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed ca9af228414dd61d4667414bfbf94e02245263d1: read 9 of 9 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15628

I found no security issues.

Scope: I read every hunk of all 9 changed files in the full diff. None of them match a trusted-path glob. No trust control, merge hold, manifest, workflow or standing instruction is touched.

What changed: this is a behavior-preserving refactor. Seven video-digest extraction CLIs each ended in the same block: an isMainModule(import.meta.url) check, then .then setting process.exitCode and .catch writing the error to stderr. That block now lives once, in the new plugins/knowledge/skills/video-digest/extraction/lib/run-main.js as runMain(moduleUrl, cli).

What I checked:

  • Same main-module decision. Each caller passes its own import.meta.url, so isMainModule still judges the calling script, not the helper. No CLI starts running just because another module imports it.
  • Same output and inputs. The helper keeps the base code's stderr text (only error.message or String(error), no stack traces or environment), its exit codes and its process.argv handling.
  • No new dependency. The helper imports isMainModule and writeStderr from the same @melodic/video-digestion/shared/* specifiers the callers already used.
  • Changelog fragment. The new file under .changes/knowledge/ is a plain patch-bump note with nothing in it that runs.

PR context: the description has no embedded instructions aimed at this lane. It says the closing issue's body was left out because its author is not on the allow lists.

Prior findings: this lane has not reviewed an earlier head of this PR (blocking only: no), so this was a full review.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head ca9af228414dd61d4667414bfbf94e02245263d1, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for ca9af22

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15628-ca9af228414dd61d4667414bfbf94e02245263d1, expires on 2026-12-12.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=LOW demote=false head=ca9af228414dd61d4667414bfbf94e02245263d1 rubric=8.4.12 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 9c313b2 Nov 12, 2026
50 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15623-43269211628-1 branch November 12, 2026 17:59
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 9c313b23b6ab6d3439c2e010ce75925b95b8d33f; later checks count it verified from this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run the video-digest async CLIs through one main-module helper

0 participants