From 6364363d1418728351f252b799d397b756e1f985 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 24 Jan 2026 20:06:28 +0000 Subject: feat: Simplify contract deliverables and add Templates UI ## Backend Changes ### Phase Deliverables Simplified - **Simple contract type**: - Plan phase: Only 'Plan' deliverable (required) - Execute phase: Only 'PR' deliverable (required) - **Specification contract type**: - Research phase: Only 'Research Notes' deliverable (required) - Specify phase: Only 'Requirements Document' deliverable (required) - Plan phase: Only 'Plan' deliverable (required) - Execute phase: Only 'PR' deliverable (required) - Review phase: Only 'Release Notes' deliverable (required) ### New 'execute' Contract Type - Only has 'execute' phase (no plan or review phases) - NO deliverables at all - executes tasks directly - Added to ContractType enum with proper Display/FromStr implementations - Added helper methods: `initial_phase()`, `terminal_phase()` ### API Updates - Added `get_phase_deliverables_for_type()` for contract-type-aware deliverables - Added `get_phase_checklist_for_type()` for contract-type-aware checklists - Added `check_phase_completion_for_type()` for contract-type-aware completion checks - Added `check_deliverables_met()` function for deliverable validation - Added `should_auto_progress()` for autonomous contract progression - Added new ContractToolRequest::CheckDeliverablesMet tool ## Frontend Changes (makima/frontend) ### Templates Page - Add TemplateEditor component for editing phase deliverables - Create Templates page with template card grid layout - Add navigation link in NavStrip - Implement three built-in templates: Simple, Specification, Execute - Support for creating custom templates with configurable phases/deliverables - Templates are persisted to localStorage Co-Authored-By: Claude Opus 4.5 --- makima/src/db/models.rs | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'makima/src/db') diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 58f4da1..0c1d9f2 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -1108,15 +1108,19 @@ pub struct MergeCompleteCheckResponse { pub enum ContractType { /// Simple Plan -> Execute workflow (default) /// - Plan phase: requires a "Plan" document - /// - Execute phase: no documents, fulfills the plan + /// - Execute phase: requires a "PR" document Simple, /// Specification-based development with TDD - /// - Research: gather requirements and context - /// - Specify: write specifications and test cases - /// - Plan: create implementation plan - /// - Execute: implement according to specs - /// - Review: verify against specifications + /// - Research: requires "Research Notes" document + /// - Specify: requires "Requirements Document" + /// - Plan: requires "Plan" document + /// - Execute: requires "PR" document + /// - Review: requires "Release Notes" document Specification, + /// Execute-only workflow with no deliverables + /// - Only has "execute" phase + /// - NO deliverables at all - just execute tasks directly + Execute, } impl Default for ContractType { @@ -1130,6 +1134,7 @@ impl std::fmt::Display for ContractType { match self { ContractType::Simple => write!(f, "simple"), ContractType::Specification => write!(f, "specification"), + ContractType::Execute => write!(f, "execute"), } } } @@ -1141,6 +1146,7 @@ impl std::str::FromStr for ContractType { match s.to_lowercase().as_str() { "simple" => Ok(ContractType::Simple), "specification" => Ok(ContractType::Specification), + "execute" => Ok(ContractType::Execute), _ => Err(format!("Unknown contract type: {}", s)), } } @@ -1347,9 +1353,27 @@ impl Contract { ContractPhase::Execute, ContractPhase::Review, ], + "execute" => vec![ContractPhase::Execute], // Execute-only, single phase _ => vec![ContractPhase::Plan, ContractPhase::Execute], // Default to simple } } + + /// Get the initial phase for this contract type + pub fn initial_phase(&self) -> ContractPhase { + match self.contract_type.as_str() { + "specification" => ContractPhase::Research, + "execute" => ContractPhase::Execute, + _ => ContractPhase::Plan, // simple and default + } + } + + /// Get the terminal phase for this contract type (phase where contract can be completed) + pub fn terminal_phase(&self) -> ContractPhase { + match self.contract_type.as_str() { + "specification" => ContractPhase::Review, + _ => ContractPhase::Execute, // simple and execute both end at execute + } + } } /// Contract repository record from the database -- cgit v1.2.3