@trama-dev/cli 0.1.1 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +31 -3
  2. package/dist/index.js +33 -6
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @trama-dev/cli
2
2
 
3
- The CLI for [trama](https://github.com/NaNhkNaN/trama) — where the program is the orchestration.
3
+ > Agents don't need frameworks. They need a runtime.
4
+
5
+ The CLI for [trama](https://github.com/NaNhkNaN/trama) — the agentic runtime that turns intent into self-contained, shareable agent programs.
4
6
 
5
7
  ```bash
6
8
  npm install -g @trama-dev/cli
@@ -16,6 +18,32 @@ trama list
16
18
  trama logs optimizer
17
19
  ```
18
20
 
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.
21
+ `create` generates a complete agent program from one sentence. `run` executes it — with auto-repair if it crashes. `update` rewrites it with new requirements. The output is real TypeScript you can read, diff, and share. Anyone can `git clone && trama run`.
22
+
23
+ ### What trama generates
24
+
25
+ From a single sentence, trama produces programs that range from one-shot pipelines to autonomous optimization loops to self-orchestrating multi-agent workflows — where trama programs create and run other trama programs.
26
+
27
+ ```bash
28
+ # One-shot pipeline
29
+ trama create hn-digest "fetch the HN API, get top 10 stories, write digest.md"
30
+
31
+ # Autonomous optimization (autoresearch pattern)
32
+ trama create sort-opt "benchmark sort.ts, propose improvements, keep only faster versions"
33
+
34
+ # Self-orchestration — trama composes trama
35
+ trama create research "break topic into sub-questions, create a trama sub-program for each, \
36
+ run them, synthesize a final report"
37
+ ```
38
+
39
+ ### CLI options
40
+
41
+ ```bash
42
+ trama create <name> <prompt> [--model <model>] [--arg key=value ...]
43
+ trama run <name> [--timeout <ms>] [--arg key=value ...]
44
+ trama update <name> <prompt>
45
+ trama list
46
+ trama logs <name>
47
+ ```
20
48
 
21
- See the [main README](https://github.com/NaNhkNaN/trama) for the full picture.
49
+ See the [main README](https://github.com/NaNhkNaN/trama) for the full picture — why a runtime matters, what generated programs look like, and the runtime API.
package/dist/index.js CHANGED
@@ -1,17 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
3
  import { createProject, runProgram, updateProject, listProjects, showLogs, resolveProject, } from "@trama-dev/runtime/runner";
4
+ function collectArg(value, previous) {
5
+ return [...previous, value];
6
+ }
7
+ function parseArgs(args) {
8
+ if (args.length === 0)
9
+ return {};
10
+ const result = {};
11
+ for (const arg of args) {
12
+ const eq = arg.indexOf("=");
13
+ if (eq === -1) {
14
+ throw new Error(`Invalid --arg format: "${arg}". Expected key=value.`);
15
+ }
16
+ result[arg.slice(0, eq)] = arg.slice(eq + 1);
17
+ }
18
+ return result;
19
+ }
4
20
  const cli = new Command()
5
21
  .name("trama")
6
22
  .description("A minimal runtime for agent-authored programs")
7
- .version("0.1.1");
23
+ .version("0.1.3");
8
24
  cli
9
25
  .command("create <name> <prompt>")
10
26
  .description("Generate a new program from a natural language prompt")
11
27
  .option("--model <model>", "LLM model to use")
28
+ .option("--arg <key=value>", "Pass argument to the program (repeatable)", collectArg, [])
12
29
  .action(async (name, prompt, opts) => {
13
30
  try {
14
- await createProject(name, prompt, opts.model ? { model: opts.model } : undefined);
31
+ const args = parseArgs(opts.arg);
32
+ await createProject(name, prompt, {
33
+ model: opts.model,
34
+ args: Object.keys(args).length > 0 ? args : undefined,
35
+ });
15
36
  }
16
37
  catch (err) {
17
38
  console.error(`Error: ${err instanceof Error ? err.message : err}`);
@@ -21,19 +42,25 @@ cli
21
42
  cli
22
43
  .command("run <name>")
23
44
  .description("Execute a program")
24
- .option("--timeout <ms>", "Execution timeout in ms")
45
+ .option("--timeout <ms>", "Per-phase timeout in ms (applies to each run and repair attempt separately)")
46
+ .option("--arg <key=value>", "Pass argument to the program (repeatable)", collectArg, [])
25
47
  .action(async (name, opts) => {
26
48
  try {
27
49
  let timeout;
28
50
  if (opts.timeout !== undefined) {
29
51
  timeout = Number(opts.timeout);
30
- if (!Number.isInteger(timeout) || timeout <= 0) {
31
- console.error(`Error: --timeout must be a positive integer (got "${opts.timeout}")`);
52
+ if (!Number.isFinite(timeout) || timeout <= 0) {
53
+ console.error(`Error: --timeout must be a positive number (got "${opts.timeout}")`);
32
54
  process.exit(1);
33
55
  }
34
56
  }
57
+ const args = parseArgs(opts.arg);
35
58
  const projectDir = resolveProject(name);
36
- await runProgram({ projectDir, timeout });
59
+ await runProgram({
60
+ projectDir,
61
+ timeout,
62
+ args: Object.keys(args).length > 0 ? args : undefined,
63
+ });
37
64
  }
38
65
  catch (err) {
39
66
  console.error(`Error: ${err instanceof Error ? err.message : err}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trama-dev/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "trama": "./dist/index.js"
@@ -25,8 +25,9 @@
25
25
  "README.md",
26
26
  "LICENSE"
27
27
  ],
28
+ "os": ["darwin", "linux"],
28
29
  "dependencies": {
29
- "@trama-dev/runtime": "0.1.1",
30
- "commander": "^12.0.0"
30
+ "@trama-dev/runtime": "0.1.3",
31
+ "commander": "^14.0.0"
31
32
  }
32
33
  }