# Task 006: Site Config And Publishing Script Versioning Development description: Build Admin-managed target site configuration with versioned publishing YAML and transformation scripts that can be activated, audited, and rolled back. ## Implementation Details - Backend endpoints: - `POST /api/sites` - `GET /api/sites` - `GET /api/sites/{site_id}` - `PATCH /api/sites/{site_id}` - `GET /api/sites/{site_id}/publishing-config/versions` - `POST /api/sites/{site_id}/publishing-config/versions` - `POST /api/sites/{site_id}/publishing-config/versions/{version_id}/activate` - `POST /api/sites/{site_id}/publishing-config/versions/{version_id}/rollback` - Site config fields: - Repository URL. - Production branch. - Content format and path templates. - Asset path template. - Frontmatter mapping. - Generic preview renderer selection. - Editorial, SEO, source, visual, and publishing rules. - Script/config versions store: - YAML config. - Transform script text. - Author. - Timestamp. - Diff from previous version. - Rollback target. - Activation timestamp. - No second Admin approval is required in v1. ## Public Interface - Admin can create and activate a site publishing config version. - Editor can read active site config but cannot mutate it. ## Acceptance Criteria - [ ] TDD pre-requirement: before implementation, write one failing Admin API test for creating a new publishing config version and one failing Editor denial test; proceed one behavior at a time and record evidence in `Result`. - [ ] Admin can create a target site with Git-backed publishing fields. - [ ] Admin can create a new YAML/script version and activate it. - [ ] Version creation records author, timestamp, diff, and rollback target. - [ ] Rollback activates a previous version and writes an audit event. - [ ] Editor can view active site config but cannot create, activate, or roll back versions. - [ ] Frontend Admin UI displays version history and active version. ## Verification - Run backend site config API tests. - Run frontend Admin site config tests. - Manually create, activate, and roll back a site config in Docker Compose. ## Result - Status: Pending execution. - TDD plan: To be filled during execution. - Red evidence: To be filled during execution. - Green evidence: To be filled during execution. - Refactor notes: To be filled during execution. - Verification output: To be filled during execution.