pr-inline-comments
Fetch inline (code) review comments on a GitHub pull request, grouped into threads, with optional filtering by datetime. Use when the user asks to read or address PR comments, code review feedback, reviewer notes, or wants to see only recent review activity on a PR. Resolves natural-language time windows like "last 30 minutes", "since yesterday 5 PM", or "since commit abc123" into ISO 8601 before invoking the script. Should be invoked as a sub-agent so the large JSON result stays out of the main agent context, run with a low-intelligence model when one is available, since the work is mechanical. Requires gh and jq.
sesori-ai · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add sesori-ai/sesori_apps_monorepo --skill pr-inline-comments技能说明
name: pr-inline-comments description: Fetch inline (code) review comments on a GitHub pull request, grouped into threads, with optional filtering by datetime. Use when the user asks to read or address PR comments, code review feedback, reviewer notes, or wants to see only recent review activity on a PR. Resolves natural-language time windows like "last 30 minutes", "since yesterday 5 PM", or "since commit abc123" into ISO 8601 before invoking the script. Should be invoked as a sub-agent so the large JSON result stays out of the main agent context, run with a low-intelligence model when one is available, since the work is mechanical. Requires gh and jq.
pr-inline-comments
Returns inline code review comments on a PR, grouped into threads, optionally filtered by datetime and/or resolution status. Issue-level PR comments (those not anchored to a line of code) are not included.
Role
Fetch the comments and nothing else. Do not add commentary, and do not speculate about what the comments mean or how to act on them — that judgment belongs to the caller. Return what the script produces: the JSON output verbatim, or a one-line summary plus the JSON when the caller explicitly asks for a summary.
Steps:
- Parse the request for the PR number, an optional time window, and whether to filter to unresolved.
- Resolve any natural-language datetime to ISO 8601 as described below.
- Run the script.
- Return the result.
This skill only reads. It never edits or writes files.
Backed by the GitHub GraphQL API, which exposes review threads natively (with isResolved and isOutdated). The REST /pulls/{n}/comments endpoint does not expose resolution status.
Output schema
A single JSON array of thread objects. Thread-level fields appear once per thread. Per-comment fields live only inside comments[].
[
{
"thread_id": 100,
"path": "src/foo.ts",
"line": 42,
"side": "RIGHT",
"start_line": null,
"is_resolved": false,
"is_outdated": false,
"commit_id": "abc123",
"diff_hunk": "@@ -40,3 +40,3 @@",
"url": "https://github.com/o/r/pull/1#discussion_r100",
"latest_at": "2026-04-29T13:30:00Z",
"comments": [
{ "id": 100, "user": "alice", "body": "...", "created_at": "...", "updated_at": "...", "html_url": "..." },
{ "id": 101, "user": "bob", "body": "...", "created_at": "...", "updated_at": "...", "html_url": "..." }
]
}
]
Thread-level fields (thread_id, path, line, side, start_line, is_resolved, is_outdated, commit_id, diff_hunk, url, latest_at) come from the thread itself or its root comment. Replies do not repeat them. Per-comment fields are limited to id, user, body, created_at, updated_at, html_url.
thread_id is the GraphQL databaseId of the root comment, equivalent to the REST comment id (a stable integer).
latest_at is the maximum createdAt across all comments in the thread.
Threads are sorted by path, then line, then thread_id.
Invocation
./scripts/fetch.sh <pr-number> [--since ISO_DATETIME] [--unresolved] [--repo OWNER/REPO]
Avoiding output truncation: The JSON output can be large. To prevent truncation by the shell or terminal, redirect stdout to a uniquely-named file and read from there:
PR_NUMBER="<pr-number>"
OUTFILE="/tmp/pr_${PR_NUMBER}_comments_$(date +%Y%m%d_%H%M%S).json"
./scripts/fetch.sh "$PR_NUMBER" --unresolved > "$OUTFILE"
# Then read "$OUTFILE"
The timestamp in the filename prevents conflicts with stale files from previous runs or other PRs.
Flags:
--since ISO_DATETIME: keep only threads whose latest comment is at or after the given datetime. Inclusive. The whole thread is returned (including older replies) when it qualifies.--unresolved: keep only threads whereis_resolved == false.--repo OWNER/REPO: override the current repo. Defaults togh repo view --json nameWithOwner.
--since and --unresolved compose: a thread must satisfy both to be kept.
--since accepted formats
The script validates input strictly and normalizes to UTC Z form internally. Any of these are accepted:
2026-04-29T14:30:00Z
2026-04-29T17:00:00+03:00
2026-04-29T17:00:00+0300
2026-04-29T14:30:00.123Z # fractional seconds are accepted and stripped
Invalid inputs (no timezone, date only, wrong shape) cause the script to exit with a clear error before any API calls.
If the input is not already in canonical UTC Z form, the script prints a normalization line to stderr, e.g.:
Normalized --since: 2026-04-28T17:00:00+03:00 -> 2026-04-28T14:00:00Z
This is informational only and does not affect stdout.
Resolving --since from natural language
Convert the user's expression to any valid ISO 8601 datetime with a timezone, then pass it to the script. The script handles UTC normalization regardless of platform. There is no need to use date -d (GNU) or date -j -f (BSD) directly.
Relative durations
Examples: "last 30 minutes", "past 2 hours", "in the last day", "last week".
Use Python (always available on macOS and Linux, stdlib only):
# 30 minutes ago, in UTC Z form
python3 -c "from datetime import datetime, timedelta, timezone; print((datetime.now(timezone.utc) - timedelta(minutes=30)).strftime('%Y-%m-%dT%H:%M:%SZ'))"
# 2 hours ago
python3 -c "from datetime import datetime, timedelta, timezone; print((datetime.now(timezone.utc) - timedelta(hours=2)).strftime('%Y-%m-%dT%H:%M:%SZ'))"
# 1 day ago
python3 -c "from datetime import datetime, timedelta, timezone; print((datetime.now(timezone.utc) - timedelta(days=1)).strftime('%Y-%m-%dT%H:%M:%SZ'))"
For "current UTC now" without a library, POSIX date works on both platforms:
date -u +"%Y-%m-%dT%H:%M:%SZ"
Clock-time references
Examples: "since yesterday 5 PM", "since Monday 9 AM", "since this morning".
Resolve in the user's local timezone (assume system local unless they explicitl
阅读完整来源 ↗