-
Notifications
You must be signed in to change notification settings - Fork 87
PluginGitlab
Monitor GitLab repositories for merge requests and issues with support for both GitLab.com and self-hosted instances.
3i / 2mr
5 issues
2 merge requests
| Property | Value |
|---|---|
| Platform | macOS, Linux |
| Dependencies |
curl, jq (optional but recommended) |
| Content Type | dynamic |
| Presence | conditional (hidden when no activity) |
# macOS
brew install glab
# Linux
# Download from https://gitlab.com/gitlab-org/cli/-/releases
# Authenticate
glab auth login# Create personal access token at:
# https://gitlab.com/-/profile/personal_access_tokens
# Scopes: read_api
# Set in environment
export GITLAB_TOKEN="your-token"
# Or
export GITLAB_PRIVATE_TOKEN="your-token"# Add to your tmux configuration
set -g @powerkit_plugins "gitlab"
# For specific repos (optional)
set -g @powerkit_plugin_gitlab_repos "username/repo1,group/repo2"
# Reload tmux configuration
tmux source-file ~/.tmux.confset -g @powerkit_plugins "gitlab"
# GitLab configuration
set -g @powerkit_plugin_gitlab_url "https://gitlab.com"
set -g @powerkit_plugin_gitlab_repos "myuser/project1,myteam/project2"
set -g @powerkit_plugin_gitlab_token "" # Or use env vars
# Display options
set -g @powerkit_plugin_gitlab_show_issues "true"
set -g @powerkit_plugin_gitlab_show_mrs "true"
set -g @powerkit_plugin_gitlab_separator " | "
# Icons
set -g @powerkit_plugin_gitlab_icon ""
set -g @powerkit_plugin_gitlab_icon_issue ""
set -g @powerkit_plugin_gitlab_icon_mr ""
# Thresholds
set -g @powerkit_plugin_gitlab_warning_threshold_issues "10"
set -g @powerkit_plugin_gitlab_warning_threshold_mrs "5"
# Cache (5 minutes)
set -g @powerkit_plugin_gitlab_cache_ttl "300"| Option | Type | Default | Description |
|---|---|---|---|
@powerkit_plugin_gitlab_url |
string | https://gitlab.com |
GitLab instance URL (supports self-hosted) |
@powerkit_plugin_gitlab_repos |
string | `` | Comma-separated list: owner/repo or group/project
|
@powerkit_plugin_gitlab_token |
string | `` | GitLab personal access token |
@powerkit_plugin_gitlab_show_issues |
bool | true |
Show open issues count |
@powerkit_plugin_gitlab_show_mrs |
bool | true |
Show open merge requests count |
@powerkit_plugin_gitlab_separator |
string | | |
Separator between metrics |
@powerkit_plugin_gitlab_icon |
icon | `` | GitLab icon |
@powerkit_plugin_gitlab_icon_issue |
icon | `` | Issues icon (optional) |
@powerkit_plugin_gitlab_icon_mr |
icon | `` | Merge request icon (optional) |
@powerkit_plugin_gitlab_warning_threshold_issues |
number | 10 |
Warning when issues exceed threshold |
@powerkit_plugin_gitlab_warning_threshold_mrs |
number | 5 |
Warning when MRs exceed threshold |
@powerkit_plugin_gitlab_cache_ttl |
number | 300 |
Cache duration in seconds (5 minutes) |
| State | Condition |
|---|---|
active |
Authenticated and has issues/MRs |
inactive |
No issues or MRs |
degraded |
API errors encountered |
failed |
Not authenticated |
| Level | Condition |
|---|---|
ok |
Total items < warning threshold |
warning |
Total items >= warning threshold |
error |
API errors or not authenticated |
| Context | Description |
|---|---|
unauthenticated |
Not logged in or no token |
api_error |
API request failed |
clear |
No pending items |
issues_and_mrs |
Both issues and MRs present |
issues_only |
Only issues present |
mrs_only |
Only merge requests present |
activity |
Has activity |
# Authenticate with glab
glab auth login
# Enable plugin
set -g @powerkit_plugins "gitlab"The plugin automatically uses glab to fetch your assigned issues and MRs.
set -g @powerkit_plugins "gitlab"
set -g @powerkit_plugin_gitlab_repos "mygroup/backend,mygroup/frontend"
set -g @powerkit_plugin_gitlab_token "glpat-xxxxxxxxxxxx"set -g @powerkit_plugins "gitlab"
set -g @powerkit_plugin_gitlab_url "https://gitlab.company.com"
set -g @powerkit_plugin_gitlab_repos "team/project"
set -g @powerkit_plugin_gitlab_token "glpat-xxxxxxxxxxxx"set -g @powerkit_plugins "gitlab"
set -g @powerkit_plugin_gitlab_show_issues "false"
set -g @powerkit_plugin_gitlab_show_mrs "true"set -g @powerkit_plugins "gitlab"
set -g @powerkit_plugin_gitlab_icon_issue ""
set -g @powerkit_plugin_gitlab_icon_mr ""The plugin formats output based on what's enabled and available:
| Configuration | Output |
|---|---|
| Both enabled, both have data |
3i / 2mr or 3 / 2 (with icons) |
| Both enabled, only issues |
5i or 5 (with icon) |
| Both enabled, only MRs |
2mr or 2 (with icon) |
| Only issues enabled |
5i or 5 issues
|
| Only MRs enabled |
2mr or 2 merge requests
|
The plugin supports multiple authentication methods (tried in order):
-
glab CLI (if available and authenticated)
glab auth status
-
Option token
set -g @powerkit_plugin_gitlab_token "glpat-xxxxxxxxxxxx"
-
Environment variable: GITLAB_TOKEN
export GITLAB_TOKEN="glpat-xxxxxxxxxxxx"
-
Environment variable: GITLAB_PRIVATE_TOKEN
export GITLAB_PRIVATE_TOKEN="glpat-xxxxxxxxxxxx"
The plugin uses GitLab REST API v4:
-
Issues:
/api/v4/projects/{id}/issues_statistics?scope=all -
Merge Requests:
/api/v4/projects/{id}/merge_requests?state=opened(uses X-Total header)
Project paths with slashes (e.g., group/subgroup/project) are URL-encoded automatically.
- Default cache: 5 minutes (API rate limits: 2000 requests/minute for GitLab.com)
- Uses efficient endpoints (
issues_statistics, HEAD requests for MR count) - Parallel requests are NOT used (sequential to avoid rate limits)
-
Check authentication:
# Using glab glab auth status # Using token curl -H "PRIVATE-TOKEN: your-token" \ "https://gitlab.com/api/v4/user"
-
Verify plugin is enabled:
tmux show-options -g | grep powerkit_plugins -
Test plugin directly:
POWERKIT_ROOT="/path/to/tmux-powerkit" ./bin/powerkit-plugin gitlab
If you see API errors:
-
Check API token permissions (needs
read_apiscope) -
Verify repository format (use
owner/repoorgroup/project):# Correct set -g @powerkit_plugin_gitlab_repos "gitlab-org/gitlab" # Incorrect set -g @powerkit_plugin_gitlab_repos "https://gitlab.com/gitlab-org/gitlab"
-
Test API manually:
# URL-encode project path curl -H "PRIVATE-TOKEN: token" \ "https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/issues_statistics?scope=all"
-
Ensure URL is accessible:
curl "https://gitlab.company.com/api/v4/version" -
Check SSL certificate issues:
curl -v "https://gitlab.company.com/api/v4/version" -
If using self-signed certs, curl may fail. The plugin doesn't currently support
-kflag.
If plugin is slow:
-
Increase cache TTL:
set -g @powerkit_plugin_gitlab_cache_ttl "600" # 10 minutes
-
Reduce number of repos:
set -g @powerkit_plugin_gitlab_repos "important/repo"
-
Use glab CLI instead of API:
# Remove repos option to use glab # unset @powerkit_plugin_gitlab_repos
If glab is installed but not being used:
-
Check glab authentication:
glab auth status
-
Re-authenticate:
glab auth login
-
Verify glab can list MRs:
glab mr list --assignee @me --state opened
- PluginGithub - Monitor GitHub repositories
- PluginBitbucket - Monitor Bitbucket repositories
- PluginJira - Monitor Jira issues
- PluginGit - Git repository status