Gemini Bot is designed to autonomously manage the entire lifecycle of software development tasks on GitLab/GitHub. It follows a strictly prioritized workflow to ensure existing work is maintained before starting new tasks.
The bot operates in two main phases:
Before looking for new work, the bot ensures its existing contributions are healthy. It scans for Merge Requests assigned to it or created by it that need attention:
- Conflict Resolution: If an MR has merge conflicts, the bot merges the target branch and invokes Gemini to resolve the conflicts.
- Addressing Reviews: If a human reviewer provides feedback (discussions), the bot reads the feedback and asks Gemini to implement the requested changes.
- Fixing Pipelines: If the CI/CD pipeline fails, the bot automatically downloads the failure logs from all failed jobs and asks Gemini to fix the root cause.
Once all existing MRs are healthy, the bot looks for new issues assigned to it:
- It clones the repository and creates a dedicated branch.
- It passes the issue description to Gemini to implement the feature or fix.
- It automatically handles forking if it doesn't have direct push access to the repository.
- It creates a new Merge Request and assigns itself to it for continued maintenance.
- Workspace Management: Each task is processed in a unique temporary directory within the
WorkspaceFolder. This prevents cross-task interference. - Git Visibility Control:
- For new issues: The
.gitfolder is hidden during Gemini's execution. This ensures Gemini focuses only on the code and doesn't attempt to manipulate git history or state. - For MR maintenance: The
.gitfolder remains visible. This allows Gemini to analyze the project history and previous commits to better understand the context of failures or review comments.
- For new issues: The
- Automatic Localization: After Gemini completes its task, the bot optionally runs a localization pass. It scans for projects with
Resourcesdirectories and usesAiursoft.Dotlang.AspNetTranslateto ensure all strings are correctly localized across target languages. - Smart Pushing:
- If the bot has push access, it pushes directly to the source branch.
- If fixing a third-party MR where it lacks permissions, it pushes to its own fork and creates a replacement MR, unassigning itself from the original one.
- NuGet Versioning: The bot is programmed to automatically bump NuGet package versions when it detects changes that warrant a new release.
Requirements:
Run the following command to install this tool:
dotnet tool install --global Aiursoft.GeminiBotAfter getting the binary, setup your GitLab and Gemini API KEY:
cat ./appsettings.json
{
"Servers": [
{
"Provider": "GitLab",
"EndPoint": "https://gitlab.aiursoft.com",
"PushEndPoint": "https://{0}@gitlab.aiursoft.com",
"DisplayName": "Gemini Bot",
"UserName": "gemini-bot",
"UserEmail": "[email protected]",
"ContributionBranch": "users/gemini/auto-fix-issue",
"Token": "",
"OnlyUpdate": false
}
],
"GeminiBot": {
"WorkspaceFolder": "/tmp/NugetNinjaWorkspace",
"GeminiTimeout": "00:35:00",
"ForkWaitDelayMs": 5000,
"Model": "gemini-3-pro-preview",
"GeminiApiKey": ""
}
}
Make sure to fill in the Token and GeminiApiKey fields with your actual GitLab personal access token and Gemini API key, respectively.
run it directly in the terminal.
C:\workspace> gemini-bot
16:28 info: Aiursoft.GeminiBot.Entry[0] Starting Gemini Bot for issue processing...
16:28 info: Aiursoft.GeminiBot.Entry[0] Processing server: GitLab...
16:28 info: Aiursoft.GeminiBot.Entry[0] ================ CHECKING MERGE REQUESTS ================
16:28 info: Aiursoft.GeminiBot.Entry[0] Checking merge requests before processing issues...
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Checking merge requests submitted by gemini-bot...
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Checking MR #33: Fix for issue #8: 砍掉PublicId。设计的不好。...
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] MR #33 pipeline is success, no action needed
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Checking MR #2: Fix for issue #1: UDP测试,只要连续10个包都丢了,且一个包都没收到,立刻停止测试,给0分。不需要浪费时间了。...
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] MR #2 pipeline is success, no action needed
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Checking MR #32: Fix for issue #9: 文档的分享功能非常confusing....
16:28 warn: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] MR #32 has pipeline with status: failed
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Found 1 failed merge requests to fix
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Processing failed MR #32: Fix for issue #9: 文档的分享功能非常confusing.
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] MR #32: Using project ID 375 for pipeline operations (source: 375, target: 341)
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Getting repository details from source project 375...
16:28 info: Aiursoft.NugetNinja.GitServerBase.Services.Providers.GitLab.GitLabService[0] Getting repository details for 375/ in GitLab...
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Fetching jobs for pipeline 40179 in project 375...
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Found 1 failed jobs in pipeline 40179
16:28 info: Aiursoft.GeminiBot.Services.MergeRequestProcessor[0] Downloading log for failed job: lint (ID: 230579)Requirements about how to run
- .NET 10 SDK
- Execute
dotnet runto run the app
- Open the
.slnfile in the project path. - Press
F5.
There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.
Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.
We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.