CLI: no way to stop a single named browser instance (only global `stop`)
The daemon already implements a per-name browser-stop operation
(serialized with the per-browser lock since 0.2.8), but no public surface
reaches it: dev-browser stop stops the daemon and every browser, and the
script sandbox's browser API intentionally has no instance-level close.
On machines where several agents/sessions share the daemon and mint named
instances (--browser session-xyz), nobody can release just their own
instance when they finish. The workarounds are all bad: leave the instance
running (leaks a headless Chromium; idle cleanup helps since 0.2.9 but ships
disabled and can't target one instance deterministically), or run global
stop and kill everyone else's browsers plus the daemon.
There's also a footgun in the current grammar: dev-browser --browser foo stop parses fine but silently ignores the flag and stops everything.
Proposal: make the existing top-level selector govern stop —
dev-browser --browser NAME stop sends browser-stop for exactly that
instance (daemon and other instances keep running; connected Chrome is
disconnected, not terminated; unknown names succeed idempotently; an active
script on that browser finishes first because of the per-browser lock). Bare
dev-browser stop keeps its global meaning. Internally Cli.browser
becomes Option<String> with "default" substituted for script execution,
so no clap value-source machinery is needed, and explicitly passing
--browser default targets the instance named default.
I have a working branch with tests, help text, changelog, and doc updates (including the agent skill, so LLM agents learn to release the instances they open), plus a runtime proof that stopping one instance under an isolated HOME leaves the sibling instance (and its in-page state) and the daemon untouched, and leaves an externally connected Chrome process alive. Happy to open a PR if this direction works for you, and equally happy to adjust the surface if you'd prefer different grammar.
Source: SawyerHood/dev-browser