Files
hyperframes/scripts/generate-skill-module-copies.mjs
T
Miguel Ángel 4fcad1ed74 fix(media-use): use a host app's music tools; fail loudly without the heygen CLI (#5154)
* fix(media-use): use a host app's music tools; fail loudly without the heygen CLI

* fix(media-use): name the heygen CLI only for music and sound effects; keep the sfx test offline

* fix(skills): workflow skills use a host app's own music tools first

* fix(skills): say how a host app's music track reaches the narrated workflows

* fix(skills): set a host app's music track after the last audio pass

* fix(skills): a host-music film with no narration still fetches its sound effects

* fix(media-use): keep the stub-failure test off the machine's heygen CLI; sync the skills manifest

* fix(skills): audio passes keep a host app's music and sounds; silent needs no sound cues

* fix(skills): host audio keeps string frames, stops on a broken audio_meta.json, survives a re-run

* fix(skills): report a host audio entry with no path and a broken sidecar instead of crashing

* fix(skills): keep host audio written while an audio pass runs

* test(cli): serve the telemetry capture while the resolve child waits on it

* test(cli): fail the telemetry capture when the resolve child exits non-zero

* style(skills): wrap the host audio comment to the 120-column limit
2026-10-07 07:16:51 +00:00

48 lines
1.8 KiB
JavaScript

import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const workflows = ["faceless-explainer", "pr-to-video", "product-launch-video"];
export const skillModuleCopies = [
[
"packages/cli/src/media-use/lib/media-fetch.mjs",
["skills/media-use/scripts/lib/media-fetch.mjs"],
],
[
"skills/media-use/audio/scripts/lib/bgm-volume.mjs",
workflows.map((skill) => `skills/${skill}/scripts/lib/bgm-volume.mjs`),
],
[
"skills/media-use/audio/scripts/lib/host-audio.mjs",
workflows.map((skill) => `skills/${skill}/scripts/lib/host-audio.mjs`),
],
[
"skills/hyperframes/scripts/lib/frame-packets-core.mjs",
[...workflows, "general-video"].map(
(skill) => `skills/${skill}/scripts/lib/frame-packets-core.mjs`,
),
],
];
function synchronizeCopy(content, target, check) {
const path = resolve(root, target);
if (check) return readFileSync(path, "utf8") !== content;
mkdirSync(dirname(path), { recursive: true });
writeFileSync(path, content);
return false;
}
export function generateSkillModuleCopies({ check = false } = {}) {
return skillModuleCopies.flatMap(([source, targets]) => {
const content = readFileSync(resolve(root, source), "utf8");
return targets.filter((target) => synchronizeCopy(content, target, check));
});
}
if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.meta.url) {
const drifted = generateSkillModuleCopies({ check: process.argv.includes("--check") });
if (drifted.length) throw new Error("Regenerate skill module copies: " + drifted.join(", "));
console.log("Skill module copies are in sync");
}