Skip to content

Windows

devhub runs natively on Windows 10/11; WSL is not needed.

Verification on real Windows is not finished yet: the Windows branches are tested with mocks (output parsing, command arguments, paths), so please try it on a small scale first and report the behavior details. For step-by-step acceptance and the reporting format see windows-acceptance.md.

Requirements

  • Node.js: the version requirements are the same as on other platforms, see getting-started.md (connecting through a corporate proxy needs 22.21 or later or 24.5 or later, see https-proxy.md).
  • Git (git must be on PATH; both getting worktrees through repos and reading remotes depend on it).
  • Optional: Podman Desktop (for container services; podman machine uses the WSL backend, so enable WSL2 first). For Docker set "containerEngine": "docker", see containers.md.
  • Optional: Orca. Without it use repos (see below).

Install and start

PowerShell or cmd both work:

終端機視窗
git clone <repo-url> devhub
cd devhub
npm ci
node devhub.mjs
npm link # optional: installs the devhub command (creates devhub.cmd, so you can type devhub from cmd/PowerShell)

Open http://127.0.0.1:4999. A service’s cmd runs with cmd.exe /d /s /c, so write it in cmd syntax (for example npm run dev, set PORT=3000 && node server.js).

Machines with only the Claude desktop app

Without a separate Node.js install there is no node, devhub or claude command on PATH (the Claude desktop app’s bundled runtime is not on PATH). devhub does not assume they exist:

  • The server’s own restart (the admin UI’s “Restart devhub server now”) always uses the absolute path of the running node (process.execPath) and the absolute path of bin\devhub.mjs in the plugin directory, and adds node’s directory to PATH. If the restart fails (for example npm is missing while dependencies must be installed), the UI shows the reason (taken from server.log) and releases the “restarting” lock so you can try again; the audit log also records a failed server.restart with the reason.
  • Installing dependencies: when npm is not on PATH, the npm-cli.js shipped next to node is used; if neither exists the message says why and what to do instead (run npm ci --omit=dev in that directory on a machine that has npm).
  • Asking an agent to operate devhub: prefer the MCP tools (for example devhub_server {action: "restart", confirm: true}). For the CLI, the SessionStart hint prints a ready-to-run absolute form: "<absolute path of node.exe>" "<plugin dir>\bin\devhub.mjs" <command> (the plugin directory is usually under %USERPROFILE%\.claude\plugins\cache\devhub\devhub\<version>).
  • Updating the plugin: without a claude command the new-version notice tells the agent to update the marketplace and plugin from the /plugin screen in the Claude app instead of asking for claude plugin ....

Config file location

%APPDATA%\devhub\services.json; certificates, the audit log, claims and the token file are in the same directory, which can be overridden with DEVHUB_CONFIG. This directory and the token file are restricted with icacls to the current user only; if that fails it shows only a warning and doesn’t stop, so check the permissions yourself. Path comparison (worktrees, --here) ignores letter case and drive letter case.

Repo list and worktree sources

Worktrees come from git worktree list --porcelain, and devhub discovers the repo an agent calls it from; for a permanent, named list, add each project’s main checkout to the config (or run devhub repo add):

{
"repos": {
"my-app": "C:\\Users\\me\\code\\my-app",
"my-api": "C:\\Users\\me\\code\\my-api"
}
}

For the general rules see getting-started.md.

443 and 80 and the firewall

On Windows an ordinary user can bind 443/80 without administrator rights. On Windows devhub binds only 127.0.0.1 (not exposed to the LAN), so a firewall prompt normally doesn’t appear; if one does, choosing “Cancel” or allowing only private networks are both fine, since nothing listens externally.

The hosts file

A custom domain (such as DuckDNS’s <name>.duckdns.org) resolving to 127.0.0.1 may be blocked by DNS rebinding protection in your router, corporate DNS or security software. “Test connection” in the settings panel first queries public DNS to tell the cause apart, and you only need to edit hosts when public DNS already says 127.0.0.1, this computer keeps failing to resolve it, and it is not negative caching in your local DNS (for that, wait for it to expire or run ipconfig /flushdns); when public DNS has no A record, devhub sets DuckDNS automatically and no hosts edit is needed.

