rdev/internal/port/git_repository.go
jordan 0fd4e32073 feat: Add infrastructure adapters for threesix.ai
Add Gitea, Cloudflare DNS, and Kubernetes deployer adapters following
hexagonal architecture. These enable automated project provisioning:
- Git repository creation/management via Gitea
- DNS record management via Cloudflare
- Container deployment to Kubernetes

Includes domain models, ports, handlers, and Woodpecker CI webhook
integration for automated deployments on push.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 22:49:58 -07:00

43 lines
1.7 KiB
Go

// Package port defines interfaces (ports) for external dependencies.
package port
import (
"context"
"github.com/orchard9/rdev/internal/domain"
)
// GitRepository manages git repositories via external git server (Gitea).
type GitRepository interface {
// CreateRepo creates a new git repository.
CreateRepo(ctx context.Context, name, description string, private bool) (*domain.Repo, error)
// DeleteRepo deletes a repository.
DeleteRepo(ctx context.Context, owner, name string) error
// ListRepos returns all repositories for an owner.
ListRepos(ctx context.Context, owner string) ([]*domain.Repo, error)
// GetRepo returns a single repository.
GetRepo(ctx context.Context, owner, name string) (*domain.Repo, error)
// AddCollaborator adds a user as collaborator to a repo.
// permission can be "read", "write", or "admin".
AddCollaborator(ctx context.Context, owner, repo, username string, permission string) error
// RemoveCollaborator removes a collaborator from a repo.
RemoveCollaborator(ctx context.Context, owner, repo, username string) error
// AddDeployKey adds a deploy key to a repo for read-only or read-write access.
AddDeployKey(ctx context.Context, owner, repo, title, publicKey string, readOnly bool) (*domain.DeployKey, error)
// DeleteDeployKey removes a deploy key from a repo.
DeleteDeployKey(ctx context.Context, owner, repo string, keyID int64) error
// CreateWebhook creates a webhook to trigger on specified events.
CreateWebhook(ctx context.Context, owner, repo, url, secret string, events []string) (*domain.RepoWebhook, error)
// DeleteWebhook removes a webhook from a repo.
DeleteWebhook(ctx context.Context, owner, repo string, webhookID int64) error
}