hyperscribe-diff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStep 0 — Preference: Before running any renderer command, perform the theme-preference resolution block from the baseskill (hyperscribe, section "Step 0"). It sets~/.claude/skills/hyperscribe/SKILL.mdand$THEME. If absent, this wrapper falls back to$MODE+studio.light
步骤0 — 偏好设置: 在运行任何渲染器命令之前,请执行基础技能中的主题偏好解析模块(路径:hyperscribe,“步骤0”章节)。该模块会设置~/.claude/skills/hyperscribe/SKILL.md和$THEME变量。如果该模块不存在,此包装器将默认使用$MODE主题 +studio模式。light
Hyperscribe — Diff review mode
Hyperscribe — 差异评审模式
Produces a self-contained HTML diff review using , (for impacted modules), and (for risks). Thin wrapper over the skill.
hyperscribe/CodeDiffhyperscribe/ArchitectureGridhyperscribe/Callouthyperscribe利用、(用于受影响模块)和(用于风险提示)生成独立的HTML差异评审页面。是技能的轻量包装器。
hyperscribe/CodeDiffhyperscribe/ArchitectureGridhyperscribe/CallouthyperscribeWhen to use
使用场景
- User pastes a unified diff or output and asks for review/summary.
git diff - User gives a PR URL () and asks for review.
github.com/owner/repo/pull/N - User gives a git range (,
main..HEAD, SHA range).HEAD~5..HEAD - User says "review these changes", "what changed", "impact of this diff".
Do not use for: generic commit history summaries (no concrete diff), feature spec writing, or rendering a single code snippet (use with ).
hyperscribeCodeBlock- 用户粘贴统一diff或输出并请求评审/摘要时。
git diff - 用户提供PR URL(格式:)并请求评审时。
github.com/owner/repo/pull/N - 用户提供git范围(如、
main..HEAD、SHA哈希范围)时。HEAD~5..HEAD - 用户提出“评审这些变更”、“有哪些变更”、“该diff的影响是什么”等请求时。
请勿用于:通用提交历史摘要(无具体diff内容)、功能规格编写,或渲染单个代码片段(此类场景请使用带有的)。
CodeBlockhyperscribeSource detection
来源检测
- Git range — run to get the unified diff.
git diff <range> - PR URL — use or
gh pr diff <N> -R owner/repo.gh api repos/owner/repo/pulls/<N>.diff - Pasted diff — use the provided text directly.
- No clear source — ask the user before continuing.
- Git范围 — 执行命令获取统一diff。
git diff <range> - PR URL — 使用或
gh pr diff <N> -R owner/repo命令获取diff。gh api repos/owner/repo/pulls/<N>.diff - 粘贴的diff — 直接使用用户提供的文本内容。
- 来源不明确 — 继续操作前请询问用户。
Envelope structure
信封结构
json
{
"a2ui_version": "0.9",
"catalog": "hyperscribe/v1",
"is_task_complete": true,
"parts": [
{
"component": "hyperscribe/Page",
"props": { "title": "Diff: <short summary>", "subtitle": "<N files, +X -Y lines>", "toc": true },
"children": [
{
"component": "hyperscribe/Section",
"props": { "id": "summary", "title": "Summary", "lead": "**What changed** and **why it matters**." },
"children": [
{ "component": "hyperscribe/Prose", "props": { "markdown": "One-paragraph summary." } },
{ "component": "hyperscribe/ArchitectureGrid", "props": {
"layout": "grid",
"nodes": [ { "id": "auth", "title": "Auth module", "tag": "modified" } ]
}}
]
},
{
"component": "hyperscribe/Section",
"props": { "id": "risks", "title": "Risks" },
"children": [
{ "component": "hyperscribe/Callout", "props": { "severity": "warn", "title": "Migration required", "body": "..." }}
]
},
{
"component": "hyperscribe/Section",
"props": { "id": "changes", "title": "Changes" },
"children": [
{ "component": "hyperscribe/CodeDiff", "props": {
"filename": "src/auth.ts",
"lang": "ts",
"hunks": [ { "before": "const x = 1;", "after": "const x = 2;", "atLine": 42 } ]
}}
]
}
]
}
]
}json
{
"a2ui_version": "0.9",
"catalog": "hyperscribe/v1",
"is_task_complete": true,
"parts": [
{
"component": "hyperscribe/Page",
"props": { "title": "Diff: <short summary>", "subtitle": "<N files, +X -Y lines>", "toc": true },
"children": [
{
"component": "hyperscribe/Section",
"props": { "id": "summary", "title": "Summary", "lead": "**What changed** and **why it matters**." },
"children": [
{ "component": "hyperscribe/Prose", "props": { "markdown": "One-paragraph summary." } },
{ "component": "hyperscribe/ArchitectureGrid", "props": {
"layout": "grid",
"nodes": [ { "id": "auth", "title": "Auth module", "tag": "modified" } ]
}}
]
},
{
"component": "hyperscribe/Section",
"props": { "id": "risks", "title": "Risks" },
"children": [
{ "component": "hyperscribe/Callout", "props": { "severity": "warn", "title": "Migration required", "body": "..." }}
]
},
{
"component": "hyperscribe/Section",
"props": { "id": "changes", "title": "Changes" },
"children": [
{ "component": "hyperscribe/CodeDiff", "props": {
"filename": "src/auth.ts",
"lang": "ts",
"hunks": [ { "before": "const x = 1;", "after": "const x = 2;", "atLine": 42 } ]
}}
]
}
]
}
]
}Section checklist
章节检查清单
A solid diff review includes:
- Summary — 1-paragraph +
Proseof impacted modules (tag eachArchitectureGrid/modified/added)removed - Risks — s for breaking changes, migrations, perf, security
Callout - Changes — one per significant file. Aggregate tiny typo-level changes; split big refactors by file.
CodeDiff - (Optional) Testing plan — of manual verification steps
StepList - (Optional) Follow-ups — bullet list of deferred work
一份优质的差异评审应包含:
- 摘要 — 一段内容 + 展示受影响模块的
Prose(为每个模块标记ArchitectureGrid/modified/added)removed - 风险 — 使用提示破坏性变更、迁移需求、性能影响、安全问题等
Callout - 变更内容 — 每个重要文件对应一个。汇总微小的笔误级变更;大型重构按文件拆分展示。
CodeDiff - (可选)测试计划 — 使用列出手动验证步骤
StepList - (可选)后续工作 — 使用项目符号列表记录延迟处理的任务
Callout severity guide
Callout严重程度指南
| Severity | When |
|---|---|
| Notable but benign (e.g., removes unused import) |
| Context reviewer should know (e.g., related to issue #42) |
| Behavior change callers should verify |
| Breaking change, security concern, data-loss risk |
| Celebratory (new test coverage, perf win) |
| 严重程度 | 使用场景 |
|---|---|
| 值得注意但无影响的变更(例如:移除未使用的导入) |
| 评审者需要了解的上下文信息(例如:与#42号问题相关) |
| 调用方需要验证的行为变更 |
| 破坏性变更、安全隐患、数据丢失风险 |
| 值得肯定的变更(例如:新增测试覆盖率、性能提升) |
Render
渲染流程
Same as the base skill — resolve renderer, pipe JSON, write HTML, open.
hyperscribebash
HS=$(for p in \
./.claude/skills/hyperscribe ~/.claude/skills/hyperscribe \
./.codex/skills/hyperscribe ~/.codex/skills/hyperscribe \
./.cursor/skills/hyperscribe ~/.cursor/skills/hyperscribe \
./.opencode/skills/hyperscribe ~/.opencode/skills/hyperscribe \
~/.claude/plugins/cache/hyperscribe-marketplace/*/plugins/hyperscribe
do [ -x "$p/scripts/hyperscribe" ] && { echo "$p/scripts/hyperscribe"; break; }; done)
if [ -z "$HS" ]; then
echo "hyperscribe renderer not found. Install with: npx skills add Atipico1/hyperscribe" >&2
exit 1
fi
mkdir -p ~/.hyperscribe/out
OUT=~/.hyperscribe/out/diff-$(date +%Y%m%d-%H%M%S).html
MODE_FLAG=""
[ "${MODE:-}" = "light" ] && MODE_FLAG="--mode light"
[ "${MODE:-}" = "dark" ] && MODE_FLAG="--mode dark"
cat <<'EOF' | "$HS" --theme "${THEME:-studio}" $MODE_FLAG --out "$OUT"
<the JSON you built>
EOF
open "$OUT"与基础技能一致 — 解析渲染器、传入JSON、生成HTML并打开。
hyperscribebash
HS=$(for p in \
./.claude/skills/hyperscribe ~/.claude/skills/hyperscribe \
./.codex/skills/hyperscribe ~/.codex/skills/hyperscribe \
./.cursor/skills/hyperscribe ~/.cursor/skills/hyperscribe \
./.opencode/skills/hyperscribe ~/.opencode/skills/hyperscribe \
~/.claude/plugins/cache/hyperscribe-marketplace/*/plugins/hyperscribe
do [ -x "$p/scripts/hyperscribe" ] && { echo "$p/scripts/hyperscribe"; break; }; done)
if [ -z "$HS" ]; then
echo "hyperscribe renderer not found. Install with: npx skills add Atipico1/hyperscribe" >&2
exit 1
fi
mkdir -p ~/.hyperscribe/out
OUT=~/.hyperscribe/out/diff-$(date +%Y%m%d-%H%M%S).html
MODE_FLAG=""
[ "${MODE:-}" = "light" ] && MODE_FLAG="--mode light"
[ "${MODE:-}" = "dark" ] && MODE_FLAG="--mode dark"
cat <<'EOF' | "$HS" --theme "${THEME:-studio}" $MODE_FLAG --out "$OUT"
<the JSON you built>
EOF
open "$OUT"Avoid
注意事项
- Dumping the raw diff into one giant — use
CodeBlockper file so before/after lanes render.CodeDiff - Inventing risks not supported by the diff content.
- Using for diff visualization unless the diff itself restructures a flow (then: before/after
Mermaidside by side).ArchitectureGrid
- 不要将原始diff直接放入一个巨大的中 — 按文件使用
CodeBlock,以便渲染前后对比栏。CodeDiff - 不要编造diff内容未体现的风险。
- 除非diff本身重构了流程(此时可将前后并排展示),否则不要使用
ArchitectureGrid进行diff可视化。Mermaid