gh

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub orientation

GitHub 操作指引

CLI contracts follow AVGVSTVS96/better-github-skill (no upstream license; reimplemented). Requires authenticated
gh
and Node ≥ 23.6.
CLI 约定遵循 AVGVSTVS96/better-github-skill(无上游许可证;已重新实现)。需要已认证的
gh
工具以及版本 ≥23.6 的 Node。

Flags

参数

FlagDefaultEffect
[pr]
/
--pr <n>
current branch PRTarget PR
-R owner/repo
cwd repoTarget repo; with
-R
also pass
pr
/
--pr
--json
offStructured output
--full
offSnapshot/threads: do not truncate bodies. CI: accepted; snippets stay capped
--all
offThreads: include resolved and outdated
--open
offThreads: unresolved including outdated
--author <login>
offThreads: filter by author
--since <ISO>
offThreads: activity at/after timestamp
--complete
offThreads: page leftover comments and reviews
--sha <SHA>
offCI: pin commit; not hunt surface 6
--list
offCI: recent runs instead of drilldown
-L <n>
10CI
--list
: how many runs
--workflow <W>
offCI
--list
: filter by name or file
[run-id]
PR failing checksCI: analyze that Actions run
--all
and
--open
conflict:
BLOCKED
. Missing values are
BLOCKED
. No flags mean current-branch PR, cwd repo, truncated text.
参数默认值作用
[pr]
/
--pr <n>
当前分支对应的PR目标PR
-R owner/repo
当前工作目录仓库目标仓库;使用
-R
时需同时指定
pr
/
--pr
--json
关闭结构化输出
--full
关闭快照/线程:不截断内容。CI:启用;代码片段仍保持长度限制
--all
关闭线程:包含已解决和过时的内容
--open
关闭线程:包含未解决的内容(包括过时的)
--author <login>
关闭线程:按作者筛选
--since <ISO>
关闭线程:筛选指定时间戳及之后的活动
--complete
关闭线程:分页加载剩余的评论和评审
--sha <SHA>
关闭CI:固定提交;不触发场景6的检索
--list
关闭CI:显示最近的运行记录而非深入分析
-L <n>
10CI
--list
:显示的运行记录数量
--workflow <W>
关闭CI
--list
:按名称或文件筛选工作流
[run-id]
PR对应的失败检查CI:分析该Actions运行记录
--all
--open
冲突:标记为
BLOCKED
。缺失必要值时也标记为
BLOCKED
。无参数时默认处理当前分支PR、当前工作目录仓库,且内容会被截断。

Iron laws

核心规则

  1. Scripts for the three inspect loops; raw
    gh
    for everything else. Before any raw
    gh
    command, apply the gotchas in
    ./REFERENCE.md
    .
  2. Snapshot is PR state; threads is what reviewers wrote. Neither replaces the other.
  3. Scripts exit 0 when the report succeeds. Red CI and open threads are not script failures. Never
    gh | head
    . EPIPE is not failure.
  4. Never reply, resolve, push, or merge.
  1. 三个检查循环使用脚本实现;其他所有操作使用原生
    gh
    命令。执行任何原生
    gh
    命令前,需遵循
    ./REFERENCE.md
    中的注意事项。
  2. 快照展示PR的当前状态;线程展示评审者的评论内容。两者功能互不替代。
  3. 脚本生成报告成功时返回0。失败的CI或未关闭的线程不属于脚本执行失败。禁止使用
    gh | head
    命令。EPIPE 错误不算执行失败。
  4. 禁止回复、解决问题、推送代码或合并PR。

Scripts

脚本

Resolve
<anchor>
as the directory containing this
SKILL.md
. Run with
node
. Load JSON shapes in
./REFERENCE.md
before parsing
--json
.
ScriptCovers
<anchor>/scripts/pr-snapshot.ts [pr] [--pr n] [-R owner/repo] [--full] [--json]
Meta, mergeability, checks, files, reviews, comments, thread counts
<anchor>/scripts/pr-threads.ts [pr] [--pr n] [-R owner/repo] [--all|--open] [--author] [--since] [--full] [--json] [--complete]
Review bodies, issue comments, inline threads with resolution
<anchor>/scripts/ci-failures.ts [run-id] [--pr N] [--sha SHA] [--list [-L n] [--workflow W]] [--full] [-R owner/repo] [--json]
Failing checks → jobs/steps → snippet; logs on disk
<anchor>
解析为包含此
SKILL.md
文件的目录。使用
node
运行脚本。解析
--json
输出前,请先查看
./REFERENCE.md
中的JSON结构定义。
脚本涵盖内容
<anchor>/scripts/pr-snapshot.ts [pr] [--pr n] [-R owner/repo] [--full] [--json]
元信息、可合并性、检查状态、文件变更、评审记录、评论内容、线程数量
<anchor>/scripts/pr-threads.ts [pr] [--pr n] [-R owner/repo] [--all|--open] [--author] [--since] [--full] [--json] [--complete]
评审内容、议题评论、带解决状态的内联线程
<anchor>/scripts/ci-failures.ts [run-id] [--pr N] [--sha SHA] [--list [-L n] [--workflow W]] [--full] [-R owner/repo] [--json]
失败检查 → 任务/步骤 → 代码片段;磁盘上的日志文件

1. Resolve the target

1. 确定目标

Confirm
gh
is authenticated and Node is ≥ 23.6. Record owner/repo, PR or run id, SHA if known, and which surface. No PR for a PR-bound request is
NO_CHANGES
. Auth failure or missing
gh
is
BLOCKED
.
Record:
target | surface | command | terminal
.
Done when the target is identified or a terminal is set.
确认
gh
已完成认证且 Node 版本 ≥23.6。记录仓库所有者/仓库名、PR或运行记录ID、已知的SHA值,以及对应的场景。如果PR相关请求未指定PR,则标记为
NO_CHANGES
。认证失败或未安装
gh
则标记为
BLOCKED
记录内容:
target | surface | command | terminal
当目标已确定或终端状态已设置时,此步骤完成。

2. Inspect

2. 检查

Pick one covering script. Pass
--sha
when the head SHA is known. Pass
--json --open --complete
when the consumer needs every unresolved thread. If no script covers the request, use raw
gh
after applying gotchas in
./REFERENCE.md
. Redirect large output to a file; never pipe to
head
.
Done when stdout is a complete report or stderr names a real failure.
选择一个对应的脚本。已知HEAD SHA时传入
--sha
参数。如果需要获取所有未解决的线程,传入
--json --open --complete
参数。如果没有脚本能满足需求,则在遵循
./REFERENCE.md
中的注意事项后使用原生
gh
命令。将大体积输出重定向到文件;禁止通过管道传递给
head
命令。
当标准输出为完整报告或标准错误输出明确指出真实失败时,此步骤完成。

3. Report

3. 报告

Summarize from the script output. Cite printed log paths; do not paste full CI logs. A set cap marker in
--json
means that list is incomplete. Green CI or zero threads is
SUCCESS
.
Terminal values are
SUCCESS
,
NO_CHANGES
(empty or no PR), and
BLOCKED
.
从脚本输出中提取摘要。引用打印出的日志路径;请勿粘贴完整的CI日志。
--json
输出中的长度限制标记表示列表内容不完整。CI状态正常或线程数量为0时标记为
SUCCESS
终端状态包括
SUCCESS
NO_CHANGES
(无内容或无PR)和
BLOCKED