fa63f4d956
Includes all spec features plus pop-out player with bidirectional video transfer: - YouTube IFrame API + Data API v3 channel management - Idle/broadcast mode, channel flip animation, NCO onboarding - Pop-out player (⧉/P) transfers video to popup; P closes and returns it Co-Authored-By: claude-flow <ruv@ruv.net>
2.8 KiB
2.8 KiB
VidFlow — Codex Agent Instructions
Role
Codex implements. Claude reads context, writes task prompts, and reviews diffs. When Claude delegates a task here, implement it fully and trust your own reading of the file — Claude will catch anything that needs correction in the diff review.
How Claude Delegates
Claude writes a task description and runs:
cd /home/aaron/Programming/vidflow && /home/aaron/.npm-global/bin/codex exec < /tmp/vf-task.md
# or inline:
cd /home/aaron/Programming/vidflow && /home/aaron/.npm-global/bin/codex exec "edit vidflow.html: ..."
After you finish, Claude reviews with git -C /home/aaron/Programming/vidflow diff and either accepts or makes targeted corrections.
Project Rules (enforce these without being told)
- Single file: everything lives in
vidflow.html— no new files, no build step, no frameworks - Script section order must be preserved (see below)
- Never hardcode API keys — stored in
localStorageonly - All app state in
const A— never create separate state variables - Keyboard shortcuts: call player API directly, never
.click()on DOM elements DEBUG = false— never commit as true
Script Section Order
When adding functions, insert them in the correct section:
- State (
const A,const FD,DEBUG,dbg) - Utility (
qs,qsa,esc,cleanArtist,extractPID) - YouTube IFrame API (
onYouTubeIframeAPIReady,onPReady,onPState,onPErr) - Channel flip (
flip()) - Channel loading (
loadCh()) - Now playing (
updateNP,setTicker,tickerLoop,showTitleCard) - Progress bar (
startPB) - Data API (
apiFetch,validateKey,searchPL,getPLInfo) - Channel management (
addCh,removeCh,updateCS) - UI rendering (
renderTab,renderChTab,renderSearchTab,renderAddTab) - NCO onboarding (
initNCO,renderNCOTab,ncoAdd) - Visibility helpers + toast
- Persistence (
save,loadState) - Setup (
initSetup) - App launch (
launchApp) - Controls wiring (
wireControls) - Pop-out transfer (
popOut, storage listeners) - Idle system (poll + event listeners)
- PWA manifest injection
- Init:
loadState(); wireControls(); initSetup();
Known Gotchas (check these when editing related code)
stopVideo()beforeloadPlaylist()on channel switch — prevents shared-video stuck state- Shuffle: must call
setShuffle(true)ANDplayVideoAt(startIdx)—loadPlaylistindex alone isn't enough - Sidebar click-close: guard with
document.contains(e.target)before checkingsb.contains() - Keyboard handlers: skip if
e.target.tagNameis INPUT or TEXTAREA window.openerdistinguishes popup from main window for pop-out transfer logic
Local Dev
python3 -m http.server 8080
# Open http://localhost:8080/vidflow.html
# Must be HTTP — YouTube API rejects file://