mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
* fix(cli): a project .env provider key prints a note when it is used A provider key from a project .env is still used when no own credential competes. Capture vision (OpenRouter, Gemini, Google and both Vertex parts), snapshot --describe, Gemini speech and Lyria music now print one note per key before it is first used, naming the variable and the escaped .env path, as the ElevenLabs note does. The ignoring notes escape the path too, and the media-use skill gets a generated copy of the CLI's terminal-text helper. * fix(media-use): the audio scripts read a received .env by the CLI's full rule The audio scripts judged a project .env as received only from received-files.json at or above it. They now use a generated copy of the CLI's rule, which also reads the host's received-state file, nested records and the received content hashes, and treats an unreadable one as received. A parity test runs the CLI and the copy over the same projects. A key the CLI unset from a .env is now passed to the scripts it launches, so they do not load it again from the same file. * fix(media-use): match the CLI's folder walk and judge a parent .env by itself The received-rule copy now skips folders by the CLI's exact private-path rule, so a hidden Studio folder with an asset-like name is walked as the CLI walks it. A .env the scripts find in a folder above the working one is judged only by records and host state at or above that folder, so a received sibling or a large parent folder cannot flip the person's own key. Keys the CLI unset are matched by the folder's real path. * fix(media-use): match the received rule's narrowed private-file check The CLI's private-file rule now treats a hidden file as private whatever its type, and framework build-output folders and service-account key names as private. The media-use copy of the rule follows it, so the parity cases for hidden asset-named Studio folders agree again.
61 lines
2.1 KiB
JavaScript
61 lines
2.1 KiB
JavaScript
import { mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
export const skillModuleCopies = [
|
|
[
|
|
"packages/cli/src/media-use/lib/media-fetch.mjs",
|
|
["skills/media-use/scripts/lib/media-fetch.mjs"],
|
|
],
|
|
[
|
|
"packages/cli/src/media-use/lib/terminal-text.mjs",
|
|
["skills/media-use/scripts/lib/terminal-text.mjs"],
|
|
],
|
|
[
|
|
"packages/cli/src/media-use/lib/received-env.mjs",
|
|
["skills/media-use/scripts/lib/received-env.mjs"],
|
|
],
|
|
[
|
|
"packages/cli/src/media-use/lib/openverse.mjs",
|
|
["skills/media-use/audio/scripts/lib/openverse.mjs"],
|
|
],
|
|
[
|
|
"skills/hyperframes/scripts/lib/main-module.mjs",
|
|
[
|
|
"skills/media-use/audio/scripts/lib/main-module.mjs",
|
|
"packages/cli/src/media-use/lib/main-module.mjs",
|
|
],
|
|
],
|
|
[
|
|
"skills/hyperframes/scripts/lib/windows-exe-search.mjs",
|
|
[
|
|
"skills/media-use/scripts/lib/windows-exe-search.mjs",
|
|
"skills/figma/scripts/lib/windows-exe-search.mjs",
|
|
// The CLI build replaces the published media-use scripts/lib with this folder.
|
|
"packages/cli/src/media-use/lib/windows-exe-search.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(realpathSync(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");
|
|
}
|