@upstash/box-cli 0.1.3 → 0.1.4

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 (57) hide show
  1. package/README.md +29 -0
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +7 -9
  5. package/dist/auth.js.map +1 -1
  6. package/dist/commands/connect.d.ts +3 -6
  7. package/dist/commands/connect.d.ts.map +1 -1
  8. package/dist/commands/connect.js +15 -15
  9. package/dist/commands/connect.js.map +1 -1
  10. package/dist/commands/create.d.ts +7 -7
  11. package/dist/commands/create.d.ts.map +1 -1
  12. package/dist/commands/create.js +26 -27
  13. package/dist/commands/create.js.map +1 -1
  14. package/dist/commands/from-snapshot.d.ts +8 -11
  15. package/dist/commands/from-snapshot.d.ts.map +1 -1
  16. package/dist/commands/from-snapshot.js +26 -27
  17. package/dist/commands/from-snapshot.js.map +1 -1
  18. package/dist/commands/get.d.ts +2 -2
  19. package/dist/commands/get.js +4 -4
  20. package/dist/commands/init-demo.d.ts +15 -0
  21. package/dist/commands/init-demo.d.ts.map +1 -0
  22. package/dist/commands/init-demo.js +202 -0
  23. package/dist/commands/init-demo.js.map +1 -0
  24. package/dist/commands/list.d.ts +2 -2
  25. package/dist/commands/list.d.ts.map +1 -1
  26. package/dist/commands/list.js +15 -15
  27. package/dist/commands/list.js.map +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +45 -34
  30. package/dist/index.js.map +1 -1
  31. package/dist/output.d.ts +1 -1
  32. package/dist/output.js +3 -3
  33. package/dist/repl-commands/delete.d.ts +1 -1
  34. package/dist/repl-commands/delete.js +4 -4
  35. package/dist/repl-commands/exec.d.ts +1 -1
  36. package/dist/repl-commands/exec.js +9 -8
  37. package/dist/repl-commands/files.d.ts +1 -1
  38. package/dist/repl-commands/files.js +53 -53
  39. package/dist/repl-commands/git.d.ts +1 -1
  40. package/dist/repl-commands/git.js +32 -32
  41. package/dist/repl-commands/pause.d.ts +6 -0
  42. package/dist/repl-commands/pause.d.ts.map +1 -0
  43. package/dist/repl-commands/pause.js +9 -0
  44. package/dist/repl-commands/pause.js.map +1 -0
  45. package/dist/repl-commands/run.d.ts +1 -1
  46. package/dist/repl-commands/run.js +9 -9
  47. package/dist/repl-commands/snapshot.d.ts +1 -1
  48. package/dist/repl-commands/snapshot.js +4 -4
  49. package/dist/repl.d.ts +1 -1
  50. package/dist/repl.d.ts.map +1 -1
  51. package/dist/repl.js +51 -47
  52. package/dist/repl.js.map +1 -1
  53. package/package.json +4 -3
  54. package/dist/repl-commands/stop.d.ts +0 -6
  55. package/dist/repl-commands/stop.d.ts.map +0 -1
  56. package/dist/repl-commands/stop.js +0 -9
  57. package/dist/repl-commands/stop.js.map +0 -1
@@ -1,19 +1,19 @@
1
1
  import { Box } from "@upstash/box";
2
2
  import { resolveToken } from "../auth.js";
