外部公关审查
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
关闭/合并→继续之前询问。起草→继续,在判决中注明。
在 SHA 头部需要一个独立的工作树。按顺序尝试。方法 A — 来自本地克隆的工作树(当 `git config remote.origin.url` 与 `$OWNER/$REPO` 匹配时): 方法 B — 新鲜的浅克隆:`gh pr checkout` 在具有 `cannot set up tracking information` 的浅克隆上失败 — 回退有效,因为提取已经创建了远程跟踪引用。如果布兰布尔后来抱怨缺少碱基,`git fetch --unshallow`。
`--goal` 是最高杠杆旋钮。如果没有严格的目标,codex/光标就会进入基础设施/锁定文件/跨存储库审计,并在一个小型 PR 上花费 5-8 分钟。将其写入`$WORKTREE_DIR/.external-review-goal.txt`:如果 PR 正文为空或一行,则替换为标题 + 第一个提交主题。不要让模型从分支名称中发明意图。
在 `Monitor` 下运行(通常 2-6 分钟):等待时不要调用 `ScheduleWakeup` 或任何睡眠循环。监视器的完成事件是唯一需要的信号。带有斜线命令提示符的`ScheduleWakeup`将重新启动整个技能并双重发布评论。如果信封报告`status: "error"`但`review.raw_text`包含受隔离的```json```块,请通过提取内部JSON来恢复。否则报告 stderr 路径并停止。
每个信封发现物都有一个`severity`(`high`/`medium`/`low`/`nit`)、`path`/`line`和`description`。对于每个:应用上面“批准偏差”中的阻塞测试。交叉引用引用的文件:行。如果它不在差异中,则降级为可选(预先存在)或删除(陈旧)。在有保证的情况下不同意模型的严重性 — `high` 风格的 nit 是可选的;一个`low`真正的错误是阻塞。
结论:≥1 次阻塞 → 请求更改。 ≥1 个实质性可选(真正的非阻塞错误、错过的迁移站点、可能的意外行为)→ 批准建议。否则 → 批准。如果只剩下纯粹的尼特,请将它们列在“尼特(接受或离开)”页脚下,并保持标题简单明了“批准”。
首先,幂等性检查——当前用户是否已经检查过这个 SHA?如果是(可能会重新启动),请提供*更新现有*、*无论如何发布*、*跳过* - 默认跳过。否则通过 `AskUserQuestion` 询问:在 GitHub 上批准(仅当判决为 APPROVE 或 APPROVE-with-suggestions 时):`gh pr review --approve --body-file <file>`。仅评论:`gh pr review --comment --body-file <file>`。
工作树 → `git worktree remove --force <path>` 然后`git update-ref -d refs/remotes/origin/pr-<N>`。临时克隆 → `rm -rf <path>`。保持`$ENVELOPE`和`$LOG_DIR`处于清理失败状态并告诉用户它们在哪里。
# External PR Review
Read-only review of someone else's PR. One `bramble code-review` pass against the diff, calibrated verdict, optionally posted to GitHub.
Companion to `/pr-polish` (which iterates fixes on your *own* branch). This one never edits the PR's files, never pushes.
## Calibrating findings
A finding is **blocking** only when merging the diff as-is would cause something observable to break or regress:
- Real bug introduced by the diff (wrong condition, off-by-one, missing await).
- Security regression introduced by the diff.
- Missing/broken tests for behavior the diff explicitly changes.
- Obvious perf regression (N+1 on a hot path, sync I/O in async hot loop).
- Change to a documented contract without a matching doc/test update.
Everything else — naming, structure, style, optional refactors, pre-existing issues — is **Optional**, and doesn't gate the verdict.
The blocking test: *if this merges as-is, will something observable break or regress?* Code-smell answers no. Wrong SQL predicate answers yes.
## Arguments
- `<pr>` (required): full URL `https://github.com/owner/repo/pull/N`, or bare `#N` / `N` when invoked from inside a clone of that repo.
- `--backend`: `codex` (default), `cursor`, or `gemini`.
- `--model`: backend-specific override.
- `--effort`: codex-only. `low` / `medium` (default) / `high`. `medium` catches cross-call-site coverage gaps that `low` misses; `high` for genuinely subtle correctness.
## Step 1: Resolve the PR
```bash
mkdir -p /tmp/external-pr-review-$PR_NUM
gh pr view "$PR_INPUT" --repo "$OWNER/$REPO" \
--json number,title,body,headRefOid,headRefName,baseRefName,url,author,isDraft,state \
> /tmp/external-pr-review-$PR_NUM/pr.json
```
Closed/merged → ask before continuing. Draft → proceed, note in verdict.
## Step 2: Check out the code
Need an isolated worktree at the head SHA. Try in order.
**Method A — worktree from local clone** (when `git config remote.origin.url` matches `$OWNER/$REPO`):
```bash
git fetch origin "pull/$PR_NUM/head:refs/remotes/origin/pr-$PR_NUM"
WORKTREE_DIR="/tmp/external-pr-review-$PR_NUM-$(date +%s)"
git worktree add --detach "$WORKTREE_DIR" "refs/remotes/origin/pr-$PR_NUM"
```
**Method B — fresh shallow clone**:
```bash
WORKTREE_DIR="/tmp/external-pr-review-$OWNER-$REPO-$PR_NUM-$(date +%s)"
gh repo clone "$OWNER/$REPO" "$WORKTREE_DIR" -- --depth 50
cd "$WORKTREE_DIR"
gh pr checkout "$PR_NUM" || \
git checkout -b "pr-$PR_NUM" "origin/$(jq -r .headRefName /tmp/external-pr-review-$PR_NUM/pr.json)"
```
`gh pr checkout` fails on shallow clones with `cannot set up tracking information` — the fallback works because the fetch already created the remote-tracking ref. If bramble later complains about missing base, `git fetch --unshallow`.
Verify `git rev-parse HEAD` matches the head SHA from step 1 before continuing.
If both methods fail, report the error and stop.
## Step 3: Build the review goal
`--goal` is the highest-leverage knob. Without a tight goal, codex/cursor wander into infra/lockfile/cross-repo audits and burn 5–8 minutes on a small PR.
Write this to `$WORKTREE_DIR/.external-review-goal.txt`:
```
Review of GitHub PR #<N>: "<title>"
Repo: <owner>/<repo>
Base: <baseRef> Head: <headRefShort>
Author: <login>
## What the author says this PR does
<verbatim PR body, capped at ~50 lines; truncate with "(truncated)" note>
## Diff stat
<git diff --stat origin/<base>..HEAD, capped at 10 lines>
## Review brief
Calibrate findings against real impact. Mark a finding as blocking only if
merging this diff as-is would cause something OBSERVABLE to break or
regress: real bug, security regression, missing/broken test for changed
behavior, obvious perf regression, or a change to a documented contract
without matching doc/test update.
Style notes, structural preferences, and pre-existing issues belong
under optional improvements, not blockers.
Stay inside the diff. Do not audit Pulumi/infra, lockfiles, generated
code, or cross-repo prompts unless this PR explicitly changes them. If
you find yourself reading a file not in `git diff --name-only`, stop.
One pass. Don't re-verify the same plumbing across multiple turns.
```
If the PR body is empty or one-liner, substitute title + first commit subject. Don't let the model invent intent from the branch name.
## Step 4: Run bramble code-review
```bash
export BRAMBLE_BIN="$([ -x "$(pwd)/bazel-bin/bramble/bramble_/bramble" ] \
&& echo "$(pwd)/bazel-bin/bramble/bramble_/bramble" \
|| echo bramble)"
ENVELOPE="$WORKTREE_DIR/.external-review-envelope.json"
LOG_DIR="$WORKTREE_DIR/.external-review-logs"
mkdir -p "$LOG_DIR"
BACKEND="${BACKEND:-codex}"
MODEL_FLAG=""; [ -n "$MODEL" ] && MODEL_FLAG="--model $MODEL"
EFFORT_FLAG=""
[ "$BACKEND" = "codex" ] && EFFORT_FLAG="--effort ${EFFORT:-medium}"
cd "$WORKTREE_DIR" && \
BRAMBLE_RUN_TAG="external-pr-review:$OWNER/$REPO:$PR_NUM:$BACKEND" \
"$BRAMBLE_BIN" code-review \
--backend "$BACKEND" $MODEL_FLAG $EFFORT_FLAG \
--skip-test-execution --verbose --timeout 10m \
--goal "$(cat "$WORKTREE_DIR/.external-review-goal.txt")" \
--envelope-file "$ENVELOPE" \
2> "$LOG_DIR/stderr.txt"
```
Run it under `Monitor` (typical 2–6 min):
```
Monitor({
description: "external PR review (bramble code-review)",
timeout_ms: 720000,
persistent: false,
command: "<the bramble invocation above>"
})
```
**Do not also call `ScheduleWakeup` or any sleep loop while waiting.** Monitor's completion event is the only signal needed. `ScheduleWakeup` with a slash-command prompt will re-fire the whole skill and double-post the review.
If the envelope reports `status: "error"` but `review.raw_text` contains a fenced ```json``` block, recover by extracting the inner JSON. Otherwise report stderr path and stop.
## Step 5: Triage
Each envelope finding has a `severity` (`high`/`medium`/`low`/`nit`), `path`/`line`, and `description`. For each:
- Apply the blocking test from "Approval bias" above.
- Cross-reference the cited file:line. If it isn't in the diff, demote to optional (pre-existing) or drop (stale).
- Disagree with the model's severity when warranted — a `high` style nit is optional; a `low` real bug is blocking.
## Step 6: Print the verdict
```
# Review of <owner>/<repo>#<N> — "<title>"
**Verdict:** ✅ APPROVE (or ⚠️ APPROVE with suggestions / 🛑 REQUEST CHANGES)
**Summary:** <one sentence>
## Blocking issues
<omit when none>
- **`path:line`** — <one-liner>
<2–3 sentences: why blocking, what to change>
## Optional improvements
<omit when none>
- **`path:line`** — <one-liner>
<1–2 sentences, phrased as a suggestion>
```
Verdict:
- ≥1 blocking → **REQUEST CHANGES**.
- ≥1 substantive optional (real non-blocking bug, missed migration site, likely-unintended behavior) → **APPROVE with suggestions**.
- Otherwise → **APPROVE**. If only pure nits remain, list them under a "Nits (take or leave)" footer and keep the headline plain APPROVE.
## Step 7: Ask before posting
First, idempotency check — has the current user already reviewed this SHA?
```bash
gh pr view "$PR_NUM" --repo "$OWNER/$REPO" --json reviews,headRefOid \
--jq '.headRefOid as $sha | .reviews[] | select(.commit.oid == $sha) | {author: .author.login, state}'
```
If yes (likely a re-fire), offer *Update existing*, *Post anyway*, *Skip* — default Skip.
Otherwise ask via `AskUserQuestion`:
- **Approve on GitHub** (only when verdict is APPROVE or APPROVE-with-suggestions): `gh pr review --approve --body-file <file>`.
- **Comment only**: `gh pr review --comment --body-file <file>`.
- **Request changes** (only when verdict is REQUEST CHANGES): `gh pr review --request-changes --body-file <file>`.
- **Skip** (default).
Always `--body-file`, never `--body "..."` — long markdown breaks shell quoting.
## Step 8: Cleanup
- Worktree → `git worktree remove --force <path>` then `git update-ref -d refs/remotes/origin/pr-<N>`.
- Temp clone → `rm -rf <path>`.
Keep `$ENVELOPE` and `$LOG_DIR` on cleanup failure and tell the user where they are.
## Edge cases
- **Generated code** (lockfiles, `*.pb.go`, snapshots): skip findings on these.
- **Revert PR**: confirm revert target matches the description; approve unless the revert itself introduces a bug.
- **Docs-only PR**: read for accuracy and broken links; default APPROVE.
- **Stacked PR**: verdict is on this diff in isolation; note the dependency.
---
> Source: [bazelment/yoloswe](https://github.com/bazelment/yoloswe) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
按说明文件中的顺序排列。
校准结果
论点
第 1 步:解决 PR
第二步:查看代码
第 3 步:制定审核目标
文件/命令 -> bramble code-review · /pr-polish · <pr> · https://github.com/owner/repo/pull/N · --backend · gemini · --model · --effort
内容校验值 -> b85afae54d3a
当前原文的自动摘译,尚未人工审校。
校准结果
仅当按原样合并 diff 会导致可观察到的某些内容破坏或回归时,发现才会被阻止: diff 引入的真正错误(错误的条件、相差一、缺少等待)。 diff 引入的安全回归。缺少/损坏的差异明确更改的行为测试。明显的性能回归(热路径上的 N+1,异步热循环中的同步 I/O)。
论点
<pr>(必需):完整 URLhttps://github.com/owner/repo/pull/N,或从该存储库的克隆内部调用时裸露的#N/N。--backend:codex(默认)、cursor或gemini。--model:后端特定的覆盖。--effort:仅限法典。low/medium(默认)/high。medium捕捉low错过的跨呼叫站点覆盖差距;high真正微妙的正确性。