Skip to content

A motion design studio on your own machine: Claude makes the video step by step, you approve every stage. Bring your own Claude Code or API key.

Run on macOS from a folder with spaces in its path

Troy White682ea6839a68
diff --git a/package.json b/package.json
index 8fac20c..2dbbc57 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
"node": ">=20"
},
"scripts": {
- "test": "node --test test/",
+ "test": "node --test test/*.test.mjs",
"start": "node bin/mortiflix serve"
},
"dependencies": {
diff --git a/src/backends/anthropic-api.mjs b/src/backends/anthropic-api.mjs
index 38d4456..184ec28 100644
--- a/src/backends/anthropic-api.mjs
+++ b/src/backends/anthropic-api.mjs
@@ -280,6 +280,8 @@ export function editorTool(work, input, onActivity = () => {}) {
// Resolve a model-supplied path and refuse anything outside the project folder (.., absolute paths, symlinks).
export function confine(work, path, creating = false) {
if (typeof path !== 'string' || !path) throw new Error('path is required');
+ // macOS keeps temp folders behind symlinks (/var -> /private/var): compare against the real project folder.
+ if (existsSync(work)) work = realpathSync(work);
const abs = resolve(work, path);
let probe = abs;
if (creating) while (!existsSync(probe)) probe = dirname(probe);
diff --git a/test/gates.test.mjs b/test/gates.test.mjs
index 222c686..eee0ec2 100644
--- a/test/gates.test.mjs
+++ b/test/gates.test.mjs
@@ -34,7 +34,7 @@ test('submit enforces items, checks, folder and review mode', async (t) => {
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, error_checks: [] }), /missing/);
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, error_checks: [...ok.error_checks.slice(1), { id: ok.error_checks[0].id, result: 'n/a' }] }), /needs a note/);
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, items: [{ path: '../../../etc/passwd' }] }), /outside|doesn't exist/);
- symlinkSync('/etc/hostname', join(work, 'out', 'sneaky.png'));
+ symlinkSync('/etc/hosts', join(work, 'out', 'sneaky.png'));
assert.throws(() => gates.submit(root, id, 'directions', { ...ok, items: [{ path: 'out/sneaky.png' }] }), /outside/);
assert.throws(() => gates.submit(root, id, 'final', ok), /can't start yet/);
diff --git a/test/skills.test.mjs b/test/skills.test.mjs
index 652be3a..4512f97 100644
--- a/test/skills.test.mjs
+++ b/test/skills.test.mjs
@@ -5,8 +5,9 @@ import { mkdtempSync, rmSync, writeFileSync, readFileSync, chmodSync, existsSync
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { spawnSync } from 'node:child_process';
+import { fileURLToPath } from 'node:url';
-const SETUP = new URL('../pipelines/_shared/skills/remotion-motion/setup.mjs', import.meta.url).pathname;
+const SETUP = fileURLToPath(new URL('../pipelines/_shared/skills/remotion-motion/setup.mjs', import.meta.url));
test('remotion setup installs once per studio and links every project', (t) => {
const dir = mkdtempSync(join(tmpdir(), 'mfx-setup-'));
@@ -36,7 +37,7 @@ test('qc.mjs: a designed end hold passes with --end-hold; a freeze mid-video nev
if (spawnSync('ffmpeg', ['-version']).status !== 0) return t.skip('no ffmpeg');
const dir = mkdtempSync(join(tmpdir(), 'mfx-qc-'));
t.after(() => rmSync(dir, { recursive: true, force: true }));
- const QC = new URL('../pipelines/_shared/skills/final-pass/qc.mjs', import.meta.url).pathname;
+ const QC = fileURLToPath(new URL('../pipelines/_shared/skills/final-pass/qc.mjs', import.meta.url));
const clip = (name, parts) => {
const inputs = parts.flatMap((p) => ['-f', 'lavfi', '-i', `${p}=size=320x180:rate=30:duration=2`]);
const r = spawnSync('ffmpeg', ['-loglevel', 'error', '-y', ...inputs, '-filter_complex', `${parts.map((_, i) => `[${i}]`).join('')}concat=n=${parts.length}:v=1:a=0`, '-pix_fmt', 'yuv420p', join(dir, name)]);