@tmhs/screencast-mcp 0.49.1 → 0.50.0
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 +13 -8
- package/dist/index.js +550 -106
- package/dist/wgcRecorder.js +15 -139
- package/package.json +8 -4
- package/assets/.gitkeep +0 -0
- package/assets/icon.png +0 -0
- package/dist/cli.js +0 -516
- package/dist/context.js +0 -50
- package/dist/prompts.js +0 -95
- package/dist/resources.js +0 -93
- package/dist/server.js +0 -174
- package/dist/setup.js +0 -438
- package/dist/tools/addMarker.js +0 -93
- package/dist/tools/assembleHighlights.js +0 -69
- package/dist/tools/backdrop.js +0 -79
- package/dist/tools/bugReport.js +0 -243
- package/dist/tools/burnSubtitles.js +0 -56
- package/dist/tools/callout.js +0 -62
- package/dist/tools/chapters.js +0 -156
- package/dist/tools/clip.js +0 -52
- package/dist/tools/compress.js +0 -51
- package/dist/tools/concat.js +0 -67
- package/dist/tools/contactSheet.js +0 -113
- package/dist/tools/convert.js +0 -46
- package/dist/tools/crop.js +0 -43
- package/dist/tools/cursor.js +0 -67
- package/dist/tools/cutByTranscript.js +0 -86
- package/dist/tools/cutIdle.js +0 -84
- package/dist/tools/deleteRecording.js +0 -119
- package/dist/tools/denoise.js +0 -60
- package/dist/tools/doctor.js +0 -146
- package/dist/tools/exportGif.js +0 -57
- package/dist/tools/exportPreset.js +0 -48
- package/dist/tools/extractAudio.js +0 -65
- package/dist/tools/findText.js +0 -194
- package/dist/tools/getMediaInfo.js +0 -36
- package/dist/tools/getSession.js +0 -40
- package/dist/tools/indexRecording.js +0 -195
- package/dist/tools/keystrokeOverlay.js +0 -90
- package/dist/tools/listAudioDevices.js +0 -35
- package/dist/tools/listSessions.js +0 -28
- package/dist/tools/listTargets.js +0 -76
- package/dist/tools/listVideoDevices.js +0 -26
- package/dist/tools/musicBed.js +0 -55
- package/dist/tools/narrate.js +0 -86
- package/dist/tools/normalizeAudio.js +0 -59
- package/dist/tools/overlay.js +0 -62
- package/dist/tools/pauseRecording.js +0 -44
- package/dist/tools/pipeline.js +0 -397
- package/dist/tools/readEvents.js +0 -98
- package/dist/tools/redactRegion.js +0 -62
- package/dist/tools/reframe.js +0 -46
- package/dist/tools/resumeRecording.js +0 -46
- package/dist/tools/reviewRecording.js +0 -163
- package/dist/tools/sampleFrames.js +0 -200
- package/dist/tools/saveReplay.js +0 -90
- package/dist/tools/scale.js +0 -44
- package/dist/tools/screenDiff.js +0 -86
- package/dist/tools/screenshot.js +0 -76
- package/dist/tools/searchRecording.js +0 -79
- package/dist/tools/speed.js +0 -46
- package/dist/tools/startRecording.js +0 -398
- package/dist/tools/stepGuide.js +0 -249
- package/dist/tools/stopRecording.js +0 -132
- package/dist/tools/titleCard.js +0 -67
- package/dist/tools/transcribe.js +0 -66
- package/dist/tools/trim.js +0 -57
- package/dist/tools/waitForChange.js +0 -142
- package/dist/tools/xfadeTransition.js +0 -58
- package/dist/tools/zoom.js +0 -134
- package/dist/utils/anim.js +0 -54
- package/dist/utils/animExport.js +0 -56
- package/dist/utils/argPaths.js +0 -39
- package/dist/utils/audio.js +0 -117
- package/dist/utils/audioDevices.js +0 -107
- package/dist/utils/backdrop.js +0 -162
- package/dist/utils/bugReport.js +0 -195
- package/dist/utils/callout.js +0 -132
- package/dist/utils/calloutAssets.js +0 -42
- package/dist/utils/capabilities.js +0 -96
- package/dist/utils/captions.js +0 -104
- package/dist/utils/chapters.js +0 -227
- package/dist/utils/consent.js +0 -29
- package/dist/utils/cursor.js +0 -338
- package/dist/utils/diff.js +0 -186
- package/dist/utils/errors.js +0 -29
- package/dist/utils/events.js +0 -403
- package/dist/utils/expr.js +0 -11
- package/dist/utils/ffmpeg.js +0 -285
- package/dist/utils/fontCoverage.js +0 -177
- package/dist/utils/fonts.js +0 -154
- package/dist/utils/frameQueue.js +0 -50
- package/dist/utils/gpu.js +0 -219
- package/dist/utils/idle.js +0 -91
- package/dist/utils/images.js +0 -38
- package/dist/utils/jobs.js +0 -129
- package/dist/utils/keystrokes.js +0 -198
- package/dist/utils/lifecycle.js +0 -233
- package/dist/utils/logging.js +0 -75
- package/dist/utils/media.js +0 -584
- package/dist/utils/monitors.js +0 -124
- package/dist/utils/narrate.js +0 -233
- package/dist/utils/ocr.js +0 -222
- package/dist/utils/ocrScan.js +0 -93
- package/dist/utils/paths.js +0 -155
- package/dist/utils/pause.js +0 -190
- package/dist/utils/pipeline.js +0 -361
- package/dist/utils/player.js +0 -85
- package/dist/utils/pool.js +0 -29
- package/dist/utils/produce.js +0 -300
- package/dist/utils/recipes.js +0 -71
- package/dist/utils/recorder.js +0 -173
- package/dist/utils/recordingFiles.js +0 -32
- package/dist/utils/recordingIndex.js +0 -312
- package/dist/utils/replay.js +0 -283
- package/dist/utils/resolveTarget.js +0 -25
- package/dist/utils/retention.js +0 -48
- package/dist/utils/roots.js +0 -43
- package/dist/utils/sessions.js +0 -499
- package/dist/utils/sheet.js +0 -82
- package/dist/utils/stepGuide.js +0 -231
- package/dist/utils/steps.js +0 -88
- package/dist/utils/still.js +0 -38
- package/dist/utils/targetList.js +0 -64
- package/dist/utils/targets.js +0 -265
- package/dist/utils/timeline.js +0 -85
- package/dist/utils/toolSpec.js +0 -31
- package/dist/utils/toolsets.js +0 -134
- package/dist/utils/transcriptCut.js +0 -149
- package/dist/utils/validate.js +0 -23
- package/dist/utils/waitLoop.js +0 -50
- package/dist/utils/wgc.js +0 -84
- package/dist/utils/windows.js +0 -192
- package/dist/utils/zoom.js +0 -252
package/dist/setup.js
DELETED
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
5
|
-
import { createInterface } from "node:readline/promises";
|
|
6
|
-
import { errorMessage } from "./utils/errors.js";
|
|
7
|
-
export const CLIENT_IDS = ["claude-desktop", "claude-code", "cursor", "vscode"];
|
|
8
|
-
export const SETUP_USAGE = `setup options:
|
|
9
|
-
--yes answer yes: install FFmpeg and write client configs without asking
|
|
10
|
-
--dry-run print the checks and the config changes; change nothing
|
|
11
|
-
--clients <list> detected (default) | none | a comma list of
|
|
12
|
-
${CLIENT_IDS.join(", ")}
|
|
13
|
-
--no-install never offer to install FFmpeg
|
|
14
|
-
--force replace an existing, different "screencast" server entry
|
|
15
|
-
--test record a 3 s test clip and export a GIF
|
|
16
|
-
|
|
17
|
-
setup exits 0 when the doctor checks pass, 1 when something still needs fixing.
|
|
18
|
-
`;
|
|
19
|
-
export const PACKAGE = "@tmhs/screencast-mcp";
|
|
20
|
-
export const SERVER_NAME = "screencast";
|
|
21
|
-
const NPX = { command: "npx", args: ["-y", PACKAGE] };
|
|
22
|
-
export const WINGET_FFMPEG = ["install", "--id", "Gyan.FFmpeg", "-e", "--accept-source-agreements", "--accept-package-agreements"];
|
|
23
|
-
export function parseSetupArgs(argv) {
|
|
24
|
-
const options = { yes: false, dryRun: false, install: true, clients: "detected", force: false, test: false };
|
|
25
|
-
for (let i = 0; i < argv.length; i++) {
|
|
26
|
-
const raw = argv[i] ?? "";
|
|
27
|
-
const eq = raw.startsWith("--") ? raw.indexOf("=") : -1;
|
|
28
|
-
const flag = eq === -1 ? raw : raw.slice(0, eq);
|
|
29
|
-
switch (flag) {
|
|
30
|
-
case "--yes":
|
|
31
|
-
case "-y":
|
|
32
|
-
options.yes = true;
|
|
33
|
-
break;
|
|
34
|
-
case "--dry-run":
|
|
35
|
-
options.dryRun = true;
|
|
36
|
-
break;
|
|
37
|
-
case "--no-install":
|
|
38
|
-
options.install = false;
|
|
39
|
-
break;
|
|
40
|
-
case "--force":
|
|
41
|
-
options.force = true;
|
|
42
|
-
break;
|
|
43
|
-
case "--test":
|
|
44
|
-
options.test = true;
|
|
45
|
-
break;
|
|
46
|
-
case "--clients": {
|
|
47
|
-
let value;
|
|
48
|
-
if (eq !== -1)
|
|
49
|
-
value = raw.slice(eq + 1);
|
|
50
|
-
else
|
|
51
|
-
value = argv[++i];
|
|
52
|
-
if (value === undefined || value === "")
|
|
53
|
-
throw new Error("--clients needs a value.");
|
|
54
|
-
if (value === "detected" || value === "none") {
|
|
55
|
-
options.clients = value;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
const ids = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
59
|
-
const bad = ids.filter((id) => !CLIENT_IDS.includes(id));
|
|
60
|
-
if (bad.length > 0) {
|
|
61
|
-
throw new Error(`--clients: unknown client ${bad.map((b) => `"${b}"`).join(", ")}; use ${CLIENT_IDS.join(", ")}, detected, or none.`);
|
|
62
|
-
}
|
|
63
|
-
options.clients = ids;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
default:
|
|
67
|
-
throw new Error(`Unknown setup option "${raw}". Run screencast-mcp --help.`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return options;
|
|
71
|
-
}
|
|
72
|
-
function appData(deps) {
|
|
73
|
-
return deps.env.APPDATA ?? join(deps.home, "AppData", "Roaming");
|
|
74
|
-
}
|
|
75
|
-
export function jsonClients(deps) {
|
|
76
|
-
const roaming = appData(deps);
|
|
77
|
-
return [
|
|
78
|
-
{
|
|
79
|
-
id: "claude-desktop",
|
|
80
|
-
name: "Claude Desktop",
|
|
81
|
-
path: join(roaming, "Claude", "claude_desktop_config.json"),
|
|
82
|
-
key: "mcpServers",
|
|
83
|
-
entry: NPX,
|
|
84
|
-
marker: join(roaming, "Claude"),
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: "cursor",
|
|
88
|
-
name: "Cursor",
|
|
89
|
-
path: join(deps.home, ".cursor", "mcp.json"),
|
|
90
|
-
key: "mcpServers",
|
|
91
|
-
entry: NPX,
|
|
92
|
-
marker: join(deps.home, ".cursor"),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "vscode",
|
|
96
|
-
name: "VS Code",
|
|
97
|
-
path: join(roaming, "Code", "User", "mcp.json"),
|
|
98
|
-
key: "servers",
|
|
99
|
-
entry: { type: "stdio", ...NPX },
|
|
100
|
-
marker: join(roaming, "Code", "User"),
|
|
101
|
-
},
|
|
102
|
-
];
|
|
103
|
-
}
|
|
104
|
-
export function claudeCodeArgs(platform) {
|
|
105
|
-
const run = platform === "win32" ? ["cmd", "/c", "npx", "-y", PACKAGE] : ["npx", "-y", PACKAGE];
|
|
106
|
-
return ["mcp", "add", "--scope", "user", SERVER_NAME, "--", ...run];
|
|
107
|
-
}
|
|
108
|
-
const sameJson = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
109
|
-
export function mergeServerConfig(existing, key, name, entry, force = false) {
|
|
110
|
-
let config = {};
|
|
111
|
-
if (existing !== null && existing.trim() !== "") {
|
|
112
|
-
let parsed;
|
|
113
|
-
try {
|
|
114
|
-
parsed = JSON.parse(existing.charCodeAt(0) === 0xfeff ? existing.slice(1) : existing);
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
return { status: "invalid", reason: `not plain JSON (${errorMessage(err)})` };
|
|
118
|
-
}
|
|
119
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
120
|
-
return { status: "invalid", reason: "the file is not a JSON object" };
|
|
121
|
-
}
|
|
122
|
-
config = parsed;
|
|
123
|
-
}
|
|
124
|
-
const servers = config[key] ?? {};
|
|
125
|
-
if (typeof servers !== "object" || servers === null || Array.isArray(servers)) {
|
|
126
|
-
return { status: "invalid", reason: `"${key}" is not an object` };
|
|
127
|
-
}
|
|
128
|
-
const current = servers[name];
|
|
129
|
-
if (current !== undefined) {
|
|
130
|
-
if (sameJson(current, entry))
|
|
131
|
-
return { status: "unchanged" };
|
|
132
|
-
if (!force)
|
|
133
|
-
return { status: "conflict", existing: current };
|
|
134
|
-
}
|
|
135
|
-
const next = { ...config, [key]: { ...servers, [name]: entry } };
|
|
136
|
-
return { status: "added", text: JSON.stringify(next, null, 2) + "\n" };
|
|
137
|
-
}
|
|
138
|
-
export function lineDiff(before, after) {
|
|
139
|
-
const a = before === "" ? [] : before.replace(/\n$/, "").split("\n");
|
|
140
|
-
const b = after === "" ? [] : after.replace(/\n$/, "").split("\n");
|
|
141
|
-
const lcs = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
|
|
142
|
-
for (let i = a.length - 1; i >= 0; i--) {
|
|
143
|
-
for (let j = b.length - 1; j >= 0; j--) {
|
|
144
|
-
lcs[i][j] = a[i] === b[j] ? lcs[i + 1][j + 1] + 1 : Math.max(lcs[i + 1][j], lcs[i][j + 1]);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const out = [];
|
|
148
|
-
let i = 0;
|
|
149
|
-
let j = 0;
|
|
150
|
-
while (i < a.length || j < b.length) {
|
|
151
|
-
if (i < a.length && j < b.length && a[i] === b[j]) {
|
|
152
|
-
out.push(` ${a[i]}`);
|
|
153
|
-
i++;
|
|
154
|
-
j++;
|
|
155
|
-
}
|
|
156
|
-
else if (j < b.length && (i >= a.length || lcs[i][j + 1] >= lcs[i + 1][j])) {
|
|
157
|
-
out.push(`+ ${b[j]}`);
|
|
158
|
-
j++;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
out.push(`- ${a[i]}`);
|
|
162
|
-
i++;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return out.join("\n") + "\n";
|
|
166
|
-
}
|
|
167
|
-
export function backupPath(path, now) {
|
|
168
|
-
const p = (n) => String(n).padStart(2, "0");
|
|
169
|
-
const stamp = `${now.getFullYear()}${p(now.getMonth() + 1)}${p(now.getDate())}-${p(now.getHours())}${p(now.getMinutes())}${p(now.getSeconds())}`;
|
|
170
|
-
return `${path}.bak-${stamp}`;
|
|
171
|
-
}
|
|
172
|
-
export function checklist(report, env, platform) {
|
|
173
|
-
const lines = [];
|
|
174
|
-
const nodeMajor = Number((report.server?.node ?? process.version).replace(/^v/, "").split(".")[0]);
|
|
175
|
-
lines.push({ state: nodeMajor >= 22 ? "ok" : "fail", text: `Node.js ${report.server?.node ?? process.version}${nodeMajor >= 22 ? "" : " (needs 22+)"}` });
|
|
176
|
-
const ff = report.ffmpeg ?? {};
|
|
177
|
-
if (!ff.found)
|
|
178
|
-
lines.push({ state: "fail", text: "FFmpeg not found on PATH (or FFMPEG_PATH)" });
|
|
179
|
-
else if (ff.meetsFfmpeg8 === false)
|
|
180
|
-
lines.push({ state: "warn", text: `FFmpeg ${ff.version ?? "?"}: works, but transcribe and backend "wgc" need FFmpeg 8+` });
|
|
181
|
-
else
|
|
182
|
-
lines.push({ state: "ok", text: `FFmpeg ${ff.version ?? "?"}${ff.path ? ` (${ff.path})` : ""}` });
|
|
183
|
-
lines.push(report.ffprobe?.found ? { state: "ok", text: `ffprobe ${report.ffprobe.version ?? ""}`.trim() } : { state: "fail", text: "ffprobe not found" });
|
|
184
|
-
if (platform === "win32") {
|
|
185
|
-
lines.push({ state: report.devices?.gdigrab ? "ok" : "fail", text: report.devices?.gdigrab ? "Screen capture (gdigrab)" : "No gdigrab: this ffmpeg cannot capture the screen" });
|
|
186
|
-
lines.push({ state: report.wgc?.available ? "ok" : "info", text: report.wgc?.available ? "Windows Graphics Capture (backend wgc)" : 'Windows Graphics Capture unavailable (backend "wgc" needs FFmpeg 8)' });
|
|
187
|
-
lines.push(report.ocr?.available
|
|
188
|
-
? { state: "ok", text: `Windows OCR${report.ocr.language ? ` (${report.ocr.language})` : ""}` }
|
|
189
|
-
: { state: "warn", text: "Windows OCR unavailable: find_text cannot read the screen (add an OCR language in Settings > Time & language > Language)" });
|
|
190
|
-
if (report.tts) {
|
|
191
|
-
lines.push(report.tts.available ? { state: "ok", text: "Windows speech (narrate)" } : { state: "warn", text: "No Windows voice: narrate cannot speak" });
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
lines.push({ state: "warn", text: "Not Windows: capture and OCR are unavailable; the edit and watch tools work" });
|
|
196
|
-
}
|
|
197
|
-
const model = report.env?.SCREENCAST_WHISPER_MODEL ?? env.SCREENCAST_WHISPER_MODEL;
|
|
198
|
-
lines.push(model
|
|
199
|
-
? { state: "ok", text: `Whisper model: ${model}` }
|
|
200
|
-
: { state: "info", text: "transcribe needs a Whisper model: download a ggml model and set SCREENCAST_WHISPER_MODEL to its path" });
|
|
201
|
-
return lines;
|
|
202
|
-
}
|
|
203
|
-
const MARK = { ok: "[ok] ", warn: "[warn]", fail: "[fail]", info: "[info]" };
|
|
204
|
-
async function configureJsonClient(client, opts, deps) {
|
|
205
|
-
const { fs } = deps;
|
|
206
|
-
const had = fs.exists(client.path);
|
|
207
|
-
let text = null;
|
|
208
|
-
if (had) {
|
|
209
|
-
try {
|
|
210
|
-
text = fs.readFile(client.path);
|
|
211
|
-
}
|
|
212
|
-
catch (err) {
|
|
213
|
-
deps.out(` ${client.name}: could not read ${client.path}: ${errorMessage(err)}\n`);
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
const merged = mergeServerConfig(text, client.key, SERVER_NAME, client.entry, opts.force);
|
|
218
|
-
switch (merged.status) {
|
|
219
|
-
case "unchanged":
|
|
220
|
-
deps.out(` ${client.name}: already configured (${client.path})\n`);
|
|
221
|
-
return true;
|
|
222
|
-
case "invalid":
|
|
223
|
-
deps.out(` ${client.name}: left ${client.path} alone: ${merged.reason}. Add the server by hand (see docs/connect.html).\n`);
|
|
224
|
-
return false;
|
|
225
|
-
case "conflict":
|
|
226
|
-
deps.out(` ${client.name}: ${client.path} already has a different "${SERVER_NAME}" entry; kept it (pass --force to replace).\n`);
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
if (opts.dryRun) {
|
|
230
|
-
deps.out(` ${client.name}: would ${had ? "update" : "create"} ${client.path}:\n`);
|
|
231
|
-
deps.out(lineDiff(text ?? "", merged.text).replace(/^/gm, " "));
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
if (!opts.yes && !(await deps.confirm(`Add the screencast server to ${client.name} (${client.path})?`))) {
|
|
235
|
-
deps.out(` ${client.name}: skipped (run with --yes to write it, or --dry-run to see the change).\n`);
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
try {
|
|
239
|
-
let backup = null;
|
|
240
|
-
if (had) {
|
|
241
|
-
backup = backupPath(client.path, deps.now());
|
|
242
|
-
fs.copyFile(client.path, backup);
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
fs.mkdir(dirname(client.path));
|
|
246
|
-
}
|
|
247
|
-
fs.writeFile(client.path, merged.text);
|
|
248
|
-
deps.out(` ${client.name}: ${had ? "updated" : "created"} ${client.path}${backup ? ` (backup: ${backup})` : ""}. Restart it to load the server.\n`);
|
|
249
|
-
return true;
|
|
250
|
-
}
|
|
251
|
-
catch (err) {
|
|
252
|
-
deps.out(` ${client.name}: could not write ${client.path}: ${errorMessage(err)}\n`);
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
async function configureClaudeCode(opts, deps) {
|
|
257
|
-
const args = claudeCodeArgs(deps.platform);
|
|
258
|
-
const existing = await deps.exec("claude", ["mcp", "get", SERVER_NAME]);
|
|
259
|
-
if (existing.code === 0) {
|
|
260
|
-
deps.out(` Claude Code: already has a "${SERVER_NAME}" server (claude mcp get ${SERVER_NAME}).\n`);
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
if (opts.dryRun) {
|
|
264
|
-
deps.out(` Claude Code: would run: claude ${args.join(" ")}\n`);
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
if (!opts.yes && !(await deps.confirm("Add the screencast server to Claude Code (user scope)?"))) {
|
|
268
|
-
deps.out(` Claude Code: skipped. To add it yourself: claude ${args.join(" ")}\n`);
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
const res = await deps.exec("claude", args);
|
|
272
|
-
if (res.code !== 0) {
|
|
273
|
-
deps.out(` Claude Code: claude mcp add failed (${(res.stderr || res.stdout).trim() || `exit ${res.code}`}).\n`);
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
deps.out(" Claude Code: added (user scope). Check it with claude mcp list.\n");
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
async function detectedClients(deps) {
|
|
280
|
-
const found = [];
|
|
281
|
-
for (const c of jsonClients(deps))
|
|
282
|
-
if (deps.fs.exists(c.marker))
|
|
283
|
-
found.push(c.id);
|
|
284
|
-
const claude = await deps.exec("claude", ["--version"]).catch(() => ({ code: 1, stdout: "", stderr: "" }));
|
|
285
|
-
if (claude.code === 0)
|
|
286
|
-
found.push("claude-code");
|
|
287
|
-
return CLIENT_IDS.filter((id) => found.includes(id));
|
|
288
|
-
}
|
|
289
|
-
export async function runSetup(opts, deps) {
|
|
290
|
-
const say = deps.out;
|
|
291
|
-
say(`screencast-mcp setup${opts.dryRun ? " (dry run: nothing is installed or written)" : ""}\n\n`);
|
|
292
|
-
let report;
|
|
293
|
-
try {
|
|
294
|
-
report = await deps.doctor();
|
|
295
|
-
}
|
|
296
|
-
catch (err) {
|
|
297
|
-
deps.err(`screencast-mcp: the doctor checks failed to run: ${errorMessage(err)}\n`);
|
|
298
|
-
return 1;
|
|
299
|
-
}
|
|
300
|
-
for (const line of checklist(report, deps.env, deps.platform))
|
|
301
|
-
say(`${MARK[line.state]} ${line.text}\n`);
|
|
302
|
-
const problems = report.problems ?? [];
|
|
303
|
-
if (problems.length > 0) {
|
|
304
|
-
say("\nWhat doctor says to fix:\n");
|
|
305
|
-
for (const p of problems)
|
|
306
|
-
say(` - ${p}\n`);
|
|
307
|
-
}
|
|
308
|
-
const ff = report.ffmpeg ?? {};
|
|
309
|
-
const needsFfmpeg = !ff.found || ff.meetsFfmpeg8 === false;
|
|
310
|
-
if (needsFfmpeg && opts.install && deps.platform === "win32") {
|
|
311
|
-
const line = `winget ${WINGET_FFMPEG.join(" ")}`;
|
|
312
|
-
say(`\nFFmpeg 8 ${ff.found ? "is not installed (found an older one)" : "is missing"}.\n`);
|
|
313
|
-
if (opts.dryRun) {
|
|
314
|
-
say(` would run: ${line}\n`);
|
|
315
|
-
}
|
|
316
|
-
else if (opts.yes || (await deps.confirm("Install FFmpeg 8 with winget now?"))) {
|
|
317
|
-
say(` running: ${line}\n`);
|
|
318
|
-
const res = await deps.exec("winget", WINGET_FFMPEG).catch((err) => ({
|
|
319
|
-
code: 1,
|
|
320
|
-
stdout: "",
|
|
321
|
-
stderr: errorMessage(err),
|
|
322
|
-
}));
|
|
323
|
-
if (res.code === 0)
|
|
324
|
-
say(" FFmpeg installed. Open a new terminal so PATH picks it up, then run setup again.\n");
|
|
325
|
-
else
|
|
326
|
-
say(` winget failed (${(res.stderr || res.stdout).trim().split("\n").pop() || `exit ${res.code}`}). Install it yourself: ${line}\n`);
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
say(` skipped. Install it yourself: ${line}\n`);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if (opts.clients !== "none") {
|
|
333
|
-
const ids = opts.clients === "detected" ? await detectedClients(deps) : opts.clients;
|
|
334
|
-
say("\nMCP clients:\n");
|
|
335
|
-
if (ids.length === 0) {
|
|
336
|
-
say(" none found (Claude Desktop, Claude Code, Cursor, VS Code). Name one with --clients, or see docs/connect.html.\n");
|
|
337
|
-
}
|
|
338
|
-
const byId = new Map(jsonClients(deps).map((c) => [c.id, c]));
|
|
339
|
-
for (const id of ids) {
|
|
340
|
-
const json = byId.get(id);
|
|
341
|
-
if (json)
|
|
342
|
-
await configureJsonClient(json, opts, deps);
|
|
343
|
-
else
|
|
344
|
-
await configureClaudeCode(opts, deps);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (opts.test) {
|
|
348
|
-
say("\nTest clip:\n");
|
|
349
|
-
if (opts.dryRun) {
|
|
350
|
-
say(" would record 3 s of the screen and export a GIF.\n");
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
try {
|
|
354
|
-
const gif = await deps.testClip();
|
|
355
|
-
say(` recorded 3 s and exported ${gif}\n`);
|
|
356
|
-
await deps.open(gif).catch(() => undefined);
|
|
357
|
-
}
|
|
358
|
-
catch (err) {
|
|
359
|
-
say(` the test clip failed: ${errorMessage(err)}\n`);
|
|
360
|
-
return 1;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
const ok = report.ok ?? problems.length === 0;
|
|
365
|
-
say(ok ? "\nAll checks passed.\n" : "\nSome checks need attention (above). Run setup again after fixing them.\n");
|
|
366
|
-
return ok ? 0 : 1;
|
|
367
|
-
}
|
|
368
|
-
function execReal(platform) {
|
|
369
|
-
return (cmd, args) => new Promise((resolveExec) => {
|
|
370
|
-
const child = spawn(cmd, args, { shell: platform === "win32", windowsHide: true });
|
|
371
|
-
let stdout = "";
|
|
372
|
-
let stderr = "";
|
|
373
|
-
child.stdout?.on("data", (d) => (stdout += d.toString()));
|
|
374
|
-
child.stderr?.on("data", (d) => (stderr += d.toString()));
|
|
375
|
-
child.on("error", (err) => resolveExec({ code: 127, stdout, stderr: err.message }));
|
|
376
|
-
child.on("close", (code) => resolveExec({ code: code ?? 1, stdout, stderr }));
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
const realFs = {
|
|
380
|
-
exists: (p) => existsSync(p),
|
|
381
|
-
readFile: (p) => readFileSync(p, "utf8"),
|
|
382
|
-
writeFile: (p, s) => writeFileSync(p, s),
|
|
383
|
-
mkdir: (p) => void mkdirSync(p, { recursive: true }),
|
|
384
|
-
copyFile: (a, b) => copyFileSync(a, b),
|
|
385
|
-
};
|
|
386
|
-
export function defaultSetupDeps(base) {
|
|
387
|
-
const platform = process.platform;
|
|
388
|
-
const exec = execReal(platform);
|
|
389
|
-
const withClient = async (fn) => {
|
|
390
|
-
const client = await base.connect();
|
|
391
|
-
try {
|
|
392
|
-
return await fn(client);
|
|
393
|
-
}
|
|
394
|
-
finally {
|
|
395
|
-
await client.close();
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
const must = async (c, name, args) => {
|
|
399
|
-
const res = await c.call(name, args);
|
|
400
|
-
if (res.isError)
|
|
401
|
-
throw new Error(`${name}: ${res.text}`);
|
|
402
|
-
return res.structured ?? {};
|
|
403
|
-
};
|
|
404
|
-
return {
|
|
405
|
-
out: base.io.out,
|
|
406
|
-
err: base.io.err,
|
|
407
|
-
env: process.env,
|
|
408
|
-
platform,
|
|
409
|
-
home: homedir(),
|
|
410
|
-
fs: realFs,
|
|
411
|
-
exec,
|
|
412
|
-
doctor: () => withClient(async (c) => (await must(c, "doctor", {}))),
|
|
413
|
-
confirm: async (question) => {
|
|
414
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
415
|
-
return false;
|
|
416
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
417
|
-
try {
|
|
418
|
-
return /^y(es)?$/i.test((await rl.question(`${question} [y/N] `)).trim());
|
|
419
|
-
}
|
|
420
|
-
finally {
|
|
421
|
-
rl.close();
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
testClip: () => withClient(async (c) => {
|
|
425
|
-
const started = await must(c, "start_recording", { target: "full", fps: 15, maxDurationSec: 30 });
|
|
426
|
-
await new Promise((r) => setTimeout(r, 3000));
|
|
427
|
-
const stopped = await must(c, "stop_recording", { sessionId: String(started.sessionId) });
|
|
428
|
-
const gif = await must(c, "export_gif", { input: String(stopped.outputPath) });
|
|
429
|
-
return String(gif.outputPath);
|
|
430
|
-
}),
|
|
431
|
-
open: async (path) => {
|
|
432
|
-
if (platform !== "win32" || !process.stdout.isTTY)
|
|
433
|
-
return;
|
|
434
|
-
spawn("explorer.exe", [path], { detached: true, stdio: "ignore" }).unref();
|
|
435
|
-
},
|
|
436
|
-
now: () => new Date(),
|
|
437
|
-
};
|
|
438
|
-
}
|
package/dist/tools/addMarker.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { errorMessage, errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
-
import { looseOutput } from "../utils/toolSpec.js";
|
|
5
|
-
import { assertOutputAllowed } from "../utils/paths.js";
|
|
6
|
-
import { cleanLabel, insertMarker, markerTimeSec, markersPath, readMarkers, writeMarkers, MAX_LABEL, } from "../utils/chapters.js";
|
|
7
|
-
import { getStore } from "../context.js";
|
|
8
|
-
import { recordedSec } from "../utils/pause.js";
|
|
9
|
-
const ADDS_MARKER = {
|
|
10
|
-
readOnlyHint: false,
|
|
11
|
-
destructiveHint: false,
|
|
12
|
-
idempotentHint: false,
|
|
13
|
-
openWorldHint: false,
|
|
14
|
-
};
|
|
15
|
-
const inputSchema = {
|
|
16
|
-
label: z.string().min(1).max(MAX_LABEL).describe('e.g. "bug appears".'),
|
|
17
|
-
sessionId: z.string().min(1).optional().describe("Recording to mark (a stopped one needs at)."),
|
|
18
|
-
input: z.string().min(1).optional().describe("Or a video path (needs at)."),
|
|
19
|
-
at: z
|
|
20
|
-
.number()
|
|
21
|
-
.min(0)
|
|
22
|
-
.optional()
|
|
23
|
-
.describe("Video second (default: now, while recording)."),
|
|
24
|
-
};
|
|
25
|
-
export function register(server) {
|
|
26
|
-
server.registerTool("add_marker", {
|
|
27
|
-
title: "Add Marker",
|
|
28
|
-
description: "Mark a labelled moment on a recording, live or at a second. Kept in the session and a sidecar; " +
|
|
29
|
-
"chapters and pipeline turn markers into chapters.",
|
|
30
|
-
inputSchema,
|
|
31
|
-
outputSchema: looseOutput({ count: z.number().int(), markersPath: z.string() }),
|
|
32
|
-
annotations: ADDS_MARKER,
|
|
33
|
-
}, async (args) => {
|
|
34
|
-
try {
|
|
35
|
-
if (!args.sessionId && !args.input)
|
|
36
|
-
throw new ScreencastError("Pass sessionId or input.");
|
|
37
|
-
if (args.sessionId) {
|
|
38
|
-
const store = getStore();
|
|
39
|
-
const record = store.get(args.sessionId);
|
|
40
|
-
if (!record)
|
|
41
|
-
throw new ScreencastError(`No session with id "${args.sessionId}".`);
|
|
42
|
-
let t = args.at;
|
|
43
|
-
if (t === undefined && record.status === "paused") {
|
|
44
|
-
t = recordedSec(record.segments?.parts ?? []);
|
|
45
|
-
}
|
|
46
|
-
else if (t === undefined) {
|
|
47
|
-
if (record.status !== "recording") {
|
|
48
|
-
throw new ScreencastError(`Session "${args.sessionId}" is ${record.status}, so there is no "now" to mark.`, "Pass at (video seconds) to mark a stopped recording.");
|
|
49
|
-
}
|
|
50
|
-
t = markerTimeSec(record.videoStartMs ?? Date.parse(record.startedAt), Date.now());
|
|
51
|
-
}
|
|
52
|
-
else if (record.durationSec != null && t > record.durationSec) {
|
|
53
|
-
throw new ScreencastError(`at ${t}s is past the end of the recording (${record.durationSec}s).`);
|
|
54
|
-
}
|
|
55
|
-
const marker = { t, label: args.label, at: new Date().toISOString() };
|
|
56
|
-
const markers = insertMarker(record.markers ?? [], marker);
|
|
57
|
-
store.update(args.sessionId, { markers });
|
|
58
|
-
let sidecar = markersPath(record.outputPath);
|
|
59
|
-
let warning;
|
|
60
|
-
try {
|
|
61
|
-
sidecar = writeMarkers(record.outputPath, markers, args.sessionId);
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
warning = `Saved in the session, but the sidecar ${sidecar} could not be written: ${errorMessage(err)}`;
|
|
65
|
-
}
|
|
66
|
-
return okResponse({
|
|
67
|
-
sessionId: args.sessionId,
|
|
68
|
-
marker: { t: Math.round(t * 1000) / 1000, label: cleanLabel(args.label) },
|
|
69
|
-
count: markers.length,
|
|
70
|
-
markersPath: sidecar,
|
|
71
|
-
...(record.status === "recording" || record.status === "paused" ? { live: true } : {}),
|
|
72
|
-
...(warning ? { warning } : {}),
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
const input = args.input;
|
|
76
|
-
if (args.at === undefined)
|
|
77
|
-
throw new ScreencastError("Pass at (video seconds) to mark a file.");
|
|
78
|
-
if (!existsSync(input))
|
|
79
|
-
throw new ScreencastError(`Input file not found: ${input}`);
|
|
80
|
-
assertOutputAllowed(markersPath(input));
|
|
81
|
-
const markers = insertMarker(readMarkers(input), { t: args.at, label: args.label, at: new Date().toISOString() });
|
|
82
|
-
const path = writeMarkers(input, markers);
|
|
83
|
-
return okResponse({
|
|
84
|
-
marker: { t: Math.round(args.at * 1000) / 1000, label: cleanLabel(args.label) },
|
|
85
|
-
count: markers.length,
|
|
86
|
-
markersPath: path,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
return errorResponse(error);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
-
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
|
-
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
6
|
-
import { runEditJob } from "../utils/jobs.js";
|
|
7
|
-
import { buildAssembleArgs, clipLength, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
|
|
8
|
-
import { assertEditContainer } from "../utils/media.js";
|
|
9
|
-
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
10
|
-
const inputSchema = {
|
|
11
|
-
clips: z
|
|
12
|
-
.array(z.string().min(1))
|
|
13
|
-
.min(2)
|
|
14
|
-
.describe("Clip paths, in order."),
|
|
15
|
-
transition: z
|
|
16
|
-
.string()
|
|
17
|
-
.optional()
|
|
18
|
-
.describe("cut (default) or an xfade name (fade, wipeleft, slideup, ...)."),
|
|
19
|
-
duration: z
|
|
20
|
-
.number()
|
|
21
|
-
.positive()
|
|
22
|
-
.optional()
|
|
23
|
-
.describe(`Transition seconds (default ${DEFAULT_TRANSITION_DUR}).`),
|
|
24
|
-
width: z.number().int().positive().optional().describe("Common output width (default 1920)."),
|
|
25
|
-
height: z.number().int().positive().optional().describe("Common output height (default 1080)."),
|
|
26
|
-
fps: z.number().int().positive().optional().describe("Common output fps (default 30)."),
|
|
27
|
-
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
28
|
-
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
29
|
-
};
|
|
30
|
-
export function register(server) {
|
|
31
|
-
server.registerTool("assemble_highlights", {
|
|
32
|
-
title: "Assemble Highlights",
|
|
33
|
-
description: "Stitch clips (including title cards) into one video with cuts or xfade transitions; they " +
|
|
34
|
-
"need not match in size, fps, or audio.",
|
|
35
|
-
inputSchema,
|
|
36
|
-
outputSchema: OUTPUT_PATH,
|
|
37
|
-
annotations: WRITES_FILE,
|
|
38
|
-
}, async (args, extra) => {
|
|
39
|
-
try {
|
|
40
|
-
requireFfmpeg();
|
|
41
|
-
for (const f of args.clips) {
|
|
42
|
-
if (!existsSync(f))
|
|
43
|
-
throw new ScreencastError(`Input file not found: ${f}`);
|
|
44
|
-
}
|
|
45
|
-
assertEditContainer(args.output);
|
|
46
|
-
const infos = await Promise.all(args.clips.map((c) => probeMedia(c)));
|
|
47
|
-
const durations = infos.map((i) => clipLength(i) ?? 0);
|
|
48
|
-
const clipHasAudio = infos.map((i) => i.audioCodec !== null);
|
|
49
|
-
const output = resolveOutput(args.output, subdir("edits"), `highlights-${stamp()}-${rand()}.mp4`, args.overwrite);
|
|
50
|
-
const ffArgs = buildAssembleArgs(args.clips, durations, output, {
|
|
51
|
-
transition: args.transition,
|
|
52
|
-
duration: args.duration,
|
|
53
|
-
width: args.width,
|
|
54
|
-
height: args.height,
|
|
55
|
-
fps: args.fps,
|
|
56
|
-
}, clipHasAudio);
|
|
57
|
-
await runEditJob(ffArgs, { output, durationSec: durations.reduce((a, d) => a + d, 0) || null, extra });
|
|
58
|
-
return okResponse({
|
|
59
|
-
outputPath: output,
|
|
60
|
-
clips: args.clips.length,
|
|
61
|
-
transition: args.transition ?? "cut",
|
|
62
|
-
audio: clipHasAudio.some(Boolean),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
return errorResponse(error);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
package/dist/tools/backdrop.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { extname } from "node:path";
|
|
4
|
-
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
5
|
-
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
6
|
-
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
7
|
-
import { runEditJob } from "../utils/jobs.js";
|
|
8
|
-
import { buildBackdropArgs, backdropOptionsSchema } from "../utils/backdrop.js";
|
|
9
|
-
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
10
|
-
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
11
|
-
const STILL = /\.(png|jpe?g|bmp|tiff?|webp)$/i;
|
|
12
|
-
const o = backdropOptionsSchema;
|
|
13
|
-
const inputSchema = {
|
|
14
|
-
input: z.string().min(1).describe("Path to the source video or image (png/jpg)."),
|
|
15
|
-
preset: o.preset.describe("Gradient: desktop (default, dark slate), rec (red), amber, light."),
|
|
16
|
-
colors: o.colors.describe("Instead: 1 color = solid, 2-4 = diagonal gradient."),
|
|
17
|
-
image: o.image.describe("Instead: a wallpaper image, scaled to cover."),
|
|
18
|
-
padding: o.padding.describe("px around the content (default 6% of the longer side)."),
|
|
19
|
-
radius: o.radius.describe("Corner radius px (default ~1.2% of the longer side; 0 = square)."),
|
|
20
|
-
shadow: o.shadow.describe("Shadow blur px (default ~2.5%; 0 = none)."),
|
|
21
|
-
shadowOpacity: o.shadowOpacity.describe("Default 0.5."),
|
|
22
|
-
aspect: o.aspect.describe("Output on this aspect's canvas (1920x1080, ...), content scaled to fit."),
|
|
23
|
-
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits (screenshots for an image)."),
|
|
24
|
-
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
25
|
-
};
|
|
26
|
-
export function register(server) {
|
|
27
|
-
server.registerTool("backdrop", {
|
|
28
|
-
title: "Add Backdrop",
|
|
29
|
-
description: "Frame a video or screenshot on a gradient, color, or wallpaper with padding, rounded corners, " +
|
|
30
|
-
"and a drop shadow, optionally on a 16:9/1:1/9:16/4:5 canvas.",
|
|
31
|
-
inputSchema,
|
|
32
|
-
outputSchema: looseOutput({ outputPath: z.string(), width: z.number().int(), height: z.number().int() }),
|
|
33
|
-
annotations: WRITES_FILE,
|
|
34
|
-
}, async (args, extra) => {
|
|
35
|
-
try {
|
|
36
|
-
requireFfmpeg();
|
|
37
|
-
if (!existsSync(args.input))
|
|
38
|
-
throw new ScreencastError(`Input file not found: ${args.input}`);
|
|
39
|
-
if (args.image && !existsSync(args.image))
|
|
40
|
-
throw new ScreencastError(`Background image not found: ${args.image}`);
|
|
41
|
-
const still = STILL.test(args.input);
|
|
42
|
-
if (still && args.output && !STILL.test(args.output)) {
|
|
43
|
-
throw new ScreencastError("An image input writes an image: give the output a .png or .jpg extension.");
|
|
44
|
-
}
|
|
45
|
-
if (!still)
|
|
46
|
-
assertEditContainer(args.output);
|
|
47
|
-
const info = await probeMedia(args.input);
|
|
48
|
-
if (!info.width || !info.height)
|
|
49
|
-
throw new ScreencastError(`Could not read the size of ${args.input}.`);
|
|
50
|
-
const ext = still ? (/\.jpe?g$/i.test(args.input) ? extname(args.input).toLowerCase() : ".png") : editOutputExt(args.input);
|
|
51
|
-
const output = resolveOutput(args.output, subdir(still ? "screenshots" : "edits"), `backdrop-${stamp()}-${rand()}${ext}`, args.overwrite);
|
|
52
|
-
const opts = {
|
|
53
|
-
preset: args.preset,
|
|
54
|
-
colors: args.colors,
|
|
55
|
-
image: args.image,
|
|
56
|
-
padding: args.padding,
|
|
57
|
-
radius: args.radius,
|
|
58
|
-
shadow: args.shadow,
|
|
59
|
-
shadowOpacity: args.shadowOpacity,
|
|
60
|
-
aspect: args.aspect,
|
|
61
|
-
};
|
|
62
|
-
const { args: ffArgs, layout } = buildBackdropArgs(args.input, output, opts, { width: info.width, height: info.height }, still);
|
|
63
|
-
await runEditJob(ffArgs, { output, durationSec: still ? null : info.durationSec, extra });
|
|
64
|
-
return okResponse({
|
|
65
|
-
outputPath: output,
|
|
66
|
-
width: layout.canvasW,
|
|
67
|
-
height: layout.canvasH,
|
|
68
|
-
content: { x: layout.x, y: layout.y, width: layout.contentW, height: layout.contentH },
|
|
69
|
-
padding: layout.padding,
|
|
70
|
-
radius: layout.radius,
|
|
71
|
-
shadow: layout.shadow,
|
|
72
|
-
background: args.image ? "image" : args.colors ? "colors" : (args.preset ?? "desktop"),
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
return errorResponse(error);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|