CI Copilot
Your AI-powered assistant for GitLab CI/CD pipelines.
CI Copilot helps you analyze, fix, and understand your .gitlab-ci.yml files using large language models (LLMs).
It works both as a command-line tool and as a local HTTP API.
π Features
CI Copilot supports 4 powerful AI-driven modes:
-
π Suggest
Analyze your pipeline and get clear recommendations to improve reliability, structure, or efficiency.
-
π Fix
Automatically fix common issues in your .gitlab-ci.yml file. You can preview or apply the changes.
-
π Audit
Perform a focused audit for security, speed, or cleanliness. Get prioritized recommendations.
-
π Explain
Understand what your pipeline is doing. The AI explains your .gitlab-ci.yml in simple language.
βοΈ Usage (CLI + API)
CI Copilot can be used as a command-line tool or as a local API.
π₯ CLI usage
# Get suggestions for improvements
ci-copilot suggest --in .gitlab-ci.yml
# Automatically fix and save to a new file
ci-copilot fix --in .gitlab-ci.yml --out .gitlab-ci.fixed.yml
# Audit the pipeline for security issues
ci-copilot audit --in .gitlab-ci.yml --focus security
# Get a simple explanation of the pipeline
ci-copilot explain --in .gitlab-ci.yml
π§© API usage
You can use CI Copilot as a local HTTP API by running the Go server.
Start the server:
go run ./cmd/server/main.go
POST /suggest
POST /fix
POST /audit
POST /explain
Example request (using curl)
Request:
curl -X POST http://localhost:8080/suggest \
-H "Content-Type: application/json" \
-d '{"message": "your .gitlab-ci.yml content here"}'
Response:
{
"summary": "The pipeline is mostly correct but can be improved.",
"recommendations": [
{
"issue": "Job 'build' is missing retry policy",
"suggestion": "Add 'retry: 2' to ensure resilience",
"priority": "medium"
}
]
}
π Installation
1. Clone the repository
git clone https://github.com/genov8/ci-copilot.git
cd ci-copilot
2. Alternatively, if you only need a single CLI command:
You can also install individual CLI tools:
go install github.com/genov8/ci-copilot/cmd/suggest@latest
go install github.com/genov8/ci-copilot/cmd/fix@latest
go install github.com/genov8/ci-copilot/cmd/audit@latest
go install github.com/genov8/ci-copilot/cmd/explain@latest
π§ͺ Tests
Basic API behavior is covered with integration tests.
Since core functionality relies on AI model responses,
we recommend manual review for output accuracy.
Run all tests with:
go test ./...
π Project Structure
The project is organized into clearly separated modules:
ci-copilot/
βββ cmd/ # CLI entry points (suggest, fix, audit, explain)
βββ internal/
β βββ client/ # Main logic for interacting with the AI service
β βββ config/ # Centralized configuration (e.g. endpoint URLs)
β βββ server/ # HTTP API server for local AI access
β βββ ui/ # Optional pretty output for CLI users
βββ prompts/ # All prompt templates used by AI interactions
βββ tests/ # Test cases (optional)
βββ ai-service/ # Optional local AI service using Gemini via FastAPI
π§ How It Works
CI Copilot combines CLI tools written in Go with a local AI-powered analysis service.
Hereβs the flow:
- The CLI reads your
.gitlab-ci.yml file.
- It loads a specific prompt (stored in the
prompts/ folder).
- The content and prompt are combined and sent via HTTP to a local FastAPI AI service.
- The AI model (e.g., Gemini) generates a structured response.
- The CLI tool formats and prints the result β or applies changes if needed.
The architecture is modular:
- Prompts are decoupled and easy to edit.
- You can replace the AI backend without changing the CLI logic.
π‘ Potential Extensions
This project is designed to be extensible. Below are directions where CI Copilot could evolve:_
-
π§ Custom LLMs for CI/CD
Train or fine-tune your own language models that specialize in DevOps and .gitlab-ci.yml pipelines.
-
π Pluggable AI Backends
Support multiple AI providers β OpenAI, Gemini, or local LLMs β by switching via simple configuration.
-
π§ͺ GitLab-native validation
Add automatic .gitlab-ci.yml checks during push via GitLab Webhooks or server-side hooks β no changes to pipeline files needed.
-
π Custom rule engines
Allow teams to define internal rules or style guides that the assistant must enforce.
-
π§© IDE plugins
Integrate with VS Code or JetBrains IDEs to provide in-editor suggestions and validation.
-
π Web dashboard
Visualize suggestions, track history, and monitor best practice adoption across projects.
-
π‘ Enterprise mode
Add support for self-hosted models, offline operation, and team-level controls in secure environments.
π License
This project is licensed under the MIT License.