dev-desktop-sandbox
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDesktop (Electron) sandbox instances
桌面(Electron)沙箱实例
make devmake startMUX_ROOTThis skill documents the repo workflow for starting multiple desktop dev instances in parallel (including from different git worktrees) by giving each instance its own temporary .
MUX_ROOTmake devmake startMUX_ROOT本技能文档记录了仓库的工作流,通过为每个实例分配独立的临时,实现并行启动多个桌面开发实例(包括来自不同Git工作树的实例)。
MUX_ROOTQuick start
快速开始
bash
make dev-desktop-sandboxbash
make dev-desktop-sandboxWhat it does
功能说明
- Creates a fresh temporary directory
MUX_ROOT - Copies these files into the sandbox if present (unless disabled by flags):
- (provider config)
providers.jsonc - (project list)
config.json
- Picks free ports:
- Vite devserver port (used by the renderer)
- Electron remote debugging port (optional)
- Runs with:
make devMUX_ROOT=<temp>MUX_VITE_PORT=<free-port>
- Waits for Vite to be reachable, then runs (Electron expects
make build-static)dist/splash.html - Launches Electron () with:
bunx electron .MUX_ROOT=<temp>MUX_DEVSERVER_HOST=127.0.0.1MUX_DEVSERVER_PORT=<vite-port>- by default (avoids
MUX_SERVER_PORT=0if yourEADDRINUSEpinsconfig.json)apiServerPort - (so you can run alongside another dev instance)
CMUX_ALLOW_MULTIPLE_INSTANCES=1
- 创建全新的临时目录
MUX_ROOT - 如果存在以下文件,则将其复制到沙箱中(可通过标志禁用):
- (提供商配置)
providers.jsonc - (项目列表)
config.json
- 选择空闲端口:
- Vite开发服务器端口(供渲染器使用)
- Electron远程调试端口(可选)
- 运行并携带以下参数:
make devMUX_ROOT=<temp>MUX_VITE_PORT=<free-port>
- 等待Vite服务可达后,运行(Electron需要
make build-static文件)dist/splash.html - 启动Electron()并携带以下参数:
bunx electron .MUX_ROOT=<temp>MUX_DEVSERVER_HOST=127.0.0.1MUX_DEVSERVER_PORT=<vite-port>- 默认(避免当你的
MUX_SERVER_PORT=0固定了config.json时出现apiServerPort错误)EADDRINUSE - (允许与其他开发实例同时运行)
CMUX_ALLOW_MULTIPLE_INSTANCES=1
Options
可选参数
bash
undefinedbash
undefinedStart with a clean instance (do not copy providers or projects)
启动干净的实例(不复制提供商或项目配置)
make dev-desktop-sandbox DEV_DESKTOP_SANDBOX_ARGS="--clean-providers --clean-projects"
make dev-desktop-sandbox DEV_DESKTOP_SANDBOX_ARGS="--clean-providers --clean-projects"
Skip copying providers.jsonc
跳过复制providers.jsonc
make dev-desktop-sandbox DEV_DESKTOP_SANDBOX_ARGS="--clean-providers"
make dev-desktop-sandbox DEV_DESKTOP_SANDBOX_ARGS="--clean-providers"
Clear projects from config.json (preserves other config)
清空config.json中的项目(保留其他配置)
make dev-desktop-sandbox DEV_DESKTOP_SANDBOX_ARGS="--clean-projects"
make dev-desktop-sandbox DEV_DESKTOP_SANDBOX_ARGS="--clean-projects"
Use a specific root to seed from (defaults to $MUX_ROOT then ~/.mux-dev then ~/.mux)
使用指定的根目录作为种子(默认为$MUX_ROOT,其次是~/.mux-dev,最后是~/.mux)
SEED_MUX_ROOT=~/.mux-dev make dev-desktop-sandbox
SEED_MUX_ROOT=~/.mux-dev make dev-desktop-sandbox
Keep the sandbox root directory after exit (useful for debugging)
退出后保留沙箱根目录(便于调试)
KEEP_SANDBOX=1 make dev-desktop-sandbox
KEEP_SANDBOX=1 make dev-desktop-sandbox
Pin Vite port
固定Vite端口
VITE_PORT=5174 make dev-desktop-sandbox
VITE_PORT=5174 make dev-desktop-sandbox
Control how long we wait for Vite to come up (ms)
控制等待Vite启动的时长(毫秒)
VITE_READY_TIMEOUT_MS=120000 make dev-desktop-sandbox
VITE_READY_TIMEOUT_MS=120000 make dev-desktop-sandbox
Enable/pin Electron remote debugging port (defaults to an auto-picked free port)
启用/固定Electron远程调试端口(默认为自动选择的空闲端口)
ELECTRON_DEBUG_PORT=9223 make dev-desktop-sandbox
ELECTRON_DEBUG_PORT=9223 make dev-desktop-sandbox
Disable Electron remote debugging entirely
完全禁用Electron远程调试
ELECTRON_DEBUG_PORT=0 make dev-desktop-sandbox
ELECTRON_DEBUG_PORT=0 make dev-desktop-sandbox
Override the internal API server port (defaults to 0/random for sandboxes)
覆盖内部API服务器端口(沙箱中默认为0/随机端口)
MUX_SERVER_PORT=3772 make dev-desktop-sandbox
MUX_SERVER_PORT=3772 make dev-desktop-sandbox
Override which make binary to use
覆盖使用的make二进制文件
MAKE=gmake make dev-desktop-sandbox
undefinedMAKE=gmake make dev-desktop-sandbox
undefinedOptional: deeper Electron isolation (MUX_E2E=1
)
MUX_E2E=1可选:更深层次的Electron隔离(MUX_E2E=1
)
MUX_E2E=1Even with a unique , Electron's directory (localStorage, window state, single-instance lock, etc.) is not automatically relocated unless is set.
MUX_ROOTuserDataMUX_E2E=1If you want full isolation (including ), run:
userDatabash
MUX_E2E=1 make dev-desktop-sandbox即使使用了唯一的,Electron的目录(包含localStorage、窗口状态、单实例锁等)也不会自动迁移,除非设置了。
MUX_ROOTuserDataMUX_E2E=1如果需要完全隔离(包括),请运行:
userDatabash
MUX_E2E=1 make dev-desktop-sandboxSecurity notes
安全注意事项
- may contain API keys.
providers.jsonc - The sandbox root directory is created on disk (usually under your system temp dir).
- This flow intentionally does not copy .
secrets.json
- 可能包含API密钥。
providers.jsonc - 沙箱根目录会创建在磁盘上(通常位于系统临时目录下)。
- 本工作流特意不复制文件。
secrets.json