Commit 74ce78a
feat(launcher-standard): cross-platform browser launch + env-overridable wait timing (#177)
## Summary
Two related template improvements the standard had already partly
declared but never specified or implemented in the reference templates.
### 1. Cross-platform `open_browser()`
Previously Linux-only (`xdg-open` / `firefox` / `chromium`) despite
the standard's stated cross-platform commitment (design principle 2:
*"The same launcher script works on Linux, macOS, and Windows."*).
On macOS the template fell through to "Open manually: \$URL"; on
Windows-via-Git-Bash and on WSL it did too — even though every modern
WSL has `wslview` and Git Bash has `start`.
Now:
| Step | Action |
|------|--------|
| 1 | Honour `\$BROWSER` env var (de-facto Unix convention; lets users
override without re-minting) |
| 2 | Platform dispatch via `uname -s`: macOS → `open`; Linux → WSL
detection (`/proc/version contains "microsoft"`) → `wslview`, else
`xdg-open` → `firefox` → `chromium`; Windows (MINGW/MSYS/CYGWIN) →
`start` |
| 3 | Fallback unchanged: print `"Open manually: \$URL"` |
a2ml gains `[browser-launch]` declaring the resolution order so
consumers (`launch-scaffolder`, audit tools) can reason about it
without re-parsing the bash.
### 2. `wait_for_server()` honours the env-var override
The a2ml had `wait-for-url-timeout-seconds = 15` but the bash
template hardcoded `wait_for_server 15` — operators on slow hosts
had no way to extend the timeout short of editing the script. Also
no per-request timeout: a single hung TCP connection could block
the whole polling loop.
Fix to `[runtime]`:
- `wait-for-url-timeout-env-var = "WAIT_FOR_URL_TIMEOUT_SECONDS"` —
formalises the override name
- `wait-for-url-poll-interval-seconds = 1` + env var (was implicit
in the template's `sleep 1`)
- `wait-for-url-per-request-timeout-seconds = 2` — caps each `curl`
probe with `--max-time`
Fix to template:
\`\`\`bash
local max_wait="\${1:-\${WAIT_FOR_URL_TIMEOUT_SECONDS:-15}}" # arg → env
→ default
local poll_interval="\${WAIT_FOR_URL_POLL_INTERVAL:-1}"
local per_request_timeout=2
curl -fsS --max-time "\$per_request_timeout" "\$URL" >/dev/null 2>&1
\`\`\`
Error message now tells operators how to extend the timeout.
## Compatibility
- Existing launchers that pass an explicit timeout (`wait_for_server
30`)
still work — the new template prefers the arg over the env var.
- Existing launchers without `\$BROWSER` set get the platform-aware
ladder, which is strictly more capable than the old Linux-only chain
(Linux-with-no-WSL behaves identically since `wslview` won't be
found and `xdg-open` runs).
## Lock-step + coordination
Both files in the same commit per §Sync requirement (and the gate
introduced in #172, which will go green on first push).
Independent of #170, #171, #172, #173, #175, #176. No file overlap
with #176 (which is keepopen.sh).
## Test plan
- [x] a2ml parses (python tomllib); new `[browser-launch]` table and
4 new `[runtime]` keys round-trip cleanly
- [x] `open_browser()` and `wait_for_server()` bash blocks pass
`bash -n` syntax check
- [ ] Manual test on macOS / WSL hosts (deferred — needs those
hosts; logic matches well-documented `uname -s` / `/proc/version`
conventions used by `wslview` itself)
- [ ] Live lock-step gate (#172) goes green on first push
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a03e5a3 commit 74ce78a
2 files changed
Lines changed: 86 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
83 | 87 | | |
84 | 88 | | |
85 | | - | |
86 | | - | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | | - | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
95 | 99 | | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
105 | 122 | | |
106 | 123 | | |
107 | 124 | | |
108 | 125 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
118 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
119 | 161 | | |
120 | 162 | | |
121 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
95 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
96 | 106 | | |
97 | 107 | | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
101 | 126 | | |
102 | 127 | | |
103 | 128 | | |
| |||
0 commit comments