rdev/ai-lookup/services/template-provider.md
jordan c59d348040 chore: prepare for composable monorepo template implementation
This commit captures the current state before implementing the composable
monorepo template system. Key changes included:

Infrastructure:
- Add CockroachDB provisioner adapter for database provisioning
- Add Redis provisioner adapter for cache provisioning
- Add build events system with PostgreSQL storage
- Add WebSocket endpoint for real-time build progress

Code agent improvements:
- Fix Claude Code adapter to use default allowed tools instead of dangerously-skip-permissions
- Add context-aware stream closing for cancellation support
- Improve parser tests for edge cases

Build system:
- Add build event constants and metrics
- Remove deprecated git_operations.go (replaced by pod_git_operations.go)
- Add rollback logic for multi-step provisioning operations

Documentation:
- Add composable-monorepo feature documentation
- Add DNS/Cloudflare service documentation
- Update deployment and troubleshooting guides

Cookbooks:
- Add fullstack-app cookbook
- Refactor landing-test with shared library

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

2.0 KiB

Template Provider

Last Updated: 2026-01 Confidence: High

Evolution: This documents the current single-template system. See Composable Monorepo for the upcoming monorepo architecture.

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

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

POST /project
{
    "name": "myapp",
    "template": "astro-landing"
}