Story 32: Multi-Instance Worktree Support

Add configurable port via STORYKIT_PORT env var (default 3001). Server
prints machine-readable STORYKIT_PORT=<port> on startup and writes
.story_kit_port file for discovery. Frontend proxy and WebSocket read
VITE_STORYKIT_PORT env var instead of hardcoding port 3001.

7 new tests (4 backend, 3 frontend) all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-19 17:14:33 +00:00
parent baee84dfa5
commit e54209eb5a
5 changed files with 120 additions and 25 deletions

View File

@@ -1,22 +0,0 @@
---
name: "Multi-Instance Worktree Support"
test_plan: pending
---
# Story 32: Multi-Instance Worktree Support
## User Story
**As a** developer working across multiple git worktrees,
**I want** to run separate app instances (server + frontend) per worktree on different ports,
**So that** I can QA each worktree independently without port conflicts.
## Acceptance Criteria
- [ ] Server discovers an available port instead of hardcoding 3001 (e.g., try 3001, then 3002, etc., or use port 0 and report back).
- [ ] Server prints the actual bound port on startup so callers can discover it.
- [ ] Frontend dev server proxy target is configurable (env var or auto-detected from server).
- [ ] WebSocket client in the frontend reads the port dynamically rather than hardcoding it.
- [ ] A simple registry or file-based mechanism lets a supervisor discover which ports map to which worktrees.
## Out of Scope
- Agent orchestration across worktrees (separate story).
- Service mesh or container orchestration.
- Multi-machine distributed instances (local only for now).