Scaffold a Project
easy5 minscaffold-project.ts
You want a ready-to-run project (package.json, tsconfig, a registry of agents, tools and tests) generated from code, e.g. inside your own tooling.
What it shows
- Describe the project as a spec: preset, app, memory, provider, model and package manager
planProject()shows the files without writing,scaffold()writes, installs, formats and commits
The code
scaffold-project.ts
import { planProject, scaffold } from 'create-cogitator-app';
import { join } from 'node:path';
const spec = {
name: 'my-agent',
preset: 'basic',
app: 'script',
memory: 'sqlite',
provider: 'ollama',
model: 'qwen3.5:4b',
packageManager: 'pnpm',
} as const;
const plan = planProject(spec);
console.log(`${plan.files.length} files, recreate with:\n ${plan.command}`);
const result = await scaffold(spec, {
directory: join(process.cwd(), 'my-agent'),
install: false,
git: false,
});
console.log(result.files.join('\n'));
console.log('Dependencies:', Object.keys(result.plan.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