On Windows the hosts file is C:\Windows\System32\drivers\etc\hosts and must be edited as Administrator (search for Notepad in the Start menu → right-click “Run as administrator” → File → Open, with the file type set to “All files”). Add a line 127.0.0.1 <name>.duckdns.org and save; on macOS/Linux it is /etc/hosts, edited with sudo. devhub does not need a restart afterwards.

IIS occupying 443 and 80

Common holders on Windows are System (PID 4, HTTP.sys), svchost and IIS’s w3wp. The Proxy pill shows the cause and the fix explicitly; devhub never stops IIS automatically and never takes over these system processes. Choose one of:

  1. Stop IIS as an administrator: net stop w3svc (to disable it permanently, set World Wide Web Publishing Service to manual or disabled in “Services”).
  2. Move the IIS site’s binding to another port.
  3. Use netsh http show servicestate and netsh http show urlacl to find who registered that port, then decide what to do.

You can also avoid it with DEVHUB_HTTPS_PORT/DEVHUB_HTTP_PORT.

Relationship between the server and agent sessions

On Windows, child processes stay inside the parent’s Job Object by default; if an agent creates a Job with kill-on-job-close, every process in the Job is ended when the session ends. Node’s detached: true on Windows only means “no attached console, new process group”, and whether it leaves the Job depends on whether the Job allows breakaway, which isn’t reliable.

So on Windows devhub server start creates the server through WMI: powershell -NoProfile -EncodedCommand (Invoke-CimMethod -ClassName Win32_Process -MethodName Create). A process created through WMI has the WmiPrvSE service as its parent and is not in the caller’s Job. Options not chosen: Start-Process stays in the same Job; schtasks must create and clean up a task and may need privileges; wmic has been removed from newer Windows.

  • Processes created through WMI don’t inherit environment variables, so the command line passes an allowlist with set (system variables such as PATH and all DEVHUB_*), and output is appended to server.log with >>. Values containing cmd.exe special characters such as %, ^ and & cannot be escaped safely.
  • When PowerShell or WMI is unavailable or the arguments aren’t safe, it falls back to an ordinary detached spawn (server.log records a line with the reason); in that case the server may end together with the agent’s Job.
  • For the acceptance steps see windows-acceptance.md.

Limits of graceful stop

Windows has no SIGTERM. To stop a service, devhub first runs taskkill /PID <pid> /T on the root process (without /F, including child processes); this only works for programs with a window, and it can’t reach console programs without a window (the vast majority of Node and .NET services), nor does it trigger their Ctrl+C/SIGINT cleanup. When devhub detects that a graceful stop can’t be delivered, it skips the stopTimeoutSec wait and ends the process tree straight away with taskkill /PID <pid> /T /F. Consequently, a service that needs to save files or close connections before exit has no reliable graceful stop on Windows (GenerateConsoleCtrlEvent isn’t used because the service and devhub don’t share a console); the “Force stop” button is always /T /F. A container’s stop -t is handled by the engine and is unaffected.

Known differences

  • The node_modules link in worktree initialization is a junction (it needs neither Developer Mode nor administrator rights); if creating it fails it falls back to a real install. See configuration.md.
  • Output encoding of external commands: cmd.exe and native programs write their error messages in the system’s OEM code page (CP950 on Traditional Chinese Windows); devhub decodes them using the code page reported by chcp (CP950/936/932/949 and others are supported), while valid UTF-8 output is left as is. When a command does not exist (for example Orca is not installed), the header and error messages show devhub’s own localized hint instead of the system’s raw message.

Service processes have no separate process group; devhub records the root process pid and handles the process tree. If a service detaches from the process tree itself (for example start opening another window), stopping can only rely on killing the port listener afterwards. stopTimeoutSec is meaningful on Windows only when a graceful stop was delivered.

For the acceptance checklist see windows-acceptance.md.