Install
openclaw skills install @panchenbo/atomgit-powershellAtomGit (GitCode) 代码托管平台集成 - PowerShell 版本。完整支持 PR 审查、批准、合并、仓库管理、Issues 管理。特色功能:批量并行处理 (性能提升 80%)、CI 流水线检查、仓库协作管理。跨平台:Windows/Linux/macOS。
openclaw skills install @panchenbo/atomgit-powershell当任务涉及 AtomGit/GitCode 平台的 Pull Request 审查、批准、合并、仓库管理等操作时优先使用此版本。
适用场景:
不适用场景:
| 主题 | 文件 |
|---|---|
| 快速入门 | README.md |
| 命令参考 | commands.md |
| API 参考 | API-REFERENCE.md |
| 更新日志 | CHANGELOG.md |
ClawHub 限制: 由于 ClawHub 平台限制,PowerShell 脚本文件 (.ps1) 会被重命名为 .ps1.txt 发布。
从 ClawHub 安装技能 (自动完成)
恢复脚本文件扩展名:
# 进入技能目录
cd ~/.openclaw/workspace/skills/atomgit-ps
# 恢复 scripts 目录中的.ps1 扩展名
Rename-Item -Path "scripts/*.ps1.txt" -NewName { $_.Name -replace '\.ps1\.txt$', '.ps1' }
# 验证
Get-ChildItem scripts/*.ps1
# 加载技能
. ~/.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
# 并行处理多个 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
性能对比:
PR 处理判断标准:
/lgtm 和 /approve 两条评论说明: 必须同时具备 /lgtm 和 /approve 才算完成审查流程
# 加载脚本
. ~/.openclaw/workspace/skills/atomgit-powershell/scripts/atomgit.ps1
# 检查 CI 流水线
AtomGit-CheckCI -Owner "openeuler" -Repo "release-management" -PR 2560
状态码:
0 - ✅ SUCCESS (全部通过)1 - ⏳ RUNNING (有运行中)2 - ❌ FAILED (有失败)/pulls/{id}/reviews 端点# 加载脚本
. ~/.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
}
}
# 加载批量脚本
. ~/.openclaw/workspace/skills/atomgit-powershell/scripts/atomgit-batch.ps1
# 并行批量批准 (推荐)
Invoke-BatchApprove -Owner "openeuler" -Repo "release-management" `
-PRs @(2547, 2564, 2565) `
-Parallel `
-MaxConcurrency 3
# 检查 CI 流水线
AtomGit-CheckCI -Owner "openeuler" -Repo "release-management" -PR 2564
# 输出示例:
# === AtomGit CI Check ===
# Total: 10
# Success: 9
# Failure: 1
# Overall: FAILED
# 创建 PR
AtomGit-CreatePR -Owner "openeuler" -Repo "release-management" `
-Title "添加新包" `
-Head "feature/new-package" `
-Base "main" `
-Body "这个 PR 添加了新的软件包"
# 获取协作者列表
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"
# 获取 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 "这个问题已经修复"
# 获取我的仓库
AtomGit-GetRepos
# 获取仓库详情
AtomGit-GetRepoDetail -Owner "openeuler" -Repo "release-management"
# 获取文件树
AtomGit-GetRepoTree -Owner "openeuler" -Repo "release-management"
# 获取文件内容
AtomGit-GetRepoFile -Owner "openeuler" -Repo "release-management" -Path "README.md"
# 获取标签列表
AtomGit-GetLabels -Owner "openeuler" -Repo "release-management"
# 获取发布列表
AtomGit-GetReleases -Owner "openeuler" -Repo "release-management"
# 获取 Webhooks 列表
AtomGit-GetHooks -Owner "openeuler" -Repo "release-management"
# ✅ 推荐:并行处理,性能提升 80%
Invoke-BatchApprove -Owner "openeuler" -Repo "release-management" `
-PRs @(2547, 2564, 2565) -Parallel -MaxConcurrency 3
# ❌ 不推荐:串行处理
foreach ($pr in @(2547, 2564, 2565)) {
AtomGit-ApprovePR -Owner "openeuler" -Repo "release-management" -PR $pr
}
# ✅ 推荐:使用环境变量
$env:ATOMGIT_TOKEN="YOUR_TOKEN"
# ❌ 不推荐:硬编码在脚本中
$token = "YOUR_TOKEN" # 不要提交到 Git
# ✅ 技能自动处理错误
try {
AtomGit-ApprovePR -Owner "openeuler" -Repo "release-management" -PR 2547
} catch {
Write-Host "批准失败:$($_.Exception.Message)"
}
Base URL: https://api.atomgit.com/api/v5
认证方式:
$headers = @{ "Authorization" = "Bearer YOUR_TOKEN" }
Invoke-RestMethod -Uri "https://api.atomgit.com/api/v5/user" -Headers $headers
详细 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 |
clawhub install atomgit-ps
# 1. 克隆技能到本地
# 2. 配置 Token (优先级:环境变量 > openclaw.json)
$env:ATOMGIT_TOKEN="YOUR_TOKEN"
# 或在 ~/.openclaw/openclaw.json 中添加:
# {"env": {"ATOMGIT_TOKEN": "YOUR_TOKEN"}}
# 3. 加载技能
. ~/.openclaw/workspace/skills/atomgit-ps/scripts/atomgit.ps1
优先级顺序:
ATOMGIT_TOKEN (最高优先级)env.ATOMGIT_TOKEN 字段配置方式:
# 方式 1: 环境变量 (推荐用于临时会话)
$env:ATOMGIT_TOKEN="YOUR_TOKEN"
# 方式 2: openclaw.json (推荐用于持久配置)
# 编辑 ~/.openclaw/openclaw.json,添加:
{
"env": {
"ATOMGIT_TOKEN": "YOUR_TOKEN"
}
}
AtomGit-Login "YOUR_TOKEN"
AtomGit-GetUserInfo
AtomGit-GetPRList -Owner "openeuler" -Repo "release-management" -State "open"
AtomGit-ApprovePR -Owner "openeuler" -Repo "release-management" -PR 2560 -Comment "/lgtm"
. ~/.openclaw/workspace/skills/atomgit-ps/scripts/atomgit-batch.ps1
Invoke-BatchApprove -Owner "openeuler" -Repo "release-management" `
-PRs @(2557, 2558, 2560) `
-Parallel
git - Git 版本控制基础操作