Skip to content

fix(cli): accept trailing browser --window option - #1963

Merged
jackwener merged 1 commit into
mainfrom
fix/browser-window-trailing-option-integrated
Jun 17, 2026
Merged

fix(cli): accept trailing browser --window option#1963
jackwener merged 1 commit into
mainfrom
fix/browser-window-trailing-option-integrated

Conversation

@jackwener

@jackwener jackwener commented Jun 16, 2026

Copy link
Copy Markdown
Owner

What

Fixes #1850 by accepting the natural browser command shape:

opencli browser work open https://x.com --window background

--window remains a browser namespace option. Instead of registering it on every browser leaf command, the existing rewriteBrowserArgv preprocessor now hoists a trailing --window <mode> / --window=<mode> into the namespace-option slot before Commander parses argv.

The branch also includes a lockfile-only production dependency refresh for ws and js-yaml because the required CI audit gate flagged the old locked versions. package.json ranges already allow the patched versions, so no range change is needed.

Why this version

This integrates the useful parts of both open PRs:

This PR uses the preprocessor approach, adds nested-command coverage from the broader concern, avoids rewriting anything after a literal --, avoids hoisting a bare --window without a value, and documents the trailing placement in browser help examples.

Tests

  • npx vitest run src/cli-argv-preprocess.test.ts
  • npm run typecheck
  • npm run build
  • HOME=$(mktemp -d) npx vitest run src/cli-argv-preprocess.test.ts src/cli.test.ts
  • npm audit --omit=dev --audit-level=high
  • HOME=$(mktemp -d) npm test

Supersedes #1926 and #1899.
Fixes #1850.

Hoist user-facing browser --window placements after a leaf command into the browser namespace option slot before Commander parses argv. This keeps --window as a namespace option instead of mirroring it onto every browser leaf, while accepting the natural command shape agents tend to produce.\n\nAlso document the trailing form in browser help and cover nested browser groups plus literal -- separators.\n\nCo-authored-by: Zhongyue Lin <zhongyuelin990405@gmail.com>\nCo-authored-by: Chen17-sq <109075336+Chen17-sq@users.noreply.github.com>
@jackwener
jackwener force-pushed the fix/browser-window-trailing-option-integrated branch from 882ca86 to 3113483 Compare June 17, 2026 14:25
@jackwener
jackwener merged commit b0de4e6 into main Jun 17, 2026
11 checks passed
@jackwener
jackwener deleted the fix/browser-window-trailing-option-integrated branch June 17, 2026 14:33
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.

[Bug] opencli browser --window only works before the leaf subcommand

1 participant