Merge PR #321: feat(issue): add journal and activity shortcuts
# Conflicts: # internal/i18n/locales/en-US.json # internal/i18n/locales/zh-CN.json # shortcuts/issue/issue_test.go # skills/gitlink-issue/SKILL.md
This commit is contained in:
commit
e1d332c768
|
|
@ -326,6 +326,10 @@ gitlink-cli issue +batch-close --owner Gitlink --repo forgeplus --from issues.cs
|
|||
# Add a comment
|
||||
gitlink-cli issue +comment --owner Gitlink --repo forgeplus -i 123 -b "Fixed"
|
||||
|
||||
# List issue journals or comment activity
|
||||
gitlink-cli issue +journals --owner Gitlink --repo forgeplus --number 123 --page 1 --limit 50
|
||||
gitlink-cli issue +activity --owner Gitlink --repo forgeplus --number 123 --category comment
|
||||
|
||||
# List issue assigners
|
||||
gitlink-cli issue +assigners --owner Gitlink --repo forgeplus
|
||||
|
||||
|
|
|
|||
|
|
@ -368,6 +368,10 @@ gitlink-cli issue +batch-delete --owner Gitlink --repo forgeplus --ids 101,102 -
|
|||
# 添加评论
|
||||
gitlink-cli issue +comment --owner Gitlink --repo forgeplus -i 123 -b "已修复"
|
||||
|
||||
# 列出 Issue 动态记录或评论活动
|
||||
gitlink-cli issue +journals --owner Gitlink --repo forgeplus --number 123 --page 1 --limit 50
|
||||
gitlink-cli issue +activity --owner Gitlink --repo forgeplus --number 123 --category comment
|
||||
|
||||
# 列出 Issue 负责人
|
||||
gitlink-cli issue +assigners --owner Gitlink --repo forgeplus
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
# Issue journal shortcuts
|
||||
|
||||
## Background
|
||||
|
||||
Issue comments and journal events are useful for stale issue detection, audit
|
||||
trails, and triage workflows. Those reads were still documented as Raw API calls
|
||||
against `/v1/:owner/:repo/issues/:number/journals`.
|
||||
|
||||
This change adds first-class read-only shortcuts for issue journals.
|
||||
|
||||
## New shortcuts
|
||||
|
||||
- `issue +journals` lists raw issue journal records.
|
||||
- `issue +activity` uses the same journal endpoint as an activity-oriented
|
||||
alias.
|
||||
|
||||
Both commands preserve the existing issue number convention:
|
||||
|
||||
- `--number` / `-n` is the preferred web-visible issue number.
|
||||
- `--id` / `-i` remains a compatibility alias for the same web-visible number,
|
||||
not the database ID.
|
||||
|
||||
## Options
|
||||
|
||||
- `--category` filters journal category, for example `comment`.
|
||||
- `--page` defaults to `1`.
|
||||
- `--limit` defaults to `50`.
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
gitlink-cli issue +journals --owner Gitlink --repo forgeplus --number 123 --page 1 --limit 50
|
||||
gitlink-cli issue +journals --owner Gitlink --repo forgeplus --number 123 --category comment
|
||||
gitlink-cli issue +activity --owner Gitlink --repo forgeplus --number 123 --category comment
|
||||
```
|
||||
|
||||
## Documentation updates
|
||||
|
||||
- README and README.zh-CN include journal and activity examples.
|
||||
- `skills/gitlink-issue` documents the new read-only shortcuts.
|
||||
- `skills/gitlink-stale-issue-manager` now uses `issue +journals` instead of
|
||||
Raw API for comment history lookup.
|
||||
|
||||
## Tests
|
||||
|
||||
Unit tests cover:
|
||||
|
||||
- endpoint path and query mapping;
|
||||
- `--number` and `--id` alias behavior;
|
||||
- missing issue number validation;
|
||||
- HTTP error propagation.
|
||||
|
||||
Suggested verification:
|
||||
|
||||
```bash
|
||||
go test ./shortcuts/issue ./shortcuts
|
||||
```
|
||||
|
||||
Full project verification:
|
||||
|
||||
```bash
|
||||
go test ./...
|
||||
```
|
||||
|
|
@ -1,13 +1,4 @@
|
|||
{
|
||||
"cmd.action.disable.short": "Disable Actions for the repository",
|
||||
"cmd.action.enable.short": "Enable Actions for the repository",
|
||||
"cmd.action.job_rerun.short": "Rerun a single job of a run",
|
||||
"cmd.action.list.short": "List workflow files (.gitea/workflows)",
|
||||
"cmd.action.logs.short": "Fetch the raw logs of a workflow job",
|
||||
"cmd.action.rerun.short": "Rerun all jobs of a run",
|
||||
"cmd.action.run.short": "Trigger a workflow run",
|
||||
"cmd.action.runs.short": "List runs of a workflow",
|
||||
"cmd.action.short": "Gitea Actions (CI workflow) operations",
|
||||
"cmd.api.long": "Send arbitrary HTTP requests to the GitLink API. Authentication is injected automatically.",
|
||||
"cmd.api.short": "Make raw API requests to GitLink",
|
||||
"cmd.auth.login.short": "Login to GitLink",
|
||||
|
|
@ -43,13 +34,7 @@
|
|||
"cmd.dataset.view.short": "View a repository's dataset",
|
||||
"cmd.doctor.long": "Run local diagnostics for gitlink-cli configuration, authentication, repository context and API connectivity.",
|
||||
"cmd.doctor.short": "Diagnose gitlink-cli environment problems",
|
||||
"cmd.file.batch.short": "Apply multiple file operations in a single commit",
|
||||
"cmd.file.create.short": "Create a new file in the repository",
|
||||
"cmd.file.delete.short": "Delete a file from the repository",
|
||||
"cmd.file.search.short": "Search files in the repository by name",
|
||||
"cmd.file.short": "Repository file content operations",
|
||||
"cmd.file.update.short": "Update an existing file in the repository",
|
||||
"cmd.file.view.short": "View the contents of a file",
|
||||
"cmd.issue.activity.short": "List issue activity events",
|
||||
"cmd.issue.batch_close.long": "Close filtered issues in bulk.\n\nThis command defaults to dry-run mode and only prints matching issues.\nPass --yes to execute remote close operations. Use restrictive filters and a small limit.\n\nExamples:\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20 --yes",
|
||||
"cmd.issue.batch_close.short": "Close filtered issues in bulk. Defaults to dry-run; pass --yes to execute.",
|
||||
"cmd.issue.batch_label.long": "Add a label to filtered issues in bulk.\n\nThis command defaults to dry-run mode and only prints matching issues.\nPass --yes to execute remote label operations. The current implementation does not fake label writes when the API endpoint is unavailable.\n\nExamples:\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50 --yes",
|
||||
|
|
@ -59,6 +44,7 @@
|
|||
"cmd.issue.close.short": "Close an issue",
|
||||
"cmd.issue.comment.short": "Add a comment to an issue",
|
||||
"cmd.issue.create.short": "Create a new issue",
|
||||
"cmd.issue.journals.short": "List issue journals",
|
||||
"cmd.issue.list.short": "List issues",
|
||||
"cmd.issue.short": "Issue operations",
|
||||
"cmd.issue.update.short": "Update an issue",
|
||||
|
|
@ -68,10 +54,8 @@
|
|||
"cmd.org.list.short": "List organizations",
|
||||
"cmd.org.members.short": "List organization members",
|
||||
"cmd.org.short": "Organization operations",
|
||||
"cmd.pr.check_merge.short": "Pre-flight check whether a merge request can be created between two branches",
|
||||
"cmd.pr.close.short": "Close a pull request",
|
||||
"cmd.pr.comment.short": "Add a comment to a pull request",
|
||||
"cmd.pr.commits.short": "List commits of a pull request",
|
||||
"cmd.pr.create.short": "Create a pull request",
|
||||
"cmd.pr.diff.short": "Show diff for a pull request",
|
||||
"cmd.pr.files.short": "List changed files in a pull request",
|
||||
|
|
@ -132,10 +116,6 @@
|
|||
"error.missing_required_flag": "required flag --{name} is missing",
|
||||
"error.profile.user_required": "could not determine target user; pass --user or run gitlink-cli auth login",
|
||||
"error.unsupported_language": "unsupported language: {lang}",
|
||||
"flag.action.job": "Job name within the run",
|
||||
"flag.action.ref": "Branch or tag to run on",
|
||||
"flag.action.run_id": "Run ID from action +runs",
|
||||
"flag.action.workflow": "Workflow file name (e.g. ci.yml)",
|
||||
"flag.api.batch_continue_on_error": "Continue running remaining batch requests after a failure",
|
||||
"flag.api.batch_dry_run": "Preview batch requests without sending remote requests",
|
||||
"flag.api.batch_file": "Read an API batch plan from a JSON file",
|
||||
|
|
@ -167,15 +147,6 @@
|
|||
"flag.description": "Description",
|
||||
"flag.doctor.skip_network": "Skip authenticated API connectivity checks",
|
||||
"flag.dry_run": "Preview the request without creating it",
|
||||
"flag.file.batch_spec": "Path to a JSON array of file operations: [{action_type, file_path, content, encoding}]",
|
||||
"flag.file.branch": "Branch to commit to",
|
||||
"flag.file.content": "File content",
|
||||
"flag.file.content_file": "Read file content from a local file",
|
||||
"flag.file.message": "Commit message",
|
||||
"flag.file.new_branch": "Create a new branch from --branch for the commit",
|
||||
"flag.file.path": "File path",
|
||||
"flag.file.raw": "Print only the decoded file content",
|
||||
"flag.file.ref": "Branch, tag, or commit SHA (defaults to the default branch)",
|
||||
"flag.format": "Output format: json, table, yaml (default: table)",
|
||||
"flag.issue.add_label": "Label to add to each matching issue",
|
||||
"flag.issue.assignee": "Assignee login",
|
||||
|
|
@ -189,6 +160,7 @@
|
|||
"flag.issue.batch_list.limit": "Maximum issues to return, capped at 100",
|
||||
"flag.issue.batch_process.limit": "Maximum issues to process, capped at 100",
|
||||
"flag.issue.body": "Issue description",
|
||||
"flag.issue.journal_category": "Journal category filter, for example: comment",
|
||||
"flag.issue.label": "Label ID",
|
||||
"flag.issue.label_filter": "Filter by existing label",
|
||||
"flag.issue.milestone": "Milestone ID",
|
||||
|
|
@ -213,7 +185,6 @@
|
|||
"flag.pr.base": "Target branch",
|
||||
"flag.pr.body": "PR description",
|
||||
"flag.pr.file": "Filter diff by file path",
|
||||
"flag.pr.fork_project_id": "Fork project ID for cross-fork merge checks",
|
||||
"flag.pr.head": "Source branch",
|
||||
"flag.pr.id": "PR number",
|
||||
"flag.pr.merge_method": "Merge method: merge, rebase, squash",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
{
|
||||
"cmd.action.disable.short": "为仓库停用 Actions",
|
||||
"cmd.action.enable.short": "为仓库启用 Actions",
|
||||
"cmd.action.job_rerun.short": "重跑运行中的单个任务",
|
||||
"cmd.action.list.short": "列出工作流文件(.gitea/workflows)",
|
||||
"cmd.action.logs.short": "获取流水线任务的原始日志",
|
||||
"cmd.action.rerun.short": "重跑一次运行的全部任务",
|
||||
"cmd.action.run.short": "触发一次工作流运行",
|
||||
"cmd.action.runs.short": "列出工作流的运行记录",
|
||||
"cmd.action.short": "Gitea Actions(CI 工作流)操作",
|
||||
"cmd.api.long": "向 GitLink API 发送任意 HTTP 请求。认证信息会自动注入。",
|
||||
"cmd.api.short": "向 GitLink 发起原始 API 请求",
|
||||
"cmd.auth.login.short": "登录 GitLink",
|
||||
|
|
@ -43,13 +34,7 @@
|
|||
"cmd.dataset.view.short": "查看仓库数据集",
|
||||
"cmd.doctor.long": "诊断 gitlink-cli 的配置、认证、仓库上下文和 API 连通性问题。",
|
||||
"cmd.doctor.short": "诊断 gitlink-cli 环境问题",
|
||||
"cmd.file.batch.short": "在单个提交中应用多个文件操作",
|
||||
"cmd.file.create.short": "在仓库中创建文件",
|
||||
"cmd.file.delete.short": "删除仓库中的文件",
|
||||
"cmd.file.search.short": "按文件名搜索仓库文件",
|
||||
"cmd.file.short": "仓库文件内容操作",
|
||||
"cmd.file.update.short": "更新仓库中的文件",
|
||||
"cmd.file.view.short": "查看文件内容",
|
||||
"cmd.issue.activity.short": "列出议题活动事件",
|
||||
"cmd.issue.batch_close.long": "批量关闭筛选后的议题。\n\n该命令默认处于 dry-run 模式,只打印匹配的议题。\n传入 --yes 后执行远端关闭操作。请使用严格筛选条件和较小 limit。\n\n示例:\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20\n gitlink-cli issue +batch-close --owner Gitlink --repo gitlink-cli --older-than-days 60 --limit 20 --yes",
|
||||
"cmd.issue.batch_close.short": "批量关闭筛选后的议题。默认 dry-run;传入 --yes 后执行。",
|
||||
"cmd.issue.batch_label.long": "给筛选后的议题批量添加标签。\n\n该命令默认处于 dry-run 模式,只打印匹配的议题。\n传入 --yes 后执行远端标签操作。当前实现不会在 API 端点不可用时伪造写入结果。\n\n示例:\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50\n gitlink-cli issue +batch-label --owner Gitlink --repo gitlink-cli --add-label stale --older-than-days 30 --limit 50 --yes",
|
||||
|
|
@ -59,6 +44,7 @@
|
|||
"cmd.issue.close.short": "关闭议题",
|
||||
"cmd.issue.comment.short": "给议题添加评论",
|
||||
"cmd.issue.create.short": "创建新议题",
|
||||
"cmd.issue.journals.short": "列出议题动态记录",
|
||||
"cmd.issue.list.short": "列出议题",
|
||||
"cmd.issue.short": "议题操作",
|
||||
"cmd.issue.update.short": "更新议题",
|
||||
|
|
@ -68,10 +54,8 @@
|
|||
"cmd.org.list.short": "列出组织",
|
||||
"cmd.org.members.short": "列出组织成员",
|
||||
"cmd.org.short": "组织操作",
|
||||
"cmd.pr.check_merge.short": "预检两个分支之间能否创建合并请求",
|
||||
"cmd.pr.close.short": "关闭拉取请求",
|
||||
"cmd.pr.comment.short": "给拉取请求添加评论",
|
||||
"cmd.pr.commits.short": "列出合并请求的提交",
|
||||
"cmd.pr.create.short": "创建拉取请求",
|
||||
"cmd.pr.diff.short": "显示拉取请求 diff",
|
||||
"cmd.pr.files.short": "列出拉取请求中的变更文件",
|
||||
|
|
@ -132,10 +116,6 @@
|
|||
"error.missing_required_flag": "缺少必需参数 --{name}",
|
||||
"error.profile.user_required": "无法确定目标用户;请通过 --user 指定,或先运行 gitlink-cli auth login 登录",
|
||||
"error.unsupported_language": "不支持的语言:{lang}",
|
||||
"flag.action.job": "运行中的任务名",
|
||||
"flag.action.ref": "运行所在的分支或标签",
|
||||
"flag.action.run_id": "运行 ID(来自 action +runs)",
|
||||
"flag.action.workflow": "工作流文件名(如 ci.yml)",
|
||||
"flag.api.batch_continue_on_error": "批处理请求失败后继续执行后续请求",
|
||||
"flag.api.batch_dry_run": "预览批处理请求,不发送远端请求",
|
||||
"flag.api.batch_file": "从 JSON 文件读取 API 批处理计划",
|
||||
|
|
@ -167,15 +147,6 @@
|
|||
"flag.description": "描述",
|
||||
"flag.doctor.skip_network": "跳过需要访问 GitLink 的认证连通性检查",
|
||||
"flag.dry_run": "预览请求,不实际创建",
|
||||
"flag.file.batch_spec": "文件操作 JSON 数组路径:[{action_type, file_path, content, encoding}]",
|
||||
"flag.file.branch": "提交到的分支",
|
||||
"flag.file.content": "文件内容",
|
||||
"flag.file.content_file": "从本地文件读取内容",
|
||||
"flag.file.message": "提交信息",
|
||||
"flag.file.new_branch": "从 --branch 新建分支并提交",
|
||||
"flag.file.path": "文件路径",
|
||||
"flag.file.raw": "仅输出解码后的文件正文",
|
||||
"flag.file.ref": "分支、标签或提交 SHA(默认使用默认分支)",
|
||||
"flag.format": "输出格式:json、table、yaml(默认:table)",
|
||||
"flag.issue.add_label": "要添加到每个匹配议题的标签",
|
||||
"flag.issue.assignee": "负责人登录名",
|
||||
|
|
@ -189,6 +160,7 @@
|
|||
"flag.issue.batch_list.limit": "最多返回的议题数,上限 100",
|
||||
"flag.issue.batch_process.limit": "最多处理的议题数,上限 100",
|
||||
"flag.issue.body": "议题描述",
|
||||
"flag.issue.journal_category": "动态记录分类筛选,例如:comment",
|
||||
"flag.issue.label": "标签 ID",
|
||||
"flag.issue.label_filter": "按已有标签筛选",
|
||||
"flag.issue.milestone": "里程碑 ID",
|
||||
|
|
@ -213,7 +185,6 @@
|
|||
"flag.pr.base": "目标分支",
|
||||
"flag.pr.body": "PR 描述",
|
||||
"flag.pr.file": "按文件路径筛选 diff",
|
||||
"flag.pr.fork_project_id": "跨 fork 合并检查用的 fork 项目 ID",
|
||||
"flag.pr.head": "源分支",
|
||||
"flag.pr.id": "PR 编号",
|
||||
"flag.pr.merge_method": "合并方式:merge、rebase、squash",
|
||||
|
|
|
|||
|
|
@ -303,6 +303,18 @@ func Shortcuts(translators ...*i18n.Translator) []*common.Shortcut {
|
|||
return ctx.Output(env)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "journals",
|
||||
Description: tr.T("cmd.issue.journals.short"),
|
||||
Flags: issueJournalFlags(tr),
|
||||
Run: runIssueJournals,
|
||||
},
|
||||
{
|
||||
Name: "activity",
|
||||
Description: tr.T("cmd.issue.activity.short"),
|
||||
Flags: issueJournalFlags(tr),
|
||||
Run: runIssueJournals,
|
||||
},
|
||||
{
|
||||
Name: "assigners",
|
||||
Description: "List issue assigners",
|
||||
|
|
@ -441,6 +453,14 @@ func appendIssueNumberFlags(flags ...common.Flag) []common.Flag {
|
|||
return append(issueNumberFlags(), flags...)
|
||||
}
|
||||
|
||||
func issueJournalFlags(tr *i18n.Translator) []common.Flag {
|
||||
return appendIssueNumberFlags(
|
||||
common.Flag{Name: "category", Short: "c", Usage: tr.T("flag.issue.journal_category")},
|
||||
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: "50"},
|
||||
)
|
||||
}
|
||||
|
||||
func issueNumberArg(ctx *common.RuntimeContext) (string, error) {
|
||||
if number := strings.TrimSpace(ctx.Arg("number")); number != "" {
|
||||
return number, nil
|
||||
|
|
@ -451,6 +471,25 @@ func issueNumberArg(ctx *common.RuntimeContext) (string, error) {
|
|||
return "", fmt.Errorf("required flag --number is missing (or use --id as a compatibility alias)")
|
||||
}
|
||||
|
||||
func runIssueJournals(ctx *common.RuntimeContext) error {
|
||||
if err := ctx.ResolveOwnerRepo(); err != nil {
|
||||
return err
|
||||
}
|
||||
number, err := issueNumberArg(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
q := url.Values{}
|
||||
setIssueQueryIfPresent(q, "category", ctx.Arg("category"))
|
||||
setIssueQueryIfPresent(q, "page", ctx.Arg("page"))
|
||||
setIssueQueryIfPresent(q, "limit", ctx.Arg("limit"))
|
||||
env, err := ctx.CallAPIWithQuery("GET", fmt.Sprintf("%s/issues/%s/journals", v1RepoPath(ctx), number), q)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctx.Output(env)
|
||||
}
|
||||
|
||||
// normalizeIssueListIDs adds "number" (project_issues_index) and renames
|
||||
// "id" to "database_id" so the user-facing output uses the project-level
|
||||
// issue number, not the global database primary key.
|
||||
|
|
@ -656,3 +695,9 @@ func parseIssueID(value, flagName string) (int, error) {
|
|||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func setIssueQueryIfPresent(q url.Values, key, value string) {
|
||||
if value := strings.TrimSpace(value); value != "" {
|
||||
q.Set(key, value)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: gitlink-issue
|
||||
version: 2.0.0
|
||||
description: "Issue 管理:创建、查看、更新、关闭/批量关闭/批量更新/批量删除/批量重开/批量标签/批量指派/批量评论/批量导出/批量导入 Issue,添加评论。当用户需要操作 GitLink Issue 时触发。"
|
||||
version: 3.0.0
|
||||
description: "Issue 管理:创建、查看、更新、关闭/批量关闭/批量更新/批量删除 Issue,添加评论,查看动态记录和活动。当用户需要操作 GitLink Issue 时触发。"
|
||||
metadata:
|
||||
requires:
|
||||
bins: ["gitlink-cli"]
|
||||
|
|
@ -26,15 +26,11 @@ metadata:
|
|||
| `issue +update` | 更新 Issue | 是 |
|
||||
| `issue +close` | 关闭 Issue | 是 |
|
||||
| `issue +batch-close` | 批量关闭 Issue,支持 `--dry-run` 预览 | 是(dry-run 不写入) |
|
||||
| `issue +batch-reopen` | 批量重开已关闭 Issue,支持 `--dry-run` 预览 | 是(dry-run 不写入) |
|
||||
| `issue +batch-update` | 按 API issue id 批量更新状态、优先级、里程碑、标签、负责人 | 是(dry-run 不写入) |
|
||||
| `issue +batch-delete` | 按 API issue id 批量删除 Issue;真实删除必须 `--yes` | 是(dry-run 不写入) |
|
||||
| `issue +batch-label` | 按 API issue id 批量添加/移除标签 | 是(dry-run 不写入) |
|
||||
| `issue +batch-assign` | 按 API issue id 批量指派/取消指派负责人 | 是(dry-run 不写入) |
|
||||
| `issue +batch-comment` | 批量添加评论到多个 Issue | 是(dry-run 不写入) |
|
||||
| `issue +batch-export` | 导出 Issue 到 CSV 或 JSON 格式 | 否(公开项目) |
|
||||
| `issue +batch-import` | 从 CSV 文件批量创建 Issue | 是(dry-run 不写入) |
|
||||
| `issue +comment` | 添加评论 | 是 |
|
||||
| `issue +journals` | 查询 Issue 动态记录,支持分类和分页 | 否(公开项目) |
|
||||
| `issue +activity` | 查询 Issue 活动事件,复用 journals 端点 | 否(公开项目) |
|
||||
| `issue +assigners` | 查询 Issue 负责人列表 | 否(公开项目) |
|
||||
| `issue +authors` | 查询 Issue 发布人列表 | 否(公开项目) |
|
||||
| `issue +statuses` | 查询 Issue 状态列表 | 否(公开项目) |
|
||||
|
|
@ -75,36 +71,13 @@ gitlink-cli issue +batch-update --owner myuser --repo myrepo --ids 101,102 --sta
|
|||
gitlink-cli issue +batch-delete --owner myuser --repo myrepo --ids 101,102 --dry-run
|
||||
gitlink-cli issue +batch-delete --owner myuser --repo myrepo --ids 101,102 --yes
|
||||
|
||||
# 批量重开已关闭的 Issue
|
||||
gitlink-cli issue +batch-reopen --owner myuser --repo myrepo --numbers 123,124 --dry-run
|
||||
|
||||
# 批量添加标签(使用 API issue id 和标签 id)
|
||||
gitlink-cli issue +batch-label --owner myuser --repo myrepo --ids 101,102 --add 1,2 --dry-run
|
||||
|
||||
# 批量移除标签
|
||||
gitlink-cli issue +batch-label --owner myuser --repo myrepo --ids 101,102 --remove 3,4
|
||||
|
||||
# 批量指派负责人(使用 API issue id 和用户 id)
|
||||
gitlink-cli issue +batch-assign --owner myuser --repo myrepo --ids 101,102 --add 5,6 --dry-run
|
||||
|
||||
# 批量取消指派
|
||||
gitlink-cli issue +batch-assign --owner myuser --repo myrepo --ids 101,102 --remove 5,6
|
||||
|
||||
# 批量添加评论
|
||||
gitlink-cli issue +batch-comment --owner myuser --repo myrepo --numbers 123,124 --message "已修复,请验证" --dry-run
|
||||
|
||||
# 导出 Issue 到 CSV
|
||||
gitlink-cli issue +batch-export --owner myuser --repo myrepo --output issues.csv
|
||||
|
||||
# 导出 Issue 到 JSON(带过滤条件)
|
||||
gitlink-cli issue +batch-export --owner myuser --repo myrepo --format json --status-id 5 --output closed_issues.json
|
||||
|
||||
# 从 CSV 文件批量创建 Issue
|
||||
gitlink-cli issue +batch-import --owner myuser --repo myrepo --file issues.csv --dry-run
|
||||
|
||||
# 添加评论
|
||||
gitlink-cli issue +comment --number 4 --body "已修复,请验证"
|
||||
|
||||
# 查询 Issue 评论和活动记录
|
||||
gitlink-cli issue +journals --number 4 --category comment --page 1 --limit 50
|
||||
gitlink-cli issue +activity --number 4 --page 1 --limit 50
|
||||
|
||||
# 查询 Issue 负责人
|
||||
gitlink-cli issue +assigners --owner Gitlink --repo forgeplus --keyword alice
|
||||
|
||||
|
|
@ -114,50 +87,17 @@ gitlink-cli issue +authors --owner Gitlink --repo forgeplus --keyword bob
|
|||
|
||||
## 批量维护安全约束
|
||||
|
||||
### ID 类型说明
|
||||
|
||||
- **网页 Issue 编号**(`project_issues_index`):用于 `--numbers` 参数
|
||||
- `issue +batch-close --numbers`
|
||||
- `issue +batch-reopen --numbers`
|
||||
- `issue +batch-comment --numbers`
|
||||
|
||||
- **API Issue ID**(数据库内部 ID):用于 `--ids` 参数
|
||||
- `issue +batch-update --ids`
|
||||
- `issue +batch-delete --ids`
|
||||
- `issue +batch-label --ids`
|
||||
- `issue +batch-assign --ids`
|
||||
|
||||
### 安全操作流程
|
||||
|
||||
- 执行 `batch-update` / `batch-delete` / `batch-label` / `batch-assign` 前,先用 `issue +list` 或 `issue +view` 确认 API issue id 来源。
|
||||
- `issue +batch-close --numbers` 使用网页 URL 中的 Issue 编号,即 `project_issues_index`。
|
||||
- `issue +batch-update --ids` 和 `issue +batch-delete --ids` 使用 OpenAPI 返回的 API issue id,不是网页 Issue 编号。
|
||||
- 执行 `batch-update` / `batch-delete` 前,先用 `issue +list` 或 `issue +view` 确认 id 来源。
|
||||
- 写操作先执行 `--dry-run`,展示 `method`、`path`、`body` 给用户确认。
|
||||
- `batch-delete` 是破坏性操作,真实执行必须显式传 `--yes`。
|
||||
- `batch-label` 和 `batch-assign` 会保留现有标签/负责人,仅添加/移除指定的项。
|
||||
|
||||
### CSV 文件格式
|
||||
|
||||
`batch-import` 支持的 CSV 列:
|
||||
- `subject`(必需):Issue 标题
|
||||
- `description`(可选):Issue 描述
|
||||
- `priority_id`(可选):优先级 ID
|
||||
- `status_id`(可选):状态 ID(默认为 1)
|
||||
- `assigner_ids`(可选):负责人 ID 列表(逗号分隔)
|
||||
- `issue_tag_ids`(可选):标签 ID 列表(逗号分隔)
|
||||
|
||||
## Raw API 补充
|
||||
|
||||
```bash
|
||||
# 获取 Issue 评论列表(使用 v1 API,按 issue number 查询)
|
||||
gitlink-cli api GET /v1/:owner/:repo/issues/:number/journals
|
||||
|
||||
# 批量更新 Issue(仍使用旧版 API,需传数据库 ID)
|
||||
gitlink-cli api POST /:owner/:repo/issues/series_update --body '{"ids":[1,2,3],"status_id":"closed"}'
|
||||
|
||||
# 批量添加评论(使用 v1 API)
|
||||
gitlink-cli api POST /v1/:owner/:repo/issues/:number/journals --body '{"notes":"评论内容"}'
|
||||
|
||||
# 导出 Issue 列表(使用 v1 API)
|
||||
gitlink-cli api GET /v1/:owner/:repo/issues.json
|
||||
```
|
||||
|
||||
## GitLink Issue 字段映射
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ gitlink-cli issue +list --state open --owner <owner> --repo <repo> --page 1 --li
|
|||
|
||||
```bash
|
||||
# 获取某个 Issue 的评论列表(如果数据量过大,可能需要翻到最后一页取最后十条)
|
||||
gitlink-cli api GET /v1/:owner/:repo/issues/:number/journals?category=comment&page=1&limit=50 --format json
|
||||
gitlink-cli issue +journals --owner <owner> --repo <repo> --number <number> --category comment --page 1 --limit 50 --format json
|
||||
```
|
||||
|
||||
**AI 判断逻辑**:
|
||||
|
|
@ -412,7 +412,7 @@ gitlink-cli issue +list --state open --owner <owner> --repo <repo> --format json
|
|||
# Step 2:判断 Issue 最后活动时间
|
||||
# a. 如果 created_at == updated_at → 最后活动时间 = created_at(无需查询评论)
|
||||
# b. 如果 created_at != updated_at → 查询评论列表获取最新评论时间
|
||||
gitlink-cli api GET /v1/:owner/:repo/issues/:number/journals --format json
|
||||
gitlink-cli issue +journals --owner <owner> --repo <repo> --number <number> --category comment --page 1 --limit 50 --format json
|
||||
# - 有评论 → 最后活动时间 = 最新评论的 created_at
|
||||
# - 无评论 → 最后活动时间 = updated_at
|
||||
# 需注意排除skill自动发送的评论内容
|
||||
|
|
|
|||
Loading…
Reference in New Issue