devserver · shipped · week of
One command for the dev server
In 246 coding-agent sessions I read, the first commands went on netstat, sleeps, picking a port and sometimes killing the wrong process. One command can own a project's dev server instead, provided it checks that whatever holds the port descends from the process it started.
devserver: a tool for coding agents, on Windows and Linux, that manages a project's dev server · private repo
How dev <project> works
dev <project> reuses the project's dev server if it is already running and starts it in the background if not. A second checkout of the same project gets its own free port. The command returns only when the server answers its health URL, or fails at once and shows the end of the server's log.
Alive or not, without tracking process IDs
The first version tracked servers by process ID and lock folders. Now each server is started by a small launcher process, and the launcher listens on a named pipe on Windows, or a Unix socket elsewhere. Only a live launcher can answer, so a crashed one cannot look alive the way a stale process ID or lock folder can. To stop the server, the command sends a message to the same pipe.
Is this server mine?
A review found a hole: the command assumed whatever process held the port was its own server. Now it walks up from the process listening on the port, parent by parent, and accepts the server only if that chain reaches its own launcher.
launcher (mine)
-> shell
-> dev server, on the port
walk up from the listener:
reach the launcher, or refuse
The check also compares start times: a parent that started later than its child is a reused process ID, not a parent. It took six rounds of review to get there.
I'm Ovi. I recompile old Windows games to run in a browser, build a virtual GPU for Windows XP, and write tools for my own machines, with AI since 2020. Projects and the latest log