Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: bump remotion version. generate RSP artifacts (#293)
KapishDimadf56732fe379
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonnew file mode 100644index 00000000..9b8c4b14--- /dev/null+++ b/.claude-plugin/marketplace.json@@ -0,0 +1,19 @@+{+ "$schema": "https://json.schemastore.org/claude-code-marketplace.json",+ "name": "remocn",+ "owner": {+ "name": "Remocn",+ "url": "https://remocn.dev"+ },+ "metadata": {+ "description": "The remocn plugin: Remotion videos from a shadcn registry of motion components."+ },+ "plugins": [+ {+ "name": "remocn",+ "source": "./plugins/remocn",+ "description": "Make Remotion videos from remocn components: brief to storyboard to a rendering project, with visual QA and a hand-off to Remocn Studio.",+ "category": "design"+ }+ ]+}diff --git a/.github/workflows/plugin.yml b/.github/workflows/plugin.ymlnew file mode 100644index 00000000..b599115a--- /dev/null+++ b/.github/workflows/plugin.yml@@ -0,0 +1,51 @@+name: Plugin++on:+ pull_request:+ paths:+ - "plugins/remocn/**"+ - ".claude-plugin/**"+ - "lib/plugin-scripts.test.ts"+ push:+ branches: [main]+ paths:+ - "plugins/remocn/**"+ - ".claude-plugin/**"++jobs:+ validate:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ - uses: oven-sh/setup-bun@v2+ with:+ bun-version: latest+ - run: npm install -g @anthropic-ai/claude-code+ - run: claude plugin validate --strict plugins/remocn+ - run: claude plugin validate --strict .+ # The Claude and Agent Plugins manifests must agree on the release.+ - run: |+ test "$(jq -r .version plugins/remocn/plugin.json)" = "$(jq -r .version plugins/remocn/.claude-plugin/plugin.json)"+ - run: bun test lib/plugin-scripts.test.ts++ evals:+ needs: validate+ runs-on: ubuntu-latest+ env:+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}+ steps:+ - if: env.ANTHROPIC_API_KEY == ''+ run: echo "::notice::ANTHROPIC_API_KEY is not set, so plugin evals are skipped."+ - if: env.ANTHROPIC_API_KEY != ''+ uses: actions/checkout@v4+ - if: env.ANTHROPIC_API_KEY != ''+ run: npm install -g @anthropic-ai/claude-code+ # One run per case, no baseline arm: a regression signal at about $4 a+ # run. Pinned model, so a model rollout isn't read as a plugin change.+ - if: env.ANTHROPIC_API_KEY != ''+ run: >-+ claude plugin eval plugins/remocn+ --trust-plugin --no-publish --scaffold+ --runs 1 --ablation none --model sonnet -j 4+ --max-cost-usd 10+ --allow-tools "WebFetch(domain:remocn.dev)"diff --git a/.gitignore b/.gitignoreindex 3fd30d88..003a0a87 100644--- a/.gitignore+++ b/.gitignore@@ -56,3 +56,6 @@ articles/agent//plans//skills-lock.json++# plugin eval runs+plugins/remocn/evals/results/diff --git a/README.md b/README.mdindex 9f233163..4e9e2352 100644--- a/README.md+++ b/README.md@@ -35,6 +35,16 @@ Set up a new Remotion video project in this folder, then install the remocn agenWhen a browser tab opens with an empty video player, you're ready. Pick a [guide](https://remocn.dev/docs/guides) and make it yours.+## Plugin for Claude Code and Codex++The [remocn plugin](https://remocn.dev/docs/getting-started/plugin) bundles the skill with a `/remocn:video` workflow: brief → storyboard → install → compose → visual check → open in [Remocn Studio](https://remocn.studio).++```text+/plugin install remocn --marketplace Remocn/remocn+```++In Codex: `codex plugin marketplace add Remocn/remocn`, then `codex plugin add remocn@remocn`.+## Sponsorsremocn is free and MIT-licensed. These sponsors keep the registry growing and the renders fast.diff --git a/app/embed/[name]/embed-player.tsx b/app/embed/[name]/embed-player.tsxnew file mode 100644index 00000000..9df4c0b8--- /dev/null+++ b/app/embed/[name]/embed-player.tsx@@ -0,0 +1,28 @@+"use client";++import { PreviewStage } from "@/lib/ui-preview-internals";+import registry from "@/registry/__index__";+import type { BackdropFill } from "@/registry/remocn/backdrop";++export function EmbedPlayer({+ name,+ ...stage+}: {+ name: string;+ inputProps: Record<string, unknown>;+ durationInFrames: number;+ fps: number;+ compositionWidth: number;+ compositionHeight: number;+ previewBackdrop?: BackdropFill;+}) {+ const entry = Object.hasOwn(registry, name) ? registry[name] : undefined;+ if (!entry) {+ return (+ <p className="text-sm text-muted-foreground">+ No preview for <code>{name}</code>.+ </p>+ );+ }+ return <PreviewStage name={name} load={entry.load} className="" {...stage} />;+}diff --git a/app/embed/[name]/page.tsx b/app/embed/[name]/page.tsxnew file mode 100644index 00000000..9e6f9e20--- /dev/null+++ b/app/embed/[name]/page.tsx@@ -0,0 +1,61 @@+import type { Metadata } from "next";+import { notFound } from "next/navigation";+import { previewManifest } from "@/registry/__manifest__";+import { EmbedPlayer } from "./embed-player";++/**+ * Chrome-less player for one registry component, made to be iframed — the MCP+ * App view behind `preview_component` / `plan_video` loads it. Optional+ * `?props=<url-encoded JSON>` is merged over the component's demo defaults.+ */++export const metadata: Metadata = {+ title: "Embed",+ robots: { index: false, follow: false },+};++const MAX_PROPS_JSON = 4000;++function parseProps(+ raw: string | string[] | undefined,+): Record<string, unknown> {+ const value = Array.isArray(raw) ? raw[0] : raw;+ if (!value || value.length > MAX_PROPS_JSON) return {};+ try {+ const parsed: unknown = JSON.parse(value);+ return parsed && typeof parsed === "object" && !Array.isArray(parsed)+ ? (parsed as Record<string, unknown>)+ : {};+ } catch {+ return {};+ }+}++export default async function EmbedPage({+ params,+ searchParams,+}: {+ params: Promise<{ name: string }>;+ searchParams: Promise<Record<string, string | string[] | undefined>>;+}) {+ const { name } = await params;+ // `name` comes from the URL: `constructor` or `toString` must 404, not+ // resolve to an Object.prototype member.+ if (!Object.hasOwn(previewManifest, name)) notFound();+ const entry = previewManifest[name];+ const props = parseProps((await searchParams).props);++ return (+ <main className="flex min-h-dvh w-full items-center justify-center bg-background">+ <EmbedPlayer+ name={name}+ inputProps={{ ...entry.defaults, ...props }}+ durationInFrames={entry.durationInFrames}+ fps={entry.fps}+ compositionWidth={entry.compositionWidth}+ compositionHeight={entry.compositionHeight}+ previewBackdrop={entry.previewBackdrop}+ />+ </main>+ );+}diff --git a/app/layout.tsx b/app/layout.tsxindex 122bcfc8..4e380c26 100644--- a/app/layout.tsx+++ b/app/layout.tsx@@ -99,6 +99,9 @@ export default function RootLayout({trackScreenViewstrackAttributestrackOutgoingLinks+ // /embed/* runs inside MCP App iframes in chat hosts; its URL carries+ // the user's props, so nothing there is tracked.+ filter="function () { return !window.location.pathname.startsWith('/embed/'); }"/></body></html>diff --git a/app/mcp/route.ts b/app/mcp/route.tsnew file mode 100644index 00000000..edaa2081--- /dev/null+++ b/app/mcp/route.ts@@ -0,0 +1,57 @@+import { createMcpHandler } from "@modelcontextprotocol/server";+import { createRemocnMcpServer } from "@/lib/mcp/server";++/**+ * Remote MCP server at https://remocn.dev/mcp — read-only, no auth, stateless.+ *+ * `createMcpHandler` (@modelcontextprotocol/server v2) builds a fresh server+ * per request. It serves 2026-07-28 clients natively and 2025-era clients+ * through its stateless streamable-HTTP fallback (POST only; GET/DELETE, the+ * 2025 session operations, answer 405). Responses are plain JSON — no tool here+ * streams progress, so SSE buys nothing.+ */++export const runtime = "nodejs";+export const dynamic = "force-dynamic";++const handler = createMcpHandler(() => createRemocnMcpServer(), {+ responseMode: "json",+ // Tool inputs are short strings; the SDK's 4 MiB default is far more than+ // any legitimate call needs.+ maxRequestBodySize: 64_000,+});++const EXPOSED_HEADERS = "Mcp-Session-Id, Mcp-Protocol-Version";++function corsHeaders(request: Request): Headers {+ const headers = new Headers({+ "Access-Control-Allow-Origin": "*",+ "Access-Control-Allow-Methods": "GET, POST, DELETE, OPTIONS",+ "Access-Control-Allow-Headers":+ request.headers.get("Access-Control-Request-Headers") ??+ "Content-Type, Accept, Authorization, Mcp-Session-Id, Mcp-Protocol-Version, Mcp-Method, Mcp-Name, Last-Event-ID",+ "Access-Control-Expose-Headers": EXPOSED_HEADERS,+ "Access-Control-Max-Age": "86400",+ });+ headers.append("Vary", "Access-Control-Request-Headers");+ return headers;+}++async function serve(request: Request): Promise<Response> {+ const response = await handler.fetch(request);+ const headers = new Headers(response.headers);+ for (const [key, value] of corsHeaders(request)) headers.set(key, value);+ return new Response(response.body, {+ status: response.status,+ statusText: response.statusText,+ headers,+ });+}++export function OPTIONS(request: Request) {+ return new Response(null, { status: 204, headers: corsHeaders(request) });+}++export const GET = serve;+export const POST = serve;+export const DELETE = serve;diff --git a/biome.json b/biome.jsonindex c28bff36..d53b50d4 100644--- a/biome.json+++ b/biome.json@@ -13,7 +13,8 @@"!.next","!dist","!build",- "!.claude/skills"+ "!.claude/skills",+ "!plugins/remocn/skills/studio/assets"]},"formatter": {diff --git a/bun.lock b/bun.lockindex eab8a38a..3b5eee1e 100644--- a/bun.lock+++ b/bun.lock@@ -11,6 +11,7 @@"@fontsource/roboto-mono": "^5.3.0","@hugeicons/core-free-icons": "^4.3.0","@hugeicons/react": "^1.1.10",+ "@modelcontextprotocol/server": "^2.3.1","@openpanel/nextjs": "^1.0.13","@openpanel/sdk": "^1.3.1","@paper-design/shaders-react": "0.0.76",@@ -320,8 +321,12 @@"@mediabunny/mp3-encoder": ["@mediabunny/[email protected]", "", { "peerDependencies": { "mediabunny": "^1.0.0" } }, "sha512-p66ovEq6mZt3ejje45NOju84hIJI4v8rHfsmc1D2J34ziV0USE8AdJBzmiwqxl6nZkIAQLNB19HzbVRcQfc51g=="],+ "@modelcontextprotocol/core": ["@modelcontextprotocol/[email protected]", "", { "dependencies": { "zod": "^4.2.0" } }, "sha512-laVmIhPGpWi7rG9q+0UigblRN0Hws/Yjlb6qLFtVqryXVLkc4h+yN8z731POD2LnAGQlFe7/tXhUm7Bi0YB91g=="],+"@modelcontextprotocol/sdk": ["@modelcontextprotocol/[email protected]", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ=="],+ "@modelcontextprotocol/server": ["@modelcontextprotocol/[email protected]", "", { "dependencies": { "@modelcontextprotocol/core": "2.3.1", "zod": "^4.2.0" } }, "sha512-e59MfWuSssj6DoQ96JCTqdW1AXT5/XtnTl0WWd6MU1Ka434fFUGGosCLJbGNySDhHGvxQWoRWK137FXYFkYNWw=="],+"@module-federation/error-codes": ["@module-federation/[email protected]", "", {}, "sha512-xF9SjnEy7vTdx+xekjPCV5cIHOGCkdn3pIxo9vU7gEZMIw0SvAEdsy6Uh17xaCpm8V0FWvR0SZoK9Ik6jGOaug=="],"@module-federation/runtime": ["@module-federation/[email protected]", "", { "dependencies": { "@module-federation/error-codes": "0.22.0", "@module-federation/runtime-core": "0.22.0", "@module-federation/sdk": "0.22.0" } }, "sha512-38g5iPju2tPC3KHMPxRKmy4k4onNp6ypFPS1eKGsNLUkXgHsPMBFqAjDw96iEcjri91BrahG4XcdyKi97xZzlA=="],diff --git a/content/changelog/2026-10-10-agent-plugin.mdx b/content/changelog/2026-10-10-agent-plugin.mdxnew file mode 100644index 00000000..5a08822b--- /dev/null+++ b/content/changelog/2026-10-10-agent-plugin.mdx@@ -0,0 +1,21 @@+---+title: Plugin for Claude Code and Codex+date: 2026-10-10+---++remocn now ships as a plugin for Claude Code and Codex. Type `/remocn:video` and a one-line brief: the agent reads your repo for content, picks an archetype and plans a storyboard with a frame budget for every beat, then waits for your go-ahead. After that it installs the components, writes the video, renders stills to check the frames, and offers to open the project in [Remocn Studio](https://remocn.studio) to tweak and export. [Plugin](/docs/getting-started/plugin) has the install commands and everything inside.++### New++- `/remocn:video`, `/remocn:changelog`, `/remocn:add` and `/remocn:studio`: the video workflow, a release video from your git history, one component at a time, and the Remocn Studio hand-off.+- Two agents for Claude Code: `video-director` plans the storyboard, `scene-reviewer` looks at rendered stills and reports clipped text, empty frames and low contrast.+- A remote MCP server at `https://remocn.dev/mcp` for component search, component pages, video plans and live previews, including in claude.ai and ChatGPT as a custom connector.++### Improvements++- The agent skill moved into the plugin, at `plugins/remocn/skills/remocn`. `npx skills add Remocn/remocn` still installs it, now next to the plugin's workflow skills.+- The skill's description now leaves Remotion API questions to Remotion's own skills, so the two work side by side.++### Fixes++- `remocn-ui` now installs `@types/culori`, so a fresh project typechecks after the first UI primitive.diff --git a/content/docs/getting-started/agent-skill.mdx b/content/docs/getting-started/agent-skill.mdxindex ea6c9936..2909c001 100644--- a/content/docs/getting-started/agent-skill.mdx+++ b/content/docs/getting-started/agent-skill.mdx@@ -20,14 +20,18 @@ your additions to match the library — without you pasting context every time.## Install with skills.sh-The skill lives in the [`skills/`](https://github.com/Remocn/remocn/tree/main/skills) folder of-the remocn repo. Install it with the [`skills`](https://skills.sh) CLI:+The skill lives in the [remocn plugin](/docs/getting-started/plugin), in+[`plugins/remocn/skills/`](https://github.com/Remocn/remocn/tree/main/plugins/remocn/skills) of the+remocn repo. In Claude Code or Codex, installing the plugin gets you the skill plus the video+workflow. For any other agent, install the skill on its own with the [`skills`](https://skills.sh)+CLI:```bashnpx skills add Remocn/remocn```-This finds the `remocn` skill and installs it into your agent (for Claude Code:+This lists the `remocn` skill next to the plugin's workflow skills (`video`, `changelog`, `add`,+`studio`) and installs your pick into your agent (for Claude Code:`.claude/skills/remocn/`). The CLI is interactive — pick the skill and target agent when prompted.### Common flagsdiff --git a/content/docs/getting-started/introduction.mdx b/content/docs/getting-started/introduction.mdxindex 3b7f15e5..a3f362ab 100644--- a/content/docs/getting-started/introduction.mdx+++ b/content/docs/getting-started/introduction.mdx@@ -58,6 +58,9 @@ If you work through an AI agent, install the skill too:npx skills add Remocn/remocn --skill remocn --yes```+In Claude Code or Codex, the [plugin](/docs/getting-started/plugin) goes further: it carries the skill+plus a `/remocn:video` workflow that plans, builds and checks a whole video from a one-line brief.+The [Installation](/docs/getting-started/installation) page covers the full flow, including the one-shot command that installs every component and the Add to Studio button for a running Remotion Studio.## remocn vs raw Remotiondiff --git a/content/docs/getting-started/meta.json b/content/docs/getting-started/meta.jsonindex 30c1b66d..6a0aac2f 100644--- a/content/docs/getting-started/meta.json+++ b/content/docs/getting-started/meta.json@@ -1,6 +1,6 @@{"title": "Getting Started","defaultOpen": true,- "pages": ["introduction", "installation", "agent-skill"],+ "pages": ["introduction", "installation", "agent-skill", "plugin"],"icon": "Rocket01Icon"}diff --git a/content/docs/getting-started/plugin.mdx b/content/docs/getting-started/plugin.mdxnew file mode 100644index 00000000..92f7c299--- /dev/null+++ b/content/docs/getting-started/plugin.mdx@@ -0,0 +1,102 @@+---+title: Plugin+description: Install the remocn plugin for Claude Code or Codex. It turns a one-line brief into a Remotion video built from remocn components, checks the frames, and opens the result in Remocn Studio.+---++The remocn plugin packages everything an AI agent needs to make a video with remocn: the+[agent skill](/docs/getting-started/agent-skill), a step-by-step video workflow, two helper agents,+and a connection to this site's component catalog. One install works in Claude Code and in Codex.++```text+/remocn:video 30-second product demo for Tasklane, a shared task inbox for small teams+```++The agent reads your repo for content, plans a storyboard and waits for your go-ahead. Then it+installs the components, writes the video, renders stills to check how it looks, and offers to open+the project in [Remocn Studio](https://remocn.studio) for tweaking and export.++## Install++### Claude Code++```text+/plugin install remocn --marketplace Remocn/remocn+```++Or from your shell:++```bash+claude plugin marketplace add Remocn/remocn+claude plugin install remocn@remocn+```++### Codex++```bash+codex plugin marketplace add Remocn/remocn+codex plugin add remocn@remocn+```++## What's inside++| Part | What it does |+|---|---|+| `/remocn:video <brief>` | The main workflow: brief → archetype → storyboard → install → compose → visual check → hand-off. Stops after the storyboard so you can change direction before any code is written |+| `/remocn:changelog [range]` | Collects a release from git tags, commits or merged pull requests, writes it as short on-screen lines, and builds a changelog video |+| `/remocn:add <name>` | Installs one component, reads its docs page, and places it in a `Sequence` with the right length |+| `/remocn:studio` | Prepares the project for Remocn Studio and opens it there |+| `remocn` skill | The [agent skill](/docs/getting-started/agent-skill): component tiers, timing rules, composition recipes. Loads on its own for any video work |+| `video-director` agent | Plans the storyboard: one beat per row, a component per beat, frame budgets that hit the target length |+| `scene-reviewer` agent | Renders stills at key frames of every beat and checks them for clipped text, empty frames, low contrast and jumps between beats |+| `remocn` MCP server | Connects to `https://remocn.dev/mcp` for component search, component pages, video plans and live previews |++The agents run in Claude Code. In Codex the video workflow does the same planning and checking+itself.++## Plugin or skill++The bare skill (`npx skills add Remocn/remocn`) teaches an agent how remocn works and leaves the+workflow to you. The plugin adds the workflow on top: the storyboard step, project setup, visual+checks and the Studio hand-off. Both read the same catalog live from this site, and the plugin+includes the skill, so install one or the other.++The plugin works alongside Remotion's own skills. Remotion's skills answer how Remotion works; the+remocn plugin decides what goes on screen.++## Project setup it handles++remocn assumes a Remotion project. When the folder is empty, `/remocn:video` creates one with+`npx create-video --blank`. In either case it then makes three small, visible edits so components+install and render:++- `components.json` with the `@remocn` registry, because `shadcn init` doesn't recognise Remotion+ projects+- the `@/*` path in `tsconfig.json`+- the same `@/` alias in `remotion.config.ts`, because Remotion's bundler doesn't read tsconfig+ paths++Videos are written to `src/videos/<slug>/index.tsx` and export a `meta` object with the+dimensions, frame rate and duration. That layout is what Remocn Studio opens, and it registers each+video as a composition with id `<slug>` in Remotion Studio too. In a project you already have, the+agent says which files it will touch and asks first.++## Open in Remocn Studio++Remocn Studio is a desktop app for macOS and Linux that previews a Remotion project live, lets you+tune elements by hand, and exports mp4. After a video is built, the plugin asks whether to open it+there:++- **Studio installed:** the plugin starts it and tells you which folder to pick with **Open Folder**+ (⌘O).+- **Not installed:** you get the download link and the same steps for afterwards.+- **Windows:** Studio isn't available, so the plugin skips the offer. Preview with+ `npx remotion studio` and render with `npx remotion render <slug>`.++The project already carries Studio's manifest (`.remocn/project.json`), so it opens as-is.++## In claude.ai and ChatGPT++Chat apps have no terminal, so the plugin can't install components there. What does work is the+catalog connection: add `https://remocn.dev/mcp` as a custom connector to search components, read+their pages, plan a video and preview components inline. Then take the plan to Claude Code or Codex+to build it.diff --git a/content/docs/guides/setup.mdx b/content/docs/guides/setup.mdxindex 8f532fbe..ce6ca4f0 100644--- a/content/docs/guides/setup.mdx+++ b/content/docs/guides/setup.mdx@@ -15,4 +15,7 @@ agent skill: npx skills add Remocn/remocn --yes. When you're done, start thepreview studio so I can watch the video while we work.```+In Claude Code or Codex you can install the [remocn plugin](/docs/getting-started/plugin) instead of+the skill, then start any video with `/remocn:video` and a one-line brief.+When a browser tab opens with an empty video player, you're ready. Pick a [guide](/docs/guides) and make it yours.diff --git a/lib/docs-meta.test.ts b/lib/docs-meta.test.tsindex fa14c926..cbae627e 100644--- a/lib/docs-meta.test.ts+++ b/lib/docs-meta.test.ts@@ -204,12 +204,12 @@ describe("component pages carry selection metadata", () => {});describe("the agent skill points at pages that exist", () => {- const skillSources = [...new Glob("skills/**/*.md").scanSync(".")].map(- (file) => ({- file,- text: readFileSync(file, "utf8"),- }),- );+ const skillSources = [+ ...new Glob("plugins/remocn/**/*.md").scanSync("."),+ ].map((file) => ({+ file,+ text: readFileSync(file, "utf8"),+ }));const urls = skillSources.flatMap(({ file, text }) =>[...text.matchAll(/https:\/\/remocn\.dev(\/[^\s`)"']*)/g)].map((m) => ({@@ -248,7 +248,9 @@ describe("the agent skill points at pages that exist", () => {it("no longer ships a bundled component catalog", () => {const catalog = [- ...new Glob("skills/remocn/references/components/**").scanSync("."),+ ...new Glob(+ "plugins/remocn/skills/remocn/references/components/**",+ ).scanSync("."),];expect(catalog).toEqual([]);diff --git a/lib/mcp/archetype-files.ts b/lib/mcp/archetype-files.tsnew file mode 100644index 00000000..3ed1d844--- /dev/null+++ b/lib/mcp/archetype-files.ts@@ -0,0 +1,52 @@+import "server-only";++import { readFileSync } from "node:fs";+import path from "node:path";+import type { Archetype } from "@/lib/mcp/archetypes";++/**+ * Archetype recipes live with the remocn skill in the plugin at+ * `plugins/remocn/skills/remocn`. They are plain repo files: the Dockerfile+ * copies the whole tree and the app runs `next start` from it, and+ * `outputFileTracingIncludes` in next.config.ts covers traced output. The+ * folder is spelled out literally so the bundler traces only it, not the+ * whole project.+ */+const REFERENCES = path.join(+ process.cwd(),+ "plugins",+ "remocn",+ "skills",+ "remocn",+ "references",+);++const fileCache = new Map<string, string | null>();++function read(key: string, load: () => string): string | undefined {+ if (!fileCache.has(key)) {+ let text: string | null = null;+ try {+ text = load();+ } catch {+ text = null;+ }+ fileCache.set(key, text);+ }+ return fileCache.get(key) ?? undefined;+}++export function readArchetypeRecipe(archetype: Archetype): string | undefined {+ return read(archetype, () =>+ readFileSync(+ path.join(REFERENCES, "archetypes", `${archetype}.md`),+ "utf8",+ ),+ );+}++export function readAnatomy(): string | undefined {+ return read("anatomy.md", () =>+ readFileSync(path.join(REFERENCES, "anatomy.md"), "utf8"),+ );+}diff --git a/lib/mcp/archetypes.test.ts b/lib/mcp/archetypes.test.tsnew file mode 100644index 00000000..589730d4--- /dev/null+++ b/lib/mcp/archetypes.test.ts@@ -0,0 +1,193 @@+import { describe, expect, it } from "bun:test";+import { existsSync, readFileSync } from "node:fs";+import path from "node:path";+import {+ ARCHETYPES,+ extractQualityBar,+ parseRecipe,+ pickArchetype,+ splitRow,+} from "./archetypes";++describe("pickArchetype", () => {+ const cases: [string, string][] = [+ ["Release notes video for v2.3", "changelog"],+ ["Show off our open source repo and its GitHub stars", "oss-showcase"],+ ["A demo of our CLI running in the terminal", "cli-tool-demo"],+ ["Reveal our new pricing plans", "pricing-reveal"],+ ["A reel of customer testimonials", "testimonial-reel"],+ ["Our 2025 year in review", "year-in-review"],+ ["5 second logo sting for the channel intro", "logo-bumper"],+ ["Introducing Smart Replies, a new feature", "feature-announcement"],+ ["Product demo for our SaaS dashboard", "product-demo"],+ ];+ for (const [brief, expected] of cases) {+ it(`${brief} → ${expected}`, () => {+ expect(pickArchetype(brief).archetype).toBe(expected as never);+ });+ }++ it("falls back to product-demo when nothing matches", () => {+ const pick = pickArchetype("something cool");+ expect(pick.archetype).toBe("product-demo");+ expect(pick.fallback).toBe(true);+ });++ it("is deterministic", () => {+ const brief = "launch video for our cli with github stars";+ expect(pickArchetype(brief)).toEqual(pickArchetype(brief));+ });+});++describe("splitRow", () => {+ it("honors escaped pipes and pipes inside code spans", () => {+ expect(splitRow("| a | `x | y` | b \\| c |")).toEqual([+ "a",+ "`x | y`",+ "b | c",+ ]);+ });+});++const FIXTURE = `# changelog++**Family:** B. Release & Updates · **Default duration:** ~9s (270f @30fps) · **Format:** 16:9 · **Vibe:** clean++## Beats++| Frames (N=4) | Beat | What happens |+|---|---|---|+| 0–60 | **Version badge** | chip slides in; title builds via \`tracking-in\` |+| 60–160 | **Change list** | rows staggered in |+| 160–270 | **Footer / CTA** | link fades in |++## Beat → slots++| Beat | Catalog components | New component needed |+|---|---|---|+| Version badge | \`tracking-in\` (title), \`shader-dot-orbit\` (bg) | **\`version-badge\`** — chip |+| Change list | \`staggered-fade-up\` (rows), \`not-a-component\` | **\`change-list\`** — rows |+| Footer / CTA | \`soft-blur-in\` (link) | — |+| Accent pop | \`confetti\` | — |+`;++const KNOWN = [+ "tracking-in",+ "shader-dot-orbit",+ "staggered-fade-up",+ "soft-blur-in",+ "confetti",+];++describe("parseRecipe", () => {+ it("joins beats with their slot rows", () => {+ const plan = parseRecipe(FIXTURE, KNOWN);+ expect(plan.meta.defaultduration).toContain("270f");+ expect(plan.totalFrames).toBe(270);+ expect(plan.beats.map((b) => b.name)).toEqual([+ "Version badge",+ "Change list",+ "Footer / CTA",+ ]);+ expect(plan.beats[0]).toMatchObject({+ startFrame: 0,+ endFrame: 60,+ components: ["tracking-in", "shader-dot-orbit"],+ buildNew: ["version-badge"],+ });+ // Unknown names never leak into components.+ expect(plan.beats[1].components).toEqual(["staggered-fade-up"]);+ expect(plan.beats[1].buildNew).toEqual(["change-list"]);+ });++ it("surfaces unmatched slot rows as extras", () => {+ const plan = parseRecipe(FIXTURE, KNOWN);+ expect(plan.extras).toEqual([+ { label: "Accent pop", components: ["confetti"], buildNew: [] },+ ]);+ });++ it("notes when the requested duration differs from the recipe", () => {+ const plan = parseRecipe(FIXTURE, KNOWN, 60);+ expect(plan.notes.length).toBe(1);+ });+});++// Real recipes: skip when the skill files are not in this checkout.+const DIRS = ["plugins/remocn/skills/remocn/references"].map((d) =>+ path.join(process.cwd(), d),+);+const refs = DIRS.find((d) => existsSync(path.join(d, "archetypes")));++function knownNames(): string[] {+ const names: string[] = [];+ for (const ns of [+ "remocn",+ "remocn-ui",+ "remocn-icons",+ "remocn-templates",+ ]) {+ const json = JSON.parse(+ readFileSync(+ path.join(process.cwd(), "registry", ns, "registry.json"),+ "utf8",+ ),+ ) as { items: { name: string }[] };+ names.push(...json.items.map((i) => i.name));+ }+ return names;+}++describe.skipIf(!refs)("real archetype recipes", () => {+ const known = knownNames();+ const read = (a: string) =>+ readFileSync(path.join(refs as string, "archetypes", `${a}.md`), "utf8");++ for (const archetype of ARCHETYPES) {+ it(`${archetype} parses into beats with catalog components`, () => {+ const plan = parseRecipe(read(archetype), known);+ expect(plan.beats.length).toBeGreaterThanOrEqual(3);+ expect(plan.beats.some((b) => b.components.length > 0)).toBe(true);+ for (const beat of plan.beats) {+ for (const c of beat.components) expect(known).toContain(c);+ }+ });+ }++ it("product-demo uses the prose split for frames and lists transitions", () => {+ const plan = parseRecipe(read("product-demo"), known);+ expect(plan.beats[0].name).toBe("Hook");+ expect(plan.beats[0]).toMatchObject({ startFrame: 0, endFrame: 165 });+ expect(plan.totalFrames).toBe(1356);+ expect(plan.transitions).toContain("whip-pan");+ });++ it("product-demo short variant keeps the recipe's beat order", () => {+ const plan = parseRecipe(read("product-demo"), known, 18);+ expect(plan.variant).toBe("Short");+ expect(plan.beats.map((b) => b.name)).toEqual([+ "Hook",+ "Product reveal",+ "Positioning",+ "CTA",+ ]);+ expect(plan.beats.at(-1)?.endFrame).toBe(540);+ });++ it("cli-tool-demo picks the variant closest to the duration", () => {+ expect(parseRecipe(read("cli-tool-demo"), known, 18).totalFrames).toBe(540);+ expect(parseRecipe(read("cli-tool-demo"), known, 45).totalFrames).toBe(+ 1350,+ );+ });++ it("anatomy exposes the quality bar section", () => {+ const anatomy = readFileSync(+ path.join(refs as string, "anatomy.md"),+ "utf8",+ );+ const bar = extractQualityBar(anatomy);+ expect(bar?.startsWith("## 3.")).toBe(true);+ expect(bar).not.toContain("## 2.");+ });+});diff --git a/lib/mcp/archetypes.ts b/lib/mcp/archetypes.tsnew file mode 100644index 00000000..d1a24fd1--- /dev/null+++ b/lib/mcp/archetypes.ts@@ -0,0 +1,562 @@+/**+ * Pure archetype logic for `plan_video`: pick an archetype from a brief and+ * package a recipe markdown file into a structured beats array. The recipe is+ * the authority — this module only reads what the recipe says (its tables) and+ * never invents beats or components the recipe does not name.+ */++export const ARCHETYPES = [+ "product-demo",+ "changelog",+ "feature-announcement",+ "oss-showcase",+ "cli-tool-demo",+ "testimonial-reel",+ "year-in-review",+ "pricing-reveal",+ "logo-bumper",+] as const;++export type Archetype = (typeof ARCHETYPES)[number];++/** Phrase → weight. Multi-word phrases are matched on the normalized brief. */+const KEYWORDS: Record<Archetype, Record<string, number>> = {+ "product-demo": {+ demo: 2,+ "product demo": 4,+ walkthrough: 3,+ explainer: 3,+ saas: 2,+ app: 1,+ product: 1,+ startup: 1,+ onboarding: 2,+ "how it works": 3,+ },+ changelog: {+ changelog: 5,+ "release notes": 5,+ "what's new": 3,+ "whats new": 3,+ release: 2,+ version: 2,+ patch: 2,+ update: 1,+ updates: 1,+ fixed: 1,+ },+ "feature-announcement": {+ feature: 2,+ "new feature": 4,+ announce: 3,+ announcement: 3,+ announcing: 3,+ introducing: 3,+ spotlight: 2,+ "now available": 3,+ "now in beta": 3,+ },+ "oss-showcase": {+ "open source": 4,+ "open-source": 4,+ oss: 4,+ github: 3,+ repo: 3,+ repository: 3,+ stars: 2,+ contributors: 3,+ library: 1,+ },+ "cli-tool-demo": {+ cli: 5,+ terminal: 4,+ "command line": 5,+ "command-line": 5,+ command: 1,+ shell: 2,+ npx: 3,+ "dev tool": 3,+ devtool: 3,+ sdk: 1,+ },+ "testimonial-reel": {+ testimonial: 5,+ testimonials: 5,+ quotes: 3,+ quote: 2,+ reviews: 3,+ review: 1,+ customers: 2,+ "social proof": 5,+ "what people say": 4,+ "what users say": 4,+ },+ "year-in-review": {+ "year in review": 6,+ "year-in-review": 6,+ recap: 4,+ wrapped: 4,+ annual: 3,+ yearly: 3,+ milestones: 2,+ metrics: 2,+ stats: 2,+ numbers: 1,+ },+ "pricing-reveal": {+ pricing: 5,+ price: 3,+ prices: 3,+ plans: 3,+ tiers: 3,+ subscription: 2,+ "free trial": 2,+ },+ "logo-bumper": {+ logo: 3,+ bumper: 5,+ sting: 4,+ ident: 4,+ intro: 2,+ outro: 2,+ wordmark: 4,+ "brand reveal": 4,+ "logo reveal": 6,+ },+};++export interface ArchetypePick {+ archetype: Archetype;+ matched: string[];+ /** True when nothing matched and the flagship default was used. */+ fallback: boolean;+}++function normalizeText(text: string): string {+ return ` ${text+ .toLowerCase()+ .replace(/[’']/g, "'")+ .replace(/[^a-z0-9' -]+/g, " ")+ .replace(/\s+/g, " ")+ .trim()} `;+}++export function pickArchetype(brief: string): ArchetypePick {+ const text = normalizeText(brief);+ let best: ArchetypePick & { score: number } = {+ archetype: "product-demo",+ matched: [],+ fallback: true,+ score: 0,+ };+ for (const archetype of ARCHETYPES) {+ let score = 0;+ const matched: string[] = [];+ for (const [phrase, weight] of Object.entries(KEYWORDS[archetype])) {+ if (text.includes(` ${phrase} `)) {+ score += weight;+ matched.push(phrase);+ }+ }+ // Strict `>` keeps ARCHETYPES order as the deterministic tie-break.+ if (score > best.score) {+ best = { archetype, matched, fallback: false, score };+ }+ }+ return {+ archetype: best.archetype,+ matched: best.matched,+ fallback: best.fallback,+ };+}++export function isArchetype(value: string): value is Archetype {+ return (ARCHETYPES as readonly string[]).includes(value);+}++// ---------------------------------------------------------------------------+// Recipe parsing+// ---------------------------------------------------------------------------++export interface PlanBeat {+ name: string;+ startFrame?: number;+ endFrame?: number;+ what?: string;+ /** Catalog components the recipe names for this beat, in recipe order. */+ components: string[];+ /** Components the recipe says to build because the catalog lacks them. */+ buildNew: string[];+}++export interface PlanExtra {+ label: string;+ components: string[];+ buildNew: string[];+}++export interface ParsedRecipe {+ meta: Record<string, string>;+ /** Heading of the beats table used (e.g. `Short (~18s / 540f)`), when the recipe has several. */+ variant?: string;+ /** Frames the picked variant runs for, per the recipe. */+ totalFrames?: number;+ beats: PlanBeat[];+ transitions: string[];+ extras: PlanExtra[];+ notes: string[];+}++interface Table {+ heading?: string;+ header: string[];+ rows: string[][];+}++/** Split a markdown table row on `|`, honoring `\|` escapes and code spans. */+export function splitRow(line: string): string[] {+ const cells: string[] = [];+ let current = "";+ let inCode = false;+ const body = line.trim().replace(/^\|/, "").replace(/\|$/, "");+ for (let i = 0; i < body.length; i++) {+ const ch = body[i];+ if (ch === "\\" && body[i + 1] === "|") {+ current += "|";+ i++;+ continue;+ }+ if (ch === "`") inCode = !inCode;+ if (ch === "|" && !inCode) {+ cells.push(current.trim());+ current = "";+ continue;+ }+ current += ch;+ }+ cells.push(current.trim());+ return cells;+}++function parseTables(markdown: string): Table[] {+ const tables: Table[] = [];+ const lines = markdown.split("\n");+ let heading: string | undefined;+ for (let i = 0; i < lines.length; i++) {+ const line = lines[i];+ const h = /^#{2,4}\s+(.*)$/.exec(line);+ if (h) {+ heading = h[1].trim();+ continue;+ }+ if (!line.trim().startsWith("|")) continue;+ const next = lines[i + 1] ?? "";+ if (!/^\s*\|[\s:|-]+\|\s*$/.test(next)) continue;+ const header = splitRow(line);+ const rows: string[][] = [];+ let j = i + 2;+ while (j < lines.length && lines[j].trim().startsWith("|")) {+ rows.push(splitRow(lines[j]));+ j++;+ }+ tables.push({ heading, header, rows });+ i = j - 1;+ }+ return tables;+}++function stripMd(text: string): string {+ return text.replace(/\*\*/g, "").trim();+}++function beatKey(name: string): string {+ return (+ stripMd(name)+ .toLowerCase()+ .match(/[a-z]+/)?.[0] ?? ""+ );+}++function backticked(text: string): string[] {+ return [...text.matchAll(/`([^`]+)`/g)].map((m) => m[1].trim());+}++function uniq(values: string[]): string[] {+ return [...new Set(values)];+}++function catalogNames(text: string, known: Set<string>): string[] {+ return backticked(text).filter((n) => known.has(n));+}++function buildNewNames(text: string, known: Set<string>): string[] {+ return [...text.matchAll(/\*\*`([a-z0-9-]+)`\*\*/g)]+ .map((m) => m[1])+ .filter((n) => !known.has(n));+}++function parseFrames(cell: string): { start?: number; end?: number } {+ const m = /(\d+)\s*f?\s*[–—-]\s*(\d+)/.exec(cell);+ if (!m) return {};+ return { start: Number(m[1]), end: Number(m[2]) };+}++export function parseMetaLine(markdown: string): Record<string, string> {+ const line = markdown.split("\n").find((l) => l.startsWith("**Family:**"));+ if (!line) return {};+ const meta: Record<string, string> = {};+ for (const part of line.split(" · ")) {+ const m = /^\*\*(.+?):\*\*\s*(.*)$/.exec(part.trim());+ if (m) meta[m[1].toLowerCase().replace(/\s+/g, "")] = m[2].trim();+ }+ return meta;+}++/** First `(\d+)f` in the recipe's default duration, e.g. `~45s (1350f @30fps…)` → 1350. */+export function defaultFrames(+ meta: Record<string, string>,+): number | undefined {+ const m = /(\d+)f\b/.exec(meta.defaultduration ?? "");+ return m ? Number(m[1]) : undefined;+}++/** `Hook 165 · Positioning 120 · Product reveal 150` → ordered name/frames pairs. */+function parseSplit(markdown: string): { name: string; frames: number }[] {+ // Join soft-wrapped prose lines so a split that wraps mid-sentence parses.+ const prose = markdown.replace(/([^\n])\n(?=[^\n])/g, "$1 ");+ const m = /split:\s*([^\n]+?)\.\s*$/m.exec(prose);+ if (!m) return [];+ return m[1]+ .split("·")+ .map((part) => /^\s*([A-Za-z][A-Za-z /-]*?)\s+(\d+)/.exec(part))+ .filter((p): p is RegExpExecArray => p !== null)+ .map((p) => ({ name: p[1].trim(), frames: Number(p[2]) }));+}++function isBeatsTable(t: Table): boolean {+ return (+ t.header.some((h) => /^beat$/i.test(h)) &&+ t.header.some((h) => /^frames/i.test(h))+ );+}++function isSlotsTable(t: Table): boolean {+ return (+ /^beat$/i.test(t.header[0] ?? "") &&+ t.header.some((h) => /component|slot/i.test(h))+ );+}++function isVariantTable(t: Table): boolean {+ return /^variant$/i.test(t.header[0] ?? "");+}++function variantFrames(cell: string): number | undefined {+ const m = /(\d[\d,]*)/.exec(cell);+ return m ? Number(m[1].replace(/,/g, "")) : undefined;+}++export function parseRecipe(+ markdown: string,+ knownComponents: Iterable<string>,+ durationSeconds?: number,+): ParsedRecipe {+ const known = new Set(knownComponents);+ const meta = parseMetaLine(markdown);+ const tables = parseTables(markdown);+ const notes: string[] = [];+ const targetFrames =+ durationSeconds !== undefined+ ? Math.round(durationSeconds * 30)+ : defaultFrames(meta);++ // Slot rows: what the recipe says goes into each beat.+ const slots = tables.find(isSlotsTable);+ const slotRows = (slots?.rows ?? []).map((row) => {+ const label = stripMd(row[0] ?? "");+ const catalogCol = slots?.header.findIndex((h) =>+ /catalog|slot candidates/i.test(h),+ );+ const newCol = slots?.header.findIndex((h) => /new component/i.test(h));+ const catalogText =+ catalogCol !== undefined && catalogCol >= 0+ ? (row[catalogCol] ?? "")+ : row.slice(1).join(" ");+ const newText =+ newCol !== undefined && newCol >= 0 ? (row[newCol] ?? "") : "";+ return {+ label,+ key: beatKey(label),+ components: catalogNames(catalogText, known),+ buildNew: uniq([+ ...buildNewNames(newText, known),+ ...buildNewNames(catalogText, known),+ ]),+ used: false,+ };+ });++ const transitionsRow = slotRows.find((r) => r.key === "transitions");+ const transitions = transitionsRow?.components ?? [];+ if (transitionsRow) transitionsRow.used = true;++ let beats: PlanBeat[] = [];+ let variant: string | undefined;+ let totalFrames: number | undefined;++ const beatTables = tables.filter(isBeatsTable);+ if (beatTables.length > 0) {+ // Several beats tables = duration variants (e.g. Short / Standard). Pick+ // the one whose length is closest to the requested (or default) duration.+ const withTotals = beatTables.map((t) => {+ const frameCol = t.header.findIndex((h) => /^frames/i.test(h));+ const ends = t.rows.map((r) => parseFrames(r[frameCol] ?? "").end ?? 0);+ return { table: t, total: Math.max(0, ...ends) };+ });+ const chosen =+ targetFrames === undefined+ ? withTotals[withTotals.length - 1]+ : withTotals.reduce((a, b) =>+ Math.abs(b.total - targetFrames) < Math.abs(a.total - targetFrames)+ ? b+ : a,+ );+ if (beatTables.length > 1) variant = chosen.table.heading;+ totalFrames = chosen.total || undefined;++ const { header, rows } = chosen.table;+ const frameCol = header.findIndex((h) => /^frames/i.test(h));+ const beatCol = header.findIndex((h) => /^beat$/i.test(h));+ const whatCol = header.findIndex((h) => /what happens/i.test(h));+ beats = rows.map((row) => {+ const name = stripMd(row[beatCol] ?? "");+ const frames = parseFrames(row[frameCol] ?? "");+ const what = whatCol >= 0 ? row[whatCol] : undefined;+ const key = beatKey(name);+ const matches = slotRows.filter((s) => s.key === key);+ for (const m of matches) m.used = true;+ return {+ name,+ startFrame: frames.start,+ endFrame: frames.end,+ what,+ components: uniq([+ ...matches.flatMap((m) => m.components),+ ...catalogNames(what ?? "", known),+ ]),+ buildNew: uniq(matches.flatMap((m) => m.buildNew)),+ };+ });+ } else if (slotRows.length > 0) {+ // No frames table (product-demo): the slots table is the beat list and+ // the prose "split:" line carries the frame budget.+ const split = parseSplit(markdown);+ let cursor = 0;+ beats = slotRows+ .filter((r) => !r.used)+ .map((r) => {+ r.used = true;+ const budget = split.find((s) => beatKey(s.name) === r.key);+ const beat: PlanBeat = {+ name: r.label,+ components: r.components,+ buildNew: r.buildNew,+ };+ if (budget) {+ beat.startFrame = cursor;+ beat.endFrame = cursor + budget.frames;+ cursor += budget.frames;+ }+ return beat;+ });+ if (cursor > 0) totalFrames = cursor;++ const variants = tables.find(isVariantTable);+ if (variants && durationSeconds !== undefined && targetFrames) {+ const framesCol = variants.header.findIndex((h) => /^frames/i.test(h));+ const beatsCol = variants.header.findIndex((h) => /^beats$/i.test(h));+ const options = variants.rows+ .map((row) => ({+ label: stripMd(row[0] ?? ""),+ frames: variantFrames(row[framesCol] ?? ""),+ beats: row[beatsCol] ?? "",+ }))+ .filter((v): v is typeof v & { frames: number } => !!v.frames);+ if (options.length > 0) {+ const best = options.reduce((a, b) =>+ Math.abs(b.frames - targetFrames) < Math.abs(a.frames - targetFrames)+ ? b+ : a,+ );+ variant = best.label;+ if (!/^all\b/i.test(best.beats.trim())) {+ const order = best.beats+ .split(/→|\/|,/)+ .map((part) => beatKey(part))+ .filter(Boolean);+ const subset = beats+ .filter((b) => order.includes(beatKey(b.name)))+ .sort(+ (a, b) =>+ order.indexOf(beatKey(a.name)) - order.indexOf(beatKey(b.name)),+ );+ if (subset.length > 0 && subset.length < beats.length) {+ beats = rescale(subset, best.frames);+ totalFrames = best.frames;+ notes.push(+ `Beat frames were scaled from the recipe's standard split to the ${best.label} variant (${best.frames}f). Treat them as a starting budget.`,+ );+ }+ }+ }+ }+ }++ const extras = slotRows+ .filter((r) => !r.used)+ .map(({ label, components, buildNew }) => ({+ label,+ components,+ buildNew,+ }));++ if (+ durationSeconds !== undefined &&+ totalFrames !== undefined &&+ Math.abs(totalFrames - durationSeconds * 30) > 30+ ) {+ notes.push(+ `The recipe's beats run ${totalFrames}f (~${Math.round(totalFrames / 30)}s) vs the requested ${durationSeconds}s. Adjust hold time, not component lengths, and check the recipe's duration guidance.`,+ );+ }++ return { meta, variant, totalFrames, beats, transitions, extras, notes };+}++function rescale(beats: PlanBeat[], total: number): PlanBeat[] {+ const sum = beats.reduce(+ (acc, b) => acc + ((b.endFrame ?? 0) - (b.startFrame ?? 0)),+ 0,+ );+ if (sum <= 0) return beats;+ let cursor = 0;+ return beats.map((b, i) => {+ const length = (b.endFrame ?? 0) - (b.startFrame ?? 0);+ const scaled =+ i === beats.length - 1+ ? total - cursor+ : Math.round((length / sum) * total);+ const out = { ...b, startFrame: cursor, endFrame: cursor + scaled };+ cursor += scaled;+ return out;+ });+}++/** `## 3. Good vs slop` section of anatomy.md — the quality bar every recipe points at. */+export function extractQualityBar(anatomy: string): string | undefined {+ const start = anatomy.search(/^## 3\./m);+ if (start < 0) return undefined;+ const rest = anatomy.slice(start);+ const next = rest.slice(1).search(/^## /m);+ return (next < 0 ? rest : rest.slice(0, next + 1)).trim();+}diff --git a/lib/mcp/catalog.ts b/lib/mcp/catalog.tsnew file mode 100644index 00000000..257983b0--- /dev/null+++ b/lib/mcp/catalog.ts@@ -0,0 +1,99 @@+import "server-only";++import { getLLMText, SITE_URL } from "@/lib/get-llm-text";+import type { ComponentRecord } from "@/lib/mcp/search";+import { installCommand } from "@/lib/mcp/search";+import remocnRegistry from "@/registry/remocn/registry.json";+import iconsRegistry from "@/registry/remocn-icons/registry.json";+import templatesRegistry from "@/registry/remocn-templates/registry.json";+import remocnUiRegistry from "@/registry/remocn-ui/registry.json";+import { source } from "@/source";++/**+ * The same facts that power `/llms-components.txt`: registry.json items joined+ * with the docs frontmatter (`component`, `vibe`, `length`, `useWhen`,+ * `avoidWhen`). Built once per process — both inputs are static at runtime.+ */++const TIERS = [+ { tier: "remocn", items: remocnRegistry.items },+ { tier: "remocn-ui", items: remocnUiRegistry.items },+ { tier: "remocn-icons", items: iconsRegistry.items },+ { tier: "remocn-template", items: templatesRegistry.items },+] as const;++export interface RegistryFacts {+ name: string;+ title?: string;+ description?: string;+ tier: string;+ deps: string[];+}++type DocPage = ReturnType<typeof source.getPages>[number];++interface Catalog {+ records: ComponentRecord[];+ byName: Map<string, ComponentRecord>;+ pages: Map<string, DocPage>;+ registry: Map<string, RegistryFacts>;+}++let cached: Catalog | undefined;++export function getCatalog(): Catalog {+ if (cached) return cached;++ const registry = new Map<string, RegistryFacts>();+ for (const { tier, items } of TIERS) {+ for (const item of items as {+ name: string;+ title?: string;+ description?: string;+ registryDependencies?: string[];+ }[]) {+ registry.set(item.name, {+ name: item.name,+ title: item.title,+ description: item.description,+ tier,+ deps: item.registryDependencies ?? [],+ });+ }+ }++ const records: ComponentRecord[] = [];+ const byName = new Map<string, ComponentRecord>();+ const pages = new Map<string, DocPage>();+ for (const page of source.getPages()) {+ const data = page.data;+ const name = data.component;+ if (!name || byName.has(name)) continue;+ const record: ComponentRecord = {+ name,+ title: data.title ?? name,+ description: data.description ?? registry.get(name)?.description ?? "",+ section: page.slugs[0] ?? "",+ docs: `${SITE_URL}${page.url}.md`,+ vibe: data.vibe,+ length: data.length,+ tier: registry.get(name)?.tier,+ useWhen: data.useWhen ?? [],+ avoidWhen: data.avoidWhen ?? [],+ install: installCommand(name),+ };+ records.push(record);+ byName.set(name, record);+ pages.set(name, page);+ }++ cached = { records, byName, pages, registry };+ return cached;+}++export async function getComponentMarkdown(+ name: string,+): Promise<string | undefined> {+ const page = getCatalog().pages.get(name);+ return page ? getLLMText(page) : undefined;+}diff --git a/lib/mcp/config.ts b/lib/mcp/config.tsnew file mode 100644index 00000000..b5bd6b78--- /dev/null+++ b/lib/mcp/config.ts@@ -0,0 +1,37 @@+import { SITE_URL } from "@/lib/get-llm-text";++/** URI of the MCP App view shared by `preview_component` and `plan_video`. */+export const PREVIEW_RESOURCE_URI = "ui://remocn/preview";++/**+ * MCP Apps constants, verified against `@modelcontextprotocol/[email protected]`+ * (`dist/src/constants.d.ts`, `spec.types.d.ts`). Inlined rather than imported+ * so the server does not pull the ext-apps client/core peer dependencies.+ */+export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";++/**+ * Origin that serves the chrome-less `/embed/<name>` player pages the MCP App+ * view iframes. Defaults to production; set `REMOCN_EMBED_BASE_URL` (e.g.+ * `http://localhost:3123`) to test against a local dev server.+ */+export function embedBaseUrl(): string {+ const raw = process.env.REMOCN_EMBED_BASE_URL?.trim();+ if (!raw) return SITE_URL;+ try {+ return new URL(raw).origin;+ } catch {+ return SITE_URL;+ }+}++export function embedUrl(+ name: string,+ props?: Record<string, unknown>,+): string {+ const url = new URL(`/embed/${encodeURIComponent(name)}`, embedBaseUrl());+ if (props && Object.keys(props).length > 0) {+ url.searchParams.set("props", JSON.stringify(props));+ }+ return url.toString();+}diff --git a/lib/mcp/search.test.ts b/lib/mcp/search.test.tsnew file mode 100644index 00000000..68886810--- /dev/null+++ b/lib/mcp/search.test.ts@@ -0,0 +1,151 @@+import { describe, expect, it } from "bun:test";+import {+ type ComponentRecord,+ closestNames,+ normalizeName,+ searchComponents,+} from "./search";++function record(+ name: string,+ overrides: Partial<ComponentRecord> = {},+): ComponentRecord {+ return {+ name,+ title: name+ .split("-")+ .map((w) => w[0].toUpperCase() + w.slice(1))+ .join(" "),+ description: "",+ section: "typography",+ docs: `https://remocn.dev/docs/typography/${name}.md`,+ vibe: "clean",+ length: 30,+ tier: "remocn",+ useWhen: [],+ avoidWhen: [],+ install: `npx shadcn@latest add @remocn/${name}`,+ ...overrides,+ };+}++const RECORDS: ComponentRecord[] = [+ record("typewriter", {+ description: "Types text character by character with a blinking caret",+ useWhen: ["A terminal-style line should appear as if typed"],+ length: 90,+ vibe: "tech",+ }),+ record("rolling-number", {+ section: "motion-graphics",+ description: "A number counter that rolls digits up to a target",+ useWhen: ["Land one metric with a satisfying count-up"],+ vibe: "data",+ length: 45,+ }),+ record("number-wheel", {+ section: "motion-graphics",+ description: "Slot-style digits spin into place",+ vibe: "data",+ length: 60,+ }),+ record("accordion", {+ section: "ui",+ description: "Expands and collapses a disclosure panel",+ length: "state-driven",+ tier: "remocn-ui",+ }),+ record("whip-pan", {+ section: "transitions",+ description: "Fast directional blur transition between scenes",+ vibe: "playful",+ length: 18,+ }),+];++describe("searchComponents", () => {+ it("ranks the exact name first", () => {+ const [first] = searchComponents(RECORDS, { query: "number wheel" });+ expect(first.name).toBe("number-wheel");+ });++ it("matches on description and useWhen", () => {+ const names = searchComponents(RECORDS, { query: "metric counter" }).map(+ (r) => r.name,+ );+ expect(names[0]).toBe("rolling-number");+ });++ it("prefix-matches longer words", () => {+ const names = searchComponents(RECORDS, { query: "type" }).map(+ (r) => r.name,+ );+ expect(names).toContain("typewriter");+ });++ it("filters by vibe", () => {+ const names = searchComponents(RECORDS, {+ query: "number",+ vibe: "data",+ }).map((r) => r.name);+ expect(names.sort()).toEqual(["number-wheel", "rolling-number"]);+ });++ it("filters by maxLength and drops non-numeric lengths", () => {+ const names = searchComponents(RECORDS, { query: "", maxLength: 50 }).map(+ (r) => r.name,+ );+ expect(names).toEqual(["rolling-number", "whip-pan"]);+ expect(names).not.toContain("accordion");+ });++ it("keeps state-driven components when maxLength is not set", () => {+ const names = searchComponents(RECORDS, { query: "disclosure" }).map(+ (r) => r.name,+ );+ expect(names).toEqual(["accordion"]);+ });++ it("returns nothing for unrelated queries", () => {+ expect(searchComponents(RECORDS, { query: "zebra quokka" })).toEqual([]);+ });++ it("respects the limit", () => {+ expect(searchComponents(RECORDS, { query: "", limit: 2 })).toHaveLength(2);+ });+});++describe("name lookup", () => {+ it("normalizes registry-style input", () => {+ expect(normalizeName("@remocn/Kinetic Center Build")).toBe(+ "kinetic-center-build",+ );+ expect(normalizeName("typography/typewriter.md")).toBe("typewriter");+ });++ it("suggests close matches for typos", () => {+ const names = RECORDS.map((r) => r.name);+ expect(closestNames(names, "typewritter")[0]).toBe("typewriter");+ expect(closestNames(names, "rolling")[0]).toBe("rolling-number");+ expect(closestNames(names, "wheel-number")).toContain("number-wheel");+ });++ it("returns no suggestions for nonsense", () => {+ expect(closestNames(["typewriter", "whip-pan"], "qqqqqqqqqq")).toEqual([]);+ });+});++describe("ranking regressions", () => {+ it("a full component name in a longer query beats partial-word matches", () => {+ const records = [+ record("typewriter", { description: "Character reveal with a cursor" }),+ record("rush-type", {+ description: "Cycles one forceful headline word at a time",+ }),+ ];+ const [first] = searchComponents(records, {+ query: "typewriter headline",+ });+ expect(first.name).toBe("typewriter");+ });+});diff --git a/lib/mcp/search.ts b/lib/mcp/search.tsnew file mode 100644index 00000000..ba189d52--- /dev/null+++ b/lib/mcp/search.ts@@ -0,0 +1,256 @@+/**+ * Pure catalog search for the MCP server. No I/O here — the records are built+ * from the docs frontmatter + registry.json files in `lib/mcp/catalog.ts` and+ * passed in, so the ranking is testable with plain fixtures.+ */++export type ComponentLength =+ | number+ | "state-driven"+ | "sustained"+ | "transcript-driven";++export interface ComponentRecord {+ name: string;+ title: string;+ description: string;+ /** First docs slug segment, e.g. `typography`. */+ section: string;+ /** Absolute URL of the raw-markdown docs page (`…/docs/<section>/<name>.md`). */+ docs: string;+ vibe?: string;+ length?: ComponentLength;+ /** Registry namespace: `remocn`, `remocn-ui`, `remocn-template`, … */+ tier?: string;+ useWhen: string[];+ avoidWhen: string[];+ install: string;+}++export interface SearchOptions {+ query: string;+ vibe?: string;+ maxLength?: number;+ limit?: number;+}++export const DEFAULT_LIMIT = 10;+export const MAX_LIMIT = 50;++const STOPWORDS = new Set([+ "a",+ "an",+ "and",+ "are",+ "as",+ "at",+ "be",+ "by",+ "for",+ "from",+ "i",+ "in",+ "into",+ "is",+ "it",+ "me",+ "my",+ "need",+ "of",+ "on",+ "or",+ "our",+ "some",+ "something",+ "that",+ "the",+ "this",+ "to",+ "want",+ "we",+ "with",+ "component",+ "components",+ "remocn",+]);++export function installCommand(name: string): string {+ return `npx shadcn@latest add @remocn/${name}`;+}++export function tokenize(text: string): string[] {+ return text+ .toLowerCase()+ .split(/[^a-z0-9]+/)+ .filter((t) => t.length > 1 && !STOPWORDS.has(t));+}++/**+ * Exact match; a typed prefix of 4+ chars (`type` → `typewriter`); or a word+ * that is the query minus a short suffix (`counter` → `count`). The reverse+ * direction is capped so `typewriter` does not match every `type`.+ */+function tokenMatches(queryToken: string, word: string): boolean {+ if (queryToken === word) return true;+ if (queryToken.length >= 4 && word.startsWith(queryToken)) return true;+ if (+ word.length >= 4 &&+ queryToken.length - word.length <= 3 &&+ queryToken.startsWith(word)+ )+ return true;+ return false;+}++function fieldHit(queryToken: string, words: string[]): boolean {+ return words.some((w) => tokenMatches(queryToken, w));+}++const WEIGHTS = {+ name: 6,+ title: 5,+ description: 3,+ section: 2,+ useWhen: 2,+ vibe: 1,+} as const;++export function scoreComponent(+ record: ComponentRecord,+ queryTokens: string[],+ rawQuery: string,+): number {+ if (queryTokens.length === 0) return 0;+ const fields = {+ name: tokenize(record.name.replace(/-/g, " ")),+ title: tokenize(record.title),+ description: tokenize(record.description),+ section: tokenize(record.section.replace(/-/g, " ")),+ useWhen: tokenize(record.useWhen.join(" ")),+ vibe: record.vibe ? [record.vibe] : [],+ };++ let score = 0;+ let matchedTokens = 0;+ for (const token of queryTokens) {+ let tokenScore = 0;+ for (const key of Object.keys(fields) as (keyof typeof fields)[]) {+ if (fieldHit(token, fields[key])) tokenScore += WEIGHTS[key];+ }+ if (tokenScore > 0) matchedTokens++;+ score += tokenScore;+ }+ if (score === 0) return 0;++ // Reward covering more of the query, so "number counter" beats a page that+ // just says "number" a lot.+ score *= 1 + matchedTokens / queryTokens.length;++ const normalized = rawQuery.trim().toLowerCase().replace(/\s+/g, "-");+ if (normalized === record.name) score += 50;+ else if (queryTokens.includes(record.name)) score += 15;+ else if (normalized.length >= 3 && record.name.includes(normalized))+ score += 10;++ return score;+}++function passesFilters(+ record: ComponentRecord,+ { vibe, maxLength }: SearchOptions,+): boolean {+ if (vibe && record.vibe !== vibe) return false;+ if (maxLength !== undefined) {+ // Only components with a measured frame count can be compared against a+ // budget — state-driven / sustained / transcript-driven ones are excluded.+ if (typeof record.length !== "number") return false;+ if (record.length > maxLength) return false;+ }+ return true;+}++export function searchComponents(+ records: ComponentRecord[],+ options: SearchOptions,+): ComponentRecord[] {+ const limit = Math.min(+ Math.max(1, Math.floor(options.limit ?? DEFAULT_LIMIT)),+ MAX_LIMIT,+ );+ const candidates = records.filter((r) => passesFilters(r, options));+ const queryTokens = tokenize(options.query);++ if (queryTokens.length === 0) {+ return [...candidates]+ .sort((a, b) => a.name.localeCompare(b.name))+ .slice(0, limit);+ }++ return candidates+ .map((record) => ({+ record,+ score: scoreComponent(record, queryTokens, options.query),+ }))+ .filter((r) => r.score > 0)+ .sort(+ (a, b) => b.score - a.score || a.record.name.localeCompare(b.record.name),+ )+ .slice(0, limit)+ .map((r) => r.record);+}++export function levenshtein(a: string, b: string): number {+ if (a === b) return 0;+ if (!a.length) return b.length;+ if (!b.length) return a.length;+ let prev = Array.from({ length: b.length + 1 }, (_, i) => i);+ for (let i = 1; i <= a.length; i++) {+ const curr = [i];+ for (let j = 1; j <= b.length; j++) {+ curr[j] = Math.min(+ prev[j] + 1,+ curr[j - 1] + 1,+ prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),+ );+ }+ prev = curr;+ }+ return prev[b.length];+}++/** Normalize user input into a registry-style name: `Kinetic Center Build` → `kinetic-center-build`. */+export function normalizeName(input: string): string {+ const last =+ input+ .trim()+ .toLowerCase()+ .replace(/^@remocn\//, "")+ .replace(/\.md$/, "")+ .split("/")+ .pop() ?? "";+ return last.replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");+}++/** Closest known names for an unknown lookup: substring hits first, then edit distance. */+export function closestNames(+ names: string[],+ input: string,+ count = 5,+): string[] {+ const target = normalizeName(input);+ if (!target) return [];+ const targetTokens = target.split("-").filter((t) => t.length > 2);+ return names+ .map((name) => {+ let score =+ levenshtein(target, name) / Math.max(target.length, name.length);+ if (name.includes(target) || target.includes(name)) score -= 1;+ const shared = targetTokens.filter((t) => name.split("-").includes(t));+ score -= shared.length * 0.4;+ return { name, score };+ })+ .sort((a, b) => a.score - b.score || a.name.localeCompare(b.name))+ .filter((r) => r.score < 0.6)+ .slice(0, count)+ .map((r) => r.name);+}diff --git a/lib/mcp/server.ts b/lib/mcp/server.tsnew file mode 100644index 00000000..6cfb93b9--- /dev/null+++ b/lib/mcp/server.ts@@ -0,0 +1,501 @@+import "server-only";++import { McpServer } from "@modelcontextprotocol/server";+import { z } from "zod";+import { VIBES } from "@/lib/docs-schema";+import { SITE_URL } from "@/lib/get-llm-text";+import { readAnatomy, readArchetypeRecipe } from "@/lib/mcp/archetype-files";+import {+ ARCHETYPES,+ type Archetype,+ extractQualityBar,+ type PlanBeat,+ parseRecipe,+ pickArchetype,+} from "@/lib/mcp/archetypes";+import { getCatalog, getComponentMarkdown } from "@/lib/mcp/catalog";+import {+ embedBaseUrl,+ embedUrl,+ MCP_APP_MIME_TYPE,+ PREVIEW_RESOURCE_URI,+} from "@/lib/mcp/config";+import {+ type ComponentRecord,+ closestNames,+ installCommand,+ MAX_LIMIT,+ normalizeName,+ searchComponents,+} from "@/lib/mcp/search";+import { PREVIEW_WIDGET_HTML } from "@/lib/mcp/widget";+import { previewManifest } from "@/registry/__manifest__";++const SERVER_INFO = { name: "remocn", version: "1.0.0" };++const INSTRUCTIONS = `remocn is a shadcn registry of Remotion video components. Find components with search_components, read one with get_component before writing code against it, and use plan_video to turn a brief into a beat-by-beat storyboard. Install with \`npx shadcn@latest add @remocn/<name>\`. Full index: ${SITE_URL}/llms-components.txt`;++const MAX_PROPS_JSON = 4000;+// The endpoint is public and unauthenticated; every text input is bounded so+// one request can't hold the event loop.+const MAX_NAME = 200;+const MAX_QUERY = 500;+const MAX_BRIEF = 2000;+const MAX_SUGGEST_INPUT = 64;++const READ_ONLY = {+ readOnlyHint: true,+ destructiveHint: false,+ idempotentHint: true,+ openWorldHint: false,+} as const;++type TextResult = {+ content: { type: "text"; text: string }[];+ structuredContent?: Record<string, unknown>;+ isError?: boolean;+};++function text(body: string, structuredContent?: Record<string, unknown>) {+ const result: TextResult = { content: [{ type: "text", text: body }] };+ if (structuredContent) result.structuredContent = structuredContent;+ return result;+}++function errorText(body: string): TextResult {+ return { content: [{ type: "text", text: body }], isError: true };+}++function lengthLabel(length: ComponentRecord["length"]): string {+ if (length === undefined) return "—";+ return typeof length === "number" ? `${length}f` : length;+}++function htmlDocsUrl(record: ComponentRecord): string {+ return record.docs.replace(/\.md$/, "");+}++/** Resolve user input (name, `@remocn/name`, docs path, or title) to a documented component. */+function resolveComponent(input: string): ComponentRecord | undefined {+ const { byName, records } = getCatalog();+ const exact = byName.get(input.trim());+ if (exact) return exact;+ const normalized = normalizeName(input);+ const byNormalized = byName.get(normalized);+ if (byNormalized) return byNormalized;+ const lowered = input.trim().toLowerCase();+ return records.find((r) => r.title.toLowerCase() === lowered);+}++function unknownComponent(input: string): TextResult {+ const { records, registry } = getCatalog();+ const normalized = normalizeName(input);+ const registryOnly = registry.get(normalized);+ if (registryOnly) {+ const hint =+ registryOnly.tier === "remocn-icons"+ ? `Icons are documented as a gallery: ${SITE_URL}/docs/icons/gallery.md`+ : "It is a shared library pulled in by other components, not used on its own.";+ return text(+ `\`${normalized}\` is a registry item without its own docs page. ${hint}\nInstall: \`${installCommand(normalized)}\``,+ );+ }+ // Edit distance against every name is quadratic in the input; a name this+ // long is no typo of a component, so skip the suggestions.+ const matches =+ input.length > MAX_SUGGEST_INPUT+ ? []+ : closestNames(+ records.map((r) => r.name),+ input,+ );+ const suggestion = matches.length+ ? `Did you mean: ${matches.map((m) => `\`${m}\``).join(", ")}?`+ : "Try search_components to find it by what it does.";+ return errorText(`No remocn component named "${input}". ${suggestion}`);+}++function formatRow(r: ComponentRecord): string {+ const facts = [r.section, r.vibe, lengthLabel(r.length), r.tier]+ .filter(Boolean)+ .join(" · ");+ const lines = [`- \`${r.name}\` — ${r.title} (${facts})`];+ if (r.useWhen[0]) lines.push(` Use: ${r.useWhen[0]}`);+ if (r.avoidWhen[0]) lines.push(` Avoid: ${r.avoidWhen[0]}`);+ lines.push(` Docs: ${r.docs} · Install: \`${r.install}\``);+ return lines.join("\n");+}++function compactRow(r: ComponentRecord) {+ return {+ name: r.name,+ title: r.title,+ section: r.section,+ docs: r.docs,+ vibe: r.vibe ?? null,+ length: r.length ?? null,+ tier: r.tier ?? null,+ useWhen: r.useWhen.slice(0, 2),+ avoidWhen: r.avoidWhen.slice(0, 2),+ install: r.install,+ };+}++function previewFor(name: string, props?: Record<string, unknown>) {+ const entry = previewManifest[name];+ if (!entry) return undefined;+ return {+ name,+ embedUrl: embedUrl(name, props),+ durationInFrames: entry.durationInFrames,+ fps: entry.fps,+ width: entry.compositionWidth,+ height: entry.compositionHeight,+ };+}++function beatOptions(beat: PlanBeat) {+ return beat.components.map((name) => ({+ name,+ embedUrl: previewManifest[name] ? embedUrl(name) : null,+ docs: getCatalog().byName.get(name)?.docs ?? null,+ }));+}++function formatFrames(beat: PlanBeat): string {+ return beat.startFrame !== undefined && beat.endFrame !== undefined+ ? ` (${beat.startFrame}–${beat.endFrame}f)`+ : "";+}++/**+ * `_meta.ui` for the view (McpUiResourceMeta in ext-apps). Hosts read it from+ * the `resources/read` content item, falling back to the `resources/list`+ * entry, so it is set on both. The view only nests iframes of the embed+ * origin; it loads no remote scripts and makes no network calls itself.+ */+function previewResourceMeta() {+ return {+ ui: {+ csp: {+ frameDomains: [embedBaseUrl()],+ resourceDomains: [],+ connectDomains: [],+ },+ permissions: { clipboardWrite: {} },+ prefersBorder: false,+ },+ };+}++export function createRemocnMcpServer(): McpServer {+ const server = new McpServer(SERVER_INFO, { instructions: INSTRUCTIONS });++ server.registerTool(+ "search_components",+ {+ title: "Search remocn components",+ description:+ "Search remocn Remotion components by what they do. Returns name, docs .md URL, vibe, length (frames @30fps), use/avoid notes and install command.",+ inputSchema: z.object({+ query: z+ .string()+ .max(MAX_QUERY)+ .describe("What the component should do, e.g. 'typewriter headline'"),+ vibe: z.enum(VIBES).optional().describe("Tonal tag to match the brand"),+ maxLength: z+ .number()+ .int()+ .positive()+ .optional()+ .describe("Max motion length in frames @30fps"),+ limit: z.number().int().min(1).max(MAX_LIMIT).optional(),+ }),+ annotations: READ_ONLY,+ },+ async ({ query, vibe, maxLength, limit }) => {+ const results = searchComponents(getCatalog().records, {+ query,+ vibe,+ maxLength,+ limit,+ });+ const filters = [+ vibe && `vibe=${vibe}`,+ maxLength !== undefined && `maxLength=${maxLength}f`,+ ]+ .filter(Boolean)+ .join(", ");+ if (results.length === 0) {+ return text(+ `No components match "${query}"${filters ? ` (${filters})` : ""}. Try fewer words${filters ? " or drop the filters" : ""}. Vibes: ${VIBES.join(", ")}. Full index: ${SITE_URL}/llms-components.txt`,+ { results: [] },+ );+ }+ const header = `${results.length} remocn components for "${query}"${filters ? ` (${filters})` : ""}. Lengths are frames of motion @30fps — a floor for the Sequence, add hold on top.`;+ return text(`${header}\n\n${results.map(formatRow).join("\n")}`, {+ results: results.map(compactRow),+ });+ },+ );++ server.registerTool(+ "get_component",+ {+ title: "Get a remocn component's docs",+ description:+ "Full markdown docs for one remocn component: props, usage example, use/avoid notes and install command.",+ inputSchema: z.object({+ name: z+ .string()+ .max(MAX_NAME)+ .describe("Component name, e.g. 'kinetic-center-build'"),+ }),+ annotations: READ_ONLY,+ },+ async ({ name }) => {+ const record = resolveComponent(name);+ if (!record) return unknownComponent(name);+ const markdown = await getComponentMarkdown(record.name);+ if (!markdown) return unknownComponent(name);+ const deps = getCatalog().registry.get(record.name)?.deps ?? [];+ const depsLine = deps.length+ ? `\n\nRegistry dependencies (installed automatically): ${deps.map((d) => `\`${d}\``).join(", ")}`+ : "";+ return text(`${markdown}${depsLine}`);+ },+ );++ server.registerTool(+ "plan_video",+ {+ title: "Plan a remocn video",+ description:+ "Turn a video brief into a storyboard: picks an archetype, returns its recipe and a beat list with suggested remocn components per beat.",+ inputSchema: z.object({+ brief: z+ .string()+ .min(1)+ .max(MAX_BRIEF)+ .describe("What the video is about, e.g. 'launch video for our CLI'"),+ archetype: z+ .enum(ARCHETYPES)+ .optional()+ .describe("Force an archetype instead of picking by keywords"),+ durationSeconds: z+ .number()+ .positive()+ .max(600)+ .optional()+ .describe("Target length; picks the closest recipe variant"),+ }),+ annotations: READ_ONLY,+ _meta: { ui: { resourceUri: PREVIEW_RESOURCE_URI } },+ },+ async ({ brief, archetype, durationSeconds }) => {+ const pick = archetype+ ? { archetype, matched: [] as string[], fallback: false }+ : pickArchetype(brief);+ const chosen: Archetype = pick.archetype;+ const recipe = readArchetypeRecipe(chosen);+ if (!recipe) {+ return errorText(+ `The ${chosen} recipe is not available on this server. Use search_components and the index at ${SITE_URL}/llms-components.txt instead.`,+ );+ }++ const catalog = getCatalog();+ const plan = parseRecipe(+ recipe,+ catalog.registry.keys(),+ durationSeconds,+ );+ const beats = plan.beats.map((beat) => {+ const primary = beat.components.find((n) => previewManifest[n]);+ return {+ ...beat,+ preview: primary ? previewFor(primary) : null,+ options: beatOptions(beat),+ };+ });+ const picked = [+ ...new Set([+ ...beats.flatMap((b) => (b.preview ? [b.preview.name] : [])),+ ...plan.transitions.slice(0, 1),+ ]),+ ];+ const install = picked.length+ ? `npx shadcn@latest add ${picked.map((n) => `@remocn/${n}`).join(" ")}`+ : "";+ const prompts = {+ claudeCode: `/remocn:video ${brief}`,+ generic: `Build a ${chosen} video in this Remotion project with remocn components (${SITE_URL}/llms.txt): ${brief}`,+ };++ const why = archetype+ ? "requested"+ : pick.fallback+ ? "default — no archetype keywords matched; pass `archetype` to override"+ : `matched: ${pick.matched.join(", ")}`;+ const lines: string[] = [+ `# Video plan: ${chosen} (${why})`,+ "",+ `Brief: ${brief}`,+ `Recipe default duration: ${plan.meta.defaultduration ?? "see recipe"}${plan.variant ? ` · variant: ${plan.variant}` : ""}${plan.totalFrames ? ` · beats total ${plan.totalFrames}f` : ""}`,+ "",+ "## Beats",+ "The first component of each beat is the suggested pick; the rest are recipe alternatives.",+ "",+ ];+ beats.forEach((beat, i) => {+ lines.push(`${i + 1}. **${beat.name}**${formatFrames(beat)}`);+ if (beat.what) lines.push(` ${beat.what}`);+ if (beat.components.length)+ lines.push(+ ` Components: ${beat.components.map((c) => `\`${c}\``).join(", ")}`,+ );+ if (beat.buildNew.length)+ lines.push(+ ` Build new (not in catalog): ${beat.buildNew.map((c) => `\`${c}\``).join(", ")}`,+ );+ });+ if (plan.transitions.length)+ lines.push(+ "",+ `Transitions: ${plan.transitions.map((c) => `\`${c}\``).join(", ")}`,+ );+ if (plan.extras.length) {+ lines.push("", "Optional:");+ for (const extra of plan.extras) {+ const parts = [+ ...extra.components.map((c) => `\`${c}\``),+ ...extra.buildNew.map((c) => `build \`${c}\``),+ ];+ lines.push(+ `- ${extra.label}${parts.length ? `: ${parts.join(", ")}` : ""}`,+ );+ }+ }+ for (const note of plan.notes) lines.push("", `Note: ${note}`);+ if (install) lines.push("", "## Install", "", `\`${install}\``);+ lines.push(+ "",+ "## Next step",+ "",+ `Claude Code with the remocn plugin: \`${prompts.claudeCode}\``,+ `Other agents: ${prompts.generic}`,+ "Read each component's docs (get_component) before writing code against its props.",+ "",+ "---",+ "",+ `## Recipe: ${chosen} (authoritative — follow it over the summary above)`,+ "",+ recipe.trim(),+ );+ const anatomy = readAnatomy();+ const qualityBar = anatomy ? extractQualityBar(anatomy) : undefined;+ if (qualityBar)+ lines.push(+ "",+ "---",+ "",+ "## Quality bar (from anatomy.md)",+ "",+ qualityBar,+ );++ return text(lines.join("\n"), {+ kind: "plan",+ brief,+ archetype: chosen,+ archetypeReason: why,+ variant: plan.variant ?? null,+ defaultDuration: plan.meta.defaultduration ?? null,+ totalFrames: plan.totalFrames ?? null,+ beats,+ transitions: plan.transitions,+ extras: plan.extras,+ notes: plan.notes,+ install,+ prompts,+ });+ },+ );++ server.registerTool(+ "preview_component",+ {+ title: "Preview a remocn component",+ description:+ "Live in-chat preview of a remocn component with optional props. Also returns its docs URL and install command.",+ inputSchema: z.object({+ name: z+ .string()+ .max(MAX_NAME)+ .describe("Component name, e.g. 'kinetic-center-build'"),+ props: z+ .record(z.string(), z.unknown())+ .optional()+ .describe("Props merged over the component's demo defaults"),+ }),+ annotations: READ_ONLY,+ _meta: { ui: { resourceUri: PREVIEW_RESOURCE_URI } },+ },+ async ({ name, props }) => {+ const record = resolveComponent(name);+ if (!record) return unknownComponent(name);+ if (props && JSON.stringify(props).length > MAX_PROPS_JSON) {+ return errorText(+ `props is too large to preview (max ${MAX_PROPS_JSON} chars of JSON).`,+ );+ }+ const preview = previewFor(record.name, props);+ const docsPage = htmlDocsUrl(record);+ if (!preview) {+ return text(+ `\`${record.name}\` has no live preview. Docs: ${record.docs}\nInstall: \`${record.install}\``,+ );+ }+ return text(+ [+ `Live preview of \`${record.name}\` (${record.title}): ${preview.embedUrl}`,+ `${preview.durationInFrames}f @ ${preview.fps}fps, ${preview.width}×${preview.height}${props ? ", custom props applied over demo defaults" : ""}.`,+ `Docs: ${record.docs}`,+ `Install: \`${record.install}\``,+ ].join("\n"),+ {+ kind: "preview",+ ...preview,+ title: record.title,+ docs: record.docs,+ docsPage,+ install: record.install,+ props: props ?? null,+ },+ );+ },+ );++ server.registerResource(+ "remocn-preview",+ PREVIEW_RESOURCE_URI,+ {+ title: "remocn live preview",+ description: "Plays remocn components and video plans in the chat.",+ mimeType: MCP_APP_MIME_TYPE,+ _meta: previewResourceMeta(),+ },+ async (uri) => ({+ contents: [+ {+ uri: uri.href,+ mimeType: MCP_APP_MIME_TYPE,+ text: PREVIEW_WIDGET_HTML,+ _meta: previewResourceMeta(),+ },+ ],+ }),+ );++ return server;+}diff --git a/lib/mcp/widget.ts b/lib/mcp/widget.tsnew file mode 100644index 00000000..d5e502eb--- /dev/null+++ b/lib/mcp/widget.ts@@ -0,0 +1,217 @@+/**+ * The MCP App view behind `ui://remocn/preview`. One self-contained HTML+ * document, no bundle: it speaks the MCP Apps postMessage dialect directly+ * (JSON-RPC 2.0 over `window.parent.postMessage`) and iframes remocn.dev's+ * chrome-less `/embed/<name>` player pages instead of shipping Remotion.+ *+ * Method names follow `@modelcontextprotocol/[email protected]`+ * (`spec.types.d.ts`, spec 2026-01-26): `ui/initialize` →+ * `ui/notifications/initialized`, then `ui/notifications/tool-input` /+ * `ui/notifications/tool-result` from the host, `ui/open-link` and+ * `ui/notifications/size-changed` from the view.+ *+ * It renders `structuredContent` of either tool:+ * - `{ kind: "preview", … }` from `preview_component`+ * - `{ kind: "plan", … }` from `plan_video`+ */++const STYLE = `+:root { color-scheme: light dark; --bg: #ffffff; --fg: #111111; --muted: #6b6b6b; --border: #e5e5e5; --card: #fafafa; --accent: #2563eb; }+:root[data-theme="dark"] { --bg: #0b0b0b; --fg: #f2f2f2; --muted: #9a9a9a; --border: #262626; --card: #141414; --accent: #60a5fa; }+* { box-sizing: border-box; }+html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }+main { padding: 12px; display: flex; flex-direction: column; gap: 12px; }+h1 { font-size: 15px; margin: 0; font-weight: 600; }+h2 { font-size: 13px; margin: 0; font-weight: 600; }+p { margin: 0; }+.muted { color: var(--muted); font-size: 12px; }+.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }+.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }+.stage .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; padding: 12px; text-align: center; }+.beats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }+.beat { display: flex; flex-direction: column; gap: 6px; }+.chips { display: flex; flex-wrap: wrap; gap: 4px; }+.chip { border: 1px solid var(--border); background: transparent; color: var(--fg); border-radius: 999px; padding: 1px 8px; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; }+.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }+.chip.new { cursor: default; border-style: dashed; color: var(--muted); }+.copy { display: flex; gap: 6px; align-items: stretch; }+.copy code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; border: 1px solid var(--border); background: var(--card); border-radius: 8px; padding: 6px 8px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }+button.action { border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 12px; cursor: pointer; }+a { color: var(--accent); }+`;++const SCRIPT = `+(function () {+ var nextId = 1;+ var pending = {};+ var root = document.getElementById("root");++ function send(msg) { window.parent.postMessage(msg, "*"); }+ function request(method, params) {+ var id = nextId++;+ send({ jsonrpc: "2.0", id: id, method: method, params: params || {} });+ return new Promise(function (resolve, reject) { pending[id] = { resolve: resolve, reject: reject }; });+ }+ function notify(method, params) { send({ jsonrpc: "2.0", method: method, params: params || {} }); }++ function el(tag, attrs, children) {+ var node = document.createElement(tag);+ if (attrs) for (var k in attrs) {+ if (k === "text") node.textContent = attrs[k];+ else if (k.indexOf("on") === 0) node.addEventListener(k.slice(2), attrs[k]);+ else node.setAttribute(k, attrs[k]);+ }+ (children || []).forEach(function (c) { if (c) node.appendChild(c); });+ return node;+ }++ function openLink(url) {+ request("ui/open-link", { url: url }).catch(function () { window.open(url, "_blank", "noopener"); });+ }+ function link(text, url) {+ return el("a", { href: url, text: text, onclick: function (e) { e.preventDefault(); openLink(url); } });+ }++ function copyText(text, button) {+ function done(ok) {+ var label = button.textContent;+ button.textContent = ok ? "Copied" : "Select + copy";+ setTimeout(function () { button.textContent = label; }, 1500);+ }+ function fallback() {+ var ta = document.createElement("textarea");+ ta.value = text; ta.style.position = "fixed"; ta.style.opacity = "0";+ document.body.appendChild(ta); ta.select();+ var ok = false; try { ok = document.execCommand("copy"); } catch (e) {}+ document.body.removeChild(ta); done(ok);+ }+ if (navigator.clipboard && navigator.clipboard.writeText) {+ navigator.clipboard.writeText(text).then(function () { done(true); }, fallback);+ } else fallback();+ }+ function copyRow(label, text) {+ var button = el("button", { class: "action", type: "button", text: "Copy" });+ button.addEventListener("click", function () { copyText(text, button); });+ return el("div", {}, [+ el("p", { class: "muted", text: label }),+ el("div", { class: "copy" }, [el("code", { text: text }), button]),+ ]);+ }++ function stage(src, title) {+ var box = el("div", { class: "stage" });+ if (src) {+ box.appendChild(el("iframe", { src: src, title: title, loading: "lazy", allow: "autoplay; fullscreen" }));+ } else {+ box.appendChild(el("div", { class: "empty", text: "No live preview for this beat. The recipe asks for a new component here." }));+ }+ return box;+ }++ function renderPreview(data) {+ root.replaceChildren(+ el("h1", { text: data.title + " (" + data.name + ")" }),+ stage(data.embedUrl, data.title),+ el("p", { class: "muted" }, [link("Docs", data.docsPage), document.createTextNode(" · " + data.durationInFrames + "f @ " + data.fps + "fps")]),+ copyRow("Install", data.install)+ );+ }++ function renderBeat(beat) {+ var frames = beat.startFrame != null && beat.endFrame != null ? " · " + beat.startFrame + "–" + beat.endFrame + "f" : "";+ var current = beat.preview;+ var box = stage(current && current.embedUrl, beat.name);+ var chips = el("div", { class: "chips" });+ (beat.options || []).forEach(function (opt) {+ var chip = el("button", { class: "chip", type: "button", text: opt.name, "aria-pressed": String(!!current && opt.name === current.name) });+ if (opt.embedUrl) {+ chip.addEventListener("click", function () {+ box.replaceChildren(el("iframe", { src: opt.embedUrl, title: opt.name, allow: "autoplay; fullscreen" }));+ chips.querySelectorAll(".chip").forEach(function (c) { c.setAttribute("aria-pressed", String(c === chip)); });+ });+ } else chip.disabled = true;+ chips.appendChild(chip);+ });+ (beat.buildNew || []).forEach(function (name) {+ chips.appendChild(el("span", { class: "chip new", text: "build: " + name }));+ });+ return el("section", { class: "beat" }, [+ el("h2", { text: beat.name + frames }),+ beat.what ? el("p", { class: "muted", text: beat.what.replace(/\\*\\*|\`/g, "") }) : null,+ box,+ chips,+ ]);+ }++ function renderPlan(data) {+ root.replaceChildren(+ el("h1", { text: "Video plan: " + data.archetype + (data.variant ? " · " + data.variant : "") }),+ el("p", { class: "muted", text: data.brief }),+ el("div", { class: "beats" }, data.beats.map(renderBeat)),+ data.install ? copyRow("Install the picked components", data.install) : null,+ copyRow("Claude Code", data.prompts.claudeCode),+ copyRow("Codex / any agent", data.prompts.generic)+ );+ }++ function render(result) {+ var data = result && result.structuredContent;+ if (!data) {+ var text = (result && result.content || []).filter(function (c) { return c.type === "text"; }).map(function (c) { return c.text; }).join("\\n\\n");+ root.replaceChildren(el("pre", { text: text || "No result." }));+ return;+ }+ if (data.kind === "preview") renderPreview(data);+ else if (data.kind === "plan") renderPlan(data);+ }++ function applyContext(ctx) {+ if (ctx && (ctx.theme === "dark" || ctx.theme === "light")) {+ document.documentElement.setAttribute("data-theme", ctx.theme);+ }+ }++ window.addEventListener("message", function (event) {+ if (event.source !== window.parent) return;+ var msg = event.data;+ if (!msg || msg.jsonrpc !== "2.0") return;+ if (msg.id != null && !msg.method) {+ var p = pending[msg.id]; delete pending[msg.id];+ if (p) msg.error ? p.reject(msg.error) : p.resolve(msg.result);+ return;+ }+ if (msg.method === "ui/notifications/tool-result") render(msg.params);+ else if (msg.method === "ui/notifications/tool-input") root.replaceChildren(el("p", { class: "muted", text: "Working…" }));+ else if (msg.method === "ui/notifications/host-context-changed") applyContext(msg.params);+ else if (msg.id != null) send({ jsonrpc: "2.0", id: msg.id, result: {} });+ });++ new ResizeObserver(function () {+ notify("ui/notifications/size-changed", { height: Math.ceil(document.documentElement.scrollHeight) });+ }).observe(document.body);++ request("ui/initialize", {+ appInfo: { name: "remocn-preview", version: "1.0.0" },+ appCapabilities: {},+ protocolVersion: "2026-01-26",+ }).then(function (res) {+ applyContext(res && res.hostContext);+ notify("ui/notifications/initialized", {});+ }, function () {});+})();+`;++export const PREVIEW_WIDGET_HTML = `<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8" />+<meta name="viewport" content="width=device-width, initial-scale=1" />+<title>remocn preview</title>+<style>${STYLE}</style>+</head>+<body>+<main id="root"><p class="muted">Waiting for the tool result…</p></main>+<script>${SCRIPT}</script>+</body>+</html>+`;diff --git a/lib/plugin-scripts.test.ts b/lib/plugin-scripts.test.tsnew file mode 100644index 00000000..ba73899a--- /dev/null+++ b/lib/plugin-scripts.test.ts@@ -0,0 +1,353 @@+import { afterEach, describe, expect, it } from "bun:test";+import {+ existsSync,+ mkdirSync,+ mkdtempSync,+ readFileSync,+ rmSync,+ writeFileSync,+} from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";++// The plugin ships two Node scripts that edit a user's Remotion project. They+// run on machines we never see, so their edits are pinned here.++const SKILLS = join(import.meta.dir, "..", "plugins", "remocn", "skills");+const STUDIO = join(SKILLS, "studio", "scripts", "studio.mjs");+const SETUP = join(SKILLS, "video", "scripts", "setup.mjs");+const REGISTRY = join(SKILLS, "studio", "assets", "registry.tsx");++const ENTRY = `import { registerRoot } from "remotion";+import { RemotionRoot } from "./Root";++registerRoot(RemotionRoot);+`;++const dirs: string[] = [];++afterEach(() => {+ for (const dir of dirs.splice(0))+ rmSync(dir, { force: true, recursive: true });+});++function project(files: Record<string, string>): string {+ const dir = mkdtempSync(join(tmpdir(), "remocn-plugin-"));+ dirs.push(dir);+ for (const [file, content] of Object.entries(files)) {+ mkdirSync(join(dir, file, ".."), { recursive: true });+ writeFileSync(join(dir, file), content);+ }+ return dir;+}++function run(script: string, args: string[]) {+ const result = Bun.spawnSync(["node", script, ...args]);+ return {+ exitCode: result.exitCode,+ json: JSON.parse(result.stdout.toString()),+ };+}++const remotionPackage = JSON.stringify({+ name: "launch-video",+ dependencies: { remotion: "4.0.534" },+});++describe("studio.mjs init", () => {+ it("writes the manifest, places the scan and wraps the entry point", () => {+ const dir = project({+ "package.json": remotionPackage,+ "src/index.ts": ENTRY,+ });++ const { json } = run(STUDIO, ["init", dir, "--name", "Launch video"]);++ expect(json.ok).toBe(true);+ const manifest = JSON.parse(+ readFileSync(join(dir, ".remocn/project.json"), "utf8"),+ );+ expect(manifest).toEqual({+ schemaVersion: 1,+ projectId: expect.any(String),+ name: "Launch video",+ revision: 0,+ brand: null,+ });+ expect(readFileSync(join(dir, "src/videos/registry.tsx"), "utf8")).toBe(+ readFileSync(REGISTRY, "utf8"),+ );+ expect(readFileSync(join(dir, "src/index.ts"), "utf8")).toBe(+ `import { registerRoot } from "remotion";+import { RemotionRoot } from "./Root";+import { withVideos } from "./videos/registry";++registerRoot(withVideos(RemotionRoot));+`,+ );+ });++ it("is idempotent and never replaces a project's identity", () => {+ const dir = project({+ "package.json": remotionPackage,+ "src/index.ts": ENTRY,+ });+ const first = run(STUDIO, ["init", dir]).json;+ const entry = readFileSync(join(dir, "src/index.ts"), "utf8");++ const second = run(STUDIO, ["init", dir]).json;++ expect(second.manifest.written).toBe(false);+ expect(second.manifest.projectId).toBe(first.manifest.projectId);+ expect(second.registry.wrapped).toBe(false);+ expect(readFileSync(join(dir, "src/index.ts"), "utf8")).toBe(entry);+ });++ it("names the project after package.json when no name is given", () => {+ const dir = project({+ "package.json": remotionPackage,+ "src/index.ts": ENTRY,+ });+ run(STUDIO, ["init", dir]);+ const manifest = JSON.parse(+ readFileSync(join(dir, ".remocn/project.json"), "utf8"),+ );+ expect(manifest.name).toBe("launch-video");+ });++ it("refuses an entry point it cannot read instead of guessing", () => {+ const source = `import { registerRoot } from "remotion";\nregisterRoot(() => null);\n`;+ const dir = project({+ "package.json": remotionPackage,+ "src/index.ts": source,+ });++ const { json } = run(STUDIO, ["init", dir]);++ expect(json.ok).toBe(false);+ expect(json.registry.reason).toContain("registerRoot(Root)");+ expect(readFileSync(join(dir, "src/index.ts"), "utf8")).toBe(source);+ });++ it("ignores registerRoot in comments and keeps multi-line imports whole", () => {+ const source = `// Previously: registerRoot(OldRoot);+import { registerRoot } from "remotion";+import {+ RemotionRoot,+} from "./Root";++/* registerRoot(Draft) */+registerRoot(RemotionRoot);+`;+ const dir = project({+ "package.json": remotionPackage,+ "src/index.ts": source,+ });++ const { json } = run(STUDIO, ["init", dir]);++ expect(json.ok).toBe(true);+ expect(readFileSync(join(dir, "src/index.ts"), "utf8")).toBe(+ `// Previously: registerRoot(OldRoot);+import { registerRoot } from "remotion";+import {+ RemotionRoot,+} from "./Root";+import { withVideos } from "./videos/registry";++/* registerRoot(Draft) */+registerRoot(withVideos(RemotionRoot));+`,+ );+ });++ it("points the import at src/videos from an entry outside src", () => {+ const dir = project({+ "package.json": remotionPackage,+ "remotion/index.ts": ENTRY,+ });+ run(STUDIO, ["init", dir]);+ expect(readFileSync(join(dir, "remotion/index.ts"), "utf8")).toContain(+ 'import { withVideos } from "../src/videos/registry";',+ );+ });++ it("refuses a folder that is not a project", () => {+ const dir = project({});+ expect(run(STUDIO, ["init", dir]).json.ok).toBe(false);+ expect(existsSync(join(dir, ".remocn"))).toBe(false);+ });+});++describe("studio.mjs open", () => {+ it("asks for init before handing over a folder without a manifest", () => {+ const dir = project({ "package.json": remotionPackage });+ const { json } = run(STUDIO, ["open", dir]);+ expect(json.ok).toBe(false);+ expect(json.reason).toContain("init");+ });+});++describe("setup.mjs", () => {+ const tsconfig = `{+ // Remotion's default+ "compilerOptions": {+ "target": "ES2018",+ "jsx": "react-jsx", /* keep */+ "strict": true,+ },+ "include": ["src"],+ "$schema": "https://json.schemastore.org/tsconfig"+}+`;+ const config = `import { Config } from "@remotion/cli/config";++Config.setVideoImageFormat("jpeg");+`;++ it("makes a fresh Remotion project ready for shadcn add", () => {+ const dir = project({+ "package.json": remotionPackage,+ "tsconfig.json": tsconfig,+ "remotion.config.ts": config,+ });++ const { json } = run(SETUP, [dir]);++ expect(json.ok).toBe(true);+ const components = JSON.parse(+ readFileSync(join(dir, "components.json"), "utf8"),+ );+ expect(components.registries["@remocn"]).toBe(+ "https://remocn.dev/r/{name}.json",+ );+ expect(components.aliases.components).toBe("@/components");++ const ts = JSON.parse(readFileSync(join(dir, "tsconfig.json"), "utf8"));+ expect(ts.compilerOptions.paths).toEqual({ "@/*": ["./src/*"] });+ expect(ts.compilerOptions.strict).toBe(true);+ expect(ts.$schema).toBe("https://json.schemastore.org/tsconfig");++ const remotion = readFileSync(join(dir, "remotion.config.ts"), "utf8");+ expect(remotion.startsWith('import path from "node:path";\n')).toBe(true);+ expect(remotion).toContain('Config.setVideoImageFormat("jpeg");');+ expect(remotion).toContain('"@": path.join(process.cwd(), "src")');+ expect(remotion).toContain(+ 'if (typeof Config.overrideBundlerConfig === "function") {',+ );+ expect(remotion).toContain(+ "Config.overrideWebpackConfig(withRemocnAlias);",+ );+ });++ it("leaves a configured project alone", () => {+ const dir = project({+ "package.json": remotionPackage,+ "tsconfig.json": tsconfig,+ "remotion.config.ts": config,+ });+ run(SETUP, [dir]);+ const before = readFileSync(join(dir, "remotion.config.ts"), "utf8");++ const { json } = run(SETUP, [dir]);++ expect(json.components.action).toBe("unchanged");+ expect(json.tsconfig.action).toBe("unchanged");+ expect(json.bundler.action).toBe("unchanged");+ expect(readFileSync(join(dir, "remotion.config.ts"), "utf8")).toBe(before);+ });++ it("follows an existing @/ path instead of adding src", () => {+ const dir = project({+ "package.json": remotionPackage,+ "tsconfig.json": JSON.stringify({+ compilerOptions: { paths: { "@/*": ["./*"] } },+ }),+ "remotion.config.ts": config,+ });++ run(SETUP, [dir]);++ const remotion = readFileSync(join(dir, "remotion.config.ts"), "utf8");+ expect(remotion).toContain('"@": process.cwd()');+ });++ it("resolves an existing @/ path against baseUrl", () => {+ const dir = project({+ "package.json": remotionPackage,+ "tsconfig.json": JSON.stringify({+ compilerOptions: { baseUrl: "./src", paths: { "@/*": ["*"] } },+ }),+ "remotion.config.ts": config,+ });+ run(SETUP, [dir]);+ expect(readFileSync(join(dir, "remotion.config.ts"), "utf8")).toContain(+ '"@": path.join(process.cwd(), "src")',+ );+ });++ it("writes the new path relative to baseUrl", () => {+ const dir = project({+ "package.json": remotionPackage,+ "tsconfig.json": JSON.stringify({ compilerOptions: { baseUrl: "src" } }),+ "remotion.config.ts": config,+ });+ run(SETUP, [dir]);+ const ts = JSON.parse(readFileSync(join(dir, "tsconfig.json"), "utf8"));+ expect(ts.compilerOptions.paths).toEqual({ "@/*": ["./*"] });+ });++ it("does not shadow paths inherited through extends", () => {+ const dir = project({+ "package.json": remotionPackage,+ "tsconfig.base.json": JSON.stringify({+ compilerOptions: { paths: { "~lib/*": ["./lib/*"] } },+ }),+ "tsconfig.json": JSON.stringify({ extends: "./tsconfig.base.json" }),+ "remotion.config.ts": config,+ });+ const before = readFileSync(join(dir, "tsconfig.json"), "utf8");++ const { json } = run(SETUP, [dir]);++ expect(json.tsconfig.action).toBe("skipped");+ expect(json.tsconfig.warning).toContain("extends");+ expect(readFileSync(join(dir, "tsconfig.json"), "utf8")).toBe(before);+ });++ it("uses an @/ path inherited through extends", () => {+ const dir = project({+ "package.json": remotionPackage,+ "config/tsconfig.base.json": JSON.stringify({+ compilerOptions: { paths: { "@/*": ["../app/*"] } },+ }),+ "tsconfig.json": JSON.stringify({ extends: "./config/tsconfig.base" }),+ "remotion.config.ts": config,+ });+ const { json } = run(SETUP, [dir]);+ expect(json.tsconfig.base).toBe("app");+ });++ it("adds the registry to an existing components.json", () => {+ const dir = project({+ "package.json": remotionPackage,+ "components.json": JSON.stringify({ aliases: { components: "@/ui" } }),+ });++ run(SETUP, [dir]);++ const components = JSON.parse(+ readFileSync(join(dir, "components.json"), "utf8"),+ );+ expect(components.aliases.components).toBe("@/ui");+ expect(components.registries["@remocn"]).toBeDefined();+ });++ it("refuses a project without Remotion", () => {+ const dir = project({ "package.json": JSON.stringify({ name: "web" }) });+ const { exitCode, json } = run(SETUP, [dir]);+ expect(exitCode).toBe(1);+ expect(json.reason).toContain("create-video");+ expect(existsSync(join(dir, "components.json"))).toBe(false);+ });+});diff --git a/next.config.ts b/next.config.tsindex 8e15baab..56932fbb 100644--- a/next.config.ts+++ b/next.config.ts@@ -26,6 +26,12 @@ const nextConfig: NextConfig = {"esbuild","@takumi-rs/core",],+ // The /mcp route reads the remocn skill's archetype recipes from disk at+ // runtime (lib/mcp/archetype-files.ts). Docker copies the whole tree, but+ // trace them explicitly so standalone/traced output keeps them too.+ outputFileTracingIncludes: {+ "/mcp": ["./plugins/remocn/skills/remocn/references/**/*.md"],+ },turbopack: {root: __dirname,},diff --git a/package.json b/package.jsonindex 0900f96f..000104b7 100644--- a/package.json+++ b/package.json@@ -50,6 +50,7 @@"@fontsource/roboto-mono": "^5.3.0","@hugeicons/core-free-icons": "^4.3.0","@hugeicons/react": "^1.1.10",+ "@modelcontextprotocol/server": "^2.3.1","@openpanel/nextjs": "^1.0.13","@openpanel/sdk": "^1.3.1","@paper-design/shaders-react": "0.0.76",diff --git a/plugins/remocn/.claude-plugin/plugin.json b/plugins/remocn/.claude-plugin/plugin.jsonnew file mode 100644index 00000000..14e580a2--- /dev/null+++ b/plugins/remocn/.claude-plugin/plugin.json@@ -0,0 +1,20 @@+{+ "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",+ "name": "remocn",+ "displayName": "remocn",+ "version": "0.1.0",+ "description": "Make Remotion videos from remocn components: brief to storyboard to a rendering project, with visual QA and a hand-off to Remocn Studio.",+ "author": {+ "name": "Remocn",+ "url": "https://remocn.dev"+ },+ "homepage": "https://remocn.dev/docs/getting-started/plugin",+ "repository": "https://github.com/Remocn/remocn",+ "license": "MIT",+ "keywords": ["remotion", "video", "shadcn", "motion", "animation"],+ "icon": "./assets/icon.png",+ "documentationUrl": "https://remocn.dev/docs/getting-started/plugin",+ "supportUrl": "https://github.com/Remocn/remocn/issues",+ "privacyPolicyUrl": "https://remocn.dev/legal#privacy",+ "termsOfServiceUrl": "https://remocn.dev/legal#terms"+}diff --git a/plugins/remocn/.mcp.json b/plugins/remocn/.mcp.jsonnew file mode 100644index 00000000..101fd1cd--- /dev/null+++ b/plugins/remocn/.mcp.json@@ -0,0 +1,8 @@+{+ "mcpServers": {+ "remocn": {+ "type": "http",+ "url": "https://remocn.dev/mcp"+ }+ }+}diff --git a/plugins/remocn/agents/scene-reviewer.md b/plugins/remocn/agents/scene-reviewer.mdnew file mode 100644index 00000000..5c1c16e7--- /dev/null+++ b/plugins/remocn/agents/scene-reviewer.md@@ -0,0 +1,59 @@+---+name: scene-reviewer+description: Visual QA for a Remotion video. Renders stills at key frames of every beat, looks at them, and reports concrete fixes for clipped or overflowing elements, unreadable text, empty frames, layout jumps and low contrast. Use after a remocn video composes and typechecks, before handing it to the user.+tools: Read, Glob, Grep, Bash+model: sonnet+---++You check how a Remotion video actually looks. The agent that wrote it never saw a frame, so you+are its eyes. You don't edit the video: you return fixes for the caller to apply.++## Inputs++The project root, the composition id (the video's slug), and its storyboard in the format of+`${CLAUDE_PLUGIN_ROOT}/skills/video/references/storyboard.md`. If no storyboard is given, read the+composition's source (`src/videos/<slug>/index.tsx`) and work out the beat boundaries from its+`Sequence` and `TransitionSeries.Sequence` durations.++## Render the stills++If the caller hands you stills that are already rendered, review those and skip to **What to check**.++1. Compute each beat's start frame. In a `TransitionSeries` each transition overlaps the next+ sequence, so start(n+1) = start(n) + sequence(n) − transition(n).+2. For each beat take three frames: **entry** (start + 2), **settled** (start + own length) and+ **end of hold** (start + sequence − 2). Clamp to the composition's duration.+3. Render them in one go. Make sure `out/review/<slug>/` exists first:++ ```bash+ npx remotion still <slug> out/review/<slug>/<beat>-<frame>.png --frame=<frame>+ ```++ If rendering fails, report the error as the first finding and stop.+4. Open every image with Read and look at it.++## What to check++- **Clipping and overflow:** text or elements cut by the frame edge or by a container, where the+ storyboard didn't ask for it.+- **Legibility:** text too small at 1280×720 (under about 28px for body copy), too long for its+ hold, or with too little contrast against what is behind it.+- **Empty or broken frames:** a settled frame that is blank, a single flat color where content was+ planned, missing images, fallback fonts.+- **Jumps between beats:** the end of one beat and the entry of the next disagreeing in position,+ scale or color in a way the transition doesn't explain.+- **The quality bar:** more than one accent color, decorative ALL-CAPS or letter-spacing, gradient+ text fills, glow halos on your own additions (not on components whose effect that is), lorem or+ "Scene A" placeholder copy.++## Report++One block per finding, worst first:++```+[beat #, frame] <what is wrong, as seen in the image>+fix: <file and the concrete change: prop, value, duration or layout>+```++End with `PASS` if nothing needs fixing, or `FIXES: <count>`. Don't report taste preferences as+fixes. Every finding must point to something visible in a still you rendered.diff --git a/plugins/remocn/agents/video-director.md b/plugins/remocn/agents/video-director.mdnew file mode 100644index 00000000..d4693dfe--- /dev/null+++ b/plugins/remocn/agents/video-director.md@@ -0,0 +1,42 @@+---+name: video-director+description: Plans a remocn video. Turns a brief, its content and an archetype into a storyboard of beats, one remocn component per beat, transitions and a frame budget that hits the target length. Use before composing any multi-beat video with remocn components.+tools: Read, Glob, Grep, WebFetch, Bash+model: sonnet+---++You are the director of a short video built from remocn components for Remotion. You plan; you don't+write code. Your output is one storyboard in the format of+`${CLAUDE_PLUGIN_ROOT}/skills/video/references/storyboard.md`. Read that file first and follow it+exactly. The `video` skill and the `scene-reviewer` agent parse it.++## Inputs++The brief, the gathered content (product name, lines, features, numbers), the archetype, the target+length and the brand (accent, vibe) if known. If the archetype is missing, choose it from+`${CLAUDE_PLUGIN_ROOT}/skills/remocn/references/archetypes/index.md`.++## How to plan++1. Read `${CLAUDE_PLUGIN_ROOT}/skills/remocn/references/anatomy.md` and the archetype's recipe in+ `${CLAUDE_PLUGIN_ROOT}/skills/remocn/references/archetypes/`. The recipe's beats and its+ beat-to-slot table are your starting point. Its duration variant sets the target when the brief+ gives none.+2. Fetch `https://remocn.dev/llms-components.txt` (WebFetch, or `curl -s` with Bash). For each beat,+ shortlist from the recipe's slot candidates and the index. Prefer the vibe that fits the brand,+ and keep one vibe across the video.+3. Fetch the `.md` page of every component you keep. Take `Length` from the index row and check+ the props can carry the content. Read every `Avoid for` note: if one matches the beat, take the+ replacement it names in backticks.+4. Budget the frames by the storyboard rules: own length + hold = sequence, transitions overlap, and+ the planned total within ±10% of the target. Trim holds before dropping beats.+5. If no catalog component fits a beat or a piece of one, name it under **Build new**, with one line+ on what to build. Don't force a mismatched component into the slot.++## Rules++- Never list a component whose page you haven't read in this session. Never invent props or lengths.+- If remocn.dev can't be reached, return that fact instead of a storyboard.+- Real content in the Content column. Where the user hasn't supplied it, use an honest placeholder+ in angle brackets and list it under **Content still missing**.+- Reply with the storyboard only, no preamble.diff --git a/plugins/remocn/assets/icon.png b/plugins/remocn/assets/icon.pngnew file mode 100644index 00000000..f4a71eb8Binary files /dev/null and b/plugins/remocn/assets/icon.png differdiff --git a/plugins/remocn/evals/README.md b/plugins/remocn/evals/README.mdnew file mode 100644index 00000000..5872631e--- /dev/null+++ b/plugins/remocn/evals/README.md@@ -0,0 +1,28 @@+# remocn plugin evals++Run from the repo root with `claude plugin eval` (Claude Code 2.1.269+). Every case runs in an empty+workspace, so cases carry their brief in the prompt and their fixtures in `resources/`.++| Tag | Cases | What it checks |+|---|---|---|+| `storyboard` | `storyboard-<archetype>`, one per archetype | The plugin's skill fires on a natural brief, a storyboard comes back in the shared table format, the archetype is right, the planned frames land within ±10% of the brief, and nothing is built before the user confirms |+| `trigger` | `remotion-api-question` | A plain Remotion API question does not load any remocn skill (coexistence with the Remotion skills) |+| `review` | `scene-review-fixtures` | The `scene-reviewer` agent catches a clipped headline and an empty frame in two prepared stills. Its scaffold copies them into the workspace, so it needs `--scaffold` |++```bash+# Everything, as CI runs it (.github/workflows/plugin.yml)+claude plugin eval plugins/remocn --trust-plugin --scaffold --runs 1 --ablation none \+ --model sonnet --allow-tools "WebFetch(domain:remocn.dev)"++# The full comparison against no plugin, three runs per case: about $25+claude plugin eval plugins/remocn --scaffold --allow-tools "WebFetch(domain:remocn.dev)"++# One case, one run, no baseline: quick while editing a skill+claude plugin eval plugins/remocn --case storyboard-changelog --runs 1 --ablation none \+ --allow-tools "WebFetch(domain:remocn.dev)"+```++Storyboard cases read the live catalog at remocn.dev, so a component renamed in the registry shows+up here as a failing case. Typechecking and rendering a full project is out of scope for these+cases: a run can't install npm packages inside the eval sandbox in reasonable time. That path is+covered by building a video with `/remocn:video` by hand before a release.diff --git a/plugins/remocn/evals/remotion-api-question/graders/answer.md b/plugins/remocn/evals/remotion-api-question/graders/answer.mdnew file mode 100644index 00000000..eddfe74b--- /dev/null+++ b/plugins/remocn/evals/remotion-api-question/graders/answer.md@@ -0,0 +1,5 @@+---+type: llm+---+PASS if the reply explains that interpolate() maps an input value (usually the frame) from an input range to an output range, and that extrapolateRight: "clamp" holds the last output value instead of continuing the line past the input range.+FAIL if either point is missing or wrong, or if the reply steers the user to install remocn components.diff --git a/plugins/remocn/evals/remotion-api-question/graders/remocn-not-invoked.md b/plugins/remocn/evals/remotion-api-question/graders/remocn-not-invoked.mdnew file mode 100644index 00000000..7fc31869--- /dev/null+++ b/plugins/remocn/evals/remotion-api-question/graders/remocn-not-invoked.md@@ -0,0 +1,8 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:remocn|video|add|changelog|studio)"'+min: 0+max: 0+arm: both+---diff --git a/plugins/remocn/evals/remotion-api-question/prompt.md b/plugins/remocn/evals/remotion-api-question/prompt.mdnew file mode 100644index 00000000..e3efe009--- /dev/null+++ b/plugins/remocn/evals/remotion-api-question/prompt.md@@ -0,0 +1,6 @@+---+max_turns: 8+tags: [trigger]+allowed_tools: [Read, Glob, Grep, Skill]+---+How does interpolate() work in Remotion, and what does extrapolateRight: "clamp" change?diff --git a/plugins/remocn/evals/scene-review-fixtures/case.yaml b/plugins/remocn/evals/scene-review-fixtures/case.yamlnew file mode 100644index 00000000..1f1d59a9--- /dev/null+++ b/plugins/remocn/evals/scene-review-fixtures/case.yaml@@ -0,0 +1,5 @@+schema_version: "1.1"+name: scene-review-fixtures+tags: [review]+context:+ scaffold_script: scaffold.shdiff --git a/plugins/remocn/evals/scene-review-fixtures/graders/findings.md b/plugins/remocn/evals/scene-review-fixtures/graders/findings.mdnew file mode 100644index 00000000..02900dae--- /dev/null+++ b/plugins/remocn/evals/scene-review-fixtures/graders/findings.md@@ -0,0 +1,6 @@+---+type: llm+weight: 2+---+PASS if the final reply reports both problems: (1) in beat 1 the headline "Your team has tasks everywhere" runs off the right edge of the frame and is cut off, with a concrete fix such as a smaller font size, wrapping or a narrower layout; and (2) in beat 2 the frame is empty, with no checklist or features content where the storyboard planned it.+FAIL if either problem is missing, or if the reply says the stills look fine.diff --git a/plugins/remocn/evals/scene-review-fixtures/graders/reviewer-dispatched.md b/plugins/remocn/evals/scene-review-fixtures/graders/reviewer-dispatched.mdnew file mode 100644index 00000000..9a78ce78--- /dev/null+++ b/plugins/remocn/evals/scene-review-fixtures/graders/reviewer-dispatched.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Agent+input_match: 'scene-reviewer'+---diff --git a/plugins/remocn/evals/scene-review-fixtures/prompt.md b/plugins/remocn/evals/scene-review-fixtures/prompt.mdnew file mode 100644index 00000000..0a699535--- /dev/null+++ b/plugins/remocn/evals/scene-review-fixtures/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 20+timeout_seconds: 600+tags: [review]+allowed_tools: [Read, Glob, Grep, Agent]+---+The tasklane-teaser video is built. I already rendered two review stills and saved them with the storyboard in the review folder: beat1-hook-frame58.png and beat2-features-frame90.png, plus storyboard.md. Don't render anything new. Have the remocn scene reviewer check those stills against the storyboard and tell me what needs fixing.diff --git a/plugins/remocn/evals/scene-review-fixtures/resources/beat1-hook-frame58.png b/plugins/remocn/evals/scene-review-fixtures/resources/beat1-hook-frame58.pngnew file mode 100644index 00000000..0bfc2c5fBinary files /dev/null and b/plugins/remocn/evals/scene-review-fixtures/resources/beat1-hook-frame58.png differdiff --git a/plugins/remocn/evals/scene-review-fixtures/resources/beat2-features-frame90.png b/plugins/remocn/evals/scene-review-fixtures/resources/beat2-features-frame90.pngnew file mode 100644index 00000000..ec2be0c1Binary files /dev/null and b/plugins/remocn/evals/scene-review-fixtures/resources/beat2-features-frame90.png differdiff --git a/plugins/remocn/evals/scene-review-fixtures/resources/storyboard.md b/plugins/remocn/evals/scene-review-fixtures/resources/storyboard.mdnew file mode 100644index 00000000..a2693006--- /dev/null+++ b/plugins/remocn/evals/scene-review-fixtures/resources/storyboard.md@@ -0,0 +1,12 @@+# Storyboard: Tasklane teaser++- **Archetype:** product-demo+- **Slug:** tasklane-teaser+- **Canvas:** 1280×720 @ 30fps+- **Target:** 4s · **Planned:** 120f = 4s+- **Vibe:** clean · **Accent:** #4F46E5++| # | Beat | Component | Content | Own length | Hold | Sequence | Transition out |+|---|---|---|---|---|---|---|---|+| 1 | Hook | `kinetic-center-build` | "Your team has tasks everywhere" | 30f | 30f | 60f | cut |+| 2 | Features | `check-list` | "Slack, email and GitHub in one list" | 30f | 30f | 60f | — |diff --git a/plugins/remocn/evals/scene-review-fixtures/scaffold.sh b/plugins/remocn/evals/scene-review-fixtures/scaffold.shnew file mode 100755index 00000000..4de00e12--- /dev/null+++ b/plugins/remocn/evals/scene-review-fixtures/scaffold.sh@@ -0,0 +1,6 @@+#!/usr/bin/env bash+# Puts the prepared stills and storyboard into the run's workspace.+set -euo pipefail+here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+mkdir -p review+cp "$here"/resources/* review/diff --git a/plugins/remocn/evals/storyboard-changelog/graders/skill-fired.md b/plugins/remocn/evals/storyboard-changelog/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-changelog/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-changelog/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-changelog/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-changelog/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-changelog/graders/storyboard.md b/plugins/remocn/evals/storyboard-changelog/graders/storyboard.mdnew file mode 100644index 00000000..2367d36d--- /dev/null+++ b/plugins/remocn/evals/storyboard-changelog/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `changelog` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 243 and 297 frames at 30fps (the brief asks for about 9 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-changelog/prompt.md b/plugins/remocn/evals/storyboard-changelog/prompt.mdnew file mode 100644index 00000000..d5d2d14a--- /dev/null+++ b/plugins/remocn/evals/storyboard-changelog/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, changelog]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+We just shipped Tasklane 2.4. Make a short release video: export to vertical video, search is three times faster, dark mode no longer flickers on startup.diff --git a/plugins/remocn/evals/storyboard-cli-tool-demo/graders/skill-fired.md b/plugins/remocn/evals/storyboard-cli-tool-demo/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-cli-tool-demo/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-cli-tool-demo/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-cli-tool-demo/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-cli-tool-demo/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-cli-tool-demo/graders/storyboard.md b/plugins/remocn/evals/storyboard-cli-tool-demo/graders/storyboard.mdnew file mode 100644index 00000000..13016b1d--- /dev/null+++ b/plugins/remocn/evals/storyboard-cli-tool-demo/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `cli-tool-demo` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 675 and 825 frames at 30fps (the brief asks for about 25 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-cli-tool-demo/prompt.md b/plugins/remocn/evals/storyboard-cli-tool-demo/prompt.mdnew file mode 100644index 00000000..2fea1f99--- /dev/null+++ b/plugins/remocn/evals/storyboard-cli-tool-demo/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, cli-tool-demo]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 25-second demo video of our CLI, shipit. You run `shipit deploy`, it builds, uploads and prints a live URL in about ten seconds.diff --git a/plugins/remocn/evals/storyboard-feature-announcement/graders/skill-fired.md b/plugins/remocn/evals/storyboard-feature-announcement/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-feature-announcement/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-feature-announcement/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-feature-announcement/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-feature-announcement/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-feature-announcement/graders/storyboard.md b/plugins/remocn/evals/storyboard-feature-announcement/graders/storyboard.mdnew file mode 100644index 00000000..bbfb02e5--- /dev/null+++ b/plugins/remocn/evals/storyboard-feature-announcement/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `feature-announcement` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 405 and 495 frames at 30fps (the brief asks for about 15 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-feature-announcement/prompt.md b/plugins/remocn/evals/storyboard-feature-announcement/prompt.mdnew file mode 100644index 00000000..305de9cd--- /dev/null+++ b/plugins/remocn/evals/storyboard-feature-announcement/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, feature-announcement]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 15-second video announcing AI triage in Tasklane: it reads every incoming task and sorts it by urgency, so the inbox starts with what matters.diff --git a/plugins/remocn/evals/storyboard-logo-bumper/graders/skill-fired.md b/plugins/remocn/evals/storyboard-logo-bumper/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-logo-bumper/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-logo-bumper/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-logo-bumper/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-logo-bumper/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-logo-bumper/graders/storyboard.md b/plugins/remocn/evals/storyboard-logo-bumper/graders/storyboard.mdnew file mode 100644index 00000000..15683bc1--- /dev/null+++ b/plugins/remocn/evals/storyboard-logo-bumper/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `logo-bumper` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 135 and 165 frames at 30fps (the brief asks for about 5 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-logo-bumper/prompt.md b/plugins/remocn/evals/storyboard-logo-bumper/prompt.mdnew file mode 100644index 00000000..f90d2fa1--- /dev/null+++ b/plugins/remocn/evals/storyboard-logo-bumper/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, logo-bumper]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 5-second logo intro for Tasklane to put in front of our YouTube tutorials. The wordmark is just the word Tasklane, accent #4F46E5.diff --git a/plugins/remocn/evals/storyboard-oss-showcase/graders/skill-fired.md b/plugins/remocn/evals/storyboard-oss-showcase/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-oss-showcase/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-oss-showcase/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-oss-showcase/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-oss-showcase/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-oss-showcase/graders/storyboard.md b/plugins/remocn/evals/storyboard-oss-showcase/graders/storyboard.mdnew file mode 100644index 00000000..af924fdf--- /dev/null+++ b/plugins/remocn/evals/storyboard-oss-showcase/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `oss-showcase` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 675 and 825 frames at 30fps (the brief asks for about 25 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-oss-showcase/prompt.md b/plugins/remocn/evals/storyboard-oss-showcase/prompt.mdnew file mode 100644index 00000000..dd28638a--- /dev/null+++ b/plugins/remocn/evals/storyboard-oss-showcase/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, oss-showcase]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 25-second showcase video for our open source library quickparse, a zero-dependency CSV parser for TypeScript. 4.2k GitHub stars, 120 contributors, install with npm i quickparse.diff --git a/plugins/remocn/evals/storyboard-pricing-reveal/graders/skill-fired.md b/plugins/remocn/evals/storyboard-pricing-reveal/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-pricing-reveal/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-pricing-reveal/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-pricing-reveal/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-pricing-reveal/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-pricing-reveal/graders/storyboard.md b/plugins/remocn/evals/storyboard-pricing-reveal/graders/storyboard.mdnew file mode 100644index 00000000..8b4fc6b3--- /dev/null+++ b/plugins/remocn/evals/storyboard-pricing-reveal/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `pricing-reveal` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 405 and 495 frames at 30fps (the brief asks for about 15 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-pricing-reveal/prompt.md b/plugins/remocn/evals/storyboard-pricing-reveal/prompt.mdnew file mode 100644index 00000000..3c96acd0--- /dev/null+++ b/plugins/remocn/evals/storyboard-pricing-reveal/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, pricing-reveal]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 15-second pricing video for Tasklane: Free for up to 3 people, Team at $8 per user per month, Business at $16 per user per month with SSO and audit logs.diff --git a/plugins/remocn/evals/storyboard-product-demo/graders/skill-fired.md b/plugins/remocn/evals/storyboard-product-demo/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-product-demo/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-product-demo/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-product-demo/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-product-demo/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-product-demo/graders/storyboard.md b/plugins/remocn/evals/storyboard-product-demo/graders/storyboard.mdnew file mode 100644index 00000000..8f17aa02--- /dev/null+++ b/plugins/remocn/evals/storyboard-product-demo/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `product-demo` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 810 and 990 frames at 30fps (the brief asks for about 30 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-product-demo/prompt.md b/plugins/remocn/evals/storyboard-product-demo/prompt.mdnew file mode 100644index 00000000..bee6c7d0--- /dev/null+++ b/plugins/remocn/evals/storyboard-product-demo/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, product-demo]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 30-second product demo video for Tasklane, a shared task inbox for small teams. It pulls tasks from Slack, email and GitHub into one list, and triages them by urgency. The site is tasklane.app. Brand accent is #4F46E5.diff --git a/plugins/remocn/evals/storyboard-testimonial-reel/graders/skill-fired.md b/plugins/remocn/evals/storyboard-testimonial-reel/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-testimonial-reel/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-testimonial-reel/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-testimonial-reel/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-testimonial-reel/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-testimonial-reel/graders/storyboard.md b/plugins/remocn/evals/storyboard-testimonial-reel/graders/storyboard.mdnew file mode 100644index 00000000..04cfeab2--- /dev/null+++ b/plugins/remocn/evals/storyboard-testimonial-reel/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `testimonial-reel` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 540 and 660 frames at 30fps (the brief asks for about 20 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-testimonial-reel/prompt.md b/plugins/remocn/evals/storyboard-testimonial-reel/prompt.mdnew file mode 100644index 00000000..4f1fbcd8--- /dev/null+++ b/plugins/remocn/evals/storyboard-testimonial-reel/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, testimonial-reel]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 20-second testimonial video for Tasklane with these quotes: "Our standups got 10 minutes shorter." (Maya Chen, Head of Ops at Fieldnote); "The only inbox my team actually empties." (Jon Reyes, CTO at Parcelbox); "Setup took five minutes." (Priya Nair, founder of Loomwork).diff --git a/plugins/remocn/evals/storyboard-year-in-review/graders/skill-fired.md b/plugins/remocn/evals/storyboard-year-in-review/graders/skill-fired.mdnew file mode 100644index 00000000..dab9eb66--- /dev/null+++ b/plugins/remocn/evals/storyboard-year-in-review/graders/skill-fired.md@@ -0,0 +1,5 @@+---+type: tool_used+tool: Skill+input_match: '"skill"\s*:\s*"(?:remocn:)?(?:video|remocn)"'+---diff --git a/plugins/remocn/evals/storyboard-year-in-review/graders/storyboard-table.md b/plugins/remocn/evals/storyboard-year-in-review/graders/storyboard-table.mdnew file mode 100644index 00000000..409c36e7--- /dev/null+++ b/plugins/remocn/evals/storyboard-year-in-review/graders/storyboard-table.md@@ -0,0 +1,4 @@+---+type: regex+pattern: '\|\s*#\s*\|\s*Beat\s*\|\s*Component\s*\|'+---diff --git a/plugins/remocn/evals/storyboard-year-in-review/graders/storyboard.md b/plugins/remocn/evals/storyboard-year-in-review/graders/storyboard.mdnew file mode 100644index 00000000..0789be26--- /dev/null+++ b/plugins/remocn/evals/storyboard-year-in-review/graders/storyboard.md@@ -0,0 +1,9 @@+---+type: llm+weight: 2+---+PASS if the final reply presents a storyboard for a `year-in-review` video and stops to ask the user to confirm or change it before any code is written, and all of these hold:+- each beat names its component in backticks (a remocn component, or a piece listed under Build new), and there is an `npx shadcn add @remocn/...` install line covering the remocn components;+- the content comes from the brief (real names, numbers or lines), not lorem or "Scene A";+- the planned total is between 675 and 825 frames at 30fps (the brief asks for about 25 seconds).+FAIL if there is no storyboard, if the archetype is clearly a different one, if the planned total is outside that range, or if the reply claims files were written.diff --git a/plugins/remocn/evals/storyboard-year-in-review/prompt.md b/plugins/remocn/evals/storyboard-year-in-review/prompt.mdnew file mode 100644index 00000000..13efbd21--- /dev/null+++ b/plugins/remocn/evals/storyboard-year-in-review/prompt.md@@ -0,0 +1,7 @@+---+max_turns: 30+timeout_seconds: 600+tags: [storyboard, year-in-review]+allowed_tools: [Read, Glob, Grep, Skill, Agent, WebFetch]+---+Make a 25-second year-in-review video for Tasklane's 2025: 12,000 teams joined, 340 releases shipped, 99.98% uptime, 4.8 million tasks closed.diff --git a/plugins/remocn/mcp.json b/plugins/remocn/mcp.jsonnew file mode 100644index 00000000..c9bf9c5d--- /dev/null+++ b/plugins/remocn/mcp.json@@ -0,0 +1,14 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",+ "mcpServers": {+ "remocn": {+ "type": "streamable-http",+ "url": "https://remocn.dev/mcp",+ "extensions": {+ "com.openai": {+ "auth": { "type": "none" }+ }+ }+ }+ }+}diff --git a/plugins/remocn/plugin.json b/plugins/remocn/plugin.jsonnew file mode 100644index 00000000..25dddaab--- /dev/null+++ b/plugins/remocn/plugin.json@@ -0,0 +1,37 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",+ "name": "remocn",+ "version": "0.1.0",+ "description": "Make Remotion videos from remocn components: brief to storyboard to a rendering project, with visual QA and a hand-off to Remocn Studio.",+ "author": {+ "name": "Remocn",+ "url": "https://remocn.dev"+ },+ "homepage": "https://remocn.dev/docs/getting-started/plugin",+ "repository": "https://github.com/Remocn/remocn",+ "license": "MIT",+ "keywords": ["remotion", "video", "shadcn", "motion", "animation"],+ "extensions": {+ "com.openai": {+ "interface": {+ "displayName": "remocn",+ "shortDescription": "Remotion videos from ready-made remocn components",+ "longDescription": "Pick components from the remocn registry, plan a storyboard, install with shadcn and compose a Remotion video that renders. Works in a coding agent with a terminal; in chat it searches components and plans videos through the remocn.dev MCP server.",+ "developerName": "Remocn",+ "category": "Design",+ "capabilities": ["Read", "Write"],+ "websiteURL": "https://remocn.dev",+ "privacyPolicyURL": "https://remocn.dev/legal#privacy",+ "termsOfServiceURL": "https://remocn.dev/legal#terms",+ "defaultPrompt": [+ "Make a 30-second product demo video for my app with remocn.",+ "Turn the last release of this repo into a changelog video.",+ "Find a remocn transition for a fast, techy cut."+ ],+ "brandColor": "#2A3033",+ "composerIcon": "./assets/icon.png",+ "logo": "./assets/icon.png"+ }+ }+ }+}diff --git a/plugins/remocn/skills/add/SKILL.md b/plugins/remocn/skills/add/SKILL.mdnew file mode 100644index 00000000..9d76b3da--- /dev/null+++ b/plugins/remocn/skills/add/SKILL.md@@ -0,0 +1,33 @@+---+name: add+description: >+ Install one remocn component into a Remotion project and show how to use it: read its docs page,+ run shadcn add, and place it in a Sequence with the right length. Use when the user names a remocn+ component to add, or asks for a single animation, transition, background or UI primitive rather+ than a whole video.+---++# Add one remocn component++Requested: $ARGUMENTS++Load the `remocn` skill first for the tier conventions and Canvas & timing.++1. **Resolve the name.** If the request is an exact component name, use it. If it's a description+ ("a glitchy title", "a fast cut"), shortlist from `https://remocn.dev/llms-components.txt` and+ offer the best two or three, each with its `Use for` line and length. Wait for the pick.+2. **Read its page.** Fetch the `.md` docs URL the index gives for it. Note the props, the example,+ `Length` and any `Avoid for` note. If the avoid note matches what the user wants, say so and+ suggest the replacement it names.+3. **Prepare the project once.** If `components.json` has no `@remocn` registry, run+ `node "${CLAUDE_SKILL_DIR}/../video/scripts/setup.mjs" <project-root>` first (outside Claude+ Code: `../video/scripts/setup.mjs` from this skill's folder). Its JSON result says which files it+ wrote; relay any `warning`.+4. **Install.** `npx shadcn add @remocn/<name>`. Dependencies install transitively; list which+ files landed.+5. **Use it.** Show a usage snippet built from the docs example, sized to the canvas, inside a+ `<Sequence durationInFrames>` of at least its `Length` plus hold time. Transitions go into+ `TransitionSeries.Transition` as `presentation` with `linearTiming`/`springTiming` at their+ `Length`. If the user named a place in their code, put it there; otherwise ask where it goes.+6. **Check.** `npx tsc --noEmit`, then a still at the end of its motion+ (`npx remotion still <composition> out/<name>.png --frame=<n>`) and look at it.diff --git a/plugins/remocn/skills/changelog/SKILL.md b/plugins/remocn/skills/changelog/SKILL.mdnew file mode 100644index 00000000..5ce150b5--- /dev/null+++ b/plugins/remocn/skills/changelog/SKILL.md@@ -0,0 +1,42 @@+---+name: changelog+description: >+ Turn a release into a short changelog video with remocn: collect what changed from git tags,+ commits or merged pull requests, write it as a few human-readable lines, and build the video with+ the changelog archetype. Use when the user wants a release, version or "what's new" video for a+ repository.+---++# Changelog video++Range or release: $ARGUMENTS++## 1. Collect what changed++Work out the range: the argument if given (`v1.4.0`, `v1.3.0..v1.4.0`, "last 2 weeks"), else from+the latest tag to `HEAD`, else the last 30 days.++- Tags: `git tag --sort=-creatordate | head -5`+- Commits: `git log --no-merges --pretty='%s' <from>..<to>`+- Merged pull requests, when the GitHub CLI is available:+ `gh pr list --state merged --search "merged:>=<date>" --json number,title,labels --limit 50`+- A `CHANGELOG.md` or release notes in the repo beat both. Prefer them when they cover the range.++## 2. Write the lines++The changelog archetype holds a version and a short list of changes. Video copy is not a commit log:++- Pick the 3–5 changes a user would notice. Drop chores, refactors, dependency bumps and CI.+- One line each, sentence case, under about 40 characters, starting with what the user gets+ ("Export to vertical video", not "feat(export): add 9:16 preset").+- Group into New / Improved / Fixed only when there are enough lines to need it.++If you collected the lines from the repo, show the version and the lines and wait for edits before+building. If the user gave the changes themselves, tidy the wording and go straight on: the+storyboard the `video` skill shows next is where they confirm it, so don't stop twice.++## 3. Build++Run the `video` skill with the brief "changelog video for <product> <version>", the archetype+`changelog`, and the approved lines as content. It plans the storyboard, installs, composes, checks the+render and offers the Remocn Studio hand-off.diff --git a/skills/remocn/SKILL.md b/plugins/remocn/skills/remocn/SKILL.mdsimilarity index 87%rename from skills/remocn/SKILL.mdrename to plugins/remocn/skills/remocn/SKILL.mdindex 60188633..7fcc9f91 100644--- a/skills/remocn/SKILL.md+++ b/plugins/remocn/skills/remocn/SKILL.md@@ -1,11 +1,13 @@---name: remocndescription: >- Build Remotion videos with remocn — copy-paste animation components and timeline-driven- UI primitives from a shadcn registry. Use when composing a video or scene in a Remotion- project, adding a single animation, transition, background, or UI-block sim, or reaching- for a video-ready UI primitive (button, dialog, command menu). Activate for polished- Remotion video work even when remocn isn't named.+ Pick, install and compose remocn components: ready-made Remotion animations, transitions,+ backgrounds, captions, UI primitives and video templates from a shadcn registry. Use when+ building a video or scene out of prebuilt parts (product demo, launch, changelog, intro,+ social clip), adding an animation, transition or background to a Remotion project, or+ choosing between components. Activate for polished Remotion video work even when remocn+ isn't named. Works alongside the Remotion skills: questions about the Remotion API itself+ (interpolate, spring, Sequence, rendering, config) belong to them, not to this skill.---# remocn@@ -168,10 +170,20 @@ https://remocn.dev/docs/craft/anti-patterns.mdGeneral Remotion rules (no `Math.random()`, no `setInterval`, animate `transform` not `top`/`left`,load fonts before render) live in the `remotion-best-practices` skill.+## Working alongside the Remotion skills++remocn is the component layer on top of Remotion, not a second guide to it. When Remotion's own+skills are installed (`remotion-create`, `remotion-render`, `remotion-best-practices`), let them+answer how Remotion works — project setup, the animation API, rendering, config — and use this+skill for what to put on screen: which remocn component, how long it runs, how beats chain. Don't+restate Remotion API docs here or in your answer; point to those skills or to remotion.dev.+## Composing a videoDon't dump components — compose one story. When asked to build a full video ("make a product demo",-"changelog video", "intro for my landing"):+"changelog video", "intro for my landing") and the `video` skill from the remocn plugin is installed,+follow it: it runs the whole brief → storyboard → install → compose → review flow below and hands+the result to Remocn Studio. Otherwise:1. **Decide the strategy** — ready template vs compose from components vs build a new component. See`references/anatomy.md` §1.diff --git a/skills/remocn/references/anatomy.md b/plugins/remocn/skills/remocn/references/anatomy.mdsimilarity index 100%rename from skills/remocn/references/anatomy.mdrename to plugins/remocn/skills/remocn/references/anatomy.mddiff --git a/skills/remocn/references/archetypes/changelog.md b/plugins/remocn/skills/remocn/references/archetypes/changelog.mdsimilarity index 100%rename from skills/remocn/references/archetypes/changelog.mdrename to plugins/remocn/skills/remocn/references/archetypes/changelog.mddiff --git a/skills/remocn/references/archetypes/cli-tool-demo.md b/plugins/remocn/skills/remocn/references/archetypes/cli-tool-demo.mdsimilarity index 100%rename from skills/remocn/references/archetypes/cli-tool-demo.mdrename to plugins/remocn/skills/remocn/references/archetypes/cli-tool-demo.mddiff --git a/skills/remocn/references/archetypes/feature-announcement.md b/plugins/remocn/skills/remocn/references/archetypes/feature-announcement.mdsimilarity index 100%rename from skills/remocn/references/archetypes/feature-announcement.mdrename to plugins/remocn/skills/remocn/references/archetypes/feature-announcement.mddiff --git a/skills/remocn/references/archetypes/index.md b/plugins/remocn/skills/remocn/references/archetypes/index.mdsimilarity index 100%rename from skills/remocn/references/archetypes/index.mdrename to plugins/remocn/skills/remocn/references/archetypes/index.mddiff --git a/skills/remocn/references/archetypes/logo-bumper.md b/plugins/remocn/skills/remocn/references/archetypes/logo-bumper.mdsimilarity index 100%rename from skills/remocn/references/archetypes/logo-bumper.mdrename to plugins/remocn/skills/remocn/references/archetypes/logo-bumper.mddiff --git a/skills/remocn/references/archetypes/oss-showcase.md b/plugins/remocn/skills/remocn/references/archetypes/oss-showcase.mdsimilarity index 100%rename from skills/remocn/references/archetypes/oss-showcase.mdrename to plugins/remocn/skills/remocn/references/archetypes/oss-showcase.mddiff --git a/skills/remocn/references/archetypes/pricing-reveal.md b/plugins/remocn/skills/remocn/references/archetypes/pricing-reveal.mdsimilarity index 100%rename from skills/remocn/references/archetypes/pricing-reveal.mdrename to plugins/remocn/skills/remocn/references/archetypes/pricing-reveal.mddiff --git a/skills/remocn/references/archetypes/product-demo.md b/plugins/remocn/skills/remocn/references/archetypes/product-demo.mdsimilarity index 100%rename from skills/remocn/references/archetypes/product-demo.mdrename to plugins/remocn/skills/remocn/references/archetypes/product-demo.mddiff --git a/skills/remocn/references/archetypes/testimonial-reel.md b/plugins/remocn/skills/remocn/references/archetypes/testimonial-reel.mdsimilarity index 100%rename from skills/remocn/references/archetypes/testimonial-reel.mdrename to plugins/remocn/skills/remocn/references/archetypes/testimonial-reel.mddiff --git a/skills/remocn/references/archetypes/year-in-review.md b/plugins/remocn/skills/remocn/references/archetypes/year-in-review.mdsimilarity index 100%rename from skills/remocn/references/archetypes/year-in-review.mdrename to plugins/remocn/skills/remocn/references/archetypes/year-in-review.mddiff --git a/plugins/remocn/skills/studio/SKILL.md b/plugins/remocn/skills/studio/SKILL.mdnew file mode 100644index 00000000..9f04235f--- /dev/null+++ b/plugins/remocn/skills/studio/SKILL.md@@ -0,0 +1,75 @@+---+name: studio+description: >+ Open a Remotion project in Remocn Studio, the desktop app for tuning a video visually and exporting+ mp4. Use when the user wants to open, continue or export a video in Remocn Studio, or right after a+ video is built and they accept the offer to open it there. Also prepares a project so Studio can+ open it.+---++# Remocn Studio hand-off++Remocn Studio (https://remocn.studio) is a desktop app for macOS and Linux. It previews a Remotion+project live, lets the user tune elements by hand, and exports mp4. It only opens folders it+recognises, so a project goes through **Prepare** once and can then be **Opened** any time.++The helper script is `${CLAUDE_SKILL_DIR}/scripts/studio.mjs` (outside Claude Code: `scripts/studio.mjs`+next to this file). It needs only Node and prints one JSON object per command. Run it from the+Remotion project root, or pass the root as the first argument.++## Prepare++```bash+node "${CLAUDE_SKILL_DIR}/scripts/studio.mjs" init <project-root> --name "<video or product name>"+```++What it does, and what to tell the user:++- Writes `.remocn/project.json` (Studio's project manifest: a fresh `projectId`, `revision: 0`, no+ brand) if it isn't there. An existing manifest is never touched: its `projectId` is the project's+ identity in Studio.+- Places Studio's scan at `src/videos/registry.tsx` if missing, and wraps the root in the entry point+ as `registerRoot(withVideos(Root))`. From then on every `src/videos/<slug>/index.tsx` that exports+ `meta` is a composition with id `<slug>`, in Remotion Studio and in Remocn Studio alike. The+ user's own compositions in `Root.tsx` keep working.++In a project the user already had, ask before running it: it edits their entry point (one import, one+wrap) and adds two files.++If the result says `ok: false` with an entry-point reason, the entry point doesn't call+`registerRoot(Root)` exactly once after its imports. Do the wrap by hand: add+`import { withVideos } from "<registry.specifier>";` using the `specifier` from the result (it is+relative to the entry point, e.g. `../src/videos/registry` for `remotion/index.ts`), and change the+call to `registerRoot(withVideos(Root))`. If that isn't possible, explain why to the user.++Then check `npx remotion compositions` lists every video slug.++## Open++Only after the user says yes to opening the project in Studio:++```bash+node "${CLAUDE_SKILL_DIR}/scripts/studio.mjs" open <project-root>+```++Relay the `message` from the result. By `action`:++- `deep-link`: Studio is opening the project and shows a confirmation dialog. Nothing else to do.+- `launched`: Studio is starting but can't be told which folder to open yet. Tell the user to choose+ **Open Folder** (⌘O on macOS, Ctrl+O on Linux) and pick the project root, and give them the path.+- `not-installed`: give the download link (https://remocn.studio) and the same Open Folder steps for+ after installing.+- `unsupported-platform`: Studio doesn't run on this OS. The video still previews with+ `npx remotion studio` and renders with `npx remotion render <slug>`.++If the result says the manifest is missing, run **Prepare** first.++To check whether Studio is installed without opening anything, run the `detect` command.++## Don'ts++- Don't create `.remocn/project.json` by hand or copy one from another project. Two projects with+ the same `projectId` collide in Studio, and it refuses the second.+- Don't move videos out of `src/videos/<slug>/`. Studio identifies a video by its folder name.+- In claude.ai or ChatGPT there is no local project to hand off. Point the user to a coding agent+ (Claude Code, Codex) with this plugin, or to Remocn Studio's own templates.diff --git a/plugins/remocn/skills/studio/assets/registry.tsx b/plugins/remocn/skills/studio/assets/registry.tsxnew file mode 100644index 00000000..e06483dc--- /dev/null+++ b/plugins/remocn/skills/studio/assets/registry.tsx@@ -0,0 +1,79 @@+import type { ComponentProps, ComponentType } from "react";+import { Composition } from "remotion";++interface VideoMeta {+ durationInFrames: number;+ fps: number;+ height: number;+ width: number;+}++interface VideoModule {+ default: ComponentType;+ defaultProps?: Record<string, unknown>;+ meta: VideoMeta;+ schema?: ComponentProps<typeof Composition>["schema"];+}++interface WebpackContext {+ keys: () => string[];+ (key: string): unknown;+}++// `require.context` has to appear literally for webpack to see it. The cast is+// what keeps this file free of an ambient declaration that would clash with+// whatever types the project already has.+const VIDEOS = (+ require as unknown as {+ context: (+ directory: string,+ deep?: boolean,+ filter?: RegExp+ ) => WebpackContext;+ }+).context(".", true, /^\.\/[^/]+\/index\.tsx$/);++const ID = /^\.\/([^/]+)\/index\.tsx$/;++// Every folder under src/videos is a composition, named after the folder. This+// file is the studio's; the project's own compositions stay in Root.tsx, and+// nothing here ever edits them.+export function Videos() {+ return (+ <>+ {VIDEOS.keys().map((key) => {+ const id = ID.exec(key)?.[1];+ if (id === undefined) {+ return null;+ }++ const video = VIDEOS(key) as VideoModule;++ return (+ <Composition+ component={video.default}+ defaultProps={video.defaultProps}+ durationInFrames={video.meta.durationInFrames}+ fps={video.meta.fps}+ height={video.meta.height}+ id={id}+ key={id}+ schema={video.schema}+ width={video.meta.width}+ />+ );+ })}+ </>+ );+}++export function withVideos(Root: ComponentType) {+ return function Registered() {+ return (+ <>+ <Root />+ <Videos />+ </>+ );+ };+}diff --git a/plugins/remocn/skills/studio/scripts/studio.mjs b/plugins/remocn/skills/studio/scripts/studio.mjsnew file mode 100644index 00000000..4cce9c9d--- /dev/null+++ b/plugins/remocn/skills/studio/scripts/studio.mjs@@ -0,0 +1,440 @@+#!/usr/bin/env node+// Hands a Remotion project over to Remocn Studio (https://remocn.studio).+//+// node studio.mjs init [dir] [--name "Launch video"]+// node studio.mjs detect+// node studio.mjs open [dir]+//+// Every command prints one JSON object on stdout, so the agent reads the outcome+// instead of parsing prose. Nothing here needs a dependency beyond Node itself.++import { execFileSync, spawn } from "node:child_process";+import { randomUUID } from "node:crypto";+import { existsSync } from "node:fs";+import { mkdir, readFile, writeFile } from "node:fs/promises";+import { homedir, platform } from "node:os";+import { basename, dirname, join, relative, resolve, sep } from "node:path";+import { fileURLToPath } from "node:url";++const BUNDLE_ID = "com.remocn.remocn-studio";+const SCHEME = "remocn-studio";+const DOWNLOAD_URL = "https://remocn.studio";+const RELEASES_URL = "https://github.com/Remocn/remocn-studio/releases/latest";++// First Studio release that understands `remocn-studio://open-project`. Until it+// ships this stays null and `open` launches Studio and explains Open Folder (⌘O)+// instead — an older Studio answers an unknown route with an error dialog.+const OPEN_PROJECT_SINCE = null;++// `.remocn/project.json` belongs to Studio (shared/project-config.ts there).+// Write only what schemaVersion 1 accepts, and never touch an existing file:+// its projectId is the project's identity in Studio's history.+const MANIFEST = join(".remocn", "project.json");+const SCHEMA_VERSION = 1;++// The scan Studio itself places in src/videos/. A byte-identical copy is one+// Studio recognises as its own and leaves alone.+const REGISTRY_FILE = "registry.tsx";+const REGISTRY_EXPORT = "withVideos";+const REGISTRY_TEMPLATE = join(+ dirname(fileURLToPath(import.meta.url)),+ "..",+ "assets",+ REGISTRY_FILE,+);++// The precedence Remotion's own CLI uses; the first one that exists is the entry.+const ENTRY_CANDIDATES = [+ "src/index.ts",+ "src/index.tsx",+ "src/index.js",+ "src/index.mjs",+ "remotion/index.tsx",+ "remotion/index.ts",+ "remotion/index.js",+ "remotion/index.mjs",+ "src/remotion/index.tsx",+ "src/remotion/index.ts",+ "src/remotion/index.js",+ "src/remotion/index.mjs",+];++const REGISTER = /registerRoot\(\s*([A-Za-z_$][\w$]*)\s*\)/g;+// A whole import statement, including one that spans lines: everything up to+// its module specifier, plus an optional semicolon.+const IMPORT = /^import\b[\s\S]*?["'][^"'\n]+["'][ \t]*;?/gm;++// The source with every comment blanked to spaces, newlines kept, so offsets+// found in it are offsets in the original. A `registerRoot(Old)` in a comment+// must not be mistaken for the real call.+function withoutComments(source) {+ let out = "";+ let quote = null;+ for (let i = 0; i < source.length; i++) {+ const char = source[i];+ const next = source[i + 1];+ if (quote !== null) {+ out += char;+ if (char === "\\" && i + 1 < source.length) {+ out += next;+ i++;+ } else if (char === quote) {+ quote = null;+ }+ } else if (char === '"' || char === "'" || char === "`") {+ quote = char;+ out += char;+ } else if (char === "/" && next === "/") {+ while (i < source.length && source[i] !== "\n") {+ out += " ";+ i++;+ }+ if (i < source.length) out += "\n";+ } else if (char === "/" && next === "*") {+ out += " ";+ i += 2;+ while (+ i < source.length &&+ !(source[i] === "*" && source[i + 1] === "/")+ ) {+ out += source[i] === "\n" ? "\n" : " ";+ i++;+ }+ if (i < source.length) {+ out += " ";+ i++;+ }+ } else {+ out += char;+ }+ }+ return out;+}++function parseArgs(argv) {+ const [command, ...rest] = argv;+ const flags = {};+ const positional = [];+ for (let i = 0; i < rest.length; i++) {+ const arg = rest[i];+ if (arg.startsWith("--")) {+ flags[arg.slice(2)] = rest[i + 1];+ i++;+ } else {+ positional.push(arg);+ }+ }+ return { command, flags, dir: resolve(positional[0] ?? ".") };+}++function print(result) {+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);+}++// ---------------------------------------------------------------------------+// init — make the folder one Studio can open as-is+// ---------------------------------------------------------------------------++async function init(dir, name) {+ if (!existsSync(join(dir, "package.json"))) {+ return {+ ok: false,+ reason: `${dir} has no package.json — run this from the Remotion project root`,+ };+ }++ const manifest = await ensureManifest(dir, name);+ const registry = await ensureRegistry(dir);++ return { ok: registry.ok, dir, manifest, registry };+}++async function ensureManifest(dir, name) {+ const path = join(dir, MANIFEST);++ if (existsSync(path)) {+ try {+ const existing = JSON.parse(await readFile(path, "utf8"));+ return { path, written: false, projectId: existing.projectId };+ } catch {+ return {+ path,+ written: false,+ warning: "the existing manifest is not valid JSON — left untouched",+ };+ }+ }++ const config = {+ schemaVersion: SCHEMA_VERSION,+ projectId: randomUUID(),+ name: (name ?? (await defaultName(dir))).trim() || basename(dir),+ revision: 0,+ brand: null,+ };++ await mkdir(dirname(path), { recursive: true });+ await writeFile(path, `${JSON.stringify(config, null, 2)}\n`, "utf8");+ return { path, written: true, projectId: config.projectId };+}++async function defaultName(dir) {+ try {+ const pkg = JSON.parse(await readFile(join(dir, "package.json"), "utf8"));+ if (typeof pkg.name === "string" && pkg.name.trim().length > 0) {+ return pkg.name;+ }+ } catch {}+ return basename(dir);+}++async function ensureRegistry(dir) {+ const registry = join(dir, "src", "videos", REGISTRY_FILE);+ let placed = false;++ if (!existsSync(registry)) {+ await mkdir(dirname(registry), { recursive: true });+ await writeFile(+ registry,+ await readFile(REGISTRY_TEMPLATE, "utf8"),+ "utf8",+ );+ placed = true;+ }++ const entry = ENTRY_CANDIDATES.map((candidate) => join(dir, candidate)).find(+ (file) => existsSync(file),+ );++ if (entry === undefined) {+ return {+ ok: false,+ placed,+ reason: `no Remotion entry point — expected one of ${ENTRY_CANDIDATES.join(", ")}`,+ };+ }++ const before = await readFile(entry, "utf8");+ const code = withoutComments(before);+ const specifier = importOf(entry, registry);++ if (code.includes(`"${specifier}"`) || code.includes(`'${specifier}'`)) {+ return { ok: true, placed, entry, wrapped: false };+ }++ const calls = [...code.matchAll(REGISTER)];+ const last = [...code.matchAll(IMPORT)].at(-1);+ const call = calls.length === 1 ? calls[0] : undefined;++ // The entry point is the person's file. Anything that isn't exactly one+ // plain `registerRoot(Root)` after the imports is reported, not rewritten+ // on a guess.+ if (+ call?.index === undefined ||+ last?.index === undefined ||+ call.index < last.index + last[0].length+ ) {+ return {+ ok: false,+ placed,+ entry,+ specifier,+ reason: `${relative(dir, entry)} does not call registerRoot(Root) once, after its imports — add \`import { ${REGISTRY_EXPORT} } from "${specifier}";\` and wrap the root as registerRoot(${REGISTRY_EXPORT}(Root)) by hand`,+ };+ }++ const at = last.index + last[0].length;+ const end = call.index + call[0].length;+ const after =+ before.slice(0, at) ++ `\nimport { ${REGISTRY_EXPORT} } from "${specifier}";` ++ before.slice(at, call.index) ++ `registerRoot(${REGISTRY_EXPORT}(${call[1]}))` ++ before.slice(end);++ await writeFile(entry, after, "utf8");+ return { ok: true, placed, entry, wrapped: true };+}++function importOf(entry, registry) {+ const path = relative(dirname(entry), registry)+ .split(sep)+ .join("/")+ .replace(/\.tsx$/, "");+ return path.startsWith(".") ? path : `./${path}`;+}++// ---------------------------------------------------------------------------+// detect — is Studio on this machine, and which version+// ---------------------------------------------------------------------------++function run(file, args) {+ try {+ return execFileSync(file, args, {+ encoding: "utf8",+ stdio: ["ignore", "pipe", "ignore"],+ }).trim();+ } catch {+ return "";+ }+}++function detect() {+ const os = platform();++ if (os === "darwin") {+ const candidates = [+ ...run("mdfind", [`kMDItemCFBundleIdentifier == '${BUNDLE_ID}'`])+ .split("\n")+ .filter(Boolean),+ "/Applications/Remocn Studio.app",+ join(homedir(), "Applications", "Remocn Studio.app"),+ ];+ const app = candidates.find((path) => existsSync(path));+ if (app === undefined) {+ return { platform: os, supported: true, installed: false };+ }+ const version =+ run("plutil", [+ "-extract",+ "CFBundleShortVersionString",+ "raw",+ join(app, "Contents", "Info.plist"),+ ]) || null;+ return { platform: os, supported: true, installed: true, app, version };+ }++ if (os === "linux") {+ const handler = run("xdg-mime", [+ "query",+ "default",+ `x-scheme-handler/${SCHEME}`,+ ]);+ return {+ platform: os,+ supported: true,+ installed: handler.length > 0,+ handler: handler || null,+ version: null,+ };+ }++ return { platform: os, supported: false, installed: false };+}++// ---------------------------------------------------------------------------+// open — hand the project to Studio, or say how to+// ---------------------------------------------------------------------------++function newerOrEqual(version, since) {+ const a = version.split(".").map(Number);+ const b = since.split(".").map(Number);+ for (let i = 0; i < Math.max(a.length, b.length); i++) {+ const diff = (a[i] ?? 0) - (b[i] ?? 0);+ if (diff !== 0) {+ return diff > 0;+ }+ }+ return true;+}++function supportsOpenProject(studio) {+ if (OPEN_PROJECT_SINCE === null) {+ return false;+ }+ // Linux exposes no version for the scheme handler; assume a current install.+ return (+ studio.version === null || newerOrEqual(studio.version, OPEN_PROJECT_SINCE)+ );+}++function launch(file, args) {+ const child = spawn(file, args, { detached: true, stdio: "ignore" });+ child.on("error", () => {});+ child.unref();+}++function open(dir) {+ const studio = detect();+ const fallback = [+ "In Remocn Studio choose Open Folder (⌘O on macOS, Ctrl+O on Linux)",+ `and pick ${dir}`,+ ].join(" ");++ if (!existsSync(join(dir, MANIFEST))) {+ return {+ ok: false,+ studio,+ reason: `${dir} has no ${MANIFEST} — run \`init\` first; Studio refuses folders without it`,+ };+ }++ if (!studio.supported) {+ return {+ ok: false,+ studio,+ action: "unsupported-platform",+ message:+ "Remocn Studio is available for macOS and Linux only. The project still opens in Remotion Studio with `npx remotion studio`.",+ };+ }++ if (!studio.installed) {+ return {+ ok: true,+ studio,+ action: "not-installed",+ message: `Remocn Studio is not installed. Download it from ${DOWNLOAD_URL} (or ${RELEASES_URL}), then: ${fallback}.`,+ download: DOWNLOAD_URL,+ };+ }++ if (supportsOpenProject(studio)) {+ const link = `${SCHEME}://open-project?path=${encodeURIComponent(dir)}`;+ launch(studio.platform === "darwin" ? "open" : "xdg-open", [link]);+ return {+ ok: true,+ studio,+ action: "deep-link",+ link,+ message:+ "Remocn Studio is opening the project — confirm the dialog it shows.",+ };+ }++ // Launch the app itself, never a bare `remocn-studio://` — Studio answers a+ // link with no route by showing an error.+ if (studio.platform === "darwin") {+ launch("open", ["-b", BUNDLE_ID]);+ } else {+ launch("gtk-launch", [studio.handler]);+ }+ return {+ ok: true,+ studio,+ action: "launched",+ message: `Remocn Studio is starting. ${fallback}.`,+ };+}++// ---------------------------------------------------------------------------++const { command, flags, dir } = parseArgs(process.argv.slice(2));++switch (command) {+ case "init":+ print(await init(dir, flags.name));+ break;+ case "detect":+ print(detect());+ break;+ case "open":+ print(open(dir));+ break;+ default:+ print({+ ok: false,+ reason: "usage: studio.mjs <init|detect|open> [dir] [--name <name>]",+ });+ process.exitCode = 1;+}diff --git a/plugins/remocn/skills/video/SKILL.md b/plugins/remocn/skills/video/SKILL.mdnew file mode 100644index 00000000..c1b53dba--- /dev/null+++ b/plugins/remocn/skills/video/SKILL.md@@ -0,0 +1,117 @@+---+name: video+description: >+ Make a complete Remotion video from a short brief with remocn components: pick the archetype, plan+ a storyboard with frame budgets, install the components, compose the scenes, check the render and+ offer to open the project in Remocn Studio. Use when the user asks for a whole video (product demo,+ launch, feature announcement, changelog, OSS showcase, CLI demo, testimonials, year in review,+ pricing, logo bumper), not a single component.+---++# Make a video with remocn++The brief: $ARGUMENTS++Load the `remocn` skill before anything else. It carries the conventions this flow relies on (the two+component tiers, Canvas & timing, design defaults) and the recipes in its+`references/archetypes/`. This skill is the order of work; that one is the knowledge.++Work through the steps in order. Don't skip the storyboard confirmation: it is the cheapest point to+change direction.++## 1. Read the brief and the project++- Pull the content from the brief and the repo before asking: `README`, landing copy,+ `package.json`, recent releases. Ask only for what is still missing, in one message, and fall back+ to honest placeholders rather than blocking.+- Pick the archetype from the `remocn` skill's `references/archetypes/index.md` and read that+ recipe. Its content contract tells you what to gather; its duration variants set the target length+ when the brief doesn't.++## 2. Plan the storyboard++Plan it in the format of [references/storyboard.md](references/storyboard.md).++- If the `remocn:video-director` agent is available, hand it the brief, the gathered content, the+ archetype and the target length, and take its storyboard back.+- Otherwise plan it yourself: shortlist from `https://remocn.dev/llms-components.txt`, read the+ `.md` page of every pick, and budget each beat as the format describes.++Show the storyboard to the user **as it is in that format**: the header lines, the table with all its+columns, the install line and the missing-content list. Don't retell it as prose or reshape the+table. A few lines above it on the choices you made are fine. Then **wait for a yes or for+changes**, and apply changes to the table, not straight to code.++## 3. Set up the project++Find out which case you are in:++- **No Remotion project yet** (no `remotion` dependency in `package.json`): create one with+ `npx create-video@latest --yes --blank <folder>`, then work inside it. Remotion is a prerequisite+ of remocn; this is the only time you create it.+- **An existing Remotion project**: work in it as it is. Don't restructure the user's code.++Then, in both cases:++1. Make `shadcn add` work in the project:++ ```bash+ node "${CLAUDE_SKILL_DIR}/scripts/setup.mjs" <project-root>+ ```++ (Outside Claude Code: `scripts/setup.mjs` next to this file.) `shadcn init` refuses Remotion+ projects, and Remotion's bundler ignores tsconfig paths, so the script writes `components.json`+ with the `@remocn` registry, adds the `@/*` path to `tsconfig.json`, and resolves the same alias+ in `remotion.config.ts`. Each step is skipped when the project already has it; relay any+ `warning` in the result.+2. Make the project open in Remocn Studio as-is by following the `studio` skill's **Prepare** step.++For an existing project, say which files these two steps will touch and ask before running them.++## 4. Install and compose++1. Run the storyboard's install line: `npx shadcn add @remocn/<a> @remocn/<b> ...`. Dependencies+ install transitively.+2. Write the video as **`src/videos/<slug>/index.tsx`**. This layout is what Remocn Studio scans,+ and the scan registers it as a Remotion composition with id `<slug>`:++ ```tsx+ export const meta = {+ durationInFrames: 1356, // Planned total from the storyboard+ fps: 30,+ height: 720,+ width: 1280,+ };++ export default function LaunchVideo() {+ return (/* the <TransitionSeries> from the storyboard */);+ }+ ```++ Scenes that grow past a screen of code go next to it in the same folder+ (`src/videos/<slug>/scenes/hook.tsx`), never beside the video folder. Optional extra exports:+ `defaultProps` and a zod `schema`, both forwarded to the composition.+3. Use the exact props from each component's docs page. Sequence lengths come from the storyboard,+ not from guesses.+4. Typecheck (`npx tsc --noEmit`) and list compositions (`npx remotion compositions`). The slug+ must be in the list. Fix every error before moving on. A missing declaration file for a+ component's dependency is fixed with `npm i -D @types/<package>`, not with `any`.++## 5. Check the render++The agent that writes the code never sees the frames, so look at them.++- If the `remocn:scene-reviewer` agent is available, hand it the composition id, the storyboard and+ the project path. Apply the fixes it returns, then ask it to check again. Stop after **two** review+ rounds and tell the user what is still open, if anything.+- Otherwise render stills yourself at the start, the middle of the motion and the end of the hold of+ each beat (`npx remotion still <slug> out/review/<beat>-<frame>.png --frame=<n>`), open the images,+ and check them against the `remocn` skill's quality bar (`references/anatomy.md` §3).++## 6. Hand off++1. Tell the user how to preview (`npx remotion studio`) and render+ (`npx remotion render <slug> out/<slug>.mp4`).+2. Offer **"Open in Remocn Studio to tweak and export?"** and, on a yes, follow the `studio` skill's+ **Open** step. Remocn Studio is a desktop app for tuning elements visually and exporting mp4;+ skip the offer on Windows, where it isn't available.diff --git a/plugins/remocn/skills/video/references/storyboard.md b/plugins/remocn/skills/video/references/storyboard.mdnew file mode 100644index 00000000..35963ea5--- /dev/null+++ b/plugins/remocn/skills/video/references/storyboard.md@@ -0,0 +1,57 @@+# Storyboard format++The storyboard is the contract between planning and building. The `video-director` agent writes it,+the `video` skill shows it to the user and builds from it, and the `scene-reviewer` agent checks the+render against it. Keep it in this shape so each of them can read the others' output.++## Shape++````markdown+# Storyboard: <video title>++- **Archetype:** <product-demo | changelog | feature-announcement | oss-showcase | cli-tool-demo |+ testimonial-reel | year-in-review | pricing-reveal | logo-bumper | custom>+- **Slug:** <kebab-case, ASCII, becomes src/videos/<slug>/>+- **Canvas:** 1280×720 @ 30fps (or 1080×1920 / 1080×1080 when the brief asks for vertical / square)+- **Target:** <seconds from the brief>s · **Planned:** <total frames>f = <seconds>s+- **Vibe:** <tech | premium | data | clean | playful | social | paper> · **Accent:** <one hex>++| # | Beat | Component | Content | Own length | Hold | Sequence | Transition out |+|---|---|---|---|---|---|---|---|+| 1 | Hook | `kinetic-center-build` | "Your team has tasks everywhere" | 45f | 120f | 165f | `fade()` 18f |+| 2 | ... | ... | ... | ... | ... | ... | ... |++**Install:** `npx shadcn add @remocn/kinetic-center-build @remocn/per-character-rise ...`++**Content still missing:** <fields the user should supply; placeholders used meanwhile>++**Build new:** <any beat no catalog component covers, with one line on what to build — or "none">+````++## Rules for the numbers++- **Own length** is the component's `Length` from `https://remocn.dev/llms-components.txt` (frames at+ 30fps). It is the floor, never the whole beat. `state-driven` components have no own length: give+ them the time their state changes need.+- **Hold** is time on screen after the motion settles. Text needs roughly 4 frames per character+ read at a glance, and never less than 30 frames.+- **Sequence** = own length + hold. This is the `durationInFrames` of the beat's+ `<TransitionSeries.Sequence>` (or `<Series.Sequence>`).+- **Transition out** is a presentation plus its timing frames. In a `TransitionSeries` adjacent+ sequences overlap by the transition's length, so+ `Planned = sum(Sequence) − sum(transition frames)`.+- **Planned** must land within ±10% of **Target**. Trim holds before trimming beats; drop a beat+ before squeezing every hold below its floor.+- At other frame rates scale every frame count by `fps / 30`.++## Rules for the picks++- One lead component per beat, chosen from the index, with its docs page read (`.md` URL) before it+ goes in the table. Supporting components layered in the same beat go in the same cell, after the+ lead. Never a component you have not read.+- A piece no catalog component covers is named in backticks too and listed under **Build new**. It+ stays out of the install line.+- Respect `Avoid for`: when a pick's avoid note matches the beat, take the replacement it names in+ backticks.+- One vibe across the video. `paper` components only mix with other `paper` components.+- One accent color. Everything else neutral.diff --git a/plugins/remocn/skills/video/scripts/setup.mjs b/plugins/remocn/skills/video/scripts/setup.mjsnew file mode 100644index 00000000..1e0d44f4--- /dev/null+++ b/plugins/remocn/skills/video/scripts/setup.mjs@@ -0,0 +1,297 @@+#!/usr/bin/env node+// Makes a Remotion project ready for `npx shadcn add @remocn/<name>`.+//+// node setup.mjs [dir]+//+// `shadcn init` refuses a Remotion project ("could not detect a supported+// framework"), and Remotion's bundler doesn't read tsconfig paths, so a fresh+// project needs three small edits before the first component lands. Each one is+// skipped when the project already has it. Prints one JSON report on stdout.++import { existsSync } from "node:fs";+import { readFile, writeFile } from "node:fs/promises";+import { dirname, join, relative, resolve, sep } from "node:path";++const REGISTRY = "https://remocn.dev/r/{name}.json";+const ALIAS_MARKER = "withRemocnAlias";+const CONFIG_FILES = ["remotion.config.ts", "remotion.config.js"];++const COMPONENTS_JSON = {+ $schema: "https://ui.shadcn.com/schema.json",+ style: "new-york",+ rsc: false,+ tsx: true,+ tailwind: { config: "", css: "", baseColor: "neutral", cssVariables: false },+ aliases: {+ components: "@/components",+ utils: "@/lib/utils",+ ui: "@/components/ui",+ lib: "@/lib",+ hooks: "@/hooks",+ },+ registries: { "@remocn": REGISTRY },+};++const ALIAS_BLOCK = (target) => `+// remocn components import each other through the "@/" alias in components.json.+// Bundlers don't read tsconfig paths, so the alias is resolved here as well.+// Both overrides are deliberate: the Remotion CLI applies overrideBundlerConfig+// with webpack and rspack alike, while Remocn Studio's preview reads only+// overrideWebpackConfig. Both run from the project root, which process.cwd()+// points at.+const ${ALIAS_MARKER} = <C extends { resolve?: object }>(config: C): C => ({+ ...config,+ resolve: {+ ...config.resolve,+ alias: {+ ...((config.resolve as { alias?: object } | undefined)?.alias ?? {}),+ "@": ${target},+ },+ },+});+// overrideBundlerConfig only exists in newer Remotion 4 releases.+if (typeof Config.overrideBundlerConfig === "function") {+ Config.overrideBundlerConfig(${ALIAS_MARKER});+}+Config.overrideWebpackConfig(${ALIAS_MARKER});+`;++// tsconfig.json is JSONC. Drop comments and trailing commas without touching+// anything inside a string ("https://..." must survive).+function parseJsonc(text) {+ let out = "";+ let inString = false;+ for (let i = 0; i < text.length; i++) {+ const char = text[i];+ const next = text[i + 1];+ if (inString) {+ out += char;+ if (char === "\\") {+ out += next;+ i++;+ } else if (char === '"') {+ inString = false;+ }+ } else if (char === '"') {+ inString = true;+ out += char;+ } else if (char === "/" && next === "/") {+ while (i < text.length && text[i] !== "\n") i++;+ out += "\n";+ } else if (char === "/" && next === "*") {+ i += 2;+ while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;+ i++;+ } else {+ out += char;+ }+ }+ return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));+}++async function readJson(path, jsonc = false) {+ const text = await readFile(path, "utf8");+ return jsonc ? parseJsonc(text) : JSON.parse(text);+}++async function writeJson(path, value) {+ await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, "utf8");+}++async function ensureComponentsJson(dir) {+ const path = join(dir, "components.json");+ if (!existsSync(path)) {+ await writeJson(path, COMPONENTS_JSON);+ return { path, action: "created" };+ }+ const config = await readJson(path);+ if (config.registries?.["@remocn"]) {+ return { path, action: "unchanged" };+ }+ config.registries = { ...config.registries, "@remocn": REGISTRY };+ await writeJson(path, config);+ return { path, action: "added @remocn registry" };+}++// The folder a tsconfig's "@/*" path points at, relative to the project root.+// Paths resolve against baseUrl when it is set, else against the config's own+// folder.+function aliasBase(dir, configDir, compilerOptions) {+ const target = compilerOptions?.paths?.["@/*"]?.[0];+ if (typeof target !== "string") {+ return null;+ }+ const absolute = resolve(+ configDir,+ compilerOptions.baseUrl ?? ".",+ target.replace(/\/?\*$/, ""),+ );+ return relative(dir, absolute).split(sep).join("/") || ".";+}++// Follows one level of a relative `extends`, which is how Remotion and most+// app templates use it.+async function inheritedOptions(dir, config) {+ const parent = config.extends;+ if (typeof parent !== "string" || !parent.startsWith(".")) {+ return null;+ }+ const file = resolve(+ dir,+ parent.endsWith(".json") ? parent : `${parent}.json`,+ );+ try {+ const base = await readJson(file, true);+ return { configDir: dirname(file), compilerOptions: base.compilerOptions };+ } catch {+ return null;+ }+}++async function ensureTsconfigPaths(dir) {+ const path = join(dir, "tsconfig.json");+ if (!existsSync(path)) {+ return { path, action: "missing", base: "src" };+ }+ let config;+ try {+ config = await readJson(path, true);+ } catch (error) {+ return {+ path,+ action: "unreadable",+ base: "src",+ warning: `could not parse tsconfig.json (${error.message}) — add "paths": { "@/*": ["./src/*"] } by hand`,+ };+ }++ const own = aliasBase(dir, dir, config.compilerOptions);+ if (own !== null) {+ return { path, action: "unchanged", base: own };+ }++ if (+ config.extends !== undefined &&+ config.compilerOptions?.paths === undefined+ ) {+ // A local `paths` would replace the inherited map, not merge with it.+ const parent = await inheritedOptions(dir, config);+ const inherited = parent+ ? aliasBase(dir, parent.configDir, parent.compilerOptions)+ : null;+ if (inherited !== null) {+ return { path, action: "unchanged (inherited)", base: inherited };+ }+ return {+ path,+ action: "skipped",+ base: "src",+ warning: `tsconfig.json extends ${JSON.stringify(config.extends)}, and a local "paths" would replace the inherited ones — add "@/*": ["./src/*"] where the paths are defined`,+ };+ }++ // With a baseUrl, paths resolve against it rather than the config's folder.+ const baseUrl = config.compilerOptions?.baseUrl;+ const src = baseUrl+ ? relative(resolve(dir, baseUrl), resolve(dir, "src")).split(sep).join("/")+ : "src";+ const target = src === "" ? "." : src.startsWith(".") ? src : `./${src}`;+ config.compilerOptions = {+ ...config.compilerOptions,+ paths: { ...config.compilerOptions?.paths, "@/*": [`${target}/*`] },+ };+ // Rewriting drops any comments the file had; say so rather than hide it.+ await writeJson(path, config);+ return {+ path,+ action: "added @/* path",+ base: "src",+ note: "tsconfig.json was rewritten as plain JSON",+ };+}++async function ensureBundlerAlias(dir, base) {+ const target =+ base === "."+ ? "process.cwd()"+ : `path.join(process.cwd(), ${JSON.stringify(base)})`;+ const existing = CONFIG_FILES.map((name) => join(dir, name)).find((file) =>+ existsSync(file),+ );++ if (existing === undefined) {+ const path = join(dir, "remotion.config.ts");+ await writeFile(+ path,+ `import path from "node:path";\nimport { Config } from "@remotion/cli/config";\n${ALIAS_BLOCK(target)}`,+ "utf8",+ );+ return { path, action: "created" };+ }++ const source = await readFile(existing, "utf8");+ if (source.includes(ALIAS_MARKER)) {+ return { path: existing, action: "unchanged" };+ }+ if (existing.endsWith(".js")) {+ return {+ path: existing,+ action: "skipped",+ warning: `remotion.config.js is JavaScript — add an "@" alias to ${target} through Config.overrideBundlerConfig and Config.overrideWebpackConfig by hand`,+ };+ }++ const hasPath =+ /import\s+(\*\s+as\s+)?path\s+from\s+["'](node:)?path["']/.test(source);+ const hasConfig =+ /import\s*\{[^}]*\bConfig\b[^}]*\}\s*from\s*["']@remotion\/cli\/config["']/.test(+ source,+ );+ const header = [+ hasPath ? null : 'import path from "node:path";',+ hasConfig ? null : 'import { Config } from "@remotion/cli/config";',+ ]+ .filter(Boolean)+ .join("\n");++ await writeFile(+ existing,+ `${header ? `${header}\n` : ""}${source.trimEnd()}\n${ALIAS_BLOCK(target)}`,+ "utf8",+ );+ return { path: existing, action: "added @ alias" };+}++const dir = resolve(process.argv[2] ?? ".");+const pkgPath = join(dir, "package.json");++if (!existsSync(pkgPath)) {+ process.stdout.write(+ `${JSON.stringify({ ok: false, reason: `${dir} has no package.json` }, null, 2)}\n`,+ );+ process.exit(1);+}++const pkg = await readJson(pkgPath);+const deps = { ...pkg.dependencies, ...pkg.devDependencies };+if (!deps.remotion) {+ process.stdout.write(+ `${JSON.stringify(+ {+ ok: false,+ reason: `${dir} is not a Remotion project — create one with \`npx create-video@latest --yes --blank <folder>\``,+ },+ null,+ 2,+ )}\n`,+ );+ process.exit(1);+}++const components = await ensureComponentsJson(dir);+const tsconfig = await ensureTsconfigPaths(dir);+const bundler = await ensureBundlerAlias(dir, tsconfig.base);++process.stdout.write(+ `${JSON.stringify({ ok: true, dir, components, tsconfig, bundler }, null, 2)}\n`,+);diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.jsonindex 484de8a0..b3291936 100644--- a/registry-artifacts/registry.json+++ b/registry-artifacts/registry.json@@ -3056,6 +3056,7 @@"title": "remocn UI Core","description": "Shared timeline-fold hook, theme context, and color math for remocn UI primitives.","dependencies": ["remotion", "culori"],+ "devDependencies": ["@types/culori"],"files": [{"path": "registry/remocn-ui/core/timeline.ts",diff --git a/registry-artifacts/remocn-ui.json b/registry-artifacts/remocn-ui.jsonindex 23437d6a..07318999 100644--- a/registry-artifacts/remocn-ui.json+++ b/registry-artifacts/remocn-ui.json@@ -4,6 +4,7 @@"title": "remocn UI Core","description": "Shared timeline-fold hook, theme context, and color math for remocn UI primitives.","dependencies": ["remotion", "culori"],+ "devDependencies": ["@types/culori"],"files": [{"path": "registry/remocn-ui/core/timeline.ts",diff --git a/registry/remocn-ui/registry.json b/registry/remocn-ui/registry.jsonindex 9146f805..b3e429c9 100644--- a/registry/remocn-ui/registry.json+++ b/registry/remocn-ui/registry.json@@ -9,6 +9,7 @@"title": "remocn UI Core","description": "Shared timeline-fold hook, theme context, and color math for remocn UI primitives.","dependencies": ["remotion", "culori"],+ "devDependencies": ["@types/culori"],"files": [{"path": "core/timeline.ts",diff --git a/tsconfig.json b/tsconfig.jsonindex bc7ba164..2f68403e 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -191,5 +191,10 @@".next/dev/types/**/*.ts","**/*.mts"],- "exclude": ["node_modules", "out", "**/__tests__/**"]+ "exclude": [+ "node_modules",+ "out",+ "**/__tests__/**",+ "plugins/remocn/skills/studio/assets"+ ]}