Minimal Process
Layout
Section titled “Layout”ccode.yamlccode/ hello/ generate.ts templates/ greeting.tplProcess
Section titled “Process”import type { Context } from "@ccode/context";
export default function main(ctx: Context) { const model = { name: "Cohesive Code", };
const preview = ctx.renderTemplate("templates/greeting.tpl", model); ctx.println(preview); ctx.generate("templates/greeting.tpl", "generated/greeting.txt", model);}Template
Section titled “Template”Hello {{ data.name }}!ccode run hello/generateExpected result:
- stdout prints
Hello Cohesive Code! output_path/generated/greeting.txtis created
This pattern is useful because the process handles orchestration, the template handles formatting, and the output path is explicit.