Monitor GitLab projects and automatically process issues and merge requests
Project description
GitLab Watcher
Monitor GitLab projects and automatically process issues and merge requests using AI tools. It features built-in support for automated branch management, AI-driven code generation, and Discord notifications.
What the Watcher Does
Issue Processing (Automatic)
When an issue is assigned to the configured user without workflow labels:
- Adds "In progress" label
- Creates branch
<issue-id>-<slug>from default branch - Runs AI tool with the issue description
- Pushes changes and creates merge request
- Moves issue to "Review" label
- Sends optional Discord notification
MR Comment Processing (Automatic)
When a new comment appears on an open MR (not from the bot user):
- Checks out the MR's source branch
- Runs AI tool with the comment as feedback
- Pushes the changes to the remote branch
- Notifies Discord channels about applied changes
Post-Merge Cleanup (Automatic)
When an MR is merged:
- Updates default branch (e.g., master/main)
- Deletes the merged feature branch
- Sends Discord notification to confirm cleanup
Prerequisites
- Python 3.11 or higher
- Git installed and available in your system path
- GitLab Access Token with API access
- Claude CLI (or
opencode) must be installed and available in your PATH. (ollamais optional but supported for launching Claude).
Installation
# From PyPI (recommended)
pip install gitlab-watcher
# From source (development mode)
git clone https://git.gyengus.hu/gyengus/gitlab-watcher.git
cd gitlab-watcher
pip install -e ".[dev]"
Usage
# Run with default config
gitlab-watcher
# Custom config file
gitlab-watcher -c /path/to/config.conf
# Verbose mode
gitlab-watcher --verbose
Configuration
Create the default configuration directory:
mkdir -p ~/.config/gitlab-watcher
Create ~/.config/gitlab-watcher/config.conf with your environment details:
# Your GitLab instance URL
GITLAB_URL="https://git.example.com"
# Personal or Group Access Token
GITLAB_TOKEN="your_token_here"
# (Optional) Discord Webhook for detailed event notifications
DISCORD_WEBHOOK="https://discord.com/api/webhooks/your_webhook_id"
# Monitoring interval in seconds
POLL_INTERVAL=30
# AI Tool implementation style (ollama, direct, opencode, custom)
AI_TOOL_MODE="ollama"
# Maximum execution time for AI tool in seconds (default: 3600 / 1 hour)
AI_TOOL_TIMEOUT=3600
# List of absolute paths to project directories to monitor
PROJECT_DIRS=(
"/path/to/project1"
"/path/to/project2"
)
(Note: If GITLAB_URL and GITLAB_TOKEN are not provided in the configuration, the watcher will attempt to extract them from your git remotes automatically.)
Each monitored project directory must have a PROJECT.md, AGENTS.md, or CLAUDE.md file with a corresponding Project ID:
Project ID: 31
Supported AI Tools
The watcher supports multiple AI tools:
| Mode | Description |
|---|---|
ollama |
Launches Claude via Ollama (requires both ollama and claude) (default) |
direct |
Direct Claude CLI execution (claude) |
opencode |
Opencode CLI execution using run subcommand |
custom |
Custom command for any AI tool |
Configure in config.conf:
AI_TOOL_MODE="ollama" # or "direct", "opencode", "custom"
AI_TOOL_TIMEOUT=3600 # default is 1 hour
Timeout Diagnostics
If an AI tool exceeds the configured AI_TOOL_TIMEOUT, the watcher will attempt to capture and display any partial output (stdout/stderr) generated before the process was terminated. This helps in diagnosing why a tool might be hanging or taking longer than expected.
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=gitlab_watcher
Support & Donations
If you find this tool helpful and would like to support its continued development, crypto donations are very much appreciated!
- Bitcoin (BTC):
bc1qx4q5epl7nsyu9mum8edrvp2my8tut0enrz7kcn - Dogecoin (DOGE):
DS62HBswTfAJLadRcMyrUJq6CAE8XV6SqC - EVM (ETH/BSC/Polygon):
0x9F0a70A7306DF3fc072446cAF540F6766a4CC4E8 - Web3 Domain:
gyengus.sendme1satoshi.wallet
Thank you for your support!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitlab_watcher-1.0.3.tar.gz.
File metadata
- Download URL: gitlab_watcher-1.0.3.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd659f3b7201d50975c4f3bed6fe914049b837388dd9547354d8aa6b5f166a11
|
|
| MD5 |
c2b26073f3422cf16b9c2602a764fd96
|
|
| BLAKE2b-256 |
4fdc7915bea3e2b0e61b32969c9009cb44f9d291bff008ebb1cea5549a4b5277
|
File details
Details for the file gitlab_watcher-1.0.3-py3-none-any.whl.
File metadata
- Download URL: gitlab_watcher-1.0.3-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e3863b72a302d8e7406bbfc6488439d9e9d5ccc5a6321a10cd72227dadb1421
|
|
| MD5 |
d65290054e1266a1c70beb31905da6ff
|
|
| BLAKE2b-256 |
f647e444487187844f226a46e3192dea937e3b25683338785e4670c6f9d50c16
|