mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-02 19:57:13 +00:00
* feat(cli): move media-use engine into the CLI * fix(cli): replace media-use compatibility asset * fix(cli): replace moved media-use tree * fix(cli): copy moved media-use files cleanly * fix(cli): copy media-use engine files individually * fix(cli): keep audio helper compatibility import * fix(cli): clear copied skill destinations * test(cli): preserve moved media-use test paths * fix(cli): preserve media-use script compatibility imports * fix(cli): preserve media-use telemetry shim * fix(cli): resolve packaged media-use LUT assets * fix(cli): resolve packaged bundled SFX assets * chore(skills): regenerate media-use manifest * fix(cli): preserve media-use parity coverage * fix(cli): cover relocated media-use tests * chore(skills): regenerate media-use manifest * fix(cli): format bundled media provider * fix(ci): run relocated media-use tests with node * fix(ci): preserve fallow script exemptions * fix(ci): scope media-use fallow exemption * refactor(cli): trim media-use essay comments * feat(cli): index media-use assets for catalog search * feat(catalog): commit media-use search vectors * chore(catalog): track media vector metadata * fix(catalog): validate media vector row order * fix(catalog): validate media artifact freshness * fix(catalog): cover media metadata and credits * fix(cli): reject malformed media rows * fix(catalog): compare complete media rows * feat(cli): route media search through media-use * refactor(cli): trim relocated media-use comments * fix(cli): make media search runtime-safe * fix(cli): preserve sfx fallback diagnostics * fix(cli): probe sfx fallback provider explicitly * chore(skills): regenerate manifest * refactor(cli): keep typed media ranker source * fix(cli): align media search checks with local-first flow * fix(cli): scope vector audit exceptions * fix(cli): ship resolver registry beside skill * fix(cli): keep media-use skill scripts standalone * test(cli): cover local vector validation * test(cli): correct media vector fixtures * fix(cli): prefer exact media keys * fix(cli): stem exact media keys * test(cli): skip media lint for snippets without media * fix(cli): align skills test discovery Keep the CI skills job's bash discovery as the single source of truth so its empty-list guard covers the exact files Node executes. Make hasMediaVectors private because it has no external callers and needs no Fallow suppression. * fix(cli): close media-use review gaps Prioritize literal ids before stemmed ids and cover the collision alongside the plural regression. Add command seam tests for engine discovery, actionable failure, and argv passthrough. Add a deterministic parity check for standalone media-use copies, with documented allowlists for the standalone media-fetch shim and self-contained npx resolver. Keep the bash-discovered skills test list as the CI source of truth. * fix(cli): lower parity check complexity Split missing-copy and unallowlisted-drift checks so the parity guard keeps its behavior without a threshold CRAP score. * fix(cli): close media-use review seams Run the parity test in the skills job so skills-only edits exercise the same check. Export the verb mapping and inject command dispatch for direct coverage. Keep missing-copy diagnostics separate from drift reads.
58 lines
2.3 KiB
JavaScript
58 lines
2.3 KiB
JavaScript
import { existsSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
|
|
function resolveNpxCliPath(env, pathExists) {
|
|
const npmExecPath = env.npm_execpath;
|
|
const nodeExecPath = env.npm_node_execpath || process.execPath;
|
|
if (npmExecPath) {
|
|
const fileName = npmExecPath.replace(/\\/g, "/").split("/").pop()?.toLowerCase();
|
|
const candidate =
|
|
fileName === "npx-cli.js" ? npmExecPath : join(dirname(npmExecPath), "npx-cli.js");
|
|
if (pathExists(candidate)) return candidate;
|
|
}
|
|
const besideNode = join(dirname(nodeExecPath), "node_modules", "npm", "bin", "npx-cli.js");
|
|
return pathExists(besideNode) ? besideNode : null;
|
|
}
|
|
|
|
// Sync-spawn analog of the audio engine's spawnP, for execFileSync call sites
|
|
// that must hard-fail (rather than fall through to another provider) when npx
|
|
// cannot be resolved. On Windows a bare "npx" is npx.cmd, which
|
|
// execFileSync/spawnSync cannot exec (spawnSync npx ENOENT) —
|
|
// resolveSpawnCommand reroutes it through node + npx-cli.js, no shell:true.
|
|
//
|
|
// `platform`/`env`/`pathExists` params (defaulting to the real values) exist
|
|
// so tests can exercise the win32 branch without mocking node:child_process
|
|
// (its ESM exports are non-configurable) — same idiom as spawnP and
|
|
// localTtsGenerate.
|
|
export function resolveNpxInvocation(
|
|
argv,
|
|
opts,
|
|
platform = process.platform,
|
|
env = process.env,
|
|
pathExists = existsSync,
|
|
) {
|
|
const resolved =
|
|
platform !== "win32"
|
|
? { cmd: "npx", args: argv, opts: { stdio: "ignore", ...opts } }
|
|
: (() => {
|
|
const nodeExecPath = env.npm_node_execpath || process.execPath;
|
|
const npxCliPath = resolveNpxCliPath(env, pathExists);
|
|
return npxCliPath
|
|
? {
|
|
cmd: nodeExecPath,
|
|
args: [npxCliPath, ...argv.map((arg) => String(arg))],
|
|
opts: { stdio: "ignore", windowsHide: true, ...opts },
|
|
}
|
|
: null;
|
|
})();
|
|
if (!resolved) {
|
|
// npx-on-win32 with no resolvable npx-cli.js — same terminal condition
|
|
// spawnP warns about, surfaced as a throw for callers with no fallback.
|
|
throw new Error(
|
|
"cannot run npx on Windows: npm's npx-cli.js was not found " +
|
|
"(install npm with Node, or run via npx/npm run so npm_execpath is set)",
|
|
);
|
|
}
|
|
return resolved;
|
|
}
|