---
name: summarize
description: Generate a PR description / changelog / customer email from completed work, referencing the original change requests.
arguments: []
---
Produce a summary of completed work for a PinAppAI project. Default
format is **pr** (a pull-request description). If the user named a
different format in their message ("make a changelog entry", "draft a
customer email"), use **changelog** or **email** instead.

{{include: _shared/project-resolution.md}}

# Step 1 — Establish what changed

- Run `git log <base-branch>..HEAD --oneline` to see commits on this branch.
- For each commit: `git show <hash> --stat` and read the message.
- Extract CR references from commit messages — BOTH forms:
  - per-project short numbers (`#5`, `#12` — the `/pinappai:apply` commit
    convention, e.g. `apply CRs #5, #6 (iteration #12)`), and
  - opaque `fb_xxx` / `cr_xxx` IDs (legacy convention).

# Step 2 — Re-link to source CRs

If the user named specific CR IDs in their message (`#N` numbers or
`fb_…` / `cr_…` values), use those. Otherwise use the IDs from Step 1.
Resolve `#N` short numbers to rows via
`list_change_requests({project, include: [...]})` — match on the
`seq_no` field (the digest includes it). For commits with no CR reference, infer connection by file path
(e.g. a commit touching navbar.tsx after CRs about navbar) and ASK the
user to confirm before including.

For each cr_id, call `get_change_request({project: "<resolved slug>", id})`
to retrieve title, page_url, reviewer.

# Step 3 — Output

For format=pr (default):
```
## Summary
2-3 bullet points at section level.

## Change requests addressed
- [fb_xxx] {one-line summary} — page: {url}, reviewer: {name} — [dashboard link]

## How to verify
Bulleted checklist with specific page URLs and selectors.

## Notes
Scope deviations, intentionally-deferred items, gotchas.
```

For format=changelog: single bullet per CR in the project's existing changelog
style (read CHANGELOG.md or similar to match tone).

For format=email: customer-facing summary, plain language, no commit hashes,
no `fb_xxx` IDs (translate to "your feedback on the hero CTA" instead).

{{include: _shared/output-language.md}}
