feat(cli): add --live and --focus flags for automation window lifecycle#1122
Merged
feat(cli): add --live and --focus flags for automation window lifecycle#1122
Conversation
--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).
This was referenced Apr 21, 2026
Closed
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--live/OPENCLI_LIVE=1keeps the automation window open after an adapter command finishes (default: close immediately as before)--focus/OPENCLI_WINDOW_FOCUSED=1already existed as env var; now also a CLI flag so users don't have to shell-exportWhy
@WAWQAQ asked for a way to stop commands from auto-closing, so the page stays visible for inspection or follow-up commands.
--focuswas also brought up and turned out to already exist as an env var — exposing it as a flag makes it actually discoverable.Test plan
execution.test.tscases:OPENCLI_LIVE=1skipscloseWindow()on both success and failure pathscalls closeWindow on browser command failurecase still passes (default behavior unchanged)npx vitest run src/execution.test.ts src/commanderAdapter.test.ts src/cli.test.ts— 99 passednpm run buildgreenopencli --live listandopencli list --focusboth parse correctlyNot in scope