LogoCyanPrint

Test Templates Locally

Test your template during development without publishing

Test Templates Locally

The try command lets you test templates during development without publishing to the registry. This provides a fast feedback loop: write code, test, iterate.

Basic Usage

cyanprint try template <template_path> <output_path>
ArgumentDescription
template_pathPath to template directory (containing cyan.yaml)
output_pathDirectory for generated output

Quick Start

Create Template Directory

cyan.yaml
index.ts
Dockerfile
package.json
README.md

Run Try Command

cyanprint try template . ./output

This command will:

  1. Build the template Docker image automatically
  2. Start the coordinator daemon (if needed)
  3. Prompt for template questions
  4. Generate the project

Check Output

ls ./output

How It Works

The try command automates the full development workflow:

cyan.yaml ──► Docker Build ──► Coordinator ──► Template Execution ──► Output
  1. Build: Creates the template image from your cyan.yaml configuration
  2. Coordinate: Starts a local coordinator on port 9000
  3. Execute: Runs your template logic with interactive prompts
  4. Generate: Writes files to the output directory

The try command builds images automatically—you don't need to run docker build manually.

Command Options

Keep Containers

Preserve containers after execution for debugging:

cyanprint try template . ./output --keep-containers

Useful when:

  • Inspecting container state
  • Debugging build issues
  • Checking mounted volumes

Skip Daemon Autostart

Use an already-running coordinator:

cyanprint try template . ./output --disable-daemon-autostart

Custom Coordinator

Connect to a different coordinator endpoint:

cyanprint try template . ./output -c http://coordinator.example.com:9000

Development Workflow

Iterative Development

  1. Write your template logic in cyan/index.ts
  2. Test with cyanprint try template . ./output
  3. Review generated files in ./output
  4. Iterate by modifying code and re-running
# After making changes
rm -rf ./output
cyanprint try template . ./output

For hot-reloading during development, see Dev Mode which enables live code updates without rebuilding.

Testing Different Inputs

Create multiple output directories to test different configurations:

Test with TypeScript configuration:

# Test with TypeScript configuration
cyanprint try template . ./output-ts
# Review TypeScript output
ls ./output-ts
cat ./output-ts/package.json

Test with Python configuration:

# Test with Python configuration
cyanprint try template . ./output-python
# Review Python output
ls ./output-python
cat ./output-python/pyproject.toml

Test with C# configuration:

# Test with C# configuration
cyanprint try template . ./output-csharp
# Review C# output
ls ./output-csharp
cat ./output-csharp/Project.csproj

Trying Group Templates

Group templates (meta-templates) combine multiple published templates:

cyanprint try group <group_path> <output_path>

Groups don't require building because they reference published templates from the registry.

Next Steps