Skip to content

Minimal Process

ccode.yaml
ccode/
hello/
generate.ts
templates/
greeting.tpl
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);
}
Hello {{ data.name }}!
Terminal window
ccode run hello/generate

Expected result:

  • stdout prints Hello Cohesive Code!
  • output_path/generated/greeting.txt is created

This pattern is useful because the process handles orchestration, the template handles formatting, and the output path is explicit.