Open source CapCut alternative.
TypeScript
feat(site): Cut data lives in ~/Movies/DonkeyCut, with one-time launch migration [rebuild]
David Le241f8697c657
diff --git a/docs/guides/cut/README.md b/docs/guides/cut/README.mdindex 0d544d3e..0d224b3e 100644--- a/docs/guides/cut/README.md+++ b/docs/guides/cut/README.md@@ -62,7 +62,7 @@ The shared dispatch also binds each request to the account id the page sends, an## The engine-The engine is a single compiled binary built from the site's Cut code and version-locked to the app: the app's dev run script and release packaging build and bundle it automatically (no separate step), and the app stamps its own release version into the engine's environment, so updates ride app releases. The Donkey app spawns it at launch — regardless of sign-in, since Cut is free and standalone — restarts it with backoff if it dies, and stops it on quit. The engine's lifetime is tied to the app process: the engine watches the pid that spawned it and exits when that process is gone, and at launch the app replaces an engine on the port stamped with a different version, so engine fixes always ship with the app update. An engine matching the app's version (another instance) or a developer-run "dev" engine is left alone. Its data lives under the user's Application Support, one folder per Donkey account; its logs under the user's Logs folder.+The engine is a single compiled binary built from the site's Cut code and version-locked to the app: the app's dev run script and release packaging build and bundle it automatically (no separate step), and the app stamps its own release version into the engine's environment, so updates ride app releases. The Donkey app spawns it at launch — regardless of sign-in, since Cut is free and standalone — restarts it with backoff if it dies, and stops it on quit. The engine's lifetime is tied to the app process: the engine watches the pid that spawned it and exits when that process is gone, and at launch the app replaces an engine on the port stamped with a different version, so engine fixes always ship with the app update. An engine matching the app's version (another instance) or a developer-run "dev" engine is left alone. Its data lives in the user's Movies folder (`~/Movies/DonkeyCut`), one folder per Donkey account, so projects and exports are visible in Finder and openable by other apps; its logs under the user's Logs folder.Because a GUI-spawned process inherits a bare PATH, the engine rebuilds it: tools shipped beside the engine binary first (they version with the app), then the app's bundled tools (bundled tool always wins), then the user's login-shell PATH and common install dirs. That is how it finds the speech tool, ffmpeg, and the user's `claude` and `codex`.@@ -88,7 +88,7 @@ Missing tools disable the matching feature; they never affect the rest of the si| Transcription, subtitles, and voice dictation in prompt inputs (assistant, image/video/audio generation) | prebuilt `cut-stt` shipped beside the engine binary (the plain dev server falls back to compiling it); dictation streams live mic audio through its `--live` mode || AI assistant | the user's own `claude` and `codex` CLI logins; its Gemini models use a Donkey sign-in and credits instead || AI generation (image / video / voiceover) | a Donkey sign-in and credits |-| Projects, library, exports | writable local disk (Application Support when run as the engine) |+| Projects, library, exports | writable local disk (the user's Movies folder when run as the engine) |## The assistant's knowledgediff --git a/site/src/cut/engine/serve.ts b/site/src/cut/engine/serve.tsindex 9bfc278a..f83f1a3e 100644--- a/site/src/cut/engine/serve.ts+++ b/site/src/cut/engine/serve.ts@@ -3,6 +3,7 @@ import { Readable } from "node:stream";import { allowedOrigin, corsHeaders, preflightHeaders } from "../server/cors";import { matchCutRoute, runCutRoute } from "../server/http/routes";+import { migrateCutDataDir } from "../server/migrateDataDir";import { ensureToolPath, resolveOnPath } from "../server/tool-path";import { enginePort } from "./config";@@ -73,6 +74,7 @@ function exitWithParent() {async function start() {exitWithParent();+ migrateCutDataDir();await ensureToolPath();// The Agent SDK can't resolve its built-in CLI from inside a compileddiff --git a/site/src/cut/server/dataDir.ts b/site/src/cut/server/dataDir.tsindex a8d920aa..65659198 100644--- a/site/src/cut/server/dataDir.ts+++ b/site/src/cut/server/dataDir.ts@@ -5,12 +5,13 @@ import path from "node:path";* Where Cut keeps its projects/ and library/ folders. The dev server keeps* them next to the checkout (cwd, gitignored). The engine binary runs as a* LaunchAgent whose cwd is "/", so it sets DONKEY_CUT_ENGINE and data lives in- * the user's Application Support instead. DONKEY_CUT_DATA_DIR overrides both.+ * the user's Movies folder, where Apple says user media belongs and where+ * Finder and other apps can reach it. DONKEY_CUT_DATA_DIR overrides both.*/export function cutDataRoot(): string {if (process.env.DONKEY_CUT_DATA_DIR) return process.env.DONKEY_CUT_DATA_DIR;if (process.env.DONKEY_CUT_ENGINE) {- return path.join(os.homedir(), "Library", "Application Support", "DonkeyCut");+ return path.join(os.homedir(), "Movies", "DonkeyCut");}return process.cwd();}diff --git a/site/src/cut/server/migrateDataDir.ts b/site/src/cut/server/migrateDataDir.tsnew file mode 100644index 00000000..4dfa0788--- /dev/null+++ b/site/src/cut/server/migrateDataDir.ts@@ -0,0 +1,42 @@+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++/**+ * One-time launch migration (shipped 2026-08-04): the Cut data root moved from+ * ~/Library/Application Support/DonkeyCut to ~/Movies/DonkeyCut. The engine+ * runs this once at startup, before any route can touch the data root: it+ * moves the old folder into place and removes the Application Support/Donkey+ * folder left behind by builds from before the video-editor pivot.+ *+ * TODO: delete this module and its serve.ts call after 2026-10-03 — by then+ * auto-updating installs have migrated.+ */+export function migrateCutDataDir(): void {+ if (process.env.DONKEY_CUT_DATA_DIR || !process.env.DONKEY_CUT_ENGINE) return;+ const appSupport = path.join(os.homedir(), "Library", "Application Support");+ const oldRoot = path.join(appSupport, "DonkeyCut");+ const newRoot = path.join(os.homedir(), "Movies", "DonkeyCut");+ try {+ if (fs.existsSync(oldRoot) && !fs.existsSync(newRoot)) {+ // Same volume (both under the home directory), so this is an atomic+ // rename regardless of how much media the folder holds.+ fs.renameSync(oldRoot, newRoot);+ console.log(`migrated cut data ${oldRoot} -> ${newRoot}`);+ }+ // Once the Movies root exists, anything still at the old path is stale;+ // clear it so no data lingers in Application Support.+ if (fs.existsSync(newRoot)) {+ fs.rmSync(oldRoot, { recursive: true, force: true });+ }+ } catch (err) {+ console.error(+ `cut data migration failed, keeping ${oldRoot}: ${err instanceof Error ? err.message : String(err)}`+ );+ }+ try {+ fs.rmSync(path.join(appSupport, "Donkey"), { recursive: true, force: true });+ } catch {+ // Leftover cleanup only; the engine runs fine with the folder still there.+ }+}