rdev/ai-lookup/features/infrastructure.md
jordan 39df51defd feat: Add multi-provider code agent interface with Claude Code and OpenCode adapters
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>
2026-01-27 09:25:51 -07:00

1.6 KiB

Infrastructure Management

Last Updated: 2025-01 Confidence: High

Summary

rdev can manage project infrastructure: creating Git repos, configuring DNS, and deploying applications to Kubernetes. This enables full project lifecycle management via API.

Key Facts:

  • Git repos via Gitea integration
  • DNS via Cloudflare integration
  • Deployments create K8s Deployment + Service + Ingress
  • Managed projects combine all three steps
  • Woodpecker CI integration for auto-deploy on build

File Pointers:

  • Handler: internal/handlers/infrastructure.go
  • Service: internal/service/project_infra.go
  • Gitea adapter: internal/adapter/gitea/client.go
  • Cloudflare adapter: internal/adapter/cloudflare/client.go
  • Deployer adapter: internal/adapter/deployer/deployer.go

Capabilities

Feature Endpoint Description
Create repo POST /projects/{id}/repo Creates Gitea repository
Deploy POST /projects/{id}/deploy Deploys to Kubernetes
Configure DNS POST /projects/{id}/domain Creates Cloudflare record
Managed project POST /projects/create-managed Full lifecycle

Managed Project Flow

  1. Create Gitea repository
  2. Initialize with template
  3. Create Cloudflare DNS record
  4. Deploy to Kubernetes (Deployment + Service + Ingress)
  5. Return project details

Environment Variables

GITEA_URL, GITEA_TOKEN, GITEA_DEFAULT_ORG
CLOUDFLARE_API_TOKEN, CLOUDFLARE_ZONE_ID, DEFAULT_DOMAIN
DEPLOY_NAMESPACE, DEPLOY_TLS_ISSUER, REGISTRY_URL