docs: prefer trans gh route for body patches

This commit is contained in:
Codex
2026-06-15 03:10:50 +00:00
parent 779721ea73
commit 008f7fbb62
4 changed files with 36 additions and 14 deletions
+18 -8
View File
@@ -5,7 +5,7 @@ description: UniDesk GitHub CLI - 通过 `bun scripts/cli.ts gh ...` 管理 GitH
# UniDesk GitHub CLI
UniDesk 受控 GitHub 操作入口,所有 issue/PR 读写走 `bun scripts/cli.ts gh <subcommand>`,不依赖原生 `gh` binary,不手写 `curl`/GraphQL。
UniDesk 受控 GitHub 操作入口,底层 issue/PR REST 读写走 `bun scripts/cli.ts gh <subcommand>`,不依赖原生 `gh` binary,不手写 `curl`/GraphQL。Issue/PR 正文局部修补的人工首选入口是 `trans gh:/owner/repo/issue/<number> apply-patch``trans gh:/owner/repo/pr/<number> apply-patch`,底层 `gh issue patch` 只作为受控底座或兼容入口。
**固定入口前缀**: `cd /root/unidesk && bun scripts/cli.ts gh ...`
@@ -93,13 +93,23 @@ EOF
`edit``update --mode replace` 的兼容别名。正式写入默认先读当前 issue 做 body guard。
### 局部修补正文
### 局部修补正文(优先走 `trans gh:`
```bash
bun scripts/cli.ts gh issue patch <number|owner/repo#number> \
--repo owner/name --body-patch-stdin <<'PATCH'
# Issue 正文:route 未写 /1 时默认一楼正文
trans gh:/owner/name/issue/<number> apply-patch <<'PATCH'
*** Begin Patch
*** Update File: issue.md
*** Update File: body.md
@@
-old text
+new text
*** End Patch
PATCH
# PR 正文同样使用 body.md
trans gh:/owner/name/pr/<number> apply-patch --dry-run <<'PATCH'
*** Begin Patch
*** Update File: body.md
@@
-old text
+new text
@@ -107,7 +117,7 @@ bun scripts/cli.ts gh issue patch <number|owner/repo#number> \
PATCH
```
`issue patch` 会先读取当前 issue 正文,把 Codex `apply_patch` envelope 应用到虚拟文件 `issue.md`,再通过现有 issue body guard 写回。支持 `--dry-run``--expect-updated-at``--expect-body-sha``--body-patch-file <file|->`;输出包含 old/new bodySha、updatedAt、patch 摘要和 readCommands,不回显完整正文
GitHub issue/PR 正文局部修补必须优先走 `trans gh:/owner/repo/issue/<number> apply-patch``trans gh:/owner/repo/pr/<number> apply-patch`;虚拟文件固定是 `body.md``apply_patch``patch-apply` 仅作为兼容别名。底层 `bun scripts/cli.ts gh issue patch ... --body-patch-stdin` 是受控写回底座或兼容入口,不作为人工首选。`trans gh:` 会先读取当前正文,把 Codex `apply_patch` envelope 应用到 `body.md`,再通过现有 `gh issue/pr update` guard 写回`--dry-run` 只输出计划不写 GitHub
### 评论
@@ -263,7 +273,7 @@ trans gh:/pikasTech/HWLAB/issue ls [--limit N] [--full]
trans gh:/pikasTech/HWLAB/pr/507 ls
trans gh:/pikasTech/HWLAB/505/1 cat
# patch-apply 写回正文(走 gh issue/pr update
# apply-patch 写回正文(走 gh issue/pr update
trans gh:/pikasTech/HWLAB/pr/507 apply-patch <<'PATCH'
*** Begin Patch
*** Update File: body.md
@@ -276,7 +286,7 @@ trans gh:/pikasTech/HWLAB/pr/507 apply-patch <<'PATCH'
PATCH
```
正文一楼映射为 `body.md`。写回走 `gh issue/pr update` 的 guard 规则。`rm` 对正文结构化拒绝。
正文一楼映射为 `body.md`route 未写 `/1` 时默认一楼正文。写回走 `gh issue/pr update` 的 guard 规则。`apply-patch` 是首选 operation`apply_patch``patch-apply` 只作为兼容别名。`rm` 对正文结构化拒绝。
---