@trama-dev/cli 0.1.0 → 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/dist/index.js +11 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import {
|
|
4
|
-
import { homedir } from "os";
|
|
5
|
-
import { createProject, runProgram, updateProject, listProjects, showLogs, validateProjectName, } from "@trama-dev/runtime/runner";
|
|
3
|
+
import { createProject, runProgram, updateProject, listProjects, showLogs, resolveProject, } from "@trama-dev/runtime/runner";
|
|
6
4
|
const cli = new Command()
|
|
7
5
|
.name("trama")
|
|
8
6
|
.description("A minimal runtime for agent-authored programs")
|
|
9
|
-
.version("0.1.
|
|
7
|
+
.version("0.1.1");
|
|
10
8
|
cli
|
|
11
9
|
.command("create <name> <prompt>")
|
|
12
10
|
.description("Generate a new program from a natural language prompt")
|
|
@@ -23,16 +21,18 @@ cli
|
|
|
23
21
|
cli
|
|
24
22
|
.command("run <name>")
|
|
25
23
|
.description("Execute a program")
|
|
26
|
-
.option("--timeout <ms>", "Execution timeout in ms"
|
|
24
|
+
.option("--timeout <ms>", "Execution timeout in ms")
|
|
27
25
|
.action(async (name, opts) => {
|
|
28
26
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
let timeout;
|
|
28
|
+
if (opts.timeout !== undefined) {
|
|
29
|
+
timeout = Number(opts.timeout);
|
|
30
|
+
if (!Number.isInteger(timeout) || timeout <= 0) {
|
|
31
|
+
console.error(`Error: --timeout must be a positive integer (got "${opts.timeout}")`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
34
|
}
|
|
35
|
-
const projectDir =
|
|
35
|
+
const projectDir = resolveProject(name);
|
|
36
36
|
await runProgram({ projectDir, timeout });
|
|
37
37
|
}
|
|
38
38
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trama-dev/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"trama": "./dist/index.js"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@trama-dev/runtime": "0.1.
|
|
29
|
+
"@trama-dev/runtime": "0.1.1",
|
|
30
30
|
"commander": "^12.0.0"
|
|
31
31
|
}
|
|
32
32
|
}
|