rdev/internal/port/component.go
jordan 8282d60c69 feat: implement composable monorepo template system with component architecture
Adds the composable monorepo template system that generates project skeletons
with pluggable components (service, worker, app-react, app-astro, cli).

Key changes:
- Monorepo skeleton templates with shared pkg/, scripts/, and git hooks
- Component templates (service, worker, app-react, app-astro, cli) with
  Dockerfiles, CI steps, and component.yaml manifests
- Component domain model with validation and dependency resolution
- Component handler endpoints for CRUD and composition
- Template provider extended with BuildComposableProject and component assembly
- Deployer extended with composable project deployment support
- Handler timeout constants (TimeoutFastLookup through TimeoutLongRunning)
- envutil package for centralized env var reads with defaults
- api.DecodeJSON helper for standardized request body decoding
- Standardized response helpers (WriteBadRequest, WriteNotFound, etc.)
- Replaced fullstack-app cookbook with composable-app cookbook
- Hardened handler timeouts, logging, and error responses across all handlers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:11:42 -07:00

29 lines
1.1 KiB
Go

// Package port defines interfaces (ports) for external dependencies.
package port
import (
"context"
"github.com/orchard9/rdev/internal/domain"
)
// ComponentService manages components within monorepo projects.
type ComponentService interface {
// AddComponent adds a new component to a project's monorepo.
AddComponent(ctx context.Context, projectID string, req AddComponentRequest) (*domain.Component, error)
// ListComponents lists all components in a project's monorepo.
ListComponents(ctx context.Context, projectID string) ([]domain.Component, error)
// RemoveComponent removes a component from a project's monorepo.
RemoveComponent(ctx context.Context, projectID string, componentPath string) error
}
// AddComponentRequest contains the parameters for adding a component.
type AddComponentRequest struct {
Type string `json:"type"` // service, worker, app-astro, app-react, cli
Name string `json:"name"` // component name (slug format)
Template string `json:"template"` // optional: specific template variant
Port int `json:"port"` // optional: specific port (auto-assigned if 0)
}