Scaffold a Project
easy5 minscaffold-project.ts
You want a ready-to-run project — package.json, tsconfig, an agent and a tool — generated from code, e.g. inside your own tooling.
What it shows
- Call
scaffold()fromcreate-cogitator-appwith a template, provider and package manager
The code
scaffold-project.ts
import { scaffold } from 'create-cogitator-app';
import { readFileSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
const projectDir = join(process.cwd(), 'my-agent');
await scaffold({
name: 'my-agent',
path: projectDir,
template: 'basic',
provider: 'ollama',
packageManager: 'pnpm',
docker: false,
git: false,
});
console.log(readdirSync(projectDir).sort());
const pkg = JSON.parse(readFileSync(join(projectDir, 'package.json'), 'utf-8')) as {
dependencies: Record<string, string>;
};
console.log('Dependencies:', Object.keys(pkg.dependencies).join(', '));Run it
install · bash
pnpm add create-cogitator-apprun · bash
npx tsx scaffold-project.tsOr run the full example from a clone of the repository (keys in .env):
repository · bash
npx tsx examples/create-cogitator-app/scaffold-programmatic.ts