From d328a1d97b9cdd44596b526f6aab7969a43092d7 Mon Sep 17 00:00:00 2001 From: laurencewannamaker Date: Sun, 5 Jul 2026 22:56:48 +0000 Subject: [PATCH] =?UTF-8?q?feat(issue):=20=E6=96=B0=E5=A2=9E=20issue=20+co?= =?UTF-8?q?mments=20=E8=AF=BB=E8=AF=84=E8=AE=BA=E6=B5=81=EF=BC=88journals?= =?UTF-8?q?=20=E5=88=86=E9=A1=B5=20+=20--all=EF=BC=8C=E5=AF=B9=E6=A0=87=20?= =?UTF-8?q?gh=20issue=20view=20--comments=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- doc/changes/list-all-pagination.md | 6 ++++++ internal/i18n/locales/en-US.json | 1 + internal/i18n/locales/zh-CN.json | 1 + shortcuts/issue/issue.go | 34 ++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/doc/changes/list-all-pagination.md b/doc/changes/list-all-pagination.md index 54b0145..9bdb6fd 100644 --- a/doc/changes/list-all-pagination.md +++ b/doc/changes/list-all-pagination.md @@ -22,6 +22,7 @@ - `milestone +list --all`、`org +list --all`、`repo +list --all` - `search +repos --all`、`search +users --all` - `label +list --all`、`member +list --all`、`webhook +list --all` + - `issue +comments --all`(新增子命令,见下) - 对应资源键:`issues`/`pulls`/`branches`/`releases`/`milestones`/ `organizations`/`projects`/`users`/`issue_tags`/`collaborators`/`webhooks` (均生产实测确认) @@ -33,6 +34,11 @@ `/v1/:owner/:repo/collaborators`(支持分页且普通成员可读); - `webhook +list` 完全没有 `--page/--limit`(探针实测:建 3 个 webhook 后 `page=2&limit=1` 返回第二条,确认端点分页),现已补齐。 +- 新增 `issue +comments` 子命令(对标 `gh issue view --comments`): + 此前 CLI 只能发评论(`issue +comment`)无法读评论流,Agent 无法获取 + issue 讨论上下文;现接 `/v1/:owner/:repo/issues/:number/journals` + (资源键 `journals`,生产实测分页 + --all 合并通过), + 复用 --number/--id 语义。 - 未加 `--all` 的 list 端点均经生产验证为非分页或未部署: `licenses`/`ignores` 返回全量数组;`pm/pipelines` 404 未部署; `pipeline +runs` 用 `total_data` 非标准包裹;dataset 端点未部署(平台 issue #144255)。 diff --git a/internal/i18n/locales/en-US.json b/internal/i18n/locales/en-US.json index 59fdf8e..9c2cc67 100644 --- a/internal/i18n/locales/en-US.json +++ b/internal/i18n/locales/en-US.json @@ -42,6 +42,7 @@ "cmd.issue.batch_list.short": "List issue batch maintenance candidates without changing remote data", "cmd.issue.close.short": "Close an issue", "cmd.issue.comment.short": "Add a comment to an issue", + "cmd.issue.comments.short": "List comments on an issue", "cmd.issue.create.short": "Create a new issue", "cmd.issue.list.short": "List issues", "cmd.issue.short": "Issue operations", diff --git a/internal/i18n/locales/zh-CN.json b/internal/i18n/locales/zh-CN.json index 2f8c7f7..3e8d129 100644 --- a/internal/i18n/locales/zh-CN.json +++ b/internal/i18n/locales/zh-CN.json @@ -42,6 +42,7 @@ "cmd.issue.batch_list.short": "列出议题批量维护候选项,不修改远端数据", "cmd.issue.close.short": "关闭议题", "cmd.issue.comment.short": "给议题添加评论", + "cmd.issue.comments.short": "列出 Issue 的评论", "cmd.issue.create.short": "创建新议题", "cmd.issue.list.short": "列出议题", "cmd.issue.short": "议题操作", diff --git a/shortcuts/issue/issue.go b/shortcuts/issue/issue.go index 83c06fb..79d240e 100644 --- a/shortcuts/issue/issue.go +++ b/shortcuts/issue/issue.go @@ -307,6 +307,40 @@ func Shortcuts(translators ...*i18n.Translator) []*common.Shortcut { return ctx.Output(env) }, }, + { + Name: "comments", + Description: tr.T("cmd.issue.comments.short"), + Flags: appendIssueNumberFlags( + common.Flag{Name: "page", Short: "p", Usage: tr.T("flag.page"), Default: "1"}, + common.Flag{Name: "limit", Short: "l", Usage: tr.T("flag.limit"), Default: "20"}, + common.Flag{Name: "all", Usage: tr.T("flag.all"), Bool: true, Default: "false"}, + ), + Run: func(ctx *common.RuntimeContext) error { + if err := ctx.ResolveOwnerRepo(); err != nil { + return err + } + number, err := issueNumberArg(ctx) + if err != nil { + return err + } + path := fmt.Sprintf("%s/issues/%s/journals", v1RepoPath(ctx), number) + q := url.Values{} + q.Set("page", ctx.Arg("page")) + q.Set("limit", ctx.Arg("limit")) + if ctx.Arg("all") == "true" { + items, err := ctx.PaginateAllKey(path, q, "journals") + if err != nil { + return err + } + return ctx.Output(common.NewListEnvelope("journals", items)) + } + env, err := ctx.CallAPIWithQuery("GET", path, q) + if err != nil { + return err + } + return ctx.Output(env) + }, + }, { Name: "assigners", Description: "List issue assigners",