Execution Flow
Understanding how templates, processors, and plugins execute in CyanPrint
Execution Flow
This document explains how CyanPrint executes templates, processors, and plugins through the Boron coordinator using containerized environments.
Overview
When a user runs a command like cyanprint create <template_ref> [path], the following high-level flow occurs:
Detailed Execution Phases
Phase 1: Template Resolution
The CLI first resolves the requested template:
During this phase:
- The template identifier is parsed (name, version, registry)
- Template metadata is fetched from the Zinc registry
- Dependencies are resolved transitively
- Input schema is retrieved for validation
Phase 2: Input Collection
Once the template is resolved, inputs are collected:
Inputs are collected through interactive prompts driven by the template's inquirer schema. The template defines the questions and validation rules, and the SDK handles user interaction.
Phase 3: Container Scheduling
Boron manages container execution:
Phase 4: Template Execution
Inside the container, the template executes:
The template uses the Helium SDK to:
- Access validated inputs
- Generate files and directories
- Set file permissions and metadata
- Return a virtual file tree
Phase 5: Processor Pipeline
Processors transform the template output in parallel:
Processors are primarily templaters that perform file transformations:
- Template engines: Handlebars, Mustache, Jinja2, etc.
- Syntax transformers: TypeScript compiler, Sass, etc.
- File processors: Copy, rename, organize files
Formatters, linters, and validators run in the Plugin stage (Phase 6), not as processors.
Phase 6: Plugin Application
Plugins can modify the final output:
Phase 7: Output Streaming
Results are streamed back to the client:
Container Lifecycle
Error Handling
| Stage | Error Type | Handling |
|---|---|---|
| Resolution | Template not found | Return error with suggestions |
| Resolution | Version conflict | Show dependency tree, suggest resolution |
| Input | Validation failed | Display errors, prompt for correction |
| Processing | Processor failed | Returns error, stops merge pipeline |
| Output | Write failure | Retry with elevated permissions, suggest manual path |
Next Steps
- Learn about specific Repositories
- Set up your Development Environment
- Return to Architecture Overview