Implements weeks 1-4 of the multi-provider architecture: Week 1 - Foundation: - Add domain models (AgentProvider, AgentRequest, AgentEvent, AgentResult) - Define CodeAgent port interface with Execute, Cancel, Capabilities - Create thread-safe provider registry with first-registered default Week 2 - Claude Code Adapter: - Extract kubectl exec logic into CodeAgent implementation - Parse stream-json output format (init, message, tool_use, result) - Support session continuation via --resume flag Week 3 - OpenCode Adapter: - HTTP/SSE client for opencode serve API - Session management (create, send message, abort) - Event streaming with documented buffer rationale Week 4 - Quality & Polish: - Fix race condition in OpenCode Cancel method - Add AgentRequest.Validate() with ErrPromptRequired, ErrInvalidTimeout - Document DefaultAvailabilityTimeout constants - Add HTTP error context for debugging Also includes: - Work queue system with PostgreSQL adapter - Credential store for infrastructure secrets - Project templates with Woodpecker CI integration - Comprehensive test coverage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
// Package port defines interfaces (ports) for external dependencies.
|
|
package port
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/orchard9/rdev/internal/domain"
|
|
)
|
|
|
|
// CIProvider manages CI/CD pipeline configurations.
|
|
// Implementations include Woodpecker, GitHub Actions, GitLab CI, etc.
|
|
type CIProvider interface {
|
|
// ActivateRepo enables CI for a repository.
|
|
// The forge is the git forge (e.g., gitea, github) where the repo lives.
|
|
// This creates the necessary webhooks and enables the CI pipeline.
|
|
ActivateRepo(ctx context.Context, forge, owner, repo string) (*domain.CIRepo, error)
|
|
|
|
// DeactivateRepo disables CI for a repository.
|
|
DeactivateRepo(ctx context.Context, owner, repo string) error
|
|
|
|
// GetRepo returns the CI configuration for a repository.
|
|
GetRepo(ctx context.Context, owner, repo string) (*domain.CIRepo, error)
|
|
|
|
// ListRepos returns all repositories visible to the CI system.
|
|
ListRepos(ctx context.Context) ([]*domain.CIRepo, error)
|
|
|
|
// AddSecret adds a secret to a repository for use in pipelines.
|
|
AddSecret(ctx context.Context, owner, repo string, secret domain.CISecret) error
|
|
|
|
// DeleteSecret removes a secret from a repository.
|
|
DeleteSecret(ctx context.Context, owner, repo, secretName string) error
|
|
}
|