3
3
  export async function listCommand(flags) {
4
- const apiKey = resolveToken(flags.token);
5
- const boxes = await Box.list({ apiKey });
6
- if (boxes.length === 0) {
7
- console.log("No boxes found.");
8
- return;
9
- }
10
- const headers = ["ID", "STATUS", "MODEL", "CREATED"];
11
- const rows = boxes.map((b) => [b.id, b.status, b.model ?? "", String(b.created_at)]);
12
- const colWidths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => r[i].length)));
13
- const formatRow = (row) => row.map((val, i) => val.padEnd(colWidths[i])).join(" ");
14
- console.log(formatRow(headers));
15
- for (const row of rows) {
16
- console.log(formatRow(row));
17
- }
4
+ const apiKey = resolveToken(flags.token);
5
+ const boxes = await Box.list({ apiKey });
6
+ if (boxes.length === 0) {
7
+ console.log("No boxes found.");
8
+ return;
9
+ }
10
+ const headers = ["ID", "STATUS", "MODEL", "CREATED"];
11
+ const rows = boxes.map((b) => [b.id, b.status, b.model ?? "", String(b.created_at)]);
12
+ const colWidths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => r[i].length)));
13
+ const formatRow = (row) => row.map((val, i) => val.padEnd(colWidths[i])).join(" ");
14
+ console.log(formatRow(headers));
15
+ for (const row of rows) {
16
+ console.log(formatRow(row));
17
+ }
18
18
  }
19
- //# sourceMappingURL=list.js.map
19
+ //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAgB;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAErF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACrC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC,CAAC,CACrD,CAAC;IAEF,MAAM,SAA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,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAE9F,MAAM,SAAS,GAAG,CAAC,GAAa,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/F,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import "dotenv/config";
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -6,45 +6,56 @@ import { connectCommand } from "./commands/connect.js";
6
6
  import { fromSnapshotCommand } from "./commands/from-snapshot.js";
7
7
  import { listCommand } from "./commands/list.js";
8
8
  import { getCommand } from "./commands/get.js";
9
+ import { initDemoCommand } from "./commands/init-demo.js";
9
10
  const program = new Command();
10
11
  program
11
- .name("box")
12
- .description("CLI for Upstash Box — REPL-first interface for AI coding agents")
13
- .version("0.1.0");
12
+ .name("box")
13
+ .description("CLI for Upstash Box — REPL-first interface for AI coding agents")
14
+ .version("0.1.0");
14
15
  program
15
- .command("create")
16
- .description("Create a new box and enter the REPL")
17
- .option("--token <token>", "Upstash Box API token")
18
- .option("--runtime <runtime>", "Runtime environment (node, python, golang, ruby, rust)")
19
- .option("--agent-model <model>", "Agent model identifier")
20
- .option("--agent-api-key <key>", "Agent API key (Anthropic or OpenAI)")
21
- .option("--git-token <token>", "GitHub personal access token")
22
- .option("--env <KEY=VAL>", "Environment variable (repeatable)", (val, prev) => [...prev, val], [])
23
- .action((opts) => createCommand(opts));
16
+ .command("create")
17
+ .description("Create a new box and enter the REPL")
18
+ .option("--token <token>", "Upstash Box API token")
19
+ .option("--runtime <runtime>", "Runtime environment (node, python, golang, ruby, rust)")
20
+ .option("--agent-model <model>", "Agent model identifier")
21
+ .option("--agent-api-key <key>", "Agent API key (Anthropic or OpenAI)")
22
+ .option("--git-token <token>", "GitHub personal access token")
23
+ .option("--env <KEY=VAL>", "Environment variable (repeatable)", (val, prev) => [...prev, val], [])
24
+ .action((opts) => createCommand(opts));
24
25
  program
25
- .command("connect [box-id]")
26
- .description("Connect to an existing box (or most recent) and enter the REPL")
27
- .option("--token <token>", "Upstash Box API token")
28
- .action((boxId, opts) => connectCommand(boxId, opts));
26
+ .command("connect [box-id]")
27
+ .description("Connect to an existing box (or most recent) and enter the REPL")
28
+ .option("--token <token>", "Upstash Box API token")
29
+ .action((boxId, opts) => connectCommand(boxId, opts));
29
30
  program
