Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

gitlab-discussionGitLab discussion 搜索

Agent Skill

用于围绕 GitLab 项目、Merge Request、Issue、分支、流水线和代码审查流程提供辅助能力。它适合让 Agent 查询项目状态、整理提交差异、辅助检查合并请求或汇总 CI 结果。使用时需要确认项目权限、访问 token 和目标分支范围;涉及合并、推送、改工单或触发流水线时,应先预览影响并核对团队流程。

总安装

2,101

周安装

85

GitHub Stars

1

下载量

660
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gitlab-discussion(GitLab discussion 搜索)
来源仓库:https://github.com/grandcamel/gitlab-assistant-skills
仓库路径:skills/gitlab-discussion
安装命令:
npx skills add https://github.com/grandcamel/gitlab-assistant-skills --skill gitlab-discussion
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/grandcamel/gitlab-assistant-skills --skill gitlab-discussion

简介

用于围绕 GitLab 项目、Merge Request、Issue 等流程提供辅助能力。

  • 适合查询项目状态、整理提交差异、辅助检查合并请求或汇总 CI 结果。
  • 使用时需确认项目权限和访问 token,涉及合并或改工单应预览影响。
  • 安装方式:通过 npx 从指定 GitHub 仓库添加技能。
  • 建议在使用前核对团队流程和目标分支范围。

SKILL.md

Discussion Skill

Threaded discussion management for GitLab using glab api raw endpoint calls.

Quick Reference

OperationCommand PatternRisk
List MR discussionsglab api projects/:id/merge_requests/:iid/discussions-
List issue discussionsglab api projects/:id/issues/:iid/discussions-
Get discussionglab api projects/:id/merge_requests/:iid/discussions/:id-
Create discussionglab api projects/:id/merge_requests/:iid/discussions -X POST -f...⚠️
Reply to discussionglab api projects/:id/.../discussions/:id/notes -X POST -f...⚠️
Resolve discussionglab api projects/:id/.../discussions/:id -X PUT -f resolved=true⚠️
Delete noteglab api projects/:id/.../discussions/:id/notes/:nid -X DELETE⚠️⚠️

Risk Legend: - Safe | ⚠️ Caution | ⚠️⚠️ Warning | ⚠️⚠️⚠️ Danger

When to Use This Skill

ALWAYS use when:

  • User mentions "discussion", "thread", "conversation"
  • User wants to add code review comments
  • User mentions "resolve", "unresolve" discussions
  • User wants to reply to existing comments/threads
  • User wants line-specific comments on MRs

NEVER use when:

  • User wants simple notes/comments (use glab mr note or glab issue note)
  • User wants to review MR changes (use gitlab-mr)
  • User wants to search comments (use gitlab-search with notes scope)

API Prerequisites

Required Token Scopes: api

Permissions:

  • Read discussions: Reporter+ (for private repos)
  • Create discussions: Reporter+
  • Resolve discussions: Developer+ (or MR author)

Available Commands

List MR Discussions

# List all discussions on MR
glab api projects/123/merge_requests/1/discussions --method GET

# With pagination
glab api projects/123/merge_requests/1/discussions --paginate

# Using project path
glab api "projects/$(echo 'mygroup/myproject' | jq -Rr @uri)/merge_requests/1/discussions"

List Issue Discussions

# List all discussions on issue
glab api projects/123/issues/42/discussions --method GET

# With pagination
glab api projects/123/issues/42/discussions --paginate

Get Specific Discussion

# Get MR discussion by ID
glab api projects/123/merge_requests/1/discussions/abc123 --method GET

# Get issue discussion by ID
glab api projects/123/issues/42/discussions/def456 --method GET

Create Discussion on MR

# Create general discussion
glab api projects/123/merge_requests/1/discussions --method POST \
  -f body="This looks good overall, but I have some suggestions."

# Create discussion on specific line (diff note)
glab api projects/123/merge_requests/1/discussions --method POST \
  -f body="This could be simplified using a helper function." \
  -f position[base_sha]="abc123" \
  -f position[head_sha]="def456" \
  -f position[start_sha]="abc123" \
  -f position[position_type]="text" \
  -f position[new_path]="src/app.py" \
  -f position[new_line]=42

# Create discussion on old line (removed code)
glab api projects/123/merge_requests/1/discussions --method POST \
  -f body="Why was this removed?" \
  -f position[base_sha]="abc123" \
  -f position[head_sha]="def456" \
  -f position[start_sha]="abc123" \
  -f position[position_type]="text" \
  -f position[old_path]="src/old.py" \
  -f position[old_line]=15

# Create suggestion
glab api projects/123/merge_requests/1/discussions --method POST \
  -f body='```suggestion
def improved_function():
    return "better implementation"

### Create Discussion on Issue

Create discussion

glab api projects/123/issues/42/discussions --method POST \ -f body="I think we should reconsider this approach."


### Reply to Discussion

Reply to MR discussion

glab api projects/123/merge_requests/1/discussions/abc123/notes --method POST \ -f body="Good point, I'll fix this."

Reply to issue discussion

glab api projects/123/issues/42/discussions/def456/notes --method POST \ -f body="I agree with the above."


### Resolve/Unresolve Discussion

Resolve MR discussion

