vince-winkintel/gitlab-cli-skills

gitlab-cli-skills

Comprehensive GitLab CLI (glab) command reference and workflows for all GitLab operations via terminal.

查看源码

使用方法

  1. 复制安装命令,在自己的智能体环境安装前先检查源码包。
  2. 从原始文档核对所需工具、凭据和支持的宿主。
  3. 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/vince-winkintel/gitlab-cli-skills --skill gitlab-cli-skills

开始前需了解

  • 安装不包含模型订阅、API 额度或访问文件的权限。
  • 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

GitLab CLI Skills

Comprehensive GitLab CLI (glab) command reference and workflows.

Quick start

bash
# First time setup
glab auth login

# Common operations
glab mr create --fill              # Create MR from current branch
glab issue create                  # Create issue
glab ci view                       # View pipeline status
glab repo view --web              # Open repo in browser

Multi-agent identity note

When you want different agents to appear as different GitLab users, give each agent its own GitLab bot/service account. Multiple personal access tokens on the same GitLab user still act as that same visible identity.

Use the Actor identity for actor-authored GitLab comments, replies, approvals, and other writes. Use an agent identity only when the GitLab action is explicitly that agent's own work product. Choose the intended visible actor before the first GitLab write.

Treat shell identity as sticky and unsafe by default. If another env file was sourced earlier in the same shell/session, glab may still write as that previously loaded identity unless you deliberately switch and verify first.

A practical pattern is one env file per actor, for example ~/.config/openclaw/env/gitlab-actor.env, ~/.config/openclaw/env/gitlab-reviewer.env, and ~/.config/openclaw/env/gitlab-release.env. Keep these env files outside version control, restrict their permissions (for example chmod 600), be mindful of backup exposure, and use least-privilege bot/service-account tokens. In a reused shell, clear stale GitLab auth vars first or start a fresh shell. If those files use plain KEY=value lines, load them with exported vars before running glab:

bash
unset GITLAB_TOKEN GITLAB_ACCESS_TOKEN OAUTH_TOKEN GITLAB_HOST
set -a
source ~/.config/openclaw/env/gitlab-<actor>.env
set +a

Plain source updates the current shell but may not export variables to child processes such as glab. If the token/host vars are not exported, glab may silently fall back to shared stored auth from the active global glab config file, which can make the wrong account appear to perform the action.

Required pre-flight before any GitLab write

Run this immediately before any GitLab write, including glab mr note, review replies/approvals, and any glab api POST/PATCH/PUT/DELETE call:

bash
glab auth status --hostname "$GITLAB_HOST"
glab api --hostname "$GITLAB_HOST" user

This assumes the target actor env file set GITLAB_HOST for the exact GitLab instance you intend to modify. Do not write until both commands clearly show the intended visible actor on that host.

Wrong-identity remediation

If a comment or reply was posted under the wrong identity:

  1. Stop posting.
  2. Delete the mistaken comment or reply if cleanup is needed.
  3. unset GITLAB_TOKEN GITLAB_ACCESS_TOKEN OAUTH_TOKEN GITLAB_HOST or start a fresh shell.
  4. Source the correct env file with set -a; source ...; set +a.
  5. Rerun glab auth status --hostname "$GITLAB_HOST" and glab api --hostname "$GITLAB_HOST" user.
  6. Repost under the correct actor.
  7. Verify the thread no longer shows the wrong visible author for the replacement message.

If the wrong-identity write changed state beyond a comment or reply, do not treat the comment cleanup steps as sufficient. Re-auth as above, then use the matching GitLab reversal for that write under the correct actor and host, such as unapproving an MR or sending the compensating glab api --hostname "$GITLAB_HOST" mutation for the exact resource that was changed.

Skill organization

This skill routes to specialized sub-skills by GitLab domain. Each is a standalone skill in a sibling directory; open its SKILL.md for full details.

Core Workflows:

  • `glab-mr` - Merge requests: create, review, approve, merge
  • `glab-issue` - Issues: create, list, update, close, comment
  • `glab-ci` - CI/CD: pipelines, jobs, logs, artifacts
  • `glab-repo` - Repositories: clone, create, fork, manage

Project Management:

Authentication & Config:

CI/CD Management:

Collaboration:

Advanced:

  • `glab-api` - Direct REST API calls
  • `glab-artifact-registry` - Experimental short-lived Artifact Registry token exchange and access checks
  • `glab-cluster` - Kubernetes cluster integration
  • `glab-container-registry` - Container registry repositories and tags
  • `glab-dependency-firewall` - Experimental Dependency Firewall package checks, package-manager wrappers, and local activity summaries
  • `glab-deploy-key` - Deploy keys for automation
  • `glab-govern` - Experimental AI agent governance hooks, diagnosis, and transcript-audit sync
  • `glab-orbit` - Managed Orbit CLI workflows for remote graph status/query/discovery and local code-graph indexing/search; use glab-skills to install the remote Orbit wrapper skill (EXPERIMENTAL)
  • `glab-quick-actions` - GitLab slash command quick actions for batching state changes
  • `glab-security` - Project security scan profile enable/disable/status management (EXPERIMENTAL)
  • `glab-stack` - Create, reorder, sync, and delete local stacked/dependent merge-request metadata
  • `glab-opentofu` - Terraform/OpenTofu state management

Utilities:

When to use glab vs web UI

Use glab when:

  • Automating GitLab operations in scripts
  • Working in terminal-centric workflows
  • Batch operations (multiple MRs/issues)
  • Integration with other CLI tools
  • CI/CD pipeline workflows
  • Faster navigation without browser context switching

