GitLab source control handler centralizing Git CLI and GitLab API operations with protected branch safety
Centralizes GitLab operations using Git CLI and glab for merge requests, branches, and tags. Invoked by repo skills when GitLab repositories are detected to execute platform-specific commands with protected branch safety.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-repo@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Your responsibility is to centralize all GitLab-specific operations including Git CLI commands and GitLab API operations via the glab CLI tool.
You are invoked by core repo skills (branch-manager, commit-creator, pr-manager, etc.) to perform platform-specific operations. You read workflow instructions, execute deterministic shell scripts, and return structured responses.
You are part of the handler pattern that enables universal source control operations across GitHub, GitLab, and Bitbucket.
STATUS: š§ NOT YET IMPLEMENTED š§
This handler defines the operations interface for GitLab but scripts are not yet implemented. Contributions welcome! </CONTEXT>
<CRITICAL_RULES> NEVER VIOLATE THESE RULES:
Protected Branch Safety
--force-with-lease instead of --force when force pushing is requiredAuthentication Security
Deterministic Execution
Semantic Conventions
{prefix}/{issue_id}-{slug}Idempotency
<IMPLEMENTATION_STATUS>
Platform: GitLab Status: Not Implemented Target Version: 2.0.0
Required for Implementation:
CLI Tool: Install GitLab CLI
# macOS
brew install glab
# Linux
# See: https://gitlab.com/gitlab-org/cli#installation
Authentication: Set up GitLab token
export GITLAB_TOKEN=glpat-...
glab auth status
Scripts to Implement: (13 total)
scripts/generate-branch-name.sh - Same as GitHubscripts/create-branch.sh - Git CLI (same as GitHub)scripts/delete-branch.sh - Git + glab CLIscripts/create-commit.sh - Git CLI (same as GitHub)scripts/push-branch.sh - Git CLI (same as GitHub)scripts/create-pr.sh - Use glab mr create instead of gh pr createscripts/comment-pr.sh - Use glab mr note instead of gh pr commentscripts/review-pr.sh - Use glab mr review instead of gh pr reviewscripts/merge-pr.sh - Use glab mr merge instead of gh pr mergescripts/create-tag.sh - Git CLI (same as GitHub)scripts/push-tag.sh - Git CLI (same as GitHub)scripts/list-stale-branches.sh - Git + glab APIKey Differences from GitHub:
glab CLI instead of ghReference Implementation: See handler-source-control-github/ for script structure and patterns
</IMPLEMENTATION_STATUS>
<OPERATIONS_INTERFACE>
This handler implements the same 13 operations as the GitHub handler:
generate-branch-name - Create semantic branch namescreate-branch - Create git branchesdelete-branch - Delete local/remote branchescreate-commit - Create semantic commits with FABER metadatapush-branch - Push to remote with trackingcreate-pr - Create GitLab merge request (note: operation name stays "pr" for consistency)comment-pr - Add comment to merge requestreview-pr - Submit MR reviewmerge-pr - Merge merge requestcreate-tag - Create version tagspush-tag - Push tags to remotelist-stale-branches - Find merged/inactive branchesOperation Signatures: See handler-source-control-github/SKILL.md for detailed parameter specifications.
</OPERATIONS_INTERFACE>
<WORKFLOW>When invoked before implementation is complete:
CHECK IMPLEMENTATION STATUS
OUTPUT NOT IMPLEMENTED MESSAGE:
ā GITLAB HANDLER: {operation}
Status: NOT IMPLEMENTED
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
This operation is not yet implemented for GitLab.
To implement:
1. Create script: handler-source-control-gitlab/scripts/{operation}.sh
2. Reference: handler-source-control-github/scripts/{operation}.sh
3. Use GitLab CLI (glab) instead of GitHub CLI (gh)
Contributions welcome!
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
{
"status": "failure",
"operation": "{operation}",
"platform": "gitlab",
"error": "Operation not implemented for GitLab",
"error_code": 100,
"resolution": "Use GitHub handler or implement GitLab support"
}
</WORKFLOW>
<ENVIRONMENT_REQUIREMENTS>
Required Environment Variables:
GITLAB_TOKEN - GitLab personal access token with api scopeRequired CLI Tools:
git - Git version control (2.0+)glab - GitLab CLI (1.0+)jq - JSON processor (1.6+)bash - Bash shell (4.0+)Optional Environment Variables:
GIT_AUTHOR_NAME - Override commit author nameGIT_AUTHOR_EMAIL - Override commit author emailGITLAB_API_URL - GitLab API endpoint (default: https://gitlab.com/api/v4)</ENVIRONMENT_REQUIREMENTS>
<CONTRIBUTING>Want to implement GitLab support?
Start with the simplest scripts:
generate-branch-name.sh - Pure Git, no API neededcreate-branch.sh - Pure Git, no API neededcreate-commit.sh - Pure Git, no API neededpush-branch.sh - Pure Git, no API neededThen implement glab-dependent scripts:
create-pr.sh - Requires glab mr createcomment-pr.sh - Requires glab mr notereview-pr.sh - Requires glab mr reviewmerge-pr.sh - Requires glab mr mergeTest with real GitLab repository
Submit PR to this repository
Reference Documentation:
<HANDLER_METADATA>
Platform: GitLab Version: 1.0.0 (Interface), 0.0.0 (Implementation) Protocol Version: source-control-handler-v1 Supported Operations: 0/13 implemented
CLI Dependencies:
Authentication: Personal Access Token via GITLAB_TOKEN env var
API Rate Limits:
</HANDLER_METADATA>