import { spawn } from "node:child_process"; import { fileURLToPath } from "node:url"; import { dirname, resolve } from "node:path"; import { withPinnedNodePath } from "./mise-toolchain-env.mjs"; import { quoteArgsForWindowsShell } from "./spawn-command.mjs"; const requestedEnv = process.argv[2]?.trim().toLowerCase(); const agentBytecode = process.argv.slice(3).includes("--agent-bytecode"); if (requestedEnv !== "test" && requestedEnv !== "production") { console.error("Usage: node scripts/dev-desktop-env.mjs [--agent-bytecode]"); process.exit(1); } const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); const pnpmCommand = process.platform === "win32" ? "pnpm.cmd" : "pnpm"; function run(command, args) { return new Promise((resolveRun, rejectRun) => { // Windows 下 shell:true 只按空格拼接参数;仓库路径含空格(如 E:\Z Code\...)时 // node