glab api projects/123/merge_requests/1/discussions/abc123 --method PUT \ -f resolved=true

Unresolve MR discussion

glab api projects/123/merge_requests/1/discussions/abc123 --method PUT \ -f resolved=false


### Update Note

Update note in discussion

glab api projects/123/merge_requests/1/discussions/abc123/notes/789 --method PUT \ -f body="Updated comment text"


### Delete Note

Delete note from discussion

glab api projects/123/merge_requests/1/discussions/abc123/notes/789 --method DELETE


## Position Object for Diff Notes

For line-specific comments on MRs, you need to provide position information:

| Field | Required | Description |
| --- | --- | --- |
| `base_sha` | Yes | SHA of the base commit (target branch) |
| `head_sha` | Yes | SHA of the head commit (source branch) |
| `start_sha` | Yes | SHA of the start commit |
| `position_type` | Yes | `text` for code, `image` for images |
| `new_path` | For new/modified | Path in new version |
| `new_line` | For new/modified | Line number in new version |
| `old_path` | For deleted | Path in old version |
| `old_line` | For deleted | Line number in old version |

### Get SHAs for Position

Get MR details to find SHAs

mr_info=$(glab api projects/123/merge_requests/1) base_sha=$(echo "$mr_info" | jq -r '.diff_refs.base_sha') head_sha=$(echo "$mr_info" | jq -r '.diff_refs.head_sha') start_sha=$(echo "$mr_info" | jq -r '.diff_refs.start_sha')

echo "Base: $base_sha" echo "Head: $head_sha" echo "Start: $start_sha"


## Common Workflows

### Workflow 1: Review MR with Comments

project_id=123 mr_iid=1

Get diff refs

mr_info=$(glab api projects/$project_id/merge_requests/$mr_iid) base_sha=$(echo "$mr_info" | jq -r '.diff_refs.base_sha') head_sha=$(echo "$mr_info" | jq -r '.diff_refs.head_sha') start_sha=$(echo "$mr_info" | jq -r '.diff_refs.start_sha')

Add comment on line 42 of new file

glab api projects/$project_id/merge_requests/$mr_iid/discussions --method POST \ -f body="Consider adding error handling here." \ -f position[base_sha]="$base_sha" \ -f position[head_sha]="$head_sha" \ -f position[start_sha]="$start_sha" \ -f position[position_type]="text" \ -f position[new_path]="src/handler.py" \ -f position[new_line]=42


### Workflow 2: Resolve All Discussions

Get all unresolved discussions

glab api projects/123/merge_requests/1/discussions --paginate | \ jq -r '.[] | select(.notes[0].resolvable == true and .notes[0].resolved == false) | .id' | \ while read discussion_id; do echo "Resolving: $discussion_id" glab api projects/123/merge_requests/1/discussions/$discussion_id --method PUT \ -f resolved=true done


### Workflow 3: List Unresolved Discussions

Show unresolved discussions with content

glab api projects/123/merge_requests/1/discussions --paginate | \ jq -r '.[] | select(.notes[0].resolvable == true and .notes[0].resolved == false) | "[\(.id)] \(.notes[0].author.username): \(.notes[0].body | split("\n")[0])"'


### Workflow 4: Add Suggestion

project_id=123 mr_iid=1

mr_info=$(glab api projects/$project_id/merge_requests/$mr_iid) base_sha=$(echo "$mr_info" | jq -r '.diff_refs.base_sha') head_sha=$(echo "$mr_info" | jq -r '.diff_refs.head_sha') start_sha=$(echo "$mr_info" | jq -r '.diff_refs.start_sha')

Create suggestion (multi-line needs proper escaping)

glab api projects/$project_id/merge_requests/$mr_iid/discussions --method POST \ -f body='```suggestion const result = await fetchData(); return result.data;

  -f position[base_sha]="$base_sha" \
  -f position[head_sha]="$head_sha" \
  -f position[start_sha]="$start_sha" \
  -f position[position_type]="text" \
  -f position[new_path]="src/api.js" \
  -f position[new_line]=25

Workflow 5: Summarize Discussion Activity

# Count discussions by state
glab api projects/123/merge_requests/1/discussions --paginate | \
  jq '{
    total: length,
    resolved: [.[] | select(.notes[0].resolved == true)] | length,
    unresolved: [.[] | select(.notes[0].resolvable == true and .notes[0].resolved == false)] | length
  }'

Troubleshooting

IssueCauseSolution
400 Bad RequestMissing position fieldsInclude all required position fields
404 Discussion not foundInvalid discussion IDCheck discussion exists
Cannot resolveNot resolvable or not authorizedCheck note type and permissions
Position invalidWrong SHAs or line numbersGet fresh diff_refs from MR
Note emptyBody not setCheck -f body=... parameter

Discussion vs Note

  • Discussion: A thread that can have multiple notes/replies
  • Note: A single comment within a discussion
  • Resolvable: Discussions on MR diffs can be resolved/unresolved
  • System notes: Auto-generated (commits, status changes) - not editable

Related Documentation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.86%
按下载量换算237

Claude

31.54%
按下载量换算208

Cursor

18.59%
按下载量换算123

Gemini CLI

9.74%
按下载量换算64

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills