Expand description
Task template system for Ralph.
Templates provide pre-filled task fields for common patterns.
Built-in templates are embedded; custom templates can be added to .ralph/templates/.
Responsibilities:
- Define built-in templates for common task types (bug, feature, refactor, test, docs).
- Load templates from
.ralph/templates/directory (custom overrides). - Merge template fields with user-provided options.
- Validate templates and report warnings for unknown variables.
Not handled here:
- Template application to task creation (see
crate::commands::task). - CLI argument parsing (see
crate::cli::task).
Invariants/assumptions:
- Template names are case-sensitive and must be valid filenames.
- Custom templates override built-in templates with the same name.
- Template JSON must parse to a valid Task struct (partial tasks allowed).
- Unknown variables produce warnings; strict mode fails on unknown variables.
Re-exports§
pub use loader::LoadedTemplate;pub use loader::TemplateInfo;pub use loader::TemplateSource;pub use loader::list_templates;pub use loader::load_template;pub use loader::load_template_with_context;pub use loader::load_template_with_context_legacy;pub use merge::format_template_context;pub use merge::merge_template_with_options;pub use variables::TemplateContext;pub use variables::TemplateValidation;pub use variables::TemplateWarning;pub use variables::detect_context;pub use variables::detect_context_with_warnings;pub use variables::substitute_variables;pub use variables::substitute_variables_in_task;pub use variables::validate_task_template;