Skip to content

fix(test-browser): detect dev server port from project config#233

Open
mvanhorn wants to merge 1 commit intoEveryInc:mainfrom
mvanhorn:fix/test-browser-port-detection
Open

fix(test-browser): detect dev server port from project config#233
mvanhorn wants to merge 1 commit intoEveryInc:mainfrom
mvanhorn:fix/test-browser-port-detection

Conversation

@mvanhorn
Copy link

@mvanhorn mvanhorn commented Mar 8, 2026

Summary

  • Add new step 4 (Detect Dev Server Port) with cascading port detection:
    1. Explicit --port argument (e.g., /test-browser --port 5000)
    2. CLAUDE.md / project instructions (regex for port, PORT, localhost:\d+)
    3. package.json dev scripts (--port flags)
    4. Environment files (.env, .env.local, .env.development)
    5. Falls back to 3000 if nothing found
  • Replace all hardcoded localhost:3000 with localhost:${PORT} using detected port
  • Update "Server not running" error to show detected port and suggest --port flag
  • Renumber subsequent steps (5-8 become 6-9) to accommodate the new step

Closes #164

Test plan

  • Run /test-browser in a project with default port 3000 - auto-detects and works as before
  • Run /test-browser --port 5000 - uses port 5000
  • Add PORT=4000 to .env and run /test-browser - detects port 4000
  • Add localhost:8080 reference in CLAUDE.md - detects port 8080
  • Verify no remaining hardcoded localhost:3000 in the file

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Replace all hardcoded localhost:3000 references with dynamic port
detection. The command now checks (in priority order): explicit
--port argument, CLAUDE.md config, package.json scripts, .env files,
then falls back to 3000.

Closes EveryInc#164

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[compound-engineering] Bug: /test-browser hardcodes localhost:3000, ignores project port config

1 participant