sandbox 2.0.3 → 2.1.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/LICENSE +201 -21
- package/dist/{app-JwdJjZ6c.mjs → app-DtmaeGtx.mjs} +414 -259
- package/dist/app-DtmaeGtx.mjs.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/pty-server-linux-x86_64 +0 -0
- package/dist/sandbox.mjs +1 -1
- package/package.json +3 -3
- package/dist/app-JwdJjZ6c.mjs.map +0 -1
|
@@ -622,8 +622,8 @@ var require_effects = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
622
622
|
* with a command line, and again, to mock `stdout` and `stderr` it if we want to test it.
|
|
623
623
|
*/
|
|
624
624
|
var Exit = class {
|
|
625
|
-
constructor(config) {
|
|
626
|
-
this.config = config;
|
|
625
|
+
constructor(config$1) {
|
|
626
|
+
this.config = config$1;
|
|
627
627
|
}
|
|
628
628
|
run() {
|
|
629
629
|
this.output()(this.config.message);
|
|
@@ -867,65 +867,65 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
867
867
|
displayName: "true/false",
|
|
868
868
|
defaultValue: () => false
|
|
869
869
|
};
|
|
870
|
-
function fullFlag(config) {
|
|
870
|
+
function fullFlag(config$1) {
|
|
871
871
|
var _a;
|
|
872
|
-
const decoder = (0, type_1$2.extendType)(exports.boolean, config.type);
|
|
872
|
+
const decoder = (0, type_1$2.extendType)(exports.boolean, config$1.type);
|
|
873
873
|
return {
|
|
874
|
-
description: (_a = config.description) !== null && _a !== void 0 ? _a : config.type.description,
|
|
874
|
+
description: (_a = config$1.description) !== null && _a !== void 0 ? _a : config$1.type.description,
|
|
875
875
|
helpTopics() {
|
|
876
876
|
var _a$1, _b;
|
|
877
|
-
let usage = `--${config.long}`;
|
|
878
|
-
if (config.short) usage += `, -${config.short}`;
|
|
877
|
+
let usage = `--${config$1.long}`;
|
|
878
|
+
if (config$1.short) usage += `, -${config$1.short}`;
|
|
879
879
|
const defaults = [];
|
|
880
|
-
if (config.env) {
|
|
881
|
-
const env$2 = process.env[config.env] === void 0 ? "" : `=${chalk_1$6.default.italic(process.env[config.env])}`;
|
|
882
|
-
defaults.push(`env: ${config.env}${env$2}`);
|
|
880
|
+
if (config$1.env) {
|
|
881
|
+
const env$2 = process.env[config$1.env] === void 0 ? "" : `=${chalk_1$6.default.italic(process.env[config$1.env])}`;
|
|
882
|
+
defaults.push(`env: ${config$1.env}${env$2}`);
|
|
883
883
|
}
|
|
884
|
-
if (config.defaultValue) try {
|
|
885
|
-
const defaultValue = config.defaultValue();
|
|
886
|
-
if (config.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
884
|
+
if (config$1.defaultValue) try {
|
|
885
|
+
const defaultValue = config$1.defaultValue();
|
|
886
|
+
if (config$1.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
887
887
|
else defaults.push("optional");
|
|
888
888
|
} catch (e) {}
|
|
889
|
-
else if (config.type.defaultValue) try {
|
|
890
|
-
const defaultValue = config.type.defaultValue();
|
|
891
|
-
if (config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
889
|
+
else if (config$1.type.defaultValue) try {
|
|
890
|
+
const defaultValue = config$1.type.defaultValue();
|
|
891
|
+
if (config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
892
892
|
else defaults.push("optional");
|
|
893
893
|
} catch (e) {}
|
|
894
|
-
else if (config.onMissing || config.type.onMissing) defaults.push("optional");
|
|
894
|
+
else if (config$1.onMissing || config$1.type.onMissing) defaults.push("optional");
|
|
895
895
|
return [{
|
|
896
896
|
category: "flags",
|
|
897
897
|
usage,
|
|
898
898
|
defaults,
|
|
899
|
-
description: (_b = (_a$1 = config.description) !== null && _a$1 !== void 0 ? _a$1 : config.type.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
899
|
+
description: (_b = (_a$1 = config$1.description) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
900
900
|
}];
|
|
901
901
|
},
|
|
902
902
|
register(opts) {
|
|
903
|
-
opts.forceFlagLongNames.add(config.long);
|
|
904
|
-
if (config.short) opts.forceFlagShortNames.add(config.short);
|
|
903
|
+
opts.forceFlagLongNames.add(config$1.long);
|
|
904
|
+
if (config$1.short) opts.forceFlagShortNames.add(config$1.short);
|
|
905
905
|
},
|
|
906
906
|
async parse({ nodes, visitedNodes }) {
|
|
907
907
|
var _a$1, _b;
|
|
908
908
|
const options = (0, findOption_1$3.findOption)(nodes, {
|
|
909
|
-
longNames: [config.long],
|
|
910
|
-
shortNames: config.short ? [config.short] : []
|
|
909
|
+
longNames: [config$1.long],
|
|
910
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
911
911
|
}).filter((x) => !visitedNodes.has(x));
|
|
912
912
|
options.forEach((opt) => visitedNodes.add(opt));
|
|
913
913
|
if (options.length > 1) return Result$10.err({ errors: [{
|
|
914
914
|
nodes: options,
|
|
915
915
|
message: `Expected 1 occurence, got ${options.length}`
|
|
916
916
|
}] });
|
|
917
|
-
const valueFromEnv = config.env ? process.env[config.env] : void 0;
|
|
918
|
-
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
917
|
+
const valueFromEnv = config$1.env ? process.env[config$1.env] : void 0;
|
|
918
|
+
const onMissingFn = config$1.onMissing || config$1.type.onMissing;
|
|
919
919
|
let rawValue;
|
|
920
920
|
let envPrefix = "";
|
|
921
921
|
if (options.length === 0 && valueFromEnv !== void 0) {
|
|
922
922
|
rawValue = valueFromEnv;
|
|
923
|
-
envPrefix = `env[${chalk_1$6.default.italic(config.env)}]: `;
|
|
924
|
-
} else if (options.length === 0 && config.defaultValue) try {
|
|
925
|
-
const defaultValue = config.defaultValue();
|
|
923
|
+
envPrefix = `env[${chalk_1$6.default.italic(config$1.env)}]: `;
|
|
924
|
+
} else if (options.length === 0 && config$1.defaultValue) try {
|
|
925
|
+
const defaultValue = config$1.defaultValue();
|
|
926
926
|
return Result$10.ok(defaultValue);
|
|
927
927
|
} catch (e) {
|
|
928
|
-
const message = `Default value not found for '--${config.long}': ${e.message}`;
|
|
928
|
+
const message = `Default value not found for '--${config$1.long}': ${e.message}`;
|
|
929
929
|
return Result$10.err({ errors: [{
|
|
930
930
|
message,
|
|
931
931
|
nodes: []
|
|
@@ -935,17 +935,17 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
935
935
|
const missingValue = await onMissingFn();
|
|
936
936
|
return Result$10.ok(missingValue);
|
|
937
937
|
} catch (e) {
|
|
938
|
-
const message = `Failed to get missing value for '--${config.long}': ${e.message}`;
|
|
938
|
+
const message = `Failed to get missing value for '--${config$1.long}': ${e.message}`;
|
|
939
939
|
return Result$10.err({ errors: [{
|
|
940
940
|
message,
|
|
941
941
|
nodes: []
|
|
942
942
|
}] });
|
|
943
943
|
}
|
|
944
|
-
else if (options.length === 0 && config.type.defaultValue) try {
|
|
945
|
-
const defaultValue = config.type.defaultValue();
|
|
944
|
+
else if (options.length === 0 && config$1.type.defaultValue) try {
|
|
945
|
+
const defaultValue = config$1.type.defaultValue();
|
|
946
946
|
return Result$10.ok(defaultValue);
|
|
947
947
|
} catch (e) {
|
|
948
|
-
const message = `Default value not found for '--${config.long}': ${e.message}`;
|
|
948
|
+
const message = `Default value not found for '--${config$1.long}': ${e.message}`;
|
|
949
949
|
return Result$10.err({ errors: [{
|
|
950
950
|
message,
|
|
951
951
|
nodes: []
|
|
@@ -954,7 +954,7 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
954
954
|
else if (options.length === 1) rawValue = (_b = (_a$1 = options[0].value) === null || _a$1 === void 0 ? void 0 : _a$1.node.raw) !== null && _b !== void 0 ? _b : "true";
|
|
955
955
|
else return Result$10.err({ errors: [{
|
|
956
956
|
nodes: [],
|
|
957
|
-
message: `No value provided for --${config.long}`
|
|
957
|
+
message: `No value provided for --${config$1.long}`
|
|
958
958
|
}] });
|
|
959
959
|
const decoded = await Result$10.safeAsync(decoder.from(rawValue));
|
|
960
960
|
if (Result$10.isErr(decoded)) return Result$10.err({ errors: [{
|
|
@@ -965,10 +965,10 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
965
965
|
}
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
|
-
function flag(config) {
|
|
968
|
+
function flag(config$1) {
|
|
969
969
|
return fullFlag({
|
|
970
970
|
type: types_1$4.boolean,
|
|
971
|
-
...config
|
|
971
|
+
...config$1
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
974
|
}) });
|
|
@@ -1146,24 +1146,24 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1146
1146
|
const chalk_1$5 = __importDefault$8((init_source(), __toCommonJS$3(source_exports)));
|
|
1147
1147
|
const Result$8 = __importStar$8(require_Result());
|
|
1148
1148
|
const types_1$2 = require_types();
|
|
1149
|
-
function fullPositional(config) {
|
|
1149
|
+
function fullPositional(config$1) {
|
|
1150
1150
|
var _a, _b, _c;
|
|
1151
|
-
const displayName = (_b = (_a = config.displayName) !== null && _a !== void 0 ? _a : config.type.displayName) !== null && _b !== void 0 ? _b : "arg";
|
|
1151
|
+
const displayName = (_b = (_a = config$1.displayName) !== null && _a !== void 0 ? _a : config$1.type.displayName) !== null && _b !== void 0 ? _b : "arg";
|
|
1152
1152
|
return {
|
|
1153
|
-
description: (_c = config.description) !== null && _c !== void 0 ? _c : config.type.description,
|
|
1153
|
+
description: (_c = config$1.description) !== null && _c !== void 0 ? _c : config$1.type.description,
|
|
1154
1154
|
helpTopics() {
|
|
1155
1155
|
var _a$1, _b$1, _c$1, _d;
|
|
1156
1156
|
const defaults = [];
|
|
1157
|
-
const defaultValueFn = (_a$1 = config.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config.type.defaultValue;
|
|
1157
|
+
const defaultValueFn = (_a$1 = config$1.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.defaultValue;
|
|
1158
1158
|
if (defaultValueFn) try {
|
|
1159
1159
|
const defaultValue = defaultValueFn();
|
|
1160
|
-
if ((_b$1 = config.defaultValueIsSerializable) !== null && _b$1 !== void 0 ? _b$1 : config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$5.default.italic(defaultValue)}`);
|
|
1160
|
+
if ((_b$1 = config$1.defaultValueIsSerializable) !== null && _b$1 !== void 0 ? _b$1 : config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$5.default.italic(defaultValue)}`);
|
|
1161
1161
|
else defaults.push("optional");
|
|
1162
1162
|
} catch (e) {}
|
|
1163
1163
|
return [{
|
|
1164
1164
|
category: "arguments",
|
|
1165
1165
|
usage: defaults.length > 0 ? `[${displayName}]` : `<${displayName}>`,
|
|
1166
|
-
description: (_d = (_c$1 = config.description) !== null && _c$1 !== void 0 ? _c$1 : config.type.description) !== null && _d !== void 0 ? _d : "self explanatory",
|
|
1166
|
+
description: (_d = (_c$1 = config$1.description) !== null && _c$1 !== void 0 ? _c$1 : config$1.type.description) !== null && _d !== void 0 ? _d : "self explanatory",
|
|
1167
1167
|
defaults
|
|
1168
1168
|
}];
|
|
1169
1169
|
},
|
|
@@ -1171,7 +1171,7 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1171
1171
|
async parse({ nodes, visitedNodes }) {
|
|
1172
1172
|
var _a$1;
|
|
1173
1173
|
const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
|
|
1174
|
-
const defaultValueFn = (_a$1 = config.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config.type.defaultValue;
|
|
1174
|
+
const defaultValueFn = (_a$1 = config$1.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.defaultValue;
|
|
1175
1175
|
const positional$1 = positionals[0];
|
|
1176
1176
|
if (!positional$1) {
|
|
1177
1177
|
if (defaultValueFn) return Result$8.ok(defaultValueFn());
|
|
@@ -1181,7 +1181,7 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1181
1181
|
}] });
|
|
1182
1182
|
}
|
|
1183
1183
|
visitedNodes.add(positional$1);
|
|
1184
|
-
const decoded = await Result$8.safeAsync(config.type.from(positional$1.raw));
|
|
1184
|
+
const decoded = await Result$8.safeAsync(config$1.type.from(positional$1.raw));
|
|
1185
1185
|
if (Result$8.isErr(decoded)) return Result$8.err({ errors: [{
|
|
1186
1186
|
nodes: [positional$1],
|
|
1187
1187
|
message: decoded.error.message
|
|
@@ -1190,10 +1190,10 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1190
1190
|
}
|
|
1191
1191
|
};
|
|
1192
1192
|
}
|
|
1193
|
-
function positional(config) {
|
|
1193
|
+
function positional(config$1) {
|
|
1194
1194
|
return fullPositional({
|
|
1195
1195
|
type: types_1$2.string,
|
|
1196
|
-
...config
|
|
1196
|
+
...config$1
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
1199
1199
|
}) });
|
|
@@ -1255,13 +1255,13 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1255
1255
|
/**
|
|
1256
1256
|
* Combine multiple `command`s into one
|
|
1257
1257
|
*/
|
|
1258
|
-
function subcommands$2(config) {
|
|
1259
|
-
const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config.version);
|
|
1258
|
+
function subcommands$2(config$1) {
|
|
1259
|
+
const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config$1.version);
|
|
1260
1260
|
const subcommand = (0, positional_1$1.positional)({
|
|
1261
1261
|
displayName: "subcommand",
|
|
1262
|
-
description: `one of ${Object.keys(config.cmds).join(", ")}`,
|
|
1262
|
+
description: `one of ${Object.keys(config$1.cmds).join(", ")}`,
|
|
1263
1263
|
type: { async from(str) {
|
|
1264
|
-
const commands = Object.entries(config.cmds).map(([name, cmd$1]) => {
|
|
1264
|
+
const commands = Object.entries(config$1.cmds).map(([name, cmd$1]) => {
|
|
1265
1265
|
var _a;
|
|
1266
1266
|
return {
|
|
1267
1267
|
cmdName: name,
|
|
@@ -1281,7 +1281,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1281
1281
|
});
|
|
1282
1282
|
function normalizeContext(context) {
|
|
1283
1283
|
var _a;
|
|
1284
|
-
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config.name);
|
|
1284
|
+
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config$1.name);
|
|
1285
1285
|
if (!context.nodes.some((n) => !context.visitedNodes.has(n))) context.nodes.push({
|
|
1286
1286
|
type: "longOption",
|
|
1287
1287
|
index: 0,
|
|
@@ -1290,14 +1290,14 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
1292
|
return {
|
|
1293
|
-
version: config.version,
|
|
1294
|
-
description: config.description,
|
|
1295
|
-
name: config.name,
|
|
1293
|
+
version: config$1.version,
|
|
1294
|
+
description: config$1.description,
|
|
1295
|
+
name: config$1.name,
|
|
1296
1296
|
handler: (value) => {
|
|
1297
|
-
return config.cmds[value.command].handler(value.args);
|
|
1297
|
+
return config$1.cmds[value.command].handler(value.args);
|
|
1298
1298
|
},
|
|
1299
1299
|
register(opts) {
|
|
1300
|
-
for (const cmd of Object.values(config.cmds)) cmd.register(opts);
|
|
1300
|
+
for (const cmd of Object.values(config$1.cmds)) cmd.register(opts);
|
|
1301
1301
|
circuitbreaker.register(opts);
|
|
1302
1302
|
},
|
|
1303
1303
|
printHelp(context) {
|
|
@@ -1305,12 +1305,12 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1305
1305
|
const lines = [];
|
|
1306
1306
|
const argsSoFar = (_b = (_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "cli";
|
|
1307
1307
|
lines.push(chalk_1$4.default.bold(argsSoFar + chalk_1$4.default.italic(" <subcommand>")));
|
|
1308
|
-
if (config.description) lines.push(chalk_1$4.default.dim("> ") + config.description);
|
|
1308
|
+
if (config$1.description) lines.push(chalk_1$4.default.dim("> ") + config$1.description);
|
|
1309
1309
|
lines.push("");
|
|
1310
1310
|
lines.push(`where ${chalk_1$4.default.italic("<subcommand>")} can be one of:`);
|
|
1311
1311
|
lines.push("");
|
|
1312
|
-
for (const key of Object.keys(config.cmds)) {
|
|
1313
|
-
const cmd = config.cmds[key];
|
|
1312
|
+
for (const key of Object.keys(config$1.cmds)) {
|
|
1313
|
+
const cmd = config$1.cmds[key];
|
|
1314
1314
|
let description = (_c = cmd.description) !== null && _c !== void 0 ? _c : "";
|
|
1315
1315
|
description = description && ` - ${description} `;
|
|
1316
1316
|
if ((_d = cmd.aliases) === null || _d === void 0 ? void 0 : _d.length) {
|
|
@@ -1335,7 +1335,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1335
1335
|
partialValue: {}
|
|
1336
1336
|
});
|
|
1337
1337
|
(_a = context.hotPath) === null || _a === void 0 || _a.push(parsed.value);
|
|
1338
|
-
const parsedCommand = await config.cmds[parsed.value].parse(context);
|
|
1338
|
+
const parsedCommand = await config$1.cmds[parsed.value].parse(context);
|
|
1339
1339
|
if (Result$7.isErr(parsedCommand)) return Result$7.err({
|
|
1340
1340
|
errors: parsedCommand.error.errors,
|
|
1341
1341
|
partialValue: {
|
|
@@ -1361,7 +1361,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1361
1361
|
});
|
|
1362
1362
|
}
|
|
1363
1363
|
(_a = context.hotPath) === null || _a === void 0 || _a.push(parsedSubcommand.value);
|
|
1364
|
-
const commandRun = await config.cmds[parsedSubcommand.value].run(context);
|
|
1364
|
+
const commandRun = await config$1.cmds[parsedSubcommand.value].run(context);
|
|
1365
1365
|
if (Result$7.isOk(commandRun)) return Result$7.ok({
|
|
1366
1366
|
command: parsedSubcommand.value,
|
|
1367
1367
|
value: commandRun.value
|
|
@@ -1545,17 +1545,17 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
1545
1545
|
* A combination of multiple flags, options and arguments
|
|
1546
1546
|
* with a common name and a handler that expects them as input.
|
|
1547
1547
|
*/
|
|
1548
|
-
function command(config) {
|
|
1549
|
-
const argEntries = (0, utils_1$2.entries)(config.args);
|
|
1550
|
-
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
|
|
1548
|
+
function command(config$1) {
|
|
1549
|
+
const argEntries = (0, utils_1$2.entries)(config$1.args);
|
|
1550
|
+
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config$1.version);
|
|
1551
1551
|
return {
|
|
1552
|
-
name: config.name,
|
|
1553
|
-
aliases: config.aliases,
|
|
1554
|
-
handler: config.handler,
|
|
1555
|
-
description: config.description,
|
|
1556
|
-
version: config.version,
|
|
1552
|
+
name: config$1.name,
|
|
1553
|
+
aliases: config$1.aliases,
|
|
1554
|
+
handler: config$1.handler,
|
|
1555
|
+
description: config$1.description,
|
|
1556
|
+
version: config$1.version,
|
|
1557
1557
|
helpTopics() {
|
|
1558
|
-
return (0, utils_1$2.flatMap)(Object.values(config.args).concat([circuitbreaker]), (x) => {
|
|
1558
|
+
return (0, utils_1$2.flatMap)(Object.values(config$1.args).concat([circuitbreaker]), (x) => {
|
|
1559
1559
|
var _a, _b;
|
|
1560
1560
|
return (_b = (_a = x.helpTopics) === null || _a === void 0 ? void 0 : _a.call(x)) !== null && _b !== void 0 ? _b : [];
|
|
1561
1561
|
});
|
|
@@ -1564,11 +1564,11 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
1564
1564
|
var _a, _b;
|
|
1565
1565
|
const lines = [];
|
|
1566
1566
|
let name = (_b = (_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "";
|
|
1567
|
-
if (!name) name = config.name;
|
|
1567
|
+
if (!name) name = config$1.name;
|
|
1568
1568
|
name = chalk_1$3.default.bold(name);
|
|
1569
|
-
if (config.version) name += ` ${chalk_1$3.default.dim(config.version)}`;
|
|
1569
|
+
if (config$1.version) name += ` ${chalk_1$3.default.dim(config$1.version)}`;
|
|
1570
1570
|
lines.push(name);
|
|
1571
|
-
if (config.description) lines.push(chalk_1$3.default.dim("> ") + config.description);
|
|
1571
|
+
if (config$1.description) lines.push(chalk_1$3.default.dim("> ") + config$1.description);
|
|
1572
1572
|
const usageBreakdown = (0, utils_1$2.groupBy)(this.helpTopics(), (x) => x.category);
|
|
1573
1573
|
for (const [category, helpTopics] of (0, utils_1$2.entries)(usageBreakdown)) {
|
|
1574
1574
|
lines.push("");
|
|
@@ -1593,7 +1593,7 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
1593
1593
|
},
|
|
1594
1594
|
async parse(context) {
|
|
1595
1595
|
var _a;
|
|
1596
|
-
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config.name);
|
|
1596
|
+
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config$1.name);
|
|
1597
1597
|
const resultObject = {};
|
|
1598
1598
|
const errors = [];
|
|
1599
1599
|
for (const [argName, arg] of argEntries) {
|
|
@@ -1684,47 +1684,47 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1684
1684
|
const Result$5 = __importStar$5(require_Result());
|
|
1685
1685
|
const findOption_1$2 = require_findOption();
|
|
1686
1686
|
const types_1$1 = require_types();
|
|
1687
|
-
function fullOption(config) {
|
|
1687
|
+
function fullOption(config$1) {
|
|
1688
1688
|
var _a;
|
|
1689
1689
|
return {
|
|
1690
|
-
description: (_a = config.description) !== null && _a !== void 0 ? _a : config.type.description,
|
|
1690
|
+
description: (_a = config$1.description) !== null && _a !== void 0 ? _a : config$1.type.description,
|
|
1691
1691
|
helpTopics() {
|
|
1692
1692
|
var _a$1, _b, _c;
|
|
1693
|
-
const displayName = (_a$1 = config.type.displayName) !== null && _a$1 !== void 0 ? _a$1 : "value";
|
|
1694
|
-
let usage = `--${config.long}`;
|
|
1695
|
-
if (config.short) usage += `, -${config.short}`;
|
|
1693
|
+
const displayName = (_a$1 = config$1.type.displayName) !== null && _a$1 !== void 0 ? _a$1 : "value";
|
|
1694
|
+
let usage = `--${config$1.long}`;
|
|
1695
|
+
if (config$1.short) usage += `, -${config$1.short}`;
|
|
1696
1696
|
usage += ` <${displayName}>`;
|
|
1697
1697
|
const defaults = [];
|
|
1698
|
-
if (config.env) {
|
|
1699
|
-
const env$2 = process.env[config.env] === void 0 ? "" : `=${chalk_1$2.default.italic(process.env[config.env])}`;
|
|
1700
|
-
defaults.push(`env: ${config.env}${env$2}`);
|
|
1698
|
+
if (config$1.env) {
|
|
1699
|
+
const env$2 = process.env[config$1.env] === void 0 ? "" : `=${chalk_1$2.default.italic(process.env[config$1.env])}`;
|
|
1700
|
+
defaults.push(`env: ${config$1.env}${env$2}`);
|
|
1701
1701
|
}
|
|
1702
|
-
if (config.defaultValue) try {
|
|
1703
|
-
const defaultValue = config.defaultValue();
|
|
1704
|
-
if (config.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1702
|
+
if (config$1.defaultValue) try {
|
|
1703
|
+
const defaultValue = config$1.defaultValue();
|
|
1704
|
+
if (config$1.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1705
1705
|
else defaults.push("optional");
|
|
1706
1706
|
} catch (e) {}
|
|
1707
|
-
else if (config.type.defaultValue) try {
|
|
1708
|
-
const defaultValue = config.type.defaultValue();
|
|
1709
|
-
if (config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1707
|
+
else if (config$1.type.defaultValue) try {
|
|
1708
|
+
const defaultValue = config$1.type.defaultValue();
|
|
1709
|
+
if (config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1710
1710
|
else defaults.push("optional");
|
|
1711
1711
|
} catch (e) {}
|
|
1712
|
-
else if (config.onMissing || config.type.onMissing) defaults.push("optional");
|
|
1712
|
+
else if (config$1.onMissing || config$1.type.onMissing) defaults.push("optional");
|
|
1713
1713
|
return [{
|
|
1714
1714
|
category: "options",
|
|
1715
1715
|
usage,
|
|
1716
1716
|
defaults,
|
|
1717
|
-
description: (_c = (_b = config.description) !== null && _b !== void 0 ? _b : config.type.description) !== null && _c !== void 0 ? _c : "self explanatory"
|
|
1717
|
+
description: (_c = (_b = config$1.description) !== null && _b !== void 0 ? _b : config$1.type.description) !== null && _c !== void 0 ? _c : "self explanatory"
|
|
1718
1718
|
}];
|
|
1719
1719
|
},
|
|
1720
1720
|
register(opts) {
|
|
1721
|
-
opts.forceOptionLongNames.add(config.long);
|
|
1722
|
-
if (config.short) opts.forceOptionShortNames.add(config.short);
|
|
1721
|
+
opts.forceOptionLongNames.add(config$1.long);
|
|
1722
|
+
if (config$1.short) opts.forceOptionShortNames.add(config$1.short);
|
|
1723
1723
|
},
|
|
1724
1724
|
async parse({ nodes, visitedNodes }) {
|
|
1725
1725
|
const options = (0, findOption_1$2.findOption)(nodes, {
|
|
1726
|
-
longNames: [config.long],
|
|
1727
|
-
shortNames: config.short ? [config.short] : []
|
|
1726
|
+
longNames: [config$1.long],
|
|
1727
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
1728
1728
|
}).filter((x) => !visitedNodes.has(x));
|
|
1729
1729
|
options.forEach((opt) => visitedNodes.add(opt));
|
|
1730
1730
|
if (options.length > 1) {
|
|
@@ -1734,21 +1734,21 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1734
1734
|
};
|
|
1735
1735
|
return Result$5.err({ errors: [error] });
|
|
1736
1736
|
}
|
|
1737
|
-
const valueFromEnv = config.env ? process.env[config.env] : void 0;
|
|
1738
|
-
const defaultValueFn = config.defaultValue || config.type.defaultValue;
|
|
1739
|
-
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
1737
|
+
const valueFromEnv = config$1.env ? process.env[config$1.env] : void 0;
|
|
1738
|
+
const defaultValueFn = config$1.defaultValue || config$1.type.defaultValue;
|
|
1739
|
+
const onMissingFn = config$1.onMissing || config$1.type.onMissing;
|
|
1740
1740
|
const option$1 = options[0];
|
|
1741
1741
|
let rawValue;
|
|
1742
1742
|
let envPrefix = "";
|
|
1743
1743
|
if (option$1 === null || option$1 === void 0 ? void 0 : option$1.value) rawValue = option$1.value.node.raw;
|
|
1744
1744
|
else if (valueFromEnv !== void 0) {
|
|
1745
1745
|
rawValue = valueFromEnv;
|
|
1746
|
-
envPrefix = `env[${chalk_1$2.default.italic(config.env)}]: `;
|
|
1746
|
+
envPrefix = `env[${chalk_1$2.default.italic(config$1.env)}]: `;
|
|
1747
1747
|
} else if (defaultValueFn) try {
|
|
1748
1748
|
const defaultValue = defaultValueFn();
|
|
1749
1749
|
return Result$5.ok(defaultValue);
|
|
1750
1750
|
} catch (e) {
|
|
1751
|
-
const message = `Default value not found for '--${config.long}': ${e.message}`;
|
|
1751
|
+
const message = `Default value not found for '--${config$1.long}': ${e.message}`;
|
|
1752
1752
|
return Result$5.err({ errors: [{
|
|
1753
1753
|
nodes: [],
|
|
1754
1754
|
message
|
|
@@ -1758,20 +1758,20 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1758
1758
|
const missingValue = await onMissingFn();
|
|
1759
1759
|
return Result$5.ok(missingValue);
|
|
1760
1760
|
} catch (e) {
|
|
1761
|
-
const message = `Failed to get missing value for '--${config.long}': ${e.message}`;
|
|
1761
|
+
const message = `Failed to get missing value for '--${config$1.long}': ${e.message}`;
|
|
1762
1762
|
return Result$5.err({ errors: [{
|
|
1763
1763
|
nodes: [],
|
|
1764
1764
|
message
|
|
1765
1765
|
}] });
|
|
1766
1766
|
}
|
|
1767
1767
|
else {
|
|
1768
|
-
const raw = (option$1 === null || option$1 === void 0 ? void 0 : option$1.type) === "shortOption" ? `-${option$1 === null || option$1 === void 0 ? void 0 : option$1.key}` : `--${config.long}`;
|
|
1768
|
+
const raw = (option$1 === null || option$1 === void 0 ? void 0 : option$1.type) === "shortOption" ? `-${option$1 === null || option$1 === void 0 ? void 0 : option$1.key}` : `--${config$1.long}`;
|
|
1769
1769
|
return Result$5.err({ errors: [{
|
|
1770
1770
|
nodes: options,
|
|
1771
1771
|
message: `No value provided for ${raw}`
|
|
1772
1772
|
}] });
|
|
1773
1773
|
}
|
|
1774
|
-
const decoded = await Result$5.safeAsync(config.type.from(rawValue));
|
|
1774
|
+
const decoded = await Result$5.safeAsync(config$1.type.from(rawValue));
|
|
1775
1775
|
if (Result$5.isErr(decoded)) return Result$5.err({ errors: [{
|
|
1776
1776
|
nodes: options,
|
|
1777
1777
|
message: envPrefix + decoded.error.message
|
|
@@ -1780,10 +1780,10 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1780
1780
|
}
|
|
1781
1781
|
};
|
|
1782
1782
|
}
|
|
1783
|
-
function option(config) {
|
|
1783
|
+
function option(config$1) {
|
|
1784
1784
|
return fullOption({
|
|
1785
1785
|
type: types_1$1.string,
|
|
1786
|
-
...config
|
|
1786
|
+
...config$1
|
|
1787
1787
|
});
|
|
1788
1788
|
}
|
|
1789
1789
|
}) });
|
|
@@ -2255,15 +2255,15 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
|
|
|
2255
2255
|
* Works best when it is the last item on the `command` construct, to be
|
|
2256
2256
|
* used like the `...rest` operator in JS and TypeScript.
|
|
2257
2257
|
*/
|
|
2258
|
-
function fullRestPositionals(config) {
|
|
2258
|
+
function fullRestPositionals(config$1) {
|
|
2259
2259
|
return {
|
|
2260
2260
|
helpTopics() {
|
|
2261
2261
|
var _a, _b, _c, _d;
|
|
2262
2262
|
return [{
|
|
2263
|
-
usage: `[...${(_b = (_a = config.displayName) !== null && _a !== void 0 ? _a : config.type.displayName) !== null && _b !== void 0 ? _b : "arg"}]`,
|
|
2263
|
+
usage: `[...${(_b = (_a = config$1.displayName) !== null && _a !== void 0 ? _a : config$1.type.displayName) !== null && _b !== void 0 ? _b : "arg"}]`,
|
|
2264
2264
|
category: "arguments",
|
|
2265
2265
|
defaults: [],
|
|
2266
|
-
description: (_d = (_c = config.description) !== null && _c !== void 0 ? _c : config.type.description) !== null && _d !== void 0 ? _d : ""
|
|
2266
|
+
description: (_d = (_c = config$1.description) !== null && _c !== void 0 ? _c : config$1.type.description) !== null && _d !== void 0 ? _d : ""
|
|
2267
2267
|
}];
|
|
2268
2268
|
},
|
|
2269
2269
|
register(_opts) {},
|
|
@@ -2273,7 +2273,7 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
|
|
|
2273
2273
|
const errors = [];
|
|
2274
2274
|
for (const positional$1 of positionals) {
|
|
2275
2275
|
visitedNodes.add(positional$1);
|
|
2276
|
-
const decoded = await Result$4.safeAsync(config.type.from(positional$1.raw));
|
|
2276
|
+
const decoded = await Result$4.safeAsync(config$1.type.from(positional$1.raw));
|
|
2277
2277
|
if (Result$4.isOk(decoded)) results.push(decoded.value);
|
|
2278
2278
|
else errors.push({
|
|
2279
2279
|
nodes: [positional$1],
|
|
@@ -2285,10 +2285,10 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
|
|
|
2285
2285
|
}
|
|
2286
2286
|
};
|
|
2287
2287
|
}
|
|
2288
|
-
function restPositionals(config) {
|
|
2288
|
+
function restPositionals(config$1) {
|
|
2289
2289
|
return fullRestPositionals({
|
|
2290
2290
|
type: types_1.string,
|
|
2291
|
-
...config
|
|
2291
|
+
...config$1
|
|
2292
2292
|
});
|
|
2293
2293
|
}
|
|
2294
2294
|
}) });
|
|
@@ -2346,28 +2346,28 @@ var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
2346
2346
|
* Like `option`, but can accept multiple options, and expects a decoder from a list of strings.
|
|
2347
2347
|
* An error will highlight all option occurences.
|
|
2348
2348
|
*/
|
|
2349
|
-
function multiflag(config) {
|
|
2349
|
+
function multiflag(config$1) {
|
|
2350
2350
|
return {
|
|
2351
2351
|
helpTopics() {
|
|
2352
2352
|
var _a;
|
|
2353
|
-
let usage = `--${config.long}`;
|
|
2354
|
-
if (config.short) usage += `, -${config.short}`;
|
|
2353
|
+
let usage = `--${config$1.long}`;
|
|
2354
|
+
if (config$1.short) usage += `, -${config$1.short}`;
|
|
2355
2355
|
return [{
|
|
2356
2356
|
category: "flags",
|
|
2357
2357
|
usage,
|
|
2358
2358
|
defaults: [],
|
|
2359
|
-
description: (_a = config.description) !== null && _a !== void 0 ? _a : "self explanatory"
|
|
2359
|
+
description: (_a = config$1.description) !== null && _a !== void 0 ? _a : "self explanatory"
|
|
2360
2360
|
}];
|
|
2361
2361
|
},
|
|
2362
2362
|
register(opts) {
|
|
2363
|
-
opts.forceFlagLongNames.add(config.long);
|
|
2364
|
-
if (config.short) opts.forceFlagShortNames.add(config.short);
|
|
2363
|
+
opts.forceFlagLongNames.add(config$1.long);
|
|
2364
|
+
if (config$1.short) opts.forceFlagShortNames.add(config$1.short);
|
|
2365
2365
|
},
|
|
2366
2366
|
async parse({ nodes, visitedNodes }) {
|
|
2367
2367
|
var _a, _b;
|
|
2368
2368
|
const options = (0, findOption_1$1.findOption)(nodes, {
|
|
2369
|
-
longNames: [config.long],
|
|
2370
|
-
shortNames: config.short ? [config.short] : []
|
|
2369
|
+
longNames: [config$1.long],
|
|
2370
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
2371
2371
|
}).filter((x) => !visitedNodes.has(x));
|
|
2372
2372
|
for (const option$1 of options) visitedNodes.add(option$1);
|
|
2373
2373
|
const optionValues = [];
|
|
@@ -2381,7 +2381,7 @@ var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
2381
2381
|
else optionValues.push(decoded.value);
|
|
2382
2382
|
}
|
|
2383
2383
|
if (errors.length > 0) return Result$3.err({ errors });
|
|
2384
|
-
const multiDecoded = await Result$3.safeAsync(config.type.from(optionValues));
|
|
2384
|
+
const multiDecoded = await Result$3.safeAsync(config$1.type.from(optionValues));
|
|
2385
2385
|
if (Result$3.isErr(multiDecoded)) return Result$3.err({ errors: [{
|
|
2386
2386
|
nodes: options,
|
|
2387
2387
|
message: multiDecoded.error.message
|
|
@@ -2448,49 +2448,49 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
2448
2448
|
* Like `option`, but can accept multiple options, and expects a decoder from a list of strings.
|
|
2449
2449
|
* An error will highlight all option occurences.
|
|
2450
2450
|
*/
|
|
2451
|
-
function multioption(config) {
|
|
2451
|
+
function multioption(config$1) {
|
|
2452
2452
|
return {
|
|
2453
2453
|
helpTopics() {
|
|
2454
2454
|
var _a, _b;
|
|
2455
|
-
const displayName = (_a = config.type.displayName) !== null && _a !== void 0 ? _a : "value";
|
|
2456
|
-
let usage = `--${config.long} <${displayName}>`;
|
|
2457
|
-
if (config.short) usage += `, -${config.short}=<${displayName}>`;
|
|
2455
|
+
const displayName = (_a = config$1.type.displayName) !== null && _a !== void 0 ? _a : "value";
|
|
2456
|
+
let usage = `--${config$1.long} <${displayName}>`;
|
|
2457
|
+
if (config$1.short) usage += `, -${config$1.short}=<${displayName}>`;
|
|
2458
2458
|
const defaults = [];
|
|
2459
|
-
if (config.defaultValue) try {
|
|
2460
|
-
const defaultValue = config.defaultValue();
|
|
2461
|
-
if (config.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2459
|
+
if (config$1.defaultValue) try {
|
|
2460
|
+
const defaultValue = config$1.defaultValue();
|
|
2461
|
+
if (config$1.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2462
2462
|
else defaults.push("[...optional]");
|
|
2463
2463
|
} catch (e) {}
|
|
2464
|
-
else if (config.type.defaultValue) try {
|
|
2465
|
-
const defaultValue = config.type.defaultValue();
|
|
2466
|
-
if (config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2464
|
+
else if (config$1.type.defaultValue) try {
|
|
2465
|
+
const defaultValue = config$1.type.defaultValue();
|
|
2466
|
+
if (config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2467
2467
|
else defaults.push("[...optional]");
|
|
2468
2468
|
} catch (e) {}
|
|
2469
|
-
else if (config.onMissing || config.type.onMissing) defaults.push("[...optional]");
|
|
2469
|
+
else if (config$1.onMissing || config$1.type.onMissing) defaults.push("[...optional]");
|
|
2470
2470
|
return [{
|
|
2471
2471
|
category: "options",
|
|
2472
2472
|
usage,
|
|
2473
2473
|
defaults,
|
|
2474
|
-
description: (_b = config.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
2474
|
+
description: (_b = config$1.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
2475
2475
|
}];
|
|
2476
2476
|
},
|
|
2477
2477
|
register(opts) {
|
|
2478
|
-
opts.forceOptionLongNames.add(config.long);
|
|
2479
|
-
if (config.short) opts.forceOptionShortNames.add(config.short);
|
|
2478
|
+
opts.forceOptionLongNames.add(config$1.long);
|
|
2479
|
+
if (config$1.short) opts.forceOptionShortNames.add(config$1.short);
|
|
2480
2480
|
},
|
|
2481
2481
|
async parse({ nodes, visitedNodes }) {
|
|
2482
2482
|
var _a;
|
|
2483
2483
|
const options = (0, findOption_1.findOption)(nodes, {
|
|
2484
|
-
longNames: [config.long],
|
|
2485
|
-
shortNames: config.short ? [config.short] : []
|
|
2484
|
+
longNames: [config$1.long],
|
|
2485
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
2486
2486
|
}).filter((x) => !visitedNodes.has(x));
|
|
2487
|
-
const defaultValueFn = config.defaultValue || config.type.defaultValue;
|
|
2488
|
-
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
2487
|
+
const defaultValueFn = config$1.defaultValue || config$1.type.defaultValue;
|
|
2488
|
+
const onMissingFn = config$1.onMissing || config$1.type.onMissing;
|
|
2489
2489
|
if (options.length === 0 && defaultValueFn) try {
|
|
2490
2490
|
const defaultValue = defaultValueFn();
|
|
2491
2491
|
return Result$2.ok(defaultValue);
|
|
2492
2492
|
} catch (e) {
|
|
2493
|
-
const message = `Failed to resolve default value for '--${config.long}': ${e.message}`;
|
|
2493
|
+
const message = `Failed to resolve default value for '--${config$1.long}': ${e.message}`;
|
|
2494
2494
|
return Result$2.err({ errors: [{
|
|
2495
2495
|
nodes: [],
|
|
2496
2496
|
message
|
|
@@ -2500,7 +2500,7 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
2500
2500
|
const missingValue = await onMissingFn();
|
|
2501
2501
|
return Result$2.ok(missingValue);
|
|
2502
2502
|
} catch (e) {
|
|
2503
|
-
const message = `Failed to get missing value for '--${config.long}': ${e.message}`;
|
|
2503
|
+
const message = `Failed to get missing value for '--${config$1.long}': ${e.message}`;
|
|
2504
2504
|
return Result$2.err({ errors: [{
|
|
2505
2505
|
nodes: [],
|
|
2506
2506
|
message
|
|
@@ -2523,7 +2523,7 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
2523
2523
|
message: "Expected to get a value, found a flag"
|
|
2524
2524
|
});
|
|
2525
2525
|
if (errors.length > 0) return Result$2.err({ errors });
|
|
2526
|
-
const multiDecoded = await Result$2.safeAsync(config.type.from(optionValues));
|
|
2526
|
+
const multiDecoded = await Result$2.safeAsync(config$1.type.from(optionValues));
|
|
2527
2527
|
if (Result$2.isErr(multiDecoded)) return Result$2.err({ errors: [{
|
|
2528
2528
|
nodes: options,
|
|
2529
2529
|
message: multiDecoded.error.message
|
|
@@ -2671,15 +2671,15 @@ var require_rest = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
2671
2671
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2672
2672
|
exports.rest = rest;
|
|
2673
2673
|
const Result = __importStar(require_Result());
|
|
2674
|
-
function rest(config) {
|
|
2674
|
+
function rest(config$1) {
|
|
2675
2675
|
return {
|
|
2676
2676
|
helpTopics() {
|
|
2677
2677
|
var _a, _b;
|
|
2678
2678
|
return [{
|
|
2679
|
-
usage: `[...${(_a = config === null || config === void 0 ? void 0 : config.displayName) !== null && _a !== void 0 ? _a : "arg"}]`,
|
|
2679
|
+
usage: `[...${(_a = config$1 === null || config$1 === void 0 ? void 0 : config$1.displayName) !== null && _a !== void 0 ? _a : "arg"}]`,
|
|
2680
2680
|
category: "arguments",
|
|
2681
2681
|
defaults: [],
|
|
2682
|
-
description: (_b = config === null || config === void 0 ? void 0 : config.description) !== null && _b !== void 0 ? _b : "catches the rest of the values"
|
|
2682
|
+
description: (_b = config$1 === null || config$1 === void 0 ? void 0 : config$1.description) !== null && _b !== void 0 ? _b : "catches the rest of the values"
|
|
2683
2683
|
}];
|
|
2684
2684
|
},
|
|
2685
2685
|
register() {},
|
|
@@ -2874,11 +2874,11 @@ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-t
|
|
|
2874
2874
|
|
|
2875
2875
|
//#endregion
|
|
2876
2876
|
//#region src/args/runtime.ts
|
|
2877
|
-
var import_cjs$
|
|
2878
|
-
const runtime = import_cjs$
|
|
2877
|
+
var import_cjs$22 = /* @__PURE__ */ __toESM(require_cjs());
|
|
2878
|
+
const runtime = import_cjs$22.option({
|
|
2879
2879
|
long: "runtime",
|
|
2880
2880
|
type: {
|
|
2881
|
-
...import_cjs$
|
|
2881
|
+
...import_cjs$22.oneOf([
|
|
2882
2882
|
"node22",
|
|
2883
2883
|
"node24",
|
|
2884
2884
|
"python3.13"
|
|
@@ -3010,9 +3010,9 @@ var require_ms = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ms@2.1
|
|
|
3010
3010
|
|
|
3011
3011
|
//#endregion
|
|
3012
3012
|
//#region src/types/duration.ts
|
|
3013
|
-
var import_cjs$
|
|
3013
|
+
var import_cjs$21 = require_cjs();
|
|
3014
3014
|
init_source();
|
|
3015
|
-
const Duration = (0, import_cjs$
|
|
3015
|
+
const Duration = (0, import_cjs$21.extendType)(import_cjs$21.string, {
|
|
3016
3016
|
displayName: "num UNIT",
|
|
3017
3017
|
description: "A duration, e.g. 5m, 10s, 1h",
|
|
3018
3018
|
async from(string$1) {
|
|
@@ -3028,8 +3028,8 @@ const Duration = (0, import_cjs$19.extendType)(import_cjs$19.string, {
|
|
|
3028
3028
|
|
|
3029
3029
|
//#endregion
|
|
3030
3030
|
//#region src/args/timeout.ts
|
|
3031
|
-
var import_cjs$
|
|
3032
|
-
const timeout = import_cjs$
|
|
3031
|
+
var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3032
|
+
const timeout = import_cjs$20.option({
|
|
3033
3033
|
long: "timeout",
|
|
3034
3034
|
type: Duration,
|
|
3035
3035
|
description: "The maximum duration a sandbox can run for. Example: 5m, 1h",
|
|
@@ -6317,12 +6317,12 @@ var require_spinners = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
|
|
|
6317
6317
|
//#endregion
|
|
6318
6318
|
//#region ../../node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/index.js
|
|
6319
6319
|
var require_cli_spinners = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/index.js": ((exports, module) => {
|
|
6320
|
-
const spinners$
|
|
6321
|
-
const spinnersList = Object.keys(spinners$
|
|
6322
|
-
Object.defineProperty(spinners$
|
|
6323
|
-
return spinners$
|
|
6320
|
+
const spinners$1 = Object.assign({}, require_spinners());
|
|
6321
|
+
const spinnersList = Object.keys(spinners$1);
|
|
6322
|
+
Object.defineProperty(spinners$1, "random", { get() {
|
|
6323
|
+
return spinners$1[spinnersList[Math.floor(Math.random() * spinnersList.length)]];
|
|
6324
6324
|
} });
|
|
6325
|
-
module.exports = spinners$
|
|
6325
|
+
module.exports = spinners$1;
|
|
6326
6326
|
}) });
|
|
6327
6327
|
|
|
6328
6328
|
//#endregion
|
|
@@ -6802,10 +6802,10 @@ function _usingCtx() {
|
|
|
6802
6802
|
|
|
6803
6803
|
//#endregion
|
|
6804
6804
|
//#region src/commands/login.ts
|
|
6805
|
-
var import_cjs$
|
|
6805
|
+
var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6806
6806
|
init_source();
|
|
6807
6807
|
const debug$5 = createDebugger("sandbox:login");
|
|
6808
|
-
const login = import_cjs$
|
|
6808
|
+
const login = import_cjs$19.command({
|
|
6809
6809
|
name: "login",
|
|
6810
6810
|
description: "Log in to the Sandbox CLI",
|
|
6811
6811
|
args: {},
|
|
@@ -7010,15 +7010,15 @@ var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/@ver
|
|
|
7010
7010
|
|
|
7011
7011
|
//#endregion
|
|
7012
7012
|
//#region src/args/auth.ts
|
|
7013
|
-
var import_cjs$
|
|
7013
|
+
var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7014
7014
|
init_source();
|
|
7015
7015
|
var import_dist = require_dist();
|
|
7016
7016
|
const debug$4 = createDebugger("sandbox:args:auth");
|
|
7017
|
-
const token = import_cjs$
|
|
7017
|
+
const token = import_cjs$18.option({
|
|
7018
7018
|
long: "token",
|
|
7019
7019
|
description: "A Vercel authentication token. If not provided, will use the token stored in your system from `VERCEL_AUTH_TOKEN` or will start a log in process.",
|
|
7020
7020
|
type: {
|
|
7021
|
-
...import_cjs$
|
|
7021
|
+
...import_cjs$18.string,
|
|
7022
7022
|
displayName: "pat_or_oidc",
|
|
7023
7023
|
defaultValueIsSerializable: false,
|
|
7024
7024
|
onMissing: async () => {
|
|
@@ -7151,11 +7151,15 @@ async function inferScope({ token: token$1, team: team$1 }) {
|
|
|
7151
7151
|
}
|
|
7152
7152
|
const JwtSchema = z.object({
|
|
7153
7153
|
project_id: z.string(),
|
|
7154
|
-
owner_id: z.string()
|
|
7154
|
+
owner_id: z.string(),
|
|
7155
|
+
project: z.string().optional(),
|
|
7156
|
+
owner: z.string().optional()
|
|
7155
7157
|
}).transform((data) => {
|
|
7156
7158
|
return {
|
|
7157
7159
|
projectId: data.project_id,
|
|
7158
|
-
ownerId: data.owner_id
|
|
7160
|
+
ownerId: data.owner_id,
|
|
7161
|
+
projectSlug: data.project,
|
|
7162
|
+
ownerSlug: data.owner
|
|
7159
7163
|
};
|
|
7160
7164
|
});
|
|
7161
7165
|
async function inferFromJwt(jwt) {
|
|
@@ -7172,35 +7176,37 @@ async function inferFromToken(token$1, requestedTeam) {
|
|
|
7172
7176
|
});
|
|
7173
7177
|
return {
|
|
7174
7178
|
ownerId: teamId,
|
|
7175
|
-
projectId
|
|
7179
|
+
projectId,
|
|
7180
|
+
ownerSlug: teamId,
|
|
7181
|
+
projectSlug: projectId
|
|
7176
7182
|
};
|
|
7177
7183
|
}
|
|
7178
7184
|
|
|
7179
7185
|
//#endregion
|
|
7180
7186
|
//#region src/args/scope.ts
|
|
7181
|
-
var import_cjs$
|
|
7187
|
+
var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7182
7188
|
init_source();
|
|
7183
|
-
const project = import_cjs$
|
|
7189
|
+
const project = import_cjs$17.option({
|
|
7184
7190
|
long: "project",
|
|
7185
7191
|
type: {
|
|
7186
|
-
...import_cjs$
|
|
7192
|
+
...import_cjs$17.optional(import_cjs$17.string),
|
|
7187
7193
|
displayName: "my-project"
|
|
7188
7194
|
},
|
|
7189
7195
|
description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
|
|
7190
7196
|
});
|
|
7191
7197
|
/** Parser for the `--team` option. */
|
|
7192
|
-
const teamParser = import_cjs$
|
|
7198
|
+
const teamParser = import_cjs$17.option({
|
|
7193
7199
|
long: "team",
|
|
7194
7200
|
type: {
|
|
7195
|
-
...import_cjs$
|
|
7201
|
+
...import_cjs$17.optional(import_cjs$17.string),
|
|
7196
7202
|
displayName: "my-team"
|
|
7197
7203
|
}
|
|
7198
7204
|
});
|
|
7199
7205
|
/** Parser for the `--scope` option. */
|
|
7200
|
-
const scopeParser = import_cjs$
|
|
7206
|
+
const scopeParser = import_cjs$17.option({
|
|
7201
7207
|
long: "scope",
|
|
7202
7208
|
type: {
|
|
7203
|
-
...import_cjs$
|
|
7209
|
+
...import_cjs$17.optional(import_cjs$17.string),
|
|
7204
7210
|
displayName: "my-team"
|
|
7205
7211
|
},
|
|
7206
7212
|
description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
|
|
@@ -7240,6 +7246,8 @@ const scope = {
|
|
|
7240
7246
|
const nodes = Array.from(context.visitedNodes).filter((x) => !visited.has(x));
|
|
7241
7247
|
if (projectId._tag === "error") return projectId;
|
|
7242
7248
|
if (teamId._tag === "error") return teamId;
|
|
7249
|
+
let projectSlug;
|
|
7250
|
+
let teamSlug;
|
|
7243
7251
|
if (typeof projectId.value === "undefined" || typeof teamId.value === "undefined") try {
|
|
7244
7252
|
const scope$1 = await inferScope({
|
|
7245
7253
|
token: t.value,
|
|
@@ -7247,6 +7255,8 @@ const scope = {
|
|
|
7247
7255
|
});
|
|
7248
7256
|
projectId.value ?? (projectId.value = scope$1.projectId);
|
|
7249
7257
|
teamId.value ?? (teamId.value = scope$1.ownerId);
|
|
7258
|
+
projectSlug = scope$1.projectSlug;
|
|
7259
|
+
teamSlug = scope$1.ownerSlug;
|
|
7250
7260
|
} catch (err$1) {
|
|
7251
7261
|
return {
|
|
7252
7262
|
_tag: "error",
|
|
@@ -7265,7 +7275,9 @@ const scope = {
|
|
|
7265
7275
|
value: {
|
|
7266
7276
|
token: t.value,
|
|
7267
7277
|
project: projectId.value,
|
|
7268
|
-
team: teamId.value
|
|
7278
|
+
team: teamId.value,
|
|
7279
|
+
projectSlug,
|
|
7280
|
+
teamSlug
|
|
7269
7281
|
}
|
|
7270
7282
|
};
|
|
7271
7283
|
},
|
|
@@ -7280,7 +7292,7 @@ const scope = {
|
|
|
7280
7292
|
|
|
7281
7293
|
//#endregion
|
|
7282
7294
|
//#region package.json
|
|
7283
|
-
var version = "2.0
|
|
7295
|
+
var version = "2.1.0";
|
|
7284
7296
|
|
|
7285
7297
|
//#endregion
|
|
7286
7298
|
//#region src/error.ts
|
|
@@ -7369,9 +7381,9 @@ async function writeResponseToTemp({ response, text }) {
|
|
|
7369
7381
|
|
|
7370
7382
|
//#endregion
|
|
7371
7383
|
//#region src/args/snapshot-id.ts
|
|
7372
|
-
var import_cjs$
|
|
7384
|
+
var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7373
7385
|
init_source();
|
|
7374
|
-
const snapshotId = import_cjs$
|
|
7386
|
+
const snapshotId = import_cjs$16.extendType(import_cjs$16.string, {
|
|
7375
7387
|
displayName: "snapshot_id",
|
|
7376
7388
|
description: "The ID of the snapshot",
|
|
7377
7389
|
async from(s$1) {
|
|
@@ -7380,20 +7392,99 @@ const snapshotId = import_cjs$14.extendType(import_cjs$14.string, {
|
|
|
7380
7392
|
}
|
|
7381
7393
|
});
|
|
7382
7394
|
|
|
7395
|
+
//#endregion
|
|
7396
|
+
//#region src/args/network-policy.ts
|
|
7397
|
+
var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7398
|
+
init_source();
|
|
7399
|
+
const networkPolicyMode = import_cjs$15.extendType(import_cjs$15.string, {
|
|
7400
|
+
displayName: "MODE",
|
|
7401
|
+
async from(value) {
|
|
7402
|
+
const validModes = [
|
|
7403
|
+
"internet-access",
|
|
7404
|
+
"no-access",
|
|
7405
|
+
"restricted"
|
|
7406
|
+
];
|
|
7407
|
+
if (!validModes.includes(value)) throw new Error([`Invalid network policy mode: ${value}.`, `${source_default.bold("hint:")} Valid modes are: ${validModes.join(", ")}`].join("\n"));
|
|
7408
|
+
return value;
|
|
7409
|
+
}
|
|
7410
|
+
});
|
|
7411
|
+
const networkPolicy = import_cjs$15.option({
|
|
7412
|
+
long: "network-policy",
|
|
7413
|
+
description: `Network policy mode: "internet-access", "no-access", or "restricted"
|
|
7414
|
+
|
|
7415
|
+
internet-access: sandbox can access any website/domain
|
|
7416
|
+
no-access: sandbox has no network access
|
|
7417
|
+
restricted: sandbox can only access websites and domains explicitly allowed`,
|
|
7418
|
+
type: import_cjs$15.optional(networkPolicyMode)
|
|
7419
|
+
});
|
|
7420
|
+
const allowedDomains = import_cjs$15.multioption({
|
|
7421
|
+
long: "allowed-domain",
|
|
7422
|
+
description: `Domain to allow traffic to (requires --network-policy=restricted)
|
|
7423
|
+
|
|
7424
|
+
Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com')
|
|
7425
|
+
If used as the first segment, will match any subdomain.`,
|
|
7426
|
+
type: import_cjs$15.array(import_cjs$15.string)
|
|
7427
|
+
});
|
|
7428
|
+
const allowedCIDRs = import_cjs$15.multioption({
|
|
7429
|
+
long: "allowed-cidr",
|
|
7430
|
+
description: `CIDR to allow traffic to (requires --network-policy=restricted)
|
|
7431
|
+
|
|
7432
|
+
Takes precedence over 'allowed-domain'.
|
|
7433
|
+
`,
|
|
7434
|
+
type: import_cjs$15.array(import_cjs$15.string)
|
|
7435
|
+
});
|
|
7436
|
+
const deniedCIDRs = import_cjs$15.multioption({
|
|
7437
|
+
long: "denied-cidr",
|
|
7438
|
+
description: `CIDR to deny traffic to (requires --network-policy=restricted)
|
|
7439
|
+
|
|
7440
|
+
Takes precedence over allowed domains/CIDRs.`,
|
|
7441
|
+
type: import_cjs$15.array(import_cjs$15.string)
|
|
7442
|
+
});
|
|
7443
|
+
const networkPolicyArgs = {
|
|
7444
|
+
networkPolicy,
|
|
7445
|
+
allowedDomains,
|
|
7446
|
+
allowedCIDRs,
|
|
7447
|
+
deniedCIDRs
|
|
7448
|
+
};
|
|
7449
|
+
|
|
7450
|
+
//#endregion
|
|
7451
|
+
//#region src/util/network-policy.ts
|
|
7452
|
+
init_source();
|
|
7453
|
+
/**
|
|
7454
|
+
* Builds a NetworkPolicy from CLI arguments (optional mode for create).
|
|
7455
|
+
*/
|
|
7456
|
+
function buildNetworkPolicy(args$4) {
|
|
7457
|
+
const { networkPolicy: networkPolicy$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 } = args$4;
|
|
7458
|
+
if (!networkPolicy$1 || networkPolicy$1 !== "restricted") {
|
|
7459
|
+
if (allowedDomains$1.length > 0 || allowedCIDRs$1.length > 0 || deniedCIDRs$1.length > 0) throw new Error(["Network policy options require --network-policy to be set to restricted.", `${source_default.bold("hint:")} Use --network-policy=restricted to allow/deny specific domains or CIDRs.`].join("\n"));
|
|
7460
|
+
}
|
|
7461
|
+
switch (networkPolicy$1) {
|
|
7462
|
+
case void 0:
|
|
7463
|
+
case "internet-access": return { type: "internet-access" };
|
|
7464
|
+
case "no-access": return { type: "no-access" };
|
|
7465
|
+
case "restricted": return {
|
|
7466
|
+
type: "restricted",
|
|
7467
|
+
allowedDomains: allowedDomains$1.length > 0 ? allowedDomains$1 : void 0,
|
|
7468
|
+
allowedCIDRs: allowedCIDRs$1.length > 0 ? allowedCIDRs$1 : void 0,
|
|
7469
|
+
deniedCIDRs: deniedCIDRs$1.length > 0 ? deniedCIDRs$1 : void 0
|
|
7470
|
+
};
|
|
7471
|
+
}
|
|
7472
|
+
}
|
|
7473
|
+
|
|
7383
7474
|
//#endregion
|
|
7384
7475
|
//#region src/commands/create.ts
|
|
7385
|
-
var import_cjs$
|
|
7476
|
+
var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7386
7477
|
var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
|
|
7387
7478
|
init_source();
|
|
7388
7479
|
const args$3 = {
|
|
7389
7480
|
scope,
|
|
7390
7481
|
runtime,
|
|
7391
7482
|
timeout,
|
|
7392
|
-
ports: import_cjs$
|
|
7483
|
+
ports: import_cjs$14.multioption({
|
|
7393
7484
|
long: "publish-port",
|
|
7394
7485
|
short: "p",
|
|
7395
7486
|
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
7396
|
-
type: import_cjs$
|
|
7487
|
+
type: import_cjs$14.array(import_cjs$14.extendType(import_cjs$14.number, {
|
|
7397
7488
|
displayName: "PORT",
|
|
7398
7489
|
async from(number) {
|
|
7399
7490
|
if (number < 1024 || number > 65535) throw new Error([
|
|
@@ -7405,22 +7496,29 @@ const args$3 = {
|
|
|
7405
7496
|
}
|
|
7406
7497
|
}))
|
|
7407
7498
|
}),
|
|
7408
|
-
silent: import_cjs$
|
|
7499
|
+
silent: import_cjs$14.flag({
|
|
7409
7500
|
long: "silent",
|
|
7410
7501
|
description: "Don't write sandbox ID to stdout"
|
|
7411
7502
|
}),
|
|
7412
|
-
snapshot: import_cjs$
|
|
7503
|
+
snapshot: import_cjs$14.option({
|
|
7413
7504
|
long: "snapshot",
|
|
7414
7505
|
short: "s",
|
|
7415
7506
|
description: "Start the sandbox from a snapshot ID",
|
|
7416
|
-
type: import_cjs$
|
|
7417
|
-
})
|
|
7507
|
+
type: import_cjs$14.optional(snapshotId)
|
|
7508
|
+
}),
|
|
7509
|
+
...networkPolicyArgs
|
|
7418
7510
|
};
|
|
7419
|
-
const create = import_cjs$
|
|
7511
|
+
const create = import_cjs$14.command({
|
|
7420
7512
|
name: "create",
|
|
7421
7513
|
description: "Create a sandbox in the specified account and project.",
|
|
7422
7514
|
args: args$3,
|
|
7423
|
-
async handler({ ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, silent, snapshot: snapshot$1 }) {
|
|
7515
|
+
async handler({ ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, silent, snapshot: snapshot$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
|
|
7516
|
+
const networkPolicy$1 = buildNetworkPolicy({
|
|
7517
|
+
networkPolicy: networkPolicyMode$1,
|
|
7518
|
+
allowedDomains: allowedDomains$1,
|
|
7519
|
+
allowedCIDRs: allowedCIDRs$1,
|
|
7520
|
+
deniedCIDRs: deniedCIDRs$1
|
|
7521
|
+
});
|
|
7424
7522
|
const spinner = silent ? void 0 : ora("Creating sandbox...").start();
|
|
7425
7523
|
const sandbox = snapshot$1 ? await sandboxClient.create({
|
|
7426
7524
|
source: {
|
|
@@ -7432,6 +7530,7 @@ const create = import_cjs$13.command({
|
|
|
7432
7530
|
token: scope$1.token,
|
|
7433
7531
|
ports,
|
|
7434
7532
|
timeout: (0, import_ms$1.default)(timeout$1),
|
|
7533
|
+
networkPolicy: networkPolicy$1,
|
|
7435
7534
|
__interactive: true
|
|
7436
7535
|
}) : await sandboxClient.create({
|
|
7437
7536
|
teamId: scope$1.team,
|
|
@@ -7440,24 +7539,33 @@ const create = import_cjs$13.command({
|
|
|
7440
7539
|
ports,
|
|
7441
7540
|
runtime: runtime$1,
|
|
7442
7541
|
timeout: (0, import_ms$1.default)(timeout$1),
|
|
7542
|
+
networkPolicy: networkPolicy$1,
|
|
7443
7543
|
__interactive: true
|
|
7444
7544
|
});
|
|
7445
7545
|
spinner?.stop();
|
|
7446
|
-
if (!silent) {
|
|
7447
|
-
process.stderr.write("✅ Sandbox ");
|
|
7448
|
-
process.stdout.write(source_default.cyan(sandbox.sandboxId));
|
|
7449
|
-
process.stderr.write(" created.\n");
|
|
7450
|
-
}
|
|
7451
7546
|
if (!sandbox.interactivePort) throw new Error([
|
|
7452
7547
|
`Sandbox created but interactive port is missing.`,
|
|
7453
7548
|
`${source_default.bold("hint:")} This is an internal error. Please try again.`,
|
|
7454
7549
|
"╰▶ Report this issue: https://github.com/vercel/sandbox/issues"
|
|
7455
7550
|
].join("\n"));
|
|
7456
7551
|
const routes = sandbox.routes.filter((x) => x.port !== sandbox.interactivePort);
|
|
7457
|
-
if (
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7552
|
+
if (!silent) {
|
|
7553
|
+
const teamDisplay = scope$1.teamSlug ?? scope$1.team;
|
|
7554
|
+
const projectDisplay = scope$1.projectSlug ?? scope$1.project;
|
|
7555
|
+
const hasPorts = routes.length > 0;
|
|
7556
|
+
process.stderr.write("✅ Sandbox ");
|
|
7557
|
+
process.stdout.write(source_default.cyan(sandbox.sandboxId));
|
|
7558
|
+
process.stderr.write(" created.\n");
|
|
7559
|
+
process.stderr.write(source_default.dim(" │ ") + "team: " + source_default.cyan(teamDisplay) + "\n");
|
|
7560
|
+
if (hasPorts) {
|
|
7561
|
+
process.stderr.write(source_default.dim(" │ ") + "project: " + source_default.cyan(projectDisplay) + "\n");
|
|
7562
|
+
process.stderr.write(source_default.dim(" │ ") + "ports:\n");
|
|
7563
|
+
for (let i = 0; i < routes.length; i++) {
|
|
7564
|
+
const route = routes[i];
|
|
7565
|
+
const prefix$1 = i === routes.length - 1 ? source_default.dim(" ╰ ") : source_default.dim(" │ ");
|
|
7566
|
+
process.stderr.write(prefix$1 + "• " + route.port + " -> " + source_default.cyan(route.url) + "\n");
|
|
7567
|
+
}
|
|
7568
|
+
} else process.stderr.write(source_default.dim(" ╰ ") + "project: " + source_default.cyan(projectDisplay) + "\n");
|
|
7461
7569
|
}
|
|
7462
7570
|
return sandbox;
|
|
7463
7571
|
}
|
|
@@ -7465,9 +7573,9 @@ const create = import_cjs$13.command({
|
|
|
7465
7573
|
|
|
7466
7574
|
//#endregion
|
|
7467
7575
|
//#region src/args/sandbox-id.ts
|
|
7468
|
-
var import_cjs$
|
|
7576
|
+
var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7469
7577
|
init_source();
|
|
7470
|
-
const sandboxId = import_cjs$
|
|
7578
|
+
const sandboxId = import_cjs$13.extendType(import_cjs$13.string, {
|
|
7471
7579
|
displayName: "sandbox_id",
|
|
7472
7580
|
description: "The ID of the sandbox to execute the command in",
|
|
7473
7581
|
async from(s$1) {
|
|
@@ -11175,8 +11283,8 @@ async function waitForOpen(ws) {
|
|
|
11175
11283
|
//#endregion
|
|
11176
11284
|
//#region src/util/print-command.ts
|
|
11177
11285
|
init_source();
|
|
11178
|
-
function printCommand(
|
|
11179
|
-
return source_default.gray(source_default.dim(
|
|
11286
|
+
function printCommand(command$1, args$4) {
|
|
11287
|
+
return source_default.gray(source_default.dim("$ ") + [command$1, ...args$4].join(" "));
|
|
11180
11288
|
}
|
|
11181
11289
|
|
|
11182
11290
|
//#endregion
|
|
@@ -11317,12 +11425,7 @@ async function startInteractiveShell(options) {
|
|
|
11317
11425
|
};
|
|
11318
11426
|
process.once("beforeExit", cleanup);
|
|
11319
11427
|
const _cleanup = _usingCtx3.u(defer(cleanup));
|
|
11320
|
-
const
|
|
11321
|
-
spinner.frames = spinner.frames.map((frame) => source_default.gray.dim(`${options.sandbox.sandboxId} `) + frame);
|
|
11322
|
-
const progress = _usingCtx3.u(acquireRelease(() => ora({
|
|
11323
|
-
discardStdin: false,
|
|
11324
|
-
spinner
|
|
11325
|
-
}).start(), (s$1) => s$1.clear()));
|
|
11428
|
+
const progress = _usingCtx3.u(acquireRelease(() => ora({ discardStdin: false }).start(), (s$1) => s$1.clear()));
|
|
11326
11429
|
progress.text = "Setting up sandbox environment";
|
|
11327
11430
|
await setupSandboxEnvironment(options.sandbox, progress);
|
|
11328
11431
|
progress.text = "Booting up interactive listener...";
|
|
@@ -11337,7 +11440,7 @@ async function startInteractiveShell(options) {
|
|
|
11337
11440
|
progress,
|
|
11338
11441
|
listener,
|
|
11339
11442
|
skipExtendingTimeout: options.skipExtendingTimeout,
|
|
11340
|
-
printCommand: () => console.error(printCommand(options.
|
|
11443
|
+
printCommand: () => console.error(printCommand(options.execution[0], options.execution.slice(1)))
|
|
11341
11444
|
})]).catch(waitForProcess.ignoreInterruptions);
|
|
11342
11445
|
} catch (_) {
|
|
11343
11446
|
_usingCtx3.e = _;
|
|
@@ -11464,9 +11567,9 @@ function getStderrStream() {
|
|
|
11464
11567
|
|
|
11465
11568
|
//#endregion
|
|
11466
11569
|
//#region src/args/key-value-pair.ts
|
|
11467
|
-
var import_cjs$
|
|
11570
|
+
var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11468
11571
|
init_source();
|
|
11469
|
-
const KeyValuePair = import_cjs$
|
|
11572
|
+
const KeyValuePair = import_cjs$12.extendType(import_cjs$12.string, {
|
|
11470
11573
|
displayName: "key=value",
|
|
11471
11574
|
async from(input) {
|
|
11472
11575
|
if (!input.includes("=")) return {
|
|
@@ -11480,7 +11583,7 @@ const KeyValuePair = import_cjs$11.extendType(import_cjs$11.string, {
|
|
|
11480
11583
|
};
|
|
11481
11584
|
}
|
|
11482
11585
|
});
|
|
11483
|
-
const ObjectFromKeyValue = import_cjs$
|
|
11586
|
+
const ObjectFromKeyValue = import_cjs$12.extendType(import_cjs$12.array(KeyValuePair), { async from(input) {
|
|
11484
11587
|
const obj = Object.create(null);
|
|
11485
11588
|
const missingVars = [];
|
|
11486
11589
|
for (const { key, value } of input) if (value === void 0) missingVars.push(key);
|
|
@@ -11494,34 +11597,34 @@ const ObjectFromKeyValue = import_cjs$11.extendType(import_cjs$11.array(KeyValue
|
|
|
11494
11597
|
|
|
11495
11598
|
//#endregion
|
|
11496
11599
|
//#region src/commands/exec.ts
|
|
11497
|
-
var import_cjs$
|
|
11600
|
+
var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11498
11601
|
init_source();
|
|
11499
11602
|
const args$2 = {
|
|
11500
11603
|
scope,
|
|
11501
|
-
sandbox: import_cjs$
|
|
11502
|
-
asSudo: import_cjs$
|
|
11604
|
+
sandbox: import_cjs$11.positional({ type: sandboxId }),
|
|
11605
|
+
asSudo: import_cjs$11.flag({
|
|
11503
11606
|
long: "sudo",
|
|
11504
11607
|
description: "Give extended privileges to the command."
|
|
11505
11608
|
}),
|
|
11506
|
-
command: import_cjs$
|
|
11609
|
+
command: import_cjs$11.positional({
|
|
11507
11610
|
displayName: "command",
|
|
11508
11611
|
description: "The executable to invoke"
|
|
11509
11612
|
}),
|
|
11510
|
-
args: import_cjs$
|
|
11613
|
+
args: import_cjs$11.rest({
|
|
11511
11614
|
displayName: "args",
|
|
11512
11615
|
description: "arguments to pass to the command"
|
|
11513
11616
|
}),
|
|
11514
|
-
cwd: import_cjs$
|
|
11617
|
+
cwd: import_cjs$11.option({
|
|
11515
11618
|
long: "workdir",
|
|
11516
11619
|
short: "w",
|
|
11517
11620
|
description: "The working directory to run the command in",
|
|
11518
|
-
type: import_cjs$
|
|
11621
|
+
type: import_cjs$11.optional(import_cjs$11.string)
|
|
11519
11622
|
}),
|
|
11520
|
-
interactive: import_cjs$
|
|
11623
|
+
interactive: import_cjs$11.flag({
|
|
11521
11624
|
long: "interactive",
|
|
11522
11625
|
short: "i",
|
|
11523
11626
|
description: "Run the command in a secure interactive shell",
|
|
11524
|
-
type: import_cjs$
|
|
11627
|
+
type: import_cjs$11.extendType(import_cjs$11.boolean, {
|
|
11525
11628
|
defaultValue() {
|
|
11526
11629
|
return false;
|
|
11527
11630
|
},
|
|
@@ -11531,23 +11634,23 @@ const args$2 = {
|
|
|
11531
11634
|
}
|
|
11532
11635
|
})
|
|
11533
11636
|
}),
|
|
11534
|
-
skipExtendingTimeout: import_cjs$
|
|
11637
|
+
skipExtendingTimeout: import_cjs$11.flag({
|
|
11535
11638
|
long: "no-extend-timeout",
|
|
11536
11639
|
description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
|
|
11537
11640
|
}),
|
|
11538
|
-
envVars: import_cjs$
|
|
11641
|
+
envVars: import_cjs$11.multioption({
|
|
11539
11642
|
long: "env",
|
|
11540
11643
|
short: "e",
|
|
11541
11644
|
type: ObjectFromKeyValue,
|
|
11542
11645
|
description: "Environment variables to set for the command"
|
|
11543
11646
|
}),
|
|
11544
|
-
tty: import_cjs$
|
|
11647
|
+
tty: import_cjs$11.flag({
|
|
11545
11648
|
long: "tty",
|
|
11546
11649
|
short: "t",
|
|
11547
11650
|
description: "Allocate a tty for an interactive command. This is a no-op."
|
|
11548
11651
|
})
|
|
11549
11652
|
};
|
|
11550
|
-
const exec = import_cjs$
|
|
11653
|
+
const exec = import_cjs$11.command({
|
|
11551
11654
|
name: "exec",
|
|
11552
11655
|
description: "Execute a command in an existing sandbox",
|
|
11553
11656
|
args: args$2,
|
|
@@ -11570,7 +11673,7 @@ const exec = import_cjs$10.command({
|
|
|
11570
11673
|
return;
|
|
11571
11674
|
}
|
|
11572
11675
|
if (!interactive) {
|
|
11573
|
-
console.error(printCommand(
|
|
11676
|
+
console.error(printCommand(command$1, args$4));
|
|
11574
11677
|
const result = await sandbox.runCommand({
|
|
11575
11678
|
cmd: command$1,
|
|
11576
11679
|
args: args$4,
|
|
@@ -11602,26 +11705,21 @@ function omit(obj, ...keys) {
|
|
|
11602
11705
|
|
|
11603
11706
|
//#endregion
|
|
11604
11707
|
//#region src/commands/run.ts
|
|
11605
|
-
var import_cjs$
|
|
11708
|
+
var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11606
11709
|
const args$1 = {
|
|
11607
|
-
...
|
|
11710
|
+
...args$3,
|
|
11608
11711
|
...omit(args$2, "sandbox"),
|
|
11609
|
-
removeAfterUse: import_cjs$
|
|
11712
|
+
removeAfterUse: import_cjs$10.flag({
|
|
11610
11713
|
long: "rm",
|
|
11611
11714
|
description: "Automatically remove the sandbox when the command exits."
|
|
11612
11715
|
})
|
|
11613
11716
|
};
|
|
11614
|
-
const run = import_cjs$
|
|
11717
|
+
const run = import_cjs$10.command({
|
|
11615
11718
|
name: "run",
|
|
11616
11719
|
description: "Create and run a command in a sandbox",
|
|
11617
11720
|
args: args$1,
|
|
11618
11721
|
async handler({ removeAfterUse, ...rest$1 }) {
|
|
11619
|
-
const
|
|
11620
|
-
const sandbox = await create.handler({
|
|
11621
|
-
...rest$1,
|
|
11622
|
-
silent: true
|
|
11623
|
-
});
|
|
11624
|
-
spinner.stop();
|
|
11722
|
+
const sandbox = await create.handler({ ...rest$1 });
|
|
11625
11723
|
try {
|
|
11626
11724
|
await exec.handler({
|
|
11627
11725
|
...rest$1,
|
|
@@ -11632,7 +11730,7 @@ const run = import_cjs$9.command({
|
|
|
11632
11730
|
}
|
|
11633
11731
|
}
|
|
11634
11732
|
});
|
|
11635
|
-
const sh = import_cjs$
|
|
11733
|
+
const sh = import_cjs$10.command({
|
|
11636
11734
|
name: "sh",
|
|
11637
11735
|
description: "Create a sandbox and run an interactive shell.",
|
|
11638
11736
|
aliases: ["shell"],
|
|
@@ -11649,15 +11747,15 @@ const sh = import_cjs$9.command({
|
|
|
11649
11747
|
|
|
11650
11748
|
//#endregion
|
|
11651
11749
|
//#region src/commands/list.ts
|
|
11652
|
-
var import_cjs$
|
|
11750
|
+
var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11653
11751
|
init_source();
|
|
11654
|
-
const list = import_cjs$
|
|
11752
|
+
const list = import_cjs$9.command({
|
|
11655
11753
|
name: "list",
|
|
11656
11754
|
aliases: ["ls"],
|
|
11657
11755
|
description: "List all sandboxes for the specified account and project.",
|
|
11658
11756
|
args: {
|
|
11659
11757
|
scope,
|
|
11660
|
-
all: import_cjs$
|
|
11758
|
+
all: import_cjs$9.flag({
|
|
11661
11759
|
long: "all",
|
|
11662
11760
|
short: "a",
|
|
11663
11761
|
description: "Show all sandboxes (default shows just running)"
|
|
@@ -11715,8 +11813,8 @@ const SandboxStatusColor = new Map([
|
|
|
11715
11813
|
|
|
11716
11814
|
//#endregion
|
|
11717
11815
|
//#region src/commands/ssh.ts
|
|
11718
|
-
var import_cjs$
|
|
11719
|
-
const ssh = import_cjs$
|
|
11816
|
+
var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11817
|
+
const ssh = import_cjs$8.command({
|
|
11720
11818
|
name: "ssh",
|
|
11721
11819
|
description: "Start an interactive shell in an existing sandbox",
|
|
11722
11820
|
args: omit(args$2, "command", "args", "interactive", "tty"),
|
|
@@ -14016,18 +14114,18 @@ var Listr = class {
|
|
|
14016
14114
|
|
|
14017
14115
|
//#endregion
|
|
14018
14116
|
//#region src/commands/stop.ts
|
|
14019
|
-
var import_cjs$
|
|
14020
|
-
const stop = import_cjs$
|
|
14117
|
+
var import_cjs$7 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14118
|
+
const stop = import_cjs$7.command({
|
|
14021
14119
|
name: "stop",
|
|
14022
14120
|
aliases: ["rm", "remove"],
|
|
14023
14121
|
description: "Stop one or more running sandboxes",
|
|
14024
14122
|
args: {
|
|
14025
14123
|
scope,
|
|
14026
|
-
sandboxId: import_cjs$
|
|
14124
|
+
sandboxId: import_cjs$7.positional({
|
|
14027
14125
|
type: sandboxId,
|
|
14028
14126
|
description: "a sandbox ID to stop"
|
|
14029
14127
|
}),
|
|
14030
|
-
sandboxIds: import_cjs$
|
|
14128
|
+
sandboxIds: import_cjs$7.restPositionals({
|
|
14031
14129
|
type: sandboxId,
|
|
14032
14130
|
description: "more sandboxes to stop"
|
|
14033
14131
|
})
|
|
@@ -14100,10 +14198,10 @@ var require_fs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts
|
|
|
14100
14198
|
|
|
14101
14199
|
//#endregion
|
|
14102
14200
|
//#region src/commands/cp.ts
|
|
14103
|
-
var import_cjs$
|
|
14201
|
+
var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14104
14202
|
var import_fs = /* @__PURE__ */ __toESM(require_fs());
|
|
14105
14203
|
init_source();
|
|
14106
|
-
const localOrRemote = import_cjs$
|
|
14204
|
+
const localOrRemote = import_cjs$6.extendType(import_cjs$6.string, { async from(input) {
|
|
14107
14205
|
const parts = input.split(":");
|
|
14108
14206
|
if (parts.length === 2) {
|
|
14109
14207
|
const [id, path$1] = parts;
|
|
@@ -14123,18 +14221,18 @@ const localOrRemote = import_cjs$5.extendType(import_cjs$5.string, { async from(
|
|
|
14123
14221
|
file: await import_fs.File.from(input)
|
|
14124
14222
|
};
|
|
14125
14223
|
} });
|
|
14126
|
-
const cp = import_cjs$
|
|
14224
|
+
const cp = import_cjs$6.command({
|
|
14127
14225
|
name: "copy",
|
|
14128
14226
|
description: "Copy files between your local filesystem and a remote sandbox",
|
|
14129
14227
|
aliases: ["cp"],
|
|
14130
14228
|
args: {
|
|
14131
14229
|
scope,
|
|
14132
|
-
source: import_cjs$
|
|
14230
|
+
source: import_cjs$6.positional({
|
|
14133
14231
|
displayName: `SANDBOX_ID:PATH`,
|
|
14134
14232
|
description: `The source file to copy from local file system, or or a sandbox_id:path from a remote sandbox`,
|
|
14135
14233
|
type: localOrRemote
|
|
14136
14234
|
}),
|
|
14137
|
-
dest: import_cjs$
|
|
14235
|
+
dest: import_cjs$6.positional({
|
|
14138
14236
|
displayName: `SANDBOX_ID:PATH`,
|
|
14139
14237
|
description: `The destination file to copy to local file system, or or a sandbox_id:path to a remote sandbox`,
|
|
14140
14238
|
type: localOrRemote
|
|
@@ -14176,10 +14274,10 @@ const cp = import_cjs$5.command({
|
|
|
14176
14274
|
|
|
14177
14275
|
//#endregion
|
|
14178
14276
|
//#region src/commands/logout.ts
|
|
14179
|
-
var import_cjs$
|
|
14277
|
+
var import_cjs$5 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14180
14278
|
init_source();
|
|
14181
14279
|
const debug = createDebugger("sandbox:logout");
|
|
14182
|
-
const logout = import_cjs$
|
|
14280
|
+
const logout = import_cjs$5.command({
|
|
14183
14281
|
name: "logout",
|
|
14184
14282
|
description: "Log out of the Sandbox CLI",
|
|
14185
14283
|
args: {},
|
|
@@ -14198,21 +14296,21 @@ const logout = import_cjs$4.command({
|
|
|
14198
14296
|
|
|
14199
14297
|
//#endregion
|
|
14200
14298
|
//#region src/commands/snapshot.ts
|
|
14201
|
-
var import_cjs$
|
|
14299
|
+
var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14202
14300
|
init_source();
|
|
14203
14301
|
const args = {
|
|
14204
14302
|
scope,
|
|
14205
|
-
stop: import_cjs$
|
|
14303
|
+
stop: import_cjs$4.flag({
|
|
14206
14304
|
long: "stop",
|
|
14207
14305
|
description: "Confirm that the sandbox will be stopped when snapshotting"
|
|
14208
14306
|
}),
|
|
14209
|
-
silent: import_cjs$
|
|
14307
|
+
silent: import_cjs$4.flag({
|
|
14210
14308
|
long: "silent",
|
|
14211
14309
|
description: "Don't write snapshot ID to stdout"
|
|
14212
14310
|
}),
|
|
14213
|
-
sandbox: import_cjs$
|
|
14311
|
+
sandbox: import_cjs$4.positional({ type: sandboxId })
|
|
14214
14312
|
};
|
|
14215
|
-
const snapshot = import_cjs$
|
|
14313
|
+
const snapshot = import_cjs$4.command({
|
|
14216
14314
|
name: "snapshot",
|
|
14217
14315
|
description: "Take a snapshot of the filesystem of a sandbox",
|
|
14218
14316
|
args,
|
|
@@ -14246,10 +14344,10 @@ const snapshot = import_cjs$3.command({
|
|
|
14246
14344
|
|
|
14247
14345
|
//#endregion
|
|
14248
14346
|
//#region src/commands/snapshots.ts
|
|
14249
|
-
var import_cjs$
|
|
14250
|
-
var import_cjs$
|
|
14347
|
+
var import_cjs$2 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14348
|
+
var import_cjs$3 = require_cjs();
|
|
14251
14349
|
init_source();
|
|
14252
|
-
const list$1 = import_cjs$
|
|
14350
|
+
const list$1 = import_cjs$2.command({
|
|
14253
14351
|
name: "list",
|
|
14254
14352
|
aliases: ["ls"],
|
|
14255
14353
|
description: "List snapshots for the specified account and project.",
|
|
@@ -14288,17 +14386,17 @@ const list$1 = import_cjs$1.command({
|
|
|
14288
14386
|
}));
|
|
14289
14387
|
}
|
|
14290
14388
|
});
|
|
14291
|
-
const remove = import_cjs$
|
|
14389
|
+
const remove = import_cjs$2.command({
|
|
14292
14390
|
name: "delete",
|
|
14293
14391
|
aliases: ["rm", "remove"],
|
|
14294
14392
|
description: "Delete one or more snapshots.",
|
|
14295
14393
|
args: {
|
|
14296
14394
|
scope,
|
|
14297
|
-
snapshotId: import_cjs$
|
|
14395
|
+
snapshotId: import_cjs$2.positional({
|
|
14298
14396
|
type: snapshotId,
|
|
14299
14397
|
description: "snapshot ID to delete"
|
|
14300
14398
|
}),
|
|
14301
|
-
snapshotIds: import_cjs$
|
|
14399
|
+
snapshotIds: import_cjs$2.restPositionals({
|
|
14302
14400
|
type: snapshotId,
|
|
14303
14401
|
description: "More snapshots IDs to delete"
|
|
14304
14402
|
})
|
|
@@ -14321,7 +14419,7 @@ const remove = import_cjs$1.command({
|
|
|
14321
14419
|
}), { concurrent: true }).run();
|
|
14322
14420
|
}
|
|
14323
14421
|
});
|
|
14324
|
-
const snapshots = (0, import_cjs$
|
|
14422
|
+
const snapshots = (0, import_cjs$3.subcommands)({
|
|
14325
14423
|
name: "snapshots",
|
|
14326
14424
|
description: "Manage sandbox snapshots",
|
|
14327
14425
|
cmds: {
|
|
@@ -14335,6 +14433,62 @@ const SnapshotStatusColor = new Map([
|
|
|
14335
14433
|
["failed", source_default.red]
|
|
14336
14434
|
]);
|
|
14337
14435
|
|
|
14436
|
+
//#endregion
|
|
14437
|
+
//#region src/commands/config.ts
|
|
14438
|
+
var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14439
|
+
init_source();
|
|
14440
|
+
const networkPolicyCommand = import_cjs$1.command({
|
|
14441
|
+
name: "network-policy",
|
|
14442
|
+
description: `Update the network policy of a sandbox
|
|
14443
|
+
|
|
14444
|
+
This is a full update, fully overriding the pre-existing configuration.`,
|
|
14445
|
+
args: {
|
|
14446
|
+
scope,
|
|
14447
|
+
sandbox: import_cjs$1.positional({ type: sandboxId }),
|
|
14448
|
+
...networkPolicyArgs
|
|
14449
|
+
},
|
|
14450
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandbox: sandboxId$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
|
|
14451
|
+
if (networkPolicyMode$1 === void 0) throw new Error(`Network policy mode must be set.`);
|
|
14452
|
+
const networkPolicy$1 = buildNetworkPolicy({
|
|
14453
|
+
networkPolicy: networkPolicyMode$1,
|
|
14454
|
+
allowedDomains: allowedDomains$1,
|
|
14455
|
+
allowedCIDRs: allowedCIDRs$1,
|
|
14456
|
+
deniedCIDRs: deniedCIDRs$1
|
|
14457
|
+
});
|
|
14458
|
+
const sandbox = typeof sandboxId$1 !== "string" ? sandboxId$1 : await sandboxClient.get({
|
|
14459
|
+
sandboxId: sandboxId$1,
|
|
14460
|
+
projectId: project$1,
|
|
14461
|
+
teamId: team$1,
|
|
14462
|
+
token: token$1
|
|
14463
|
+
});
|
|
14464
|
+
if (!["pending", "running"].includes(sandbox.status)) {
|
|
14465
|
+
console.error([
|
|
14466
|
+
`Sandbox ${sandbox.sandboxId} is not available (status: ${sandbox.status}).`,
|
|
14467
|
+
`${source_default.bold("hint:")} Only 'pending' or 'running' sandboxes can execute commands.`,
|
|
14468
|
+
"├▶ Use `sandbox list` to check sandbox status.",
|
|
14469
|
+
"╰▶ Use `sandbox create` to create a new sandbox."
|
|
14470
|
+
].join("\n"));
|
|
14471
|
+
process.exitCode = 1;
|
|
14472
|
+
return;
|
|
14473
|
+
}
|
|
14474
|
+
const spinner = ora("Updating network policy...").start();
|
|
14475
|
+
try {
|
|
14476
|
+
await sandbox.updateNetworkPolicy(networkPolicy$1);
|
|
14477
|
+
spinner.stop();
|
|
14478
|
+
process.stderr.write("✅ Network policy updated for sandbox " + source_default.cyan(sandbox.sandboxId) + "\n");
|
|
14479
|
+
process.stderr.write(source_default.dim(" ╰ ") + "mode: " + source_default.cyan(networkPolicy$1.type) + "\n");
|
|
14480
|
+
} catch (error) {
|
|
14481
|
+
spinner.stop();
|
|
14482
|
+
throw error;
|
|
14483
|
+
}
|
|
14484
|
+
}
|
|
14485
|
+
});
|
|
14486
|
+
const config = import_cjs$1.subcommands({
|
|
14487
|
+
name: "config",
|
|
14488
|
+
description: "Update a sandbox configuration",
|
|
14489
|
+
cmds: { "network-policy": networkPolicyCommand }
|
|
14490
|
+
});
|
|
14491
|
+
|
|
14338
14492
|
//#endregion
|
|
14339
14493
|
//#region src/app.ts
|
|
14340
14494
|
var import_cjs = require_cjs();
|
|
@@ -14345,6 +14499,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
14345
14499
|
cmds: {
|
|
14346
14500
|
list,
|
|
14347
14501
|
create,
|
|
14502
|
+
config,
|
|
14348
14503
|
copy: cp,
|
|
14349
14504
|
exec,
|
|
14350
14505
|
ssh,
|
|
@@ -14362,4 +14517,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
14362
14517
|
|
|
14363
14518
|
//#endregion
|
|
14364
14519
|
export { StyledError as n, require_cjs as r, app as t };
|
|
14365
|
-
//# sourceMappingURL=app-
|
|
14520
|
+
//# sourceMappingURL=app-DtmaeGtx.mjs.map
|