30
- .command("from-snapshot <snapshot-id>")
31
- .description("Create a new box from a snapshot and enter the REPL")
32
- .option("--token <token>", "Upstash Box API token")
33
- .option("--runtime <runtime>", "Runtime environment")
34
- .option("--agent-model <model>", "Agent model identifier")
35
- .option("--agent-api-key <key>", "Agent API key")
36
- .option("--git-token <token>", "GitHub personal access token")
37
- .option("--env <KEY=VAL>", "Environment variable (repeatable)", (val, prev) => [...prev, val], [])
38
- .action((snapshotId, opts) => fromSnapshotCommand(snapshotId, opts));
31
+ .command("from-snapshot <snapshot-id>")
32
+ .description("Create a new box from a snapshot and enter the REPL")
33
+ .option("--token <token>", "Upstash Box API token")
34
+ .option("--runtime <runtime>", "Runtime environment")
35
+ .option("--agent-model <model>", "Agent model identifier")
36
+ .option("--agent-api-key <key>", "Agent API key")
37
+ .option("--git-token <token>", "GitHub personal access token")
38
+ .option("--env <KEY=VAL>", "Environment variable (repeatable)", (val, prev) => [...prev, val], [])
39
+ .action((snapshotId, opts) => fromSnapshotCommand(snapshotId, opts));
39
40
  program
40
- .command("list")
41
- .description("List all boxes")
42
- .option("--token <token>", "Upstash Box API token")
43
- .action((opts) => listCommand(opts));
41
+ .command("list")
42
+ .description("List all boxes")
43
+ .option("--token <token>", "Upstash Box API token")
44
+ .action((opts) => listCommand(opts));
44
45
  program
45
- .command("get <box-id>")
46
- .description("Get details about a box")
47
- .option("--token <token>", "Upstash Box API token")
48
- .action((boxId, opts) => getCommand(boxId, opts));
46
+ .command("get <box-id>")
47
+ .description("Get details about a box")
48
+ .option("--token <token>", "Upstash Box API token")
49
+ .action((boxId, opts) => getCommand(boxId, opts));
50
+ program
51
+ .command("init-demo")
52
+ .description("Scaffold a standalone demo project for @upstash/box")
53
+ .option("--token <token>", "Upstash Box API token")
54
+ .option("--agent-model <model>", "Agent model identifier")
55
+ .option("--agent-api-key <key>", "Agent API key (required if --agent-model is set)")
56
+ .option("--runtime <runtime>", "Runtime environment", "node")
57
+ .option("--git-token <token>", "GitHub personal access token")
58
+ .option("--directory <dir>", "Output directory", "box-demo")
59
+ .action((opts) => initDemoCommand(opts));
49
60
  program.parse();
50
- //# sourceMappingURL=index.js.map
61
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WA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K,EAAE,CAAC"}
package/dist/output.d.ts CHANGED
@@ -6,4 +6,4 @@ export declare function formatJSON(data: unknown): string;
6
6
  * Format raw text for display.
7
7
  */
8
8
  export declare function formatRaw(text: string): string;
9
- //# sourceMappingURL=output.d.ts.map
9
+ //# sourceMappingURL=output.d.ts.map
package/dist/output.js CHANGED
@@ -2,12 +2,12 @@
2
2
  * Format data as JSON for display.
3
3
  */
4
4
  export function formatJSON(data) {
5
- return JSON.stringify(data, null, 2);
5
+ return JSON.stringify(data, null, 2);
6
6
  }
7
7
  /**
8
8
  * Format raw text for display.
9
9
  */
10
10
  export function formatRaw(text) {
11
- return text;
11
+ return text;
12
12
  }
13
- //# sourceMappingURL=output.js.map
13
+ //# sourceMappingURL=output.js.map
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Delete the box. Returns true to signal the REPL to exit.
4
4
  */
5
5
  export declare function handleDelete(box: Box, _args: string): Promise<boolean>;
6
- //# sourceMappingURL=delete.d.ts.map
6
+ //# sourceMappingURL=delete.d.ts.map
@@ -2,8 +2,8 @@
2
2
  * Delete the box. Returns true to signal the REPL to exit.
