Skip to main content

ralph/template/
mod.rs

1//! Task template system for Ralph.
2//!
3//! Templates provide pre-filled task fields for common patterns.
4//! Built-in templates are embedded; custom templates can be added to `.ralph/templates/`.
5//!
6//! Responsibilities:
7//! - Define built-in templates for common task types (bug, feature, refactor, test, docs).
8//! - Load templates from `.ralph/templates/` directory (custom overrides).
9//! - Merge template fields with user-provided options.
10//! - Validate templates and report warnings for unknown variables.
11//!
12//! Not handled here:
13//! - Template application to task creation (see `crate::commands::task`).
14//! - CLI argument parsing (see `crate::cli::task`).
15//!
16//! Invariants/assumptions:
17//! - Template names are case-sensitive and must be valid filenames.
18//! - Custom templates override built-in templates with the same name.
19//! - Template JSON must parse to a valid Task struct (partial tasks allowed).
20//! - Unknown variables produce warnings; strict mode fails on unknown variables.
21
22pub mod builtin;
23pub mod loader;
24pub mod merge;
25pub mod variables;
26
27pub use loader::{
28    LoadedTemplate, TemplateInfo, TemplateSource, list_templates, load_template,
29    load_template_with_context, load_template_with_context_legacy,
30};
31pub use merge::{format_template_context, merge_template_with_options};
32pub use variables::{
33    TemplateContext, TemplateValidation, TemplateWarning, detect_context,
34    detect_context_with_warnings, substitute_variables, substitute_variables_in_task,
35    validate_task_template,
36};