feat(pr): add pr +comment shortcut #15

Merged
wbtiger merged 1 commits from wbtiger/gitlink-cli:feat/pr-comment into master 2026-05-14 14:26:27 +08:00
Member

背景

在 review PR #13 时发现,给 PR 添加评论需要先通过 pr +view 获取 issue ID,再用 issue +comment 或原始 API 调用。流程不够直观。

改动

新增 pr +comment 命令,作为语法糖简化给 PR 评论的流程:

gitlink-cli pr +comment --id 13 --body "LGTM, ready to merge"

内部自动通过 GET /pulls/{id} 获取 PR 对应的 issue ID,再调用 /v1/{owner}/{repo}/issues/{id}/journals 发送评论。

文件清单

文件 改动
shortcuts/pr/pr.go 新增 comment shortcut + extractIssueID helper
shortcuts/pr/pr_test.go 3 个单测(正常评论、PR 不存在、issue 字段缺失)
skills/gitlink-pr/SKILL.md 文档更新

测试

  • go test ./... 全部通过
  • Live 测试:--id 14813(pull_request_id)和 --id 1(pull_request_number)均正常
  • 已有命令(list/view/merge/close/files/diff)不受影响
## 背景 在 review PR #13 时发现,给 PR 添加评论需要先通过 pr +view 获取 issue ID,再用 issue +comment 或原始 API 调用。流程不够直观。 ## 改动 新增 `pr +comment` 命令,作为语法糖简化给 PR 评论的流程: ```bash gitlink-cli pr +comment --id 13 --body "LGTM, ready to merge" ``` 内部自动通过 `GET /pulls/{id}` 获取 PR 对应的 issue ID,再调用 `/v1/{owner}/{repo}/issues/{id}/journals` 发送评论。 ## 文件清单 | 文件 | 改动 | |------|------| | shortcuts/pr/pr.go | 新增 comment shortcut + extractIssueID helper | | shortcuts/pr/pr_test.go | 3 个单测(正常评论、PR 不存在、issue 字段缺失) | | skills/gitlink-pr/SKILL.md | 文档更新 | ## 测试 - `go test ./...` 全部通过 - Live 测试:`--id 14813`(pull_request_id)和 `--id 1`(pull_request_number)均正常 - 已有命令(list/view/merge/close/files/diff)不受影响
wbtiger added 1 commit 2026-05-14 14:23:10 +08:00
20c3a4ff62 feat(pr): add pr +comment shortcut
Add a convenience command to comment on pull requests directly,
without needing to look up the underlying issue ID first.

Internally resolves the PR's issue ID via pr +view, then posts
to the issues journals API.
wbtiger merged commit a560dfc982 into master 2026-05-14 14:26:27 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Gitlink/gitlink-cli#15
No description provided.