High-level overview of git-courer's codebase for contributors.
- Language: Go 1.21+
- MCP Server: Custom implementation in
internal/delivery/mcp - LLM Integration: Ollama (local) via HTTP API
- Architecture: Hexagonal / Clean Architecture
git-courer/
├── cmd/ # CLI entry point
├── internal/
│ ├── adapters/ # External adapters
│ │ ├── git/ # Git operations (porcelain commands)
│ │ ├── llm/ # Ollama client
│ │ └── confirm/ # User confirmation prompts
│ ├── core/
│ │ ├── domain/ # Pure domain models (Commit, Release, etc.)
│ │ ├── ports/ # Interfaces (driven by adapters)
│ │ └── errors/ # Domain errors
│ ├── delivery/
│ │ └── mcp/ # MCP protocol server implementation
│ ├── infra/ # Infrastructure
│ │ ├── chunkers/ # Diff chunking for large changes
│ │ ├── logging/ # Structured logging
│ │ └── secrets/ # Secret detection (5 security layers)
│ ├── installer/ # Binary install, MCP config generation
│ ├── shared/
│ │ └── prompts/ # Ollama prompt templates
│ └── workflow/ # Business logic (commit, release, branch)
├── plugin/ # Editor plugins (OpenCode, etc.)
├── prompts/ # Agent instructions for AI tools
├── docs/ # Documentation
└── scripts/ # Install/uninstall scripts
┌─────────────────────────────────────────────┐
│ AI Assistant (Claude, Cursor, etc.) │
└──────────────────┬──────────────────────────┘
│ MCP Protocol (JSON-RPC)
┌──────────────────▼──────────────────────────┐
│ internal/delivery/mcp (MCP Server) │
└──────────────────┬──────────────────────────┘
│
┌──────────────────▼──────────────────────────┐
│ internal/workflow (Unified Engine) │
│ - Orchestrator (Workflow struct) │
│ - Specialized services (Commit, Release) │
│ - Proactive Security Interceptor │
└──────────────────┬──────────────────────────┘
│
┌──────────┼──────────┐
│ │ │
┌───────▼──┐ ┌────▼───┐ ┌──▼──────────┐
│ core/domain│ │adapters│ │ infra/ │
│ (models) │ │(git,llm)│ │ (secrets, │
│ │ │ │ │ chunkers) │
└───────────┘ └────────┘ └────────────┘
As of v1.1.0, all Git operations requiring AI or confirmation pass through a single orchestrator in internal/workflow/workflow.go. This ensures:
- Atomic Operations: Automatic backup and rollback (Capture state before START, restore on ABORT/Failure).
- Proactive Security: Every change is audited for secrets BEFORE the user sees a preview.
- Consistency: Unified preview generation and integrity checks (via Diff Hashing).
- Ports (
internal/core/ports/): Interfaces defining what the core needs. Recently addedRenameBranchandVerifySecrets. - Adapters (
internal/adapters/): Implementations of those ports. - Domain (
internal/core/domain/): Pure business models. AddedBackupandSummarytypes.
The DiffChunker now understands functional relationships across languages (Go, Python, JS, TS, Rust). It groups files based on:
- Semantic Links: Caller-callee relationships (e.g., a function in A.go called by B.go).
- Atomic Pairs: Keeps Code and Test files together.
- Directory Affinity: Prioritizes grouping files within the same domain/folder.
Security is no longer optional or model-dependent:
- Magic Bytes: Direct header scan for binary executables.
- Statistical Audit: Detection of disguised binary payloads.
- Path Blacklist: Filename-based blocking.
- Memory-First Regex: Scans the actual staged Diff in memory.
- AI Auditor: A paranoid LLM agent verifies potential leaks.
- Domain: Add models/types in
internal/core/domain/ - Ports: Define interfaces in
internal/core/ports/ - Adapters: Implement in
internal/adapters/if needed - Workflow: Add business logic in
internal/workflow/ - MCP Tools: Expose via
internal/delivery/mcp/if it's a user-facing operation - Tests: Add in the same package as the implementation
# Unit tests (standard)
make test-unit
# CI tests (PR-ready, no Ollama)
make test-ci
# Quality & Prompt Accuracy (requires Ollama)
make test-quality
# Extreme Stress & E2E Torture (Armageddon)
make test-torture
# The Ultimate Maratón (Run everything)
make test-full| What | Where |
|---|---|
| Unified Orchestrator | internal/workflow/workflow.go |
| Execution Engine | internal/workflow/execute.go |
| Preview Logic | internal/workflow/generate.go |
| Semantic Chunker | internal/infra/chunkers/diff.go |
| Security Service | internal/security/security.go |
| AI Prompts (.txt) | internal/shared/prompts/txt/ |
| Quality Matrix | internal/adapters/llm/prompt_matrix_test.go |
| E2E Torture | test/e2e/armageddon_test.go |