branch-context
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBranch Context
分支上下文
Gather all changes on the current branch relative to the base branch (main/master) and present a structured summary.
收集当前分支相对于基准分支(main/master)的所有变更,并呈现结构化的总结。
Workflow
工作流程
1. Gather Context
1. 收集上下文
Run the bundled script (path relative to this skill's directory):
python3 scripts/gather_branch_context.pyOptional flags:
- to compare against a specific branch (default: repo's default branch)
--base <branch> - to target a specific repo
--repo <path>
Returns JSON with: , , , , , , , .
branchbase_branchcommit_logcommit_countdiff_statfiles_changedfull_diffuncommitted_changesIf the script returns an field, report it and stop.
error运行绑定的脚本(路径相对于此skill的目录):
python3 scripts/gather_branch_context.py可选参数:
- :与指定分支进行对比(默认:仓库的默认分支)
--base <branch> - :指定目标仓库路径
--repo <path>
返回包含以下字段的JSON:, , , , , , , 。
branchbase_branchcommit_logcommit_countdiff_statfiles_changedfull_diffuncommitted_changes如果脚本返回字段,需报告错误并停止操作。
error2. Present Summary
2. 呈现总结
Show a structured overview:
Branch info:
Branch: feature/my-feature (12 commits ahead of main)Commit history — show the oneline log.
Files changed — group by change type and directory:
Modified:
src/components/ Button.tsx, Card.tsx
src/utils/ format.ts
Added:
src/hooks/ useDebounce.ts
Deleted:
src/legacy/ old-helper.tsDiff stats — show the stat summary (files changed, insertions, deletions).
Uncommitted changes — if any, list them separately with a warning.
展示结构化概览:
分支信息:
Branch: feature/my-feature (12 commits ahead of main)提交历史 — 展示单行日志。
变更文件 — 按变更类型和目录分组:
Modified:
src/components/ Button.tsx, Card.tsx
src/utils/ format.ts
Added:
src/hooks/ useDebounce.ts
Deleted:
src/legacy/ old-helper.ts差异统计 — 展示统计摘要(变更文件数、新增行数、删除行数)。
未提交变更 — 如果存在,单独列出并给出警告。
3. Analyze the Diff
3. 分析差异
Read through the full diff and provide:
- Change summary — what the branch does, grouped by purpose (not by file)
- Potential issues — anything that looks risky, incomplete, or inconsistent:
- TODO/FIXME comments added
- Console.log / debug statements left in
- Large files or binary additions
- Missing test coverage for new code
- Breaking API changes
- Suggestions — optional, only if something clearly stands out
通读完整差异内容并提供:
- 变更总结 — 该分支的功能,按用途分组(而非按文件)
- 潜在问题 — 任何看起来有风险、未完成或不一致的内容:
- 添加的TODO/FIXME注释
- 遗留的Console.log / 调试语句
- 大文件或二进制文件新增
- 新增代码缺少测试覆盖
- 破坏性API变更
- 建议 — 可选内容,仅当有明显问题时提供
4. Offer Next Steps
4. 提供后续步骤
Based on the state of the branch:
- If clean and ready: "Want me to open a PR? (/open-pr)"
- If uncommitted changes: "You have uncommitted changes — want to commit first?"
- If issues found: "Want me to fix any of these before opening a PR?"
根据分支状态:
- 如果分支干净且准备就绪:“需要我帮您打开PR吗?(/open-pr)”
- 如果存在未提交变更:“您有未提交的变更 — 需要先提交吗?”
- 如果发现问题:“需要我在打开PR前修复这些问题吗?”