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>
| Argument | Description |
|---|---|
template_path | Path to template directory (containing cyan.yaml) |
output_path | Directory for generated output |
Quick Start
Create Template Directory
Run Try Command
cyanprint try template . ./output
This command will:
- Build the template Docker image automatically
- Start the coordinator daemon (if needed)
- Prompt for template questions
- 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
- Build: Creates the template image from your
cyan.yamlconfiguration - Coordinate: Starts a local coordinator on port 9000
- Execute: Runs your template logic with interactive prompts
- 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
- Write your template logic in
cyan/index.ts - Test with
cyanprint try template . ./output - Review generated files in
./output - Iterate by modifying code and re-running
# After making changesrm -rf ./outputcyanprint 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 configurationcyanprint try template . ./output-ts# Review TypeScript outputls ./output-tscat ./output-ts/package.json
Test with Python configuration:
# Test with Python configurationcyanprint try template . ./output-python# Review Python outputls ./output-pythoncat ./output-python/pyproject.toml
Test with C# configuration:
# Test with C# configurationcyanprint try template . ./output-csharp# Review C# outputls ./output-csharpcat ./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
- Dev Mode - Hot-reloading during development
- Push to Registry - Publish your template
- Add Plugins - Enhance with post-processing