@pocketenv/cli 0.2.2 → 0.2.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 (3) hide show
  1. package/dist/index.js +68 -52
  2. package/package.json +2 -1
  3. package/src/index.ts +22 -17
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.2";
25
+ var version = "0.2.4";
26
26
 
27
27
  async function getAccessToken() {
28
28
  const tokenPath = path.join(os.homedir(), ".pocketenv", "token.json");
@@ -716,15 +716,19 @@ async function putSecret(sandbox, key) {
716
716
  }
717
717
  async function deleteSecret(id) {
718
718
  const token = await getAccessToken();
719
- await client.post("/xrpc/io.pocketenv.secret.deleteSecret", void 0, {
720
- params: {
721
- id
722
- },
723
- headers: {
724
- Authorization: `Bearer ${env$1.POCKETENV_TOKEN || token}`
725
- }
726
- });
727
- consola.success("Secret deleted successfully");
719
+ try {
720
+ await client.post("/xrpc/io.pocketenv.secret.deleteSecret", void 0, {
721
+ params: {
722
+ id
723
+ },
724
+ headers: {
725
+ Authorization: `Bearer ${env$1.POCKETENV_TOKEN || token}`
726
+ }
727
+ });
728
+ consola.success("Secret deleted successfully");
729
+ } catch {
730
+ consola.error("Failed to delete secret");
731
+ }
728
732
  }
729
733
 
730
734
  async function listEnvs(sandbox) {
@@ -824,13 +828,17 @@ async function putEnv(sandbox, key, value) {
824
828
  }
825
829
  async function deleteEnv(id) {
826
830
  const token = await getAccessToken();
827
- await client.post("/xrpc/io.pocketenv.variable.deleteVariable", void 0, {
828
- params: { id },
829
- headers: {
830
- Authorization: `Bearer ${env$1.POCKETENV_TOKEN || token}`
831
- }
832
- });
833
- consola.success("Variable deleted successfully");
831
+ try {
832
+ await client.post("/xrpc/io.pocketenv.variable.deleteVariable", void 0, {
833
+ params: { id },
834
+ headers: {
835
+ Authorization: `Bearer ${env$1.POCKETENV_TOKEN || token}`
836
+ }
837
+ });
838
+ consola.success("Variable deleted successfully");
839
+ } catch {
840
+ consola.error("Failed to delete variable");
841
+ }
834
842
  }
835
843
 
836
844
  function u32(n) {
@@ -1037,25 +1045,29 @@ async function putKeys(sandbox, options) {
1037
1045
  })() : body;
1038
1046
  return `${header}${maskedBody}${footer}`.replace(/\n/g, "\\n");
1039
1047
  })();
1040
- await client.post(
1041
- "/xrpc/io.pocketenv.sandbox.putSshKeys",
1042
- {
1043
- id: data.sandbox.id,
1044
- privateKey: encryptedPrivateKey,
1045
- publicKey,
1046
- redacted
1047
- },
1048
- {
1049
- headers: {
1050
- Authorization: `Bearer ${env$1.POCKETENV_TOKEN || token}`
1048
+ try {
1049
+ await client.post(
1050
+ "/xrpc/io.pocketenv.sandbox.putSshKeys",
1051
+ {
1052
+ id: data.sandbox.id,
1053
+ privateKey: encryptedPrivateKey,
1054
+ publicKey,
1055
+ redacted
1056
+ },
1057
+ {
1058
+ headers: {
1059
+ Authorization: `Bearer ${env$1.POCKETENV_TOKEN || token}`
1060
+ }
1051
1061
  }
1052
- }
1053
- );
1054
- consola.log("\nPrivate Key:");
1055
- consola.log(redacted.replace(/\\n/g, "\n"));
1056
- consola.log("\nPublic Key:");
1057
- consola.log(publicKey, "\n");
1058
- consola.success("SSH keys saved successfully!");
1062
+ );
1063
+ consola.log("\nPrivate Key:");
1064
+ consola.log(redacted.replace(/\\n/g, "\n"));
1065
+ consola.log("\nPublic Key:");
1066
+ consola.log(publicKey, "\n");
1067
+ consola.success("SSH keys saved successfully!");
1068
+ } catch {
1069
+ consola.error("Failed to save SSH keys");
1070
+ }
1059
1071
  }
