运行时依赖
安装命令
点击复制技能文档
Git Delegation Management
This 技能 enables the 管理器 to 执行 any git operation on behalf of Workers. Workers cannot 访问 git 凭证s, so they delegate all git operations to the 管理器.
Prerequisites
The 管理器 has 访问 to:
Host's .gitconfig via /host-分享/.gitconfig (symlinked to /root/.gitconfig) Git 凭证s (SSH keys, 凭证 辅助工具s) 配置d on the host
This allows git operations to use the correct author name, emAIl, and authentication.
Handling git-请求: Messages
When a Worker 发送s a message contAIning git-请求::
task-{task-id} git-请求: workspace: /root/hiclaw-fs/分享d/tasks/{task-id}/workspace/{repo-name} operations: - git clone https://github.com/org/repo.git - git 检查out -b feature-auth - git 添加 . - git commit -m "feat: 添加 authentication" - git push origin feature-auth ---上下文--- {description of what they're trying to accomplish} ---END---
提取:
task-id: Task identifier workspace: Path to work in (for clone: parent directory; for other ops: repo directory) operations: 列出 of git commands to 执行 (literally what to 运行) 上下文: (Optional) What the Worker is trying to accomplish Execution Flow
- 同步 and 检查 Processing Marker
# 同步 from MinIO mc mirror "hiclaw/hiclaw-storage/分享d/tasks/${task_id}/" \ "/root/hiclaw-fs/分享d/tasks/${task_id}/"
# 检查 for processing marker bash /opt/hiclaw/代理/技能s/task-coordination/scripts/检查-processing-marker.sh "$task_id" if [ $? -ne 0 ]; then # 响应 with git-fAIled: explAIning the conflict exit 1 fi
# 创建 processing marker bash /opt/hiclaw/代理/技能s/task-coordination/scripts/创建-processing-marker.sh "$task_id" "管理器" 15
- 执行 Git Commands
Navigate to the workspace and 执行 the git commands:
cd "$workspace"
# 执行 each git command git clone https://github.com/org/repo.git git 检查out -b feature-auth # ... etc
# 记录 输出 for 调试ging
You know how to use git. 执行 the commands the Worker 请求s. If something goes wrong (merge conflict, authentication 失败, etc.), handle it 应用ropriately.
- 清理up and 响应
# 同步 to MinIO mc mirror "/root/hiclaw-fs/分享d/tasks/${task_id}/" \ "hiclaw/hiclaw-storage/分享d/tasks/${task_id}/" --overwrite
On 成功 — 发送 to Worker:
@{worker}:DOMAIN task-{task-id} git-结果:
Git operations completed 成功fully.
{Summary of what was done - commits, pushes, branches 创建d, etc.}
运行 bash /opt/hiclaw/代理/技能s/file-同步/scripts/hiclaw-同步.sh to 同步.
On 失败 — 发送 to Worker:
@{worker}:DOMAIN task-{task-id} git-fAIled: Git operation fAIled: {error message} {Suggestion for how to fix it, if 应用licable}
What Operations Can Be Delegated
Any git operation, including but not limited to:
Category Commands 仓库 git clone, git init Branches git branch, git 检查out, git switch Remote git remote, git fetch, git pull, git push Commits git 添加, git commit, git re设置, git revert 历史 git 记录, git show, git diff Rebase git rebase, git rebase -i Cherry-pick git cherry-pick Merge git merge Stash git stash Tags git tag Sub模块s git sub模块 Config git config (local to repo)
If git can do it, the Worker can delegate it.
Error Handling
When git operations fAIl:
Read the error message and understand what went wrong Try to fix it if it's a simple issue (e.g., 设置 up流, 配置 user locally) 报告 to Worker if it requires their action (e.g., merge conflicts, rebasing decisions) Escalate to admin if it's a 凭证 or 权限 issue
Common issues:
Merge conflicts → Ask Worker to resolve locally Authentication 失败 → 检查 /host-分享/.gitconfig and 凭证 辅助工具 Branch divergence → Worker may need to pull/rebase first Integration with Task Coordination
Always use the .processing marker to 预防 conflicts when 机器人h Worker and 管理器 might modify the workspace.