From abc5fbed331ea527ccaac0cd4120c4a0650f8bc0 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 24 Jan 2026 15:18:21 +0000 Subject: feat: Simplify phase deliverables and add 'execute' contract type ## 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 - Legacy functions remain for backward compatibility (default to 'simple' type) ### Files Modified - makima/src/llm/phase_guidance.rs - Core deliverable definitions - makima/src/db/models.rs - ContractType enum and Contract methods - makima/src/llm/mod.rs - Export new functions - makima/src/server/handlers/contract_daemon.rs - Use type-aware functions - makima/src/server/handlers/contract_chat.rs - Use type-aware functions Co-Authored-By: Claude Opus 4.5 --- makima/src/server/handlers/contract_chat.rs | 10 +++++----- makima/src/server/handlers/contract_daemon.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'makima/src/server') diff --git a/makima/src/server/handlers/contract_chat.rs b/makima/src/server/handlers/contract_chat.rs index e2adb72..0b6bad1 100644 --- a/makima/src/server/handlers/contract_chat.rs +++ b/makima/src/server/handlers/contract_chat.rs @@ -20,7 +20,7 @@ use crate::db::{ }; use crate::llm::{ all_templates, analyze_task_output, body_to_markdown, format_checklist_markdown, - format_parsed_tasks, get_phase_checklist, parse_tasks_from_breakdown, + format_parsed_tasks, parse_tasks_from_breakdown, claude::{self, ClaudeClient, ClaudeError, ClaudeModel}, groq::{GroqClient, GroqError, Message, ToolCallResponse}, parse_contract_tool_call, templates_for_phase, ContractToolRequest, FileInfo, @@ -455,7 +455,7 @@ fn build_contract_context(contract: &crate::db::models::ContractWithRelations) - }).collect(); let has_repository = !contract.repositories.is_empty(); - let phase_checklist = get_phase_checklist(&c.phase, &file_infos, &task_infos, has_repository); + let phase_checklist = crate::llm::get_phase_checklist_for_type(&c.phase, &file_infos, &task_infos, has_repository, &c.contract_type); // Add phase checklist to context context.push_str("\n"); @@ -1816,8 +1816,8 @@ async fn handle_contract_request( // Update phase (either phase_guard is disabled, or user confirmed) match repository::change_contract_phase_for_owner(pool, contract_id, owner_id, &new_phase).await { Ok(Some(updated)) => { - // Get deliverables for the new phase - let deliverables = crate::llm::get_phase_deliverables(&new_phase); + // Get deliverables for the new phase (using contract type) + let deliverables = crate::llm::get_phase_deliverables_for_type(&new_phase, &contract.contract_type); // Build suggested files list let suggested_files: Vec = deliverables @@ -1963,7 +1963,7 @@ async fn handle_contract_request( }).collect(); let has_repository = !cwr.repositories.is_empty(); - let checklist = get_phase_checklist(&cwr.contract.phase, &file_infos, &task_infos, has_repository); + let checklist = crate::llm::get_phase_checklist_for_type(&cwr.contract.phase, &file_infos, &task_infos, has_repository, &cwr.contract.contract_type); ContractRequestResult { success: true, diff --git a/makima/src/server/handlers/contract_daemon.rs b/makima/src/server/handlers/contract_daemon.rs index 13c5640..5b23831 100644 --- a/makima/src/server/handlers/contract_daemon.rs +++ b/makima/src/server/handlers/contract_daemon.rs @@ -280,7 +280,7 @@ pub async fn get_contract_checklist( Err(_) => false, }; - let checklist = phase_guidance::get_phase_checklist(&contract.phase, &files, &tasks, has_repository); + let checklist = phase_guidance::get_phase_checklist_for_type(&contract.phase, &files, &tasks, has_repository, &contract.contract_type); Json(checklist).into_response() } @@ -319,7 +319,7 @@ pub async fn get_contract_goals( match repository::get_contract_for_owner(pool, id, auth.owner_id).await { Ok(Some(contract)) => { - let deliverables = phase_guidance::get_phase_deliverables(&contract.phase); + let deliverables = phase_guidance::get_phase_deliverables_for_type(&contract.phase, &contract.contract_type); Json(ContractGoalsResponse { description: contract.description, phase: contract.phase, @@ -491,7 +491,7 @@ pub async fn get_suggest_action( .map(|r| !r.is_empty()) .unwrap_or(false); - let checklist = phase_guidance::get_phase_checklist(&contract.phase, &files, &tasks, has_repository); + let checklist = phase_guidance::get_phase_checklist_for_type(&contract.phase, &files, &tasks, has_repository, &contract.contract_type); // Determine suggested action based on checklist let (action, description) = if !checklist.suggestions.is_empty() { -- cgit v1.2.3