1060
1072
 
1061
1073
  async function putAuthKey(sandbox) {
@@ -1137,31 +1149,35 @@ async function getTailscaleAuthKey(sandbox) {
1137
1149
  }
1138
1150
  }
1139
1151
 
1152
+ const c = {
1153
+ primary: (s) => chalk.rgb(0, 232, 198)(s),
1154
+ secondary: (s) => chalk.rgb(0, 198, 232)(s),
1155
+ accent: (s) => chalk.rgb(130, 100, 255)(s),
1156
+ highlight: (s) => chalk.rgb(100, 232, 130)(s),
1157
+ muted: (s) => chalk.rgb(200, 210, 220)(s),
1158
+ link: (s) => chalk.rgb(255, 160, 100)(s),
1159
+ sky: (s) => chalk.rgb(0, 210, 255)(s)
1160
+ };
1140
1161
  const program = new Command();
1141
1162
  program.name("pocketenv").description(
1142
- `
1143
- ___ __ __
1144
- / _ \\___ ____/ /_____ / /____ ___ _ __
1145
- / ___/ _ \\/ __/ '_/ -_) __/ -_) _ \\ |/ /
1146
- /_/ \\___/\\__/_/\\_\\__/\\__/\\__/_/ /_/___/
1147
-
1148
- Open, interoperable sandbox platform for agents and humans \u{1F4E6} \u2728
1149
- `
1163
+ `${chalk.bold.rgb(0, 232, 198)(`pocketenv v${version}`)} ${c.muted("\u2500")} ${c.muted("Open, interoperable sandbox platform for agents and humans")}`
1150
1164
  ).version(version);
1151
1165
  program.configureHelp({
1152
- styleTitle: (str) => chalk.bold.cyan(str),
1153
- styleCommandText: (str) => chalk.yellow(str),
1154
- styleDescriptionText: (str) => chalk.white(str),
1155
- styleOptionText: (str) => chalk.green(str),
1156
- styleArgumentText: (str) => chalk.magenta(str),
1157
- styleSubcommandText: (str) => chalk.blue(str)
1166
+ styleTitle: (str) => chalk.bold.rgb(0, 210, 255)(str),
1167
+ styleCommandText: (str) => c.secondary(str),
1168
+ styleDescriptionText: (str) => c.muted(str),
1169
+ styleOptionText: (str) => c.highlight(str),
1170
+ styleArgumentText: (str) => c.accent(str),
1171
+ styleSubcommandText: (str) => c.secondary(str)
1158
1172
  });
1159
1173
  program.addHelpText(
1160
1174
  "after",
1161
1175
  `
1162
- ${chalk.bold("\nLearn more about Pocketenv:")} ${chalk.magentaBright("https://docs.pocketenv.io")}
1163
- ${chalk.bold("Join our Discord community:")} ${chalk.blueBright("https://discord.gg/9ada4pFUFS")}
1164
- ${chalk.bold("Report bugs:")} ${chalk.greenBright("https://github.com/pocketenv-io/pocketenv/issues")}
1176
+ ${chalk.bold.rgb(0, 210, 255)("\u2500".repeat(90))}
1177
+ ${chalk.bold.rgb(0, 232, 198)("Learn more:")} ${c.link("https://docs.pocketenv.io")}
1178
+ ${chalk.bold.rgb(0, 232, 198)("Discord:")} ${c.link("https://discord.gg/9ada4pFUFS")}
1179
+ ${chalk.bold.rgb(0, 232, 198)("Report bugs:")} ${c.link("https://github.com/pocketenv-io/pocketenv/issues")}
1180
+ ${chalk.bold.rgb(0, 210, 255)("\u2500".repeat(90))}
1165
1181
  `
1166
1182
  );
1167
1183
  program.command("login").argument("<handle>", "your AT Proto handle (e.g., <username>.bsky.social)").description("login with your AT Proto account and get a session token").action(login);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "bin": {
5
5
  "pocketenv": "dist/index.js"
6
6
  },
7
- "version": "0.2.2",
7
+ "version": "0.2.4",
8
8
  "type": "module",
