Skip to main content

Module spec_template

Module spec_template 

Source
Expand description

Spec template system for creating specs from reusable templates.

Templates are markdown files with YAML frontmatter containing variable definitions. They can be stored in .chant/templates/ (project) or ~/.config/chant/templates/ (global).

§Template Format

---
name: add-feature
description: Add a new feature with tests
variables:
  - name: feature_name
    description: Name of the feature
    required: true
  - name: module
    description: Target module
    default: core
type: code
labels:
  - feature
---

# Add {{feature_name}} feature

## Problem

The {{module}} module needs {{feature_name}} functionality.

Structs§

SpecTemplate
A spec template with its metadata and content
TemplateFrontmatter
Template frontmatter containing metadata and variable definitions
TemplateVariable
A variable definition within a template

Enums§

TemplateSource
Where a template was loaded from

Constants§

GLOBAL_TEMPLATES_DIR
Directory name for global templates
PROJECT_TEMPLATES_DIR
Directory name for templates within .chant/

Functions§

find_template
Find a template by name (project templates take precedence)
global_templates_dir
Get the path to the global templates directory
load_all_templates
Load all available templates (project templates override global ones with the same name)
parse_var_args
Parse a list of “key=value” strings into a HashMap
project_templates_dir
Get the path to the project templates directory