fix: bound github issue comment views (#915)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-26 00:57:39 +08:00
committed by GitHub
parent 29f80935bf
commit 08e6ee575b
7 changed files with 77 additions and 12 deletions
+6 -2
View File
@@ -94,7 +94,7 @@ bun scripts/cli.ts gh issue view <number|url|owner/repo#number> \
`read` 是兼容别名。支持 `owner/repo#number` shorthand(如 `pikasTech/HWLAB#1024`)。
人工读取 issue/PR 正文优先走 `trans gh:/owner/repo/issue/<number> cat|rg``trans gh:/owner/repo/pr/<number> cat|rg``gh issue view/read` 主要保留为结构化 JSON 底座、metadata 读取和兼容入口。
`--json comments` 默认只返回 comment id、URL、作者、时间、正文字符数、body SHA 和短 preview完整 comment body 只在显式 `--full`/`--raw``trans gh:` drill-down 下读取。显式 `--json` 路径的 comments 位于 `.data.json.comments`,不要依赖顶层重复 comments。
`--json comments` 默认只返回 comment id、URL、作者、时间、正文字符数、body SHA 和短 preview`--full` 仍保持评论列表有界,只有 `--raw` 会显式展开所有评论正文。读取单条完整 comment body 使用 `gh issue comment view <commentId> --full`显式 `--json` 路径的 comments 位于 `.data.json.comments`,不要依赖顶层重复 comments。
### 创建
@@ -165,6 +165,10 @@ bun scripts/cli.ts gh issue comment create <number|owner/repo#number> \
评论正文
EOF
# 读取单条评论
bun scripts/cli.ts gh issue comment view <commentId> \
--repo owner/name [--full|--raw]
# 原地修正评论
bun scripts/cli.ts gh issue comment update <commentId> \
--repo owner/name --body-stdin <<'EOF'
@@ -186,7 +190,7 @@ PATCH
bun scripts/cli.ts gh issue comment delete <commentId>
```
`edit``comment update` 的兼容别名。`--body <short-text>` 仅适合短单行。日常修正文案优先用 `patch``update/edit` 保留评论 ID 和时间线;`delete` 只用于确实需要删除的评论。`comment patch` 会先读取 comment id 对应的当前正文,把 envelope 应用到虚拟文件 `comment.md`,再 PATCH 单条评论;上下文不匹配时失败且不写入。
`view` 默认返回 comment id、URL、作者、时间、正文字符数、body SHA 和短 preview`--full` 只展开这一条 comment body。`edit``comment update` 的兼容别名。`--body <short-text>` 仅适合短单行。日常修正文案优先用 `patch``update/edit` 保留评论 ID 和时间线;`delete` 只用于确实需要删除的评论。`comment patch` 会先读取 comment id 对应的当前正文,把 envelope 应用到虚拟文件 `comment.md`,再 PATCH 单条评论;上下文不匹配时失败且不写入。
评论区不要写新的大计划。若评论草稿已经包含多阶段计划、改进清单或验收标准,改为创建新 issue,并在评论中只留下新 issue 链接和短结论。