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
feat: add one-click install for motion skills in the launch video form
Adam Eivy1ad01f6e239d
diff --git a/client/src/components/apps/LaunchVideoPanel.jsx b/client/src/components/apps/LaunchVideoPanel.jsxindex ed093bdf51..b44386b8f8 100644--- a/client/src/components/apps/LaunchVideoPanel.jsx+++ b/client/src/components/apps/LaunchVideoPanel.jsx@@ -11,7 +11,7 @@ import { useAsyncAction } from '../../hooks/useAsyncAction';import useUrlParams from '../../hooks/useUrlParams';import { copyToClipboard } from '../../lib/clipboard';import socket from '../../services/socket';-import { createAppLaunchVideo, getAppLaunchVideos, getMotionToolkit, publishAppLaunchVideo } from '../../services/apiApps';+import { createAppLaunchVideo, getAppLaunchVideos, getMotionToolkit, installMotionSkills, publishAppLaunchVideo } from '../../services/apiApps';import { listPipelineMusicLibrary } from '../../services/apiPipeline';import { uploadFile } from '../../services/apiMedia';import { trackAudioUrl } from '../../services/apiTracks';@@ -53,6 +53,7 @@ function LaunchVideoForm({ appId, onQueued }) {const [critiqueRounds, setCritiqueRounds] = useState(2);const [motionBlur, setMotionBlur] = useState('');const [motionSkills, setMotionSkills] = useState(false);+ const [installingSkills, setInstallingSkills] = useState(false);const [skillPacks, setSkillPacks] = useState(null);const [music, setMusic] = useState(false);const [generateMusic, setGenerateMusic] = useState(false);@@ -84,6 +85,16 @@ function LaunchVideoForm({ appId, onQueued }) {const installedSkills = (skillPacks ?? []).filter(pack => pack.found.length);const consultSkills = motionSkills && installedSkills.length > 0;+ const handleInstallSkills = async () => {+ setInstallingSkills(true);+ const result = await installMotionSkills({ silent: true }).catch(err => { toast.error(err.message); return null; });+ setInstallingSkills(false);+ if (!result) return;+ setSkillPacks(result.skillPacks);+ setMotionSkills(true);+ toast.success('Motion skills installed');+ };+const handleReferenceUpload = async event => {const file = event.target.files?.[0];if (!file) return;@@ -189,7 +200,12 @@ function LaunchVideoForm({ appId, onQueued }) {<label htmlFor="launch-motion-skills"><input id="launch-motion-skills" type="checkbox" disabled={!installedSkills.length} checked={consultSkills} onChange={event => setMotionSkills(event.target.checked)} /> Consult motion skills</label><p className="text-sm text-port-text-muted">{skillPacks === null ? 'Checking installed skills…' : installedSkills.length? `Technique guides from ${installedSkills.map(pack => pack.label).join(', ')}.`- : 'Install HyperFrames, Remotion and Claude Animation skills with npm run setup:motion -- --skills.'}</p>+ : 'HyperFrames, Remotion and Claude Animation skills are not installed.'}</p>+ {skillPacks !== null && skillPacks.some(pack => !pack.installed) && (+ <button type="button" className="btn btn-secondary" disabled={installingSkills} onClick={handleInstallSkills}>+ {installingSkills ? 'Installing motion skills…' : installedSkills.length ? 'Install missing motion skills' : 'Install and enable motion skills'}+ </button>+ )}</div><div><label htmlFor="launch-music"><input id="launch-music" type="checkbox" checked={music} onChange={event => setMusic(event.target.checked)} /> Include music</label></div>{music && <div><label htmlFor="launch-generate-music"><input id="launch-generate-music" type="checkbox" checked={generateMusic} onChange={event => setGenerateMusic(event.target.checked)} /> Generate original music</label><p className="text-sm text-port-text-muted">Choose how the original soundtrack is made.</p></div>}diff --git a/client/src/components/apps/LaunchVideoPanel.test.jsx b/client/src/components/apps/LaunchVideoPanel.test.jsxindex 96e65860a2..30581d81cd 100644--- a/client/src/components/apps/LaunchVideoPanel.test.jsx+++ b/client/src/components/apps/LaunchVideoPanel.test.jsx@@ -2,9 +2,9 @@ import { describe, it, expect, vi } from 'vitest';import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';import { MemoryRouter } from 'react-router';import LaunchVideoPanel from './LaunchVideoPanel';-import { createAppLaunchVideo, getAppLaunchVideos, getMotionToolkit, publishAppLaunchVideo } from '../../services/apiApps';+import { createAppLaunchVideo, getAppLaunchVideos, getMotionToolkit, installMotionSkills, publishAppLaunchVideo } from '../../services/apiApps';vi.mock('../../services/apiApps', () => ({ getAppLaunchVideos: vi.fn(async () => ({ videos: [] })), createAppLaunchVideo: vi.fn(), publishAppLaunchVideo: vi.fn(),- getMotionToolkit: vi.fn(async () => ({ ffmpeg: true, skillPacks: [] })) }));+ getMotionToolkit: vi.fn(async () => ({ ffmpeg: true, skillPacks: [] })), installMotionSkills: vi.fn() }));vi.mock('../../services/apiPipeline', () => ({ listPipelineMusicLibrary: async () => ({ tracks: [{ filename: 'track-1a2b.wav', label: 'Example track', sizeBytes: 2048, updatedAt: '2026-01-01T00:00:00.000Z' }] }) }));vi.mock('../../services/socket', () => ({ default: { on: vi.fn(), off: vi.fn() } }));vi.mock('../../lib/clipboard', () => ({ copyToClipboard: vi.fn() }));@@ -50,6 +50,15 @@ describe('launch video drawer', () => {expect(createAppLaunchVideo).toHaveBeenCalledTimes(1);});+ it('installs and enables motion skills from the form', async () => {+ installMotionSkills.mockResolvedValue({ skillPacks: [{ id: 'hyperframes', label: 'HyperFrames', found: ['motion-graphics'], installed: true }] });+ getMotionToolkit.mockResolvedValueOnce({ ffmpeg: true, skillPacks: [{ id: 'hyperframes', label: 'HyperFrames', found: [], installed: false }] });+ renderPanel('/?launchVideo=true');+ fireEvent.click(await screen.findByRole('button', { name: 'Install and enable motion skills' }));+ await waitFor(() => expect(screen.getByLabelText('Consult motion skills').checked).toBe(true));+ expect(installMotionSkills).toHaveBeenCalledWith({ silent: true });+ });+it.each(['agent', 'service'])('queues %s music without requiring a library track or installed engine', async musicMethod => {createAppLaunchVideo.mockReset().mockResolvedValue({ taskId: 'task-generated' });getMotionToolkit.mockResolvedValueOnce({ ffmpeg: true, skillPacks: [{ id: 'hyperframes', label: 'HyperFrames', found: ['motion-graphics'] }] });diff --git a/client/src/services/apiApps.js b/client/src/services/apiApps.jsindex 8770f822e5..ffca0dd687 100644--- a/client/src/services/apiApps.js+++ b/client/src/services/apiApps.js@@ -7,6 +7,8 @@ export const getAppLaunchVideos = (id, options) => request(`/apps/${encodeURICom// Installed motion toolkit (ffmpeg, optional agent skill packs) for launch-video options.export const getMotionToolkit = (options) => request('/html-composition/toolkit', options);+export const installMotionSkills = (options) => request('/html-composition/toolkit/skills/install', { method: 'POST', ...options });+// Apps. The default response remains the PM2-enriched list; `view=nav` and// `view=probe` are explicit projections for hot name-only and peer callers.export const getApps = ({ includeQuality = false, view, ...options } = {}) => {diff --git a/scripts/setup-motion.js b/scripts/setup-motion.jsindex 9ad1200504..4758baa8d8 100644--- a/scripts/setup-motion.js+++ b/scripts/setup-motion.js@@ -26,15 +26,12 @@import { spawnSync } from 'node:child_process';import { createInterface } from 'node:readline';import { platform as osPlatform } from 'node:os';-import { MOTION_SKILL_PACKS, detectMotionSkills } from '../server/lib/motionSkills.js';+import { MOTION_SKILL_PACKS, detectMotionSkills, skillInstallCommand } from '../server/lib/motionSkills.js';import { whichFirstSync } from '../server/lib/processEnv.js';import { findFfmpeg } from '../server/lib/ffmpeg.js';+export { skillInstallCommand };import { isDirectlyInvoked } from './lib/directInvocation.js';-// Agents the skills CLI links each installed skill into (Claude Code + Codex-// cover the CoS providers that read skill folders).-const SKILL_AGENTS = ['claude-code', 'codex'];-export function parseMotionSetupArgs(argv) {const options = { yes: false, status: false, json: false, skills: [] };for (const arg of argv) {@@ -61,11 +58,6 @@ export function ffmpegInstallCommand(platform, has) {return null;}-/** The `skills` CLI invocation that installs one pack user-wide, non-interactively. */-export function skillInstallCommand(pack) {- return ['npx', ['-y', 'skills@latest', 'add', pack.source, '--global', '--yes', '--agent', ...SKILL_AGENTS, '--skill', ...pack.skills]];-}-const hasCommand = (command) => Boolean(whichFirstSync(command));// The server's own lookup (PATH plus Homebrew/system locations), so this CLI// and the launch-video form agree on whether ffmpeg is present.diff --git a/server/lib/motionSkills.js b/server/lib/motionSkills.jsindex 00b0385bef..37721c0b24 100644--- a/server/lib/motionSkills.js+++ b/server/lib/motionSkills.js@@ -45,3 +45,12 @@ export function detectMotionSkills({ home = homedir(), exists = existsSync } = {return { id: pack.id, label: pack.label, description: pack.description, skills: [...pack.skills], found, installed: found.length === pack.skills.length };});}++// Agents the skills CLI links each installed skill into (Claude Code + Codex+// cover the CoS providers that read skill folders).+const SKILL_AGENTS = ['claude-code', 'codex'];++/** The `skills` CLI invocation that installs one pack user-wide, non-interactively. */+export function skillInstallCommand(pack) {+ return ['npx', ['-y', 'skills@latest', 'add', pack.source, '--global', '--yes', '--agent', ...SKILL_AGENTS, '--skill', ...pack.skills]];+}diff --git a/server/routes/htmlComposition.js b/server/routes/htmlComposition.jsindex f80b31f1fe..f03108bcd1 100644--- a/server/routes/htmlComposition.js+++ b/server/routes/htmlComposition.js@@ -1,6 +1,7 @@import { Router } from 'express';import { asyncHandler, ServerError } from '../lib/errorHandler.js';import { validateRequest, htmlCompositionRenderSchema, htmlCompositionBeatsQuerySchema } from '../lib/validation.js';+import { MOTION_SKILL_PACKS } from '../lib/motionSkills.js';import { enqueueJob, attachSseClient, cancelJob } from '../services/mediaJobQueue/index.js';const router = Router();@@ -12,6 +13,34 @@ router.get('/toolkit', asyncHandler(async (req, res) => {res.json({ ffmpeg: Boolean(await findFfmpeg()), skillPacks: detectMotionSkills() });}));+// One-click equivalent of `npm run setup:motion -- --skills`: installs every+// missing skill pack user-wide through the `skills` CLI. Explicit user action+// (a button), never run on boot.+let skillInstall = null;+router.post('/toolkit/skills/install', asyncHandler(async (req, res) => {+ if (skillInstall) throw new ServerError('A motion skills install is already running', { status: 409, code: 'INSTALL_IN_PROGRESS' });+ const { detectMotionSkills, skillInstallCommand } = await import('../lib/motionSkills.js');+ const { execFile } = await import('node:child_process');+ const { safeChildProcessOptions } = await import('../lib/processEnv.js');+ const packs = detectMotionSkills().filter(pack => !pack.installed);+ const sources = new Map(MOTION_SKILL_PACKS.map(pack => [pack.id, pack]));+ const failed = [];+ skillInstall = (async () => {+ for (const { id, label } of packs) {+ const [command, args] = skillInstallCommand(sources.get(id));+ console.log(`🎬 Installing ${label} motion skills`);+ const ok = await new Promise(resolve => execFile(command, args, safeChildProcessOptions({ timeout: 5 * 60 * 1000, shell: process.platform === 'win32' }), error => {+ if (error) console.error(`❌ ${label} skill install failed: ${error.message.split('\n')[0]}`);+ resolve(!error);+ }));+ if (!ok) failed.push(label);+ }+ })();+ await skillInstall.finally(() => { skillInstall = null; });+ if (failed.length) throw new ServerError(`Could not install: ${failed.join(', ')}. Run npm run setup:motion -- --skills for details.`, { status: 502, code: 'MOTION_SKILLS_INSTALL_FAILED' });+ res.json({ skillPacks: detectMotionSkills() });+}));+// Measured beat grid for a Music-library track (#8958) — bpm/beats/downbeats/// onset hits from `lib/beatGrid.js`, so a launch-video agent can cut on the// real tempo instead of guessing it. `null` bpm (no confident tempo, e.g. andiff --git a/server/routes/htmlComposition.test.js b/server/routes/htmlComposition.test.jsindex 31cea23a8e..68c7439fb5 100644--- a/server/routes/htmlComposition.test.js+++ b/server/routes/htmlComposition.test.js@@ -12,6 +12,15 @@ vi.mock('../services/mediaJobQueue/index.js', () => ({attachSseClient: vi.fn(() => false), cancelJob: vi.fn(),}));vi.mock('../services/pipeline/audioMux.js', () => ({ resolveMusicTrackPath: vi.fn(async () => null) }));+const skillState = vi.hoisted(() => ({ installed: false }));+vi.mock('node:child_process', async importOriginal => ({+ ...(await importOriginal()),+ execFile: vi.fn((command, args, options, callback) => { skillState.installed = true; callback(null); }),+}));+vi.mock('../lib/motionSkills.js', async importOriginal => {+ const actual = await importOriginal();+ return { ...actual, detectMotionSkills: () => actual.MOTION_SKILL_PACKS.map(pack => ({ id: pack.id, label: pack.label, skills: [...pack.skills], found: skillState.installed ? [...pack.skills] : [], installed: skillState.installed })) };+});vi.mock('../lib/beatGrid.js', () => ({ getBeatGrid: vi.fn(async () => null) }));const app = express();@@ -78,3 +87,14 @@ describe('GET /api/html-composition/beats (#8958)', () => {expect(response.status).toBe(422);});});++describe('motion skills install', () => {+ it('installs each missing skill pack through the skills CLI and returns the refreshed status', async () => {+ const { execFile } = await import('node:child_process');+ const response = await request(app).post('/api/html-composition/toolkit/skills/install');+ expect(response.status).toBe(200);+ expect(execFile).toHaveBeenCalledTimes(3);+ expect(execFile.mock.calls[0][0]).toBe('npx');+ expect(response.body.skillPacks.every(pack => pack.installed)).toBe(true);+ });+});