9
9
  "keywords": [
10
10
  "sandbox",
@@ -15,6 +15,7 @@
15
15
  "openclaw",
16
16
  "microvm"
17
17
  ],
18
+ "description": "Open, interoperable sandbox platform for agents and humans 📦 ✨",
18
19
  "author": "Tsiry Sandratraina <tsiry.sndr@pocketenv.io>",
19
20
  "license": "MPL-2.0",
20
21
  "repository": {
package/src/index.ts CHANGED
@@ -15,37 +15,42 @@ import { deleteEnv, listEnvs, putEnv } from "./cmd/env";
15
15
  import { getSshKey, putKeys } from "./cmd/sshkeys";
16
16
  import { getTailscaleAuthKey, putAuthKey } from "./cmd/tailscale";
17
17
 
18
+ const c = {
19
+ primary: (s: string) => chalk.rgb(0, 232, 198)(s),
20
+ secondary: (s: string) => chalk.rgb(0, 198, 232)(s),
21
+ accent: (s: string) => chalk.rgb(130, 100, 255)(s),
22
+ highlight: (s: string) => chalk.rgb(100, 232, 130)(s),
23
+ muted: (s: string) => chalk.rgb(200, 210, 220)(s),
24
+ link: (s: string) => chalk.rgb(255, 160, 100)(s),
25
+ sky: (s: string) => chalk.rgb(0, 210, 255)(s),
26
+ };
27
+
18
28
  const program = new Command();
19
29
 
20
30
  program
21
31
  .name("pocketenv")
22
32
  .description(
23
- `
24
- ___ __ __
25
- / _ \\___ ____/ /_____ / /____ ___ _ __
26
- / ___/ _ \\/ __/ '_/ -_) __/ -_) _ \\ |/ /
27
- /_/ \\___/\\__/_/\\_\\__/\\__/\\__/_/ /_/___/
28
-
29
- Open, interoperable sandbox platform for agents and humans 📦 ✨
30
- `,
33
+ `${chalk.bold.rgb(0, 232, 198)(`pocketenv v${version}`)} ${c.muted("─")} ${c.muted("Open, interoperable sandbox platform for agents and humans")}`,
31
34
  )
32
35
  .version(version);
33
36
 
34
37
  program.configureHelp({
35
- styleTitle: (str) => chalk.bold.cyan(str),
36
- styleCommandText: (str) => chalk.yellow(str),
37
- styleDescriptionText: (str) => chalk.white(str),
38
- styleOptionText: (str) => chalk.green(str),
39
- styleArgumentText: (str) => chalk.magenta(str),
40
- styleSubcommandText: (str) => chalk.blue(str),
38
+ styleTitle: (str) => chalk.bold.rgb(0, 210, 255)(str),
39
+ styleCommandText: (str) => c.secondary(str),
40
+ styleDescriptionText: (str) => c.muted(str),
41
+ styleOptionText: (str) => c.highlight(str),
42
+ styleArgumentText: (str) => c.accent(str),
43
+ styleSubcommandText: (str) => c.secondary(str),
41
44
  });
42
45
 
43
46
  program.addHelpText(
44
47
  "after",
45
48
  `
46
- ${chalk.bold("\nLearn more about Pocketenv:")} ${chalk.magentaBright("https://docs.pocketenv.io")}
47
- ${chalk.bold("Join our Discord community:")} ${chalk.blueBright("https://discord.gg/9ada4pFUFS")}
48
- ${chalk.bold("Report bugs:")} ${chalk.greenBright("https://github.com/pocketenv-io/pocketenv/issues")}
49
+ ${chalk.bold.rgb(0, 210, 255)("─".repeat(90))}
50
+ ${chalk.bold.rgb(0, 232, 198)("Learn more:")} ${c.link("https://docs.pocketenv.io")}
51
+ ${chalk.bold.rgb(0, 232, 198)("Discord:")} ${c.link("https://discord.gg/9ada4pFUFS")}
52
+ ${chalk.bold.rgb(0, 232, 198)("Report bugs:")} ${c.link("https://github.com/pocketenv-io/pocketenv/issues")}
53
+ ${chalk.bold.rgb(0, 210, 255)("─".repeat(90))}
49
54
  `,
50
55
  );
51
56