Skip to main content

Module template

Module template 

Source
Expand description

Template instantiation system for the task-graph database.

Templates are Snapshot-format JSON files that define reusable task structures. Instantiation creates fresh copies with new IDs while preserving the internal dependency graph, optionally attaching the template root to a parent task.

§Entry and Exit Points

  • Entry points: Root tasks within the template (tasks that have no parent within the template itself). These are the “top” of the template hierarchy.
  • Exit points: Tasks with external dependency targets (references to task IDs not present in the template). These represent integration boundaries.

§Instantiation Flow

  1. Load the template from a Snapshot JSON file
  2. Validate schema compatibility
  3. Detect entry/exit points from the template structure
  4. Remap all IDs to fresh petname-based IDs
  5. Record template metadata (source, original IDs, mapping)
  6. Optionally attach entry points to a parent task
  7. Import into the database via merge mode

Structs§

ImportStats
Simplified import stats for the instantiation result.
InstantiateOptions
Options for controlling template instantiation.
InstantiateResult
Result of a template instantiation operation.
TemplateMetadata
Metadata about a template, extracted during analysis.

Functions§

analyze_template
Analyze a template snapshot to extract metadata without modifying it.
list_templates
List available templates from a directory.