Skip to content

Getting Started

Cohesive Code is an AI-enabled code generation CLI. It runs TypeScript processes from a workspace, renders Gonja templates, parses JSON and OpenAPI documents, and tracks generated artifacts that need human or agent adjustment.

Experimental stage: Cohesive Code is not recommended for use yet. The project is unstable, changing constantly, and may introduce breaking changes to interfaces, generated support files, accelerator state behavior, and CLI commands without notice.

Install the wrapper script to ~/.local/bin/ccode:

Terminal window
curl -fsSL https://raw.githubusercontent.com/cohesivestack/ccode/master/installer/install.sh | bash

From a repository clone, you can run the installer directly:

Terminal window
bash installer/install.sh

The wrapper resolves the binary version for each workspace and caches release binaries under ~/.cache/ccode/releases.

Create the project support files with an explicit version:

Terminal window
ccode init ccode --version v0.1.0

The default layout is:

ccode.yaml
ccode/
tsconfig.json
.ccode/
.gitignore
accelerators/
build/
lib/
context.ts
openapi.ts

ccode init writes the configuration file when it is missing, refreshes generated support files under .ccode/lib/, preserves an existing tsconfig.json, clears .ccode/build/, and leaves accelerator state untouched.

Create a TypeScript process under ccode_path. The process must export a default function with one Context parameter.

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);
}

Create the template:

Hello {{ data.name }}!

Recommended layout:

ccode/
hello/
generate.ts
templates/
greeting.tpl

Invoke the process without the .ts extension:

Terminal window
ccode run hello/generate

The runtime compiles the TypeScript process, executes it inside the Go runner, prints the rendered preview, and writes generated/greeting.txt under output_path.

  • Read Project Layout before building a real workspace.
  • Read Processes for the TypeScript process contract.
  • Read Accelerators before generating files that should be adjusted by a person or agent.
  • Read AI Skill Index if you are preparing a skill or agent workflow.