Skip to content

feat(cli): add --output-dir option to playwright-cli#39795

Open
178inaba wants to merge 1 commit intomicrosoft:mainfrom
178inaba:feat/add-cli-output-dir
Open

feat(cli): add --output-dir option to playwright-cli#39795
178inaba wants to merge 1 commit intomicrosoft:mainfrom
178inaba:feat/add-cli-output-dir

Conversation

@178inaba
Copy link

Summary

The --output-dir option is already available for the MCP server mode, but not for the CLI client (playwright-cli). When AI coding agents use playwright-cli across many repositories, snapshot files written to the default .playwright-cli/ directory show up as untracked files in git status. This PR adds --output-dir support to playwright-cli so users can redirect output files (snapshots, screenshots, etc.) to a directory outside the working tree.

  • Add --output-dir to the CLI client option parsing (minimist) and forward it to the daemon process
  • Register the option in the daemon's Commander definition and pass it through to configFromCLIOptions()
  • Add --output-dir to global help output and the open command help schema
  • Add tests verifying output files are written to the specified directory

Note on commands.ts quoting change

The existing property keys in the open command's options: z.object({}) were unquoted. Adding 'output-dir' (which requires quotes due to the hyphen) triggered ESLint's quote-props consistency rule, so all sibling keys were quoted to satisfy the linter.

Fixes #39792

@178inaba
Copy link
Author

@microsoft-github-policy-service agree

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.

[Feature]: Add --output-dir CLI flag to playwright-cli

1 participant