用途
github-swarm-pr 用于从 GitHub Pull Request 直接创建和管理 AI swarm,提供多智能体代码审查、自动化验证和智能合并协调,将 PR 转化为协调式的 swarm 工作流。
主要能力
- 基于 PR 创建 swarm,并自动分配智能体
- 多智能体代码审查与验证
- 通过 PR 评论命令控制 swarm
- 自动化 PR 生命周期管理
- 基于共识的智能合并协调
- 根据 PR 变更规模选择 swarm 拓扑(hierarchical / mesh / ring)并限制最大智能体数
- 按文件类型分类并分派审查
- PR 标签集成:根据标签自动分配智能体(如 bug 对应 debugger、tester;security 对应 security、reviewer 等),并据此选择拓扑
- 提供 PR 校验、合并就绪检查与按规模选择合并策略(squash / merge / rebase)
- 支持 MCP 工具集成,用于 PR 上下文存储与多智能体编排
- 支持 GitHub Actions 集成,通过 workflow 处理 PR 事件与评论命令
使用方式
通过 gh CLI 获取 PR 详情、差异与检查状态,例如:
gh pr view 123 --json title,body,labels,files,reviews
gh pr diff 123
gh pr checks 123
gh pr review 123 --comment --body "## Swarm Analysis
Code quality: PASS
Test coverage: 85%
Security: No issues found"
根据变更总量确定拓扑与智能体数量(大于 500 用 hierarchical、8 个智能体;大于 100 用 mesh、5 个;否则用 ring、3 个)。
在 PR 评论中使用命令控制 swarm:
/swarm init mesh 6
/swarm spawn coder "Implement the authentication logic"
/swarm spawn tester "Write comprehensive tests"
/swarm spawn security "Review for vulnerabilities"
/swarm status
/swarm analyze
/swarm complete
可运行 PR 校验与合并就绪检查,并根据 PR 规模选择合并策略:小于 50 行用 squash,小于 200 行用 merge,较大 PR 用 rebase,同时删除分支。
集成 GitHub Actions 时,可监听 pull_request(opened、labeled、synchronize)与 issue_comment(created)事件,在带有 swarm-review 标签时触发 swarm 审查,并对以 /swarm 开头的评论进行处理。
适用场景
- 复杂 PR:大型改动需要多视角审查
- 安全审查:涉及敏感代码路径的 PR
- 架构变更:需要架构师审查的结构性修改
- 性能关键:对性能敏感代码的改动
- 跨团队 PR:影响多个团队领域的改动
相关技能
github-swarm-issue(基于 Issue 的 swarm 协调)、github-workflow(CI/CD 自动化)、github-sync(仓库同步)、github-modes(GitHub 集成模式)。
限制
具体收费、价格、平台支持范围及使用前置条件暂未提供。