skills/gitlab-cli/SKILL.md
使用 GitLab CLI(glab)与 GitLab 资源交互;适用于 project、issue、MR、comment、wiki 等查看、更新或创建场景,含自建实例。
npx skillsauth add dcjanus/prompts gitlab-cliInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
说明:以下脚本调用均以当前 SKILL.md 所在文件夹为 workdir。
脚本调用方式(必须直接当作可执行命令运行,不要用 uv run python 或 python):
cd skills/gitlab-cli && ./scripts/gitlab_cli.py --help
错误示例:
uv run python skills/gitlab-cli/scripts/gitlab_cli.py --help
python skills/gitlab-cli/scripts/gitlab_cli.py --help
--cwd <repo> 指定实际执行目录。--hostname <host>。--project <id|group/project> 显式指定项目。--description-file <path> 传入。--description。--title 这类短文本参数可以直接传,长正文一律先写到文件里再引用。示例:
# 正确
./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 "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 "feat(scope): short summary" \
--description-file /tmp/mr-body.md \
--target-branch main \
--squash true \
--remove-source-branch true
./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。.gitlab-ci.yml,支持 --dry-run、--include-jobs、--ref、--json。--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 mr create \
--cwd /path/to/repo \
--title "feat(scope): short summary" \
--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 "short summary" \
--description-file /tmp/issue-body.md
./scripts/gitlab_cli.py issue update \
--cwd /path/to/repo \
456 \
--title "updated title" \
--description-file /tmp/issue-body.md
--description-file 传入;脚本不再支持 --description,避免 shell 转义和多行文本处理问题。--squash true 与 --remove-source-branch true。development
为当前 Codex thread 设置名称;仅当用户手动调用或明确要求命名、重命名、整理当前 Codex 会话标题时使用,永远不要自动调用。
testing
编写或更新 GitHub/GitLab Issue、PR、MR 的标题与正文;适用于创建、修改、重写 reviewer-facing 描述、Validation、Risks、Breaking Change、避免本地路径泄露等场景。
tools
使用 GitHub CLI 与 GitHub 资源交互;适用于 repo、issue、PR、comment、release、workflow 等查看、更新或创建场景。
development
记录 DCjanus 在不同语言中偏好的第三方库与使用场景,供 AI 在选型、引入依赖或替换库时优先参考。适用于 Python/Rust/Go 的库选择、技术方案对比、或需要遵循 DCjanus 个人偏好进行开发的场景。