@michalicat/trop
v1.0.0
Published
Deterministic ports + proxy switcher for dev worktrees
Maintainers
Readme
wt
Deterministic port assignment and HTTP proxy switcher for dev worktrees.
Assign every project directory a stable port (4000-5999) based on its path, and optionally run a reverse proxy on :3000 that can instantly switch between targets — no HMR reconnect issues.
Installation
npm install -g @michalicat/tropThis installs the wt command globally.
Commands
| Command | Description |
|---|---|
| wt port [target] | Print the deterministic port for a target (alias or path, default: current git root/cwd) |
| wt id [target] | Print the stable ID (resolved real path) used for hashing |
| wt alias <name> <value> | Create an alias. Value can be a path or id:YOUR_ID |
| wt aliases | List all aliases |
| wt use <target> | Set the active target (switches proxy instantly if running) |
| wt status | Show the current active mapping (live info if proxy is running) |
| wt start | Start the reverse proxy on :3000 with WebSocket/HMR support |
How it works
Deterministic ports — Each directory gets a stable port via
SHA-1(realpath) mod 2000 + 4000. The same folder always maps to the same port, so you can hardcode it in your dev server config.Reverse proxy on :3000 —
wt startlaunches an HTTP/WebSocket reverse proxy on port 3000. It forwards all traffic to whichever target is currently active.Instant switching —
wt use <target>switches the proxy target immediately (via a control API on port 3010). No restart, no reconnect — HMR connections stay alive.Aliases — Name your worktrees (
wt alias app ./worktrees/app) so you can switch withwt use appinstead of typing paths.
