mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
feat(cli): surface extract-cache dir in doctor + add --frames-cache-dir sugar
Windows users with the OS temp dir on a small system drive have hit C: exhaustion mid-render (Slack ts=1784219488 · CLI v0.7.58 · win32 15 GB / 8-core, ~5500 frames). The engine already honors HYPERFRAMES_EXTRACT_CACHE_DIR for relocation, but the knob was undocumented and invisible in diagnostics — the reporter had to piece together a 4-flag compound workaround including EXTRACT_CACHE_DIR=off. Changes: - Extract the env-var resolver into a public engine API (resolveExtractCacheDir, defaultExtractCacheDir, EXTRACT_CACHE_DIR_DISABLED_ALIASES) with a typed resolution shape distinguishing "disabled by user" vs "default" vs "env override". - Add a Frames-cache check to `hyperframes doctor` that reports the effective directory, its free space, source (env or default), and fails with a relocation hint when <2 GB free at that mount. - Add `hyperframes render --frames-cache-dir <path>` as discoverable CLI sugar for the env var, including the opt-out aliases (off/none/false/0) and CWD-safe absolute-path resolution. - Document the flag in docs/packages/cli.mdx with the field-signal citation, and add a render example row for the Windows workflow. - Cover both surfaces with unit tests (6 doctor cases + 4 engine cases including all disabled-alias variants). Refs Slack #hyperframes-cli-feedback ts=1784219488 (win32 v0.7.58). Co-authored-by: Via <via-heygen[bot]@users.noreply.github.com>
This commit is contained in:
@@ -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)",
|
||||
@@ -396,6 +400,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 "off" / "none" / "false" / "0" 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);
|
||||
@@ -579,6 +595,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 = ["off", "none", "false", "0"].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);
|
||||
|
||||
Reference in New Issue
Block a user