feat(notification): add message notification shortcuts #315

Closed
ohanabi wants to merge 0 commits from ohanabi/gitlink-cli:feat/notification-shortcuts into master
Contributor

合并请求描述

本次合并请求新增 GitLink CLI 通知与消息管理快捷命令,围绕用户消息列表、标记已读、删除消息和发送 @ 提及消息提供一组完整
Shortcut,减少 gitlink-notification-digest 等 Agent Skill 对 Raw API 的依赖,并补齐测试、文档、i18n 与 Skill 说明。

相关Issue

关联Issue编号:暂无

变更内容

1. 增强了通知消息查看能力

新增 notification +list,支持查看当前认证用户或指定用户的消息列表,并支持 --type--status--page--limit 等筛选
参数。

2. 增强了消息已读管理能力

新增 notification +read,支持通过 --ids 将指定消息标记为已读,也支持通过 --all-unread 将所选类型的全部未读消息标记为已
读。

3. 增强了消息删除能力

新增 notification +delete,支持按消息 ID 删除指定消息,并通过 --dry-run--yes 防止误删。

4. 增强了 @ 提及消息发送能力

新增 notification +send-atme,支持向指定用户发送 @ 提及消息,可关联 JournalIssuePullRequest 目标对象。

5. 补齐了配套文档和测试

新增 shortcuts/notification 单元测试,更新命令注册、README、README.zh-CN、i18n 文案、Skill 总览、gitlink-notification
Skill、gitlink-notification-digest Skill 和变更说明文档。

问题描述

此前 GitLink CLI 没有通知/消息管理相关 Shortcut,通知摘要类 Agent Skill 只能直接拼接 Raw API 路径访问 messages 接口。
这会增加用户和 Agent 的使用成本,也容易出现路径拼写、参数遗漏、误读 GitLink “messages/notifications” 术语差异等问题。
同时,标记已读、删除消息、发送 @ 消息都属于远端写操作,缺少统一的 dry-run 和显式确认机制。

问题复现步骤

  1. 使用 GitLink CLI 尝试查看当前用户未读通知。
  2. 尝试按 notificationatme 类型筛选消息。
  3. 尝试将多条消息标记为已读。
  4. 尝试删除指定消息或发送 @ 提及消息。
  5. 发现缺少对应 Shortcut,只能使用 Raw API 手动构造路径、查询参数和请求体。

根本原因

CLI 的 Shortcut 层此前未覆盖 GitLink 用户消息 API。
现有 gitlink-notification-digest Skill 虽然有完整通知摘要场景,但只能依赖 Raw API 调用 /api/users/{owner}/messages.json
等接口。
消息相关写操作也没有统一的预览和确认保护,不利于人类用户和 AI Agent 安全执行。

修复方案

新增 notification Shortcut 组,对 GitLink messages API 进行封装:

  • notification +list
  • notification +read
  • notification +delete
  • notification +send-atme

其中:

  • notification +list 为只读操作,可直接执行。
  • notification +readnotification +deletenotification +send-atme 均为写操作,默认不会修改远端状态。
  • 写操作支持 --dry-run 输出请求方法、路径和 payload。
  • 写操作必须显式传入 --yes 才会真正调用远端 API。
  • notification +read --all-unread 使用 GitLink API 的 ids: [-1] 约定。
  • notification +delete 不提供 --all-unread,避免误删大量消息。

同时更新 gitlink-notification-digest Skill,使其优先使用 notification +listnotification +read,减少 Raw API 依赖。

测试验证

  • gofmt
  • git diff --check
  • go run ./internal/i18n/cmd/check
  • go test ./shortcuts/notification ./shortcuts
  • go test ./...
