Commit 1634d0f
feat(launcher-standard): cross-platform browser launch + env-overridable wait timing
Two related template improvements that the standard had already partly
declared but never specified or implemented in the reference templates.
## 1. Cross-platform open_browser()
The prose template covered only `xdg-open` / `firefox` / `chromium` —
Linux-only despite the standard's stated cross-platform commitment
(launcher-standard.adoc §System Integration Modes design principle 2).
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 install has `wslview` and Git Bash has `start`.
Fix:
- `$BROWSER` env var honoured first (de-facto Unix convention; lets
users / operators override without re-minting the launcher).
- Platform dispatch via `uname -s`:
- macOS: `open`
- Linux: WSL detection via `/proc/version contains "microsoft"` →
`wslview` preferred (opens in Windows-side default browser; native
Linux browsers either land in WSLg or fail). Otherwise the
existing `xdg-open` → `firefox` → `chromium` chain.
- Windows (MINGW/MSYS/CYGWIN under Git Bash): `start` (cmd builtin)
- Fallback unchanged: print "Open manually: $URL"
a2ml gains `[browser-launch]` declaring the resolution order
declaratively so consumers (`launch-scaffolder`, audit tools) can
reason about it without re-parsing the bash.
## 2. wait_for_server() reads 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 the template
had 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
Fix to template:
- `local max_wait="${1:-${WAIT_FOR_URL_TIMEOUT_SECONDS:-15}}"` — chain
arg → env → default
- `curl -fsS --max-time "$per_request_timeout"` — bounded per-request
- Error message now tells operators how to extend the timeout
Both files in the same commit per the lock-step requirement and the
gate in PR #172. Bash blocks pass `bash -n` syntax check.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 431adbb commit 1634d0f
2 files changed
Lines changed: 86 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
74 | 78 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | | - | |
81 | | - | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | | - | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
| 95 | + | |
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
100 | 117 | | |
101 | 118 | | |
102 | 119 | | |
103 | 120 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
113 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 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 | + | |
114 | 156 | | |
115 | 157 | | |
116 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
70 | 95 | | |
71 | 96 | | |
72 | 97 | | |
| |||
0 commit comments