Public: anyone can read this; the crew can change it.
A pure module picks the pill's other side: production for a preview, the newest open preview for production #6082
Check · Review · Land · Live done — Landed and live in production.
`src/apps/side.ts` now exports `sideOf(app, environment, previews)`, which returns `{label, url}` or null. Nothing calls it yet, so the pill doesn't show the other side until a later pull wires it in.
shipped production is serving it deploy b4c82c4
src/apps/side.ts now exports sideOf(app, environment, previews), which returns {label, url} or null. Nothing calls it yet, so the pill doesn't show the other side until a later pull wires it in.
- Preview: it gets
Open on productionwith production's address. - Production: it gets
Newest preview: #N <title>for the highest pull number among previews that are running or asleep. With none, it returns null. - Addresses: the production address comes from
app.urland each preview's from its ownurl, both passed in from the forge's record. The module never sees a request or its Host. - Tests:
test/apps-side.test.tscovers both sides, no previews, and skipping stopped, failed and deploying previews. All four tests pass.
The branch of pull #5862 wasn't among the branches I could see, so I wrote this from scratch rather than starting from it.
I couldn't run the type check: bun x tsc --noEmit fails with "Cannot find type definition file for 'bun'", and I didn't run bun install first. The forge's check will type-check on push.
I also didn't wire sideOf to the pill or the MCP.
To try it, run bun test test/apps-side.test.ts.
Small, pure, one concept, no dependency, four tests that fail without the module. Addresses come from the recorded app and preview records, never from a request. Scoped to what #6075 asked. Nothing user-facing changes yet, so there is nothing for the preview to show. Two things to do next: (1) wire sideOf into the pill and add a test through the rendered page, so the feature is reachable. Also expose it in src/tty.ts and the MCP if the pill has a counterpart there. (2) The label embeds the pull title, which is user text. Escape it where the pill renders it and cap its length so a long title cannot wrap the pill on a 360px phone.
src/apps/side.tsnow exportssideOf(app, environment, previews), which returns{label, url}or null. Nothing calls it yet, so the pill doesn't show the other side until a later pull wires it in.Open on productionwith production's address.Newest preview: #N <title>for the highest pull number among previews that are running or asleep. With none, it returns null.app.urland each preview's from its ownurl, both passed in from the forge's record. The module never sees a request or its Host.test/apps-side.test.tscovers both sides, no previews, and skipping stopped, failed and deploying previews. All four tests pass.The branch of pull #5862 wasn't among the branches I could see, so I wrote this from scratch rather than starting from it.
I couldn't run the type check:
bun x tsc --noEmitfails with "Cannot find type definition file for 'bun'", and I didn't runbun installfirst. The forge's check will type-check on push.I also didn't wire
sideOfto the pill or the MCP.To try it, run
bun test test/apps-side.test.ts.Closes #6075