@pocketenv/cli 0.2.0 → 0.2.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 +14 -7
- package/package.json +1 -1
- package/src/cmd/create.ts +12 -2
- package/src/index.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|
|
22
22
|
import { password, editor, input } from '@inquirer/prompts';
|
|
23
23
|
import sodium from 'libsodium-wrappers';
|
|
24
24
|
|
|
25
|
-
var version = "0.2.
|
|
25
|
+
var version = "0.2.1";
|
|
26
26
|
|
|
27
27
|
async function getAccessToken() {
|
|
28
28
|
const tokenPath = path.join(os.homedir(), ".pocketenv", "token.json");
|
|
@@ -161,7 +161,7 @@ async function ssh$2(sandbox) {
|
|
|
161
161
|
let cols = process.stdout.columns ?? 220;
|
|
162
162
|
let rows = process.stdout.rows ?? 50;
|
|
163
163
|
consola.info(
|
|
164
|
-
`Connecting to ${chalk.cyanBright(sandbox.name)} via Cloudflare
|
|
164
|
+
`Connecting to ${chalk.cyanBright(sandbox.name)} via Cloudflare Sandbox\u2026`
|
|
165
165
|
);
|
|
166
166
|
const ws = new WebSocket(wsUrl.toString(), {
|
|
167
167
|
headers: { "User-Agent": "pocketenv-cli" }
|
|
@@ -539,7 +539,11 @@ async function stop(name) {
|
|
|
539
539
|
consola.success(`Sandbox ${chalk.greenBright(name)} stopped`);
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
-
async function createSandbox(name, {
|
|
542
|
+
async function createSandbox(name, {
|
|
543
|
+
provider,
|
|
544
|
+
ssh: ssh$1,
|
|
545
|
+
base
|
|
546
|
+
}) {
|
|
543
547
|
const token = await getAccessToken();
|
|
544
548
|
if (["deno", "vercel", "daytona"].includes(provider || "")) {
|
|
545
549
|
consola.error(
|
|
@@ -552,7 +556,7 @@ async function createSandbox(name, { provider, ssh: ssh$1 }) {
|
|
|
552
556
|
"/xrpc/io.pocketenv.sandbox.createSandbox",
|
|
553
557
|
{
|
|
554
558
|
name,
|
|
555
|
-
base: "at://did:plc:aturpi2ls3yvsmhc6wybomun/io.pocketenv.sandbox/openclaw",
|
|
559
|
+
base: base ?? "at://did:plc:aturpi2ls3yvsmhc6wybomun/io.pocketenv.sandbox/openclaw",
|
|
556
560
|
provider: provider ?? "cloudflare"
|
|
557
561
|
},
|
|
558
562
|
{
|
|
@@ -1158,7 +1162,10 @@ program.command("console").aliases(["shell", "ssh", "s"]).argument("[sandbox]",
|
|
|
1158
1162
|
program.command("ls").description("list sandboxes").action(listSandboxes);
|
|
1159
1163
|
program.command("start").argument("<sandbox>", "the sandbox to start").description("start the given sandbox").action(start);
|
|
1160
1164
|
program.command("stop").argument("<sandbox>", "the sandbox to stop").description("stop the given sandbox").action(stop);
|
|
1161
|
-
program.command("create").aliases(["new"]).option("--provider, -p <provider>", "the provider to use for the sandbox").option(
|
|
1165
|
+
program.command("create").aliases(["new"]).option("--provider, -p <provider>", "the provider to use for the sandbox").option(
|
|
1166
|
+
"--base, -b <base>",
|
|
1167
|
+
"the base sandbox to use for the sandbox, e.g. openclaw, claude-code, codex, copilot ..."
|
|
1168
|
+
).option("--ssh, -s", "connect to the Sandbox and automatically open a shell").argument("[name]", "the name of the sandbox to create").description("create a new sandbox").action(createSandbox);
|
|
1162
1169
|
program.command("logout").description("logout (removes session token)").action(logout);
|
|
1163
1170
|
program.command("rm").aliases(["delete", "remove"]).argument("<sandbox>", "the sandbox to delete").description("delete the given sandbox").action(deleteSandbox);
|
|
1164
1171
|
const secret = program.command("secret").description("manage secrets");
|
|
@@ -1173,8 +1180,8 @@ const sshkeys = program.command("sshkeys").description("manage SSH keys");
|
|
|
1173
1180
|
sshkeys.command("put").argument("<sandbox>", "the sandbox to put the SSH key in").option("--private-key <path>", "the path to the SSH private key").option("--public-key <path>", "the path to the SSH public key").option("--generate, -g", "generate a new SSH key pair").description("put an SSH key in the given sandbox").action(putKeys);
|
|
1174
1181
|
sshkeys.command("get").argument("<sandbox>", "the sandbox to get the SSH key from").description("get an SSH key (public key only) from the given sandbox").action(getSshKey);
|
|
1175
1182
|
const tailscale = program.command("tailscale").description("manage Tailscale");
|
|
1176
|
-
tailscale.command("put").argument("<sandbox>", "the sandbox to put the Tailscale Auth Key in").description("put a Tailscale
|
|
1177
|
-
tailscale.command("get").argument("<sandbox>", "the sandbox to get the Tailscale
|
|
1183
|
+
tailscale.command("put").argument("<sandbox>", "the sandbox to put the Tailscale Auth Key in").description("put a Tailscale Auth Key in the given sandbox").action(putAuthKey);
|
|
1184
|
+
tailscale.command("get").argument("<sandbox>", "the sandbox to get the Tailscale Auth Key from").description("get a Tailscale Auth Key (redacted) from the given sandbox").action(getTailscaleAuthKey);
|
|
1178
1185
|
if (process.argv.length <= 2) {
|
|
1179
1186
|
program.help();
|
|
1180
1187
|
}
|
package/package.json
CHANGED
package/src/cmd/create.ts
CHANGED
|
@@ -7,7 +7,15 @@ import connectToSandbox from "./ssh";
|
|
|
7
7
|
|
|
8
8
|
async function createSandbox(
|
|
9
9
|
name: string,
|
|
10
|
-
{
|
|
10
|
+
{
|
|
11
|
+
provider,
|
|
12
|
+
ssh,
|
|
13
|
+
base,
|
|
14
|
+
}: {
|
|
15
|
+
provider: string | undefined;
|
|
16
|
+
ssh: boolean | undefined;
|
|
17
|
+
base: string | undefined;
|
|
18
|
+
},
|
|
11
19
|
) {
|
|
12
20
|
const token = await getAccessToken();
|
|
13
21
|
|
|
@@ -22,7 +30,9 @@ async function createSandbox(
|
|
|
22
30
|
"/xrpc/io.pocketenv.sandbox.createSandbox",
|
|
23
31
|
{
|
|
24
32
|
name,
|
|
25
|
-
base:
|
|
33
|
+
base:
|
|
34
|
+
base ??
|
|
35
|
+
"at://did:plc:aturpi2ls3yvsmhc6wybomun/io.pocketenv.sandbox/openclaw",
|
|
26
36
|
provider: provider ?? "cloudflare",
|
|
27
37
|
},
|
|
28
38
|
{
|
package/src/index.ts
CHANGED
|
@@ -85,6 +85,10 @@ program
|
|
|
85
85
|
.command("create")
|
|
86
86
|
.aliases(["new"])
|
|
87
87
|
.option("--provider, -p <provider>", "the provider to use for the sandbox")
|
|
88
|
+
.option(
|
|
89
|
+
"--base, -b <base>",
|
|
90
|
+
"the base sandbox to use for the sandbox, e.g. openclaw, claude-code, codex, copilot ...",
|
|
91
|
+
)
|
|
88
92
|
.option("--ssh, -s", "connect to the Sandbox and automatically open a shell")
|
|
89
93
|
.argument("[name]", "the name of the sandbox to create")
|
|
90
94
|
.description("create a new sandbox")
|