🚀 Feature Request
It would be great to have an --output-dir CLI option for playwright-cli commands, allowing users to specify where snapshot files are written without relying on the PLAYWRIGHT_MCP_OUTPUT_DIR environment variable or a config file.
The --output-dir option already exists in MCP server mode (playwright run-mcp-server --output-dir), but is not yet available for the CLI client (playwright-cli).
Example
# Current: requires environment variable
PLAYWRIGHT_MCP_OUTPUT_DIR=/tmp/pw-output playwright-cli open --headed "https://example.com"
# Proposed: CLI flag
playwright-cli open --headed --output-dir /tmp/pw-output "https://example.com"
Motivation
When using playwright-cli as a tool for AI coding agents (such as Claude Code), the CLI writes snapshot files to .playwright-cli/ in the current working directory by default. This can cause some friction:
- The current working directory is typically a git repository, so
.playwright-cli/ shows up as untracked files in git status.
- Since the agent is used across many different repositories, adding
.playwright-cli/ to each project's .gitignore is not practical.
- The existing workarounds — the
PLAYWRIGHT_MCP_OUTPUT_DIR environment variable, a config file (.playwright/cli.config.json with outputDir), or a global gitignore — all work, but a CLI flag would be more discoverable and self-documenting.
Since the outputDir config option is already supported in the config file schema and MCP server mode, exposing it as a CLI flag for playwright-cli would follow the same pattern as tools like pytest --basetemp and tsc --outDir.
I would be happy to submit a pull request for this if the team is open to the idea. Thank you for considering!
🚀 Feature Request
It would be great to have an
--output-dirCLI option forplaywright-clicommands, allowing users to specify where snapshot files are written without relying on thePLAYWRIGHT_MCP_OUTPUT_DIRenvironment variable or a config file.The
--output-diroption already exists in MCP server mode (playwright run-mcp-server --output-dir), but is not yet available for the CLI client (playwright-cli).Example
Motivation
When using
playwright-clias a tool for AI coding agents (such as Claude Code), the CLI writes snapshot files to.playwright-cli/in the current working directory by default. This can cause some friction:.playwright-cli/shows up as untracked files ingit status..playwright-cli/to each project's.gitignoreis not practical.PLAYWRIGHT_MCP_OUTPUT_DIRenvironment variable, a config file (.playwright/cli.config.jsonwithoutputDir), or a global gitignore — all work, but a CLI flag would be more discoverable and self-documenting.Since the
outputDirconfig option is already supported in the config file schema and MCP server mode, exposing it as a CLI flag forplaywright-cliwould follow the same pattern as tools likepytest --basetempandtsc --outDir.I would be happy to submit a pull request for this if the team is open to the idea. Thank you for considering!