3
3
  */
4
4
  export async function handleDelete(box, _args) {
5
- await box.delete();
6
- console.log(`Box ${box.id} deleted.`);
7
- return true;
5
+ await box.delete();
6
+ console.log(`Box ${box.id} deleted.`);
7
+ return true;
8
8
  }
9
- //# sourceMappingURL=delete.js.map
9
+ //# sourceMappingURL=delete.js.map
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Execute a shell command in the box.
4
4
  */
5
5
  export declare function handleExec(box: Box, command: string): Promise<void>;
6
- //# sourceMappingURL=exec.d.ts.map
6
+ //# sourceMappingURL=exec.d.ts.map
@@ -2,12 +2,13 @@
2
2
  * Execute a shell command in the box.
3
3
  */
4
4
  export async function handleExec(box, command) {
5
- if (!command) {
6
- console.log("Usage: exec <command>");
7
- return;
8
- }
9
- const run = await box.exec(command);
10
- const result = await run.result();
11
- if (result) console.log(result);
5
+ if (!command) {
6
+ console.log("Usage: exec <command>");
7
+ return;
8
+ }
9
+ const run = await box.exec(command);
10
+ const result = await run.result();
11
+ if (result)
12
+ console.log(result);
12
13
  }
13
- //# sourceMappingURL=exec.js.map
14
+ //# sourceMappingURL=exec.js.map
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Handle file subcommands: read, write, list, upload, download.
4
4
  */
5
5
  export declare function handleFiles(box: Box, args: string): Promise<void>;
6
- //# sourceMappingURL=files.d.ts.map
6
+ //# sourceMappingURL=files.d.ts.map
@@ -2,58 +2,58 @@
2
2
  * Handle file subcommands: read, write, list, upload, download.
3
3
  */
