con un clic
r2
// Interact with Cloudflare R2 object storage - list objects, view stats, fetch files, and verify backup integrity. Usage: /r2 <command> [bucket] [args]
// Interact with Cloudflare R2 object storage - list objects, view stats, fetch files, and verify backup integrity. Usage: /r2 <command> [bucket] [args]
Investigate and fix a Sentry issue in this codebase. Use when the user provides a Sentry issue URL or ID and wants diagnosis, a fix, verification, or a PR.
Interact with the Fizzy tracker for Pagecord work. Use when the user asks to list, create, update, move, close, comment on, or inspect Fizzy cards or boards.
Run the local CI sequence for this repo. Use when the user asks to run CI, verify a branch before push, or check code quality with the full local pipeline.
Interact with the Pagecord API for a blog. Use when the user wants to inspect posts or pages, publish content through the API, check API connectivity, or inspect the home page.
Interact with Cloudflare R2 buckets used by Pagecord. Use when the user wants to list objects, inspect bucket stats, fetch files, or check backup integrity in R2.
Investigate a customer support email and draft a reply. Use when the user pastes a customer message, bug report, billing question, feature request, or how-to question.
| name | r2 |
| description | Interact with Cloudflare R2 object storage - list objects, view stats, fetch files, and verify backup integrity. Usage: /r2 <command> [bucket] [args] |
Interact with Cloudflare R2 buckets via the Cloudflare API.
Read credentials from .env:
grep '^CLOUDFLARE_' /Users/olly/dev/pagecord/.env
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_R2_{BUCKET_ENV} or CLOUDFLARE_R2_{BUCKET_ENV}_READ_ONLYTo map a bucket name to its env var: uppercase it and replace hyphens with underscores.
Example: pagecord-wal-backups → look for CLOUDFLARE_R2_PAGECORD_WAL_BACKUPS or CLOUDFLARE_R2_PAGECORD_WAL_BACKUPS_READ_ONLY.
Also try matching just a portion (e.g. WAL_BACKUPS) if the full name has a common prefix like pagecord-.
If only one bucket token is configured, use it automatically. If multiple, and no bucket is specified, list them and ask.
If CLOUDFLARE_ACCOUNT_ID is missing, stop and tell the user to add it to .env.
Base API URL: https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/r2/buckets/{BUCKET}
All requests use -H "Authorization: Bearer {TOKEN}".
Paginate object listings using the cursor from result_info when is_truncated is true. Always fetch all pages for check/inspect/stat commands.
Usage: /r2 <command> [bucket] [args]
ls [bucket] [prefix]List objects in a bucket, optionally filtered by prefix.
GET /objects?per_page=1000&prefix={PREFIX}
Display as a table: key, size (human-readable), last modified. Show total count and total size at the bottom. Paginate if needed but limit display to first 100 rows; note if truncated for display only.
stat [bucket]Show a summary of the bucket. Fetch all pages.
Report:
cat [bucket] [key]Fetch and display the contents of a single object.
GET /objects/{KEY}
Pretty-print if JSON. Warn if the object is large (> 100 KB) before fetching.
check [bucket]Surface-level integrity check — does not fetch file contents, only inspects the object listing.
*/basebackups_005/ and */wal_005/ prefixes exist.If WAL-G structure detected:
*/basebackups_005/base_*/ (exclude sentinel files themselves){dir_name}_backup_stop_sentinel.json exists*/wal_005/[0-9A-F]{24}.lz4 (standard 24-hex-char WAL names, no dots)If no WAL-G structure:
Output table:
| Check | Status |
|---|---|
| Base backups found | ✅ N |
| All sentinels present | ✅ / ⚠️ missing: [...] |
| WAL segments | ✅ N segments |
| WAL continuity | ✅ No gaps / ⚠️ N gaps found |
| WAL recency | ✅ Latest N min ago / ⚠️ Last WAL is Xh old |
inspect [bucket]Deep integrity check — fetches and parses backup metadata files.
Run all check steps first (object listing analysis), then additionally:
_backup_stop_sentinel.json and parse:
StartTime, FinishTime, LSN, FinishLSN, PgVersion, Hostname, CompressedSize, UncompressedSize, IsPermanentFinishTime > StartTime and sentinel exists)PgVersion and HostnameIsPermanent flag noted (false means subject to WAL-G retention/expiry)FinishLSNOutput: surface check table + backup detail table:
| Backup | Started | Duration | Compressed | PG Version | LSN Range |
|---|---|---|---|---|---|
| base_000...66 | 2026-03-18 03:00 UTC | 5s | 529 MB | 18.2 | 0x...→0x... |
| ... |
Then a final verdict: ✅ All checks passed / ⚠️ Issues found: [list]