Skip to content

PMelch/gitlab-agent-skill

Repository files navigation

GitLab Agent Skill

A agent skill for full GitLab project interaction. A single bundled CLI that any AI agent can invoke via bash — no build step, no npm install.

Features

Domain Read Write
Merge Requests get, commits, diffs, discussions, approvals, pipelines, full create, comment, approve, unapprove, merge, update
Issues list, get, comments create, update
Pipelines & Jobs get pipeline, jobs, job log retry job, retry pipeline, create pipeline
Repository tree, file, compare, branches, tags
Search issues, merge_requests, blobs, commits, notes
Releases list, get
Project info, members

Killer feature: job log <id> fetches CI/CD job output for debugging failures directly in your agent workflow.

Prerequisites

  • Node.js 18+
  • GitLab personal access token (api for read+write, read_api for read-only)
  • GitLab project ID

Installation

The skill ships as a pre-built bundle — no npm install or build step needed.

Global (available to all projects)

git clone <repo-url> ~/<agent_config_home>/skills/gitlab

Per-project

git clone <repo-url> <project_root>/<agent_config_home>/skills/gitlab

Using ai-skills

You can use ai-skills to manage and share skills across different AI agents. It provides a unified way to install, update, and discover skills regardless of which agent you use.

Configuration

Add a .env file to your project root (not the skill directory):

# GitLab instance URL (e.g., https://gitlab.com or your self-hosted instance)
GITLAB_INSTANCE_URL=https://gitlab.com

# GitLab personal access token
# Scopes: "api" for full access (read + write), "read_api" for read-only
GITLAB_API_TOKEN=your-api-token-here

# GitLab project ID (found in project settings or on the project page)
GITLAB_PROJECT_ID=12345678

The .env is loaded from the current working directory. Add it to your project's .gitignore.

You can also pass credentials via command-line flags:

node bin/gitlab.cjs --instance-url https://gitlab.com --token TOKEN --project-id 123 project info

Verify Installation

From your project root (with .env configured):

node <path-to-skill>/bin/gitlab.cjs project info

You should see JSON output with your project details.

Usage

Once installed, your AI agent can discover the skill automatically via SKILL.md. Refer to your agent's documentation on how to register and invoke skills.

Quick Examples

# Get full MR overview
node bin/gitlab.cjs mr full 42

# Debug a CI failure
node bin/gitlab.cjs mr pipelines 42
node bin/gitlab.cjs pipeline jobs 12345
node bin/gitlab.cjs job log 67890

# Search for code patterns
node bin/gitlab.cjs search blobs "TODO"

# Create an issue
node bin/gitlab.cjs issues create --title "Bug report" --description "Details" --labels bug

# Browse repository
node bin/gitlab.cjs repo tree --recursive
node bin/gitlab.cjs repo file src/index.ts --ref main

See SKILL.md for the complete command reference and strategy guide.

Required GitLab Token Scopes

Operations Minimum Scope
All read operations read_api
Create/update MRs, issues, comments api
Approve/merge MRs api
Retry jobs/pipelines api

Your GitLab account needs at least Reporter access to the project.

Development

npm install         # Install dependencies
npm run build       # Compile TypeScript (dev)
npm test            # Run test suite
npm run bundle      # Create single-file bundle in bin/
npm run release     # Bundle + copy release artifacts to release/

Release Contents

The release/ directory (or the repo itself for end users) contains only what's needed:

gitlab/
├── SKILL.md          # Skill definition (agents discover this)
├── bin/
│   └── gitlab.cjs    # Self-contained CLI (no dependencies needed)
├── .env.example      # Configuration template
└── README.md

License

ISC

About

An AI agent skill to manage gitlab merge requests, issues, pipelines, jobs, releases and more

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors