SuperAPI AI 工具集

issue-management

编程与开发

查看项目

更新于 10-15 20:21

技能介绍

用途

该技能用于在 GitHub 上创建、编辑、查看或移除议题(Issue)之间的关系。适用于需要管理 GitHub Issues 2.0 关系模型的场景,包括父议题、子议题、blocked-by(被阻塞)与 blocking(阻塞)链接。

前置条件

这些命令使用 GitHub CLI 在 PR cli/cli#13057 中加入的 Issues 2.0 gh issue 支持。由于该功能较新,先确认已安装的 gh 支持它:

gh issue create --help | grep -E -- '--parent|--blocked-by|--blocking'
gh issue edit --help | grep -E -- '--parent|--add-sub-issue|--add-blocked-by|--add-blocking'

如果缺少这些标志,请先更新 gh 再尝试管理议题关系。不要使用更旧的命令替代。

议题引用格式

关系标志接受议题编号或议题 URL。

当前仓库中的议题使用编号:

gh issue edit 123 --parent 100

跨仓库关系使用完整议题 URL:

gh issue edit 123 --blocked-by https://github.com/remotion-dev/remotion/issues/456

多个相关议题可以用逗号分隔列表传入:

gh issue edit 123 --add-blocked-by 200,201

父议题与子议题关系

一个子议题只能有一个父议题。

在父议题下直接创建新议题:

gh issue create \
  --title 'Docs: Add issue management skill' \
  --body-file /tmp/remotion-issue-body.md \
  --parent 100

设置或更改已有子议题的父议题:

gh issue edit <child-number> --parent <parent-number-or-url>

移除子议题的父议题:

gh issue edit <child-number> --remove-parent

从父议题侧管理子议题:

gh issue edit <parent-number> --add-sub-issue <child-number-or-url>
gh issue edit <parent-number> --remove-sub-issue <child-number-or-url>

如果子议题已有其他父议题,--add-sub-issue 会将其移动到新的父议题。不要在一条命令中同时编辑多个父议题时使用 --add-sub-issue;一个子议题不能被含糊地添加到多个父议题。

blocked-by 与 blocking 关系

当被编辑的议题正在等待另一个议题时,使用 blocked-by。

# 议题 123 被议题 200 阻塞。
gh issue edit 123 --add-blocked-by 200

# 移除该关系。
gh issue edit 123 --remove-blocked-by 200

当被编辑的议题阻塞另一个议题时,使用 blocking。

# 议题 123 阻塞议题 300 和 301。
gh issue edit 123 --add-blocking 300,301

# 移除一个阻塞关系。
gh issue edit 123 --remove-blocking 300

等价的心智模型:

gh issue edit A --add-blocking B

与以下命令含义相同:

gh issue edit B --add-blocked-by A

根据你当前正在编辑哪个议题来选择命令。

创建议题时立即设置关系:

gh issue create \
  --title 'Studio: Add timeline validation' \
  --body-file /tmp/remotion-issue-body.md \
  --blocked-by 200,201 \
  --blocking 300

查看关系

人类可读视图会显示 parent、sub-issues、blocked-by 和 blocking 元数据(存在时):

gh issue view <number>

非 TTY 的原始输出包含稳定的关系行:

gh issue view <number> | grep -E '^(parent|sub-issues|sub-issues-completed|blocked-by|blocking):'

脚本中可显式请求 JSON 字段:

gh issue view <number> \
  --json parent,subIssues,subIssuesSummary,blockedBy,blocking

subIssues、blockedBy 和 blocking 是带有 nodes 和 totalCount 的连接对象。subIssuesSummary 包含完成数量统计。

安全工作流

  1. 使用 --body-file 创建新议题正文,不要用内联多行 shell 字符串。
  2. 使用相应的 gh issue create 或 gh issue edit 标志链接关系。
  3. 用 gh issue view <number> 或 gh issue view <number> --json parent,subIssues,subIssuesSummary,blockedBy,blocking 验证结果。
  4. 如果之后编辑 PR 或父议题正文,请用具体的议题编号替换含糊的检查清单文本。