The VS Code of video editing, built for agents.
TypeScript
Enhance CLI linking process and update Windows documentation
konstantin-paulus79765f55ad64
diff --git a/README.md b/README.mdindex 0f9fdf7e..e31075ae 100644--- a/README.md+++ b/README.md@@ -249,13 +249,12 @@ To put `dapi` on your PATH, link it once (`unlink` undoes it):npm run link --workspace=@diffusionstudio/cli```-The link points at the CLI build, which `npm run dev:desktop` refreshes on every start, so the linked `dapi` always runs the latest code. On macOS it is a symlink in Homebrew's bin; on Windows it is `%LOCALAPPDATA%\DiffusionStudio\bin\dapi.cmd`, and that folder needs to be on your PATH.-Before sending a PR:```shnpm run check # typecheck all workspacesnpm run lint # lint all workspaces+npm run test # ensure tests are green```## Licensediff --git a/apps/cli/scripts/dev-link.mjs b/apps/cli/scripts/dev-link.mjsindex 1fce671e..311bf6d6 100644--- a/apps/cli/scripts/dev-link.mjs+++ b/apps/cli/scripts/dev-link.mjs@@ -15,12 +15,14 @@// Windows `%LOCALAPPDATA%\DiffusionStudio\bin\dapi.cmd`, the same file the// packaged app keeps its own shim in (apps/desktop/src/cli-windows.ts).// A packaged app rewrites it on launch, so run this again after-// using one. The folder has to be on PATH; the packaged app's-// "Install CLI" does that, or add it by hand.+// using one. The folder is added to the user PATH the way the+// packaged app's "Install CLI" does it; `--remove` leaves that+// entry, since a packaged install may still use it.//// node scripts/dev-link.mjs create the link// node scripts/dev-link.mjs --remove delete it+import { execFileSync } from "node:child_process";import { existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";import { homedir } from "node:os";import { dirname, join, win32 } from "node:path";@@ -45,10 +47,9 @@ if (process.platform === "win32") {writeFileSync(shim, ["@echo off", "setlocal", `node "${batch(script)}" %*`, ""].join("\r\n"));console.log(`dev-link: ${shim} -> ${script}`);- const onPath = (process.env.PATH ?? "")- .split(";")- .some((entry) => win32.normalize(entry).replace(/\\+$/, "").toLowerCase() === dir.toLowerCase());- if (!onPath) console.log(`dev-link: add ${dir} to your PATH to run \`dapi\` from a terminal.`);+ if (addToUserPath(dir)) {+ console.log(`dev-link: added ${dir} to your PATH; open a new terminal to run \`dapi\`.`);+ }} else if (process.platform === "darwin") {const dir = "/opt/homebrew/bin";const link = join(dir, "dapi");@@ -72,3 +73,36 @@ if (process.platform === "win32") {console.error(`dev-link: no link location for ${process.platform}; put ${script} on your PATH yourself.`);process.exit(1);}++// The user PATH in HKCU\Environment, edited the same way as+// apps/desktop/src/cli-windows.ts: through the registry, so the %VARIABLE%+// entries already there stay unexpanded, with a throwaway variable deletion+// to make .NET broadcast the change to new terminals. Returns whether the+// entry was added.+function addToUserPath(dir) {+ const normalize = (entry) => win32.normalize(entry).replace(/[\\/]+$/, "").toLowerCase();+ const powershell = (script, env) =>+ execFileSync(+ "powershell.exe",+ ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", script],+ { env: { ...process.env, ...env }, windowsHide: true, encoding: "utf8" },+ );++ const current = powershell(`+$key = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Environment')+[Console]::Out.Write($key.GetValue('Path', '', 'DoNotExpandEnvironmentNames'))+`);+ const entries = current.split(";").filter((entry) => entry.trim() !== "");+ if (entries.some((entry) => normalize(entry) === normalize(dir))) return false;++ powershell(+ `+$key = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Environment', $true)+$kind = if ($key.GetValueNames() -contains 'Path') { $key.GetValueKind('Path') } else { 'ExpandString' }+$key.SetValue('Path', $env:DAPI_USER_PATH, $kind)+[Environment]::SetEnvironmentVariable('DAPI_PATH_BROADCAST', $null, 'User')+`,+ { DAPI_USER_PATH: [...entries, dir].join(";") },+ );+ return true;+}diff --git a/apps/desktop/WINDOWS.md b/apps/desktop/WINDOWS.mdindex 0ce34e80..3635d3c7 100644--- a/apps/desktop/WINDOWS.md+++ b/apps/desktop/WINDOWS.md@@ -406,7 +406,9 @@ Status: task 1 runs on Windows: the dev build starts through`scripts/dev-desktop.mjs` (2026-09-21). Task 2 is implemented but not yetconfirmed on Windows; the script is `npm run link` in `apps/cli`(`scripts/dev-link.mjs`), one command on both platforms, which writes the-Homebrew symlink on macOS and the `dapi.cmd` shim on Windows. Task 3 (Mica) was+Homebrew symlink on macOS and, on Windows, the `dapi.cmd` shim plus the user+PATH entry, edited through the registry like `cli-windows.ts` does. The shim+part ran on Windows on 2026-09-22; the PATH part is the next thing to try. Task 3 (Mica) wastried and dropped, see below. Tasks 4 and 5 are open.Mica, tried on Windows on 2026-09-21 and reverted: the window stays solid.