use crate::PromptTemplate;
pub const BUILTIN_TEMPLATE_COUNT: usize = 12;
pub fn builtin_templates() -> Vec<PromptTemplate> {
vec![
PromptTemplate::new(
"init/analyze_repo",
include_str!("../templates/init/analyze_repo.j2"),
),
PromptTemplate::new("init/system", include_str!("../templates/init/system.j2")),
PromptTemplate::new(
"init/setup_project",
include_str!("../templates/init/setup_project.j2"),
),
PromptTemplate::new("plan/system", include_str!("../templates/plan/system.j2")),
PromptTemplate::new("plan/approve", include_str!("../templates/plan/approve.j2")),
PromptTemplate::new(
"plan/verification",
include_str!("../templates/plan/verification.j2"),
),
PromptTemplate::new("run/system", include_str!("../templates/run/system.j2")),
PromptTemplate::new(
"run/dev_phase",
include_str!("../templates/run/dev_phase.j2"),
),
PromptTemplate::new("run/review", include_str!("../templates/run/review.j2")),
PromptTemplate::new("run/verify", include_str!("../templates/run/verify.j2")),
PromptTemplate::new("run/resume", include_str!("../templates/run/resume.j2")),
PromptTemplate::new(
"run/create_pr",
include_str!("../templates/run/create_pr.j2"),
),
]
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_should_return_all_builtin_templates() {
let templates = builtin_templates();
assert_eq!(templates.len(), BUILTIN_TEMPLATE_COUNT);
}
#[test]
fn test_should_include_all_expected_template_names() {
let templates = builtin_templates();
let names: Vec<&str> = templates.iter().map(|t| t.name.as_str()).collect();
let expected = [
"init/analyze_repo",
"init/system",
"init/setup_project",
"plan/system",
"plan/approve",
"plan/verification",
"run/system",
"run/dev_phase",
"run/review",
"run/verify",
"run/resume",
"run/create_pr",
];
for name in &expected {
assert!(names.contains(name), "Missing template: {name}");
}
}
#[test]
fn test_should_have_non_empty_content_for_all_templates() {
let templates = builtin_templates();
for template in &templates {
assert!(
!template.content.is_empty(),
"Template '{}' has empty content",
template.name,
);
}
}
}