create-computeragent 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ComputerAgent contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # create-computeragent
2
+
3
+ Scaffold a runnable [ComputerAgent](https://github.com/open-gitagent/ComputerAgent) project in 60 seconds.
4
+
5
+ ```bash
6
+ npx create-computeragent my-agent
7
+ cd my-agent
8
+ npm install
9
+ ANTHROPIC_API_KEY=sk-ant-... npm start
10
+ ```
11
+
12
+ That's it. The output is a single TS file plus a `package.json` — no build tools, no boilerplate, just `runTask({...})` against a local substrate.
13
+
14
+ ## What you get
15
+
16
+ ```
17
+ my-agent/
18
+ ├── package.json # depends on @computeragent/sdk + @computeragent/runtime-local
19
+ ├── index.ts # one inline GAP agent + runTask call
20
+ ├── README.md
21
+ └── .gitignore
22
+ ```
23
+
24
+ `index.ts` is fully runnable. It defines an inline GAP agent (model + system prompt), boots a local subprocess, runs one turn, and prints the agent's reply.
25
+
26
+ ## Next steps
27
+
28
+ - Swap the substrate: `npm install @computeragent/runtime-e2b` then replace `new LocalSubstrate()` with `new E2BSubstrate({apiKey})`.
29
+ - Add cross-process memory: pass `sessionStore: { kind: "file", options: { root: "./sessions" } }` and re-run with the same `sessionId`.
30
+ - Build a real GAP repo: see https://github.com/open-gitagent/gitagent-protocol.
31
+
32
+ ## Options
33
+
34
+ ```
35
+ npx create-computeragent <project-name> [--force]
36
+ ```
37
+
38
+ `--force` lets you scaffold into a non-empty directory.
39
+
40
+ ## License
41
+
42
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `npx create-computeragent <project-name>`
4
+ *
5
+ * Scaffolds a runnable ComputerAgent project in one command. The output is a
6
+ * single TS file + a package.json that depends on the published packages, so
7
+ * the user can:
8
+ *
9
+ * npx create-computeragent my-agent
10
+ * cd my-agent
11
+ * npm install
12
+ * ANTHROPIC_API_KEY=sk-... npm start
13
+ *
14
+ * No prompts, no questions — opinionated defaults, runnable in under a minute.
15
+ */
16
+ import { mkdir, writeFile, readdir } from "node:fs/promises";
17
+ import { existsSync } from "node:fs";
18
+ import { resolve, basename, join } from "node:path";
19
+ const args = process.argv.slice(2);
20
+ const positional = args.filter((a) => !a.startsWith("--"));
21
+ const flags = new Set(args.filter((a) => a.startsWith("--")));
22
+ if (flags.has("--help") || flags.has("-h")) {
23
+ printHelp();
24
+ process.exit(0);
25
+ }
26
+ const projectName = positional[0] ?? "my-computeragent";
27
+ const targetDir = resolve(process.cwd(), projectName);
28
+ if (existsSync(targetDir)) {
29
+ const dirContents = await readdir(targetDir).catch(() => []);
30
+ if (dirContents.length > 0 && !flags.has("--force")) {
31
+ console.error(`Error: '${projectName}' already exists and is not empty.`);
32
+ console.error(`Use --force to overwrite, or pick a different name.`);
33
+ process.exit(1);
34
+ }
35
+ }
36
+ await mkdir(targetDir, { recursive: true });
37
+ await writeFile(join(targetDir, "package.json"), JSON.stringify({
38
+ name: basename(projectName),
39
+ version: "0.1.0",
40
+ private: true,
41
+ type: "module",
42
+ scripts: {
43
+ start: "node --experimental-strip-types index.ts",
44
+ },
45
+ dependencies: {
46
+ computeragent: "^0.1.0",
47
+ },
48
+ engines: { node: ">=22.6.0" },
49
+ }, null, 2));
50
+ await writeFile(join(targetDir, "index.ts"), `import { runTask, LocalSubstrate } from "computeragent";
51
+
52
+ const apiKey = process.env.ANTHROPIC_API_KEY;
53
+ if (!apiKey) {
54
+ console.error("Set ANTHROPIC_API_KEY first.");
55
+ console.error(" export ANTHROPIC_API_KEY=sk-ant-...");
56
+ process.exit(1);
57
+ }
58
+
59
+ const result = await runTask({
60
+ source: {
61
+ type: "inline",
62
+ manifest: { name: "${basename(projectName)}", version: "0.1.0" },
63
+ files: {
64
+ "agent.yaml": [
65
+ 'spec_version: "0.1.0"',
66
+ "name: ${basename(projectName)}",
67
+ "version: 0.1.0",
68
+ "model:",
69
+ " preferred: claude-haiku-4-5-20251001",
70
+ "runtime:",
71
+ " max_turns: 4",
72
+ ].join("\\n"),
73
+ "SOUL.md": [
74
+ "# Soul",
75
+ "",
76
+ "You are a friendly assistant. Respond concisely.",
77
+ "When asked to write a file, use the Write tool.",
78
+ ].join("\\n"),
79
+ },
80
+ },
81
+ harness: "claude-agent-sdk",
82
+ envs: { ANTHROPIC_API_KEY: apiKey },
83
+ runtime: new LocalSubstrate(),
84
+ options: { permissionMode: "bypassPermissions", settingSources: ["project"] },
85
+ message: "Say hi and tell me one thing you can do.",
86
+ });
87
+
88
+ for (const m of result.messages) {
89
+ const msg = m as { type?: string; result?: string; message?: { content?: unknown[] } };
90
+ if (msg.type === "result" && msg.result) {
91
+ console.log("\\nA:", msg.result);
92
+ }
93
+ }
94
+ console.log("\\nSession:", result.sessionId, "(reason:", result.ended.reason + ")");
95
+ `);
96
+ await writeFile(join(targetDir, ".gitignore"), ["node_modules", "dist", ".env", ".env.local", "*.log", ""].join("\n"));
97
+ await writeFile(join(targetDir, "README.md"), `# ${basename(projectName)}
98
+
99
+ A starter [ComputerAgent](https://github.com/open-gitagent/ComputerAgent) project.
100
+
101
+ ## Run
102
+
103
+ \`\`\`bash
104
+ npm install
105
+ ANTHROPIC_API_KEY=sk-ant-... npm start
106
+ \`\`\`
107
+
108
+ ## What this is
109
+
110
+ A minimal agent defined inline in \`index.ts\` and run in a local subprocess via \`runTask\`.
111
+ The substrate boots, the agent runs one turn, the substrate is torn down — all in one call.
112
+
113
+ ## Swap the substrate
114
+
115
+ Replace \`new LocalSubstrate()\` with \`new E2BSubstrate({apiKey})\` for a cloud sandbox,
116
+ or \`new VZVMSubstrate({...})\` for an Apple Silicon VM. Same code, different runtime.
117
+
118
+ \`\`\`bash
119
+ npm install @computeragent/runtime-e2b
120
+ \`\`\`
121
+
122
+ ## Add memory
123
+
124
+ Pass \`sessionStore: { kind: "file", options: { root: "./sessions" } }\` and the same
125
+ \`sessionId\` on a follow-up call to resume the conversation across processes.
126
+
127
+ See https://github.com/open-gitagent/ComputerAgent for the full guide.
128
+ `);
129
+ console.log(``);
130
+ console.log(`✓ Created ${projectName}/`);
131
+ console.log(``);
132
+ console.log(`Next:`);
133
+ console.log(` cd ${projectName}`);
134
+ console.log(` npm install`);
135
+ console.log(` export ANTHROPIC_API_KEY=sk-ant-...`);
136
+ console.log(` npm start`);
137
+ console.log(``);
138
+ console.log(`Docs: https://github.com/open-gitagent/ComputerAgent`);
139
+ console.log(``);
140
+ function printHelp() {
141
+ console.log(`create-computeragent — scaffold a ComputerAgent project`);
142
+ console.log(``);
143
+ console.log(`Usage:`);
144
+ console.log(` npx create-computeragent <project-name> [--force]`);
145
+ console.log(``);
146
+ console.log(`Options:`);
147
+ console.log(` --force Overwrite a non-empty target directory`);
148
+ console.log(` --help Show this message`);
149
+ console.log(``);
150
+ console.log(`Example:`);
151
+ console.log(` npx create-computeragent my-agent`);
152
+ console.log(` cd my-agent && npm install && ANTHROPIC_API_KEY=sk-... npm start`);
153
+ }
154
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE9D,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3C,SAAS,EAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,I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,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;AACpF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "create-computeragent",
3
+ "version": "0.1.1",
4
+ "description": "Scaffold a runnable ComputerAgent project in 60 seconds. `npx create-computeragent my-agent`",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "create-computeragent": "./dist/cli.js"
9
+ },
10
+ "main": "./dist/cli.js",
11
+ "files": [
12
+ "dist",
13
+ "template",
14
+ "README.md"
15
+ ],
16
+ "keywords": [
17
+ "ai-agents",
18
+ "agent-framework",
19
+ "anthropic",
20
+ "claude",
21
+ "agent-protocol",
22
+ "scaffolding",
23
+ "create-app"
24
+ ],
25
+ "homepage": "https://github.com/open-gitagent/ComputerAgent",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/open-gitagent/ComputerAgent.git",
29
+ "directory": "packages/create-computeragent"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.0.0",
33
+ "typescript": "^5.5.0",
34
+ "vitest": "^2.0.0"
35
+ },
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json && chmod +x dist/cli.js 2>/dev/null || true",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit",
42
+ "test": "vitest run --passWithNoTests",
43
+ "clean": "rm -rf dist .turbo *.tsbuildinfo"
44
+ }
45
+ }