|
| 1 | +# Implement Puppeteer Release |
| 2 | + |
| 3 | +## Context |
| 4 | +You are automating the implementation of all PRs from a Puppeteer release into PuppeteerSharp using parallel sub-agents and git worktrees. |
| 5 | + |
| 6 | +## Task |
| 7 | + |
| 8 | +Process the GitHub release at `$ARGUMENTS` and implement each non-documentation PR in parallel (max 3 concurrent). |
| 9 | + |
| 10 | +## Workflow |
| 11 | + |
| 12 | +### Step 1: Parse the Release |
| 13 | + |
| 14 | +Extract the tag from the `$ARGUMENTS` URL (e.g. `https://github.com/nicknisi/puppeteer/releases/tag/puppeteer-v24.7.2` → `puppeteer-v24.7.2`). |
| 15 | + |
| 16 | +Fetch the release body: |
| 17 | +```bash |
| 18 | +gh release view <tag> --repo nicknisi/puppeteer --json body -q .body |
| 19 | +``` |
| 20 | + |
| 21 | +### Step 2: Extract and Filter PRs |
| 22 | + |
| 23 | +Parse all PR references from the release notes. PRs appear as `[#NUMBER](URL)` links in the body. |
| 24 | + |
| 25 | +**Skip documentation-only PRs**: Any PR listed under a `Documentation` section header should be skipped. Track these for the final report. |
| 26 | + |
| 27 | +### Step 3: Fetch origin |
| 28 | + |
| 29 | +Run `git fetch origin` once before processing any PRs. |
| 30 | + |
| 31 | +### Step 4: Process PRs in Batches of 3 |
| 32 | + |
| 33 | +For each batch of up to 3 PRs, launch 3 `general-purpose` Task sub-agents **in parallel** (in a single message with multiple tool uses). Wait for the batch to complete before starting the next batch. |
| 34 | + |
| 35 | +Each sub-agent receives the following self-contained prompt (fill in `<PR_NUMBER>` and `<PR_URL>`): |
| 36 | + |
| 37 | +~~~ |
| 38 | +You are implementing upstream Puppeteer PR #<PR_NUMBER> (<PR_URL>) into the PuppeteerSharp .NET project. |
| 39 | +
|
| 40 | +## Setup |
| 41 | +
|
| 42 | +1. Create a git worktree for your work: |
| 43 | + ```bash |
| 44 | + git worktree add -b implement-upstream-change-<PR_NUMBER> ../puppeteer-sharp-pr-<PR_NUMBER> origin/master |
| 45 | + ``` |
| 46 | +2. Change your working directory to `../puppeteer-sharp-pr-<PR_NUMBER>` for ALL subsequent commands. |
| 47 | +
|
| 48 | +## Research |
| 49 | +
|
| 50 | +3. Read the upstream PR to understand the changes: |
| 51 | + ```bash |
| 52 | + gh pr view <PR_NUMBER> --repo nicknisi/puppeteer --json title,body,files |
| 53 | + gh pr diff <PR_NUMBER> --repo nicknisi/puppeteer |
| 54 | + ``` |
| 55 | +4. Read the relevant upstream source files in `../../puppeteer/puppeteer` to understand context. |
| 56 | +5. Read the corresponding PuppeteerSharp files to understand the current .NET implementation. |
| 57 | +
|
| 58 | +## Implementation |
| 59 | +
|
| 60 | +6. Implement the changes following .NET idioms and PuppeteerSharp patterns: |
| 61 | + - Upstream `puppeteer-core/src/api/*` maps to abstract base classes |
| 62 | + - Upstream `puppeteer-core/src/bidi/*` maps to `Bidi/` classes |
| 63 | + - Upstream `puppeteer-core/src/cdp/*` maps to `Cdp/` classes |
| 64 | + - All new tests must use `[Test, PuppeteerTest("<spec-file>", "<describes chain>", "<test-name>")]` |
| 65 | + - Look at existing tests for reference on attribute usage |
| 66 | +
|
| 67 | +## Verification |
| 68 | +
|
| 69 | +7. Build and run related tests: |
| 70 | + ```bash |
| 71 | + cd ../puppeteer-sharp-pr-<PR_NUMBER> |
| 72 | + BROWSER=CHROME PROTOCOL=cdp dotnet build lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj |
| 73 | + BROWSER=CHROME PROTOCOL=cdp dotnet test lib/PuppeteerSharp.Tests/PuppeteerSharp.Tests.csproj --filter "FullyQualifiedName~<RelevantTestClass>" --no-build -- NUnit.TestOutputXml=TestResults |
| 74 | + ``` |
| 75 | + Fix any failing tests before proceeding. |
| 76 | +
|
| 77 | +## Commit, Push, and PR |
| 78 | +
|
| 79 | +8. Stage and commit your changes with a descriptive message referencing the upstream PR. |
| 80 | +9. Push the branch: |
| 81 | + ```bash |
| 82 | + git push -u origin implement-upstream-change-<PR_NUMBER> |
| 83 | + ``` |
| 84 | +10. Create a PR: |
| 85 | + ```bash |
| 86 | + gh pr create --title "Implement upstream PR #<PR_NUMBER>" --body "Implements changes from <PR_URL>" --base master |
| 87 | + ``` |
| 88 | +
|
| 89 | +## Important |
| 90 | +- ALL file operations and commands must run inside the worktree at `../puppeteer-sharp-pr-<PR_NUMBER>` |
| 91 | +- Do NOT modify the main working tree |
| 92 | +- If the PR has no meaningful code changes for PuppeteerSharp (e.g. infra-only, upstream-tooling), commit a no-op with a note and still create the PR |
| 93 | +~~~ |
| 94 | + |
| 95 | +### Step 5: Final Report |
| 96 | + |
| 97 | +After all batches complete, print a summary: |
| 98 | + |
| 99 | +``` |
| 100 | +## Release Implementation Report |
| 101 | +
|
| 102 | +### Implemented |
| 103 | +- #XXXX - <title> - <status: success/failed> |
| 104 | +- ... |
| 105 | +
|
| 106 | +### Skipped (Documentation) |
| 107 | +- #XXXX - <title> |
| 108 | +- ... |
| 109 | +
|
| 110 | +### Cleanup |
| 111 | +Run `/remove-all-worktrees` to clean up worktree directories. |
| 112 | +``` |
0 commit comments