How I built it
- My role
- Product, design & engineering
- Context
- Personal project
The problem
[01]“Address already in use :::3000.” Which project is on port 3000? Is yesterday's dev server still running? Which of the six node processes is using 2 GB? lsof shows process ids and executable names, not projects, and stopping one process often leaves the rest of the dev server running.
What I built
[02]lsp answers in one screen. It reads the ports and processes the system already knows about, finds the project and framework behind each one, and groups a project's ports together. From there, one key opens a port in the browser, stops it, restarts it or shows its logs, and n shows the address and a QR code for a phone on the same network. Apps and macOS's own ports stay hidden until you ask for them.
Key decisions
[03]Read the system, nothing more
Ports come from lsof and processes from ps. There is no daemon to install, no native code and no background service, and nothing leaves the Mac.
Named after the project, not the process
The project is found from the process's working folder, walking up to the nearest package.json, go.mod, Cargo.toml or pyproject.toml, then named after its git repository. The framework comes from the command line first, then the project's dependencies, then the runtime. Dependencies only count for JavaScript runtimes, so a Python server in a JavaScript repository isn't labelled Next.js.
Stop the whole dev server, never the terminal
Stop climbs the process tree to the dev server's root, such as npm run dev, and stops everything under it: SIGTERM, then SIGKILL after a four-second grace period. It never stops lsp itself or the terminal it runs in. Homebrew services go through brew services, and Docker containers through docker stop.
Logs a terminal can't read
One terminal can't read another terminal's output, so lsp run wraps a dev server: its output still shows as usual, a copy goes to ~/.lsp/logs, and the exact command is recorded. That is what makes live logs and restart possible.
No flicker
Ink's incremental rendering redraws only the lines that changed, and the frame is kept one row shorter than the terminal, because a frame that fills it makes Ink clear the whole screen on every keypress.
The result
- 49Frameworks, runtimes and services it recognises
- 0Daemons or native code: only lsof and ps
- 52Automated tests

