@keepylabs/cutroom 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cutroom.mjs +90 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Write hooks and scripts with scoring. Break down any reel. Tear down a creator's
|
|
|
5
5
|
## Install (one command)
|
|
6
6
|
In your terminal, with your key from the welcome email:
|
|
7
7
|
|
|
8
|
-
claude mcp add cutroom -s user -e CUTROOM_KEY=ck_yourkey -- npx -y @keepylabs/cutroom
|
|
8
|
+
claude mcp add cutroom -s user -e CUTROOM_KEY=ck_yourkey -- npx -y @keepylabs/cutroom@latest
|
|
9
9
|
|
|
10
10
|
Restart Claude Code and say "check Cutroom is ready". It checks ffmpeg and Node and installs them with your OK.
|
|
11
11
|
|
package/cutroom.mjs
CHANGED
|
@@ -21531,9 +21531,12 @@ function toError(value) {
|
|
|
21531
21531
|
return value instanceof Error ? value : new Error(String(value));
|
|
21532
21532
|
}
|
|
21533
21533
|
|
|
21534
|
+
// src/community/local/server.ts
|
|
21535
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
21536
|
+
|
|
21534
21537
|
// src/community/local/render.ts
|
|
21535
21538
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
21536
|
-
import { copyFileSync, existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
21539
|
+
import { copyFileSync, existsSync as existsSync2, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync3, renameSync, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
21537
21540
|
import { homedir as homedir2 } from "node:os";
|
|
21538
21541
|
import { basename, extname, join as join3, resolve as resolve2 } from "node:path";
|
|
21539
21542
|
|
|
@@ -22045,7 +22048,8 @@ ${tail(r.stderr) || tail(r.stdout)}`);
|
|
|
22045
22048
|
}
|
|
22046
22049
|
return { head: cached2.head, made_s };
|
|
22047
22050
|
}
|
|
22048
|
-
|
|
22051
|
+
var planFile = (folder) => join3(folder, ".cutroom", "plan.json");
|
|
22052
|
+
async function composition(input) {
|
|
22049
22053
|
const pj = resolveProject(input.project);
|
|
22050
22054
|
const work = join3(pj.folder, ".cutroom");
|
|
22051
22055
|
const words = applyFixes(pj.words, input.fixes);
|
|
@@ -22053,10 +22057,65 @@ async function renderReel(input) {
|
|
|
22053
22057
|
const cutout = await wantsCutout(input.layout, local.effects) ? ensureCutout(work, pj.duration) : null;
|
|
22054
22058
|
const { html } = await call("compose", { duration: pj.duration, words, layout: input.layout, caption: input.caption, effects: local.effects, images: local.images, emphasis: input.emphasis, brand: getBrand() ?? void 0, ...cutout ? { cutout: true, head: cutout.head } : {} });
|
|
22055
22059
|
await ensureFonts(work);
|
|
22060
|
+
writeFileSync2(join3(work, "meta.json"), JSON.stringify({ id: pj.name, name: pj.name }));
|
|
22061
|
+
return { pj, work, html, cutout, words };
|
|
22062
|
+
}
|
|
22063
|
+
var fmtT = (t) => `${t.toFixed(1)}s`;
|
|
22064
|
+
var fxLine = (f) => Object.entries(f).filter(([k]) => !["slug", "start", "dur"].includes(k)).map(([, v]) => Array.isArray(v) ? v.join(" / ") : String(v)).join(" \xB7 ");
|
|
22065
|
+
async function planReel(input) {
|
|
22066
|
+
const { pj, work, html, cutout, words } = await composition(input);
|
|
22067
|
+
const effects = [...input.effects ?? []].sort((a, b) => Number(a.start) - Number(b.start));
|
|
22068
|
+
const peak = (f) => {
|
|
22069
|
+
const d = Math.min(Math.max(Number(f.dur) || 2.5, 1.2), 5);
|
|
22070
|
+
return Math.min(pj.duration - 0.1, Number(f.start) + Math.max(d * 0.5, d - 0.55));
|
|
22071
|
+
};
|
|
22072
|
+
const plainAt = effects.length && Number(effects[0].start) > 2 ? 1.2 : null;
|
|
22073
|
+
const moments = [
|
|
22074
|
+
...plainAt !== null ? [{ t: plainAt, what: `${input.layout ?? "full-frame"} + ${input.caption ?? "two-tier"} captions`, tag: "layout + captions", at: plainAt }] : [],
|
|
22075
|
+
...effects.map((f) => ({ t: Number(f.start), what: `${f.slug}${fxLine(f) ? `: ${fxLine(f)}` : ""}`, tag: String(f.slug), at: peak(f) }))
|
|
22076
|
+
];
|
|
22077
|
+
const shots = join3(work, "storyboard");
|
|
22078
|
+
rmSync(shots, { recursive: true, force: true });
|
|
22079
|
+
writeFileSync2(join3(work, "index.html"), html);
|
|
22080
|
+
let r;
|
|
22081
|
+
try {
|
|
22082
|
+
r = sh("npx", ["--yes", HF, "snapshot", "--at", moments.map((m) => m.at.toFixed(2)).join(","), "--no-end", "--describe", "false", "-o", "storyboard", "."], work);
|
|
22083
|
+
} finally {
|
|
22084
|
+
rmSync(join3(work, "index.html"), { force: true });
|
|
22085
|
+
}
|
|
22086
|
+
const pngs = existsSync2(shots) ? readdirSync(shots).filter((f) => f.endsWith(".png")).sort() : [];
|
|
22087
|
+
if (r.status !== 0 || pngs.length < moments.length) throw new Error(`Couldn't make the storyboard. Run cutroom_doctor.
|
|
22088
|
+
${tail(r.stderr) || tail(r.stdout)}`);
|
|
22089
|
+
const board = join3(pj.folder, `${pj.name}-storyboard.jpg`);
|
|
22090
|
+
const cols = Math.min(4, moments.length);
|
|
22091
|
+
const label = (s) => s.replace(/[\\':%,]/g, " ").slice(0, 42);
|
|
22092
|
+
const inputs = pngs.slice(0, moments.length).flatMap((f) => ["-i", join3(shots, f)]);
|
|
22093
|
+
const cells = moments.map((m, k) => `[${k}:v]scale=270:480,pad=270:540:0:0:#0A0A0A,drawtext=text='${label(`${fmtT(m.t)} ${m.tag}`)}':x=10:y=496:fontsize=18:fontcolor=#F7F3E8[c${k}]`).join(";");
|
|
22094
|
+
const layoutXY = moments.map((_, k) => `${k % cols * 270}_${Math.floor(k / cols) * 540}`).join("|");
|
|
22095
|
+
const stack = moments.length === 1 ? `[c0]copy[out]` : `${moments.map((_, k) => `[c${k}]`).join("")}xstack=inputs=${moments.length}:layout=${layoutXY}:fill=#0A0A0A[out]`;
|
|
22096
|
+
const t = sh("ffmpeg", ["-nostdin", "-v", "error", "-y", ...inputs, "-filter_complex", `${cells};${stack}`, "-map", "[out]", "-frames:v", "1", "-q:v", "3", board]);
|
|
22097
|
+
if (t.status !== 0) throw new Error(`Couldn't tile the storyboard.
|
|
22098
|
+
${tail(t.stderr)}`);
|
|
22099
|
+
rmSync(shots, { recursive: true, force: true });
|
|
22100
|
+
const plan = { layout: input.layout ?? "full-frame", caption: input.caption ?? "two-tier", effects, images: input.images, emphasis: input.emphasis, fixes: input.fixes };
|
|
22101
|
+
writeFileSync2(planFile(pj.folder), JSON.stringify(plan, null, 2));
|
|
22102
|
+
const text = [
|
|
22103
|
+
`PLAN ${pj.name} ${pj.duration.toFixed(1)}s ${effects.length} effects layout: ${plan.layout} captions: ${plan.caption}${cutout ? " (cut-out ready)" : ""}`,
|
|
22104
|
+
...moments.map((m) => `${fmtT(m.t).padStart(6)} ${m.what}`),
|
|
22105
|
+
`Storyboard: ${board}`
|
|
22106
|
+
].join("\n");
|
|
22107
|
+
return { text, storyboard: board, plan, words_used: words.length, next: "Show the storyboard. On changes, plan_reel again with the new choice. On a go, render_reel with plan:true and draft:true." };
|
|
22108
|
+
}
|
|
22109
|
+
async function renderReel(input) {
|
|
22110
|
+
if (input.plan) {
|
|
22111
|
+
const folder = resolveProject(input.project).folder;
|
|
22112
|
+
if (!existsSync2(planFile(folder))) throw new Error("No plan yet for this project. Make one with plan_reel first.");
|
|
22113
|
+
input = { ...JSON.parse(readFileSync3(planFile(folder), "utf8")), project: input.project, draft: input.draft };
|
|
22114
|
+
}
|
|
22115
|
+
const { pj, work, html, cutout } = await composition(input);
|
|
22056
22116
|
const out = join3(pj.folder, `${pj.name}${input.draft ? "-draft" : ""}.mp4`);
|
|
22057
22117
|
const tmp = join3(work, "render.mp4");
|
|
22058
22118
|
writeFileSync2(join3(work, "index.html"), html);
|
|
22059
|
-
writeFileSync2(join3(work, "meta.json"), JSON.stringify({ id: pj.name, name: pj.name }));
|
|
22060
22119
|
const started = Date.now();
|
|
22061
22120
|
let r;
|
|
22062
22121
|
try {
|
|
@@ -22133,16 +22192,16 @@ Tear down a creator: call creator_teardown (compare_to = the user's own handle i
|
|
|
22133
22192
|
Finish a video (raw talking-head file: edit it, add captions or effects, make it a reel):
|
|
22134
22193
|
1. prepare_footage with the file path.
|
|
22135
22194
|
2. From the timed transcript, list words that look misheard (names, brands) and confirm spellings with the user.
|
|
22136
|
-
3. list_styles (share its gallery link so the user can see each style moving), then
|
|
22137
|
-
4. render_reel with draft:true; tell them where the file is and what QA found.
|
|
22138
|
-
5. After they approve
|
|
22195
|
+
3. Plan: list_styles (share its gallery link so the user can see each style moving), then choose one layout, one caption style and 2 to 4 effects tied to moments in the transcript (a number gets number-pop, steps get checklist, the CTA line gets comment-dm or follow-tap). Effect text uses only the user's own words and numbers. Call plan_reel with that choice and show the user the plan lines and the storyboard (one frame per moment). They change anything ("move the checklist to 30s", "swap orbit for card wall"): plan_reel again. Nothing renders until they say go. No B-roll unless they ask for it. Effects and layouts marked needs "cutout" (text behind you, orbit, card wall, cut-out layouts) first cut the speaker out of the background on this computer: about 6 seconds of work per second of video, once per video; say so before you start. Ones marked needs "images" take the user's own pictures as file paths; ask for them, or use the fallback the effect describes.
|
|
22196
|
+
4. On a go: render_reel with plan:true and draft:true; tell them where the file is and what QA found.
|
|
22197
|
+
5. After they approve the draft: render_reel with plan:true (no draft) for the final. After changes: plan_reel, then render again.
|
|
22139
22198
|
6. QA "look" lines are spots to check, not failures: busy edits often get flagged on purpose (cards running off the edge, a card over a board). For each flagged time, grab that frame with ffmpeg and look at it yourself, then tell the user which ones are real problems (with the fix) and which are the design. Technical issues (frozen picture, loudness, black frames) are real; say if a freeze is a deliberate hold.
|
|
22140
22199
|
|
|
22141
22200
|
Brand: before a user's first render, call show_brand; if none is set, offer to set it with set_brand. If they give a website or logo instead of colors, pick 3 colors from it (background, accent, highlight), show them, and save on a yes.
|
|
22142
22201
|
|
|
22143
22202
|
Results are saved in ~/Cutroom. Study only for other creators' reels: never reuse their words, footage or branding.`;
|
|
22144
22203
|
await serveStdio(() => {
|
|
22145
|
-
const server = new McpServer({ name: "cutroom", version: "0.5.
|
|
22204
|
+
const server = new McpServer({ name: "cutroom", version: "0.5.2" }, { instructions: INSTRUCTIONS });
|
|
22146
22205
|
server.registerTool("cutroom_doctor", {
|
|
22147
22206
|
description: "Check Cutroom is ready: ffmpeg on this computer and an active membership key. Returns each check with the exact fix. Run it first, and whenever a tool fails.",
|
|
22148
22207
|
inputSchema: object({})
|
|
@@ -22204,8 +22263,29 @@ ${m.text}`;
|
|
|
22204
22263
|
cut_pauses: boolean2().default(true).describe("Cut pauses longer than about half a second.")
|
|
22205
22264
|
})
|
|
22206
22265
|
}, async (input) => safe(() => prepareFootage(input)));
|
|
22266
|
+
server.registerTool("plan_reel", {
|
|
22267
|
+
description: "Step 2: the plan before anything renders. Takes the same choice as render_reel (layout, caption, effects with times, images) and returns the plan as lines plus a storyboard image: one real frame of the user's video per moment, with the effect on it, in their brand. About 10 to 20 seconds (plus the one-time cut-out if the choice needs it). Saves the plan so render_reel with plan:true renders exactly this. Show the storyboard and get a go before rendering.",
|
|
22268
|
+
inputSchema: object({
|
|
22269
|
+
project: string2().min(1).describe("The project folder returned by prepare_footage."),
|
|
22270
|
+
layout: string2().default("full-frame"),
|
|
22271
|
+
caption: string2().default("two-tier"),
|
|
22272
|
+
effects: array(object({ slug: string2(), start: number2().min(0), dur: number2().min(1.2).max(5).optional() }).passthrough()).max(12).default([]).describe("Same as render_reel: e.g. [{slug:'number-pop', start:3.2, number:'24', label:'hours later'}]."),
|
|
22273
|
+
images: array(string2()).max(8).optional().describe("Pictures for the layout, full paths on this computer."),
|
|
22274
|
+
emphasis: array(string2()).optional(),
|
|
22275
|
+
fixes: array(object({ from: string2(), to: string2() })).optional().describe("Transcript corrections; to:'' drops the word.")
|
|
22276
|
+
})
|
|
22277
|
+
}, async (input) => {
|
|
22278
|
+
try {
|
|
22279
|
+
const r = await planReel(input);
|
|
22280
|
+
return { content: [{ type: "text", text: `${r.text}
|
|
22281
|
+
|
|
22282
|
+
${r.next}` }, { type: "image", data: readFileSync4(r.storyboard).toString("base64"), mimeType: "image/jpeg" }] };
|
|
22283
|
+
} catch (e) {
|
|
22284
|
+
return failure2(e);
|
|
22285
|
+
}
|
|
22286
|
+
});
|
|
22207
22287
|
server.registerTool("render_reel", {
|
|
22208
|
-
description: "Step
|
|
22288
|
+
description: "Step 3: render the prepared footage in a Cutroom layout with a caption style and effects, on this computer, then QA it (technical checks plus every sampled frame judged). Saves <name>.mp4 and <name>.qa.md in the project folder. Use draft:true for a fast preview. Effect times are seconds in the prepared (trimmed) video. Layouts and effects that cut the speaker out of the background (see needs in list_styles) run a one-time cut-out first: about 5 to 6 seconds per second of footage, reused for later renders of the same project.",
|
|
22209
22289
|
inputSchema: object({
|
|
22210
22290
|
project: string2().min(1).describe("The project folder returned by prepare_footage."),
|
|
22211
22291
|
layout: string2().default("full-frame"),
|
|
@@ -22214,7 +22294,8 @@ ${m.text}`;
|
|
|
22214
22294
|
images: array(string2()).max(8).optional().describe("Pictures for the layout (image-cluster: 3 to 5, cutout-grid: 1 to 8, cutout-backdrop: optional): full paths of jpg, png or webp files on this computer. 8 pictures at most per reel, layout and effects together."),
|
|
22215
22295
|
emphasis: array(string2()).optional().describe("Words to highlight in captions (otherwise numbers, then the longest word of each phrase)."),
|
|
22216
22296
|
fixes: array(object({ from: string2(), to: string2() })).optional().describe("Transcript corrections; to:'' drops the word."),
|
|
22217
|
-
draft: boolean2().default(false)
|
|
22297
|
+
draft: boolean2().default(false),
|
|
22298
|
+
plan: boolean2().default(false).describe("Render the plan saved by the last plan_reel for this project (ignores layout, caption, effects and images given here).")
|
|
22218
22299
|
})
|
|
22219
22300
|
}, async (input) => safe(() => renderReel(input)));
|
|
22220
22301
|
server.registerTool("qa_video", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keepylabs/cutroom",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Cutroom for Claude Code: hooks and scripts with scoring, reel breakdowns, creator teardowns, and finishing your own videos with QA. Needs a Keepy Labs membership key.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|