4
4
  export async function handleFiles(box, args) {
5
- const parts = args.split(/\s+/);
6
- const sub = parts[0];
7
- switch (sub) {
8
- case "read": {
9
- const path = parts[1];
10
- if (!path) {
11
- console.log("Usage: files read <path>");
12
- return;
13
- }
14
- const content = await box.files.read(path);
15
- console.log(content);
16
- break;
5
+ const parts = args.split(/\s+/);
6
+ const sub = parts[0];
7
+ switch (sub) {
8
+ case "read": {
9
+ const path = parts[1];
10
+ if (!path) {
11
+ console.log("Usage: files read <path>");
12
+ return;
13
+ }
14
+ const content = await box.files.read(path);
15
+ console.log(content);
16
+ break;
17
+ }
18
+ case "write": {
19
+ const path = parts[1];
20
+ const content = parts.slice(2).join(" ");
21
+ if (!path || !content) {
22
+ console.log("Usage: files write <path> <content>");
23
+ return;
24
+ }
25
+ await box.files.write({ path, content });
26
+ console.log(`Written to ${path}`);
27
+ break;
28
+ }
29
+ case "list": {
30
+ const path = parts[1];
31
+ const files = await box.files.list(path);
32
+ for (const f of files) {
33
+ const indicator = f.is_dir ? "/" : "";
34
+ console.log(`${f.name}${indicator}\t${f.size}`);
35
+ }
36
+ break;
37
+ }
38
+ case "upload": {
39
+ const localPath = parts[1];
40
+ const destination = parts[2];
41
+ if (!localPath || !destination) {
42
+ console.log("Usage: files upload <local-path> <destination>");
43
+ return;
44
+ }
45
+ await box.files.upload([{ path: localPath, destination }]);
46
+ console.log(`Uploaded ${localPath} → ${destination}`);
47
+ break;
48
+ }
49
+ case "download": {
50
+ const path = parts[1];
51
+ await box.files.download(path ? { path } : undefined);
52
+ console.log("Downloaded.");
53
+ break;
54
+ }
55
+ default:
56
+ console.log("Usage: files <read|write|list|upload|download> [args...]");
17
57
  }
18
- case "write": {
19
- const path = parts[1];
20
- const content = parts.slice(2).join(" ");
21
- if (!path || !content) {
22
- console.log("Usage: files write <path> <content>");
23
- return;
24
- }
25
- await box.files.write({ path, content });
26
- console.log(`Written to ${path}`);
27
- break;
28
- }
29
- case "list": {
30
- const path = parts[1];
31
- const files = await box.files.list(path);
32
- for (const f of files) {
33
- const indicator = f.is_dir ? "/" : "";
34
- console.log(`${f.name}${indicator}\t${f.size}`);
35
- }
36
- break;
37
- }
38
- case "upload": {
39
- const localPath = parts[1];
40
- const destination = parts[2];
41
- if (!localPath || !destination) {
42
- console.log("Usage: files upload <local-path> <destination>");
43
- return;
44
- }
45
- await box.files.upload([{ path: localPath, destination }]);
46
- console.log(`Uploaded ${localPath} → ${destination}`);
47
- break;
48
- }
49
- case "download": {
50
- const path = parts[1];
51
- await box.files.download(path ? { path } : undefined);
52
- console.log("Downloaded.");
53
- break;
54
- }
55
- default:
56
- console.log("Usage: files <read|write|list|upload|download> [args...]");
57
- }
58
58
  }
59
- //# sourceMappingURL=files.js.map
59
+ //# sourceMappingURL=files.js.map
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Handle git subcommands: clone, diff, create-pr.
4
4
  */
5
5
  export declare function handleGit(box: Box, args: string): Promise<void>;
6
- //# sourceMappingURL=git.d.ts.map
6
+ //# sourceMappingURL=git.d.ts.map
@@ -2,37 +2,37 @@
2
2
  * Handle git subcommands: clone, diff, create-pr.
3
3
  */
4
4
  export async function handleGit(box, args) {
5
- const parts = args.split(/\s+/);
6
- const sub = parts[0];
7
- switch (sub) {
8
- case "clone": {
9
- const repo = parts[1];
10
- const branch = parts[2];
11
- if (!repo) {
12
- console.log("Usage: git clone <repo> [branch]");
13
- return;
14
- }
15
- await box.git.clone({ repo, branch });
16
- console.log(`Cloned ${repo}`);
17
- break;
5
+ const parts = args.split(/\s+/);
6
+ const sub = parts[0];
7
+ switch (sub) {
8
+ case "clone": {
9
+ const repo = parts[1];
10
+ const branch = parts[2];
11
+ if (!repo) {
12
+ console.log("Usage: git clone <repo> [branch]");
13
+ return;
14
+ }
15
+ await box.git.clone({ repo, branch });
16
+ console.log(`Cloned ${repo}`);
17
+ break;
18
+ }
19
+ case "diff": {
20
+ const diff = await box.git.diff();
21
+ console.log(diff || "(no changes)");
22
+ break;
23
+ }
24
+ case "create-pr": {
25
+ const title = parts.slice(1).join(" ");
26
+ if (!title) {
27
+ console.log("Usage: git create-pr <title>");
28
+ return;
29
+ }
30
+ const pr = await box.git.createPR({ title });
31
+ console.log(`PR #${pr.number}: ${pr.url}`);
32
+ break;
33
+ }
34
+ default:
35
+ console.log("Usage: git <clone|diff|create-pr> [args...]");
18
36
  }
19
- case "diff": {
20
- const diff = await box.git.diff();
21
- console.log(diff || "(no changes)");
22
- break;
23
- }
24
- case "create-pr": {
25
- const title = parts.slice(1).join(" ");
26
- if (!title) {
27
- console.log("Usage: git create-pr <title>");
28
- return;
29
- }
30
- const pr = await box.git.createPR({ title });
31
- console.log(`PR #${pr.number}: ${pr.url}`);
32
- break;
33
- }
34
- default:
35
- console.log("Usage: git <clone|diff|create-pr> [args...]");
36
- }
37
37
  }
38
- //# sourceMappingURL=git.js.map
38
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1,6 @@
1
+ import type { Box } from "@upstash/box";
2
+ /**
3
+ * Pause the box. Returns true to signal the REPL to exit.
4
+ */
5
+ export declare function handlePause(box: Box, _args: string): Promise<boolean>;
6
+ //# sourceMappingURL=pause.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pause.d.ts","sourceRoot":"","sources":["../../src/repl-commands/pause.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC;;GAEG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAI3E"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Pause the box. Returns true to signal the REPL to exit.
3
+ */
4
+ export async function handlePause(box, _args) {
5
+ await box.pause();
6
+ console.log(`Box ${box.id} paused.`);
7
+ return true;
8
+ }
9
+ //# sourceMappingURL=pause.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pause.js","sourceRoot":"","sources":["../../src/repl-commands/pause.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAQ,EAAE,KAAa;IACvD,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Run the agent with a prompt, streaming output to stdout.
4
4
  */
5
5
  export declare function handleRun(box: Box, prompt: string): Promise<void>;
6
- //# sourceMappingURL=run.d.ts.map
6
+ //# sourceMappingURL=run.d.ts.map
@@ -2,13 +2,13 @@
2
2
  * Run the agent with a prompt, streaming output to stdout.
3
3
  */
4
4
  export async function handleRun(box, prompt) {
5
- if (!prompt) {
6
- console.log("Usage: run <prompt>");
7
- return;
8
- }
9
- for await (const chunk of box.agent.stream({ prompt })) {
10
- process.stdout.write(chunk);
11
- }
12
- console.log();
5
+ if (!prompt) {
6
+ console.log("Usage: run <prompt>");
7
+ return;
8
+ }
9
+ for await (const chunk of box.agent.stream({ prompt })) {
10
+ process.stdout.write(chunk);
11
+ }
12
+ console.log();
13
13
  }
14
- //# sourceMappingURL=run.js.map
14
+ //# sourceMappingURL=run.js.map
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Create a snapshot of the current box state.
4
4
  */
5
5
  export declare function handleSnapshot(box: Box, args: string): Promise<void>;
6
- //# sourceMappingURL=snapshot.d.ts.map
6
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -2,8 +2,8 @@
2
2
  * Create a snapshot of the current box state.
3
3
  */
4
4
  export async function handleSnapshot(box, args) {
5
- const name = args.trim() || `snapshot-${Date.now()}`;
6
- const snapshot = await box.snapshot({ name });
7
- console.log(`Snapshot created: ${snapshot.id} (${snapshot.name})`);
5
+ const name = args.trim() || `snapshot-${Date.now()}`;
6
+ const snapshot = await box.snapshot({ name });
7
+ console.log(`Snapshot created: ${snapshot.id} (${snapshot.name})`);
8
8
  }
9
- //# sourceMappingURL=snapshot.js.map
9
+ //# sourceMappingURL=snapshot.js.map
package/dist/repl.d.ts CHANGED
@@ -3,4 +3,4 @@ import type { Box } from "@upstash/box";
3
3
  * Start an interactive REPL session for the given box.
4
4
  */
5
5
  export declare function startRepl(box: Box): Promise<void>;
6
- //# sourceMappingURL=repl.d.ts.map
6
+ //# sourceMappingURL=repl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAmBxC;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CvD"}
1
+ {"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAmBxC;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CvD"}
package/dist/repl.js CHANGED
@@ -5,60 +5,64 @@ import { handleExec } from "./repl-commands/exec.js";
5
5
  import { handleFiles } from "./repl-commands/files.js";
6
6
  import { handleGit } from "./repl-commands/git.js";
7
7
  import { handleSnapshot } from "./repl-commands/snapshot.js";
8
- import { handleStop } from "./repl-commands/stop.js";
8
+ import { handlePause } from "./repl-commands/pause.js";
9
9
  import { handleDelete } from "./repl-commands/delete.js";
10
10
  const COMMANDS = {
11
- run: handleRun,
12
- exec: handleExec,
13
- files: handleFiles,
14
- git: handleGit,
15
- snapshot: handleSnapshot,
16
- stop: handleStop,
17
- delete: handleDelete,
11
+ run: handleRun,
12
+ exec: handleExec,
13
+ files: handleFiles,
14
+ git: handleGit,
15
+ snapshot: handleSnapshot,
16
+ pause: handlePause,
17
+ delete: handleDelete,
18
18
  };
19
19
  /**
20
20
  * Start an interactive REPL session for the given box.
21
21
  */
22
22
  export async function startRepl(box) {
23
- const rl = createInterface({ input: stdin, output: stdout });
24
- console.log(`\nConnected to box ${box.id}`);
25
- console.log(
26
- `Type a prompt to run the agent, or use commands: ${Object.keys(COMMANDS).join(", ")}, exit\n`,
27
- );
28
- try {
29
- while (true) {
30
- const input = await rl.question(`${box.id}> `);
31
- const trimmed = input.trim();
32
- if (!trimmed) continue;
33
- if (trimmed === "exit" || trimmed === "/exit") {
34
- console.log("Goodbye.");
35
- break;
36
- }
37
- // Strip leading slash if present
38
- const normalized = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
39
- // Find matching command
40
- const spaceIdx = normalized.indexOf(" ");
41
- const cmdName = spaceIdx === -1 ? normalized : normalized.slice(0, spaceIdx);
42
- const args = spaceIdx === -1 ? "" : normalized.slice(spaceIdx + 1).trim();
43
- const handler = COMMANDS[cmdName];
44
- if (handler) {
45
- try {
46
- const shouldExit = await handler(box, args);
47
- if (shouldExit === true) break;
48
- } catch (err) {
49
- console.error(`Error: ${err instanceof Error ? err.message : err}`);
23
+ const rl = createInterface({ input: stdin, output: stdout });
24
+ console.log(`\nConnected to box ${box.id}`);
25
+ console.log(`Type a prompt to run the agent, or use commands: ${Object.keys(COMMANDS).join(", ")}, exit\n`);
26
+ try {
27
+ while (true) {
28
+ const input = await rl.question(`${box.id}> `);
29
+ const trimmed = input.trim();
30
+ if (!trimmed)
31
+ continue;
32
+ if (trimmed === "exit" || trimmed === "/exit") {
33
+ console.log("Goodbye.");
34
+ break;
35
+ }
36
+ // Strip leading slash if present
37
+ const normalized = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
38
+ // Find matching command
39
+ const spaceIdx = normalized.indexOf(" ");
40
+ const cmdName = spaceIdx === -1 ? normalized : normalized.slice(0, spaceIdx);
41
+ const args = spaceIdx === -1 ? "" : normalized.slice(spaceIdx + 1).trim();
42
+ const handler = COMMANDS[cmdName];
43
+ if (handler) {
44
+ try {
45
+ const shouldExit = await handler(box, args);
46
+ if (shouldExit === true)
47
+ break;
48
+ }
49
+ catch (err) {
50
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
51
+ }
52
+ }
53
+ else {
54
+ // Bare text → implicit run
55
+ try {
56
+ await handleRun(box, trimmed);
57
+ }
58
+ catch (err) {
59
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
60
+ }
61
+ }
50
62
  }
51
- } else {
52
- // Bare text → implicit run
53
- try {
54
- await handleRun(box, trimmed);
55
- } catch (err) {
56
- console.error(`Error: ${err instanceof Error ? err.message : err}`);
57
- }
58
- }
59
63
  }
60
- } finally {
61
- rl.close();
62
- }
64
+ finally {
65
+ rl.close();
66
+ }
63
67
  }
64
- //# sourceMappingURL=repl.js.map
68
+ //# sourceMappingURL=repl.js.map