GitHub PAT
Interact with GitHub using Personal Access Tokens. User controls access via PAT scopes.
Setup
User provides their PAT:
CODEBLOCK0
Store in TOOLS.md or pass via --token.
Commands
CODEBLOCK1
Security Model
- - User controls access via PAT scopes
- No OAuth - no "allow full access" prompts
- Least privilege - user creates PAT with minimal needed scopes
- Fine-grained PATs supported for specific repo access
Token Storage
Agent stores token in TOOLS.md under ### GitHub section. Never expose in logs or messages.
GitHub PAT
使用个人访问令牌与GitHub交互。用户通过PAT作用域控制访问权限。
设置
用户提供其PAT:
- 1. 在 github.com/settings/tokens 创建PAT
- 选择作用域(repo为完全访问,public_repo仅限公开仓库)
- 将令牌提供给代理
存储在TOOLS.md中或通过--token传递。
命令
bash
列出你有权访问的仓库
python3 scripts/gh.py repos [--token TOKEN]
克隆仓库
python3 scripts/gh.py clone owner/repo [--token TOKEN]
创建分支
python3 scripts/gh.py branch <分支名称> [--repo owner/repo]
提交并推送
python3 scripts/gh.py push <提交信息> [--branch 分支] [--repo owner/repo]
创建拉取请求
python3 scripts/gh.py pr <标题> [--body 描述] [--base main] [--head 分支]
创建议题
python3 scripts/gh.py issue <标题> [--body 描述] [--repo owner/repo]
查看仓库信息
python3 scripts/gh.py info owner/repo
安全模型
- - 用户控制访问权限 通过PAT作用域
- 无OAuth - 无需允许完全访问提示
- 最小权限原则 - 用户使用所需的最小作用域创建PAT
- 支持细粒度PAT 用于特定仓库访问
令牌存储
代理将令牌存储在TOOLS.md中的### GitHub部分。切勿在日志或消息中暴露。