## 合并请求描述 本次合并请求新增 GitLink CLI 通知与消息管理快捷命令,围绕用户消息列表、标记已读、删除消息和发送 @ 提及消息提供一组完整 Shortcut,减少 `gitlink-notification-digest` 等 Agent Skill 对 Raw API 的依赖,并补齐测试、文档、i18n 与 Skill 说明。 ## 相关Issue 关联Issue编号:暂无 ## 变更内容 ### 1. 增强了通知消息查看能力 新增 `notification +list`,支持查看当前认证用户或指定用户的消息列表,并支持 `--type`、`--status`、`--page`、`--limit` 等筛选 参数。 ### 2. 增强了消息已读管理能力 新增 `notification +read`,支持通过 `--ids` 将指定消息标记为已读,也支持通过 `--all-unread` 将所选类型的全部未读消息标记为已 读。 ### 3. 增强了消息删除能力 新增 `notification +delete`,支持按消息 ID 删除指定消息,并通过 `--dry-run` 和 `--yes` 防止误删。 ### 4. 增强了 @ 提及消息发送能力 新增 `notification +send-atme`,支持向指定用户发送 @ 提及消息,可关联 `Journal`、`Issue` 或 `PullRequest` 目标对象。 ### 5. 补齐了配套文档和测试 新增 `shortcuts/notification` 单元测试,更新命令注册、README、README.zh-CN、i18n 文案、Skill 总览、`gitlink-notification` Skill、`gitlink-notification-digest` Skill 和变更说明文档。 ## 问题描述 此前 GitLink CLI 没有通知/消息管理相关 Shortcut,通知摘要类 Agent Skill 只能直接拼接 Raw API 路径访问 messages 接口。 这会增加用户和 Agent 的使用成本,也容易出现路径拼写、参数遗漏、误读 GitLink “messages/notifications” 术语差异等问题。 同时,标记已读、删除消息、发送 @ 消息都属于远端写操作,缺少统一的 dry-run 和显式确认机制。 ## 问题复现步骤 1. 使用 GitLink CLI 尝试查看当前用户未读通知。 2. 尝试按 `notification` 或 `atme` 类型筛选消息。 3. 尝试将多条消息标记为已读。 4. 尝试删除指定消息或发送 @ 提及消息。 5. 发现缺少对应 Shortcut,只能使用 Raw API 手动构造路径、查询参数和请求体。 ## 根本原因 CLI 的 Shortcut 层此前未覆盖 GitLink 用户消息 API。 现有 `gitlink-notification-digest` Skill 虽然有完整通知摘要场景,但只能依赖 Raw API 调用 `/api/users/{owner}/messages.json` 等接口。 消息相关写操作也没有统一的预览和确认保护,不利于人类用户和 AI Agent 安全执行。 ## 修复方案 新增 `notification` Shortcut 组,对 GitLink messages API 进行封装: - `notification +list` - `notification +read` - `notification +delete` - `notification +send-atme` 其中: - `notification +list` 为只读操作,可直接执行。 - `notification +read`、`notification +delete`、`notification +send-atme` 均为写操作,默认不会修改远端状态。 - 写操作支持 `--dry-run` 输出请求方法、路径和 payload。 - 写操作必须显式传入 `--yes` 才会真正调用远端 API。 - `notification +read --all-unread` 使用 GitLink API 的 `ids: [-1]` 约定。 - `notification +delete` 不提供 `--all-unread`,避免误删大量消息。 同时更新 `gitlink-notification-digest` Skill,使其优先使用 `notification +list` 和 `notification +read`,减少 Raw API 依赖。 ## 测试验证 - `gofmt` - `git diff --check` - `go run ./internal/i18n/cmd/check` - `go test ./shortcuts/notification ./shortcuts` - `go test ./...`
ohanabi added 1 commit 2026-07-02 13:01:05 +08:00
wbtiger closed this pull request 2026-07-14 22:57:07 +08:00
wbtiger reopened this pull request 2026-07-14 23:02:20 +08:00
wbtiger closed this pull request 2026-07-14 23:05:48 +08:00

Pull request closed

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#315
No description provided.