Files
2026-07-05 12:46:49 +00:00

46 lines
3.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: unidesk-gh
description: UniDesk GitHub CLI - 通过 `bun scripts/cli.ts gh ...` 管理 GitHub issue/PR,不依赖原生 `gh` binary。用户提到 gh、GitHub issue、GitHub PR、创建 issue、评论 issue、合并 PR、preflight、看板操作时使用。
---
# UniDesk GitHub CLI
GitHub issue/PR 正式读写必须走 `bun scripts/cli.ts gh ...``trans gh:/... apply-patch`,不依赖原生 `gh` binary,不手写 GitHub API。
## 高频规则
- Issue/PR 正文、评论、关闭/重开、PR 描述和 merge closeout 默认中文。
- 需要理解、拆解、执行或关闭 GitHub issue 时,必须阅读 issue 正文全文;即使 `gh issue view` 触发 stdout dump wrapper,也要跟随 `dump.path` 或改用 `trans gh:/... cat` 读完整正文,不能只凭 compact summary、body preview、body SHA 或截断摘要下结论。
- 新 issue 正文必须包含 `目标合并分支: <repo branch/lane>`;不需要合并时写 `目标合并分支: 不适用`
- 大计划、后续阶段和独立改进方向创建新 issue;已有 issue 评论只写短进展、证据、阻塞和链接。
- 规划型、多阶段、架构/API/平台运维类 issue 第一阶段必须 `P0 SPEC 先行`;细则见 [references/issues.md](references/issues.md)。
- `P0 SPEC 先行` 段不得写入硬编码阈值、采样周期、重试次数、并发数等可调参数;必须写明这些参数由指定 YAML/source-of-truth 控制,issue 只列配置路径、字段族和验收读取方式。
- `gh` 默认输出是 k8s 风格 text/table/summary/Next/Disclosure;脚本消费或全量排障必须显式用 `--json``--full``--raw`
- 多行正文使用 quoted heredoc`--body-stdin <<'EOF'`issue close/reopen 生命周期评论只用 `--comment-stdin <<'EOF'`。不要把 Markdown 塞进 shell 参数。
- PR merge 只走 guarded `gh pr merge``gh pr create` 的 Next 默认是 `--merge --delete-branch`,只有确认 ancestry 可丢弃时才显式 `--squash`
## 常用入口
```bash
bun scripts/cli.ts gh auth status --repo pikasTech/unidesk
bun scripts/cli.ts gh issue list --repo pikasTech/unidesk --state open --limit 30
bun scripts/cli.ts gh issue view <number> --repo pikasTech/unidesk
bun scripts/cli.ts gh issue view <number> --repo pikasTech/unidesk --json body,title,state
bun scripts/cli.ts gh issue comments <number> --repo pikasTech/unidesk --limit 8
bun scripts/cli.ts gh issue create --repo pikasTech/unidesk --title "标题" --body-stdin
bun scripts/cli.ts gh pr list --repo pikasTech/unidesk --state all --limit 10
bun scripts/cli.ts gh pr review-plan <number> --repo pikasTech/unidesk
bun scripts/cli.ts gh pr diff <number> --repo pikasTech/unidesk --file path/to/file [--hunk 1]
bun scripts/cli.ts gh pr create --repo pikasTech/unidesk --title "标题" --body-stdin --base master --head <branch>
bun scripts/cli.ts gh pr preflight <number> --repo pikasTech/unidesk
bun scripts/cli.ts gh pr merge <number> --repo pikasTech/unidesk --merge --delete-branch
```
Issue CRUD/comment/patch/stale-close/scan-escape 和看板命令见 [references/issues.md](references/issues.md)PR files/review-plan/diff/preflight/merge 见 [references/pull-requests.md](references/pull-requests.md)`trans gh:` 虚拟文件系统见 [references/trans-gh.md](references/trans-gh.md)。
## 何时读取 reference
- 需要具体 issue/comment 命令参数、`--json` 字段、body guard 或看板命令:读 [references/issues.md](references/issues.md)。
- 需要 PR bounded patch/index/drill-down、closeout、preflight、merge 或 ancestry/squash 判断:读 [references/pull-requests.md](references/pull-requests.md)。
- 需要局部修补正文或评论:读 [references/trans-gh.md](references/trans-gh.md)。