feat: add Playwright MCP auto-setup to setup.sh#150
Conversation
- Add Playwright MCP installation to setup_browser_tools() function - Check for existing Playwright installation before prompting - Install browsers (chromium, firefox, webkit) via npx playwright install - Update browser tools summary to include Playwright - Mark t006 as complete in TODO.md Closes #t006
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the development environment setup by integrating Playwright MCP into the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThe TODO.md entry t006 is marked done with duration and notes. setup.sh's setup_browser_tools now conditionally initializes Playwright MCP when Bun/Node is present, prompts the user to install Playwright browsers, checks for existing installation, and runs installation via npx if approved. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds an automated setup for Playwright MCP to the setup.sh script. The changes are generally good, but I've identified a few issues that affect correctness and user experience. The check for an existing Playwright installation is unreliable and can lead to a state where necessary browser binaries are missing. Additionally, the user prompt for installation is case-sensitive, and the installation process itself suppresses all output, which would make the script appear to hang and would hide any potential errors. I've provided suggestions to address these points.
setup.sh
Outdated
| if npx playwright --version &> /dev/null 2>&1; then | ||
| print_success "Playwright already installed" |
There was a problem hiding this comment.
The current check npx playwright --version only verifies if the playwright npm package is available, not if the browser binaries are actually installed. This can lead to a false positive, where the script reports "Playwright already installed" but the necessary browsers are missing, and the user is never prompted to install them. This is particularly confusing since the comment on line 2223 states the check is for installed browsers.
A more reliable approach would be to check for the existence of the browser files themselves. While the browser path can be customized, checking the default cache directory is a much better heuristic.
| if npx playwright --version &> /dev/null 2>&1; then | |
| print_success "Playwright already installed" | |
| # Check if Playwright browsers are installed by checking the default cache dir | |
| if [ -d "$HOME/.cache/ms-playwright" ] && [ -n "$(ls -A "$HOME/.cache/ms-playwright" 2>/dev/null)" ]; then | |
| print_success "Playwright browsers appear to be installed" |
setup.sh
Outdated
|
|
||
| if [[ "$install_playwright" == "y" ]]; then | ||
| print_info "Installing Playwright browsers..." | ||
| if npx playwright install 2>/dev/null; then |
There was a problem hiding this comment.
The command npx playwright install has its standard error redirected to /dev/null. This is not ideal for a few reasons:
- Hides progress:
playwright installshows download progress for browsers, which can take time and a lot of bandwidth. Without this output, the script will appear to be frozen to the user. - Hides errors: If the installation fails, any error messages will be hidden, making it impossible for the user to diagnose the problem. The script will just print a generic "installation failed" message.
It would be much more user-friendly to let the command print its output to the terminal.
| if npx playwright install 2>/dev/null; then | |
| if npx playwright install; then |
| else | ||
| read -r -p "Install Playwright MCP with browsers (chromium, firefox, webkit)? (y/n): " install_playwright | ||
|
|
||
| if [[ "$install_playwright" == "y" ]]; then |
There was a problem hiding this comment.
The check for user input if [[ "$install_playwright" == "y" ]] is case-sensitive and will not accept 'Y' as an answer. For better usability, it's good practice to handle both uppercase and lowercase responses, which is also more consistent with other interactive prompts in this script.
| if [[ "$install_playwright" == "y" ]]; then | |
| if [[ "$install_playwright" =~ ^[Yy]$ ]]; then |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Thu Jan 22 01:41:34 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
🤖 Augment PR SummarySummary: Adds Playwright MCP auto-setup steps to the installer to make browser automation tooling easier to enable. Changes:
Technical Notes: The setup relies on Node.js being present and uses 🤖 Was this summary useful? React with 👍 or 👎 |
setup.sh
Outdated
| print_info "Setting up Playwright MCP..." | ||
|
|
||
| # Check if Playwright browsers are installed | ||
| if npx playwright --version &> /dev/null 2>&1; then |
There was a problem hiding this comment.
Using npx playwright --version as an “already installed” check may still download/run Playwright even when it isn’t installed locally, which can incorrectly skip the npx playwright install path. Consider a no-install check (e.g., npx --no-install) or checking for an installed playwright binary so this behaves deterministically.
🤖 Was this useful? React with 👍 or 👎
| if npx playwright --version &> /dev/null 2>&1; then | ||
| print_success "Playwright already installed" | ||
| else | ||
| read -r -p "Install Playwright MCP with browsers (chromium, firefox, webkit)? (y/n): " install_playwright |
There was a problem hiding this comment.
This read -r -p prompt can block non-interactive runs: confirm_step returns success when INTERACTIVE_MODE != true, so setup_browser_tools may run unattended and hang here. Consider gating this prompt behind INTERACTIVE_MODE (or defaulting to skip/install without prompting) to keep non-interactive setups from stalling.
🤖 Was this useful? React with 👍 or 👎
setup.sh
Outdated
| print_info "Playwright MCP runs via: npx playwright-mcp@latest" | ||
| fi | ||
|
|
||
| print_info "Browser tools: dev-browser (stateful), Playwriter (extension), Playwright (testing), Stagehand (AI)" |
There was a problem hiding this comment.
The final “Browser tools” summary always includes Playwright (testing) even when Node.js is missing and the Playwright setup block is skipped. Consider making this summary conditional (or noting dependencies) so the output reflects what was actually available/installed.
🤖 Was this useful? React with 👍 or 👎
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@setup.sh`:
- Around line 2223-2235: Replace the presence check "npx playwright --version"
with "npx --no-install playwright --version" so npx won't auto-download; declare
the prompt variable as local (local install_playwright) where it's read; and
ensure the surrounding function (the Playwright install check block) ends with
an explicit return statement (e.g., return or return 0) to satisfy the shell
coding guidelines—look for the read -r -p line that sets install_playwright and
the Playwright check invocation to apply these changes.
🧹 Nitpick comments (1)
setup.sh (1)
2227-2247: Declare the prompt variable locally and return explicitly.
install_playwrightis introduced withoutlocal, and the function still relies on implicit exit status. Please localize the variable and add an explicitreturn 0to keep the shell hygiene consistent.As per coding guidelines, please keep shell locals and explicit returns consistent.♻️ Suggested refactor
- read -r -p "Install Playwright MCP with browsers (chromium, firefox, webkit)? (y/n): " install_playwright + local install_playwright + read -r -p "Install Playwright MCP with browsers (chromium, firefox, webkit)? (y/n): " install_playwright @@ - print_info "Browser tools: dev-browser (stateful), Playwriter (extension), Playwright (testing), Stagehand (AI)" + print_info "Browser tools: dev-browser (stateful), Playwriter (extension), Playwright (testing), Stagehand (AI)" + return 0
- Use npx --no-install to prevent auto-download during version check - Declare install_playwright as local variable - Add explicit return 0 at end of setup_browser_tools()
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 24 03:12:44 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
- Remove 2>/dev/null from npx playwright install to show download progress - Make browser tools summary conditional on Node.js availability
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 24 03:16:15 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
- playwright.md: Add installation section with setup.sh reference, MCP config - README.md: Note auto-install in MCP table and browser category - browser-automation.md: Update install method to reference setup.sh - onboarding-helper.sh: Use --no-install flag for consistent version check
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 24 03:21:29 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |



Summary
setup_browser_tools()function in setup.shnpx playwright installChanges
setup.sh: Added Playwright MCP setup section with:
npx playwright-mcp@latestTODO.md: Marked t006 as complete
Testing
The setup can be tested by running:
And selecting "Setup browser automation tools" when prompted.
Closes t006
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.