From 0c918b454362ff377dc02ea3421265287d71431d Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 19 Feb 2026 23:13:56 +0000 Subject: [PATCH 1/2] Enhance GitLab skill with comprehensive CLI documentation - Add trigger for https://gitlab.com URLs to identify GitLab artifacts - Add IMPORTANT note about recognizing GitLab URLs - Add glab CLI examples for checking pipeline status, viewing MRs/issues - Add section on handling review comments (matching GitHub skill) - Add comprehensive glab CLI command reference: - Merge request commands (list, view, create, checkout, approve, merge) - Issue commands (list, view, create, close, comment) - Pipeline/CI commands (status, view, list, retry, trace) - API access commands - Add section on resolving discussion threads via API - Add note about not marking MRs ready unless explicitly asked This brings the GitLab skill to parity with the GitHub skill in terms of CLI usage documentation and best practices. Co-authored-by: openhands --- skills/gitlab/SKILL.md | 135 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 4 deletions(-) diff --git a/skills/gitlab/SKILL.md b/skills/gitlab/SKILL.md index be1132d..2b21f09 100644 --- a/skills/gitlab/SKILL.md +++ b/skills/gitlab/SKILL.md @@ -1,18 +1,30 @@ --- name: gitlab -description: Interact with GitLab repositories, merge requests, and APIs using the GITLAB_TOKEN environment variable. Use when working with code hosted on GitLab or managing GitLab resources. +description: Interact with GitLab repositories, merge requests, issues, and pipelines using the GITLAB_TOKEN environment variable and GitLab CLI (glab). Use when working with code hosted on GitLab or managing GitLab resources. Any URL starting with https://gitlab.com is a GitLab artifact. triggers: - gitlab - git +- https://gitlab.com --- You have access to an environment variable, `GITLAB_TOKEN`, which allows you to interact with the GitLab API. +Any URL starting with `https://gitlab.com` refers to a GitLab artifact (repository, merge request, issue, pipeline, etc.) and should be handled using the GitLab CLI (`glab`) or GitLab API. + You can use `curl` with the `GITLAB_TOKEN` to interact with GitLab's API. -ALWAYS use the GitLab API for operations instead of a web browser. -ALWAYS use the `create_mr` tool to open a merge request +ALWAYS use the GitLab API or `glab` CLI for operations instead of a web browser. +ALWAYS use the `create_mr` tool to open a merge request. + +If the user asks you to check pipeline status, view issues, or manage merge requests, use `glab` CLI commands: +Examples: +- `glab mr view ` to view a merge request +- `glab mr view --comments` to view MR with comments +- `glab issue view --comments` to view an issue with comments +- `glab ci status` to check pipeline status +- `glab ci view` to view the current pipeline +- `glab pipeline list` to list recent pipelines If you encounter authentication issues when pushing to GitLab (such as password prompts or permission errors), the old token may have expired. In such case, update the remote URL to include the current token: `git remote set-url origin https://oauth2:${GITLAB_TOKEN}@gitlab.com/username/repo.git` @@ -22,11 +34,126 @@ Here are some instructions for pushing, but ONLY do this if the user asks you to * Git config (username and email) is pre-set. Do not modify. * You may already be on a branch starting with `openhands-workspace`. Create a new branch with a better name before pushing. * Use the `create_mr` tool to create a merge request, if you haven't already -* Once you've created your own branch or a merge request, continue to update it. Do NOT create a new one unless you are explicitly asked to. Update the PR title and description as necessary, but don't change the branch name. +* Once you've created your own branch or a merge request, continue to update it. Do NOT create a new one unless you are explicitly asked to. Update the MR title and description as necessary, but don't change the branch name. * Use the main branch as the base branch, unless the user requests otherwise * After opening or updating a merge request, send the user a short message with a link to the merge request. +* Do NOT mark a merge request as ready to merge unless the user explicitly says so * Do all of the above in as few steps as possible. E.g. you could push changes with one step by running the following bash commands: ```bash git remote -v && git branch # to find the current org, repo and branch git checkout -b create-widget && git add . && git commit -m "Create widget" && git push -u origin create-widget +``` + +## Handling Review Comments + +- Critically evaluate each review comment before acting on it. Not all feedback is worth implementing: + - Does it fix a real bug or improve clarity significantly? + - Does it align with the project's engineering principles (simplicity, maintainability)? + - Is the suggested change proportional to the benefit, or does it add unnecessary complexity? +- It's acceptable to respectfully decline suggestions that add verbosity without clear benefit, over-engineer for hypothetical edge cases, or contradict the project's pragmatic approach. +- After addressing (or deciding not to address) inline review comments, mark the corresponding discussion threads as resolved. +- Before resolving a thread, leave a reply comment that either explains the reason for dismissing the feedback or references the specific commit (e.g., commit SHA) that addressed the issue. +- Prefer resolving threads only once fixes are pushed or a clear decision is documented. + +## Common GitLab CLI (glab) Commands + +### Merge Requests +```bash +# List merge requests +glab mr list + +# View a specific MR with comments +glab mr view --comments + +# Create a merge request +glab mr create --source-branch --target-branch main --title "Title" --description "Description" + +# Check out an MR locally +glab mr checkout + +# Approve a merge request +glab mr approve + +# Merge a merge request +glab mr merge +``` + +### Issues +```bash +# List issues +glab issue list + +# View an issue with comments +glab issue view --comments + +# Create an issue +glab issue create --title "Title" --description "Description" + +# Close an issue +glab issue close + +# Add a comment to an issue +glab issue note --message "Comment text" +``` + +### Pipelines and CI +```bash +# View current pipeline status +glab ci status + +# View pipeline details +glab ci view + +# List recent pipelines +glab pipeline list + +# Retry a failed pipeline +glab ci retry + +# View a specific job's log +glab ci trace +``` + +### API Access +```bash +# Make direct API calls using glab +glab api projects/:id/merge_requests + +# Get project details +glab api projects/:id + +# List project variables +glab api projects/:id/variables +``` + +## Resolving Discussion Threads via API + +To resolve discussion threads programmatically: + +1. Get the discussion IDs for a merge request: +```bash +glab api projects/:id/merge_requests/:mr_iid/discussions +``` + +2. Reply to a discussion thread: +```bash +curl --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ + "https://gitlab.com/api/v4/projects/:id/merge_requests/:mr_iid/discussions/:discussion_id/notes" \ + --data "body=Fixed in " +``` + +3. Resolve a discussion thread: +```bash +curl --request PUT --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ + "https://gitlab.com/api/v4/projects/:id/merge_requests/:mr_iid/discussions/:discussion_id" \ + --data "resolved=true" +``` + +4. Retry a failed pipeline: +```bash +# List recent pipelines to find the ID +glab pipeline list + +# Retry the failed pipeline +glab ci retry ``` \ No newline at end of file From 331604b44e36ca008af8e5305e7345198bd04e6c Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 19 Feb 2026 23:18:34 +0000 Subject: [PATCH 2/2] Condense GitLab skill to match GitHub skill length Removed the verbose 'Common GitLab CLI Commands' reference section. Key examples are already in the IMPORTANT block, and the discussion thread resolution section provides the equivalent of GitHub's GraphQL examples. Co-authored-by: openhands --- skills/gitlab/SKILL.md | 80 +++--------------------------------------- 1 file changed, 4 insertions(+), 76 deletions(-) diff --git a/skills/gitlab/SKILL.md b/skills/gitlab/SKILL.md index 2b21f09..c2fc942 100644 --- a/skills/gitlab/SKILL.md +++ b/skills/gitlab/SKILL.md @@ -17,14 +17,12 @@ You can use `curl` with the `GITLAB_TOKEN` to interact with GitLab's API. ALWAYS use the GitLab API or `glab` CLI for operations instead of a web browser. ALWAYS use the `create_mr` tool to open a merge request. -If the user asks you to check pipeline status, view issues, or manage merge requests, use `glab` CLI commands: +If the user asks you to check pipeline status, view issues, or manage merge requests, use `glab` CLI: Examples: -- `glab mr view ` to view a merge request - `glab mr view --comments` to view MR with comments - `glab issue view --comments` to view an issue with comments - `glab ci status` to check pipeline status -- `glab ci view` to view the current pipeline -- `glab pipeline list` to list recent pipelines +- `glab ci retry` to retry a failed pipeline If you encounter authentication issues when pushing to GitLab (such as password prompts or permission errors), the old token may have expired. In such case, update the remote URL to include the current token: `git remote set-url origin https://oauth2:${GITLAB_TOKEN}@gitlab.com/username/repo.git` @@ -54,77 +52,7 @@ git checkout -b create-widget && git add . && git commit -m "Create widget" && g - After addressing (or deciding not to address) inline review comments, mark the corresponding discussion threads as resolved. - Before resolving a thread, leave a reply comment that either explains the reason for dismissing the feedback or references the specific commit (e.g., commit SHA) that addressed the issue. - Prefer resolving threads only once fixes are pushed or a clear decision is documented. - -## Common GitLab CLI (glab) Commands - -### Merge Requests -```bash -# List merge requests -glab mr list - -# View a specific MR with comments -glab mr view --comments - -# Create a merge request -glab mr create --source-branch --target-branch main --title "Title" --description "Description" - -# Check out an MR locally -glab mr checkout - -# Approve a merge request -glab mr approve - -# Merge a merge request -glab mr merge -``` - -### Issues -```bash -# List issues -glab issue list - -# View an issue with comments -glab issue view --comments - -# Create an issue -glab issue create --title "Title" --description "Description" - -# Close an issue -glab issue close - -# Add a comment to an issue -glab issue note --message "Comment text" -``` - -### Pipelines and CI -```bash -# View current pipeline status -glab ci status - -# View pipeline details -glab ci view - -# List recent pipelines -glab pipeline list - -# Retry a failed pipeline -glab ci retry - -# View a specific job's log -glab ci trace -``` - -### API Access -```bash -# Make direct API calls using glab -glab api projects/:id/merge_requests - -# Get project details -glab api projects/:id - -# List project variables -glab api projects/:id/variables -``` +- Use the GitLab API to reply to and resolve discussion threads (see below). ## Resolving Discussion Threads via API @@ -149,7 +77,7 @@ curl --request PUT --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ --data "resolved=true" ``` -4. Retry a failed pipeline: +4. Get failed pipeline and retry it: ```bash # List recent pipelines to find the ID glab pipeline list