当何时使用
当任务涉及 AtomGit/GitCode 平台的 Pull Request 审查、批准、合并、仓库管理等操作时优先使用此版本。
适用场景:
- - ✅ OpenClaw 技能 (原生支持)
- ✅ Windows/Linux/macOS 跨平台
- ✅ 需要批量处理 PR
- ✅ 复杂 JSON 处理
- ✅ 需要结构化错误处理
不适用场景:
- - ❌ 无 PowerShell 环境
- ❌ 仅需简单单次 API 调用
快速参考
commands.md |
| API 参考 |
API-REFERENCE.md |
| 更新日志 |
CHANGELOG.md |
📦 安装说明
ClawHub 限制: 由于 ClawHub 平台限制,PowerShell 脚本文件 (.ps1) 会被重命名为 .ps1.txt 发布。
安装步骤
- 1. 从 ClawHub 安装技能 (自动完成)
- 2. 恢复脚本文件扩展名:
CODEBLOCK0
- 3. 验证安装:
CODEBLOCK1
文件说明
| 文件 | 说明 |
|---|
| INLINECODE6 | 主执行脚本 (需恢复为.ps1) |
| INLINECODE7 |
批量处理脚本 (需恢复为.ps1) |
核心命令
| 命令 | 说明 | 示例 |
|---|
| INLINECODE8 | 登录认证 | INLINECODE9 |
| INLINECODE10 |
获取 PR 列表 |
AtomGit-GetPRList -Owner "o" -Repo "r" |
|
AtomGit-ApprovePR | 批准 PR |
AtomGit-ApprovePR -Owner "o" -Repo "r" -PR 123 |
|
AtomGit-MergePR | 合并 PR |
AtomGit-MergePR -Owner "o" -Repo "r" -PR 123 |
|
AtomGit-GetIssues | 获取 Issues |
AtomGit-GetIssues -Owner "o" -Repo "r" |
完整命令列表: commands.md
特色功能
1. 批量并行处理
CODEBLOCK2
性能对比:
- - 串行处理 3 个 PR: ~3 分钟
- 并行处理 3 个 PR: ~35 秒
- 提升: 81% ⬇️
2. 处理规则
PR 处理判断标准:
- - ✅ 已处理: 同时有
/lgtm 和 /approve 两条评论 - ❌ 未处理: 缺少任一评论 (只有/lgtm、只有/approve、或都没有)
说明: 必须同时具备 /lgtm 和 /approve 才算完成审查流程
3. CI 流水线检查 (v2.5.0 新增)
CODEBLOCK3
状态码:
- -
0 - ✅ SUCCESS (全部通过) - INLINECODE23 - ⏳ RUNNING (有运行中)
- INLINECODE24 - ❌ FAILED (有失败)
4. 暂不支持的功能
- - ❌ AtomGit-GetPRReviews - AtomGit API 不支持
/pulls/{id}/reviews 端点
💡 使用示例
场景 1: 查询需要处理的 PR
CODEBLOCK4
场景 2: 批量批准 PR
CODEBLOCK5
场景 3: 检查 CI 状态
CODEBLOCK6
场景 4: 创建 PR
CODEBLOCK7
场景 5: 协作管理
CODEBLOCK8
场景 6: Issues 管理
CODEBLOCK9
场景 7: 仓库查询
CODEBLOCK10
场景 8: 其他查询
CODEBLOCK11
🎯 最佳实践
1. 批量处理优先使用并行
CODEBLOCK12
2. Token 安全
CODEBLOCK13
3. 错误处理
CODEBLOCK14
API 端点
Base URL: INLINECODE26
认证方式:
CODEBLOCK15
详细 API: API-REFERENCE.md
状态码
| 状态码 | 说明 |
|---|
| 200 OK | 请求成功 |
| 201 Created |
资源创建成功 |
| 400 Bad Request | 请求参数错误 |
| 401 Unauthorized | 未认证 |
| 403 Forbidden | 无权限 |
| 404 Not Found | 资源不存在 |
| 429 Too Many Requests | 请求超限 (50/分,5000/小时) |
系统要求
| 组件 | 要求 | 说明 |
|---|
| PowerShell | 5.1+ | Windows 内置,Linux/macOS 需安装 |
| .NET |
4.7+ | 通常已预装 |
|
网络 | HTTPS | 访问 api.atomgit.com |
安装
方式 1: ClawHub (推荐)
CODEBLOCK16
方式 2: 手动安装
CODEBLOCK17
Token 配置
优先级顺序:
- 1. ✅ 环境变量
ATOMGIT_TOKEN (最高优先级) - ✅ openclaw.json 中的
env.ATOMGIT_TOKEN 字段
配置方式:
CODEBLOCK18
使用示例
登录
CODEBLOCK19
获取用户信息
CODEBLOCK20
获取 PR 列表
CODEBLOCK21
批准 PR
CODEBLOCK22
批量处理
CODEBLOCK23
相关技能
反馈
- - 文档:https://docs.atomgit.com/docs/apis/
- Token: https://atomgit.com/setting/token-classic
- 帮助:https://atomgit.com/help
何时使用
当任务涉及 AtomGit/GitCode 平台的 Pull Request 审查、批准、合并、仓库管理等操作时,优先使用此版本。
适用场景:
- - ✅ OpenClaw 技能(原生支持)
- ✅ Windows/Linux/macOS 跨平台
- ✅ 需要批量处理 PR
- ✅ 复杂 JSON 处理
- ✅ 需要结构化错误处理
不适用场景:
- - ❌ 无 PowerShell 环境
- ❌ 仅需简单单次 API 调用
快速参考
commands.md |
| API 参考 | API-REFERENCE.md |
| 更新日志 | CHANGELOG.md |
📦 安装说明
ClawHub 限制:由于 ClawHub 平台限制,PowerShell 脚本文件 (.ps1) 会被重命名为 .ps1.txt 发布。
安装步骤
- 1. 从 ClawHub 安装技能(自动完成)
- 2. 恢复脚本文件扩展名:
powershell
进入技能目录
cd ~/.openclaw/workspace/skills/atomgit-ps
恢复 scripts 目录中的 .ps1 扩展名
Rename-Item -Path scripts/*.ps1.txt -NewName { $_.Name -replace \.ps1\.txt$, .ps1 }
验证
Get-ChildItem scripts/*.ps1
- 3. 验证安装:
powershell
加载技能
. ~/.openclaw/workspace/skills/atomgit-ps/scripts/atomgit.ps1
查看帮助
AtomGit-Help
文件说明
| 文件 | 说明 |
|---|
| scripts/atomgit.ps1.txt | 主执行脚本(需恢复为 .ps1) |
| scripts/atomgit-batch.ps1.txt |
批量处理脚本(需恢复为 .ps1) |
核心命令
| 命令 | 说明 | 示例 |
|---|
| AtomGit-Login | 登录认证 | AtomGit-Login token |
| AtomGit-GetPRList |
获取 PR 列表 | AtomGit-GetPRList -Owner o -Repo r |
| AtomGit-ApprovePR | 批准 PR | AtomGit-ApprovePR -Owner o -Repo r -PR 123 |
| AtomGit-MergePR | 合并 PR | AtomGit-MergePR -Owner o -Repo r -PR 123 |
| AtomGit-GetIssues | 获取 Issues | AtomGit-GetIssues -Owner o -Repo r |
完整命令列表:commands.md
特色功能
1. 批量并行处理
powershell
并行处理多个 PR,性能提升 80%
. ~/.openclaw/workspace/skills/atomgit-powershell/scripts/atomgit-batch.ps1
Invoke-BatchApprove -Owner openeuler -Repo release-management
-PRs @(2557, 2558, 2560)
-Parallel
-MaxConcurrency 3
性能对比:
- - 串行处理 3 个 PR:约 3 分钟
- 并行处理 3 个 PR:约 35 秒
- 提升:81% ⬇️
2. 处理规则
PR 处理判断标准:
- - ✅ 已处理:同时有 /lgtm 和 /approve 两条评论
- ❌ 未处理:缺少任一评论(只有 /lgtm、只有 /approve、或都没有)
说明:必须同时具备 /lgtm 和 /approve 才算完成审查流程
3. CI 流水线检查(v2.5.0 新增)
powershell
加载脚本
. ~/.openclaw/workspace/skills/atomgit-powershell/scripts/atomgit.ps1
检查 CI 流水线
AtomGit-CheckCI -Owner openeuler -Repo release-management -PR 2560
状态码:
- - 0 - ✅ SUCCESS(全部通过)
- 1 - ⏳ RUNNING(有运行中)
- 2 - ❌ FAILED(有失败)
4. 暂不支持的功能
- - ❌ AtomGit-GetPRReviews - AtomGit API 不支持 /pulls/{id}/reviews 端点
💡 使用示例
场景 1:查询需要处理的 PR
powershell
加载脚本
. ~/.openclaw/workspace/skills/atomgit-powershell/scripts/atomgit.ps1
查询开放 PR
$prs = AtomGit-GetPRList -Owner openeuler -Repo release-management -State open
检查每个 PR 的处理状态
foreach ($pr in $prs) {
$comments = AtomGit-GetPRComments -Owner openeuler -Repo release-management -PR $pr.number
$myComments = $comments | Where-Object { $_.user.login -eq panchenbo }
$hasLgtm = $myComments | Where-Object { $_.body -eq /lgtm }
$hasApprove = $myComments | Where-Object { $_.body -eq /approve }
if ($hasLgtm -and $hasApprove) {
Write-Host PR #$($pr.number): ✅ 已处理 -ForegroundColor Green
} elseif ($hasLgtm) {
Write-Host PR #$($pr.number): ⏳ 已 LGTM,待 Approve -ForegroundColor Yellow
} else {
Write-Host PR #$($pr.number): ❌ 未处理 -ForegroundColor Red
}
}
场景 2:批量批准 PR
powershell
加载批量脚本
. ~/.openclaw/workspace/skills/atomgit-powershell/scripts/atomgit-batch.ps1
并行批量批准(推荐)
Invoke-BatchApprove -Owner openeuler -Repo release-management
-PRs @(2547, 2564, 2565)
-Parallel
-MaxConcurrency 3
场景 3:检查 CI 状态
powershell
检查 CI 流水线
AtomGit-CheckCI -Owner openeuler -Repo release-management -PR 2564
输出示例:
=== AtomGit CI Check ===
Total: 10
Success: 9
Failure: 1
Overall: FAILED
场景 4:创建 PR
powershell
创建 PR
AtomGit-CreatePR -Owner openeuler -Repo release-management
-Title 添加新包
-Head feature/new-package
-Base main
-Body 这个 PR 添加了新的软件包
场景 5:协作管理
powershell
获取协作者列表
AtomGit-GetCollaborators -Owner openeuler -Repo release-management
添加协作者
AtomGit-AddCollaborator -Owner openeuler -Repo release-management
-Username newuser -Permission push
移除协作者
AtomGit-RemoveCollaborator -Owner openeuler -Repo release-management
-Username olduser
场景 6:Issues 管理
powershell
获取 Issues 列表
AtomGit-GetIssues -Owner openeuler -Repo release-management -State open
创建 Issue
AtomGit-CreateIssue -Owner openeuler -Repo release-management
-Title 发现 bug -Body 详细描述...
添加评论
AtomGit-AddIssueComment -Owner openeuler -Repo release-management
-Issue 123 -Comment 这个问题已经修复
场景 7:仓库查询
powershell
获取我的仓库
AtomGit-GetRepos
获取仓库详情
AtomGit-GetRepoDetail -Owner openeuler -Repo release-management
获取文件树
AtomGit-GetRepoTree -Owner openeuler -Repo release-management
获取文件内容
AtomGit-GetRepoFile