Use web UI when:

  • Complex diff review with inline comments
  • Visual merge conflict resolution
  • Configuring repo settings and permissions
  • Advanced search/filtering across projects
  • Reviewing security scanning results
  • Managing group/instance-level settings

Common workflows

Daily development

bash
# Start work on issue
glab issue view 123
git checkout -b 123-feature-name

# Create MR when ready
glab mr create --fill --draft

# Mark ready for review
glab mr update --ready

# Merge after approval
glab mr merge --when-pipeline-succeeds --remove-source-branch

Code review

bash
# List your review queue
glab mr list --reviewer=@me --state=opened

# Review an MR
glab mr checkout 456
glab mr diff
npm test

# Approve
glab mr approve 456
glab mr note 456 -m "LGTM! Nice work on the error handling."

CI/CD debugging

bash
# Check pipeline status
glab ci status

# View failed jobs
glab ci view

# Get job logs
glab ci trace <job-id>

# Retry failed job
glab ci retry <job-id>

Decision Trees

"Should I create an MR or work on an issue first?"

Need to track work?
├─ Yes → Create issue first (glab issue create)
│         Then: glab mr for <issue-id>
└─ No → Direct MR (glab mr create --fill)

Use `glab issue create` + `glab mr for` when:

  • Work needs discussion/approval before coding
  • Tracking feature requests or bugs
  • Sprint planning and assignment
  • Want issue to auto-close when MR merges

Use `glab mr create` directly when:

  • Quick fixes or typos
  • Working from existing issue
  • Hotfixes or urgent changes

"Which CI command should I use?"

What do you need?
├─ Overall pipeline status → glab ci status
├─ Visual pipeline view → glab ci view
├─ Specific job logs → glab ci trace <job-id>
├─ Download build artifacts → glab ci artifact <ref> <job-name>
├─ Validate config file → glab ci lint
├─ Trigger new run → glab ci run
└─ List all pipelines → glab ci list

Quick reference:

  • Pipeline-level: glab ci status, glab ci view, glab ci run
  • Job-level: glab ci trace, glab job retry, glab job view
  • Artifacts: glab ci artifact (by pipeline) or job artifacts via glab job

"Clone or fork?"

What's your relationship to the repo?
├─ You have write access → glab repo clone group/project
├─ Contributing to someone else's project:
│   ├─ One-time contribution → glab repo fork + work + MR
│   └─ Ongoing contributions → glab repo fork, then sync regularly
└─ Just reading/exploring → glab repo clone (or view --web)

Fork when:

  • You don't have write access to the original repo
  • Contributing to open source projects
  • Experimenting without affecting the original
  • Need your own copy for long-term work

Clone when:

  • You're a project member with write access
  • Working on organization/team repositories
  • No need for a personal copy

"Project vs group labels?"

Where should the label live?
├─ Used across multiple projects → glab label create --group <group>
└─ Specific to one project → glab label create (in project directory)

Group-level labels:

  • Consistent labeling across organization
  • Examples: priority::high, type::bug, status::blocked
  • Managed centrally, inherited by projects

Project-level labels:

  • Project-specific workflows
  • Examples: needs-ux-review, deploy-to-staging
  • Managed by project maintainers

Related Skills

MR and Issue workflows:

  • Start with glab-issue to create/track work
  • Use glab-mr to create MR that closes issue
  • Script: scripts/create-mr-from-issue.sh automates this

CI/CD debugging:

  • Use glab-ci for pipeline-level operations
  • Use glab-job for individual job operations
  • Script: scripts/ci-debug.sh for quick failure diagnosis

Repository operations:

  • Use glab-repo for repository management
  • Use glab-auth for authentication setup
  • Script: scripts/sync-fork.sh for fork synchronization

Configuration:

  • Use glab-auth for initial authentication
  • Use glab-config to set defaults and preferences
  • Use glab-alias for custom shortcuts

按任务相关推荐

来自同一仓库

更多 Skills

全部 Skills
vince-winkintel
社区

glab-api

Make direct GitLab REST API calls for advanced queries and operations not covered by other glab commands. Use when accessing GitLab API endpoints directly, making custom API requests, or fetching data in JSON format. Triggers on API call, REST API, GitLab API, JSON query, advanced query.

安装量
1
GitHub Stars
49
最近更新
10月13日
vince-winkintel
社区

glab-auth

Manage GitLab CLI authentication including login/logout, check auth status, switch accounts, and configure Docker registry access. Use when setting up glab for first time, troubleshooting auth issues, switching GitLab instances/accounts, or configuring Docker to pull from GitLab registry. Triggers on auth, login, logout, authentication, credentials, token, Docker registry.

安装量
1
GitHub Stars
49
最近更新
10月13日
vince-winkintel
社区

glab-repo

Work with GitLab repositories and projects including clone, create, fork, archive, view, update, delete, search, transfer, and member management. Use when managing repo lifecycle, forking projects, cloning repositories, searching for projects, managing collaborators, or configuring repo settings. Triggers on repository, repo, project, clone, fork, create repo, search projects, collaborators.

安装量
1
GitHub Stars
49
最近更新
10月13日
vince-winkintel
社区

glab-skills

Inspect bundled agent skills and install, list, or update bundled and curated remote skills for GitLab CLI. Use when printing a bundled skill file, installing agent skills, checking the skill catalog, updating installed skills, or installing the remote Orbit wrapper skill. Triggers on skills, agent skills, glab skills, skill get, skill install, skill update, skill bundles.

安装量
1
GitHub Stars
49
最近更新
10月13日