summaryrefslogtreecommitdiff
path: root/makima/src/llm/templates.rs
blob: 48b75155611add3658bb61a34adbec404aad1180 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Contract type template definitions.
//!
//! Defines the available contract types and their workflow phases.

use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

// =============================================================================
// Contract Type Templates (Workflow Definitions)
// =============================================================================

/// A contract type template defining a workflow
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ContractTypeTemplate {
    /// Unique identifier (e.g., 'simple', 'specification', 'feature-development')
    pub id: String,
    /// Display name
    pub name: String,
    /// What this contract type is for
    pub description: String,
    /// Ordered list of phases in the workflow
    pub phases: Vec<String>,
    /// Starting phase
    pub default_phase: String,
    /// True for built-in types ('simple', 'specification')
    pub is_builtin: bool,
}

/// Get all available contract type templates
pub fn all_contract_types() -> Vec<ContractTypeTemplate> {
    vec![
        simple_contract_type(),
        specification_contract_type(),
        execute_contract_type(),
    ]
}

/// Simple contract type with basic plan/execute workflow
fn simple_contract_type() -> ContractTypeTemplate {
    ContractTypeTemplate {
        id: "simple".to_string(),
        name: "Simple".to_string(),
        description: "A basic workflow for straightforward tasks with planning and execution phases."
            .to_string(),
        phases: vec!["plan".to_string(), "execute".to_string()],
        default_phase: "plan".to_string(),
        is_builtin: true,
    }
}

/// Specification contract type with full research-to-review workflow
fn specification_contract_type() -> ContractTypeTemplate {
    ContractTypeTemplate {
        id: "specification".to_string(),
        name: "Specification".to_string(),
        description: "A comprehensive workflow for complex projects requiring research, specification, planning, execution, and review.".to_string(),
        phases: vec![
            "research".to_string(),
            "specify".to_string(),
            "plan".to_string(),
            "execute".to_string(),
            "review".to_string(),
        ],
        default_phase: "research".to_string(),
        is_builtin: true,
    }
}

/// Execute-only contract type for immediate task execution
fn execute_contract_type() -> ContractTypeTemplate {
    ContractTypeTemplate {
        id: "execute".to_string(),
        name: "Execute".to_string(),
        description: "A minimal workflow with only an execute phase for immediate task execution without planning documents.".to_string(),
        phases: vec!["execute".to_string()],
        default_phase: "execute".to_string(),
        is_builtin: true,
    }
}