Merge pull request #2564 from heygen-com/via/win-workdir-env

feat(cli): surface extract-cache dir in doctor + add --frames-cache-dir sugar
This commit is contained in:
Vance Ingalls
2026-07-17 00:43:06 -07:00
committed by GitHub
7 changed files with 290 additions and 19 deletions
+30
View File
@@ -35,6 +35,10 @@ export const examples: Example[] = [
["Deterministic render via Docker", "hyperframes render --docker --output deterministic.mp4"],
["Parallel rendering with 6 workers", "hyperframes render --workers 6 --output fast.mp4"],
["Opt out of browser GPU render", "hyperframes render --no-browser-gpu --output cpu.mp4"],
[
"Relocate frame cache off C: (Windows) or another small partition",
"hyperframes render --frames-cache-dir D:/hf-cache --output out.mp4",
],
["HDR output (auto-detected)", "hyperframes render --output hdr-output.mp4"],
[
"Override composition variables (parametrized render)",
@@ -89,6 +93,7 @@ import {
} from "../utils/render-success-state.js";
import type { ProducerLogger, RenderJob } from "@hyperframes/producer";
import {
EXTRACT_CACHE_DIR_DISABLED_ALIASES,
MAX_VP9_CPU_USED,
MIN_VP9_CPU_USED,
isVideoFrameFormat,
@@ -397,6 +402,18 @@ export default defineCommand({
// guard below leaves PRODUCER_EXPERIMENTAL_FAST_CAPTURE untouched and the
// env fallback survives (matches the --low-memory-mode idiom).
},
"frames-cache-dir": {
type: "string",
description:
"Directory for the content-addressed extracted-frame cache. " +
"Use to relocate the cache off the system drive when the OS temp " +
"directory lives on a small partition (e.g. Windows C: exhaustion " +
`during long renders). Pass ${EXTRACT_CACHE_DIR_DISABLED_ALIASES.map((a) => `"${a}"`).join(" / ")} to ` +
"disable caching entirely (frames extract into the render's workDir " +
"and are cleaned up when the render ends). Default: " +
"<tmpdir>/hyperframes-extract-cache-<uid>. " +
"Env: HYPERFRAMES_EXTRACT_CACHE_DIR.",
},
},
// `run` is the citty handler for `hyperframes render` — sequential flag
// validation + render dispatch. Inherited CRITICAL on main (CRAP 1290);
@@ -580,6 +597,19 @@ export default defineCommand({
: "false";
}
// ── Override: extracted-frame cache directory ────────────────────────
// Sugar for HYPERFRAMES_EXTRACT_CACHE_DIR. Set BEFORE resolveConfig() so
// the env resolver picks up the CLI-supplied value. Disabling aliases
// (off/none/false/0) pass through verbatim — the engine helper canonicalizes.
// Positive paths are resolved to absolute so CWD changes downstream can't
// stale them.
if (typeof args["frames-cache-dir"] === "string" && args["frames-cache-dir"].trim() !== "") {
const raw = args["frames-cache-dir"].trim();
const normalized = raw.toLowerCase();
const isDisableAlias = EXTRACT_CACHE_DIR_DISABLED_ALIASES.includes(normalized);
process.env.HYPERFRAMES_EXTRACT_CACHE_DIR = isDisableAlias ? raw : resolve(raw);
}
// ── Validate max-concurrent-renders ─────────────────────────────────
if (args["max-concurrent-renders"] != null) {
const parsed = parseInt(args["max-concurrent-renders"], 10);