Skip to content

Visual Studio Code, rebuilt in Rust

Rust

docs(agents): open pull requests with labels and a review request (#73)

Artur Roka3741deee68b
diff --git a/.agents/skills/pr/SKILL.md b/.agents/skills/pr/SKILL.md
new file mode 100644
index 00000000000..ce2a5c140d0
--- /dev/null
+++ b/.agents/skills/pr/SKILL.md
@@ -0,0 +1,97 @@
+---
+name: pr
+description: Open a pull request in VSRustium, or write its title and body. Also asks rokartur-review for review. Wins over the global `pr` skill in this repo.
+---
+
+# PR
+
+The repo's own version of `~/.agents/skills/pr`: the same title and body rules, plus the remote, the labels and the reviewer this repo uses.
+
+## Steps
+
+1. `git status --porcelain`, `git branch --show-current`, `gh pr view --json url,state`. Stop and say so if there are uncommitted changes, if `main` is checked out, or if this branch already has an open PR.
+2. Base: `main`, unless the branch stacks on an unmerged branch. In that case the base is that branch, and the body says `Stacked on #<n>`.
+3. Title: Conventional Commits, `type(scope): subject`. Copy the scopes of `gh pr list --state merged --limit 10` and `git log --oneline -10`. The subject names what the change does for the reader, not the mechanism, in at most 72 characters. The type also picks the PR's type label (see [Labels](#labels)).
+4. Body from the [Body](#body) template. If asked only for the title or body: show them and stop.
+5. Before pushing, read the body as a stranger would: the repo is public, so the body holds no credentials, personal data, local paths outside the repo, or internal links.
+6. `git push -u vsrustium HEAD` (the remote is `vsrustium`, not `origin`). Write the body into `f=$(mktemp)`, then run `gh pr create --base <base> --title '...' --body-file "$f"`, then `rm "$f"`. Open a real PR, not a draft: review bots skip drafts.
+7. Judgement labels from [Labels](#labels), if any apply: `gh pr edit <n> --add-label 'a,b'`.
+8. Reviewer: `gh pr edit <n> --add-reviewer rokartur-review`, then check it took: `gh pr view <n> --json reviewRequests --jq '[.reviewRequests[].login]'` must list `rokartur-review`. `gh pr edit` prints `ok` even when GitHub drops the request, for example when the account is not a collaborator. The bot reviews the owner's PRs only on this request, and takes itself off the list when its review is posted.
+9. Report: the URL, the labels you set, and whether the review request held.
+
+Done when the PR exists and `reviewRequests` lists `rokartur-review`, or the report says why it does not.
+
+## Labels
+
+The review bot (the `rokartur-review` GitHub App) labels every new PR within a minute: `size:*` from additions plus deletions, the type from the title (`feat`, `fix` gives `bug`, `perf` gives `performance`, `docs` gives `documentation`, `build(deps)` or `chore(deps)` gives `dependencies`), and `macos`, `windows` or `linux` when every changed file names that platform. It also reviews a PR someone else opens without being asked. Leave those labels to it.
+
+Set by hand, only when the rule matches:
+
+- `security`: the PR closes a hole an attacker could use.
+- `accessibility`: the PR changes what a screen reader, the keyboard-only path or contrast gives the user.
+- `WIP` or `DO NOT MERGE`: only when the user asks for one.
+
+The `pr:*` labels and `needs-rebase` belong to the review and land loop. This skill does not set them.
+
+## Body
+
+```markdown
+## Summary
+
+<the problem as the reader hits it, then the fix: two or three sentences>
+
+<optional: diagram, diff-sketch or tree>
+
+## Evidence
+
+- <the narrowest check that fails without the change: the command and its real result>
+
+## Merge Danger
+
+**Door:** <one-way or two-way>
+
+**Blast radius:** <what the change can reach, in a few words>
+
+Closes #<issue>
+```
+
+Skip preambles. Use the domain language of `GLOSSARY.md` once it exists, and port the names upstream VS Code uses.
+
+### Summary
+
+Take the problem from the user's request or the linked issue, not from the diff. Listing what changed is the diff's job.
+
+BAD: Removed implicit workspace carry-over from every "new thread" entry point (cmd+n, sidebar buttons, command palette). New threads inherit only the project from context.
+
+GOOD: The "new worktree" default was ignored when starting new threads on existing worktrees. Now the preference always applies.
+
+A difference from upstream 1.148.0 cites the upstream file and the `port/notes.md` decision or the ledger row that records it.
+
+Then add the smallest view that makes the key point clear. Pick one or a few:
+- pseudocode for logic;
+- a call tree for control flow;
+- a shallow file tree for a broad refactor;
+- a Mermaid sequence diagram for data flow;
+- a `diff` of an existing shape for what changes inside it.
+
+Place each view next to the text it supports.
+
+### Evidence
+
+Name the check that proves each claim, as AGENTS.md asks. Add these when the change touches their area:
+
+- tests: `port/tools/cargo-test -p <crate> <filter>`, with the test that failed before the change and passes after it;
+- extension host or API: the `port/tools/api-tests` and `port/tools/extension-tests` counts, before and after;
+- a hot path (`docs/performance.md`): its gate numbers, before and after;
+- render output: `port/tools/pixel-check` or `port/tools/ui-pair`. For a visual change, take screenshots and list their paths in the report so the user can attach them, because `gh` cannot upload images;
+- the ledger: the rows whose status changed, and `bun port/tools/ledger-check.ts` passing.
+
+### Merge Danger
+
+**Door:** one-way for a change that is hard to undo (a data or settings format that users' files keep, or a release step), two-way for the rest.
+
+**Blast radius:** everything the change can reach: the processes, the crates, extensions through the host API, users' settings or storage.
+
+### Issue links
+
+Add `Closes #<n>` on its own line for each issue the PR finishes. A PR that finishes part of an epic adds `Part of #<epic>`. Closing keywords work only in a PR whose base is `main`. A stacked PR's issues therefore go into the `Closes` lines of the PR that lands on `main`.
diff --git a/AGENTS.md b/AGENTS.md
index 943fcc93bbd..b7ebb9100a8 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -34,6 +34,10 @@ Rules:
GitHub Issues in `rokartur/vsrustium` via `gh`. See `docs/agents/issue-tracker.md`.
+### Pull requests
+
+Open every pull request through `.agents/skills/pr/SKILL.md`, the repo's own `pr` skill. It replaces the global one here, because it adds the `vsrustium` remote, the labels the review bot leaves to a person, and the `rokartur-review` review request.
+
### Triage labels
`needs-triage`, `needs more info`, `ready-for-agent`, `ready-for-human`, `wontfix`. See `docs/agents/triage-labels.md`.