docs(skill): portable Firefox install command + agent-facing preflight check#9
Open
raykuo998 wants to merge 1 commit into
Open
docs(skill): portable Firefox install command + agent-facing preflight check#9raykuo998 wants to merge 1 commit into
raykuo998 wants to merge 1 commit into
Conversation
…cing preflight check The Prerequisites section told users to run "playwright install firefox", but the bare "playwright" console script is not on PATH for a number of common install paths — notably Windows Store Python, fresh `pip install --user` installs, and bare virtualenvs whose Scripts/ directory isn't shimmed. On those setups the documented command fails with "playwright: command not found" before the user can do anything. This change: - Switches the install command to `python -m playwright install firefox`, which is the official-equivalent invocation and resolves uniformly across Windows, macOS, Linux, virtualenvs, and Windows Store Python. - Adds a small preflight one-liner the agent (or user) can run before the first heredoc: it imports playwright, checks whether `firefox.executable_path` actually exists on disk, and prints `FIREFOX_READY` or `NEEDS_INSTALL`. This catches the surprising failure mode where `pip install playwright` populates `executable_path` to a versioned dir (e.g. `firefox-1509/...`) but the binary at that path isn't downloaded until the install step, which leads to `BrowserType.launch: Executable doesn't exist at ...` for the first heredoc. - Keeps the section short — no new code in any of the heredoc patterns, no new dependencies. Verified the preflight one-liner on Windows 11 + Python 3.12: prints `FIREFOX_READY` when Firefox is installed and `NEEDS_INSTALL` when the versioned firefox dir is empty.
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
The Prerequisites section of
skills/webwright/SKILL.mdinstructs the user to runplaywright install firefox. On a number of common Python setups the bareplaywrightconsole script is not onPATH:pip install --userinstalls where~/AppData/Roaming/Python/Python<ver>/Scripts(Windows) or~/.local/bin(POSIX) is not in the user's shellPATHScripts/directory isn't shimmed by the shellOn those setups the documented command fails with
playwright: command not foundbefore the user can do anything. Hit on a stock Windows 11 + Python 3.12 (Windows Store) install while running through Webwright's own SKILL onboarding flow.There's a second, more subtle friction: the moment
pip install playwrightruns,playwright.firefox.executable_pathresolves to a versioned path (e.g.<...>/ms-playwright/firefox-1509/firefox/firefox.exe) but the binary itself isn't downloaded until the install step. An agent that probesexecutable_pathto "verify Firefox is set up" gets a false positive, then crashes inside the first heredoc withBrowserType.launch: Executable doesn't exist at <path>. The Playwright error message is clear, but it costs a heredoc round-trip and is avoidable.Changes
Single file:
skills/webwright/SKILL.md— Prerequisites section only.Switch the install command to
python -m playwright install firefox. Official-equivalent invocation, resolves uniformly across Windows / macOS / Linux / virtualenvs / Windows Store Python.Add a one-line preflight check the agent can run before the first heredoc:
python -c "import pathlib; from playwright.sync_api import sync_playwright; p=sync_playwright().start(); ok=pathlib.Path(p.firefox.executable_path).exists(); p.stop(); print('FIREFOX_READY' if ok else 'NEEDS_INSTALL')"Prints
FIREFOX_READY/NEEDS_INSTALL. Cheap (a few hundred ms), gives the agent a deterministic detect-and-install branch instead of relying on the first heredoc to surface the error.Short narrative around both, explaining why
executable_pathexisting on disk is the right check (not just "playwright is installed").No changes to any heredoc patterns. No new dependencies. No behavior change for users who already have Firefox installed.
Verification
On the same Windows 11 + Python 3.12 (Windows Store) machine where I originally hit the
command not foundfailure:Confirmed
NEEDS_INSTALLis printed when the versioned firefox dir exists but the binary inside it does not (e.g. after apip install -U playwrightthat bumps the bundled Firefox revision but doesn't re-download).Test plan
playwright install firefox(bare) fails withcommand not foundon stock Windows 11 + Python 3.12 (Windows Store).python -m playwright install firefoxsucceeds on the same machine.FIREFOX_READYafter install andNEEDS_INSTALLwhen the binary is absent.Related
Independent of #8 (which fixes a
UnicodeEncodeErrorinplaywright_patterns.mdheredocs on Windows). Same overall onboarding flow on Windows but a different file and different root cause — kept atomic so reviews don't have to weigh them together.