# PR review queue

Pull requests waiting on the user's review. Each row opens the PR; a button refreshes the list.

**Sizes:** small (how many), medium (two PRs and the buttons), large (the queue)
**Interaction:** a button answered by a listener, and a link button
**Freshness:** your agent every 15 to 30 minutes in working hours, and on Refresh

## Widget

```json
{
  "slug": "pr-queue",
  "title": "Reviews",
  "symbol": "arrow.triangle.pull",
  "accent": "#5E5CE6",
  "blocks": [
    { "type": "metric", "label": "Need review", "value": "3" },
    { "type": "list", "title": "Review queue", "items": [
      { "title": "feat: SSO support", "detail": "@alice +340", "url": "https://github.com/org/repo/pull/142" },
      { "title": "fix: worker memory leak", "detail": "@bob +8", "url": "https://github.com/org/repo/pull/141" },
      { "title": "chore: upgrade deps", "detail": "@carol +2", "url": "https://github.com/org/repo/pull/139" }
    ] },
    { "type": "buttons", "items": [
      { "label": "Refresh", "id": "refresh", "symbol": "arrow.clockwise" },
      { "label": "GitHub", "symbol": "safari.fill", "url": "https://github.com/pulls/review-requested" }
    ] }
  ],
  "sizes": { "small": [0], "medium": [1, 2], "large": [0, 1, 2] },
  "lock": { "circular": 0, "inline": "3 PRs to review" }
}
```

Medium shows two rows above the buttons; large shows the count, up to 5 rows with their details, and the buttons.

## Refresh handler

```javascript
// pr-handler.mjs, run by listen.mjs
import { readFileSync } from "node:fs";
const event = JSON.parse(readFileSync(0, "utf8"));
if (event.target !== "refresh") process.exit(0);

const res = await fetch("https://api.github.com/search/issues?q=is:pr+is:open+review-requested:@me", {
  headers: { authorization: `Bearer ${process.env.GITHUB_TOKEN}`, accept: "application/vnd.github+json" },
});
const { items = [] } = await res.json();

console.log(JSON.stringify({
  blocks: [
    { type: "metric", label: "Need review", value: String(items.length) },
    items.length
      ? { type: "list", title: "Review queue", items: items.slice(0, 6).map((pr) => ({ title: pr.title.slice(0, 41), detail: `@${pr.user.login}`, url: pr.html_url })) }
      : { type: "list", items: ["Nothing to review"] },
    { type: "buttons", items: [
      { label: "Refresh", id: "refresh", symbol: "arrow.clockwise" },
      { label: "GitHub", symbol: "safari.fill", url: "https://github.com/pulls/review-requested" },
    ] },
  ],
  lock: { circular: 0, inline: `${items.length} PRs to review` },
  relevance: items.length ? 60 : 10,
}));
```

GitHub's API needs a token in a header, so this can't be a Droplet.ai job; your agent fetches and writes it.
