php-agentic/Models
Clotho 474f96ee5f
Some checks failed
CI / PHP 8.3 (pull_request) Failing after 3s
CI / PHP 8.4 (pull_request) Failing after 3s
feat: add template version management (#35)
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>
2026-02-23 15:25:22 +00:00
..
AgentApiKey.php refactor: add Builder return types to all Eloquent query scopes 2026-02-23 05:32:38 +00:00
AgentPhase.php perf: replace N+1 find() with whereIn batch lookup in checkDependencies() 2026-02-23 10:40:00 +00:00
AgentPlan.php feat: add template version management (#35) 2026-02-23 15:25:22 +00:00
AgentSession.php refactor: add Builder return types to all Eloquent query scopes 2026-02-23 05:32:38 +00:00
AgentWorkspaceState.php refactor: add Builder return types to all Eloquent query scopes 2026-02-23 05:32:38 +00:00
PlanTemplateVersion.php feat: add template version management (#35) 2026-02-23 15:25:22 +00:00
Prompt.php refactor: add Builder return types to all Eloquent query scopes 2026-02-23 05:32:38 +00:00
PromptVersion.php refactor: update namespaces for L1/L2 package convention 2026-01-27 17:34:46 +00:00
Task.php refactor: add Builder return types to all Eloquent query scopes 2026-02-23 05:32:38 +00:00
WorkspaceState.php refactor: add Builder return types to all Eloquent query scopes 2026-02-23 05:32:38 +00:00