refactor: make SKILL.md source of truth, generate prompt.md from it
This commit is contained in:
@@ -5,7 +5,7 @@ this is the playwriter codebase
|
||||
the extension uses chrome.debugger to manage the user browser
|
||||
|
||||
read ./README.md for an overview of how this extension and mcp work
|
||||
read playwriter/src/prompt.md to understand how the MCP works
|
||||
read skills/playwriter/SKILL.md to understand the MCP docs (source of truth)
|
||||
|
||||
## backward compatibility
|
||||
|
||||
@@ -34,11 +34,11 @@ extension/ contains the chrome extension code. you need to run `pnpm build` to m
|
||||
|
||||
when I ask you to release extension run package.json release script
|
||||
|
||||
playwriter contains the ws server and MCP code. also the tests for the mcp are there. playwriter/src/prompt.md contains the docs for the MCP the agent will use. you should add there important sections that help the agent control the browser well with the MCP interface
|
||||
playwriter contains the ws server and MCP code. also the tests for the mcp are there. skills/playwriter/SKILL.md is the source of truth for MCP docs - edit that file to update agent instructions. the build script generates playwriter/src/prompt.md (gitignored) from SKILL.md, stripping CLI-only sections.
|
||||
|
||||
playwriter/src/resource.md is for more generic knowledge about playwright that the agent can use when necessary, for things like best practices for selecting locators on the page
|
||||
|
||||
website/public/resources/ is auto-generated by `playwriter/scripts/build-resources.ts` during `pnpm build`. DO NOT edit these files manually - edit the source files in `playwriter/src/` instead (e.g. `debugger-examples.ts`, `editor-examples.ts`, `styles-examples.ts`)
|
||||
website/public/resources/ and website/public/SKILL.md are auto-generated by `playwriter/scripts/build-resources.ts` during `pnpm build`. DO NOT edit these files manually - edit the source files instead (e.g. `debugger-examples.ts`, `editor-examples.ts`, `styles-examples.ts`, `skills/playwriter/SKILL.md`)
|
||||
|
||||
## CDP docs
|
||||
|
||||
@@ -69,7 +69,7 @@ remember that every time the extension is activated in a tab that tab gets added
|
||||
|
||||
to debug server or extension issues you can also inspect the file @playwriter/relay-server.log to see both extension and server logs. with all cdp events sent. to see if there are events missing or something broken. this file is recreated every time the server is started and appended in real time. use rg to only read relevant lines and parts because it can get quite long
|
||||
|
||||
IMPORTANT: `pnpm test` will take about 30 seconds so set a timeout of at least 60000ms when running the pnpm test bash command
|
||||
IMPORTANT: `pnpm test` will take about 1 minute or more so set a timeout of at least 90000ms when running the pnpm test bash command
|
||||
|
||||
## changelogs
|
||||
|
||||
@@ -93,6 +93,10 @@ the playwright source code is cloned at `./tmp/playwright` (gitignored). use Tas
|
||||
- `packages/playwright-core/src/server/chromium/crBrowser.ts` - browser and page discovery
|
||||
- `packages/playwright-core/src/server/chromium/chromium.ts` - connectOverCDP implementation
|
||||
|
||||
## ./claude-extension
|
||||
|
||||
ignore ./claude-extension. this is the source code of the Claude Chrome extension. used to reverse engineer new methods and tools to extract and control the page
|
||||
|
||||
# core guidelines
|
||||
|
||||
when summarizing changes at the end of the message, be super short, a few words and in bullet points, use bold text to highlight important keywords. use markdown.
|
||||
@@ -449,25 +453,28 @@ gh pr-review comments reply 42 -R owner/repo \
|
||||
gh pr-review threads resolve 42 -R owner/repo --thread-id PRRT_kwDOAAABbcdEFG12
|
||||
```
|
||||
|
||||
## listing, searching, reading github repos files with gitchamber
|
||||
## reading github repos source code
|
||||
|
||||
you MUST use gitchamber.com to read repo files. first ALWAYS run `curl https://gitchamber.com` to read detailed usage docs. always use curl to fetch the responses of gitchamber.com
|
||||
```sh
|
||||
opensrc zod # npm package name
|
||||
|
||||
for example when working with the vercel ai sdk, you can fetch the latest docs using:
|
||||
# Using github: prefix
|
||||
opensrc github:owner/repo
|
||||
|
||||
https://gitchamber.com/repos/facebook/react/main/files
|
||||
# Using owner/repo shorthand
|
||||
opensrc facebook/react
|
||||
|
||||
https://gitchamber.com/repos/remorses/fumabase/main/files?glob=**/*.ts
|
||||
# Using full GitHub URL
|
||||
opensrc https://github.com/colinhacks/zod
|
||||
|
||||
https://gitchamber.com/repos/facebook/react/main/files/README.md?start=10&end=50
|
||||
# Fetch a specific branch or tag
|
||||
opensrc owner/repo@v1.0.0
|
||||
opensrc owner/repo#main
|
||||
|
||||
https://gitchamber.com/repos/facebook/react/main/search/useState
|
||||
# Mix packages and repos
|
||||
```
|
||||
|
||||
gitchamber allows you to list, search and read files in a repo. you MUST use it over alternatives likes raw.github.com, because
|
||||
- it allows you to use context usage better via limit and offset pagination
|
||||
- it can list files, even filtering by a specific glob (default is *.md and *.mdx)
|
||||
- it can search a repo for a specific substring
|
||||
- it can show the code with line numbers for each line, letting you find a specific line number
|
||||
This will download the source code in ./opensrc. which should be put in .gitignore
|
||||
|
||||
# playwright
|
||||
|
||||
@@ -497,26 +504,3 @@ const jsonSchema = toJSONSchema(mySchema, {
|
||||
```
|
||||
|
||||
github.md
|
||||
|
||||
<!-- opensrc:start -->
|
||||
|
||||
## Source Code Reference
|
||||
|
||||
Source code for dependencies is available in `opensrc/` for deeper understanding of implementation details.
|
||||
|
||||
See `opensrc/sources.json` for the list of available packages and their versions.
|
||||
|
||||
Use this source code when you need to understand how a package works internally, not just its types/interface.
|
||||
|
||||
### Fetching Additional Source Code
|
||||
|
||||
To fetch source code for a package or repository you need to understand, run:
|
||||
|
||||
```bash
|
||||
npx opensrc <package> # npm package (e.g., npx opensrc zod)
|
||||
npx opensrc pypi:<package> # Python package (e.g., npx opensrc pypi:requests)
|
||||
npx opensrc crates:<package> # Rust crate (e.g., npx opensrc crates:serde)
|
||||
npx opensrc <owner>/<repo> # GitHub repo (e.g., npx opensrc vercel/ai)
|
||||
```
|
||||
|
||||
<!-- opensrc:end -->
|
||||
Reference in New Issue
Block a user