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>
77 lines
1.8 KiB
Markdown
77 lines
1.8 KiB
Markdown
# Template Provider
|
|
|
|
**Last Updated:** 2025-01
|
|
**Confidence:** High (Planned - see address-the-gaps.md)
|
|
|
|
## Summary
|
|
|
|
TemplateProvider seeds new repos with project templates. Includes .woodpecker.yml, .claude/ configuration, and stack-specific files.
|
|
|
|
**Key Facts:**
|
|
- Templates stored in `deployments/k8s/base/templates/`
|
|
- Seeded via Gitea API file creation
|
|
- Variable interpolation: `{{PROJECT_NAME}}`, `{{DOMAIN}}`
|
|
- Available templates: `default`, `astro-landing`, `go-api`
|
|
|
|
**File Pointers:**
|
|
- Port: `internal/port/template_provider.go`
|
|
- Adapter: `internal/adapter/gitea/templates.go`
|
|
- Templates: `deployments/k8s/base/templates/`
|
|
|
|
## Port Interface
|
|
|
|
```go
|
|
type TemplateProvider interface {
|
|
SeedRepo(ctx context.Context, owner, repo, templateName string, vars map[string]string) error
|
|
ListTemplates(ctx context.Context) ([]TemplateInfo, error)
|
|
}
|
|
|
|
type TemplateInfo struct {
|
|
Name string
|
|
Description string
|
|
Stack string // "astro", "go", "nextjs", etc.
|
|
}
|
|
```
|
|
|
|
## Template Structure
|
|
|
|
```
|
|
templates/
|
|
├── default/
|
|
│ ├── .woodpecker.yml
|
|
│ ├── .claude/
|
|
│ │ └── CLAUDE.md
|
|
│ └── README.md
|
|
├── astro-landing/
|
|
│ ├── .woodpecker.yml
|
|
│ ├── .claude/
|
|
│ │ └── CLAUDE.md
|
|
│ ├── package.json
|
|
│ ├── astro.config.mjs
|
|
│ ├── src/pages/index.astro
|
|
│ ├── Dockerfile
|
|
│ └── nginx.conf
|
|
└── go-api/
|
|
├── .woodpecker.yml
|
|
├── .claude/
|
|
│ └── CLAUDE.md
|
|
├── go.mod
|
|
├── main.go
|
|
└── Dockerfile
|
|
```
|
|
|
|
## API Usage
|
|
|
|
```json
|
|
POST /project
|
|
{
|
|
"name": "myapp",
|
|
"template": "astro-landing"
|
|
}
|
|
```
|
|
|
|
## Related Topics
|
|
|
|
- [Infrastructure Management](../features/infrastructure.md)
|
|
- [Project Service](./project-service.md)
|