sandbox 3.1.1 → 3.2.0-beta.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.
|
@@ -20,7 +20,7 @@ import { EOL } from "os";
|
|
|
20
20
|
import { z } from "zod/v4";
|
|
21
21
|
import { z as z$1 } from "zod";
|
|
22
22
|
import retry from "async-retry";
|
|
23
|
-
import { APIError, Sandbox, Snapshot } from "@vercel/sandbox";
|
|
23
|
+
import { APIError, Drive, Sandbox, Snapshot } from "@vercel/sandbox";
|
|
24
24
|
import readline from "node:readline";
|
|
25
25
|
import { randomUUID } from "crypto";
|
|
26
26
|
import { Writable } from "stream";
|
|
@@ -479,7 +479,7 @@ var init_source = __esm({ "../../node_modules/.pnpm/chalk@5.6.0/node_modules/cha
|
|
|
479
479
|
var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/didyoumean@1.2.2/node_modules/didyoumean/didYouMean-1.2.1.js": ((exports, module) => {
|
|
480
480
|
(function() {
|
|
481
481
|
"use strict";
|
|
482
|
-
function didYouMean(str, list$
|
|
482
|
+
function didYouMean(str, list$4, key) {
|
|
483
483
|
if (!str) return null;
|
|
484
484
|
if (!didYouMean.caseSensitive) str = str.toLowerCase();
|
|
485
485
|
var thresholdRelative = didYouMean.threshold === null ? null : didYouMean.threshold * str.length, thresholdAbsolute = didYouMean.thresholdAbsolute, winningVal;
|
|
@@ -487,9 +487,9 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS$1({ "../../node_module
|
|
|
487
487
|
else if (thresholdRelative !== null) winningVal = thresholdRelative;
|
|
488
488
|
else if (thresholdAbsolute !== null) winningVal = thresholdAbsolute;
|
|
489
489
|
else winningVal = null;
|
|
490
|
-
var winner, candidate, testCandidate, val, i, len = list$
|
|
490
|
+
var winner, candidate, testCandidate, val, i, len = list$4.length;
|
|
491
491
|
for (i = 0; i < len; i++) {
|
|
492
|
-
candidate = list$
|
|
492
|
+
candidate = list$4[i];
|
|
493
493
|
if (key) candidate = candidate[key];
|
|
494
494
|
if (!candidate) continue;
|
|
495
495
|
if (!didYouMean.caseSensitive) testCandidate = candidate.toLowerCase();
|
|
@@ -497,7 +497,7 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS$1({ "../../node_module
|
|
|
497
497
|
val = getEditDistance(str, testCandidate, winningVal);
|
|
498
498
|
if (winningVal === null || val < winningVal) {
|
|
499
499
|
winningVal = val;
|
|
500
|
-
if (key && didYouMean.returnWinningObject) winner = list$
|
|
500
|
+
if (key && didYouMean.returnWinningObject) winner = list$4[i];
|
|
501
501
|
else winner = candidate;
|
|
502
502
|
if (didYouMean.returnFirstMatch) return winner;
|
|
503
503
|
}
|
|
@@ -1447,7 +1447,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1447
1447
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1448
1448
|
};
|
|
1449
1449
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1450
|
-
exports.subcommands = subcommands$
|
|
1450
|
+
exports.subcommands = subcommands$4;
|
|
1451
1451
|
const chalk_1$3 = __importDefault$4((init_source(), __toCommonJS$3(source_exports)));
|
|
1452
1452
|
const didyoumean_1 = __importDefault$4(require_didYouMean_1_2_1());
|
|
1453
1453
|
const Result$7 = __importStar$7(require_Result());
|
|
@@ -1457,7 +1457,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1457
1457
|
/**
|
|
1458
1458
|
* Combine multiple `command`s into one
|
|
1459
1459
|
*/
|
|
1460
|
-
function subcommands$
|
|
1460
|
+
function subcommands$4(config$1) {
|
|
1461
1461
|
const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config$1.version);
|
|
1462
1462
|
const subcommand = (0, positional_1$1.positional)({
|
|
1463
1463
|
displayName: "subcommand",
|
|
@@ -2998,9 +2998,9 @@ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-t
|
|
|
2998
2998
|
|
|
2999
2999
|
//#endregion
|
|
3000
3000
|
//#region src/args/runtime.ts
|
|
3001
|
-
var import_cjs$
|
|
3001
|
+
var import_cjs$33 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3002
3002
|
const runtimeType = {
|
|
3003
|
-
...import_cjs$
|
|
3003
|
+
...import_cjs$33.oneOf([
|
|
3004
3004
|
"node22",
|
|
3005
3005
|
"node24",
|
|
3006
3006
|
"node26",
|
|
@@ -3008,7 +3008,7 @@ const runtimeType = {
|
|
|
3008
3008
|
]),
|
|
3009
3009
|
displayName: "runtime"
|
|
3010
3010
|
};
|
|
3011
|
-
const runtime = import_cjs$
|
|
3011
|
+
const runtime = import_cjs$33.option({
|
|
3012
3012
|
long: "runtime",
|
|
3013
3013
|
type: runtimeType,
|
|
3014
3014
|
defaultValue: () => "node24",
|
|
@@ -3136,9 +3136,9 @@ var require_ms = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ms@2.1
|
|
|
3136
3136
|
|
|
3137
3137
|
//#endregion
|
|
3138
3138
|
//#region src/types/duration.ts
|
|
3139
|
-
var import_cjs$
|
|
3139
|
+
var import_cjs$32 = require_cjs();
|
|
3140
3140
|
init_source();
|
|
3141
|
-
const Duration = (0, import_cjs$
|
|
3141
|
+
const Duration = (0, import_cjs$32.extendType)(import_cjs$32.string, {
|
|
3142
3142
|
displayName: "num UNIT",
|
|
3143
3143
|
description: "A duration, e.g. 5m, 10s, 1h",
|
|
3144
3144
|
async from(string$2) {
|
|
@@ -3154,8 +3154,8 @@ const Duration = (0, import_cjs$29.extendType)(import_cjs$29.string, {
|
|
|
3154
3154
|
|
|
3155
3155
|
//#endregion
|
|
3156
3156
|
//#region src/args/timeout.ts
|
|
3157
|
-
var import_cjs$
|
|
3158
|
-
const timeout = import_cjs$
|
|
3157
|
+
var import_cjs$31 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3158
|
+
const timeout = import_cjs$31.option({
|
|
3159
3159
|
long: "timeout",
|
|
3160
3160
|
type: Duration,
|
|
3161
3161
|
description: "The maximum duration a sandbox can run for. Example: 5m, 30m",
|
|
@@ -3165,17 +3165,17 @@ const timeout = import_cjs$28.option({
|
|
|
3165
3165
|
|
|
3166
3166
|
//#endregion
|
|
3167
3167
|
//#region src/args/vcpus.ts
|
|
3168
|
-
var import_cjs$
|
|
3169
|
-
const vcpusType = import_cjs$
|
|
3168
|
+
var import_cjs$30 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3169
|
+
const vcpusType = import_cjs$30.extendType(import_cjs$30.number, {
|
|
3170
3170
|
displayName: "COUNT",
|
|
3171
3171
|
async from(n) {
|
|
3172
3172
|
if (!Number.isInteger(n) || n < 1) throw new Error(`Invalid vCPU count: ${n}. Must be a positive integer.`);
|
|
3173
3173
|
return n;
|
|
3174
3174
|
}
|
|
3175
3175
|
});
|
|
3176
|
-
const vcpus = import_cjs$
|
|
3176
|
+
const vcpus = import_cjs$30.option({
|
|
3177
3177
|
long: "vcpus",
|
|
3178
|
-
type: import_cjs$
|
|
3178
|
+
type: import_cjs$30.optional(vcpusType),
|
|
3179
3179
|
description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
|
|
3180
3180
|
});
|
|
3181
3181
|
|
|
@@ -6754,10 +6754,10 @@ function _usingCtx() {
|
|
|
6754
6754
|
|
|
6755
6755
|
//#endregion
|
|
6756
6756
|
//#region src/commands/login.ts
|
|
6757
|
-
var import_cjs$
|
|
6757
|
+
var import_cjs$29 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6758
6758
|
init_source();
|
|
6759
6759
|
const debug$6 = createDebugger("sandbox:login");
|
|
6760
|
-
const login = import_cjs$
|
|
6760
|
+
const login = import_cjs$29.command({
|
|
6761
6761
|
name: "login",
|
|
6762
6762
|
description: "Log in to the Sandbox CLI",
|
|
6763
6763
|
args: {},
|
|
@@ -6975,7 +6975,7 @@ var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/@ver
|
|
|
6975
6975
|
|
|
6976
6976
|
//#endregion
|
|
6977
6977
|
//#region src/args/auth.ts
|
|
6978
|
-
var import_cjs$
|
|
6978
|
+
var import_cjs$28 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6979
6979
|
init_source();
|
|
6980
6980
|
var import_dist = require_dist();
|
|
6981
6981
|
const debug$5 = createDebugger("sandbox:args:auth");
|
|
@@ -6992,11 +6992,11 @@ function isTokenFresh() {
|
|
|
6992
6992
|
function markTokenAsFresh() {
|
|
6993
6993
|
freshTokenAcquiredAt = Date.now();
|
|
6994
6994
|
}
|
|
6995
|
-
const token = import_cjs$
|
|
6995
|
+
const token = import_cjs$28.option({
|
|
6996
6996
|
long: "token",
|
|
6997
6997
|
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.",
|
|
6998
6998
|
type: {
|
|
6999
|
-
...import_cjs$
|
|
6999
|
+
...import_cjs$28.string,
|
|
7000
7000
|
displayName: "pat_or_oidc",
|
|
7001
7001
|
defaultValueIsSerializable: false,
|
|
7002
7002
|
onMissing: async () => {
|
|
@@ -7179,29 +7179,29 @@ function getAuthFailureStatus(error) {
|
|
|
7179
7179
|
|
|
7180
7180
|
//#endregion
|
|
7181
7181
|
//#region src/args/scope.ts
|
|
7182
|
-
var import_cjs$
|
|
7182
|
+
var import_cjs$27 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7183
7183
|
init_source();
|
|
7184
|
-
const project = import_cjs$
|
|
7184
|
+
const project = import_cjs$27.option({
|
|
7185
7185
|
long: "project",
|
|
7186
7186
|
type: {
|
|
7187
|
-
...import_cjs$
|
|
7187
|
+
...import_cjs$27.optional(import_cjs$27.string),
|
|
7188
7188
|
displayName: "my-project"
|
|
7189
7189
|
},
|
|
7190
7190
|
description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
|
|
7191
7191
|
});
|
|
7192
7192
|
/** Parser for the `--team` option. */
|
|
7193
|
-
const teamParser = import_cjs$
|
|
7193
|
+
const teamParser = import_cjs$27.option({
|
|
7194
7194
|
long: "team",
|
|
7195
7195
|
type: {
|
|
7196
|
-
...import_cjs$
|
|
7196
|
+
...import_cjs$27.optional(import_cjs$27.string),
|
|
7197
7197
|
displayName: "my-team"
|
|
7198
7198
|
}
|
|
7199
7199
|
});
|
|
7200
7200
|
/** Parser for the `--scope` option. */
|
|
7201
|
-
const scopeParser = import_cjs$
|
|
7201
|
+
const scopeParser = import_cjs$27.option({
|
|
7202
7202
|
long: "scope",
|
|
7203
7203
|
type: {
|
|
7204
|
-
...import_cjs$
|
|
7204
|
+
...import_cjs$27.optional(import_cjs$27.string),
|
|
7205
7205
|
displayName: "my-team"
|
|
7206
7206
|
},
|
|
7207
7207
|
description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
|
|
@@ -7290,7 +7290,7 @@ const scope = {
|
|
|
7290
7290
|
|
|
7291
7291
|
//#endregion
|
|
7292
7292
|
//#region package.json
|
|
7293
|
-
var version = "3.
|
|
7293
|
+
var version = "3.2.0-beta.0";
|
|
7294
7294
|
|
|
7295
7295
|
//#endregion
|
|
7296
7296
|
//#region src/error.ts
|
|
@@ -7338,6 +7338,17 @@ const snapshotClient = {
|
|
|
7338
7338
|
...params
|
|
7339
7339
|
}))
|
|
7340
7340
|
};
|
|
7341
|
+
const driveClient = {
|
|
7342
|
+
getOrCreate: (params) => withErrorHandling(() => Drive.getOrCreate({
|
|
7343
|
+
fetch: fetchWithUserAgent,
|
|
7344
|
+
...params
|
|
7345
|
+
})),
|
|
7346
|
+
list: (params) => withErrorHandling(() => Drive.list({
|
|
7347
|
+
fetch: fetchWithUserAgent,
|
|
7348
|
+
...params
|
|
7349
|
+
})),
|
|
7350
|
+
delete: (drive) => withErrorHandling(() => drive.delete())
|
|
7351
|
+
};
|
|
7341
7352
|
const fetchWithUserAgent = (input, init$1) => {
|
|
7342
7353
|
const headers = new Headers(init$1?.headers ?? (input && typeof input === "object" && "headers" in input ? input?.headers : {}));
|
|
7343
7354
|
let agent = `vercel/sandbox-cli/${version}`;
|
|
@@ -7389,9 +7400,9 @@ async function writeResponseToTemp({ response, text }) {
|
|
|
7389
7400
|
|
|
7390
7401
|
//#endregion
|
|
7391
7402
|
//#region src/args/snapshot-id.ts
|
|
7392
|
-
var import_cjs$
|
|
7403
|
+
var import_cjs$26 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7393
7404
|
init_source();
|
|
7394
|
-
const snapshotId = import_cjs$
|
|
7405
|
+
const snapshotId = import_cjs$26.extendType(import_cjs$26.string, {
|
|
7395
7406
|
displayName: "snapshot_id",
|
|
7396
7407
|
description: "The ID of the snapshot",
|
|
7397
7408
|
async from(s$1) {
|
|
@@ -7402,13 +7413,13 @@ const snapshotId = import_cjs$23.extendType(import_cjs$23.string, {
|
|
|
7402
7413
|
|
|
7403
7414
|
//#endregion
|
|
7404
7415
|
//#region src/args/ports.ts
|
|
7405
|
-
var import_cjs$
|
|
7416
|
+
var import_cjs$25 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7406
7417
|
init_source();
|
|
7407
|
-
const publishPorts = import_cjs$
|
|
7418
|
+
const publishPorts = import_cjs$25.multioption({
|
|
7408
7419
|
long: "publish-port",
|
|
7409
7420
|
short: "p",
|
|
7410
7421
|
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
7411
|
-
type: import_cjs$
|
|
7422
|
+
type: import_cjs$25.array(import_cjs$25.extendType(import_cjs$25.number, {
|
|
7412
7423
|
displayName: "PORT",
|
|
7413
7424
|
async from(number) {
|
|
7414
7425
|
if (!Number.isInteger(number) || number < 1024 || number > 65535) throw new Error([
|
|
@@ -7423,8 +7434,8 @@ const publishPorts = import_cjs$22.multioption({
|
|
|
7423
7434
|
|
|
7424
7435
|
//#endregion
|
|
7425
7436
|
//#region src/types/snapshot-expiration.ts
|
|
7426
|
-
var import_cjs$
|
|
7427
|
-
const SnapshotExpiration = (0, import_cjs$
|
|
7437
|
+
var import_cjs$24 = require_cjs();
|
|
7438
|
+
const SnapshotExpiration = (0, import_cjs$24.extendType)(import_cjs$24.string, {
|
|
7428
7439
|
displayName: "DURATION|none",
|
|
7429
7440
|
description: "A duration (e.g. 7d, 30d) or \"none\" for no expiration",
|
|
7430
7441
|
async from(value) {
|
|
@@ -7435,15 +7446,15 @@ const SnapshotExpiration = (0, import_cjs$21.extendType)(import_cjs$21.string, {
|
|
|
7435
7446
|
|
|
7436
7447
|
//#endregion
|
|
7437
7448
|
//#region src/args/snapshot-retention.ts
|
|
7438
|
-
var import_cjs$
|
|
7439
|
-
const snapshotExpiration = import_cjs$
|
|
7449
|
+
var import_cjs$23 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7450
|
+
const snapshotExpiration = import_cjs$23.option({
|
|
7440
7451
|
long: "snapshot-expiration",
|
|
7441
|
-
type: import_cjs$
|
|
7452
|
+
type: import_cjs$23.optional(SnapshotExpiration),
|
|
7442
7453
|
description: "Default snapshot expiration. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
7443
7454
|
});
|
|
7444
|
-
const keepLastSnapshots = import_cjs$
|
|
7455
|
+
const keepLastSnapshots = import_cjs$23.option({
|
|
7445
7456
|
long: "keep-last-snapshots",
|
|
7446
|
-
type: import_cjs$
|
|
7457
|
+
type: import_cjs$23.optional(import_cjs$23.extendType(import_cjs$23.number, {
|
|
7447
7458
|
displayName: "COUNT",
|
|
7448
7459
|
async from(n) {
|
|
7449
7460
|
if (!Number.isInteger(n) || n < 1 || n > 10) throw new Error(`Invalid --keep-last-snapshots value: ${n}. Must be an integer between 1 and 10.`);
|
|
@@ -7452,15 +7463,15 @@ const keepLastSnapshots = import_cjs$20.option({
|
|
|
7452
7463
|
})),
|
|
7453
7464
|
description: "Keep only the N most recent snapshots of this sandbox (1-10)."
|
|
7454
7465
|
});
|
|
7455
|
-
const keepLastSnapshotsFor = import_cjs$
|
|
7466
|
+
const keepLastSnapshotsFor = import_cjs$23.option({
|
|
7456
7467
|
long: "keep-last-snapshots-for",
|
|
7457
|
-
type: import_cjs$
|
|
7468
|
+
type: import_cjs$23.optional(SnapshotExpiration),
|
|
7458
7469
|
description: "Expiration applied to kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
7459
7470
|
});
|
|
7460
|
-
const deleteEvictedSnapshots = import_cjs$
|
|
7471
|
+
const deleteEvictedSnapshots = import_cjs$23.option({
|
|
7461
7472
|
long: "delete-evicted-snapshots",
|
|
7462
|
-
type: import_cjs$
|
|
7463
|
-
...import_cjs$
|
|
7473
|
+
type: import_cjs$23.optional({
|
|
7474
|
+
...import_cjs$23.oneOf(["true", "false"]),
|
|
7464
7475
|
displayName: "true|false"
|
|
7465
7476
|
}),
|
|
7466
7477
|
description: "When \"true\" (the default), evicted snapshots are deleted immediately; when \"false\", they keep the default expiration."
|
|
@@ -7474,9 +7485,9 @@ const snapshotRetentionArgs = {
|
|
|
7474
7485
|
|
|
7475
7486
|
//#endregion
|
|
7476
7487
|
//#region src/args/sandbox-name.ts
|
|
7477
|
-
var import_cjs$
|
|
7488
|
+
var import_cjs$22 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7478
7489
|
init_source();
|
|
7479
|
-
const sandboxName = import_cjs$
|
|
7490
|
+
const sandboxName = import_cjs$22.extendType(import_cjs$22.string, {
|
|
7480
7491
|
displayName: "name",
|
|
7481
7492
|
description: "The name of the sandbox",
|
|
7482
7493
|
async from(s$1) {
|
|
@@ -7525,13 +7536,13 @@ var require_buffer_util = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
7525
7536
|
* @return {Buffer} The resulting buffer
|
|
7526
7537
|
* @public
|
|
7527
7538
|
*/
|
|
7528
|
-
function concat$1(list$
|
|
7529
|
-
if (list$
|
|
7530
|
-
if (list$
|
|
7539
|
+
function concat$1(list$4, totalLength) {
|
|
7540
|
+
if (list$4.length === 0) return EMPTY_BUFFER$3;
|
|
7541
|
+
if (list$4.length === 1) return list$4[0];
|
|
7531
7542
|
const target = Buffer.allocUnsafe(totalLength);
|
|
7532
7543
|
let offset = 0;
|
|
7533
|
-
for (let i = 0; i < list$
|
|
7534
|
-
const buf = list$
|
|
7544
|
+
for (let i = 0; i < list$4.length; i++) {
|
|
7545
|
+
const buf = list$4[i];
|
|
7535
7546
|
target.set(buf, offset);
|
|
7536
7547
|
offset += buf.length;
|
|
7537
7548
|
}
|
|
@@ -9100,13 +9111,13 @@ var require_sender = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ws
|
|
|
9100
9111
|
* @param {Function} [cb] Callback
|
|
9101
9112
|
* @private
|
|
9102
9113
|
*/
|
|
9103
|
-
sendFrame(list$
|
|
9104
|
-
if (list$
|
|
9114
|
+
sendFrame(list$4, cb) {
|
|
9115
|
+
if (list$4.length === 2) {
|
|
9105
9116
|
this._socket.cork();
|
|
9106
|
-
this._socket.write(list$
|
|
9107
|
-
this._socket.write(list$
|
|
9117
|
+
this._socket.write(list$4[0]);
|
|
9118
|
+
this._socket.write(list$4[1], cb);
|
|
9108
9119
|
this._socket.uncork();
|
|
9109
|
-
} else this._socket.write(list$
|
|
9120
|
+
} else this._socket.write(list$4[0], cb);
|
|
9110
9121
|
}
|
|
9111
9122
|
};
|
|
9112
9123
|
module.exports = Sender$2;
|
|
@@ -11518,9 +11529,9 @@ function getStderrStream() {
|
|
|
11518
11529
|
|
|
11519
11530
|
//#endregion
|
|
11520
11531
|
//#region src/args/key-value-pair.ts
|
|
11521
|
-
var import_cjs$
|
|
11532
|
+
var import_cjs$21 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11522
11533
|
init_source();
|
|
11523
|
-
const KeyValuePair = import_cjs$
|
|
11534
|
+
const KeyValuePair = import_cjs$21.extendType(import_cjs$21.string, {
|
|
11524
11535
|
displayName: "key=value",
|
|
11525
11536
|
async from(input) {
|
|
11526
11537
|
if (!input.includes("=")) return {
|
|
@@ -11534,7 +11545,7 @@ const KeyValuePair = import_cjs$18.extendType(import_cjs$18.string, {
|
|
|
11534
11545
|
};
|
|
11535
11546
|
}
|
|
11536
11547
|
});
|
|
11537
|
-
const ObjectFromKeyValue = import_cjs$
|
|
11548
|
+
const ObjectFromKeyValue = import_cjs$21.extendType(import_cjs$21.array(KeyValuePair), { async from(input) {
|
|
11538
11549
|
const obj = Object.create(null);
|
|
11539
11550
|
const missingVars = [];
|
|
11540
11551
|
for (const { key, value } of input) if (value === void 0) missingVars.push(key);
|
|
@@ -11548,28 +11559,28 @@ const ObjectFromKeyValue = import_cjs$18.extendType(import_cjs$18.array(KeyValue
|
|
|
11548
11559
|
|
|
11549
11560
|
//#endregion
|
|
11550
11561
|
//#region src/commands/exec.ts
|
|
11551
|
-
var import_cjs$
|
|
11562
|
+
var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11552
11563
|
var import_ms$5 = /* @__PURE__ */ __toESM(require_ms());
|
|
11553
11564
|
init_source();
|
|
11554
11565
|
const args$4 = {
|
|
11555
|
-
sandbox: import_cjs$
|
|
11556
|
-
command: import_cjs$
|
|
11566
|
+
sandbox: import_cjs$20.positional({ type: sandboxName }),
|
|
11567
|
+
command: import_cjs$20.positional({
|
|
11557
11568
|
displayName: "command",
|
|
11558
11569
|
description: "The executable to invoke"
|
|
11559
11570
|
}),
|
|
11560
|
-
args: import_cjs$
|
|
11571
|
+
args: import_cjs$20.rest({
|
|
11561
11572
|
displayName: "args",
|
|
11562
11573
|
description: "arguments to pass to the command"
|
|
11563
11574
|
}),
|
|
11564
|
-
asSudo: import_cjs$
|
|
11575
|
+
asSudo: import_cjs$20.flag({
|
|
11565
11576
|
long: "sudo",
|
|
11566
11577
|
description: "Give extended privileges to the command."
|
|
11567
11578
|
}),
|
|
11568
|
-
interactive: import_cjs$
|
|
11579
|
+
interactive: import_cjs$20.flag({
|
|
11569
11580
|
long: "interactive",
|
|
11570
11581
|
short: "i",
|
|
11571
11582
|
description: "Run the command in a secure interactive shell",
|
|
11572
|
-
type: import_cjs$
|
|
11583
|
+
type: import_cjs$20.extendType(import_cjs$20.boolean, {
|
|
11573
11584
|
defaultValue() {
|
|
11574
11585
|
return false;
|
|
11575
11586
|
},
|
|
@@ -11579,35 +11590,35 @@ const args$4 = {
|
|
|
11579
11590
|
}
|
|
11580
11591
|
})
|
|
11581
11592
|
}),
|
|
11582
|
-
skipExtendingTimeout: import_cjs$
|
|
11593
|
+
skipExtendingTimeout: import_cjs$20.flag({
|
|
11583
11594
|
long: "no-extend-timeout",
|
|
11584
11595
|
description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
|
|
11585
11596
|
}),
|
|
11586
|
-
tty: import_cjs$
|
|
11597
|
+
tty: import_cjs$20.flag({
|
|
11587
11598
|
long: "tty",
|
|
11588
11599
|
short: "t",
|
|
11589
11600
|
description: "Allocate a tty for an interactive command. This is a no-op."
|
|
11590
11601
|
}),
|
|
11591
|
-
cwd: import_cjs$
|
|
11602
|
+
cwd: import_cjs$20.option({
|
|
11592
11603
|
long: "workdir",
|
|
11593
11604
|
short: "w",
|
|
11594
11605
|
description: "The working directory to run the command in",
|
|
11595
|
-
type: import_cjs$
|
|
11606
|
+
type: import_cjs$20.optional(import_cjs$20.string)
|
|
11596
11607
|
}),
|
|
11597
|
-
envVars: import_cjs$
|
|
11608
|
+
envVars: import_cjs$20.multioption({
|
|
11598
11609
|
long: "env",
|
|
11599
11610
|
short: "e",
|
|
11600
11611
|
type: ObjectFromKeyValue,
|
|
11601
11612
|
description: "Environment variables to set for the command"
|
|
11602
11613
|
}),
|
|
11603
|
-
timeout: import_cjs$
|
|
11614
|
+
timeout: import_cjs$20.option({
|
|
11604
11615
|
long: "timeout",
|
|
11605
|
-
type: import_cjs$
|
|
11616
|
+
type: import_cjs$20.optional(Duration),
|
|
11606
11617
|
description: "Maximum duration to wait for the command (e.g. 30s, 5m). On expiry the process is killed with SIGKILL. Cannot be combined with --interactive."
|
|
11607
11618
|
}),
|
|
11608
11619
|
scope
|
|
11609
11620
|
};
|
|
11610
|
-
const exec = import_cjs$
|
|
11621
|
+
const exec = import_cjs$20.command({
|
|
11611
11622
|
name: "exec",
|
|
11612
11623
|
description: "Execute a command in an existing sandbox",
|
|
11613
11624
|
args: args$4,
|
|
@@ -11648,9 +11659,9 @@ const exec = import_cjs$17.command({
|
|
|
11648
11659
|
|
|
11649
11660
|
//#endregion
|
|
11650
11661
|
//#region src/args/network-policy.ts
|
|
11651
|
-
var import_cjs$
|
|
11662
|
+
var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11652
11663
|
init_source();
|
|
11653
|
-
const networkPolicyMode = import_cjs$
|
|
11664
|
+
const networkPolicyMode = import_cjs$19.extendType(import_cjs$19.string, {
|
|
11654
11665
|
displayName: "MODE",
|
|
11655
11666
|
async from(value) {
|
|
11656
11667
|
const validModes = ["allow-all", "deny-all"];
|
|
@@ -11658,28 +11669,28 @@ const networkPolicyMode = import_cjs$16.extendType(import_cjs$16.string, {
|
|
|
11658
11669
|
return value;
|
|
11659
11670
|
}
|
|
11660
11671
|
});
|
|
11661
|
-
const networkPolicy = import_cjs$
|
|
11672
|
+
const networkPolicy = import_cjs$19.option({
|
|
11662
11673
|
long: "network-policy",
|
|
11663
11674
|
description: `Network policy mode: "allow-all" or "deny-all"
|
|
11664
11675
|
- allow-all: sandbox can access any website/domain
|
|
11665
11676
|
- deny-all: sandbox has no network access
|
|
11666
11677
|
Omit this option and use --allowed-domain / --allowed-cidr / --denied-cidr for custom policies.`,
|
|
11667
|
-
type: import_cjs$
|
|
11678
|
+
type: import_cjs$19.optional(networkPolicyMode)
|
|
11668
11679
|
});
|
|
11669
|
-
const allowedDomains = import_cjs$
|
|
11680
|
+
const allowedDomains = import_cjs$19.multioption({
|
|
11670
11681
|
long: "allowed-domain",
|
|
11671
11682
|
description: `Domain to allow traffic to (creates a custom network policy). Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com'). If used as the first segment, will match any subdomain.`,
|
|
11672
|
-
type: import_cjs$
|
|
11683
|
+
type: import_cjs$19.array(import_cjs$19.string)
|
|
11673
11684
|
});
|
|
11674
|
-
const allowedCIDRs = import_cjs$
|
|
11685
|
+
const allowedCIDRs = import_cjs$19.multioption({
|
|
11675
11686
|
long: "allowed-cidr",
|
|
11676
11687
|
description: `CIDR to allow traffic to (creates a custom network policy). Takes precedence over 'allowed-domain'.`,
|
|
11677
|
-
type: import_cjs$
|
|
11688
|
+
type: import_cjs$19.array(import_cjs$19.string)
|
|
11678
11689
|
});
|
|
11679
|
-
const deniedCIDRs = import_cjs$
|
|
11690
|
+
const deniedCIDRs = import_cjs$19.multioption({
|
|
11680
11691
|
long: "denied-cidr",
|
|
11681
11692
|
description: `CIDR to deny traffic to (creates a custom network policy). Takes precedence over allowed domains/CIDRs.`,
|
|
11682
|
-
type: import_cjs$
|
|
11693
|
+
type: import_cjs$19.array(import_cjs$19.string)
|
|
11683
11694
|
});
|
|
11684
11695
|
const networkPolicyArgs = {
|
|
11685
11696
|
networkPolicy,
|
|
@@ -11773,18 +11784,70 @@ function printSandboxSummary(opts) {
|
|
|
11773
11784
|
} else process.stderr.write(source_default.dim(" ╰ ") + "project: " + source_default.cyan(projectDisplay) + "\n");
|
|
11774
11785
|
}
|
|
11775
11786
|
|
|
11787
|
+
//#endregion
|
|
11788
|
+
//#region src/args/drive.ts
|
|
11789
|
+
var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11790
|
+
init_source();
|
|
11791
|
+
const driveName = import_cjs$18.extendType(import_cjs$18.string, {
|
|
11792
|
+
displayName: "name",
|
|
11793
|
+
description: "The name of the drive",
|
|
11794
|
+
async from(input) {
|
|
11795
|
+
const value = input.trim();
|
|
11796
|
+
if (value.length === 0) throw new Error("Drive name cannot be empty.");
|
|
11797
|
+
return value;
|
|
11798
|
+
}
|
|
11799
|
+
});
|
|
11800
|
+
const driveMount = import_cjs$18.extendType(import_cjs$18.string, {
|
|
11801
|
+
displayName: "drive:path[:mode]",
|
|
11802
|
+
description: "Drive mount in the format \"drive:/path[:read-only|read-write]\".",
|
|
11803
|
+
async from(input) {
|
|
11804
|
+
return parseDriveMount(input);
|
|
11805
|
+
}
|
|
11806
|
+
});
|
|
11807
|
+
const driveMounts = import_cjs$18.extendType(import_cjs$18.array(driveMount), { async from(input) {
|
|
11808
|
+
const mounts$1 = Object.create(null);
|
|
11809
|
+
for (const mount of input) mounts$1[mount.path] = {
|
|
11810
|
+
drive: mount.drive,
|
|
11811
|
+
mode: mount.mode
|
|
11812
|
+
};
|
|
11813
|
+
return mounts$1;
|
|
11814
|
+
} });
|
|
11815
|
+
const mounts = import_cjs$18.multioption({
|
|
11816
|
+
long: "mount",
|
|
11817
|
+
type: driveMounts,
|
|
11818
|
+
description: "Attach a drive to the sandbox. Format: \"drive:/path[:read-only|read-write]\"."
|
|
11819
|
+
});
|
|
11820
|
+
const driveMaxSize = import_cjs$18.extendType(import_cjs$18.number, {
|
|
11821
|
+
displayName: "BYTES",
|
|
11822
|
+
async from(input) {
|
|
11823
|
+
if (!Number.isInteger(input) || input < 1) throw new Error(`Invalid max size: ${input}. Must be a positive integer number of bytes.`);
|
|
11824
|
+
return input;
|
|
11825
|
+
}
|
|
11826
|
+
});
|
|
11827
|
+
function parseDriveMount(input) {
|
|
11828
|
+
const [drive, path$1, mode, ...rest$1] = input.split(":");
|
|
11829
|
+
const validModes = ["read-only", "read-write"];
|
|
11830
|
+
if (rest$1.length > 0 || !drive || path$1 === void 0) throw new Error([`Invalid drive mount: ${input}.`, `${source_default.bold("hint:")} Use "drive:/path" or "drive:/path:read-only".`].join("\n"));
|
|
11831
|
+
if (mode !== void 0 && !validModes.includes(mode)) throw new Error([`Invalid drive mount mode: ${mode}.`, `${source_default.bold("hint:")} Valid modes are: ${validModes.join(", ")}`].join("\n"));
|
|
11832
|
+
return {
|
|
11833
|
+
drive,
|
|
11834
|
+
path: path$1,
|
|
11835
|
+
mode
|
|
11836
|
+
};
|
|
11837
|
+
}
|
|
11838
|
+
|
|
11776
11839
|
//#endregion
|
|
11777
11840
|
//#region src/commands/create.ts
|
|
11778
|
-
var import_cjs$
|
|
11841
|
+
var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11779
11842
|
var import_ms$3 = /* @__PURE__ */ __toESM(require_ms());
|
|
11780
11843
|
init_source();
|
|
11781
11844
|
const args$3 = {
|
|
11782
|
-
name: import_cjs$
|
|
11845
|
+
name: import_cjs$17.option({
|
|
11783
11846
|
long: "name",
|
|
11784
11847
|
description: "A user-chosen name for the sandbox. It must be unique per project.",
|
|
11785
|
-
type: import_cjs$
|
|
11848
|
+
type: import_cjs$17.optional(import_cjs$17.string)
|
|
11786
11849
|
}),
|
|
11787
|
-
nonPersistent: import_cjs$
|
|
11850
|
+
nonPersistent: import_cjs$17.flag({
|
|
11788
11851
|
long: "non-persistent",
|
|
11789
11852
|
description: "Disable automatic restore of the filesystem between sessions."
|
|
11790
11853
|
}),
|
|
@@ -11792,37 +11855,38 @@ const args$3 = {
|
|
|
11792
11855
|
timeout,
|
|
11793
11856
|
vcpus,
|
|
11794
11857
|
ports: publishPorts,
|
|
11795
|
-
silent: import_cjs$
|
|
11858
|
+
silent: import_cjs$17.flag({
|
|
11796
11859
|
long: "silent",
|
|
11797
11860
|
description: "Don't write sandbox name to stdout"
|
|
11798
11861
|
}),
|
|
11799
|
-
snapshot: import_cjs$
|
|
11862
|
+
snapshot: import_cjs$17.option({
|
|
11800
11863
|
long: "snapshot",
|
|
11801
11864
|
short: "s",
|
|
11802
11865
|
description: "Start the sandbox from a snapshot ID",
|
|
11803
|
-
type: import_cjs$
|
|
11866
|
+
type: import_cjs$17.optional(snapshotId)
|
|
11804
11867
|
}),
|
|
11805
|
-
connect: import_cjs$
|
|
11868
|
+
connect: import_cjs$17.flag({
|
|
11806
11869
|
long: "connect",
|
|
11807
11870
|
description: "Start an interactive shell session after creating the sandbox"
|
|
11808
11871
|
}),
|
|
11809
|
-
envVars: import_cjs$
|
|
11872
|
+
envVars: import_cjs$17.multioption({
|
|
11810
11873
|
long: "env",
|
|
11811
11874
|
short: "e",
|
|
11812
11875
|
type: ObjectFromKeyValue,
|
|
11813
11876
|
description: "Default environment variables for sandbox commands"
|
|
11814
11877
|
}),
|
|
11815
|
-
tags: import_cjs$
|
|
11878
|
+
tags: import_cjs$17.multioption({
|
|
11816
11879
|
long: "tag",
|
|
11817
11880
|
short: "t",
|
|
11818
11881
|
type: ObjectFromKeyValue,
|
|
11819
11882
|
description: "Key-value tags to associate with the sandbox (e.g. --tag env=staging)"
|
|
11820
11883
|
}),
|
|
11884
|
+
mounts,
|
|
11821
11885
|
...snapshotRetentionArgs,
|
|
11822
11886
|
...networkPolicyArgs,
|
|
11823
11887
|
scope
|
|
11824
11888
|
};
|
|
11825
|
-
const create = import_cjs$
|
|
11889
|
+
const create = import_cjs$17.command({
|
|
11826
11890
|
name: "create",
|
|
11827
11891
|
description: "Create a sandbox in the specified account and project.",
|
|
11828
11892
|
args: args$3,
|
|
@@ -11830,7 +11894,7 @@ const create = import_cjs$15.command({
|
|
|
11830
11894
|
description: "Create and connect to a sandbox without a network access",
|
|
11831
11895
|
command: `sandbox run --network-policy=none --connect`
|
|
11832
11896
|
}],
|
|
11833
|
-
async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$2, envVars, tags, snapshotExpiration: snapshotExpiration$1, keepLastSnapshots: keepLastSnapshots$1, keepLastSnapshotsFor: keepLastSnapshotsFor$1, deleteEvictedSnapshots: deleteEvictedSnapshots$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
|
|
11897
|
+
async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$2, envVars, tags, mounts: mounts$1, snapshotExpiration: snapshotExpiration$1, keepLastSnapshots: keepLastSnapshots$1, keepLastSnapshotsFor: keepLastSnapshotsFor$1, deleteEvictedSnapshots: deleteEvictedSnapshots$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
|
|
11834
11898
|
const networkPolicy$1 = buildNetworkPolicy({
|
|
11835
11899
|
networkPolicy: networkPolicyMode$1,
|
|
11836
11900
|
allowedDomains: allowedDomains$1,
|
|
@@ -11845,6 +11909,7 @@ const create = import_cjs$15.command({
|
|
|
11845
11909
|
const persistent = !nonPersistent;
|
|
11846
11910
|
const resources = vcpus$1 ? { vcpus: vcpus$1 } : void 0;
|
|
11847
11911
|
const tagsObj = Object.keys(tags).length > 0 ? tags : void 0;
|
|
11912
|
+
const mountsObj = Object.keys(mounts$1).length > 0 ? mounts$1 : void 0;
|
|
11848
11913
|
const spinner = silent ? void 0 : ora("Creating sandbox...").start();
|
|
11849
11914
|
const sandbox = snapshot$1 ? await sandboxClient.create({
|
|
11850
11915
|
name,
|
|
@@ -11861,6 +11926,7 @@ const create = import_cjs$15.command({
|
|
|
11861
11926
|
networkPolicy: networkPolicy$1,
|
|
11862
11927
|
env: envVars,
|
|
11863
11928
|
tags: tagsObj,
|
|
11929
|
+
mounts: mountsObj,
|
|
11864
11930
|
persistent,
|
|
11865
11931
|
snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
|
|
11866
11932
|
keepLastSnapshots: keepLastSnapshotsPayload,
|
|
@@ -11877,6 +11943,7 @@ const create = import_cjs$15.command({
|
|
|
11877
11943
|
networkPolicy: networkPolicy$1,
|
|
11878
11944
|
env: envVars,
|
|
11879
11945
|
tags: tagsObj,
|
|
11946
|
+
mounts: mountsObj,
|
|
11880
11947
|
persistent,
|
|
11881
11948
|
snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
|
|
11882
11949
|
keepLastSnapshots: keepLastSnapshotsPayload,
|
|
@@ -11912,46 +11979,46 @@ const create = import_cjs$15.command({
|
|
|
11912
11979
|
|
|
11913
11980
|
//#endregion
|
|
11914
11981
|
//#region src/commands/fork.ts
|
|
11915
|
-
var import_cjs$
|
|
11982
|
+
var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11916
11983
|
var import_ms$2 = /* @__PURE__ */ __toESM(require_ms());
|
|
11917
11984
|
init_source();
|
|
11918
11985
|
const args$2 = {
|
|
11919
|
-
source: import_cjs$
|
|
11986
|
+
source: import_cjs$16.positional({
|
|
11920
11987
|
displayName: "source",
|
|
11921
11988
|
description: "Name of the source sandbox to fork from.",
|
|
11922
11989
|
type: sandboxName
|
|
11923
11990
|
}),
|
|
11924
|
-
name: import_cjs$
|
|
11991
|
+
name: import_cjs$16.option({
|
|
11925
11992
|
long: "name",
|
|
11926
11993
|
description: "A user-chosen name for the forked sandbox. Must be unique per project.",
|
|
11927
|
-
type: import_cjs$
|
|
11994
|
+
type: import_cjs$16.optional(import_cjs$16.string)
|
|
11928
11995
|
}),
|
|
11929
|
-
nonPersistent: import_cjs$
|
|
11996
|
+
nonPersistent: import_cjs$16.flag({
|
|
11930
11997
|
long: "non-persistent",
|
|
11931
11998
|
description: "Disable automatic restore of the filesystem between sessions."
|
|
11932
11999
|
}),
|
|
11933
|
-
timeout: import_cjs$
|
|
12000
|
+
timeout: import_cjs$16.option({
|
|
11934
12001
|
long: "timeout",
|
|
11935
|
-
type: import_cjs$
|
|
12002
|
+
type: import_cjs$16.optional(Duration),
|
|
11936
12003
|
description: "Override the maximum sandbox runtime (inherited from source if omitted). Example: 5m, 30m"
|
|
11937
12004
|
}),
|
|
11938
12005
|
vcpus,
|
|
11939
12006
|
ports: publishPorts,
|
|
11940
|
-
silent: import_cjs$
|
|
12007
|
+
silent: import_cjs$16.flag({
|
|
11941
12008
|
long: "silent",
|
|
11942
12009
|
description: "Don't write sandbox name to stdout"
|
|
11943
12010
|
}),
|
|
11944
|
-
connect: import_cjs$
|
|
12011
|
+
connect: import_cjs$16.flag({
|
|
11945
12012
|
long: "connect",
|
|
11946
12013
|
description: "Start an interactive shell session after creating the forked sandbox"
|
|
11947
12014
|
}),
|
|
11948
|
-
envVars: import_cjs$
|
|
12015
|
+
envVars: import_cjs$16.multioption({
|
|
11949
12016
|
long: "env",
|
|
11950
12017
|
short: "e",
|
|
11951
12018
|
type: ObjectFromKeyValue,
|
|
11952
12019
|
description: "Environment variables to set on the fork. Env vars from the source sandbox are not copied (encrypted server-side)."
|
|
11953
12020
|
}),
|
|
11954
|
-
tags: import_cjs$
|
|
12021
|
+
tags: import_cjs$16.multioption({
|
|
11955
12022
|
long: "tag",
|
|
11956
12023
|
short: "t",
|
|
11957
12024
|
type: ObjectFromKeyValue,
|
|
@@ -11961,7 +12028,7 @@ const args$2 = {
|
|
|
11961
12028
|
...networkPolicyArgs,
|
|
11962
12029
|
scope
|
|
11963
12030
|
};
|
|
11964
|
-
const fork = import_cjs$
|
|
12031
|
+
const fork = import_cjs$16.command({
|
|
11965
12032
|
name: "fork",
|
|
11966
12033
|
description: "Fork an existing sandbox into a new one. Copies config (cpu, timeout, network policy, tags, etc.) from the source sandbox; env vars are NOT copied and must be re-supplied via --env.",
|
|
11967
12034
|
args: args$2,
|
|
@@ -12042,20 +12109,20 @@ function omit(obj, ...keys) {
|
|
|
12042
12109
|
|
|
12043
12110
|
//#endregion
|
|
12044
12111
|
//#region src/commands/run.ts
|
|
12045
|
-
var import_cjs$
|
|
12112
|
+
var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
|
|
12046
12113
|
const args$1 = {
|
|
12047
12114
|
...args$3,
|
|
12048
12115
|
...omit(args$4, "sandbox", "timeout"),
|
|
12049
|
-
removeAfterUse: import_cjs$
|
|
12116
|
+
removeAfterUse: import_cjs$15.flag({
|
|
12050
12117
|
long: "rm",
|
|
12051
12118
|
description: "Automatically remove the sandbox when the command exits."
|
|
12052
12119
|
}),
|
|
12053
|
-
stopAfterUse: import_cjs$
|
|
12120
|
+
stopAfterUse: import_cjs$15.flag({
|
|
12054
12121
|
long: "stop",
|
|
12055
12122
|
description: "Stop the sandbox when the command exits."
|
|
12056
12123
|
})
|
|
12057
12124
|
};
|
|
12058
|
-
const run = import_cjs$
|
|
12125
|
+
const run = import_cjs$15.command({
|
|
12059
12126
|
name: "run",
|
|
12060
12127
|
description: "Create and run a command in a sandbox",
|
|
12061
12128
|
args: args$1,
|
|
@@ -12097,51 +12164,51 @@ const run = import_cjs$13.command({
|
|
|
12097
12164
|
|
|
12098
12165
|
//#endregion
|
|
12099
12166
|
//#region src/commands/list.ts
|
|
12100
|
-
var import_cjs$
|
|
12167
|
+
var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
|
|
12101
12168
|
init_source();
|
|
12102
|
-
const list = import_cjs$
|
|
12169
|
+
const list = import_cjs$14.command({
|
|
12103
12170
|
name: "list",
|
|
12104
12171
|
aliases: ["ls"],
|
|
12105
12172
|
description: "List all sandboxes for the specified account and project.",
|
|
12106
12173
|
args: {
|
|
12107
|
-
all: import_cjs$
|
|
12174
|
+
all: import_cjs$14.flag({
|
|
12108
12175
|
long: "all",
|
|
12109
12176
|
short: "a",
|
|
12110
12177
|
description: "Show all sandboxes (default shows just running)"
|
|
12111
12178
|
}),
|
|
12112
|
-
namePrefix: import_cjs$
|
|
12179
|
+
namePrefix: import_cjs$14.option({
|
|
12113
12180
|
long: "name-prefix",
|
|
12114
12181
|
description: "Filter sandboxes by name prefix",
|
|
12115
|
-
type: import_cjs$
|
|
12182
|
+
type: import_cjs$14.optional(import_cjs$14.string)
|
|
12116
12183
|
}),
|
|
12117
|
-
sortBy: import_cjs$
|
|
12184
|
+
sortBy: import_cjs$14.option({
|
|
12118
12185
|
long: "sort-by",
|
|
12119
12186
|
description: "Sort sandboxes by field. Options: createdAt (default), name, statusUpdatedAt",
|
|
12120
|
-
type: import_cjs$
|
|
12187
|
+
type: import_cjs$14.optional(import_cjs$14.oneOf([
|
|
12121
12188
|
"createdAt",
|
|
12122
12189
|
"name",
|
|
12123
12190
|
"statusUpdatedAt"
|
|
12124
12191
|
]))
|
|
12125
12192
|
}),
|
|
12126
|
-
sortOrder: import_cjs$
|
|
12193
|
+
sortOrder: import_cjs$14.option({
|
|
12127
12194
|
long: "sort-order",
|
|
12128
12195
|
description: "Sort order. Options: asc, desc (default)",
|
|
12129
|
-
type: import_cjs$
|
|
12196
|
+
type: import_cjs$14.optional(import_cjs$14.oneOf(["asc", "desc"]))
|
|
12130
12197
|
}),
|
|
12131
|
-
tags: import_cjs$
|
|
12198
|
+
tags: import_cjs$14.multioption({
|
|
12132
12199
|
long: "tag",
|
|
12133
12200
|
description: "Filter sandboxes by tag. Format: \"key=value\"",
|
|
12134
12201
|
type: ObjectFromKeyValue
|
|
12135
12202
|
}),
|
|
12136
|
-
limit: import_cjs$
|
|
12203
|
+
limit: import_cjs$14.option({
|
|
12137
12204
|
long: "limit",
|
|
12138
12205
|
description: "Maximum number of sandboxes per page (default 50).",
|
|
12139
|
-
type: import_cjs$
|
|
12206
|
+
type: import_cjs$14.optional(import_cjs$14.number)
|
|
12140
12207
|
}),
|
|
12141
|
-
cursor: import_cjs$
|
|
12208
|
+
cursor: import_cjs$14.option({
|
|
12142
12209
|
long: "cursor",
|
|
12143
12210
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
12144
|
-
type: import_cjs$
|
|
12211
|
+
type: import_cjs$14.optional(import_cjs$14.string)
|
|
12145
12212
|
}),
|
|
12146
12213
|
scope
|
|
12147
12214
|
},
|
|
@@ -12191,6 +12258,7 @@ const list = import_cjs$12.command({
|
|
|
12191
12258
|
RUNTIME: { value: (s$1) => s$1.runtime ?? "-" },
|
|
12192
12259
|
TIMEOUT: { value: (s$1) => s$1.timeout != null ? timeAgo(s$1.createdAt + s$1.timeout) : "-" },
|
|
12193
12260
|
SNAPSHOT: { value: (s$1) => s$1.currentSnapshotId ?? "-" },
|
|
12261
|
+
MOUNTS: { value: (s$1) => formatMounts(s$1.mounts) },
|
|
12194
12262
|
TAGS: { value: (s$1) => s$1.tags && Object.keys(s$1.tags).length > 0 ? Object.entries(s$1.tags).map(([k, v]) => `${k}:${v}`).join(", ") : "-" }
|
|
12195
12263
|
};
|
|
12196
12264
|
if (all) {
|
|
@@ -12213,11 +12281,15 @@ const SandboxStatusColor = {
|
|
|
12213
12281
|
snapshotting: source_default.blue,
|
|
12214
12282
|
aborted: source_default.gray.dim
|
|
12215
12283
|
};
|
|
12284
|
+
function formatMounts(mounts$1) {
|
|
12285
|
+
if (!mounts$1 || Object.keys(mounts$1).length === 0) return "-";
|
|
12286
|
+
return Object.entries(mounts$1).map(([path$1, mount]) => `${mount.drive}:${path$1}:${mount.mode ?? "read-write"}`).join(", ");
|
|
12287
|
+
}
|
|
12216
12288
|
|
|
12217
12289
|
//#endregion
|
|
12218
12290
|
//#region src/commands/connect.ts
|
|
12219
|
-
var import_cjs$
|
|
12220
|
-
const connect = import_cjs$
|
|
12291
|
+
var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
|
|
12292
|
+
const connect = import_cjs$13.command({
|
|
12221
12293
|
name: "connect",
|
|
12222
12294
|
aliases: ["ssh", "shell"],
|
|
12223
12295
|
description: "Start an interactive shell in an existing sandbox",
|
|
@@ -12235,7 +12307,7 @@ const connect = import_cjs$11.command({
|
|
|
12235
12307
|
|
|
12236
12308
|
//#endregion
|
|
12237
12309
|
//#region src/commands/stop.ts
|
|
12238
|
-
var import_cjs$
|
|
12310
|
+
var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
|
|
12239
12311
|
init_source();
|
|
12240
12312
|
function c(label, value) {
|
|
12241
12313
|
return {
|
|
@@ -12288,15 +12360,15 @@ function printStopResult(name, sandbox, sessionSnapshot) {
|
|
|
12288
12360
|
]] : []
|
|
12289
12361
|
]);
|
|
12290
12362
|
}
|
|
12291
|
-
const stop = import_cjs$
|
|
12363
|
+
const stop = import_cjs$12.command({
|
|
12292
12364
|
name: "stop",
|
|
12293
12365
|
description: "Stop the current session of one or more sandboxes",
|
|
12294
12366
|
args: {
|
|
12295
|
-
sandboxName: import_cjs$
|
|
12367
|
+
sandboxName: import_cjs$12.positional({
|
|
12296
12368
|
type: sandboxName,
|
|
12297
12369
|
description: "A sandbox name to stop"
|
|
12298
12370
|
}),
|
|
12299
|
-
sandboxNames: import_cjs$
|
|
12371
|
+
sandboxNames: import_cjs$12.restPositionals({
|
|
12300
12372
|
type: sandboxName,
|
|
12301
12373
|
description: "More sandboxes to stop"
|
|
12302
12374
|
}),
|
|
@@ -14618,17 +14690,17 @@ var Listr = class {
|
|
|
14618
14690
|
|
|
14619
14691
|
//#endregion
|
|
14620
14692
|
//#region src/commands/remove.ts
|
|
14621
|
-
var import_cjs$
|
|
14622
|
-
const remove = import_cjs$
|
|
14693
|
+
var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14694
|
+
const remove = import_cjs$11.command({
|
|
14623
14695
|
name: "remove",
|
|
14624
14696
|
aliases: ["rm"],
|
|
14625
14697
|
description: "Permanently remove one or more sandboxes",
|
|
14626
14698
|
args: {
|
|
14627
|
-
sandboxName: import_cjs$
|
|
14699
|
+
sandboxName: import_cjs$11.positional({
|
|
14628
14700
|
type: sandboxName,
|
|
14629
14701
|
description: "a sandbox name to remove"
|
|
14630
14702
|
}),
|
|
14631
|
-
sandboxNames: import_cjs$
|
|
14703
|
+
sandboxNames: import_cjs$11.restPositionals({
|
|
14632
14704
|
type: sandboxName,
|
|
14633
14705
|
description: "more sandboxes to remove"
|
|
14634
14706
|
}),
|
|
@@ -14656,7 +14728,7 @@ const remove = import_cjs$9.command({
|
|
|
14656
14728
|
|
|
14657
14729
|
//#endregion
|
|
14658
14730
|
//#region src/commands/cp.ts
|
|
14659
|
-
var import_cjs$
|
|
14731
|
+
var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14660
14732
|
init_source();
|
|
14661
14733
|
const parseLocalOrRemotePath = async (input) => {
|
|
14662
14734
|
const parts = input.split(":");
|
|
@@ -14678,18 +14750,18 @@ const parseLocalOrRemotePath = async (input) => {
|
|
|
14678
14750
|
path: input
|
|
14679
14751
|
};
|
|
14680
14752
|
};
|
|
14681
|
-
const localOrRemote = import_cjs$
|
|
14682
|
-
const cp = import_cjs$
|
|
14753
|
+
const localOrRemote = import_cjs$10.extendType(import_cjs$10.string, { from: parseLocalOrRemotePath });
|
|
14754
|
+
const cp = import_cjs$10.command({
|
|
14683
14755
|
name: "copy",
|
|
14684
14756
|
description: "Copy files between your local filesystem and a remote sandbox",
|
|
14685
14757
|
aliases: ["cp"],
|
|
14686
14758
|
args: {
|
|
14687
|
-
source: import_cjs$
|
|
14759
|
+
source: import_cjs$10.positional({
|
|
14688
14760
|
displayName: `src`,
|
|
14689
14761
|
description: `The source file to copy from local file system, or a sandbox_name:path from a remote sandbox`,
|
|
14690
14762
|
type: localOrRemote
|
|
14691
14763
|
}),
|
|
14692
|
-
dest: import_cjs$
|
|
14764
|
+
dest: import_cjs$10.positional({
|
|
14693
14765
|
displayName: `dst`,
|
|
14694
14766
|
description: `The destination file to copy to local file system, or a sandbox_name:path to a remote sandbox`,
|
|
14695
14767
|
type: localOrRemote
|
|
@@ -14736,10 +14808,10 @@ const cp = import_cjs$8.command({
|
|
|
14736
14808
|
|
|
14737
14809
|
//#endregion
|
|
14738
14810
|
//#region src/commands/logout.ts
|
|
14739
|
-
var import_cjs$
|
|
14811
|
+
var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14740
14812
|
init_source();
|
|
14741
14813
|
const debug = createDebugger("sandbox:logout");
|
|
14742
|
-
const logout = import_cjs$
|
|
14814
|
+
const logout = import_cjs$9.command({
|
|
14743
14815
|
name: "logout",
|
|
14744
14816
|
description: "Log out of the Sandbox CLI",
|
|
14745
14817
|
args: {},
|
|
@@ -14758,27 +14830,27 @@ const logout = import_cjs$7.command({
|
|
|
14758
14830
|
|
|
14759
14831
|
//#endregion
|
|
14760
14832
|
//#region src/commands/snapshot.ts
|
|
14761
|
-
var import_cjs$
|
|
14833
|
+
var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14762
14834
|
init_source();
|
|
14763
14835
|
var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
|
|
14764
14836
|
const args = {
|
|
14765
|
-
stop: import_cjs$
|
|
14837
|
+
stop: import_cjs$8.flag({
|
|
14766
14838
|
long: "stop",
|
|
14767
14839
|
description: "Confirm that the sandbox will be stopped when snapshotting"
|
|
14768
14840
|
}),
|
|
14769
|
-
silent: import_cjs$
|
|
14841
|
+
silent: import_cjs$8.flag({
|
|
14770
14842
|
long: "silent",
|
|
14771
14843
|
description: "Don't write snapshot ID to stdout"
|
|
14772
14844
|
}),
|
|
14773
|
-
expiration: import_cjs$
|
|
14845
|
+
expiration: import_cjs$8.option({
|
|
14774
14846
|
long: "expiration",
|
|
14775
|
-
type: import_cjs$
|
|
14847
|
+
type: import_cjs$8.optional(Duration),
|
|
14776
14848
|
description: "The expiration time of the snapshot. Use 0 for no expiration."
|
|
14777
14849
|
}),
|
|
14778
|
-
sandbox: import_cjs$
|
|
14850
|
+
sandbox: import_cjs$8.positional({ type: sandboxName }),
|
|
14779
14851
|
scope
|
|
14780
14852
|
};
|
|
14781
|
-
const snapshot = import_cjs$
|
|
14853
|
+
const snapshot = import_cjs$8.command({
|
|
14782
14854
|
name: "snapshot",
|
|
14783
14855
|
description: "Take a snapshot of the filesystem of a sandbox",
|
|
14784
14856
|
args,
|
|
@@ -14881,34 +14953,34 @@ function renderSnapshotTree(params) {
|
|
|
14881
14953
|
|
|
14882
14954
|
//#endregion
|
|
14883
14955
|
//#region src/commands/snapshots.ts
|
|
14884
|
-
var import_cjs$
|
|
14885
|
-
var import_cjs$
|
|
14956
|
+
var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14957
|
+
var import_cjs$7 = require_cjs();
|
|
14886
14958
|
init_source();
|
|
14887
|
-
const list$
|
|
14959
|
+
const list$3 = import_cjs$6.command({
|
|
14888
14960
|
name: "list",
|
|
14889
14961
|
aliases: ["ls"],
|
|
14890
14962
|
description: "List snapshots for the specified account and project.",
|
|
14891
14963
|
args: {
|
|
14892
14964
|
scope,
|
|
14893
|
-
name: import_cjs$
|
|
14894
|
-
type: import_cjs$
|
|
14965
|
+
name: import_cjs$6.option({
|
|
14966
|
+
type: import_cjs$6.optional(sandboxName),
|
|
14895
14967
|
long: "name",
|
|
14896
14968
|
description: "Filter snapshots by sandbox."
|
|
14897
14969
|
}),
|
|
14898
|
-
sortOrder: import_cjs$
|
|
14970
|
+
sortOrder: import_cjs$6.option({
|
|
14899
14971
|
long: "sort-order",
|
|
14900
14972
|
description: "Sort order. Options: asc, desc (default)",
|
|
14901
|
-
type: import_cjs$
|
|
14973
|
+
type: import_cjs$6.optional(import_cjs$6.oneOf(["asc", "desc"]))
|
|
14902
14974
|
}),
|
|
14903
|
-
limit: import_cjs$
|
|
14975
|
+
limit: import_cjs$6.option({
|
|
14904
14976
|
long: "limit",
|
|
14905
14977
|
description: "Maximum number of snapshots per page (default 50).",
|
|
14906
|
-
type: import_cjs$
|
|
14978
|
+
type: import_cjs$6.optional(import_cjs$6.number)
|
|
14907
14979
|
}),
|
|
14908
|
-
cursor: import_cjs$
|
|
14980
|
+
cursor: import_cjs$6.option({
|
|
14909
14981
|
long: "cursor",
|
|
14910
14982
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
14911
|
-
type: import_cjs$
|
|
14983
|
+
type: import_cjs$6.optional(import_cjs$6.string)
|
|
14912
14984
|
})
|
|
14913
14985
|
},
|
|
14914
14986
|
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, sortOrder, limit, cursor }) {
|
|
@@ -14948,12 +15020,12 @@ const list$2 = import_cjs$4.command({
|
|
|
14948
15020
|
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
14949
15021
|
}
|
|
14950
15022
|
});
|
|
14951
|
-
const get = import_cjs$
|
|
15023
|
+
const get = import_cjs$6.command({
|
|
14952
15024
|
name: "get",
|
|
14953
15025
|
description: "Get details of a snapshot.",
|
|
14954
15026
|
args: {
|
|
14955
15027
|
scope,
|
|
14956
|
-
snapshotId: import_cjs$
|
|
15028
|
+
snapshotId: import_cjs$6.positional({
|
|
14957
15029
|
type: snapshotId,
|
|
14958
15030
|
description: "Snapshot ID to retrieve"
|
|
14959
15031
|
})
|
|
@@ -14991,16 +15063,16 @@ const get = import_cjs$4.command({
|
|
|
14991
15063
|
}));
|
|
14992
15064
|
}
|
|
14993
15065
|
});
|
|
14994
|
-
const remove$
|
|
15066
|
+
const remove$2 = import_cjs$6.command({
|
|
14995
15067
|
name: "delete",
|
|
14996
15068
|
aliases: ["rm", "remove"],
|
|
14997
15069
|
description: "Delete one or more snapshots.",
|
|
14998
15070
|
args: {
|
|
14999
|
-
snapshotId: import_cjs$
|
|
15071
|
+
snapshotId: import_cjs$6.positional({
|
|
15000
15072
|
type: snapshotId,
|
|
15001
15073
|
description: "Snapshot ID to delete"
|
|
15002
15074
|
}),
|
|
15003
|
-
snapshotIds: import_cjs$
|
|
15075
|
+
snapshotIds: import_cjs$6.restPositionals({
|
|
15004
15076
|
type: snapshotId,
|
|
15005
15077
|
description: "More snapshots IDs to delete"
|
|
15006
15078
|
}),
|
|
@@ -15029,29 +15101,29 @@ const remove$1 = import_cjs$4.command({
|
|
|
15029
15101
|
}
|
|
15030
15102
|
}
|
|
15031
15103
|
});
|
|
15032
|
-
const tree = import_cjs$
|
|
15104
|
+
const tree = import_cjs$6.command({
|
|
15033
15105
|
name: "tree",
|
|
15034
15106
|
description: "Show the snapshot ancestry tree for a sandbox.",
|
|
15035
15107
|
args: {
|
|
15036
15108
|
scope,
|
|
15037
|
-
sandboxName: import_cjs$
|
|
15109
|
+
sandboxName: import_cjs$6.positional({
|
|
15038
15110
|
type: sandboxName,
|
|
15039
15111
|
description: "Sandbox name"
|
|
15040
15112
|
}),
|
|
15041
|
-
sortOrder: import_cjs$
|
|
15113
|
+
sortOrder: import_cjs$6.option({
|
|
15042
15114
|
long: "sort-order",
|
|
15043
15115
|
description: "Sort order. Options: asc, desc (default). 'desc' walks ancestors, 'asc' walks descendants. Requires --cursor.",
|
|
15044
|
-
type: import_cjs$
|
|
15116
|
+
type: import_cjs$6.optional(import_cjs$6.oneOf(["asc", "desc"]))
|
|
15045
15117
|
}),
|
|
15046
|
-
limit: import_cjs$
|
|
15118
|
+
limit: import_cjs$6.option({
|
|
15047
15119
|
long: "limit",
|
|
15048
15120
|
description: "Maximum number of snapshots per page (1–10, default 10).",
|
|
15049
|
-
type: import_cjs$
|
|
15121
|
+
type: import_cjs$6.optional(import_cjs$6.number)
|
|
15050
15122
|
}),
|
|
15051
|
-
cursor: import_cjs$
|
|
15123
|
+
cursor: import_cjs$6.option({
|
|
15052
15124
|
long: "cursor",
|
|
15053
15125
|
description: "Pagination cursor from a previous 'More ancestors' or 'More descendants' hint.",
|
|
15054
|
-
type: import_cjs$
|
|
15126
|
+
type: import_cjs$6.optional(import_cjs$6.string)
|
|
15055
15127
|
})
|
|
15056
15128
|
},
|
|
15057
15129
|
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxName: name, sortOrder, limit, cursor }) {
|
|
@@ -15172,14 +15244,14 @@ const tree = import_cjs$4.command({
|
|
|
15172
15244
|
if (result.descendants.pagination.next !== null) console.log(`More descendants: sandbox snapshots tree ${name} --sort-order asc${limitArg} --cursor ${result.descendants.pagination.next}`);
|
|
15173
15245
|
}
|
|
15174
15246
|
});
|
|
15175
|
-
const snapshots = (0, import_cjs$
|
|
15247
|
+
const snapshots = (0, import_cjs$7.subcommands)({
|
|
15176
15248
|
name: "snapshots",
|
|
15177
15249
|
description: "Manage sandbox snapshots",
|
|
15178
15250
|
cmds: {
|
|
15179
|
-
list: list$
|
|
15251
|
+
list: list$3,
|
|
15180
15252
|
get,
|
|
15181
15253
|
tree,
|
|
15182
|
-
delete: remove$
|
|
15254
|
+
delete: remove$2
|
|
15183
15255
|
}
|
|
15184
15256
|
});
|
|
15185
15257
|
const SnapshotStatusColor = new Map([
|
|
@@ -15190,37 +15262,37 @@ const SnapshotStatusColor = new Map([
|
|
|
15190
15262
|
|
|
15191
15263
|
//#endregion
|
|
15192
15264
|
//#region src/commands/sessions.ts
|
|
15193
|
-
var import_cjs$
|
|
15194
|
-
var import_cjs$
|
|
15265
|
+
var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
|
|
15266
|
+
var import_cjs$5 = require_cjs();
|
|
15195
15267
|
init_source();
|
|
15196
|
-
const list$
|
|
15268
|
+
const list$2 = import_cjs$4.command({
|
|
15197
15269
|
name: "list",
|
|
15198
15270
|
aliases: ["ls"],
|
|
15199
15271
|
description: "List sessions from a sandbox",
|
|
15200
15272
|
args: {
|
|
15201
|
-
all: import_cjs$
|
|
15273
|
+
all: import_cjs$4.flag({
|
|
15202
15274
|
long: "all",
|
|
15203
15275
|
short: "a",
|
|
15204
15276
|
description: "Show all sessions (default shows just running)"
|
|
15205
15277
|
}),
|
|
15206
|
-
sandbox: import_cjs$
|
|
15278
|
+
sandbox: import_cjs$4.positional({
|
|
15207
15279
|
type: sandboxName,
|
|
15208
15280
|
description: "Sandbox name to list sessions for"
|
|
15209
15281
|
}),
|
|
15210
|
-
sortOrder: import_cjs$
|
|
15282
|
+
sortOrder: import_cjs$4.option({
|
|
15211
15283
|
long: "sort-order",
|
|
15212
15284
|
description: "Sort order. Options: asc, desc (default)",
|
|
15213
|
-
type: import_cjs$
|
|
15285
|
+
type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
|
|
15214
15286
|
}),
|
|
15215
|
-
limit: import_cjs$
|
|
15287
|
+
limit: import_cjs$4.option({
|
|
15216
15288
|
long: "limit",
|
|
15217
15289
|
description: "Maximum number of sessions per page (default 50).",
|
|
15218
|
-
type: import_cjs$
|
|
15290
|
+
type: import_cjs$4.optional(import_cjs$4.number)
|
|
15219
15291
|
}),
|
|
15220
|
-
cursor: import_cjs$
|
|
15292
|
+
cursor: import_cjs$4.option({
|
|
15221
15293
|
long: "cursor",
|
|
15222
15294
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
15223
|
-
type: import_cjs$
|
|
15295
|
+
type: import_cjs$4.optional(import_cjs$4.string)
|
|
15224
15296
|
}),
|
|
15225
15297
|
scope
|
|
15226
15298
|
},
|
|
@@ -15276,10 +15348,10 @@ const list$1 = import_cjs$2.command({
|
|
|
15276
15348
|
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
15277
15349
|
}
|
|
15278
15350
|
});
|
|
15279
|
-
const sessions = (0, import_cjs$
|
|
15351
|
+
const sessions = (0, import_cjs$5.subcommands)({
|
|
15280
15352
|
name: "sessions",
|
|
15281
15353
|
description: "Manage sandbox sessions",
|
|
15282
|
-
cmds: { list: list$
|
|
15354
|
+
cmds: { list: list$2 }
|
|
15283
15355
|
});
|
|
15284
15356
|
const SessionStatusColor = {
|
|
15285
15357
|
running: source_default.cyan,
|
|
@@ -15293,18 +15365,18 @@ const SessionStatusColor = {
|
|
|
15293
15365
|
|
|
15294
15366
|
//#endregion
|
|
15295
15367
|
//#region src/commands/config.ts
|
|
15296
|
-
var import_cjs$
|
|
15368
|
+
var import_cjs$3 = /* @__PURE__ */ __toESM(require_cjs());
|
|
15297
15369
|
init_source();
|
|
15298
15370
|
var import_ms = /* @__PURE__ */ __toESM(require_ms());
|
|
15299
|
-
const vcpusCommand = import_cjs$
|
|
15371
|
+
const vcpusCommand = import_cjs$3.command({
|
|
15300
15372
|
name: "vcpus",
|
|
15301
15373
|
description: "Update the vCPU count of a sandbox",
|
|
15302
15374
|
args: {
|
|
15303
|
-
sandbox: import_cjs$
|
|
15375
|
+
sandbox: import_cjs$3.positional({
|
|
15304
15376
|
type: sandboxName,
|
|
15305
15377
|
description: "Sandbox name to update"
|
|
15306
15378
|
}),
|
|
15307
|
-
count: import_cjs$
|
|
15379
|
+
count: import_cjs$3.positional({
|
|
15308
15380
|
type: vcpusType,
|
|
15309
15381
|
description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
|
|
15310
15382
|
}),
|
|
@@ -15329,15 +15401,15 @@ const vcpusCommand = import_cjs$1.command({
|
|
|
15329
15401
|
}
|
|
15330
15402
|
}
|
|
15331
15403
|
});
|
|
15332
|
-
const timeoutCommand = import_cjs$
|
|
15404
|
+
const timeoutCommand = import_cjs$3.command({
|
|
15333
15405
|
name: "timeout",
|
|
15334
15406
|
description: "Update the timeout of a sandbox (will be applied to all new sessions)",
|
|
15335
15407
|
args: {
|
|
15336
|
-
sandbox: import_cjs$
|
|
15408
|
+
sandbox: import_cjs$3.positional({
|
|
15337
15409
|
type: sandboxName,
|
|
15338
15410
|
description: "Sandbox name to update"
|
|
15339
15411
|
}),
|
|
15340
|
-
duration: import_cjs$
|
|
15412
|
+
duration: import_cjs$3.positional({
|
|
15341
15413
|
type: Duration,
|
|
15342
15414
|
description: "The maximum duration a sandbox can run for. Example: 5m, 1h"
|
|
15343
15415
|
}),
|
|
@@ -15362,17 +15434,17 @@ const timeoutCommand = import_cjs$1.command({
|
|
|
15362
15434
|
}
|
|
15363
15435
|
}
|
|
15364
15436
|
});
|
|
15365
|
-
const persistentCommand = import_cjs$
|
|
15437
|
+
const persistentCommand = import_cjs$3.command({
|
|
15366
15438
|
name: "persistent",
|
|
15367
15439
|
description: "Enable or disable automatic restore of the filesystem between sessions",
|
|
15368
15440
|
args: {
|
|
15369
|
-
sandbox: import_cjs$
|
|
15441
|
+
sandbox: import_cjs$3.positional({
|
|
15370
15442
|
type: sandboxName,
|
|
15371
15443
|
description: "Sandbox name to update"
|
|
15372
15444
|
}),
|
|
15373
|
-
value: import_cjs$
|
|
15445
|
+
value: import_cjs$3.positional({
|
|
15374
15446
|
type: {
|
|
15375
|
-
...import_cjs$
|
|
15447
|
+
...import_cjs$3.oneOf(["true", "false"]),
|
|
15376
15448
|
displayName: "true|false"
|
|
15377
15449
|
},
|
|
15378
15450
|
description: "Enable or disable automatic restore of the filesystem between sessions"
|
|
@@ -15398,15 +15470,15 @@ const persistentCommand = import_cjs$1.command({
|
|
|
15398
15470
|
}
|
|
15399
15471
|
}
|
|
15400
15472
|
});
|
|
15401
|
-
const snapshotExpirationCommand = import_cjs$
|
|
15473
|
+
const snapshotExpirationCommand = import_cjs$3.command({
|
|
15402
15474
|
name: "snapshot-expiration",
|
|
15403
15475
|
description: "Update the default snapshot expiration of a sandbox",
|
|
15404
15476
|
args: {
|
|
15405
|
-
sandbox: import_cjs$
|
|
15477
|
+
sandbox: import_cjs$3.positional({
|
|
15406
15478
|
type: sandboxName,
|
|
15407
15479
|
description: "Sandbox name to update"
|
|
15408
15480
|
}),
|
|
15409
|
-
duration: import_cjs$
|
|
15481
|
+
duration: import_cjs$3.positional({
|
|
15410
15482
|
type: SnapshotExpiration,
|
|
15411
15483
|
description: "Snapshot expiration duration (e.g. 7d, 30d) or \"none\" for no expiration"
|
|
15412
15484
|
}),
|
|
@@ -15432,22 +15504,22 @@ const snapshotExpirationCommand = import_cjs$1.command({
|
|
|
15432
15504
|
}
|
|
15433
15505
|
}
|
|
15434
15506
|
});
|
|
15435
|
-
const keepLastCountType = import_cjs$
|
|
15507
|
+
const keepLastCountType = import_cjs$3.extendType(import_cjs$3.number, {
|
|
15436
15508
|
displayName: "COUNT",
|
|
15437
15509
|
async from(n) {
|
|
15438
15510
|
if (!Number.isInteger(n) || n < 0 || n > 10) throw new Error(`Invalid count: ${n}. Must be an integer between 0 and 10 (0 removes the policy).`);
|
|
15439
15511
|
return n;
|
|
15440
15512
|
}
|
|
15441
15513
|
});
|
|
15442
|
-
const keepLastSnapshotsCommand = import_cjs$
|
|
15514
|
+
const keepLastSnapshotsCommand = import_cjs$3.command({
|
|
15443
15515
|
name: "keep-last-snapshots",
|
|
15444
15516
|
description: "Update the snapshot retention policy (keep only the N most recent snapshots) of a sandbox",
|
|
15445
15517
|
args: {
|
|
15446
|
-
sandbox: import_cjs$
|
|
15518
|
+
sandbox: import_cjs$3.positional({
|
|
15447
15519
|
type: sandboxName,
|
|
15448
15520
|
description: "Sandbox name to update"
|
|
15449
15521
|
}),
|
|
15450
|
-
count: import_cjs$
|
|
15522
|
+
count: import_cjs$3.positional({
|
|
15451
15523
|
type: keepLastCountType,
|
|
15452
15524
|
description: "Number of most recent snapshots to keep (1-10). Pass 0 to remove the policy."
|
|
15453
15525
|
}),
|
|
@@ -15480,15 +15552,15 @@ const keepLastSnapshotsCommand = import_cjs$1.command({
|
|
|
15480
15552
|
}
|
|
15481
15553
|
}
|
|
15482
15554
|
});
|
|
15483
|
-
const keepLastSnapshotsForCommand = import_cjs$
|
|
15555
|
+
const keepLastSnapshotsForCommand = import_cjs$3.command({
|
|
15484
15556
|
name: "keep-last-snapshots-for",
|
|
15485
15557
|
description: "Update the expiration applied to snapshots kept by the retention policy",
|
|
15486
15558
|
args: {
|
|
15487
|
-
sandbox: import_cjs$
|
|
15559
|
+
sandbox: import_cjs$3.positional({
|
|
15488
15560
|
type: sandboxName,
|
|
15489
15561
|
description: "Sandbox name to update"
|
|
15490
15562
|
}),
|
|
15491
|
-
duration: import_cjs$
|
|
15563
|
+
duration: import_cjs$3.positional({
|
|
15492
15564
|
type: SnapshotExpiration,
|
|
15493
15565
|
description: "Expiration for kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
15494
15566
|
}),
|
|
@@ -15520,17 +15592,17 @@ const keepLastSnapshotsForCommand = import_cjs$1.command({
|
|
|
15520
15592
|
}
|
|
15521
15593
|
}
|
|
15522
15594
|
});
|
|
15523
|
-
const deleteEvictedSnapshotsCommand = import_cjs$
|
|
15595
|
+
const deleteEvictedSnapshotsCommand = import_cjs$3.command({
|
|
15524
15596
|
name: "delete-evicted-snapshots",
|
|
15525
15597
|
description: "When \"true\" (the default), snapshots evicted by the keep-last-snapshots policy are deleted immediately; when \"false\", they keep the default expiration.",
|
|
15526
15598
|
args: {
|
|
15527
|
-
sandbox: import_cjs$
|
|
15599
|
+
sandbox: import_cjs$3.positional({
|
|
15528
15600
|
type: sandboxName,
|
|
15529
15601
|
description: "Sandbox name to update"
|
|
15530
15602
|
}),
|
|
15531
|
-
value: import_cjs$
|
|
15603
|
+
value: import_cjs$3.positional({
|
|
15532
15604
|
type: {
|
|
15533
|
-
...import_cjs$
|
|
15605
|
+
...import_cjs$3.oneOf(["true", "false"]),
|
|
15534
15606
|
displayName: "true|false"
|
|
15535
15607
|
},
|
|
15536
15608
|
description: "Whether to delete evicted snapshots immediately (\"true\") or let them keep the default expiration (\"false\")."
|
|
@@ -15562,15 +15634,15 @@ const deleteEvictedSnapshotsCommand = import_cjs$1.command({
|
|
|
15562
15634
|
}
|
|
15563
15635
|
}
|
|
15564
15636
|
});
|
|
15565
|
-
const currentSnapshotCommand = import_cjs$
|
|
15637
|
+
const currentSnapshotCommand = import_cjs$3.command({
|
|
15566
15638
|
name: "current-snapshot",
|
|
15567
15639
|
description: "Update the current snapshot of a sandbox",
|
|
15568
15640
|
args: {
|
|
15569
|
-
sandbox: import_cjs$
|
|
15641
|
+
sandbox: import_cjs$3.positional({
|
|
15570
15642
|
type: sandboxName,
|
|
15571
15643
|
description: "Sandbox name to update"
|
|
15572
15644
|
}),
|
|
15573
|
-
snapshotId: import_cjs$
|
|
15645
|
+
snapshotId: import_cjs$3.positional({
|
|
15574
15646
|
type: snapshotId,
|
|
15575
15647
|
description: "Snapshot ID to set as the current snapshot"
|
|
15576
15648
|
}),
|
|
@@ -15596,11 +15668,11 @@ const currentSnapshotCommand = import_cjs$1.command({
|
|
|
15596
15668
|
}
|
|
15597
15669
|
}
|
|
15598
15670
|
});
|
|
15599
|
-
const portsCommand = import_cjs$
|
|
15671
|
+
const portsCommand = import_cjs$3.command({
|
|
15600
15672
|
name: "ports",
|
|
15601
15673
|
description: "Update the published ports of a sandbox. Replaces all existing published ports.",
|
|
15602
15674
|
args: {
|
|
15603
|
-
sandbox: import_cjs$
|
|
15675
|
+
sandbox: import_cjs$3.positional({
|
|
15604
15676
|
type: sandboxName,
|
|
15605
15677
|
description: "Sandbox name to update"
|
|
15606
15678
|
}),
|
|
@@ -15637,11 +15709,11 @@ const portsCommand = import_cjs$1.command({
|
|
|
15637
15709
|
}
|
|
15638
15710
|
}
|
|
15639
15711
|
});
|
|
15640
|
-
const listCommand = import_cjs$
|
|
15712
|
+
const listCommand = import_cjs$3.command({
|
|
15641
15713
|
name: "list",
|
|
15642
15714
|
description: "Display the current configuration of a sandbox",
|
|
15643
15715
|
args: {
|
|
15644
|
-
sandbox: import_cjs$
|
|
15716
|
+
sandbox: import_cjs$3.positional({
|
|
15645
15717
|
type: sandboxName,
|
|
15646
15718
|
description: "Sandbox name to inspect"
|
|
15647
15719
|
}),
|
|
@@ -15716,16 +15788,16 @@ const listCommand = import_cjs$1.command({
|
|
|
15716
15788
|
}));
|
|
15717
15789
|
}
|
|
15718
15790
|
});
|
|
15719
|
-
const networkPolicyCommand = import_cjs$
|
|
15791
|
+
const networkPolicyCommand = import_cjs$3.command({
|
|
15720
15792
|
name: "network-policy",
|
|
15721
15793
|
description: `Update the network policy of a sandbox`,
|
|
15722
15794
|
args: {
|
|
15723
|
-
sandbox: import_cjs$
|
|
15795
|
+
sandbox: import_cjs$3.positional({ type: sandboxName }),
|
|
15724
15796
|
...networkPolicyArgs,
|
|
15725
|
-
mode: import_cjs$
|
|
15797
|
+
mode: import_cjs$3.option({
|
|
15726
15798
|
long: "mode",
|
|
15727
15799
|
description: `Alias for --network-policy.`,
|
|
15728
|
-
type: import_cjs$
|
|
15800
|
+
type: import_cjs$3.optional(networkPolicyMode)
|
|
15729
15801
|
}),
|
|
15730
15802
|
scope
|
|
15731
15803
|
},
|
|
@@ -15757,15 +15829,15 @@ const networkPolicyCommand = import_cjs$1.command({
|
|
|
15757
15829
|
}
|
|
15758
15830
|
}
|
|
15759
15831
|
});
|
|
15760
|
-
const tagsCommand = import_cjs$
|
|
15832
|
+
const tagsCommand = import_cjs$3.command({
|
|
15761
15833
|
name: "tags",
|
|
15762
15834
|
description: "Update the tags of a sandbox. Replaces all existing tags with the provided tags.",
|
|
15763
15835
|
args: {
|
|
15764
|
-
sandbox: import_cjs$
|
|
15836
|
+
sandbox: import_cjs$3.positional({
|
|
15765
15837
|
type: sandboxName,
|
|
15766
15838
|
description: "Sandbox name to update"
|
|
15767
15839
|
}),
|
|
15768
|
-
tags: import_cjs$
|
|
15840
|
+
tags: import_cjs$3.multioption({
|
|
15769
15841
|
long: "tag",
|
|
15770
15842
|
short: "t",
|
|
15771
15843
|
type: ObjectFromKeyValue,
|
|
@@ -15814,7 +15886,7 @@ function formatPorts(sandbox) {
|
|
|
15814
15886
|
function getPublishedRoutes(sandbox) {
|
|
15815
15887
|
return sandbox.routes.filter((route) => route.port !== sandbox.interactivePort);
|
|
15816
15888
|
}
|
|
15817
|
-
const config = import_cjs$
|
|
15889
|
+
const config = import_cjs$3.subcommands({
|
|
15818
15890
|
name: "config",
|
|
15819
15891
|
description: "View and update sandbox configuration",
|
|
15820
15892
|
cmds: {
|
|
@@ -15833,6 +15905,181 @@ const config = import_cjs$1.subcommands({
|
|
|
15833
15905
|
}
|
|
15834
15906
|
});
|
|
15835
15907
|
|
|
15908
|
+
//#endregion
|
|
15909
|
+
//#region src/commands/drives.ts
|
|
15910
|
+
var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
|
|
15911
|
+
var import_cjs$2 = require_cjs();
|
|
15912
|
+
init_source();
|
|
15913
|
+
const list$1 = import_cjs$1.command({
|
|
15914
|
+
name: "list",
|
|
15915
|
+
aliases: ["ls"],
|
|
15916
|
+
description: "List drives for the specified account and project.",
|
|
15917
|
+
args: {
|
|
15918
|
+
scope,
|
|
15919
|
+
namePrefix: import_cjs$1.option({
|
|
15920
|
+
long: "name-prefix",
|
|
15921
|
+
description: "Filter drives by name prefix.",
|
|
15922
|
+
type: import_cjs$1.optional(import_cjs$1.string)
|
|
15923
|
+
}),
|
|
15924
|
+
sortOrder: import_cjs$1.option({
|
|
15925
|
+
long: "sort-order",
|
|
15926
|
+
description: "Sort order. Options: asc, desc (default).",
|
|
15927
|
+
type: import_cjs$1.optional(import_cjs$1.oneOf(["asc", "desc"]))
|
|
15928
|
+
}),
|
|
15929
|
+
limit: import_cjs$1.option({
|
|
15930
|
+
long: "limit",
|
|
15931
|
+
description: "Maximum number of drives per page (default 50).",
|
|
15932
|
+
type: import_cjs$1.optional(import_cjs$1.number)
|
|
15933
|
+
}),
|
|
15934
|
+
cursor: import_cjs$1.option({
|
|
15935
|
+
long: "cursor",
|
|
15936
|
+
description: "Pagination cursor from a previous 'More results' hint.",
|
|
15937
|
+
type: import_cjs$1.optional(import_cjs$1.string)
|
|
15938
|
+
})
|
|
15939
|
+
},
|
|
15940
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, namePrefix, sortOrder, limit, cursor }) {
|
|
15941
|
+
const { drives: drives$1, pagination } = await (async () => {
|
|
15942
|
+
try {
|
|
15943
|
+
var _usingCtx$1 = _usingCtx();
|
|
15944
|
+
const _spinner$1 = _usingCtx$1.u(acquireRelease(() => ora("Fetching drives...").start(), (s$1) => s$1.stop()));
|
|
15945
|
+
return driveClient.list({
|
|
15946
|
+
token: token$1,
|
|
15947
|
+
teamId: team$1,
|
|
15948
|
+
projectId: project$1,
|
|
15949
|
+
limit: limit ?? 50,
|
|
15950
|
+
...cursor && { cursor },
|
|
15951
|
+
...namePrefix && {
|
|
15952
|
+
namePrefix,
|
|
15953
|
+
sortBy: "name"
|
|
15954
|
+
},
|
|
15955
|
+
...sortOrder && { sortOrder }
|
|
15956
|
+
});
|
|
15957
|
+
} catch (_) {
|
|
15958
|
+
_usingCtx$1.e = _;
|
|
15959
|
+
} finally {
|
|
15960
|
+
_usingCtx$1.d();
|
|
15961
|
+
}
|
|
15962
|
+
})();
|
|
15963
|
+
printDrives(drives$1);
|
|
15964
|
+
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
15965
|
+
}
|
|
15966
|
+
});
|
|
15967
|
+
const getOrCreate = import_cjs$1.command({
|
|
15968
|
+
name: "get-or-create",
|
|
15969
|
+
description: "Create a drive if it does not already exist, or retrieve it.",
|
|
15970
|
+
args: {
|
|
15971
|
+
name: import_cjs$1.positional({
|
|
15972
|
+
type: driveName,
|
|
15973
|
+
description: "Drive name to create or retrieve"
|
|
15974
|
+
}),
|
|
15975
|
+
maxSize: import_cjs$1.option({
|
|
15976
|
+
long: "max-size",
|
|
15977
|
+
description: "Maximum drive size in bytes. If omitted, a default of 100 GiB is used.",
|
|
15978
|
+
type: import_cjs$1.optional(driveMaxSize)
|
|
15979
|
+
}),
|
|
15980
|
+
scope
|
|
15981
|
+
},
|
|
15982
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, maxSize }) {
|
|
15983
|
+
const drive = await (async () => {
|
|
15984
|
+
try {
|
|
15985
|
+
var _usingCtx3 = _usingCtx();
|
|
15986
|
+
const _spinner$1 = _usingCtx3.u(acquireRelease(() => ora("Creating drive...").start(), (s$1) => s$1.stop()));
|
|
15987
|
+
return driveClient.getOrCreate({
|
|
15988
|
+
token: token$1,
|
|
15989
|
+
teamId: team$1,
|
|
15990
|
+
projectId: project$1,
|
|
15991
|
+
name,
|
|
15992
|
+
maxSize
|
|
15993
|
+
});
|
|
15994
|
+
} catch (_) {
|
|
15995
|
+
_usingCtx3.e = _;
|
|
15996
|
+
} finally {
|
|
15997
|
+
_usingCtx3.d();
|
|
15998
|
+
}
|
|
15999
|
+
})();
|
|
16000
|
+
process.stderr.write("✅ Drive " + source_default.cyan(drive.name) + " ready.\n");
|
|
16001
|
+
process.stderr.write(source_default.dim(" │ ") + "max size: " + source_default.cyan(formatDriveSize(drive)) + "\n");
|
|
16002
|
+
process.stderr.write(source_default.dim(" ╰ ") + "created: " + source_default.cyan(timeAgo(drive.createdAt)) + "\n");
|
|
16003
|
+
}
|
|
16004
|
+
});
|
|
16005
|
+
const remove$1 = import_cjs$1.command({
|
|
16006
|
+
name: "delete",
|
|
16007
|
+
aliases: ["rm", "remove"],
|
|
16008
|
+
description: "Delete one or more drives.",
|
|
16009
|
+
args: {
|
|
16010
|
+
name: import_cjs$1.positional({
|
|
16011
|
+
type: driveName,
|
|
16012
|
+
description: "Drive name to delete"
|
|
16013
|
+
}),
|
|
16014
|
+
names: import_cjs$1.restPositionals({
|
|
16015
|
+
type: driveName,
|
|
16016
|
+
description: "More drive names to delete"
|
|
16017
|
+
}),
|
|
16018
|
+
scope
|
|
16019
|
+
},
|
|
16020
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, names }) {
|
|
16021
|
+
const tasks = Array.from(new Set([name, ...names]), (driveName$1) => {
|
|
16022
|
+
return {
|
|
16023
|
+
title: `Deleting drive ${driveName$1}`,
|
|
16024
|
+
async task() {
|
|
16025
|
+
const drive = await getDriveByName({
|
|
16026
|
+
token: token$1,
|
|
16027
|
+
teamId: team$1,
|
|
16028
|
+
projectId: project$1,
|
|
16029
|
+
name: driveName$1
|
|
16030
|
+
});
|
|
16031
|
+
if (drive.currentSandboxName || drive.currentSessionId) throw new Error(`Drive ${driveName$1} is attached to a sandbox and cannot be deleted.`);
|
|
16032
|
+
await driveClient.delete(drive);
|
|
16033
|
+
}
|
|
16034
|
+
};
|
|
16035
|
+
});
|
|
16036
|
+
try {
|
|
16037
|
+
await new Listr(tasks, { concurrent: true }).run();
|
|
16038
|
+
} catch {
|
|
16039
|
+
process.exitCode = 1;
|
|
16040
|
+
}
|
|
16041
|
+
}
|
|
16042
|
+
});
|
|
16043
|
+
const drives = (0, import_cjs$2.subcommands)({
|
|
16044
|
+
name: "drives",
|
|
16045
|
+
description: "Manage sandbox drives",
|
|
16046
|
+
cmds: {
|
|
16047
|
+
list: list$1,
|
|
16048
|
+
"get-or-create": getOrCreate,
|
|
16049
|
+
delete: remove$1
|
|
16050
|
+
}
|
|
16051
|
+
});
|
|
16052
|
+
function printDrives(drives$1) {
|
|
16053
|
+
console.log(table({
|
|
16054
|
+
rows: drives$1,
|
|
16055
|
+
columns: {
|
|
16056
|
+
NAME: { value: (v) => v.name },
|
|
16057
|
+
CREATED: { value: (v) => timeAgo(v.createdAt) },
|
|
16058
|
+
UPDATED: { value: (v) => timeAgo(v.updatedAt) },
|
|
16059
|
+
SIZE: { value: formatDriveSize },
|
|
16060
|
+
["ATTACHED SANDBOX"]: { value: (v) => v.currentSandboxName ?? "-" },
|
|
16061
|
+
["ATTACHED SESSION"]: { value: (v) => v.currentSessionId ?? "-" }
|
|
16062
|
+
}
|
|
16063
|
+
}));
|
|
16064
|
+
}
|
|
16065
|
+
function formatDriveSize(drive) {
|
|
16066
|
+
return drive.maxSize === void 0 ? "-" : formatBytes(drive.maxSize);
|
|
16067
|
+
}
|
|
16068
|
+
async function getDriveByName({ token: token$1, teamId, projectId, name }) {
|
|
16069
|
+
const { drives: drives$1 } = await driveClient.list({
|
|
16070
|
+
token: token$1,
|
|
16071
|
+
teamId,
|
|
16072
|
+
projectId,
|
|
16073
|
+
namePrefix: name,
|
|
16074
|
+
sortBy: "name",
|
|
16075
|
+
sortOrder: "asc",
|
|
16076
|
+
limit: 50
|
|
16077
|
+
});
|
|
16078
|
+
const drive = drives$1.find((drive$1) => drive$1.name === name);
|
|
16079
|
+
if (!drive) throw new Error([`Drive ${name} was not found.`, `${source_default.bold("hint:")} Create it with: sandbox drives get-or-create ${name}`].join("\n"));
|
|
16080
|
+
return drive;
|
|
16081
|
+
}
|
|
16082
|
+
|
|
15836
16083
|
//#endregion
|
|
15837
16084
|
//#region src/app.ts
|
|
15838
16085
|
var import_cjs = require_cjs();
|
|
@@ -15854,6 +16101,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
15854
16101
|
snapshot,
|
|
15855
16102
|
snapshots,
|
|
15856
16103
|
sessions,
|
|
16104
|
+
drives,
|
|
15857
16105
|
...!opts?.withoutAuth && {
|
|
15858
16106
|
login,
|
|
15859
16107
|
logout
|
|
@@ -15877,4 +16125,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
15877
16125
|
|
|
15878
16126
|
//#endregion
|
|
15879
16127
|
export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
|
|
15880
|
-
//# sourceMappingURL=app-
|
|
16128
|
+
//# sourceMappingURL=app-D9MUHzWU.mjs.map
|