Major refactoring to hexagonal (ports & adapters) architecture: - Add service layer (apikey_service, project_service) for business logic - Add webhook system with dispatcher and delivery tracking - Add command queue with priority-based processing - Add rate limiting with sliding window algorithm - Add audit logging for command execution - Add OpenTelemetry integration (traces, metrics, spans) - Add circuit breaker for fault tolerance - Add cached repository wrapper for performance - Add comprehensive validation package - Add Kubernetes client integration for pod management - Add database migrations (allowed_ips, audit_log, rate_limiting, queue, webhooks) - Add network policy and PodDisruptionBudget for k8s - Remove legacy executor and projects/registry packages - Untrack secrets.yaml (now managed via envault) - Add coverage.out to .gitignore - Add e2e test infrastructure with docker-compose - Add comprehensive documentation (API, architecture, operations, plans) - Add golangci-lint config and pre-commit hook Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
// Package domain contains pure domain models with no external dependencies.
|
|
// These types represent the core business concepts of the application.
|
|
package domain
|
|
|
|
// ProjectID is a strongly-typed identifier for projects.
|
|
type ProjectID string
|
|
|
|
// Project represents a claudebox project that can execute commands.
|
|
type Project struct {
|
|
ID ProjectID
|
|
Name string
|
|
Description string
|
|
PodName string
|
|
Status ProjectStatus
|
|
Workspace string
|
|
}
|
|
|
|
// ProjectStatus represents the current state of a project's pod.
|
|
type ProjectStatus string
|
|
|
|
const (
|
|
ProjectStatusRunning ProjectStatus = "running"
|
|
ProjectStatusPending ProjectStatus = "pending"
|
|
ProjectStatusFailed ProjectStatus = "failed"
|
|
ProjectStatusNotFound ProjectStatus = "not_found"
|
|
ProjectStatusUnknown ProjectStatus = "unknown"
|
|
ProjectStatusError ProjectStatus = "error"
|
|
)
|
|
|
|
// IsAvailable returns true if the project can accept commands.
|
|
func (s ProjectStatus) IsAvailable() bool {
|
|
return s == ProjectStatusRunning
|
|
}
|
|
|
|
// IsTerminal returns true if the status is a final state.
|
|
func (s ProjectStatus) IsTerminal() bool {
|
|
return s == ProjectStatusFailed || s == ProjectStatusNotFound
|
|
}
|
|
|
|
// K8s label and annotation constants for project discovery.
|
|
// Pods with these labels are discovered as rdev projects.
|
|
const (
|
|
// LabelProject marks a pod as an rdev project when set to "true".
|
|
LabelProject = "rdev.orchard9.ai/project"
|
|
|
|
// LabelName specifies the project name (used as project ID).
|
|
LabelName = "rdev.orchard9.ai/name"
|
|
|
|
// LabelWorkspace specifies the workspace path inside the pod.
|
|
LabelWorkspace = "rdev.orchard9.ai/workspace"
|
|
|
|
// AnnotDescription provides a human-readable description of the project.
|
|
AnnotDescription = "rdev.orchard9.ai/description"
|
|
)
|