返回顶部
a

arh-pr-workflowarh工作流

Expert guidance for managing Pull Requests and feature branches using Uber's arh CLI tool. Use when creating features, publishing PRs, managing stacked PRs, merging PRs, rebasing branches, running lint/tests, or navigating feature branches in Uber's web-code monorepo.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
116
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

arh-pr-workflow

arh-pr-workflow 技能

arh CLI(Uber 的 PR 和功能分支管理工具)的专家指南。

使用 TaskCreate 为以下所有项目创建 Claude 任务列表。在操作过程中通过 TaskUpdate 标记任务完成。

  • - [ ] 解析用户请求(哪个 arh 操作?)
  • [ ] 检测环境(Uber 生产仓库?)
  • [ ] 执行请求的操作
  • [ ] 验证结果
  • [ ] 报告结果

分支命名与提交模板

有关分支命名约定、提交模板格式和 PR 元数据收集,请参阅 references/uber-commit-template.md。

初始设置

bash
arh auth

打开浏览器进行 GitHub 授权。选择所有需要的组织(例如 uber-code、uber-objectconfig)。GitHub 用户名必须以 _UBER 后缀结尾。

核心功能

1. 创建功能分支

从主分支创建新功能分支:
bash
arh feature

创建堆叠功能(从当前功能分支创建子分支):
bash
arh feature next

使用特定父分支创建功能:
bash
arh feature --parent

2. 发布拉取请求

为当前功能发布 PR:
bash
arh publish

发布整个功能堆栈(从根到叶):
bash
arh publish --full-stack

无交互提示发布(自动应用 lint 修复):
bash
arh publish --no-interactive

发布为草稿 PR:
bash
arh publish --changes-planned

启用自动合并发布:
bash
arh publish --auto-merge

使用组合标志发布:
bash
arh publish --no-interactive --apply-fixes
arh publish --full-stack --changes-planned

3. 查看 PR 状态

查看功能树:
bash
arh log -p

查看带有 PR 状态的功能树:
bash
arh log -s


arh -s

查看提交历史(领先/落后状态):
bash
arh log -c


arh -c

4. 合并拉取请求

合并当前功能及其所有祖先:
bash
arh merge

工作原理:

  • - 如果在分支 A 上(main -> C -> B -> A),则合并 A、B 和 C
  • 如果在分支 B 上,则合并 B 和 C
  • 要求所有检查通过(构建、必需审批人)
  • 先合并祖先,再合并当前分支

5. 导航功能

检出已有功能:
bash
arh checkout


arh co

从 URL 检出 PR(v0.0.38+):
bash
arh checkout https://github.com/uber-code/go-code/pull/11960


arh checkout uber-code/go-code/pull/11960


arh checkout 11960


arh checkout username/feature-name

这将从远程获取 PR 分支并设置上游跟踪。

导航功能堆栈:
bash
arh checkout next # 树中的下一个功能
arh checkout prev # 树中的上一个功能
arh checkout first # 树中的第一个功能
arh checkout last # 树中的最后一个功能

6. 变基功能

将当前功能树变基到最新父分支:
bash
arh rebase

从默认分支拉取并变基:
bash
arh pull -r

这将从 origin main 拉取最新更改并变基整个功能堆栈。

go-code 单仓库重要提示: 在任何 git pull 或 arh pull 之后,始终运行:
bash
git-bzl refresh

变基到新父分支:
bash
arh rebase --parent

变基特定功能:
bash
arh rebase --feature

变基整个堆栈:
bash
arh rebase --base

变基子树:
bash
arh rebase --subtree

变基所有功能:
bash
arh rebase --all

7. 丢弃功能

丢弃功能分支:
bash
arh discard -f

重要提示: 这将删除本地和远程分支。从此分支打开的任何 PR 都将被关闭。

仅丢弃本地(保留远程):
bash
arh discard --skip-remote -f

在检出他人想要在本地丢弃的 PR 分支时使用 --skip-remote。

8. 清理已合并功能

清理已合并/关闭的功能分支:
bash
arh tidy

无提示清理:
bash
arh tidy --no-interactive

工作原理:

  • - 列出所有已关闭/已合并的功能
  • 请求确认是否丢弃
  • 更新依赖分支的上游跟踪
  • 示例:main -> A -> B -> C,如果 B 已关闭,tidy 会丢弃 B 并将 C 的父分支更新为 A

9. 运行质量检查

对更改的文件运行 linter:
bash
arh lint

对更改的文件运行测试:
bash
arh test

10. 版本管理

检查 arh 版本:
bash
arh version


arh -v

常见工作流程

  • - 新功能:arh feature NAME -> 提交 -> arh publish
  • 堆叠 PR:arh feature NAME -> 提交 -> arh feature next NAME2 -> 提交 -> arh publish --full-stack
  • 审查后更新:提交修复 -> arh publish --no-interactive
  • 合并堆栈:arh checkout last -> arh merge -> arh tidy
  • 在主分支上变基:arh rebase 或 arh rebase --all,然后 arh publish --no-interactive

故障排除

PR 发布因 lint 错误失败:
bash
arh publish --apply-fixes # 自动应用 lint 修复

跳过推送前覆盖率检查(/opt/uber/etc/custom-hooks/coverage-check.sh):
bash
arh publish --no-coverage # 通过包装器跳过覆盖率(推荐)
SKIP_COVERAGE=1 arh publish # 通过环境变量跳过覆盖率
COVERAGE_THRESHOLD=70 arh publish # 降低阈值(默认:80%)

--no-coverage 标志由 ~/.aliases 中的 arh() shell 包装器处理,该包装器创建一个由推送前钩子使用的标记文件(/tmp/.skip-coverage-$(id -u))。
别名:arh-nc(无覆盖率)、arh-lc(降低阈值)——也在 ~/.aliases 中。

功能树混乱:
bash
arh -s # 检查状态
arh tidy # 清理已合并功能
arh rebase --all # 变基所有内容

由于检查失败无法合并:

  • - 检查构建状态:arh -s
  • 确保已收到所有必需的审批
  • 验证所有构建是否通过
  • 修复问题并更新 PR:arh publish

提示

  • - 始终使用 arh feature 创建功能以进行正确的父分支跟踪
  • 经常使用 arh -s 监控 PR 状态
  • 在自动化/CI 环境中使用 --no-interactive
  • 对 WIP/草稿 PR 使用 --changes-planned
  • 定期运行 arh tidy 以保持功能树整洁
  • 对依赖更改使用 --full-stack
  • go-code 单仓库: 在 git pull 或 arh pull 之后,必须运行 git-bzl refresh

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 arh-pr-workflow-1776106391 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 arh-pr-workflow-1776106391 技能

通过命令行安装

skillhub install arh-pr-workflow-1776106391

下载

⬇ 下载 arh-pr-workflow v1.0.0(免费)

文件大小: 4.33 KB | 发布时间: 2026-4-14 13:07

v1.0.0 最新 2026-4-14 13:07
arh-pr-workflow skill v1.0.0 – initial release

- Provides expert guidance for managing Pull Requests and feature branches with the arh CLI.
- Covers setup, feature branching, publishing PRs (including stacked and draft PRs), merging, rebasing, discarding, and cleaning branches in Uber’s monorepo.
- Includes step-by-step examples, troubleshooting tips, commit templates, and best practices for Uber engineering workflows.
- Adds workflow task list template and common commands for linting, testing, and version management.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部