@easybits.cloud/cli 0.2.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +65 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -329,6 +329,57 @@ Falta, una sola vez:
329
329
 
330
330
  Desde ah\xED, cada push a main despliega.`);
331
331
  }
332
+ async function sshProxy() {
333
+ const target = process.argv[3];
334
+ if (!target) {
335
+ console.error("uso: easybits ssh-proxy <sandboxId|caja.ghosty>");
336
+ process.exit(2);
337
+ }
338
+ let sandboxId = target.split(".")[0];
339
+ const eb = await createClientFromEnv();
340
+ if (!sandboxId.startsWith("sb_")) {
341
+ const hits = (await eb.sandboxes.list()).filter((s) => s.name === sandboxId);
342
+ if (hits.length === 0) throw new Error(`no hay ninguna caja llamada "${sandboxId}"`);
343
+ if (hits.length > 1)
344
+ throw new Error(`"${sandboxId}" es ambiguo: ${hits.length} cajas lo usan; pasa el sandboxId`);
345
+ sandboxId = hits[0].sandboxId;
346
+ }
347
+ const sb = await eb.sandboxes.get(sandboxId);
348
+ const { url } = await sb.sshTicket();
349
+ const ws = new WebSocket(url);
350
+ ws.binaryType = "arraybuffer";
351
+ ws.onerror = () => {
352
+ console.error("easybits ssh-proxy: no se pudo abrir el t\xFAnel");
353
+ process.exit(1);
354
+ };
355
+ ws.onclose = () => process.exit(0);
356
+ ws.onmessage = (ev) => {
357
+ const data = ev.data;
358
+ process.stdout.write(
359
+ typeof data === "string" ? Buffer.from(data) : Buffer.from(data)
360
+ );
361
+ };
362
+ await new Promise((resolve) => ws.onopen = () => resolve());
363
+ process.stdin.on("data", (chunk) => ws.send(chunk));
364
+ process.stdin.on("end", () => ws.close());
365
+ }
366
+ async function sshKey() {
367
+ const { homedir } = await import("os");
368
+ const { join } = await import("path");
369
+ const { existsSync: existsSync2, readFileSync: readFileSync2, mkdirSync: mkdirSync2 } = await import("fs");
370
+ const { execFileSync } = await import("child_process");
371
+ const dir = join(homedir(), ".ssh");
372
+ const key = join(dir, "easybits_ed25519");
373
+ const pub = `${key}.pub`;
374
+ if (!existsSync2(pub)) {
375
+ mkdirSync2(dir, { recursive: true, mode: 448 });
376
+ execFileSync("ssh-keygen", ["-t", "ed25519", "-N", "", "-f", key, "-C", "easybits"], {
377
+ stdio: ["ignore", "ignore", "inherit"]
378
+ });
379
+ console.error(`easybits: llave creada en ${key}`);
380
+ }
381
+ process.stdout.write(readFileSync2(pub, "utf8").trim() + "\n");
382
+ }
332
383
  var [cmd, sub] = [process.argv[2], process.argv[3]];
333
384
  switch (cmd) {
334
385
  case "login":
@@ -352,6 +403,12 @@ switch (cmd) {
352
403
  case "mcp":
353
404
  printMcpStdioConfig();
354
405
  break;
406
+ case "ssh-proxy":
407
+ sshProxy();
408
+ break;
409
+ case "ssh-key":
410
+ sshKey();
411
+ break;
355
412
  case "help":
356
413
  case void 0:
357
414
  console.log(`easybits CLI \u2014 @easybits.cloud/cli
@@ -365,7 +422,14 @@ Commands:
365
422
  files delete <id> Delete a file
366
423
  providers list Show storage providers
367
424
  config Print MCP config JSON (streamable HTTP)
368
- mcp Print MCP stdio config JSON`);
425
+ mcp Print MCP stdio config JSON
426
+ ssh-key Print your public key for sandbox_ssh_enable (creates it once)
427
+ ssh-proxy <id> SSH tunnel over 443 (use as ssh ProxyCommand)
428
+
429
+ SSH to a box \u2014 add to ~/.ssh/config:
430
+ Host *.ghosty
431
+ ProxyCommand easybits ssh-proxy %h
432
+ User root`);
369
433
  break;
370
434
  default:
371
435
  console.error(`Unknown command: ${cmd}. Run 'easybits help'`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easybits.cloud/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Official CLI for Easybits \u2014 manage files, storage, and MCP from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@easybits.cloud/sdk": "^0.28.0"
34
+ "@easybits.cloud/sdk": "^0.31.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "tsup": "^8.0.0",