feat: transcript-grounded, on-brand metadata authoring (#43)#52
Merged
Conversation
Phase-1 of agentic copy authoring: give an agent the raw materials to write
grounded, on-brand video metadata, and let the existing videos update path
apply it.
- videos captions <id> list caption tracks (captions.list), table/json
- videos transcript <id> download a track as clean plain text (captions.download,
tfmt=srt), --lang select, -o text|json; clear message
when a track exists but is not downloadable
- profile brand show/set/edit per-channel brand voice at profiles/<name>/brand.md
(owner-only), $EDITOR for edit, --file for set
- SKILL.md authoring section: brand show -> transcript -> show -> draft ->
update dry-run -> execute, with the grounding rules
No new OAuth scope (youtube.force-ssl already requested). External ASR/STT and
bulk authoring stay out of scope for later phases.
SRT parsing is block-based so numeric-only cue text (countdowns, years) survives;
consecutive-duplicate collapsing is gated to ASR tracks so repeated lines in
human captions are preserved. Caption download distinguishes a restricted/ASR
403 from a quotaExceeded 403 so quota exhaustion is reported correctly.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
==========================================
+ Coverage 84.28% 85.03% +0.75%
==========================================
Files 15 15
Lines 2520 2660 +140
Branches 372 393 +21
==========================================
+ Hits 2124 2262 +138
Misses 264 264
- Partials 132 134 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Phase-1 of #43. Gives an agent the two raw materials it needs to author good metadata - the spoken content of a video and a per-channel house style - and lets the existing
videos updatepath apply the result. The agent writes; the CLI supplies grounding and applies changes.What's new
Transcript grounding (
src/ytstudio/commands/videos.py)ytstudio videos captions <id> [-o table|json]- list caption tracks (captions.list).ytstudio videos transcript <id> [--lang xx] [-o text|json]- download a track as clean plain text (captions.download,tfmt=srt);-o jsonadds track metadata. Surfaces a clear message when a track exists but is not downloadable (restricted ASR) instead of failing opaquely.Per-channel brand voice (
src/ytstudio/config.py,src/ytstudio/commands/profile.py)profiles/<name>/brand.md, owner-only (0o600in the0o700profile dir).ytstudio profile brand show | set --file <path> | edit(editopens$EDITORand seeds a template).--profile/-pdefaults to the active profile.Skill guidance (
skills/ytstudio/SKILL.md)brand show->transcript->videos show-> draft ->videos updatedry-run ->--execute, with the rules that the transcript is the source of truth for claims, the brand file for tone, and the agent never fabricates.No new OAuth scope (
youtube.force-sslis already requested). External ASR/STT and bulk authoring stay out of scope for later phases.How it was built
Designed and reviewed with a multi-agent workflow: parallel readers mapped the relevant subsystems and synthesized a code-grounded plan, then an adversarial review pass (5 dimensions, each finding independently verified) ran over the diff. Six confirmed findings were all fixed before this PR:
403from aquotaExceeded403, so quota exhaustion reaches the real quota handler instead of telling the user to "pick another track".Tests
tests/test_captions.py(new) covers captions list (table/json/empty), transcript text/json, language selection, standard-vs-ASR preference, numeric-cue preservation, ASR dedup vs human no-dedup, not-downloadable, and quota-not-misreported;srt_to_texthas direct unit tests (multiline join, tag stripping, empty).tests/test_profile.pyadds brand show/set/edit including the owner-only re-chmod. Full suite: 338 passed, ruff clean, bundled skill reference regenerated.