Skip to content

feat(cli): add --live and --focus flags for automation window lifecycle#1122

Merged
jackwener merged 1 commit intomainfrom
feat/live-focus-flags
Apr 21, 2026
Merged

feat(cli): add --live and --focus flags for automation window lifecycle#1122
jackwener merged 1 commit intomainfrom
feat/live-focus-flags

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • --live / OPENCLI_LIVE=1 keeps the automation window open after an adapter command finishes (default: close immediately as before)
  • --focus / OPENCLI_WINDOW_FOCUSED=1 already existed as env var; now also a CLI flag so users don't have to shell-export
  • Both parsed early and stripped from argv → work on any subcommand (adapter or browser), in any position

Why

@WAWQAQ asked for a way to stop commands from auto-closing, so the page stays visible for inspection or follow-up commands. --focus was also brought up and turned out to already exist as an env var — exposing it as a flag makes it actually discoverable.

Test plan

  • New execution.test.ts cases: OPENCLI_LIVE=1 skips closeWindow() on both success and failure paths
  • Existing calls closeWindow on browser command failure case still passes (default behavior unchanged)
  • npx vitest run src/execution.test.ts src/commanderAdapter.test.ts src/cli.test.ts — 99 passed
  • npm run build green
  • Smoke: opencli --live list and opencli list --focus both parse correctly

Not in scope

  • No auto-teardown timer for the lingering window — the extension's existing 30s idle timeout still applies if the user doesn't explicitly close. Can revisit if agents end up leaking windows across long sessions.

--live (OPENCLI_LIVE=1) keeps the automation window open after an adapter
command finishes, so agents or humans can inspect the page state. Default
behavior (immediate closeWindow) is unchanged.

--focus (OPENCLI_WINDOW_FOCUSED=1) surfaces the existing env-var toggle as a
CLI flag so users don't need to shell-export to see the window in foreground.

Both flags are parsed early in main.ts and stripped from argv, so they can be
placed anywhere on the command line and work on any subcommand (adapter or
browser).
@jackwener jackwener merged commit d36bee0 into main Apr 21, 2026
13 checks passed
@jackwener jackwener deleted the feat/live-focus-flags branch April 21, 2026 13:14
luxiaolei pushed a commit to luxiaolei/OpenCLI that referenced this pull request Apr 22, 2026
…le (jackwener#1122)

--live (OPENCLI_LIVE=1) keeps the automation window open after an adapter
command finishes, so agents or humans can inspect the page state. Default
behavior (immediate closeWindow) is unchanged.

--focus (OPENCLI_WINDOW_FOCUSED=1) surfaces the existing env-var toggle as a
CLI flag so users don't need to shell-export to see the window in foreground.

Both flags are parsed early in main.ts and stripped from argv, so they can be
placed anywhere on the command line and work on any subcommand (adapter or
browser).

(cherry picked from commit d36bee0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant