Snapshots YAML template content in a new `plan_template_versions` table whenever a plan is created from a template. Plans reference their version via `template_version_id` so existing plans are unaffected by future template file edits. Key changes: - Migration 0006: create `plan_template_versions` table (slug, version, name, content JSON, content_hash SHA-256); add nullable FK `template_version_id` to `agent_plans` - Model `PlanTemplateVersion`: `findOrCreateFromTemplate()` deduplicates identical content by hash; `historyFor()` returns versions newest-first - `AgentPlan`: add `template_version_id` fillable and `templateVersion()` relationship - `PlanTemplateService::createPlan()`: snapshot raw template before variable substitution; store version id and version number in metadata; add `getVersionHistory()` and `getVersion()` public methods - Tests: `TemplateVersionManagementTest` covering model behaviour, plan creation snapshotting, deduplication, history ordering, and service methods Closes #35 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| Feature | ||
| Fixtures | ||
| Unit | ||
| UseCase | ||
| views | ||
| Pest.php | ||
| TestCase.php | ||