@trama-dev/cli 0.1.0

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 trama 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,21 @@
1
+ # @trama-dev/cli
2
+
3
+ The CLI for [trama](https://github.com/NaNhkNaN/trama) — where the program is the orchestration.
4
+
5
+ ```bash
6
+ npm install -g @trama-dev/cli
7
+ ```
8
+
9
+ Five commands. That's the whole interface.
10
+
11
+ ```bash
12
+ trama create optimizer "improve sort.ts by benchmarking alternatives"
13
+ trama run optimizer
14
+ trama update optimizer "also track memory usage"
15
+ trama list
16
+ trama logs optimizer
17
+ ```
18
+
19
+ `create` turns your intent into a TypeScript program. `run` executes it deterministically. `update` rewrites it with new requirements. The program is the only artifact — no configs, no graphs, no prompts to manage.
20
+
21
+ See the [main README](https://github.com/NaNhkNaN/trama) for the full picture.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { join } from "path";
4
+ import { homedir } from "os";
5
+ import { createProject, runProgram, updateProject, listProjects, showLogs, validateProjectName, } from "@trama-dev/runtime/runner";
6
+ const cli = new Command()
7
+ .name("trama")
8
+ .description("A minimal runtime for agent-authored programs")
9
+ .version("0.1.0");
10
+ cli
11
+ .command("create <name> <prompt>")
12
+ .description("Generate a new program from a natural language prompt")
13
+ .option("--model <model>", "LLM model to use")
14
+ .action(async (name, prompt, opts) => {
15
+ try {
16
+ await createProject(name, prompt, opts.model ? { model: opts.model } : undefined);
17
+ }
18
+ catch (err) {
19
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
20
+ process.exit(1);
21
+ }
22
+ });
23
+ cli
24
+ .command("run <name>")
25
+ .description("Execute a program")
26
+ .option("--timeout <ms>", "Execution timeout in ms", "300000")
27
+ .action(async (name, opts) => {
28
+ try {
29
+ validateProjectName(name);
30
+ const timeout = Number(opts.timeout);
31
+ if (!Number.isInteger(timeout) || timeout <= 0) {
32
+ console.error(`Error: --timeout must be a positive integer (got "${opts.timeout}")`);
33
+ process.exit(1);
34
+ }
35
+ const projectDir = join(homedir(), ".trama", "projects", name);
36
+ await runProgram({ projectDir, timeout });
37
+ }
38
+ catch (err) {
39
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
40
+ process.exit(1);
41
+ }
42
+ });
43
+ cli
44
+ .command("update <name> <prompt>")
45
+ .description("Update an existing program with new requirements")
46
+ .action(async (name, prompt) => {
47
+ try {
48
+ await updateProject(name, prompt);
49
+ }
50
+ catch (err) {
51
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
52
+ process.exit(1);
53
+ }
54
+ });
55
+ cli
56
+ .command("list")
57
+ .description("List all projects")
58
+ .action(async () => {
59
+ try {
60
+ await listProjects();
61
+ }
62
+ catch (err) {
63
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
64
+ process.exit(1);
65
+ }
66
+ });
67
+ cli
68
+ .command("logs <name>")
69
+ .description("Show logs from last run")
70
+ .action(async (name) => {
71
+ try {
72
+ await showLogs(name);
73
+ }
74
+ catch (err) {
75
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
76
+ process.exit(1);
77
+ }
78
+ });
79
+ cli.parse();
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@trama-dev/cli",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "trama": "./dist/index.js"
7
+ },
8
+ "scripts": {
9
+ "build": "tsc && chmod +x dist/index.js"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "description": "CLI for trama — an agentic runtime for agent-authored TypeScript programs",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/NaNhkNaN/trama.git",
19
+ "directory": "packages/cli"
20
+ },
21
+ "homepage": "https://github.com/NaNhkNaN/trama",
22
+ "bugs": "https://github.com/NaNhkNaN/trama/issues",
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "dependencies": {
29
+ "@trama-dev/runtime": "0.1.0",
30
+ "commander": "^12.0.0"
31
+ }
32
+ }