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>
89 lines
1.8 KiB
Go
89 lines
1.8 KiB
Go
// Package domain contains core business entities.
|
|
package domain
|
|
|
|
import "time"
|
|
|
|
// CIRepo represents a repository's CI/CD configuration.
|
|
type CIRepo struct {
|
|
// ID is the CI system's internal ID for this repo
|
|
ID int64
|
|
|
|
// ForgeRemoteID is the ID from the forge (e.g., Gitea repo ID)
|
|
ForgeRemoteID int64
|
|
|
|
// Owner is the repository owner (org or user)
|
|
Owner string
|
|
|
|
// Name is the repository name
|
|
Name string
|
|
|
|
// FullName is owner/name
|
|
FullName string
|
|
|
|
// CloneURL is the URL to clone the repo
|
|
CloneURL string
|
|
|
|
// Active indicates if CI is enabled for this repo
|
|
Active bool
|
|
|
|
// AllowPullRequests allows PRs to trigger builds
|
|
AllowPullRequests bool
|
|
|
|
// Visibility: public, private, internal
|
|
Visibility string
|
|
|
|
// CreatedAt is when CI was activated
|
|
CreatedAt time.Time
|
|
|
|
// UpdatedAt is when CI config was last modified
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
// CISecret represents a secret for use in CI pipelines.
|
|
type CISecret struct {
|
|
// Name is the secret name (e.g., "DOCKER_PASSWORD")
|
|
Name string
|
|
|
|
// Value is the secret value (encrypted at rest)
|
|
Value string
|
|
|
|
// Events controls when the secret is available (e.g., "push", "pull_request")
|
|
Events []string
|
|
|
|
// Images limits which container images can use this secret
|
|
Images []string
|
|
}
|
|
|
|
// CIPipeline represents a CI pipeline execution.
|
|
type CIPipeline struct {
|
|
// ID is the pipeline ID
|
|
ID int64
|
|
|
|
// Number is the pipeline number (increments per repo)
|
|
Number int64
|
|
|
|
// Status: pending, running, success, failure, killed, blocked
|
|
Status string
|
|
|
|
// Event: push, pull_request, tag, cron, manual
|
|
Event string
|
|
|
|
// Branch that triggered the pipeline
|
|
Branch string
|
|
|
|
// Commit SHA
|
|
Commit string
|
|
|
|
// Message is the commit message
|
|
Message string
|
|
|
|
// Author who triggered the pipeline
|
|
Author string
|
|
|
|
// Started timestamp
|
|
Started time.Time
|
|
|
|
// Finished timestamp (zero if still running)
|
|
Finished time.Time
|
|
}
|