create-cogitator-app 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # create-cogitator-app
2
2
 
3
- Interactive CLI scaffolder for [Cogitator](https://cogitator.dev) — creates production-ready AI agent projects in seconds.
3
+ Interactive scaffolder for [Cogitator](https://cogitator.app) — creates a ready-to-run TypeScript AI agent project from one of six templates.
4
+
5
+ Guide: [cogitator.app/docs/getting-started/scaffolding](https://cogitator.app/docs/getting-started/scaffolding)
4
6
 
5
7
  ## Usage
6
8
 
@@ -11,44 +13,88 @@ npx create-cogitator-app
11
13
  # With arguments
12
14
  npx create-cogitator-app my-project --template basic --provider openai
13
15
 
14
- # Skip prompts with flags
16
+ # Skip every prompt with flags
15
17
  npx create-cogitator-app my-project -t swarm -p ollama --pm pnpm --docker --no-git
18
+
19
+ # Accept the defaults for everything not given
20
+ npx create-cogitator-app -y
21
+ npx create-cogitator-app my-project -p openai --yes
16
22
  ```
17
23
 
24
+ Prompts are shown only for values not given on the command line: project directory, template, provider, package manager, Docker Compose and git. With `-y` / `--yes` nothing is asked and the defaults fill the gaps: `my-agents`, `basic`, `ollama`, the detected package manager, Docker Compose on, git on. The target directory must be empty or not exist. After writing the files the scaffolder runs `<pm> install` and, unless disabled, creates a git repository with an initial commit.
25
+
26
+ Requires Node.js 22.12+.
27
+
18
28
  ## Templates
19
29
 
20
- | Template | Description |
21
- | ------------ | ----------------------------------------- |
22
- | `basic` | Single agent with tools |
23
- | `memory` | Agent with Redis-backed persistent memory |
24
- | `swarm` | Multi-agent hierarchical swarm |
25
- | `workflow` | DAG workflow with sequential agent nodes |
26
- | `api-server` | Express REST API with Cogitator backend |
27
- | `nextjs` | Next.js chat app with streaming UI |
30
+ | Template | Description |
31
+ | ------------ | ------------------------------------------------------------------------ |
32
+ | `basic` | Single agent with tools |
33
+ | `memory` | Agent with Redis-backed persistent memory (`@cogitator-ai/redis`) |
34
+ | `swarm` | Hierarchical swarm of researcher, writer and reviewer agents |
35
+ | `workflow` | DAG workflow (`@cogitator-ai/workflows`) with sequential agent nodes |
36
+ | `api-server` | Express REST API with `CogitatorServer` from `@cogitator-ai/express` |
37
+ | `nextjs` | Next.js App Router chat app with a streaming `/api/chat` route, Tailwind |
28
38
 
29
39
  ## CLI Flags
30
40
 
31
- | Flag | Shorthand | Description |
32
- | -------------------------- | --------- | -------------------------------------------------------- |
33
- | `--template <name>` | `-t` | Template to use |
34
- | `--provider <name>` | `-p` | LLM provider (`ollama`, `openai`, `anthropic`, `google`) |
35
- | `--pm <name>` | | Package manager (`pnpm`, `npm`, `yarn`, `bun`) |
36
- | `--docker` / `--no-docker` | | Include Docker Compose |
37
- | `--git` / `--no-git` | | Initialize git repository |
41
+ | Flag | Shorthand | Description |
42
+ | -------------------------- | --------- | --------------------------------------------------------- |
43
+ | `[name]` | | Project directory (its basename becomes the package name) |
44
+ | `--template <name>` | `-t` | Template to use |
45
+ | `--provider <name>` | `-p` | LLM provider (`ollama`, `openai`, `anthropic`, `google`) |
46
+ | `--pm <name>` | | Package manager (`pnpm`, `npm`, `yarn`, `bun`) |
47
+ | `--docker` / `--no-docker` | | Include Docker Compose (Redis, Postgres, plus Ollama) |
48
+ | `--git` / `--no-git` | | Initialize git repository |
49
+ | `--yes` | `-y` | Don't prompt; use the defaults for every missing value |
50
+
51
+ Unknown values for `--template`, `--provider` and `--pm` are ignored and asked for interactively (or replaced by the default with `--yes`). The package manager prompt defaults to the one that invoked the scaffolder (`npm_config_user_agent`), falling back to `pnpm`.
38
52
 
39
53
  ## Providers
40
54
 
41
- | Provider | Default Model | Requires |
42
- | ----------- | ------------------- | ---------------------------------------------- |
43
- | `ollama` | `qwen3:8b` | [Ollama](https://ollama.com) installed locally |
44
- | `openai` | `gpt-6.1-sol` | `OPENAI_API_KEY` |
45
- | `anthropic` | `claude-sonnet-5-5` | `ANTHROPIC_API_KEY` |
46
- | `google` | `gemini-3.8-flash` | `GOOGLE_API_KEY` |
55
+ | Provider | Default Model | Requires |
56
+ | ----------- | ------------------- | ---------------------------------------------------------------------------------- |
57
+ | `ollama` | `qwen3:8b` | [Ollama](https://ollama.com) (`OLLAMA_BASE_URL`, default `http://localhost:11434`) |
58
+ | `openai` | `gpt-6.1-sol` | `OPENAI_API_KEY` |
59
+ | `anthropic` | `claude-sonnet-5-5` | `ANTHROPIC_API_KEY` |
60
+ | `google` | `gemini-3.8-flash` | `GOOGLE_API_KEY` |
61
+
62
+ ## Generated Project Structure
63
+
64
+ Every project gets these files (shown for the `basic` template):
65
+
66
+ ```
67
+ my-project/
68
+ ├── src/
69
+ │ ├── index.ts # Main entry point
70
+ │ └── tools.ts # Tool definitions
71
+ ├── package.json # dev / start / build / typecheck scripts
72
+ ├── tsconfig.json # not for nextjs, which ships its own
73
+ ├── cogitator.yml # provider and default model
74
+ ├── .env.example # the provider's key (and REDIS_URL for memory)
75
+ ├── .gitignore
76
+ ├── README.md
77
+ ├── pnpm-workspace.yaml # pnpm only
78
+ └── docker-compose.yml # with --docker
79
+ ```
80
+
81
+ Template-specific sources:
82
+
83
+ | Template | Files |
84
+ | ------------ | -------------------------------------------------------------------------------------------------- |
85
+ | `basic` | `src/index.ts`, `src/tools.ts` |
86
+ | `memory` | `src/index.ts`, `src/tools.ts` |
87
+ | `swarm` | `src/index.ts`, `src/tools.ts`, `src/agents/{researcher,writer,reviewer}.ts` |
88
+ | `workflow` | `src/index.ts`, `src/agents.ts` |
89
+ | `api-server` | `src/index.ts`, `src/agents.ts` |
90
+ | `nextjs` | `src/lib/agent.ts`, `src/app/api/chat/route.ts`, `src/app/{page,layout}.tsx`, Next/Tailwind config |
91
+
92
+ The generated code configures `Cogitator` in `src/` itself, reading the provider key from the environment. Copy `.env.example` to `.env` and fill it in, then run `pnpm dev` (or `npm run dev`, `yarn dev`, `bun dev`).
47
93
 
48
94
  ## Programmatic API
49
95
 
50
96
  ```ts
51
- import { scaffold, parseArgs } from 'create-cogitator-app';
97
+ import { scaffold, parseArgs, collectOptions } from 'create-cogitator-app';
52
98
  import type { ProjectOptions } from 'create-cogitator-app';
53
99
 
54
100
  const options: ProjectOptions = {
@@ -62,22 +108,15 @@ const options: ProjectOptions = {
62
108
  };
63
109
 
64
110
  await scaffold(options);
111
+
112
+ // or: parse CLI arguments and prompt for the rest
113
+ const fromCli = await collectOptions(parseArgs(process.argv.slice(2)));
114
+ await scaffold(fromCli);
65
115
  ```
66
116
 
67
- ## Generated Project Structure
117
+ `scaffold()` writes the files, installs dependencies with `packageManager` and initializes git when `git` is `true`; it throws when `path` exists and is not empty.
68
118
 
69
- ```
70
- my-project/
71
- ├── src/
72
- │ ├── index.ts # Main entry point
73
- │ └── tools.ts # Tool definitions
74
- ├── package.json
75
- ├── tsconfig.json
76
- ├── cogitator.yml # Cogitator configuration
77
- ├── .env.example
78
- ├── .gitignore
79
- └── README.md
80
- ```
119
+ Other exports: `getTemplate(name)` and `templateChoices` (template generators and their labels), `detectPackageManager()`, `devCommand(pm)`, `defaultModels`, `providerConfig(provider)` and `providerEnvKey(provider)`, and the types `ProjectOptions`, `Template`, `LLMProvider`, `PackageManager` and `TemplateFile`.
81
120
 
82
121
  ## License
83
122
 
package/dist/index.js CHANGED
@@ -2,17 +2,31 @@
2
2
 
3
3
  // src/index.ts
4
4
  import * as p3 from "@clack/prompts";
5
+ import { readFileSync } from "fs";
5
6
  import pc2 from "picocolors";
6
7
 
7
8
  // src/utils/logger.ts
8
9
  import pc from "picocolors";
9
- function banner() {
10
+ var MIN_INNER_WIDTH = 39;
11
+ function banner(version) {
12
+ const title = "create-cogitator-app";
13
+ const tagline = "Build AI agents in minutes";
14
+ const versionLabel = `v${version}`;
15
+ const lines = [
16
+ {
17
+ text: `${pc.bold(pc.white(title))} ${pc.dim(versionLabel)}`,
18
+ width: title.length + 2 + versionLabel.length
19
+ },
20
+ { text: pc.dim(tagline), width: tagline.length }
21
+ ];
22
+ const inner = Math.max(MIN_INNER_WIDTH, ...lines.map((line) => line.width + 4));
10
23
  const art = [
11
24
  "",
12
- ` ${pc.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}`,
13
- ` ${pc.cyan("\u2551")} ${pc.bold(pc.white("create-cogitator-app"))} ${pc.dim("v0.1.0")} ${pc.cyan("\u2551")}`,
14
- ` ${pc.cyan("\u2551")} ${pc.dim("Build AI agents in minutes")} ${pc.cyan("\u2551")}`,
15
- ` ${pc.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}`,
25
+ ` ${pc.cyan(`\u2554${"\u2550".repeat(inner)}\u2557`)}`,
26
+ ...lines.map(
27
+ (line) => ` ${pc.cyan("\u2551")} ${line.text}${" ".repeat(inner - 2 - line.width)}${pc.cyan("\u2551")}`
28
+ ),
29
+ ` ${pc.cyan(`\u255A${"\u2550".repeat(inner)}\u255D`)}`,
16
30
  ""
17
31
  ];
18
32
  console.log(art.join("\n"));
@@ -70,6 +84,9 @@ function providerConfig(provider) {
70
84
  }
71
85
  }
72
86
 
87
+ // src/templates/versions.ts
88
+ var ZOD_VERSION = "^4.6.5";
89
+
73
90
  // src/templates/basic.ts
74
91
  var basicTemplate = {
75
92
  files(options) {
@@ -138,7 +155,7 @@ var basicTemplate = {
138
155
  dependencies() {
139
156
  return {
140
157
  "@cogitator-ai/core": "latest",
141
- zod: "^3.23.0"
158
+ zod: ZOD_VERSION
142
159
  };
143
160
  },
144
161
  devDependencies() {
@@ -247,7 +264,7 @@ var memoryTemplate = {
247
264
  "@cogitator-ai/core": "latest",
248
265
  "@cogitator-ai/memory": "latest",
249
266
  "@cogitator-ai/redis": "latest",
250
- zod: "^3.23.0"
267
+ zod: ZOD_VERSION
251
268
  };
252
269
  },
253
270
  devDependencies() {
@@ -368,7 +385,7 @@ var swarmTemplate = {
368
385
  ` })`,
369
386
  ``,
370
387
  ` console.log('Result:', result.output)`,
371
- ` console.log('Strategy:', result.strategy)`,
388
+ ` console.log('Strategy:', team.strategyType)`,
372
389
  ``,
373
390
  ` await team.close()`,
374
391
  `}`,
@@ -388,7 +405,7 @@ var swarmTemplate = {
388
405
  return {
389
406
  "@cogitator-ai/core": "latest",
390
407
  "@cogitator-ai/swarms": "latest",
391
- zod: "^3.23.0"
408
+ zod: ZOD_VERSION
392
409
  };
393
410
  },
394
411
  devDependencies() {
@@ -451,7 +468,7 @@ var workflowTemplate = {
451
468
  providerConfig(options.provider),
452
469
  `})`,
453
470
  ``,
454
- `interface WorkflowState {`,
471
+ `type WorkflowState = {`,
455
472
  ` input: string`,
456
473
  ` analysis?: string`,
457
474
  ` processed?: string`,
@@ -512,7 +529,7 @@ var workflowTemplate = {
512
529
  return {
513
530
  "@cogitator-ai/core": "latest",
514
531
  "@cogitator-ai/workflows": "latest",
515
- zod: "^3.23.0"
532
+ zod: ZOD_VERSION
516
533
  };
517
534
  },
518
535
  devDependencies() {
@@ -617,7 +634,7 @@ var apiServerTemplate = {
617
634
  "@cogitator-ai/core": "latest",
618
635
  "@cogitator-ai/express": "latest",
619
636
  express: "^4.21.0",
620
- zod: "^3.23.0"
637
+ zod: ZOD_VERSION
621
638
  };
622
639
  },
623
640
  devDependencies() {
@@ -859,7 +876,7 @@ var nextjsTemplate = {
859
876
  next: "^15.0.0",
860
877
  react: "^19.0.0",
861
878
  "react-dom": "^19.0.0",
862
- zod: "^3.23.0"
879
+ zod: ZOD_VERSION
863
880
  };
864
881
  },
865
882
  devDependencies() {
@@ -974,78 +991,83 @@ function parseArgs(args) {
974
991
  }
975
992
  return parsed;
976
993
  }
977
- async function collectOptions(args) {
978
- const rawName = args.name || await p.text({
979
- message: "Where should we create your project?",
980
- placeholder: "./my-agents",
981
- defaultValue: "my-agents",
982
- validate: (value) => {
983
- if (value && !value.trim()) return "Project name is required";
984
- return void 0;
985
- }
986
- });
987
- if (p.isCancel(rawName)) {
994
+ var defaultAnswers = {
995
+ name: "my-agents",
996
+ template: "basic",
997
+ provider: "ollama",
998
+ docker: true,
999
+ git: true
1000
+ };
1001
+ function unlessCancelled(answer) {
1002
+ if (p.isCancel(answer)) {
988
1003
  p.cancel("Operation cancelled.");
989
1004
  process.exit(0);
990
1005
  }
1006
+ return answer;
1007
+ }
1008
+ async function collectOptions(args) {
1009
+ const interactive = !args.yes;
1010
+ const rawName = args.name || (interactive ? unlessCancelled(
1011
+ await p.text({
1012
+ message: "Where should we create your project?",
1013
+ placeholder: `./${defaultAnswers.name}`,
1014
+ defaultValue: defaultAnswers.name,
1015
+ validate: (value) => {
1016
+ if (value && !value.trim()) return "Project name is required";
1017
+ return void 0;
1018
+ }
1019
+ })
1020
+ ) : defaultAnswers.name);
991
1021
  const name = rawName.trim();
992
1022
  const projectName = path.basename(path.normalize(name).replace(/^\.\//, "").replace(/^\.\\/, ""));
993
1023
  const projectPath = path.resolve(process.cwd(), name);
994
- const template = args.template || await p.select({
995
- message: "Which template would you like?",
996
- options: templateChoices
997
- });
998
- if (p.isCancel(template)) {
999
- p.cancel("Operation cancelled.");
1000
- process.exit(0);
1001
- }
1002
- const provider = args.provider || await p.select({
1003
- message: "Which LLM provider?",
1004
- options: [
1005
- {
1006
- value: "ollama",
1007
- label: "Ollama",
1008
- hint: "local, free \u2014 requires Ollama installed"
1009
- },
1010
- { value: "openai", label: "OpenAI", hint: "GPT-4o" },
1011
- { value: "anthropic", label: "Anthropic", hint: "Claude Sonnet" },
1012
- { value: "google", label: "Google Gemini", hint: "Gemini 2.5 Flash" }
1013
- ]
1014
- });
1015
- if (p.isCancel(provider)) {
1016
- p.cancel("Operation cancelled.");
1017
- process.exit(0);
1018
- }
1019
- const packageManager = args.packageManager || await p.select({
1020
- message: "Package manager?",
1021
- options: [
1022
- { value: "pnpm", label: "pnpm" },
1023
- { value: "npm", label: "npm" },
1024
- { value: "yarn", label: "yarn" },
1025
- { value: "bun", label: "bun" }
1026
- ],
1027
- initialValue: detectPackageManager()
1028
- });
1029
- if (p.isCancel(packageManager)) {
1030
- p.cancel("Operation cancelled.");
1031
- process.exit(0);
1032
- }
1033
- const docker = args.docker ?? await p.confirm({
1034
- message: "Include Docker Compose? (Redis + Postgres" + (provider === "ollama" ? " + Ollama)" : ")"),
1035
- initialValue: true
1036
- });
1037
- if (p.isCancel(docker)) {
1038
- p.cancel("Operation cancelled.");
1039
- process.exit(0);
1040
- }
1041
- const git = args.git ?? await p.confirm({
1042
- message: "Initialize git repository?",
1043
- initialValue: true
1044
- });
1045
- if (p.isCancel(git)) {
1046
- p.cancel("Operation cancelled.");
1047
- process.exit(0);
1048
- }
1024
+ const template = args.template ?? (interactive ? unlessCancelled(
1025
+ await p.select({
1026
+ message: "Which template would you like?",
1027
+ options: templateChoices,
1028
+ initialValue: defaultAnswers.template
1029
+ })
1030
+ ) : defaultAnswers.template);
1031
+ const provider = args.provider ?? (interactive ? unlessCancelled(
1032
+ await p.select({
1033
+ message: "Which LLM provider?",
1034
+ options: [
1035
+ {
1036
+ value: "ollama",
1037
+ label: "Ollama",
1038
+ hint: `${defaultModels.ollama} \u2014 local, free, requires Ollama installed`
1039
+ },
1040
+ { value: "openai", label: "OpenAI", hint: defaultModels.openai },
1041
+ { value: "anthropic", label: "Anthropic", hint: defaultModels.anthropic },
1042
+ { value: "google", label: "Google Gemini", hint: defaultModels.google }
1043
+ ],
1044
+ initialValue: defaultAnswers.provider
1045
+ })
1046
+ ) : defaultAnswers.provider);
1047
+ const packageManager = args.packageManager ?? (interactive ? unlessCancelled(
1048
+ await p.select({
1049
+ message: "Package manager?",
1050
+ options: [
1051
+ { value: "pnpm", label: "pnpm" },
1052
+ { value: "npm", label: "npm" },
1053
+ { value: "yarn", label: "yarn" },
1054
+ { value: "bun", label: "bun" }
1055
+ ],
1056
+ initialValue: detectPackageManager()
1057
+ })
1058
+ ) : detectPackageManager());
1059
+ const docker = args.docker ?? (interactive ? unlessCancelled(
1060
+ await p.confirm({
1061
+ message: "Include Docker Compose? (Redis + Postgres" + (provider === "ollama" ? " + Ollama)" : ")"),
1062
+ initialValue: defaultAnswers.docker
1063
+ })
1064
+ ) : defaultAnswers.docker);
1065
+ const git = args.git ?? (interactive ? unlessCancelled(
1066
+ await p.confirm({
1067
+ message: "Initialize git repository?",
1068
+ initialValue: defaultAnswers.git
1069
+ })
1070
+ ) : defaultAnswers.git);
1049
1071
  return {
1050
1072
  name: projectName,
1051
1073
  path: projectPath,
@@ -1182,15 +1204,36 @@ function generateDockerCompose(provider) {
1182
1204
  }
1183
1205
 
1184
1206
  // src/templates/base/cogitator-yml.ts
1185
- function generateCogitatorYml(provider) {
1186
- const model = defaultModels[provider];
1187
- const lines = [`provider: ${provider}`, `model: ${model}`, ""];
1207
+ function generateCogitatorYml(provider, template) {
1208
+ const lines = [
1209
+ "llm:",
1210
+ ` defaultProvider: ${provider}`,
1211
+ ` defaultModel: ${defaultModels[provider]}`
1212
+ ];
1188
1213
  if (provider === "ollama") {
1189
- lines.push("ollama:", " baseUrl: http://localhost:11434", "");
1214
+ lines.push(
1215
+ " providers:",
1216
+ " ollama:",
1217
+ " baseUrl: ${OLLAMA_BASE_URL:-http://localhost:11434}"
1218
+ );
1190
1219
  }
1220
+ if (template === "memory") {
1221
+ lines.push(
1222
+ "",
1223
+ "memory:",
1224
+ " adapter: redis",
1225
+ " redis:",
1226
+ " url: ${REDIS_URL:-redis://localhost:6379}"
1227
+ );
1228
+ }
1229
+ lines.push("");
1191
1230
  return { path: "cogitator.yml", content: lines.join("\n") };
1192
1231
  }
1193
1232
 
1233
+ // src/utils/links.ts
1234
+ var DOCS_URL = "https://cogitator.app/docs";
1235
+ var REPO_URL = "https://github.com/cogitator-ai/Cogitator-AI";
1236
+
1194
1237
  // src/templates/base/readme.ts
1195
1238
  var templateNames = {
1196
1239
  basic: "Basic Agent",
@@ -1206,7 +1249,7 @@ function generateReadme(options) {
1206
1249
  const content = [
1207
1250
  `# ${options.name}`,
1208
1251
  "",
1209
- `> Created with [create-cogitator-app](https://github.com/cogitator-ai/cogitator) \u2014 ${templateName} template`,
1252
+ `> Created with [create-cogitator-app](${REPO_URL}) \u2014 ${templateName} template`,
1210
1253
  "",
1211
1254
  "## Getting Started",
1212
1255
  "",
@@ -1221,8 +1264,8 @@ function generateReadme(options) {
1221
1264
  ...options.docker ? ["## Docker Services", "", "```bash", "docker compose up -d", "```", ""] : [],
1222
1265
  "## Learn More",
1223
1266
  "",
1224
- "- [Cogitator Documentation](https://cogitator.dev/docs)",
1225
- "- [GitHub Repository](https://github.com/cogitator-ai/cogitator)",
1267
+ `- [Cogitator Documentation](${DOCS_URL})`,
1268
+ `- [GitHub Repository](${REPO_URL})`,
1226
1269
  ""
1227
1270
  ];
1228
1271
  return { path: "README.md", content: content.join("\n") };
@@ -1240,22 +1283,38 @@ function generatePnpmWorkspace() {
1240
1283
  }
1241
1284
 
1242
1285
  // src/utils/git.ts
1243
- import { execSync as execSync2 } from "child_process";
1286
+ import { execFileSync } from "child_process";
1287
+ var FALLBACK_IDENTITY = [
1288
+ "-c",
1289
+ "user.name=create-cogitator-app",
1290
+ "-c",
1291
+ "user.email=create-cogitator-app@localhost"
1292
+ ];
1244
1293
  function isGitInstalled() {
1245
1294
  try {
1246
- execSync2("git --version", { stdio: "ignore" });
1295
+ execFileSync("git", ["--version"], { stdio: "ignore" });
1247
1296
  return true;
1248
1297
  } catch {
1249
1298
  return false;
1250
1299
  }
1251
1300
  }
1301
+ function hasIdentity(cwd) {
1302
+ try {
1303
+ const name = execFileSync("git", ["config", "user.name"], { cwd, encoding: "utf8" }).trim();
1304
+ const email = execFileSync("git", ["config", "user.email"], { cwd, encoding: "utf8" }).trim();
1305
+ return name.length > 0 && email.length > 0;
1306
+ } catch {
1307
+ return false;
1308
+ }
1309
+ }
1252
1310
  function initGitRepo(cwd) {
1253
- execSync2("git init", { cwd, stdio: "ignore" });
1254
- execSync2("git add -A", { cwd, stdio: "ignore" });
1255
- execSync2(
1256
- 'git -c user.name="Cogitator" -c user.email="init@cogitator.dev" commit -m "feat: initial project scaffold"',
1257
- { cwd, stdio: "ignore" }
1258
- );
1311
+ execFileSync("git", ["init"], { cwd, stdio: "ignore" });
1312
+ execFileSync("git", ["add", "-A"], { cwd, stdio: "ignore" });
1313
+ const identity = hasIdentity(cwd) ? [] : FALLBACK_IDENTITY;
1314
+ execFileSync("git", [...identity, "commit", "-m", "feat: initial project scaffold"], {
1315
+ cwd,
1316
+ stdio: "ignore"
1317
+ });
1259
1318
  }
1260
1319
 
1261
1320
  // src/scaffold.ts
@@ -1267,7 +1326,7 @@ function writeFile(basePath, file) {
1267
1326
  function buildPackageJson(options) {
1268
1327
  const template = getTemplate(options.template);
1269
1328
  const isNextjs = options.template === "nextjs";
1270
- const pkg = {
1329
+ const pkg2 = {
1271
1330
  name: options.name,
1272
1331
  version: "0.1.0",
1273
1332
  private: true,
@@ -1276,7 +1335,7 @@ function buildPackageJson(options) {
1276
1335
  dependencies: template.dependencies(),
1277
1336
  devDependencies: template.devDependencies()
1278
1337
  };
1279
- return JSON.stringify(pkg, null, 2) + "\n";
1338
+ return JSON.stringify(pkg2, null, 2) + "\n";
1280
1339
  }
1281
1340
  function collectFiles(options) {
1282
1341
  const template = getTemplate(options.template);
@@ -1285,7 +1344,7 @@ function collectFiles(options) {
1285
1344
  files.push(...template.files(options));
1286
1345
  files.push(generateGitignore());
1287
1346
  files.push(generateEnvExample(options.provider, options.template));
1288
- files.push(generateCogitatorYml(options.provider));
1347
+ files.push(generateCogitatorYml(options.provider, options.template));
1289
1348
  files.push(generateReadme(options));
1290
1349
  if (options.template !== "nextjs") {
1291
1350
  files.push(generateTsconfig());
@@ -1329,8 +1388,9 @@ async function scaffold(options) {
1329
1388
  }
1330
1389
 
1331
1390
  // src/index.ts
1391
+ var pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
1332
1392
  async function main() {
1333
- banner();
1393
+ banner(pkg.version);
1334
1394
  p3.intro(pc2.cyan("Let's build something with AI agents"));
1335
1395
  const args = parseArgs(process.argv.slice(2));
1336
1396
  const options = await collectOptions(args);
@@ -1343,7 +1403,7 @@ async function main() {
1343
1403
  ` ${pc2.cyan("cd")} ${options.name}`,
1344
1404
  ` ${pc2.cyan(dev)}`,
1345
1405
  "",
1346
- pc2.dim("Docs: https://cogitator.dev/docs")
1406
+ pc2.dim(`Docs: ${DOCS_URL}`)
1347
1407
  ].join("\n")
1348
1408
  );
1349
1409
  }