docs(agents): add CLI troubleshooting and fix cleanup commands (#2)
This commit is contained in:
parent
2799608051
commit
54e8c8c0fb
23
AGENTS.md
23
AGENTS.md
@ -176,7 +176,7 @@ AI 必须按以下流程引导用户(每一步都要向用户说明当前在
|
||||
|
||||
```bash
|
||||
git checkout main && git pull origin main
|
||||
git branch -d feature/<分支名> # 删除本地分支
|
||||
git branch -D feature/<分支名> # 强制删除(Squash Merge 不产生 merge commit,Git 会提示 not fully merged)
|
||||
git push origin --delete feature/<分支名> # 删除远程分支(可选)
|
||||
```
|
||||
|
||||
@ -198,15 +198,32 @@ tea login add \
|
||||
| 操作 | 命令 |
|
||||
|------|------|
|
||||
| 列出 PR | `tea pulls list` |
|
||||
| 查看 PR 详情(含评论) | `tea pulls --comments <编号>` |
|
||||
| 查看 PR Review 评论 | `tea pulls review-comments <编号>` |
|
||||
| 创建 PR | `tea pulls create --base main --head <分支> --title "..."` |
|
||||
| 查看 PR diff | `tea pulls checkout <编号>` 后 `git diff main...<分支>` |
|
||||
| 查看 PR mergeable 状态 | `tea api "/repos/<owner>/<repo>/pulls/<编号>"` |
|
||||
| Approve | `tea pulls approve <编号>` |
|
||||
| Request Changes | `tea pulls reject <编号>` |
|
||||
| 添加评论 | `tea comment <编号>` |
|
||||
| Squash 合并 | `tea pulls merge <编号> --style squash` |
|
||||
| 关闭 PR | `tea pulls close <编号>` |
|
||||
| 分支保护 | `tea branches protect main` |
|
||||
| 列出分支 | `tea branches list` |
|
||||
| 查看分支保护 | `tea branches list` |
|
||||
| 保护分支 | `tea branches protect main` |
|
||||
| 取消保护 | `tea branches unprotect main` |
|
||||
| 修改保护规则 | `tea api -X PATCH "/repos/<owner>/<repo>/branch_protections/main" --data '{"required_approvals":0}'` |
|
||||
| 删除远程分支 | `git push origin --delete <分支名>` |
|
||||
| 强制删除本地分支 | `git branch -D <分支名>` |
|
||||
|
||||
### 6.7 故障排查(实战验证)
|
||||
|
||||
| 症状 | 原因 | 解决 |
|
||||
|------|------|------|
|
||||
| `tea pulls merge` 报 `mergeable: False` | Gitea 缓存了旧的保护规则评估结果 | 先用 `tea api "/repos/<owner>/<repo>/pulls/<编号>"` 确认 `mergeable` 字段;若规则已修改但 PR 仍不可合并,可 `tea branches unprotect main` → `git push origin main` → `tea branches protect main` 绕过 |
|
||||
| `git branch -d` 提示 `not fully merged` | Squash Merge 不会在本地产生 merge commit,Git 检测不到合并关系 | 用 `git branch -D` 强制删除 |
|
||||
| PR 需要 approval 才能合并但你是唯一开发者 | Gitea 默认 `required_approvals=1` 且作者不能自 approve | `tea api -X PATCH "/repos/<owner>/<repo>/branch_protections/main" --data '{"required_approvals":0}'` |
|
||||
| `git push origin main` 被拒绝 | 分支保护 `enable_push: false` 生效 | 正常——不应直接 push main。合并必须通过 `tea pulls merge` 或临时 unprotect(仅紧急情况) |
|
||||
| `tea whoami` 报 `no available login` | `tea` 和 `git` 认证独立,git SSH 通了不代表 tea API 认证也通了 | 参照 6.5 节用 Token 完成 `tea login add` |
|
||||
|
||||
## 7) 安全与仓库卫生
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user