diff --git a/.claude/skills/dev/SKILL.md b/.claude/skills/dev/SKILL.md new file mode 100644 index 0000000..f86a29b --- /dev/null +++ b/.claude/skills/dev/SKILL.md @@ -0,0 +1,8 @@ +--- +name: dev +description: Development workflows for the playwright-cli repository. Use when the user asks about rolling dependencies, releasing, or other repo maintenance tasks. +--- + +# Development skills + +* **Rolling Playwright dependency** [roll.md](roll.md) diff --git a/.claude/skills/dev/roll.md b/.claude/skills/dev/roll.md new file mode 100644 index 0000000..5341c96 --- /dev/null +++ b/.claude/skills/dev/roll.md @@ -0,0 +1,42 @@ +# How to roll Playwright dependency + +## Steps + +1. **Update Playwright packages** in `package.json`: + - Update `playwright` (dependency) and `@playwright/test` (devDependency) to the target version. + - Run `npm install` to update `package-lock.json`. + +2. **Run the update script** to sync skills and README: + ```bash + node scripts/update.js + ``` + This script: + - Runs `node playwright-cli.js install --skills` to regenerate skills from the new Playwright version. + - Copies the generated skills from `.claude/skills/playwright-cli/` into `skills/playwright-cli/`. + - Cleans up the generated `.claude/skills/` directory. + +3. **Update README.md** with relevant changes from the updated skill at `skills/playwright-cli/SKILL.md`. Compare the skill file with the README and update any sections that are out of date (commands, flags, default behaviors, examples). + +4. **Verify** the CLI works: + ```bash + node playwright-cli.js --help + ``` + +5. **Test** the CLI: + ```bash + npm run test + ``` + +5. **Create a branch and commit**: + - Branch name: `roll_` (e.g. `roll_214`) + - Commit message: `chore: roll Playwright to ` + +## Key files + +| File | Role | +|---|---| +| `package.json` | Playwright version pins (`playwright`, `@playwright/test`) | +| `playwright-cli.js` | CLI entry point — requires Playwright's program module | +| `scripts/update.js` | Automation script for syncing skills and README after version bump | +| `skills/playwright-cli/SKILL.md` | Skill definition installed from Playwright (source of truth for commands) | +| `README.md` | User-facing docs — must reflect current skill commands and behavior | diff --git a/.claude/skills/roll/SKILL.md b/.claude/skills/roll/SKILL.md deleted file mode 100644 index c119a65..0000000 --- a/.claude/skills/roll/SKILL.md +++ /dev/null @@ -1,4 +0,0 @@ -# How to roll skills - -- Read skill file at node_modules/playwright/lib/skill/SKILL.md -- Update README.md with the new relevant information from skill. diff --git a/README.md b/README.md index 1413832..ac5d4f1 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,6 @@ playwright-cli --help Claude Code, GitHub Copilot and others will use the locally installed skills. -Run this command in your project's root directory: - ```bash playwright-cli install --skills ``` @@ -76,16 +74,16 @@ playwright-cli open https://playwright.dev --headed ## Sessions -Playwright CLI will use a dedicated persistent profile by default. It means that -your cookies and other storage state will be preserved between the calls. You can use different -instances of the browser for different projects with sessions. +Playwright CLI keeps the browser profile in memory by default. Your cookies and storage state +are preserved between CLI calls within the session, but lost when the browser closes. Use +`--persistent` to save the profile to disk for persistence across browser restarts. -Following will result in two browsers with separate profiles being available. Pass `-s=` to +You can use different instances of the browser for different projects with sessions. Pass `-s=` to the invocation to talk to a specific browser. ```bash playwright-cli open https://playwright.dev -playwright-cli -s=example open https://example.com +playwright-cli -s=example open https://example.com --persistent playwright-cli list ``` diff --git a/package-lock.json b/package-lock.json index 7a80981..17717ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,13 +10,13 @@ "license": "Apache-2.0", "dependencies": { "minimist": "^1.2.5", - "playwright": "1.59.0-alpha-1770426101000" + "playwright": "1.59.0-alpha-2026-02-14" }, "bin": { "playwright-cli": "playwright-cli.js" }, "devDependencies": { - "@playwright/test": "1.59.0-alpha-1770426101000", + "@playwright/test": "1.59.0-alpha-2026-02-14", "@types/node": "^25.2.1" }, "engines": { @@ -24,13 +24,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.59.0-alpha-1770426101000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.0-alpha-1770426101000.tgz", - "integrity": "sha512-6cNoPv39I+mmnbVRbcP++blVI4cQHn7er6+DUkk/c2A/Eh3Lbdzs+1+33aNvg/GvciPzPAvVniJUvcAlwq7eFQ==", + "version": "1.59.0-alpha-2026-02-14", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.0-alpha-2026-02-14.tgz", + "integrity": "sha512-qRk14zmjmpNt8iEe5QuJ/zQfNvqayPr3NTmYiXvUKkH4VUEtBV6mGcUsx+AGXND3/gExoxHh3yL03eaw/7+o4Q==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.59.0-alpha-1770426101000" + "playwright": "1.59.0-alpha-2026-02-14" }, "bin": { "playwright": "cli.js" @@ -73,12 +73,12 @@ } }, "node_modules/playwright": { - "version": "1.59.0-alpha-1770426101000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.0-alpha-1770426101000.tgz", - "integrity": "sha512-v4XyNo3twOFpLTJteJb0LTxFC6MRVDuebk8XFjpMZKYk1c/z0+x+ABfoHnLaomJv50GN3KbwAeWCqifcUX2Wgg==", + "version": "1.59.0-alpha-2026-02-14", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.0-alpha-2026-02-14.tgz", + "integrity": "sha512-k9va3fYgzhrMpSgFyovKjFf/Pv69cvnAQtSqmGtEUD6Te9mpU/Pq+E/a1lUylYKtYC0jl1a821SgIW57uGObGQ==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.59.0-alpha-1770426101000" + "playwright-core": "1.59.0-alpha-2026-02-14" }, "bin": { "playwright": "cli.js" @@ -91,9 +91,9 @@ } }, "node_modules/playwright-core": { - "version": "1.59.0-alpha-1770426101000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.0-alpha-1770426101000.tgz", - "integrity": "sha512-tkCTC2sL3Nss+rjgtAKhAuWI3l6om6NB2R7RAiKrdX2oEqqYg2WWwL7cRZDerh20ihON6f+pvCC19AoV+NkjUg==", + "version": "1.59.0-alpha-2026-02-14", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.0-alpha-2026-02-14.tgz", + "integrity": "sha512-WGco2Dei6GL1ZdnPbIvwAz3vp51WzhUJYcG10KBLq1lMCiO4Av/YBdvsQUvi1GNVlP1ZDTFFUjvwjKWuA6m3Mg==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" diff --git a/package.json b/package.json index 3245ee8..cd586e1 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,12 @@ "test": "playwright test" }, "devDependencies": { - "@playwright/test": "1.59.0-alpha-1770426101000", + "@playwright/test": "1.59.0-alpha-2026-02-14", "@types/node": "^25.2.1" }, "dependencies": { "minimist": "^1.2.5", - "playwright": "1.59.0-alpha-1770426101000" + "playwright": "1.59.0-alpha-2026-02-14" }, "bin": { "playwright-cli": "playwright-cli.js" diff --git a/playwright-cli.js b/playwright-cli.js index 79ef979..5f04336 100755 --- a/playwright-cli.js +++ b/playwright-cli.js @@ -15,9 +15,4 @@ * limitations under the License. */ -const { program } = require('playwright/lib/mcp/terminal/program'); -const packageLocation = require.resolve('./package.json'); -program(packageLocation).catch(e => { - console.error(e.message); - process.exit(1); -}); +require('playwright/lib/cli/client/program'); diff --git a/scripts/update.js b/scripts/update.js index cf6c18c..a0b2325 100644 --- a/scripts/update.js +++ b/scripts/update.js @@ -11,15 +11,9 @@ function run(command, options = {}) { } async function main() { - // 1. Install latest @playwright/cli as dev dependency - console.log('\n=== Installing @playwright/cli ===\n'); - run('npm install --save-dev @playwright/cli@latest'); - const { version } = require(path.join(rootDir, 'node_modules', '@playwright', 'cli', 'package.json')); - console.log(`Installed @playwright/cli version: ${version}`); - // 2. Run playwright-cli install-skills console.log('\n=== Running playwright-cli install --skills ===\n'); - run('npx playwright-cli install --skills'); + run('node playwright-cli.js install --skills'); // 3. Move generated skills into the existing skills folder console.log('\n=== Updating skills folder ===\n'); @@ -39,19 +33,6 @@ async function main() { } catch { console.warn('Warning: Generated skills directory not found at', generatedSkillsDir); } - - // 4. Copy README from @playwright/cli to root folder - console.log('\n=== Copying README ===\n'); - const packageReadme = path.join(rootDir, 'node_modules', '@playwright', 'cli', 'README.md'); - const rootReadme = path.join(rootDir, 'README.md'); - - try { - await fs.copyFile(packageReadme, rootReadme); - console.log(`Copied README from ${packageReadme} to ${rootReadme}`); - } catch { - console.warn('Warning: README not found at', packageReadme); - } - console.log('\n=== Update complete! ===\n'); }