GitLab MR inline comment 开发

SKILL开发

原名 gitlab-mr-inline-comment

开发 联网访问 许可证不明确 CodexClaudeCursorGemini CLI
安装这个技能

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

累计安装 245 本周 10
GitHub 星标 16 仓库 skills
下载量 78 技能市场下载数
权限级别 联网访问 安装前请确认风险范围
许可证 许可证不明确 unknown

安装

GitHub 仓库
在支持 Skills 的客户端里执行,装完问一句「你有哪些技能」验证
npx skills add https://github.com/flc1125/skills --skill gitlab-mr-inline-comment

技能档案

开发
字段来自技能仓库与公开索引,中文说明由本站标注
作者 / 维护方flc1125仓库 skills · 版本 未标注
宿主客户端Codex、Claude、Cursor、Gemini CLI技能可被这些客户端加载
安装方式GitHub 仓库安装包 flc1125/skills
权限级别联网访问安装前请确认风险范围
许可证unknown许可证不明确,商用前请自行确认条款
仓库可用性available技能仓库当前是否可访问
最近核验2026-05-01上游最后核验时间 · 数据更新 未标注
正文体量6.5 KBSKILL.md 原文大小,越大说明说明书写得越细

能做什么

4 项能力
上游给出的能力概览与适用场景
  • 按任务关键词查找相关 Skills
  • 展示可复制的安装命令
  • 保留来源站点、仓库和原始说明,方便继续核验
  • 展示第三方安全扫描或审计结果
用户想查找某类 Agent Skill 时需要根据任务场景推荐可安装能力包时需要对比不同来源的安装命令和来源信息时

权限与风险

联网访问
装之前先读完这段

安装与使用指南

安装步骤

本站只展示命令,不托管安装包,也不自动执行。

怎么用

安装后应在对应宿主中按原始 README 的触发条件使用;当前草稿只做目录说明,具体调用方式由规则抽取,异常条目再复核。

SKILL.md 全文

6.5 KB
模型实际读到的说明书原文,来自技能仓库

GitLab MR Inline Comment

Publish one anchored inline comment on a GitLab merge request.

Operating Mode

Act as a narrow GitLab review helper.

Prioritize:

  • correct GitLab host and repository context before any write
  • valid MR diff SHAs before payload assembly
  • valid file path and line anchors before posting
  • explicit failure over silent downgrade to a general comment
  • reuse of the user's existing glab authentication and repository context

Assume glab is installed unless local evidence shows otherwise.

Do not require extra tokens, .env files, or custom auth setup when the user's existing glab session already has access.

Read these references only when needed:

Required Inputs

Collect or derive these values before posting:

  • mr_iid
  • body
  • old_path
  • new_path
  • one valid line anchor shape:
  • added line: new_line
  • removed line: old_line
  • unchanged line: both old_line and new_line

Resolve one repository context:

  • current repository glab context, or
  • explicit GitLab project path such as group/subgroup/repo, or
  • a GitLab merge request URL that can be parsed into host, project, and MR IID

Resolve these MR diff fields from the current merge request version:

  • base_sha
  • start_sha
  • head_sha

Workflow

Follow this sequence unless the user asks for one narrower part.

1. Confirm GitLab context with the lightest viable command

Prefer the user's current repository context first.

Use bare glab commands when the current directory is already the target GitLab repository.

Only inspect git remote -v, add GITLAB_HOST, or use explicit repository arguments when:

  • glab resolves to the wrong host
  • the task targets another repository
  • authentication fails against an unexpected instance
  • the user provides a merge request URL on another GitLab host

Do not introduce extra authentication if glab auth status already shows valid access for the target host.

2. Identify the target merge request

Normalize the task to one merge request.

If the user gives a merge request URL, parse it into:

  • host
  • project path
  • MR IID

If the user gives a project path and MR IID, use them directly.

If the current repository is already the target project, prefer repository-context commands over manual URL construction.

3. Read the current MR version SHAs

Before building the discussion payload, fetch the merge request state needed for inline anchors.

Use references/current-diff-resolution.md when exact field names or version-selection rules matter.

Resolve:

  • base_sha
  • start_sha
  • head_sha

Do not guess or reuse stale SHAs from old output.

If the current MR version cannot be read reliably, stop and report that inline comment posting is blocked by missing diff context.

4. Validate the anchor

Confirm that:

  • old_path and new_path match the current MR diff position
  • the line anchor matches one valid text diff case:
  • added line: new_line only
  • removed line: old_line only
  • unchanged line: both old_line and new_line

Use references/current-diff-resolution.md when deciding whether the target line is safely anchorable.

Do not guess the path or line.

Do not silently switch to a general merge request comment when the anchor is invalid.

5. Build the payload and post the discussion

Use the minimal payload shape from references/api-shape.md.

Post to the merge request discussions endpoint with glab api.

Use the user's existing glab authentication and host context whenever possible.

6. Return a concise result

On success, report:

  • target project and MR IID
  • anchored paths and line position
  • short confirmation that the inline comment was posted

On failure, report the concrete blocking reason, such as:

  • host or auth mismatch
  • missing MR version SHAs
  • path not in diff
  • line not commentable
  • GitLab API validation error

Output Structure

When the task is to post the comment directly, summarize the execution result like this:

# Inline Comment Result

## Target
- project: <group/subgroup/repo>
- mr: !<iid>
- old_path: <old_path>
- new_path: <new_path>
- old_line: <old_line or omitted>
- new_line: <new_line or omitted>

## Result
- status: <posted | failed>
- detail: <short reason or confirmation>

Decision Rules

  • Prefer repository-context glab commands over manual encoded project IDs when the current directory already matches the target project.
  • Use explicit GITLAB_HOST only when the target host differs from the current repository context or glab resolves incorrectly.
  • Treat inline comment posting as blocked when the current MR diff SHAs are unavailable or ambiguous.
  • Treat invalid anchors as hard failures.
  • Keep v1 limited to one text diff inline comment with one valid position shape.

Red Flags

Stop and reassess if:

  • multiple GitLab hosts are present and the write target is unclear
  • the authenticated host and intended host disagree
  • the merge request URL, project, or IID do not resolve to one clear target
  • base_sha, start_sha, and head_sha cannot be read from the current MR state
  • old_path or new_path cannot be reconciled with the current diff position
  • the provided old_line / new_line combination does not form a valid text diff anchor
  • the only fallback would be posting a non-inline general comment

Out Of Scope For V1

Do not add these behaviors in v1:

  • multi-line or range comments
  • batch comment publishing
  • draft review or pending review workflows
  • automatic comment placement based on code analysis
  • automatic downgrade to a general merge request note

安全信息

审计结论
未标注不代表已通过审计
安全审计Gen Agent Trust Hub、Socket、Snyk第三方安全审计平台给出的结论

热门专题

按场景挑技能
全部专题 →

技能内容以作者仓库为准;分类、权限级别与许可证状态的中文说明为中文整理,最近核验 2026-05-01。