Skip to content

feat(cli): hyperframes narration list, init and check - #8940

Open
DhanushMurugesanG wants to merge 3 commits into
heygen-com:mainfrom
DhanushMurugesanG:narration/3-cli
Open

DhanushMurugesanG wants to merge 3 commits into
heygen-com:mainfrom
DhanushMurugesanG:narration/3-cli

Conversation

@DhanushMurugesanG

Copy link
Copy Markdown

Part 3 of 4 for linked narration (#6708). Builds on #8938 and #8939: until they merge, this PR also shows their commits. Only the last commit (feat(cli): hyperframes narration list, init and check) is new here.

What

A narration command with three subcommands:

  • hyperframes narration init: writes narration.json for a project voiced before it existed. It reads media-use's audio_meta.json and audio_request.json (the text comes from the request), or else clips already tagged data-narration-line and the caption words inside them. It tags each line's clip, all as one history entry. --force replaces an existing file.
  • hyperframes narration list: each line, its length (from audio_meta.json) and its findings, or "in sync".
  • hyperframes narration check: the narration findings from lint; exits 1 while any warning remains.

All take --dir and --json. A refusal (no narration.json, nothing to adopt, a file already there) exits 2 with its message.

Why

Lint (#8939) needs a narration.json to compare against, and nobody should have to write one by hand for a project media-use already voiced.

Related work

Refs #6708. Follows #8938 and #8939. Next is narration set.

How

  • packages/cli/src/commands/narration.ts: citty subcommands with lazy imports, like timeline. Printed text goes through terminalLines, and JSON answers the same with --json before or after the subcommand (cli.jsonFlag.test.ts lists the new leaves).
  • narration/init.ts writes the script only. Lengths and word timings stay in audio_meta.json. Clip tagging goes through applyFileMutations with expectedVersion, and narration/history.ts files it as one history entry (or joins a turn that's already open).
  • narration/status.ts runs the same lintProject pass and groups findings by line.
  • Lint's narration_manifest_invalid hint now mentions narration init.

Test plan

  • Unit tests added/updated: narration/init.test.ts. Adopt a media-use project (text from the request, clips tagged, no timings copied, lint clean); refuse to replace unless --force; adopt tagged clips with no media-use; refuse a project with nothing to adopt; list with and without audio_meta.json; check exit codes 0, 1 and 2 through the command.
  • bun run --filter @hyperframes/cli test: the narration tests, cli.jsonFlag.test.ts and printedFailureText.wiring.test.ts pass. 5 other files fail on my Mac for local reasons (Homebrew whisper, the local ffmpeg build, macOS file-name normalisation, a file-watcher timing test); none of them touch narration.
  • node scripts/check-docs-cli-commands.mjs passes.
  • Documentation updated: a narration section in docs/packages/cli.mdx.
  • Comments say why, not what.

Adds two subpaths that later narration work builds on. No behaviour
changes: nothing imports them yet.

- @hyperframes/parsers/narration: reads, checks and writes
  narration.json, the script of a narrated project (each line's text,
  voice, audio file and what it was last voiced from), keeping unknown
  keys. Lengths and word timings are not copied into it:
  narrationTimingsOf() reads them from media-use's audio_meta.json by
  line id.
- @hyperframes/parsers/caption-array: finds const/let/var `script` and
  `TRANSCRIPT` caption arrays in HTML, reads their words, and splices or
  shifts words while every other element stays byte-identical.

Refs heygen-com#6708
A project with narration.json now gets a warning when a line's text,
voice or WAV changed since it was voiced, when a line has no linked
clip or its clip is the wrong length, and when the caption words that
show it no longer match its voice. Captions that read differently from
the script get an info. No manifest, no findings, and nothing blocks a
render.

Lengths and word timings come from media-use's audio_meta.json by line
id. Without it, the length isn't checked and a line's captions only
need to fall inside its clip.

Refs heygen-com#6708
- init writes narration.json for a project voiced before it existed:
  from media-use's audio_meta.json and audio_request.json, or from clips
  already tagged with data-narration-line and the caption words inside
  them. It tags each line's clip, as one history entry. Lengths and word
  timings stay in audio_meta.json.
- list shows each line, its length from audio_meta.json and its
  narration findings, or "in sync".
- check prints the narration findings from lint and exits 1 while any
  warning remains.

Every subcommand takes --dir and --json and answers the same with
--json before or after it. A refusal (no narration.json, nothing to
adopt) exits 2 with its message.

Refs heygen-com#6708
@mintlify

mintlify Bot commented Nov 26, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 21385fa.

Approve preview

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant