githubnext/chopinPublic

Let's compose rich plans together

Print the app's address once both halves are up #22

MergedMaggieAppletonmerged 1 commit intomainfromrefs/pull/22/head
  1. MA

    ## What

    `bun dev` now prints where the app actually is, after probing for it:

    ``` VITE v7.3.1 ready in 256 ms

    ➜ Local: http://127.0.0.1:5173/

    [dev] chopin is at http://127.0.0.1:8787

    chopin · http://127.0.0.1:8787 · client: vite (…) · agent: claude-sonnet-4.6 · … ```

    ## Why

    Vite announces its own port on the way up, and that address does not work. The server is the only origin — it owns `/ws` and forwards everything else — so the client derives its socket URL from `location` and dials whatever origin served the page.

    Load `:5173` and you get a page that renders perfectly and a socket that goes nowhere:

    ``` WebSocket connection to 'ws://localhost:5173/ws?room=main&as=…' failed: WebSocket opening handshake timed out @ src/wire.ts:59 ```

    The header sits at `connecting` and the editor says *"Reconnecting — Editing resumes once connected."* forever. It reads as a broken app rather than a wrong URL. The readme has always documented `:8787`, but the only clickable thing in the terminal was the address that doesn't work.

    ## How

    `announce()` polls the server origin, then prints once. Probing rather than printing immediately buys two things:

    - the line lands **beneath** Vite's banner instead of scrolling off above it - the server answers **502** while Vite is down (`apps/server/src/client.ts:56`), so an `ok` response means *both* halves are ready, not merely spawned

    `APP` is derived from `SERVER_HOST`/`PORT` with the same defaults as `apps/server/src/config.ts`. Importing `load()` would drag its `statSync` boot check into a supervisor with no use for one.

    Quiet on timeout and quiet during shutdown — a child that failed has already explained itself better than a timeout could.

    ## Testing

    - `bun run ci` — 0 warnings, 0 errors - `bun run types` — clean across all six packages - Ran `bun dev` end to end: line prints in the right place, Ctrl-C still leaves both ports clear

    🤖 Generated with [Claude Code](https://claude.com/claude-code)

  2. MaggieAppletonhead-ref-force-pushed 36b9c9ba87923 months ago on GitHub

  3. MaggieAppletonmerged e59e9c73ace93 months ago on GitHub

  4. MaggieAppletonclosed3 months ago on GitHub

  5. MaggieAppletonhead-ref-deleted3 months ago on GitHub