# CI Provider (Woodpecker)

**Last Updated:** 2025-01
**Confidence:** High (Planned - see address-the-gaps.md)

## Summary

CIProvider port enables automatic Woodpecker CI activation when projects are created. Eliminates manual UI clicks to activate repos.

**Key Facts:**
- Activates repos via Woodpecker API on project creation
- Can trigger manual builds
- JWT token authentication
- Graceful fallback if activation fails (logs warning, adds manual step)

**File Pointers:**
- Port: `internal/port/ci_provider.go`
- Adapter: `internal/adapter/woodpecker/client.go`
- Integration: `internal/service/project_infra.go`

## Port Interface

```go
type CIProvider interface {
    ActivateRepo(ctx context.Context, forgeRemoteID int64) error
    DeactivateRepo(ctx context.Context, owner, name string) error
    TriggerBuild(ctx context.Context, owner, name, branch string) (int64, error)
}
```

## Configuration

```
WOODPECKER_URL=https://ci.threesix.ai
WOODPECKER_API_TOKEN=<jwt token from .secrets>
```

## Integration Flow

1. `ProjectInfraService.CreateProject()` creates Gitea repo
2. Gets repo ID from Gitea
3. Calls `ci.ActivateRepo(ctx, repoID)`
4. Woodpecker creates webhook in Gitea
5. Future pushes trigger builds automatically

## Related Topics

- [Infrastructure Management](../features/infrastructure.md)
- [Project Service](./project-service.md)
