This commit implements Phase 4 of the CHORUS task execution engine development plan, replacing the MockTaskProvider with real repository provider implementations for Gitea, GitHub, and GitLab APIs. ## Major Components Added: ### Repository Providers (pkg/providers/) - **GiteaProvider**: Complete Gitea API integration for self-hosted Git services - **GitHubProvider**: GitHub API integration with comprehensive issue management - **GitLabProvider**: GitLab API integration supporting both cloud and self-hosted - **ProviderFactory**: Centralized factory for creating and managing providers - **Comprehensive Testing**: Full test suite with mocks and validation ### Key Features Implemented: #### Gitea Provider Integration - Issue retrieval with label filtering and status management - Task claiming with automatic assignment and progress labeling - Completion handling with detailed comments and issue closure - Priority/complexity calculation from labels and content analysis - Role and expertise determination from issue metadata #### GitHub Provider Integration - GitHub API v3 integration with proper authentication - Pull request filtering (issues only, no PRs as tasks) - Rich completion comments with execution metadata - Label management for task lifecycle tracking - Comprehensive error handling and retry logic #### GitLab Provider Integration - Supports both GitLab.com and self-hosted instances - Project ID or owner/repository identification - GitLab-specific features (notes, time tracking, milestones) - Issue state management and assignment handling - Flexible configuration for different GitLab setups #### Provider Factory System - **Dynamic Provider Creation**: Factory pattern for provider instantiation - **Configuration Validation**: Provider-specific config validation - **Provider Discovery**: Runtime provider enumeration and info - **Extensible Architecture**: Easy addition of new providers #### Intelligent Task Analysis - **Priority Calculation**: Multi-factor priority analysis from labels, titles, content - **Complexity Estimation**: Content analysis for task complexity scoring - **Role Determination**: Automatic role assignment based on label analysis - **Expertise Mapping**: Technology and skill requirement extraction ### Technical Implementation Details: #### API Integration: - HTTP client configuration with timeouts and proper headers - JSON marshaling/unmarshaling for API request/response handling - Error handling with detailed API response analysis - Rate limiting considerations and retry mechanisms #### Security & Authentication: - Token-based authentication for all providers - Secure credential handling without logging sensitive data - Proper API endpoint URL construction and validation - Request sanitization and input validation #### Task Lifecycle Management: - Issue claiming with conflict detection - Progress tracking through label management - Completion reporting with execution metadata - Status updates with rich markdown formatting - Automatic issue closure on successful completion ### Configuration System: - Flexible configuration supporting multiple provider types - Environment variable expansion and validation - Provider-specific required and optional fields - Configuration validation with detailed error messages ### Quality Assurance: - Comprehensive unit tests with HTTP mocking - Provider factory testing with configuration validation - Priority/complexity calculation validation - Role and expertise determination testing - Benchmark tests for performance validation This implementation enables CHORUS agents to work with real repository systems instead of mock providers, allowing true autonomous task execution across different Git platforms. The system now supports the major Git hosting platforms used in enterprise and open-source development, with a clean abstraction that allows easy addition of new providers. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
130 lines
4.0 KiB
Makefile
130 lines
4.0 KiB
Makefile
# CHORUS Multi-Binary Makefile
|
|
# Builds both chorus-agent and chorus-hap binaries
|
|
|
|
# Build configuration
|
|
BINARY_NAME_AGENT = chorus-agent
|
|
BINARY_NAME_HAP = chorus-hap
|
|
BINARY_NAME_COMPAT = chorus
|
|
VERSION ?= 0.5.0
|
|
COMMIT_HASH ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
BUILD_DATE ?= $(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
|
|
|
# Go build flags
|
|
LDFLAGS = -ldflags "-X main.version=$(VERSION) -X main.commitHash=$(COMMIT_HASH) -X main.buildDate=$(BUILD_DATE)"
|
|
BUILD_FLAGS = -v $(LDFLAGS)
|
|
|
|
# Directories
|
|
BUILD_DIR = build
|
|
CMD_DIR = cmd
|
|
|
|
# Default target
|
|
.PHONY: all
|
|
all: clean build
|
|
|
|
# Build all binaries (including compatibility wrapper)
|
|
.PHONY: build
|
|
build: build-agent build-hap build-compat
|
|
|
|
# Build autonomous agent binary
|
|
.PHONY: build-agent
|
|
build-agent:
|
|
@echo "🤖 Building CHORUS autonomous agent..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME_AGENT) ./$(CMD_DIR)/agent
|
|
@echo "✅ Agent binary built: $(BUILD_DIR)/$(BINARY_NAME_AGENT)"
|
|
|
|
# Build human agent portal binary
|
|
.PHONY: build-hap
|
|
build-hap:
|
|
@echo "👤 Building CHORUS human agent portal..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME_HAP) ./$(CMD_DIR)/hap
|
|
@echo "✅ HAP binary built: $(BUILD_DIR)/$(BINARY_NAME_HAP)"
|
|
|
|
# Build compatibility wrapper (deprecated)
|
|
.PHONY: build-compat
|
|
build-compat:
|
|
@echo "⚠️ Building CHORUS compatibility wrapper (deprecated)..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME_COMPAT) ./$(CMD_DIR)/chorus
|
|
@echo "✅ Compatibility wrapper built: $(BUILD_DIR)/$(BINARY_NAME_COMPAT)"
|
|
|
|
# Test compilation without building
|
|
.PHONY: test-compile
|
|
test-compile:
|
|
@echo "🔍 Testing compilation of both binaries..."
|
|
go build -o /dev/null ./$(CMD_DIR)/agent
|
|
go build -o /dev/null ./$(CMD_DIR)/hap
|
|
@echo "✅ Both binaries compile successfully"
|
|
|
|
# Run tests
|
|
.PHONY: test
|
|
test:
|
|
@echo "🧪 Running tests..."
|
|
go test -v ./...
|
|
|
|
# Clean build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "🧹 Cleaning build artifacts..."
|
|
rm -rf $(BUILD_DIR)
|
|
@echo "✅ Clean complete"
|
|
|
|
# Install both binaries to GOPATH/bin
|
|
.PHONY: install
|
|
install: build
|
|
@echo "📦 Installing binaries to GOPATH/bin..."
|
|
cp $(BUILD_DIR)/$(BINARY_NAME_AGENT) $(shell go env GOPATH)/bin/
|
|
cp $(BUILD_DIR)/$(BINARY_NAME_HAP) $(shell go env GOPATH)/bin/
|
|
@echo "✅ Binaries installed"
|
|
|
|
# Development helpers
|
|
.PHONY: run-agent
|
|
run-agent: build-agent
|
|
@echo "🚀 Running CHORUS agent..."
|
|
./$(BUILD_DIR)/$(BINARY_NAME_AGENT)
|
|
|
|
.PHONY: run-hap
|
|
run-hap: build-hap
|
|
@echo "🚀 Running CHORUS HAP..."
|
|
./$(BUILD_DIR)/$(BINARY_NAME_HAP)
|
|
|
|
# Docker builds
|
|
.PHONY: docker-agent
|
|
docker-agent:
|
|
@echo "🐳 Building Docker image for CHORUS agent..."
|
|
docker build -f docker/Dockerfile.agent -t chorus-agent:$(VERSION) .
|
|
|
|
.PHONY: docker-hap
|
|
docker-hap:
|
|
@echo "🐳 Building Docker image for CHORUS HAP..."
|
|
docker build -f docker/Dockerfile.hap -t chorus-hap:$(VERSION) .
|
|
|
|
.PHONY: docker
|
|
docker: docker-agent docker-hap
|
|
|
|
# Help
|
|
.PHONY: help
|
|
help:
|
|
@echo "CHORUS Multi-Binary Build System"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " all - Clean and build both binaries (default)"
|
|
@echo " build - Build both binaries"
|
|
@echo " build-agent - Build autonomous agent binary only"
|
|
@echo " build-hap - Build human agent portal binary only"
|
|
@echo " test-compile - Test that both binaries compile"
|
|
@echo " test - Run tests"
|
|
@echo " clean - Remove build artifacts"
|
|
@echo " install - Install binaries to GOPATH/bin"
|
|
@echo " run-agent - Build and run agent"
|
|
@echo " run-hap - Build and run HAP"
|
|
@echo " docker - Build Docker images for both binaries"
|
|
@echo " docker-agent - Build Docker image for agent only"
|
|
@echo " docker-hap - Build Docker image for HAP only"
|
|
@echo " help - Show this help"
|
|
@echo ""
|
|
@echo "Environment Variables:"
|
|
@echo " VERSION - Version string (default: 0.1.0-dev)"
|
|
@echo " COMMIT_HASH - Git commit hash (auto-detected)"
|
|
@echo " BUILD_DATE - Build timestamp (auto-generated)"
|