LogoCyanPrint
Architecture

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:

  1. The template identifier is parsed (name, version, registry)
  2. Template metadata is fetched from the Zinc registry
  3. Dependencies are resolved transitively
  4. 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:

  1. Access validated inputs
  2. Generate files and directories
  3. Set file permissions and metadata
  4. 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

StageError TypeHandling
ResolutionTemplate not foundReturn error with suggestions
ResolutionVersion conflictShow dependency tree, suggest resolution
InputValidation failedDisplay errors, prompt for correction
ProcessingProcessor failedReturns error, stops merge pipeline
OutputWrite failureRetry with elevated permissions, suggest manual path

Next Steps