Interacts with GitLab resources (projects, issues, MRs, comments, wikis) via the glab CLI. Handles creation, updates, and CI pipeline monitoring with self-hosted instance support.
Ships in dcjanus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
本 skill 只负责 GitLab 资源读取与平台操作,不定义标题、正文或 inline review reply 的文案。
--cwd <repo> 指定实际执行目录。--hostname <host>。--project <id|group/project> 显式指定项目。--description-file <path> 传入。--description。--title 这类短文本参数可以直接传,长正文一律先写到文件里再引用。rm -- <明确路径> 用 && 串行执行。写操作失败时保留文件,
不要使用 ; 无条件删除,也不要用变量、通配符或目录作为清理目标。示例:
# 正确
./scripts/gitlab_cli.py mr update --cwd /path/to/repo 123 --description-file /tmp/mr-body.md
# 临时正文成功写入后立即清理
./scripts/gitlab_cli.py mr update --cwd /path/to/repo 123 \
--description-file /tmp/mr-body.md \
&& rm -- /tmp/mr-body.md
# 错误
./scripts/gitlab_cli.py mr update --cwd /path/to/repo 123 --description "multi-line body"
在创建 Issue 或 MR 前,先检查对应的 GitLab 模板、表单和当前资源状态。
.gitlab/issue_templates/、.gitlab/merge_request_templates/、.gitlab-ci.yml、项目说明文档等 GitLab 专用配置。以下规范建立在“创建前检查”已完成的前提上。
/tmp/*.md,标题通常较短,可直接用 --title 传入。--description-file,例如:./scripts/gitlab_cli.py issue create --cwd /path/to/repo --title "..." --description-file /tmp/issue-body.md,或 ./scripts/gitlab_cli.py issue update --cwd /path/to/repo 123 --title "..." --description-file /tmp/issue-body.md。以下规范建立在“创建前检查”已完成的前提上。
git status 必须干净,且当前分支已推送到远端。/tmp/*.md,不要在 shell 里拼多行字符串,也不要依赖交互式编辑。标题通常较短,可直接用 --title 传入。--description-file,例如:./scripts/gitlab_cli.py mr create \
--cwd /path/to/repo \
--title "..." \
--description-file /tmp/mr-body.md \
--target-branch main \
--squash true \
--remove-source-branch true
--dry-run 预览最终请求,参数从 --help 探索。./scripts/gitlab_cli.py mr update --cwd /path/to/repo 123 --title "..." --description-file /tmp/mr-body.md。glab issue view、glab issue list、glab mr view、glab mr diffglab ci status --live 等 pipeline 结束;需要跟随单个 job 日志时用 glab ci trace <job-id|job-name>glab issue noteglab <group> --help、glab <group> <subcommand> --helpglab wiki --help;若当前版本没有子命令,再考虑 glab apiglab ci status --live --compact
glab ci status --branch main --live --compact
glab ci status --branch main --live --compact -R group/project
glab ci trace 123456
glab ci trace test --pipeline-id 123456 --branch main
glab ci status --live 适合替代 agent 自己的轮询等待;等待结束后若需要把结果写入 MR / Issue / 回复,先再用 glab ci status --output json、glab ci get --with-job-details 或 glab ci list --output json 做一次最终状态读取,避免只根据动态终端输出下结论。glab ci view --pipelineid <id> 做交互查看;如果任务需要非交互、机器可解析的最终状态,改用 glab ci get 或 glab api 读取该 pipeline / jobs。当用户要求“确保 MR 可以合并”“准备好合入”或同等结果时,不能只检查冲突和 CI,也不能仅凭 MR API 的 merge_status=can_be_merged 下结论。该字段可能只表示内容可以无冲突地合并,项目的线性历史、fast-forward 或 source branch 必须包含最新 target branch 等策略仍可能让 GitLab UI 要求 rebase。
读取目标项目设置,至少确认 merge_method、squash_option、pipeline/discussion 合入限制和默认源分支删除策略:
glab api 'projects/:id' --jq '{merge_method, squash_option, only_allow_merge_if_pipeline_succeeds, only_allow_merge_if_all_discussions_are_resolved, remove_source_branch_after_merge}'
merge_method 常见值包括 merge、rebase_merge 和 ff。不要根据名称推测平台一定会自动处理落后提交;应继续核对实际分支关系和 MR 状态。
git fetch 最新 source/target 后检查双方独有提交,并确认 target tip 是否已经包含在 source 历史中:
git rev-list --left-right --count origin/<target>...origin/<source>
git merge-base --is-ancestor origin/<target> origin/<source>
当第二条命令返回非 0,source 仍落后或与 target 分叉。如果项目要求 fast-forward、线性历史或源分支必须最新,则 MR 尚未达到可合并状态,即使没有内容冲突。
回读 MR、审批、讨论和最新 MR pipeline;需要 GitLab 重新计算合并状态时传入 with_merge_status_recheck=true:
glab api 'projects/:id/merge_requests/<iid>?include_diverged_commits_count=true&with_merge_status_recheck=true'
glab api 'projects/:id/merge_requests/<iid>/approvals'
glab api 'projects/:id/merge_requests/<iid>/discussions?per_page=100'
glab api 'projects/:id/merge_requests/<iid>/pipelines?per_page=1'
只有同时满足以下条件时才能报告“可以合并”:MR 为 opened 且非 draft、无冲突、目标分支同步要求已满足、必需 pipeline/check 成功、审批数量满足、阻塞讨论已解决,并且当前用户或预期合并者具备合并权限。
如果 source 落后,先按 repository-workflow 和项目策略选择同步方式。共享或长期分支不要因为 UI 显示 “Rebase” 就直接改写历史;优先判断是否允许把 target merge 到 source。确实必须 rebase 时,先核对远端分支共享情况和改写范围,再按授权边界执行。
同步 source 会产生新 commit/pipeline;必须等待新 pipeline 到终态并再次执行上述机器可读回读,不能沿用同步前的 CI 或 merge status。
.gitlab-ci.yml,支持 --dry-run、--include-jobs、--ref、--json。
--dry-run --ref refs/merge-requests/<iid>/head 会改用 MR source branch 调用 CI Lint。调用方知道源分支时可显式传 --source-branch <branch>;否则脚本会根据 ref 里的 MR IID 查询 MR 元数据。部分 GitLab 14.x 实例会因为 MR internal ref 缺少 source_branch 在 CI Lint dry-run 返回 500,所以脚本避免直接把 MR internal ref 发给 CI Lint。--cwd、--hostname、--project 使用。除此之外,优先直接用 glab。
脚本入口:运行 gitlab_cli.py
./scripts/gitlab_cli.py ci lint --cwd /path/to/repo
./scripts/gitlab_cli.py ci lint --cwd /path/to/repo --project group/project --ref main --dry-run --include-jobs
./scripts/gitlab_cli.py ci lint --cwd /path/to/repo --project 122477 --ref refs/merge-requests/9/head --dry-run
./scripts/gitlab_cli.py ci lint --cwd /path/to/repo --project 122477 --ref refs/merge-requests/9/head --source-branch chore/sync-knots-api-master --dry-run
./scripts/gitlab_cli.py mr create \
--cwd /path/to/repo \
--title "..." \
--target-branch main \
--description-file /tmp/mr-body.md \
--squash true \
--remove-source-branch true
./scripts/gitlab_cli.py mr update \
--cwd /path/to/repo \
123 \
--description-file /tmp/mr-body.md
./scripts/gitlab_cli.py issue create \
--cwd /path/to/repo \
--title "..." \
--description-file /tmp/issue-body.md
./scripts/gitlab_cli.py issue update \
--cwd /path/to/repo \
456 \
--title "..." \
--description-file /tmp/issue-body.md
--description-file 传入;脚本不再支持 --description,避免 shell 转义和多行文本处理问题。--squash true 与 --remove-source-branch true。What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/dcjanus-dcjanus-plugins-dcjanus:gitlab-clifrom dcjanus
Generated from the plugin's indexed repository (dcjanus/prompts) — no native marketplace selected
npx claudepluginhub p/dcjanus-dcjanus-plugins-dcjanus27 skills in this plugin
/codex-thread-close-check检查当前 Codex thread(会话)是否还有遗留事项,适用于用户准备关闭、归档当前对话,或询问当前 thread 是否可以收尾时。/codex-thread-namer为当前 Codex thread 设置名称;仅当用户手动调用或明确要求命名、重命名、整理当前 Codex 会话标题时使用,永远不要自动调用。/confluence-cli查询、检索与阅读 Confluence 文档/页面。/dcjanus-merge-policy将 GitHub 或 GitLab 仓库配置为 DCjanus 偏好的合并策略,包括 squash、组织仓库的 merge queue、提交消息模板和源分支删除设置。适用于明确要求采用 DCjanus 个人合并策略的场景,不用于一般 PR/MR 合并操作。/dcjanus-preferences适用于创建、修改或评审 Skill,配置或复刻 GitHub 个人仓库与长期自用 fork 的维护、CI、发布、合并策略和 Dependabot 更新,设计或评审 CLI 的命名、输入手感、输出与补全,设计或评审前端界面的布局、信息层级和文案,或在前端技术栈与无障碍组件、Connect/Protobuf API、well-known types、FieldMask/PATCH、AIP-127 HTTP 映射与 Protovalidate 校验、项目开发工具(含 mbx/Cargo)及版本管理、用户级程序的 XDG 数据目录、跨语言的数据存储、分析、压缩、归档、哈希、Telegram Bot 消息呈现及 Python/Rust/Go 第三方库之间做技术选择的场景。/dcjanus-tasklog查询或管理 DCjanus 的 Linear 事项、提醒、长期文档、模板(含周期事项)、视图或团队配置,以及按个人任务模型整理目标、进展和关联时使用。Other plugins' skills for the same job