Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .claude/skills/dev/SKILL.md
Original file line number Diff line number Diff line change
@@ -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)
42 changes: 42 additions & 0 deletions .claude/skills/dev/roll.md
Original file line number Diff line number Diff line change
@@ -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_<version>` (e.g. `roll_214`)
- Commit message: `chore: roll Playwright to <version>`

## 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 |
4 changes: 0 additions & 4 deletions .claude/skills/roll/SKILL.md

This file was deleted.

12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
```

Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 1 addition & 6 deletions playwright-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
21 changes: 1 addition & 20 deletions scripts/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
}

Expand Down