@easybits.cloud/cli 0.3.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +36 -3
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -313,8 +313,13 @@ Falta, una sola vez:
313
313
  -d '{"repo":"https://github.com/TU/REPO.git","branch":"main",
314
314
  "tier":"micro","template":"node","appDir":"${appDir}","port":${port}}'
315
315
 
316
- Un repo privado necesita un token en la URL:
317
- https://x-access-token:TOKEN@github.com/TU/REPO.git
316
+ Repo privado: deja el URL limpio y agrega el token aparte,
317
+ "repoToken":"github_pat_\u2026"
318
+ (un token dentro del URL se rechaza).
319
+
320
+ \xBFTu build cabe en la caja? Entonces no necesitas este workflow:
321
+ POST /machines/SANDBOX_ID/push-deploy te da un webhook de GitHub
322
+ y cada push despliega solo. Docs: https://www.easybits.cloud/docs
318
323
 
319
324
  2. Guarda en el repo (Settings \u2192 Secrets and variables \u2192 Actions):
320
325
  EASYBITS_API_KEY tu key
@@ -335,8 +340,15 @@ async function sshProxy() {
335
340
  console.error("uso: easybits ssh-proxy <sandboxId|caja.ghosty>");
336
341
  process.exit(2);
337
342
  }
338
- const sandboxId = target.split(".")[0];
343
+ let sandboxId = target.split(".")[0];
339
344
  const eb = await createClientFromEnv();
345
+ if (!sandboxId.startsWith("sb_")) {
346
+ const hits = (await eb.sandboxes.list()).filter((s) => s.name === sandboxId);
347
+ if (hits.length === 0) throw new Error(`no hay ninguna caja llamada "${sandboxId}"`);
348
+ if (hits.length > 1)
349
+ throw new Error(`"${sandboxId}" es ambiguo: ${hits.length} cajas lo usan; pasa el sandboxId`);
350
+ sandboxId = hits[0].sandboxId;
351
+ }
340
352
  const sb = await eb.sandboxes.get(sandboxId);
341
353
  const { url } = await sb.sshTicket();
342
354
  const ws = new WebSocket(url);
@@ -356,6 +368,23 @@ async function sshProxy() {
356
368
  process.stdin.on("data", (chunk) => ws.send(chunk));
357
369
  process.stdin.on("end", () => ws.close());
358
370
  }
371
+ async function sshKey() {
372
+ const { homedir } = await import("os");
373
+ const { join } = await import("path");
374
+ const { existsSync: existsSync2, readFileSync: readFileSync2, mkdirSync: mkdirSync2 } = await import("fs");
375
+ const { execFileSync } = await import("child_process");
376
+ const dir = join(homedir(), ".ssh");
377
+ const key = join(dir, "easybits_ed25519");
378
+ const pub = `${key}.pub`;
379
+ if (!existsSync2(pub)) {
380
+ mkdirSync2(dir, { recursive: true, mode: 448 });
381
+ execFileSync("ssh-keygen", ["-t", "ed25519", "-N", "", "-f", key, "-C", "easybits"], {
382
+ stdio: ["ignore", "ignore", "inherit"]
383
+ });
384
+ console.error(`easybits: llave creada en ${key}`);
385
+ }
386
+ process.stdout.write(readFileSync2(pub, "utf8").trim() + "\n");
387
+ }
359
388
  var [cmd, sub] = [process.argv[2], process.argv[3]];
360
389
  switch (cmd) {
361
390
  case "login":
@@ -382,6 +411,9 @@ switch (cmd) {
382
411
  case "ssh-proxy":
383
412
  sshProxy();
384
413
  break;
414
+ case "ssh-key":
415
+ sshKey();
416
+ break;
385
417
  case "help":
386
418
  case void 0:
387
419
  console.log(`easybits CLI \u2014 @easybits.cloud/cli
@@ -396,6 +428,7 @@ Commands:
396
428
  providers list Show storage providers
397
429
  config Print MCP config JSON (streamable HTTP)
398
430
  mcp Print MCP stdio config JSON
431
+ ssh-key Print your public key for sandbox_ssh_enable (creates it once)
399
432
  ssh-proxy <id> SSH tunnel over 443 (use as ssh ProxyCommand)
400
433
 
401
434
  SSH to a box \u2014 add to ~/.ssh/config:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@easybits.cloud/cli",
3
- "version": "0.3.0",
4
- "description": "Official CLI for Easybits \u2014 manage files, storage, and MCP from your terminal",
3
+ "version": "0.4.1",
4
+ "description": "Official CLI for Easybits — manage files, storage, and MCP from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "easybits": "./dist/index.js"
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/easybits-cloud/easybits",
21
+ "url": "https://github.com/blissito/easybits",
22
22
  "directory": "cli"
23
23
  },
24
24
  "license": "MIT",
@@ -31,11 +31,11 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@easybits.cloud/sdk": "^0.30.0"
34
+ "@easybits.cloud/sdk": "^0.31.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "tsup": "^8.0.0",
38
38
  "typescript": "^5.7.0",
39
39
  "@types/node": "^22.0.0"
40
40
  }
41
- }
41
+ }