@easybits.cloud/cli 0.3.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.
- package/dist/index.js +29 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -335,8 +335,15 @@ async function sshProxy() {
|
|
|
335
335
|
console.error("uso: easybits ssh-proxy <sandboxId|caja.ghosty>");
|
|
336
336
|
process.exit(2);
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
let sandboxId = target.split(".")[0];
|
|
339
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
|
+
}
|
|
340
347
|
const sb = await eb.sandboxes.get(sandboxId);
|
|
341
348
|
const { url } = await sb.sshTicket();
|
|
342
349
|
const ws = new WebSocket(url);
|
|
@@ -356,6 +363,23 @@ async function sshProxy() {
|
|
|
356
363
|
process.stdin.on("data", (chunk) => ws.send(chunk));
|
|
357
364
|
process.stdin.on("end", () => ws.close());
|
|
358
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
|
+
}
|
|
359
383
|
var [cmd, sub] = [process.argv[2], process.argv[3]];
|
|
360
384
|
switch (cmd) {
|
|
361
385
|
case "login":
|
|
@@ -382,6 +406,9 @@ switch (cmd) {
|
|
|
382
406
|
case "ssh-proxy":
|
|
383
407
|
sshProxy();
|
|
384
408
|
break;
|
|
409
|
+
case "ssh-key":
|
|
410
|
+
sshKey();
|
|
411
|
+
break;
|
|
385
412
|
case "help":
|
|
386
413
|
case void 0:
|
|
387
414
|
console.log(`easybits CLI \u2014 @easybits.cloud/cli
|
|
@@ -396,6 +423,7 @@ Commands:
|
|
|
396
423
|
providers list Show storage providers
|
|
397
424
|
config Print MCP config JSON (streamable HTTP)
|
|
398
425
|
mcp Print MCP stdio config JSON
|
|
426
|
+
ssh-key Print your public key for sandbox_ssh_enable (creates it once)
|
|
399
427
|
ssh-proxy <id> SSH tunnel over 443 (use as ssh ProxyCommand)
|
|
400
428
|
|
|
401
429
|
SSH to a box \u2014 add to ~/.ssh/config:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easybits.cloud/cli",
|
|
3
|
-
"version": "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.
|
|
34
|
+
"@easybits.cloud/sdk": "^0.31.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"tsup": "^8.0.0",
|