Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
make Music Video projects deep-linkable by id, codify URL-selection convention
[._.]/ Adam Eivyde28d96002bf
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 4c1e70cd1f..050c23a39f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -10,6 +10,8 @@## Music Video+- **Deep-link straight to a project's scene board.** The Music Video page's selected project now lives in the URL (`/media/music-video/:projectId`) instead of local component state, so a project's edit/scene-selection board is directly shareable, bookmarkable, and reachable from ⌘K, voice nav, and the media job-completion hooks — clicking a project navigates to its id'd route, deleting the open project returns to the index, and a stale/deleted id renders a "project not found → back to projects" fallback rather than a blank selection. Establishes the project-wide convention (now documented in `CLAUDE.md`) that every selectable UI element encodes its selection in the URL by id. (`client/src/pages/MusicVideo.jsx`, `client/src/App.jsx`)+- **[issue-1945] Import a track's audio straight from a YouTube URL.** Both the project-create form and an existing project's detail view now have a "paste a YouTube URL" field next to the track picker (the detail view also gained the ability to change a project's linked track after creation, which wasn't previously possible at all). PortOS downloads the video and extracts just its audio via `yt-dlp` (a new host dependency — install it the same way you installed `ffmpeg`), lands it in the shared music library as a new Track, and links it to the project automatically. Progress streams live (download % → extracting → importing) with a Cancel button, mirroring the render job's progress UI. `POST /api/tracks/import/youtube` is a library-level endpoint (`server/services/trackYoutubeImport.js`, `server/lib/ytdlp.js`), so any project's track picker can reuse an imported track without re-downloading.- **[issue-1854] Beat-quantized timeline arranger: drag-snap scenes to the beat grid.** The director board's scene list now sits above an interactive **beat-grid timeline** (built from the project's cached audio analysis) showing section bands, beats, and downbeats. Drag a scene's right edge to trim how long it plays, or drag its body to reposition it — both snap to the nearest beat, downbeat, or section boundary within a small tolerance; an unsnapped drop is left exactly where you placed it. A confirmed (snapped) length-trim is marked **beat-aligned** and now renders *exactly* as arranged: the render's beat-snap step (`beatSnapClips`) honors a beat-aligned scene's saved `startSec`/`endSec` outright instead of re-deriving the cut from whichever beats happen to be nearby at render time — a reposition-only drag never marks a scene beat-aligned unless it already had a real, explicitly-set duration, so simply nudging a freshly-added scene can't silently crop its clip down to the timeline's placeholder length. Auto-arranging scenes across the song's sections by energy is filed as a follow-up (#1915). (Closes #1854)diff --git a/CLAUDE.md b/CLAUDE.mdindex 0b7feee940..7e74069454 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -211,6 +211,7 @@ When CoS agents or AI tools work on managed apps outside PortOS, all research, p- **No window.alert/confirm** - use inline confirmations or toast notifications- **Form labels need `htmlFor`/`id` pairing** - when adding a settings/config form field, wire `<label htmlFor="...">` to an `id="..."` on the input — screen readers and click-to-focus both depend on the association. The visual `block`/`mb-1` styling alone doesn't establish it.- **Linkable routes for all views** - tabbed pages use URL params, not local state (e.g., `/devtools/history` not `/devtools` with tab state)+- **ID-based deep linking for every selectable UI element** - any view that opens/selects a specific record (a project, item, scene, detail, editor, or master-detail selection) MUST encode that selection in the URL via a route param (`/media/music-video/:projectId`, `/media/timeline/:projectId`, `/media/creative-director/:id/:tab`) — never in local `useState`/`selectedId`. The URL is the single source of truth for "what is open," so every element is directly shareable, bookmarkable, and reachable from ⌘K, voice nav, and media job-completion hooks. Selection handlers `navigate()` to the id'd route; deletes/clears `navigate()` back to the index; render a "not found" fallback for stale/deleted ids. Add both the bare index route and the `:id` detail route in `App.jsx`, and keep the base path registered in `NAV_COMMANDS`.- **Functional programming** - no classes, use hooks in React- **Zod validation** - all route inputs validated via `lib/validation.js`- **Command allowlist** - shell execution restricted to approved commands onlydiff --git a/client/src/App.jsx b/client/src/App.jsxindex 4994304c7b..0835755f0c 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -276,6 +276,7 @@ export default function App() {<Route path="creative-director/:id" element={<Navigate to="overview" replace />} /><Route path="creative-director/:id/:tab" element={<CreativeDirectorDetail />} /><Route path="music-video" element={<MusicVideo />} />+ <Route path="music-video/:projectId" element={<MusicVideo />} /><Route path="timeline" element={<VideoTimeline />} /><Route path="timeline/:projectId" element={<VideoTimelineEditor />} /><Route path="models" element={<MediaModels />} />diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex a5f6097abd..f8101891b2 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -1,4 +1,5 @@import { useEffect, useState, useCallback } from 'react';+import { useParams, useNavigate } from 'react-router-dom';import { Plus, Film, Trash2, Music, Activity, ArrowUp, ArrowDown, Image as ImageIcon, Video, Wand2, Download } from 'lucide-react';import toast from '../components/ui/Toast';import PageHeader from '../components/PageHeader';@@ -78,9 +79,16 @@ function YoutubeImportControls({ id, url, onUrlChange, job, onStart, compact = f}export default function MusicVideo() {+ // Deep-linkable project selection: the selected project lives in the URL+ // (/media/music-video/:projectId) rather than local state, so a project's+ // scene board is directly shareable/bookmarkable and reachable from the+ // media job-completion hooks. selectProject() navigates; the browser URL is+ // the single source of truth for "which project is open".+ const { projectId: routeProjectId } = useParams();+ const navigate = useNavigate();const [projects, setProjects] = useState([]);const [tracks, setTracks] = useState([]);- const [selectedId, setSelectedId] = useState(null);+ const selectedId = routeProjectId || null;const [loading, setLoading] = useState(true);const [analyzing, setAnalyzing] = useState(false);const [arranging, setArranging] = useState(false);@@ -124,7 +132,7 @@ export default function MusicVideo() {toast.error('Finish or cancel the in-progress YouTube import before switching projects');return;}- setSelectedId(id);+ navigate(id ? `/media/music-video/${id}` : '/media/music-video');};// Merge ONLY a scene's referenceImageId via a functional update so a render// that resolves after the user edited the board can't clobber those edits with@@ -208,7 +216,7 @@ export default function MusicVideo() {deleteMusicVideoProject(id).then(() => {setProjects((prev) => prev.filter((p) => p.id !== id));- if (selectedId === id) setSelectedId(null);+ if (selectedId === id) navigate('/media/music-video');}).catch((err) => toast.error(err?.message || 'Failed to delete project'));};@@ -541,7 +549,13 @@ export default function MusicVideo() {{/* Detail / scene board */}<div className="md:col-span-2">- {!selected && <p className="text-sm text-port-text-muted">Select or create a project to open its scene board.</p>}+ {!selected && !loading && routeProjectId && (+ <p className="text-sm text-port-text-muted">+ Project not found — it may have been deleted.{' '}+ <button onClick={() => navigate('/media/music-video')} className="text-port-accent underline">Back to projects</button>+ </p>+ )}+ {!selected && (loading || !routeProjectId) && <p className="text-sm text-port-text-muted">Select or create a project to open its scene board.</p>}{selected && (<div className="space-y-3"><div className="bg-port-card border border-port-border rounded-lg p-3">