sandbox 3.5.0-beta.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,7 +19,7 @@ import { EOL } from "os";
|
|
|
19
19
|
import { z } from "zod/v4";
|
|
20
20
|
import { z as z$1 } from "zod";
|
|
21
21
|
import retry from "async-retry";
|
|
22
|
-
import { APIError,
|
|
22
|
+
import { APIError, Sandbox, Snapshot, StreamError } from "@vercel/sandbox";
|
|
23
23
|
import { WebSocket } from "ws";
|
|
24
24
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
25
25
|
import * as tty$1 from "tty";
|
|
@@ -475,7 +475,7 @@ var init_source = __esm({ "../../node_modules/.pnpm/chalk@5.6.0/node_modules/cha
|
|
|
475
475
|
var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/didyoumean@1.2.2/node_modules/didyoumean/didYouMean-1.2.1.js": ((exports, module) => {
|
|
476
476
|
(function() {
|
|
477
477
|
"use strict";
|
|
478
|
-
function didYouMean(str, list$
|
|
478
|
+
function didYouMean(str, list$3, key) {
|
|
479
479
|
if (!str) return null;
|
|
480
480
|
if (!didYouMean.caseSensitive) str = str.toLowerCase();
|
|
481
481
|
var thresholdRelative = didYouMean.threshold === null ? null : didYouMean.threshold * str.length, thresholdAbsolute = didYouMean.thresholdAbsolute, winningVal;
|
|
@@ -483,9 +483,9 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
483
483
|
else if (thresholdRelative !== null) winningVal = thresholdRelative;
|
|
484
484
|
else if (thresholdAbsolute !== null) winningVal = thresholdAbsolute;
|
|
485
485
|
else winningVal = null;
|
|
486
|
-
var winner, candidate, testCandidate, val, i, len = list$
|
|
486
|
+
var winner, candidate, testCandidate, val, i, len = list$3.length;
|
|
487
487
|
for (i = 0; i < len; i++) {
|
|
488
|
-
candidate = list$
|
|
488
|
+
candidate = list$3[i];
|
|
489
489
|
if (key) candidate = candidate[key];
|
|
490
490
|
if (!candidate) continue;
|
|
491
491
|
if (!didYouMean.caseSensitive) testCandidate = candidate.toLowerCase();
|
|
@@ -493,7 +493,7 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
493
493
|
val = getEditDistance(str, testCandidate, winningVal);
|
|
494
494
|
if (winningVal === null || val < winningVal) {
|
|
495
495
|
winningVal = val;
|
|
496
|
-
if (key && didYouMean.returnWinningObject) winner = list$
|
|
496
|
+
if (key && didYouMean.returnWinningObject) winner = list$3[i];
|
|
497
497
|
else winner = candidate;
|
|
498
498
|
if (didYouMean.returnFirstMatch) return winner;
|
|
499
499
|
}
|
|
@@ -1443,7 +1443,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
1443
1443
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1444
1444
|
};
|
|
1445
1445
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1446
|
-
exports.subcommands = subcommands$
|
|
1446
|
+
exports.subcommands = subcommands$3;
|
|
1447
1447
|
const chalk_1$3 = __importDefault$4((init_source(), __toCommonJS$3(source_exports)));
|
|
1448
1448
|
const didyoumean_1 = __importDefault$4(require_didYouMean_1_2_1());
|
|
1449
1449
|
const Result$7 = __importStar$7(require_Result());
|
|
@@ -1453,7 +1453,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
1453
1453
|
/**
|
|
1454
1454
|
* Combine multiple `command`s into one
|
|
1455
1455
|
*/
|
|
1456
|
-
function subcommands$
|
|
1456
|
+
function subcommands$3(config$1) {
|
|
1457
1457
|
const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config$1.version);
|
|
1458
1458
|
const subcommand = (0, positional_1$1.positional)({
|
|
1459
1459
|
displayName: "subcommand",
|
|
@@ -2994,9 +2994,9 @@ var require_cjs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/cmd-ts@
|
|
|
2994
2994
|
|
|
2995
2995
|
//#endregion
|
|
2996
2996
|
//#region src/args/runtime.ts
|
|
2997
|
-
var import_cjs$
|
|
2997
|
+
var import_cjs$31 = /* @__PURE__ */ __toESM(require_cjs());
|
|
2998
2998
|
const runtimeType = {
|
|
2999
|
-
...import_cjs$
|
|
2999
|
+
...import_cjs$31.oneOf([
|
|
3000
3000
|
"node22",
|
|
3001
3001
|
"node24",
|
|
3002
3002
|
"node26",
|
|
@@ -3004,9 +3004,9 @@ const runtimeType = {
|
|
|
3004
3004
|
]),
|
|
3005
3005
|
displayName: "runtime"
|
|
3006
3006
|
};
|
|
3007
|
-
const runtime = import_cjs$
|
|
3007
|
+
const runtime = import_cjs$31.option({
|
|
3008
3008
|
long: "runtime",
|
|
3009
|
-
type: import_cjs$
|
|
3009
|
+
type: import_cjs$31.optional(runtimeType)
|
|
3010
3010
|
});
|
|
3011
3011
|
|
|
3012
3012
|
//#endregion
|
|
@@ -3130,9 +3130,9 @@ var require_ms = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ms@2.1.3
|
|
|
3130
3130
|
|
|
3131
3131
|
//#endregion
|
|
3132
3132
|
//#region src/types/duration.ts
|
|
3133
|
-
var import_cjs$
|
|
3133
|
+
var import_cjs$30 = require_cjs();
|
|
3134
3134
|
init_source();
|
|
3135
|
-
const Duration = (0, import_cjs$
|
|
3135
|
+
const Duration = (0, import_cjs$30.extendType)(import_cjs$30.string, {
|
|
3136
3136
|
displayName: "num UNIT",
|
|
3137
3137
|
description: "A duration, e.g. 5m, 10s, 1h",
|
|
3138
3138
|
async from(string$2) {
|
|
@@ -3148,8 +3148,8 @@ const Duration = (0, import_cjs$33.extendType)(import_cjs$33.string, {
|
|
|
3148
3148
|
|
|
3149
3149
|
//#endregion
|
|
3150
3150
|
//#region src/args/timeout.ts
|
|
3151
|
-
var import_cjs$
|
|
3152
|
-
const timeout = import_cjs$
|
|
3151
|
+
var import_cjs$29 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3152
|
+
const timeout = import_cjs$29.option({
|
|
3153
3153
|
long: "timeout",
|
|
3154
3154
|
type: Duration,
|
|
3155
3155
|
description: "The maximum duration a sandbox can run for. Example: 5m, 30m",
|
|
@@ -3159,17 +3159,17 @@ const timeout = import_cjs$32.option({
|
|
|
3159
3159
|
|
|
3160
3160
|
//#endregion
|
|
3161
3161
|
//#region src/args/vcpus.ts
|
|
3162
|
-
var import_cjs$
|
|
3163
|
-
const vcpusType = import_cjs$
|
|
3162
|
+
var import_cjs$28 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3163
|
+
const vcpusType = import_cjs$28.extendType(import_cjs$28.number, {
|
|
3164
3164
|
displayName: "COUNT",
|
|
3165
3165
|
async from(n) {
|
|
3166
3166
|
if (!Number.isInteger(n) || n < 1) throw new Error(`Invalid vCPU count: ${n}. Must be a positive integer.`);
|
|
3167
3167
|
return n;
|
|
3168
3168
|
}
|
|
3169
3169
|
});
|
|
3170
|
-
const vcpus = import_cjs$
|
|
3170
|
+
const vcpus = import_cjs$28.option({
|
|
3171
3171
|
long: "vcpus",
|
|
3172
|
-
type: import_cjs$
|
|
3172
|
+
type: import_cjs$28.optional(vcpusType),
|
|
3173
3173
|
description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
|
|
3174
3174
|
});
|
|
3175
3175
|
|
|
@@ -6748,10 +6748,10 @@ function _usingCtx() {
|
|
|
6748
6748
|
|
|
6749
6749
|
//#endregion
|
|
6750
6750
|
//#region src/commands/login.ts
|
|
6751
|
-
var import_cjs$
|
|
6751
|
+
var import_cjs$27 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6752
6752
|
init_source();
|
|
6753
6753
|
const debug$8 = createDebugger("sandbox:login");
|
|
6754
|
-
const login = import_cjs$
|
|
6754
|
+
const login = import_cjs$27.command({
|
|
6755
6755
|
name: "login",
|
|
6756
6756
|
description: "Log in to the Sandbox CLI",
|
|
6757
6757
|
args: {},
|
|
@@ -6969,28 +6969,23 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@verce
|
|
|
6969
6969
|
|
|
6970
6970
|
//#endregion
|
|
6971
6971
|
//#region src/args/auth.ts
|
|
6972
|
-
var import_cjs$
|
|
6972
|
+
var import_cjs$26 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6973
6973
|
init_source();
|
|
6974
6974
|
var import_dist = require_dist();
|
|
6975
6975
|
const debug$7 = createDebugger("sandbox:args:auth");
|
|
6976
|
-
/**
|
|
6977
|
-
* Timestamp (ms epoch) of the most recent auto-login. Used to identify
|
|
6978
|
-
* tokens so that the first 401/403 against a freshly-issued token can be
|
|
6979
|
-
* retried instead of surfaced to the user.
|
|
6980
|
-
*/
|
|
6981
6976
|
let freshTokenAcquiredAt;
|
|
6982
|
-
const FRESH_TOKEN_WINDOW_MS =
|
|
6977
|
+
const FRESH_TOKEN_WINDOW_MS = 15e3;
|
|
6983
6978
|
function isTokenFresh() {
|
|
6984
6979
|
return freshTokenAcquiredAt !== void 0 && Date.now() - freshTokenAcquiredAt < FRESH_TOKEN_WINDOW_MS;
|
|
6985
6980
|
}
|
|
6986
6981
|
function markTokenAsFresh() {
|
|
6987
6982
|
freshTokenAcquiredAt = Date.now();
|
|
6988
6983
|
}
|
|
6989
|
-
const token = import_cjs$
|
|
6984
|
+
const token = import_cjs$26.option({
|
|
6990
6985
|
long: "token",
|
|
6991
6986
|
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.",
|
|
6992
6987
|
type: {
|
|
6993
|
-
...import_cjs$
|
|
6988
|
+
...import_cjs$26.string,
|
|
6994
6989
|
displayName: "pat_or_oidc",
|
|
6995
6990
|
defaultValueIsSerializable: false,
|
|
6996
6991
|
onMissing: async () => {
|
|
@@ -7002,7 +6997,10 @@ const token = import_cjs$29.option({
|
|
|
7002
6997
|
console.warn(source_default.yellow(`${source_default.bold("warn:")} failed to get or refresh OIDC token, using personal token authentication.`));
|
|
7003
6998
|
}
|
|
7004
6999
|
try {
|
|
7005
|
-
|
|
7000
|
+
const previousToken = getAuth()?.token;
|
|
7001
|
+
const storedToken = await (0, import_dist.getVercelToken)();
|
|
7002
|
+
if (previousToken && storedToken !== previousToken) markTokenAsFresh();
|
|
7003
|
+
return storedToken;
|
|
7006
7004
|
} catch (error) {
|
|
7007
7005
|
if (error instanceof import_dist.AccessTokenMissingError || error instanceof import_dist.RefreshAccessTokenFailedError) {
|
|
7008
7006
|
debug$7(`CLI token unavailable (${error.name}), prompting for login...`);
|
|
@@ -7173,30 +7171,30 @@ function getAuthFailureStatus(error) {
|
|
|
7173
7171
|
|
|
7174
7172
|
//#endregion
|
|
7175
7173
|
//#region src/args/scope.ts
|
|
7176
|
-
var import_cjs$
|
|
7174
|
+
var import_cjs$25 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7177
7175
|
init_source();
|
|
7178
7176
|
const debug$4 = createDebugger("sandbox:scope");
|
|
7179
|
-
const project = import_cjs$
|
|
7177
|
+
const project = import_cjs$25.option({
|
|
7180
7178
|
long: "project",
|
|
7181
7179
|
type: {
|
|
7182
|
-
...import_cjs$
|
|
7180
|
+
...import_cjs$25.optional(import_cjs$25.string),
|
|
7183
7181
|
displayName: "my-project"
|
|
7184
7182
|
},
|
|
7185
7183
|
description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
|
|
7186
7184
|
});
|
|
7187
7185
|
/** Parser for the `--team` option. */
|
|
7188
|
-
const teamParser = import_cjs$
|
|
7186
|
+
const teamParser = import_cjs$25.option({
|
|
7189
7187
|
long: "team",
|
|
7190
7188
|
type: {
|
|
7191
|
-
...import_cjs$
|
|
7189
|
+
...import_cjs$25.optional(import_cjs$25.string),
|
|
7192
7190
|
displayName: "my-team"
|
|
7193
7191
|
}
|
|
7194
7192
|
});
|
|
7195
7193
|
/** Parser for the `--scope` option. */
|
|
7196
|
-
const scopeParser = import_cjs$
|
|
7194
|
+
const scopeParser = import_cjs$25.option({
|
|
7197
7195
|
long: "scope",
|
|
7198
7196
|
type: {
|
|
7199
|
-
...import_cjs$
|
|
7197
|
+
...import_cjs$25.optional(import_cjs$25.string),
|
|
7200
7198
|
displayName: "my-team"
|
|
7201
7199
|
},
|
|
7202
7200
|
description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
|
|
@@ -7286,7 +7284,7 @@ const scope = {
|
|
|
7286
7284
|
|
|
7287
7285
|
//#endregion
|
|
7288
7286
|
//#region package.json
|
|
7289
|
-
var version = "3.5.
|
|
7287
|
+
var version = "3.5.1";
|
|
7290
7288
|
|
|
7291
7289
|
//#endregion
|
|
7292
7290
|
//#region src/error.ts
|
|
@@ -7416,17 +7414,6 @@ const snapshotClient = {
|
|
|
7416
7414
|
...params
|
|
7417
7415
|
}))
|
|
7418
7416
|
};
|
|
7419
|
-
const driveClient = {
|
|
7420
|
-
getOrCreate: (params) => withErrorHandling(() => Drive.getOrCreate({
|
|
7421
|
-
fetch: fetchWithUserAgent,
|
|
7422
|
-
...params
|
|
7423
|
-
})),
|
|
7424
|
-
list: (params) => withErrorHandling(() => Drive.list({
|
|
7425
|
-
fetch: fetchWithUserAgent,
|
|
7426
|
-
...params
|
|
7427
|
-
})),
|
|
7428
|
-
delete: (drive) => withErrorHandling(() => drive.delete())
|
|
7429
|
-
};
|
|
7430
7417
|
const fetchWithUserAgent = (input, init$1) => {
|
|
7431
7418
|
const headers = new Headers(init$1?.headers ?? (input && typeof input === "object" && "headers" in input ? input?.headers : {}));
|
|
7432
7419
|
let agent = `vercel/sandbox-cli/${version}`;
|
|
@@ -7449,9 +7436,9 @@ async function withErrorHandling(factory) {
|
|
|
7449
7436
|
|
|
7450
7437
|
//#endregion
|
|
7451
7438
|
//#region src/args/snapshot-id.ts
|
|
7452
|
-
var import_cjs$
|
|
7439
|
+
var import_cjs$24 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7453
7440
|
init_source();
|
|
7454
|
-
const snapshotId = import_cjs$
|
|
7441
|
+
const snapshotId = import_cjs$24.extendType(import_cjs$24.string, {
|
|
7455
7442
|
displayName: "snapshot_id",
|
|
7456
7443
|
description: "The ID of the snapshot",
|
|
7457
7444
|
async from(s$1) {
|
|
@@ -7462,13 +7449,13 @@ const snapshotId = import_cjs$27.extendType(import_cjs$27.string, {
|
|
|
7462
7449
|
|
|
7463
7450
|
//#endregion
|
|
7464
7451
|
//#region src/args/ports.ts
|
|
7465
|
-
var import_cjs$
|
|
7452
|
+
var import_cjs$23 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7466
7453
|
init_source();
|
|
7467
|
-
const publishPorts = import_cjs$
|
|
7454
|
+
const publishPorts = import_cjs$23.multioption({
|
|
7468
7455
|
long: "publish-port",
|
|
7469
7456
|
short: "p",
|
|
7470
7457
|
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
7471
|
-
type: import_cjs$
|
|
7458
|
+
type: import_cjs$23.array(import_cjs$23.extendType(import_cjs$23.number, {
|
|
7472
7459
|
displayName: "PORT",
|
|
7473
7460
|
async from(number) {
|
|
7474
7461
|
if (!Number.isInteger(number) || number < 1024 || number > 65535) throw new Error([
|
|
@@ -7483,8 +7470,8 @@ const publishPorts = import_cjs$26.multioption({
|
|
|
7483
7470
|
|
|
7484
7471
|
//#endregion
|
|
7485
7472
|
//#region src/types/snapshot-expiration.ts
|
|
7486
|
-
var import_cjs$
|
|
7487
|
-
const SnapshotExpiration = (0, import_cjs$
|
|
7473
|
+
var import_cjs$22 = require_cjs();
|
|
7474
|
+
const SnapshotExpiration = (0, import_cjs$22.extendType)(import_cjs$22.string, {
|
|
7488
7475
|
displayName: "DURATION|none",
|
|
7489
7476
|
description: "A duration (e.g. 7d, 30d) or \"none\" for no expiration",
|
|
7490
7477
|
async from(value) {
|
|
@@ -7495,15 +7482,15 @@ const SnapshotExpiration = (0, import_cjs$25.extendType)(import_cjs$25.string, {
|
|
|
7495
7482
|
|
|
7496
7483
|
//#endregion
|
|
7497
7484
|
//#region src/args/snapshot-retention.ts
|
|
7498
|
-
var import_cjs$
|
|
7499
|
-
const snapshotExpiration = import_cjs$
|
|
7485
|
+
var import_cjs$21 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7486
|
+
const snapshotExpiration = import_cjs$21.option({
|
|
7500
7487
|
long: "snapshot-expiration",
|
|
7501
|
-
type: import_cjs$
|
|
7488
|
+
type: import_cjs$21.optional(SnapshotExpiration),
|
|
7502
7489
|
description: "Default snapshot expiration. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
7503
7490
|
});
|
|
7504
|
-
const keepLastSnapshots = import_cjs$
|
|
7491
|
+
const keepLastSnapshots = import_cjs$21.option({
|
|
7505
7492
|
long: "keep-last-snapshots",
|
|
7506
|
-
type: import_cjs$
|
|
7493
|
+
type: import_cjs$21.optional(import_cjs$21.extendType(import_cjs$21.number, {
|
|
7507
7494
|
displayName: "COUNT",
|
|
7508
7495
|
async from(n) {
|
|
7509
7496
|
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.`);
|
|
@@ -7512,15 +7499,15 @@ const keepLastSnapshots = import_cjs$24.option({
|
|
|
7512
7499
|
})),
|
|
7513
7500
|
description: "Keep only the N most recent snapshots of this sandbox (1-10)."
|
|
7514
7501
|
});
|
|
7515
|
-
const keepLastSnapshotsFor = import_cjs$
|
|
7502
|
+
const keepLastSnapshotsFor = import_cjs$21.option({
|
|
7516
7503
|
long: "keep-last-snapshots-for",
|
|
7517
|
-
type: import_cjs$
|
|
7504
|
+
type: import_cjs$21.optional(SnapshotExpiration),
|
|
7518
7505
|
description: "Expiration applied to kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
7519
7506
|
});
|
|
7520
|
-
const deleteEvictedSnapshots = import_cjs$
|
|
7507
|
+
const deleteEvictedSnapshots = import_cjs$21.option({
|
|
7521
7508
|
long: "delete-evicted-snapshots",
|
|
7522
|
-
type: import_cjs$
|
|
7523
|
-
...import_cjs$
|
|
7509
|
+
type: import_cjs$21.optional({
|
|
7510
|
+
...import_cjs$21.oneOf(["true", "false"]),
|
|
7524
7511
|
displayName: "true|false"
|
|
7525
7512
|
}),
|
|
7526
7513
|
description: "When \"true\" (the default), evicted snapshots are deleted immediately; when \"false\", they keep the default expiration."
|
|
@@ -7534,9 +7521,9 @@ const snapshotRetentionArgs = {
|
|
|
7534
7521
|
|
|
7535
7522
|
//#endregion
|
|
7536
7523
|
//#region src/args/sandbox-name.ts
|
|
7537
|
-
var import_cjs$
|
|
7524
|
+
var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7538
7525
|
init_source();
|
|
7539
|
-
const sandboxName = import_cjs$
|
|
7526
|
+
const sandboxName = import_cjs$20.extendType(import_cjs$20.string, {
|
|
7540
7527
|
displayName: "name",
|
|
7541
7528
|
description: "The name of the sandbox",
|
|
7542
7529
|
async from(s$1) {
|
|
@@ -7713,9 +7700,9 @@ function toEnvArray(env$2) {
|
|
|
7713
7700
|
|
|
7714
7701
|
//#endregion
|
|
7715
7702
|
//#region src/args/key-value-pair.ts
|
|
7716
|
-
var import_cjs$
|
|
7703
|
+
var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7717
7704
|
init_source();
|
|
7718
|
-
const KeyValuePair = import_cjs$
|
|
7705
|
+
const KeyValuePair = import_cjs$19.extendType(import_cjs$19.string, {
|
|
7719
7706
|
displayName: "key=value",
|
|
7720
7707
|
async from(input) {
|
|
7721
7708
|
if (!input.includes("=")) return {
|
|
@@ -7729,7 +7716,7 @@ const KeyValuePair = import_cjs$22.extendType(import_cjs$22.string, {
|
|
|
7729
7716
|
};
|
|
7730
7717
|
}
|
|
7731
7718
|
});
|
|
7732
|
-
const ObjectFromKeyValue = import_cjs$
|
|
7719
|
+
const ObjectFromKeyValue = import_cjs$19.extendType(import_cjs$19.array(KeyValuePair), { async from(input) {
|
|
7733
7720
|
const obj = Object.create(null);
|
|
7734
7721
|
const missingVars = [];
|
|
7735
7722
|
for (const { key, value } of input) if (value === void 0) missingVars.push(key);
|
|
@@ -7743,28 +7730,28 @@ const ObjectFromKeyValue = import_cjs$22.extendType(import_cjs$22.array(KeyValue
|
|
|
7743
7730
|
|
|
7744
7731
|
//#endregion
|
|
7745
7732
|
//#region src/commands/exec.ts
|
|
7746
|
-
var import_cjs$
|
|
7733
|
+
var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7747
7734
|
var import_ms$5 = /* @__PURE__ */ __toESM(require_ms());
|
|
7748
7735
|
init_source();
|
|
7749
7736
|
const args$4 = {
|
|
7750
|
-
sandbox: import_cjs$
|
|
7751
|
-
command: import_cjs$
|
|
7737
|
+
sandbox: import_cjs$18.positional({ type: sandboxName }),
|
|
7738
|
+
command: import_cjs$18.positional({
|
|
7752
7739
|
displayName: "command",
|
|
7753
7740
|
description: "The executable to invoke"
|
|
7754
7741
|
}),
|
|
7755
|
-
args: import_cjs$
|
|
7742
|
+
args: import_cjs$18.rest({
|
|
7756
7743
|
displayName: "args",
|
|
7757
7744
|
description: "arguments to pass to the command"
|
|
7758
7745
|
}),
|
|
7759
|
-
asSudo: import_cjs$
|
|
7746
|
+
asSudo: import_cjs$18.flag({
|
|
7760
7747
|
long: "sudo",
|
|
7761
7748
|
description: "Give extended privileges to the command."
|
|
7762
7749
|
}),
|
|
7763
|
-
interactive: import_cjs$
|
|
7750
|
+
interactive: import_cjs$18.flag({
|
|
7764
7751
|
long: "interactive",
|
|
7765
7752
|
short: "i",
|
|
7766
7753
|
description: "Run the command in a secure interactive shell",
|
|
7767
|
-
type: import_cjs$
|
|
7754
|
+
type: import_cjs$18.extendType(import_cjs$18.boolean, {
|
|
7768
7755
|
defaultValue() {
|
|
7769
7756
|
return false;
|
|
7770
7757
|
},
|
|
@@ -7774,35 +7761,35 @@ const args$4 = {
|
|
|
7774
7761
|
}
|
|
7775
7762
|
})
|
|
7776
7763
|
}),
|
|
7777
|
-
skipExtendingTimeout: import_cjs$
|
|
7764
|
+
skipExtendingTimeout: import_cjs$18.flag({
|
|
7778
7765
|
long: "no-extend-timeout",
|
|
7779
7766
|
description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
|
|
7780
7767
|
}),
|
|
7781
|
-
tty: import_cjs$
|
|
7768
|
+
tty: import_cjs$18.flag({
|
|
7782
7769
|
long: "tty",
|
|
7783
7770
|
short: "t",
|
|
7784
7771
|
description: "Allocate a tty for an interactive command. This is a no-op."
|
|
7785
7772
|
}),
|
|
7786
|
-
cwd: import_cjs$
|
|
7773
|
+
cwd: import_cjs$18.option({
|
|
7787
7774
|
long: "workdir",
|
|
7788
7775
|
short: "w",
|
|
7789
7776
|
description: "The working directory to run the command in",
|
|
7790
|
-
type: import_cjs$
|
|
7777
|
+
type: import_cjs$18.optional(import_cjs$18.string)
|
|
7791
7778
|
}),
|
|
7792
|
-
envVars: import_cjs$
|
|
7779
|
+
envVars: import_cjs$18.multioption({
|
|
7793
7780
|
long: "env",
|
|
7794
7781
|
short: "e",
|
|
7795
7782
|
type: ObjectFromKeyValue,
|
|
7796
7783
|
description: "Environment variables to set for the command"
|
|
7797
7784
|
}),
|
|
7798
|
-
timeout: import_cjs$
|
|
7785
|
+
timeout: import_cjs$18.option({
|
|
7799
7786
|
long: "timeout",
|
|
7800
|
-
type: import_cjs$
|
|
7787
|
+
type: import_cjs$18.optional(Duration),
|
|
7801
7788
|
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."
|
|
7802
7789
|
}),
|
|
7803
7790
|
scope
|
|
7804
7791
|
};
|
|
7805
|
-
const exec = import_cjs$
|
|
7792
|
+
const exec = import_cjs$18.command({
|
|
7806
7793
|
name: "exec",
|
|
7807
7794
|
description: "Execute a command in an existing sandbox",
|
|
7808
7795
|
args: args$4,
|
|
@@ -7843,9 +7830,9 @@ const exec = import_cjs$21.command({
|
|
|
7843
7830
|
|
|
7844
7831
|
//#endregion
|
|
7845
7832
|
//#region src/args/network-policy.ts
|
|
7846
|
-
var import_cjs$
|
|
7833
|
+
var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7847
7834
|
init_source();
|
|
7848
|
-
const networkPolicyMode = import_cjs$
|
|
7835
|
+
const networkPolicyMode = import_cjs$17.extendType(import_cjs$17.string, {
|
|
7849
7836
|
displayName: "MODE",
|
|
7850
7837
|
async from(value) {
|
|
7851
7838
|
const validModes = ["allow-all", "deny-all"];
|
|
@@ -7853,28 +7840,28 @@ const networkPolicyMode = import_cjs$20.extendType(import_cjs$20.string, {
|
|
|
7853
7840
|
return value;
|
|
7854
7841
|
}
|
|
7855
7842
|
});
|
|
7856
|
-
const networkPolicy = import_cjs$
|
|
7843
|
+
const networkPolicy = import_cjs$17.option({
|
|
7857
7844
|
long: "network-policy",
|
|
7858
7845
|
description: `Network policy mode: "allow-all" or "deny-all"
|
|
7859
7846
|
- allow-all: sandbox can access any website/domain
|
|
7860
7847
|
- deny-all: sandbox has no network access
|
|
7861
7848
|
Omit this option and use --allowed-domain / --allowed-cidr / --denied-cidr for custom policies.`,
|
|
7862
|
-
type: import_cjs$
|
|
7849
|
+
type: import_cjs$17.optional(networkPolicyMode)
|
|
7863
7850
|
});
|
|
7864
|
-
const allowedDomains = import_cjs$
|
|
7851
|
+
const allowedDomains = import_cjs$17.multioption({
|
|
7865
7852
|
long: "allowed-domain",
|
|
7866
7853
|
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.`,
|
|
7867
|
-
type: import_cjs$
|
|
7854
|
+
type: import_cjs$17.array(import_cjs$17.string)
|
|
7868
7855
|
});
|
|
7869
|
-
const allowedCIDRs = import_cjs$
|
|
7856
|
+
const allowedCIDRs = import_cjs$17.multioption({
|
|
7870
7857
|
long: "allowed-cidr",
|
|
7871
7858
|
description: `CIDR to allow traffic to (creates a custom network policy). Takes precedence over 'allowed-domain'.`,
|
|
7872
|
-
type: import_cjs$
|
|
7859
|
+
type: import_cjs$17.array(import_cjs$17.string)
|
|
7873
7860
|
});
|
|
7874
|
-
const deniedCIDRs = import_cjs$
|
|
7861
|
+
const deniedCIDRs = import_cjs$17.multioption({
|
|
7875
7862
|
long: "denied-cidr",
|
|
7876
7863
|
description: `CIDR to deny traffic to (creates a custom network policy). Takes precedence over allowed domains/CIDRs.`,
|
|
7877
|
-
type: import_cjs$
|
|
7864
|
+
type: import_cjs$17.array(import_cjs$17.string)
|
|
7878
7865
|
});
|
|
7879
7866
|
const networkPolicyArgs = {
|
|
7880
7867
|
networkPolicy,
|
|
@@ -7968,114 +7955,61 @@ function printSandboxSummary(opts) {
|
|
|
7968
7955
|
} else process.stderr.write(source_default.dim(" ╰ ") + "project: " + source_default.cyan(projectDisplay) + "\n");
|
|
7969
7956
|
}
|
|
7970
7957
|
|
|
7971
|
-
//#endregion
|
|
7972
|
-
//#region src/args/drive.ts
|
|
7973
|
-
var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7974
|
-
init_source();
|
|
7975
|
-
const driveName = import_cjs$19.extendType(import_cjs$19.string, {
|
|
7976
|
-
displayName: "name",
|
|
7977
|
-
description: "The name of the drive",
|
|
7978
|
-
async from(input) {
|
|
7979
|
-
const value = input.trim();
|
|
7980
|
-
if (value.length === 0) throw new Error("Drive name cannot be empty.");
|
|
7981
|
-
return value;
|
|
7982
|
-
}
|
|
7983
|
-
});
|
|
7984
|
-
const driveMount = import_cjs$19.extendType(import_cjs$19.string, {
|
|
7985
|
-
displayName: "drive:path[:mode]",
|
|
7986
|
-
description: "Drive mount in the format \"drive:/path[:read-only|read-write]\".",
|
|
7987
|
-
async from(input) {
|
|
7988
|
-
return parseDriveMount(input);
|
|
7989
|
-
}
|
|
7990
|
-
});
|
|
7991
|
-
const driveMounts = import_cjs$19.extendType(import_cjs$19.array(driveMount), { async from(input) {
|
|
7992
|
-
const mounts$1 = Object.create(null);
|
|
7993
|
-
for (const mount of input) mounts$1[mount.path] = {
|
|
7994
|
-
drive: mount.drive,
|
|
7995
|
-
mode: mount.mode
|
|
7996
|
-
};
|
|
7997
|
-
return mounts$1;
|
|
7998
|
-
} });
|
|
7999
|
-
const mounts = import_cjs$19.multioption({
|
|
8000
|
-
long: "mount",
|
|
8001
|
-
type: driveMounts,
|
|
8002
|
-
description: "Attach a drive to the sandbox. Format: \"drive:/path[:read-only|read-write]\"."
|
|
8003
|
-
});
|
|
8004
|
-
const driveMaxSize = import_cjs$19.extendType(import_cjs$19.number, {
|
|
8005
|
-
displayName: "BYTES",
|
|
8006
|
-
async from(input) {
|
|
8007
|
-
if (!Number.isInteger(input) || input < 1) throw new Error(`Invalid max size: ${input}. Must be a positive integer number of bytes.`);
|
|
8008
|
-
return input;
|
|
8009
|
-
}
|
|
8010
|
-
});
|
|
8011
|
-
function parseDriveMount(input) {
|
|
8012
|
-
const [drive, path, mode, ...rest$1] = input.split(":");
|
|
8013
|
-
const validModes = ["read-only", "read-write"];
|
|
8014
|
-
if (rest$1.length > 0 || !drive || path === void 0) throw new Error([`Invalid drive mount: ${input}.`, `${source_default.bold("hint:")} Use "drive:/path" or "drive:/path:read-only".`].join("\n"));
|
|
8015
|
-
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"));
|
|
8016
|
-
return {
|
|
8017
|
-
drive,
|
|
8018
|
-
path,
|
|
8019
|
-
mode
|
|
8020
|
-
};
|
|
8021
|
-
}
|
|
8022
|
-
|
|
8023
7958
|
//#endregion
|
|
8024
7959
|
//#region src/commands/create.ts
|
|
8025
|
-
var import_cjs$
|
|
7960
|
+
var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8026
7961
|
var import_ms$3 = /* @__PURE__ */ __toESM(require_ms());
|
|
8027
7962
|
init_source();
|
|
8028
7963
|
const args$3 = {
|
|
8029
|
-
name: import_cjs$
|
|
7964
|
+
name: import_cjs$16.option({
|
|
8030
7965
|
long: "name",
|
|
8031
7966
|
description: "A user-chosen name for the sandbox. It must be unique per project.",
|
|
8032
|
-
type: import_cjs$
|
|
7967
|
+
type: import_cjs$16.optional(import_cjs$16.string)
|
|
8033
7968
|
}),
|
|
8034
|
-
nonPersistent: import_cjs$
|
|
7969
|
+
nonPersistent: import_cjs$16.flag({
|
|
8035
7970
|
long: "non-persistent",
|
|
8036
7971
|
description: "Disable automatic restore of the filesystem between sessions."
|
|
8037
7972
|
}),
|
|
8038
7973
|
runtime,
|
|
8039
|
-
image: import_cjs$
|
|
7974
|
+
image: import_cjs$16.option({
|
|
8040
7975
|
long: "image",
|
|
8041
7976
|
description: "A Vercel Container Registry (VCR) image name and optional tag or sha to start the sandbox from (e.g. my-repo, my-repo:v1).",
|
|
8042
|
-
type: import_cjs$
|
|
7977
|
+
type: import_cjs$16.optional(import_cjs$16.string)
|
|
8043
7978
|
}),
|
|
8044
7979
|
timeout,
|
|
8045
7980
|
vcpus,
|
|
8046
7981
|
ports: publishPorts,
|
|
8047
|
-
silent: import_cjs$
|
|
7982
|
+
silent: import_cjs$16.flag({
|
|
8048
7983
|
long: "silent",
|
|
8049
7984
|
description: "Don't write sandbox name to stdout"
|
|
8050
7985
|
}),
|
|
8051
|
-
snapshot: import_cjs$
|
|
7986
|
+
snapshot: import_cjs$16.option({
|
|
8052
7987
|
long: "snapshot",
|
|
8053
7988
|
short: "s",
|
|
8054
7989
|
description: "Start the sandbox from a snapshot ID",
|
|
8055
|
-
type: import_cjs$
|
|
7990
|
+
type: import_cjs$16.optional(snapshotId)
|
|
8056
7991
|
}),
|
|
8057
|
-
connect: import_cjs$
|
|
7992
|
+
connect: import_cjs$16.flag({
|
|
8058
7993
|
long: "connect",
|
|
8059
7994
|
description: "Start an interactive shell session after creating the sandbox"
|
|
8060
7995
|
}),
|
|
8061
|
-
envVars: import_cjs$
|
|
7996
|
+
envVars: import_cjs$16.multioption({
|
|
8062
7997
|
long: "env",
|
|
8063
7998
|
short: "e",
|
|
8064
7999
|
type: ObjectFromKeyValue,
|
|
8065
8000
|
description: "Default environment variables for sandbox commands"
|
|
8066
8001
|
}),
|
|
8067
|
-
tags: import_cjs$
|
|
8002
|
+
tags: import_cjs$16.multioption({
|
|
8068
8003
|
long: "tag",
|
|
8069
8004
|
short: "t",
|
|
8070
8005
|
type: ObjectFromKeyValue,
|
|
8071
8006
|
description: "Key-value tags to associate with the sandbox (e.g. --tag env=staging)"
|
|
8072
8007
|
}),
|
|
8073
|
-
mounts,
|
|
8074
8008
|
...snapshotRetentionArgs,
|
|
8075
8009
|
...networkPolicyArgs,
|
|
8076
8010
|
scope
|
|
8077
8011
|
};
|
|
8078
|
-
const create = import_cjs$
|
|
8012
|
+
const create = import_cjs$16.command({
|
|
8079
8013
|
name: "create",
|
|
8080
8014
|
description: "Create a sandbox in the specified account and project.",
|
|
8081
8015
|
args: args$3,
|
|
@@ -8083,7 +8017,7 @@ const create = import_cjs$18.command({
|
|
|
8083
8017
|
description: "Create and connect to a sandbox without a network access",
|
|
8084
8018
|
command: `sandbox run --network-policy=none --connect`
|
|
8085
8019
|
}],
|
|
8086
|
-
async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, image, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$1, envVars, tags,
|
|
8020
|
+
async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, image, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$1, 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 }) {
|
|
8087
8021
|
if (image && runtime$1) throw new Error("--image and --runtime cannot be used together.");
|
|
8088
8022
|
const networkPolicy$1 = buildNetworkPolicy({
|
|
8089
8023
|
networkPolicy: networkPolicyMode$1,
|
|
@@ -8099,7 +8033,6 @@ const create = import_cjs$18.command({
|
|
|
8099
8033
|
const persistent = !nonPersistent;
|
|
8100
8034
|
const resources = vcpus$1 ? { vcpus: vcpus$1 } : void 0;
|
|
8101
8035
|
const tagsObj = Object.keys(tags).length > 0 ? tags : void 0;
|
|
8102
|
-
const mountsObj = Object.keys(mounts$1).length > 0 ? mounts$1 : void 0;
|
|
8103
8036
|
const spinner = silent ? void 0 : ora("Creating sandbox...").start();
|
|
8104
8037
|
const sandbox = snapshot$1 ? await sandboxClient.create({
|
|
8105
8038
|
name,
|
|
@@ -8116,7 +8049,6 @@ const create = import_cjs$18.command({
|
|
|
8116
8049
|
networkPolicy: networkPolicy$1,
|
|
8117
8050
|
env: envVars,
|
|
8118
8051
|
tags: tagsObj,
|
|
8119
|
-
mounts: mountsObj,
|
|
8120
8052
|
persistent,
|
|
8121
8053
|
snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
|
|
8122
8054
|
keepLastSnapshots: keepLastSnapshotsPayload,
|
|
@@ -8133,7 +8065,6 @@ const create = import_cjs$18.command({
|
|
|
8133
8065
|
networkPolicy: networkPolicy$1,
|
|
8134
8066
|
env: envVars,
|
|
8135
8067
|
tags: tagsObj,
|
|
8136
|
-
mounts: mountsObj,
|
|
8137
8068
|
persistent,
|
|
8138
8069
|
snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
|
|
8139
8070
|
keepLastSnapshots: keepLastSnapshotsPayload,
|
|
@@ -8177,8 +8108,8 @@ function omit(obj, ...keys) {
|
|
|
8177
8108
|
|
|
8178
8109
|
//#endregion
|
|
8179
8110
|
//#region src/commands/sh.ts
|
|
8180
|
-
var import_cjs$
|
|
8181
|
-
const sh = import_cjs$
|
|
8111
|
+
var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8112
|
+
const sh = import_cjs$15.command({
|
|
8182
8113
|
name: "sh",
|
|
8183
8114
|
description: "Create a sandbox and start an interactive shell",
|
|
8184
8115
|
args: omit(args$3, "connect"),
|
|
@@ -8192,46 +8123,46 @@ const sh = import_cjs$17.command({
|
|
|
8192
8123
|
|
|
8193
8124
|
//#endregion
|
|
8194
8125
|
//#region src/commands/fork.ts
|
|
8195
|
-
var import_cjs$
|
|
8126
|
+
var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8196
8127
|
var import_ms$2 = /* @__PURE__ */ __toESM(require_ms());
|
|
8197
8128
|
init_source();
|
|
8198
8129
|
const args$2 = {
|
|
8199
|
-
source: import_cjs$
|
|
8130
|
+
source: import_cjs$14.positional({
|
|
8200
8131
|
displayName: "source",
|
|
8201
8132
|
description: "Name of the source sandbox to fork from.",
|
|
8202
8133
|
type: sandboxName
|
|
8203
8134
|
}),
|
|
8204
|
-
name: import_cjs$
|
|
8135
|
+
name: import_cjs$14.option({
|
|
8205
8136
|
long: "name",
|
|
8206
8137
|
description: "A user-chosen name for the forked sandbox. Must be unique per project.",
|
|
8207
|
-
type: import_cjs$
|
|
8138
|
+
type: import_cjs$14.optional(import_cjs$14.string)
|
|
8208
8139
|
}),
|
|
8209
|
-
nonPersistent: import_cjs$
|
|
8140
|
+
nonPersistent: import_cjs$14.flag({
|
|
8210
8141
|
long: "non-persistent",
|
|
8211
8142
|
description: "Disable automatic restore of the filesystem between sessions."
|
|
8212
8143
|
}),
|
|
8213
|
-
timeout: import_cjs$
|
|
8144
|
+
timeout: import_cjs$14.option({
|
|
8214
8145
|
long: "timeout",
|
|
8215
|
-
type: import_cjs$
|
|
8146
|
+
type: import_cjs$14.optional(Duration),
|
|
8216
8147
|
description: "Override the maximum sandbox runtime (inherited from source if omitted). Example: 5m, 30m"
|
|
8217
8148
|
}),
|
|
8218
8149
|
vcpus,
|
|
8219
8150
|
ports: publishPorts,
|
|
8220
|
-
silent: import_cjs$
|
|
8151
|
+
silent: import_cjs$14.flag({
|
|
8221
8152
|
long: "silent",
|
|
8222
8153
|
description: "Don't write sandbox name to stdout"
|
|
8223
8154
|
}),
|
|
8224
|
-
connect: import_cjs$
|
|
8155
|
+
connect: import_cjs$14.flag({
|
|
8225
8156
|
long: "connect",
|
|
8226
8157
|
description: "Start an interactive shell session after creating the forked sandbox"
|
|
8227
8158
|
}),
|
|
8228
|
-
envVars: import_cjs$
|
|
8159
|
+
envVars: import_cjs$14.multioption({
|
|
8229
8160
|
long: "env",
|
|
8230
8161
|
short: "e",
|
|
8231
8162
|
type: ObjectFromKeyValue,
|
|
8232
8163
|
description: "Environment variables to set on the fork. Env vars from the source sandbox are not copied (encrypted server-side)."
|
|
8233
8164
|
}),
|
|
8234
|
-
tags: import_cjs$
|
|
8165
|
+
tags: import_cjs$14.multioption({
|
|
8235
8166
|
long: "tag",
|
|
8236
8167
|
short: "t",
|
|
8237
8168
|
type: ObjectFromKeyValue,
|
|
@@ -8241,7 +8172,7 @@ const args$2 = {
|
|
|
8241
8172
|
...networkPolicyArgs,
|
|
8242
8173
|
scope
|
|
8243
8174
|
};
|
|
8244
|
-
const fork = import_cjs$
|
|
8175
|
+
const fork = import_cjs$14.command({
|
|
8245
8176
|
name: "fork",
|
|
8246
8177
|
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.",
|
|
8247
8178
|
args: args$2,
|
|
@@ -8314,20 +8245,20 @@ const fork = import_cjs$16.command({
|
|
|
8314
8245
|
|
|
8315
8246
|
//#endregion
|
|
8316
8247
|
//#region src/commands/run.ts
|
|
8317
|
-
var import_cjs$
|
|
8248
|
+
var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8318
8249
|
const args$1 = {
|
|
8319
8250
|
...args$3,
|
|
8320
8251
|
...omit(args$4, "sandbox", "timeout"),
|
|
8321
|
-
removeAfterUse: import_cjs$
|
|
8252
|
+
removeAfterUse: import_cjs$13.flag({
|
|
8322
8253
|
long: "rm",
|
|
8323
8254
|
description: "Automatically remove the sandbox when the command exits."
|
|
8324
8255
|
}),
|
|
8325
|
-
stopAfterUse: import_cjs$
|
|
8256
|
+
stopAfterUse: import_cjs$13.flag({
|
|
8326
8257
|
long: "stop",
|
|
8327
8258
|
description: "Stop the sandbox when the command exits."
|
|
8328
8259
|
})
|
|
8329
8260
|
};
|
|
8330
|
-
const run = import_cjs$
|
|
8261
|
+
const run = import_cjs$13.command({
|
|
8331
8262
|
name: "run",
|
|
8332
8263
|
description: "Create and run a command in a sandbox",
|
|
8333
8264
|
args: args$1,
|
|
@@ -8369,51 +8300,58 @@ const run = import_cjs$15.command({
|
|
|
8369
8300
|
|
|
8370
8301
|
//#endregion
|
|
8371
8302
|
//#region src/commands/list.ts
|
|
8372
|
-
var import_cjs$
|
|
8303
|
+
var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8373
8304
|
init_source();
|
|
8374
|
-
|
|
8305
|
+
function formatImage(image) {
|
|
8306
|
+
const [repository, digest] = image.split("@");
|
|
8307
|
+
if (!digest) return image;
|
|
8308
|
+
const [algorithm, hex] = digest.split(":");
|
|
8309
|
+
if (!hex) return image;
|
|
8310
|
+
return `${repository}@${algorithm}:${hex.slice(0, 12)}…`;
|
|
8311
|
+
}
|
|
8312
|
+
const list = import_cjs$12.command({
|
|
8375
8313
|
name: "list",
|
|
8376
8314
|
aliases: ["ls"],
|
|
8377
8315
|
description: "List all sandboxes for the specified account and project.",
|
|
8378
8316
|
args: {
|
|
8379
|
-
all: import_cjs$
|
|
8317
|
+
all: import_cjs$12.flag({
|
|
8380
8318
|
long: "all",
|
|
8381
8319
|
short: "a",
|
|
8382
8320
|
description: "Show all sandboxes (default shows just running)"
|
|
8383
8321
|
}),
|
|
8384
|
-
namePrefix: import_cjs$
|
|
8322
|
+
namePrefix: import_cjs$12.option({
|
|
8385
8323
|
long: "name-prefix",
|
|
8386
8324
|
description: "Filter sandboxes by name prefix",
|
|
8387
|
-
type: import_cjs$
|
|
8325
|
+
type: import_cjs$12.optional(import_cjs$12.string)
|
|
8388
8326
|
}),
|
|
8389
|
-
sortBy: import_cjs$
|
|
8327
|
+
sortBy: import_cjs$12.option({
|
|
8390
8328
|
long: "sort-by",
|
|
8391
8329
|
description: "Sort sandboxes by field. Options: createdAt (default), name, statusUpdatedAt",
|
|
8392
|
-
type: import_cjs$
|
|
8330
|
+
type: import_cjs$12.optional(import_cjs$12.oneOf([
|
|
8393
8331
|
"createdAt",
|
|
8394
8332
|
"name",
|
|
8395
8333
|
"statusUpdatedAt"
|
|
8396
8334
|
]))
|
|
8397
8335
|
}),
|
|
8398
|
-
sortOrder: import_cjs$
|
|
8336
|
+
sortOrder: import_cjs$12.option({
|
|
8399
8337
|
long: "sort-order",
|
|
8400
8338
|
description: "Sort order. Options: asc, desc (default)",
|
|
8401
|
-
type: import_cjs$
|
|
8339
|
+
type: import_cjs$12.optional(import_cjs$12.oneOf(["asc", "desc"]))
|
|
8402
8340
|
}),
|
|
8403
|
-
tags: import_cjs$
|
|
8341
|
+
tags: import_cjs$12.multioption({
|
|
8404
8342
|
long: "tag",
|
|
8405
8343
|
description: "Filter sandboxes by tag. Format: \"key=value\"",
|
|
8406
8344
|
type: ObjectFromKeyValue
|
|
8407
8345
|
}),
|
|
8408
|
-
limit: import_cjs$
|
|
8346
|
+
limit: import_cjs$12.option({
|
|
8409
8347
|
long: "limit",
|
|
8410
8348
|
description: "Maximum number of sandboxes per page (default 50).",
|
|
8411
|
-
type: import_cjs$
|
|
8349
|
+
type: import_cjs$12.optional(import_cjs$12.number)
|
|
8412
8350
|
}),
|
|
8413
|
-
cursor: import_cjs$
|
|
8351
|
+
cursor: import_cjs$12.option({
|
|
8414
8352
|
long: "cursor",
|
|
8415
8353
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
8416
|
-
type: import_cjs$
|
|
8354
|
+
type: import_cjs$12.optional(import_cjs$12.string)
|
|
8417
8355
|
}),
|
|
8418
8356
|
scope
|
|
8419
8357
|
},
|
|
@@ -8460,14 +8398,13 @@ const list = import_cjs$14.command({
|
|
|
8460
8398
|
CREATED: { value: (s$1) => timeAgo(s$1.createdAt) },
|
|
8461
8399
|
MEMORY: { value: (s$1) => s$1.memory != null ? memoryFormatter.format(s$1.memory) : "-" },
|
|
8462
8400
|
VCPUS: { value: (s$1) => s$1.vcpus ?? "-" },
|
|
8463
|
-
RUNTIME: { value: (s$1) => s$1.runtime ?? "-" },
|
|
8401
|
+
"RUNTIME/IMAGE": { value: (s$1) => s$1.runtime ?? (s$1.image ? formatImage(s$1.image) : "-") },
|
|
8464
8402
|
TIMEOUT: { value: (s$1) => {
|
|
8465
8403
|
if (s$1.expiresAt != null) return timeAgo(s$1.expiresAt);
|
|
8466
8404
|
if (s$1.timeout != null) return timeAgo(s$1.createdAt + s$1.timeout);
|
|
8467
8405
|
return "-";
|
|
8468
8406
|
} },
|
|
8469
8407
|
SNAPSHOT: { value: (s$1) => s$1.currentSnapshotId ?? "-" },
|
|
8470
|
-
MOUNTS: { value: (s$1) => formatMounts(s$1.mounts) },
|
|
8471
8408
|
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(", ") : "-" }
|
|
8472
8409
|
};
|
|
8473
8410
|
if (all) {
|
|
@@ -8490,15 +8427,11 @@ const SandboxStatusColor = {
|
|
|
8490
8427
|
snapshotting: source_default.blue,
|
|
8491
8428
|
aborted: source_default.gray.dim
|
|
8492
8429
|
};
|
|
8493
|
-
function formatMounts(mounts$1) {
|
|
8494
|
-
if (!mounts$1 || Object.keys(mounts$1).length === 0) return "-";
|
|
8495
|
-
return Object.entries(mounts$1).map(([path, mount]) => `${mount.drive}:${path}:${mount.mode ?? "read-write"}`).join(", ");
|
|
8496
|
-
}
|
|
8497
8430
|
|
|
8498
8431
|
//#endregion
|
|
8499
8432
|
//#region src/commands/connect.ts
|
|
8500
|
-
var import_cjs$
|
|
8501
|
-
const connect = import_cjs$
|
|
8433
|
+
var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8434
|
+
const connect = import_cjs$11.command({
|
|
8502
8435
|
name: "connect",
|
|
8503
8436
|
aliases: ["ssh", "shell"],
|
|
8504
8437
|
description: "Start an interactive shell in an existing sandbox",
|
|
@@ -8516,7 +8449,7 @@ const connect = import_cjs$13.command({
|
|
|
8516
8449
|
|
|
8517
8450
|
//#endregion
|
|
8518
8451
|
//#region src/commands/stop.ts
|
|
8519
|
-
var import_cjs$
|
|
8452
|
+
var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8520
8453
|
init_source();
|
|
8521
8454
|
function c(label, value) {
|
|
8522
8455
|
return {
|
|
@@ -8569,15 +8502,15 @@ function printStopResult(name, sandbox, sessionSnapshot) {
|
|
|
8569
8502
|
]] : []
|
|
8570
8503
|
]);
|
|
8571
8504
|
}
|
|
8572
|
-
const stop = import_cjs$
|
|
8505
|
+
const stop = import_cjs$10.command({
|
|
8573
8506
|
name: "stop",
|
|
8574
8507
|
description: "Stop the current session of one or more sandboxes",
|
|
8575
8508
|
args: {
|
|
8576
|
-
sandboxName: import_cjs$
|
|
8509
|
+
sandboxName: import_cjs$10.positional({
|
|
8577
8510
|
type: sandboxName,
|
|
8578
8511
|
description: "A sandbox name to stop"
|
|
8579
8512
|
}),
|
|
8580
|
-
sandboxNames: import_cjs$
|
|
8513
|
+
sandboxNames: import_cjs$10.restPositionals({
|
|
8581
8514
|
type: sandboxName,
|
|
8582
8515
|
description: "More sandboxes to stop"
|
|
8583
8516
|
}),
|
|
@@ -10899,17 +10832,17 @@ var Listr = class {
|
|
|
10899
10832
|
|
|
10900
10833
|
//#endregion
|
|
10901
10834
|
//#region src/commands/remove.ts
|
|
10902
|
-
var import_cjs$
|
|
10903
|
-
const remove = import_cjs$
|
|
10835
|
+
var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10836
|
+
const remove = import_cjs$9.command({
|
|
10904
10837
|
name: "remove",
|
|
10905
10838
|
aliases: ["rm"],
|
|
10906
10839
|
description: "Permanently remove one or more sandboxes",
|
|
10907
10840
|
args: {
|
|
10908
|
-
sandboxName: import_cjs$
|
|
10841
|
+
sandboxName: import_cjs$9.positional({
|
|
10909
10842
|
type: sandboxName,
|
|
10910
10843
|
description: "a sandbox name to remove"
|
|
10911
10844
|
}),
|
|
10912
|
-
sandboxNames: import_cjs$
|
|
10845
|
+
sandboxNames: import_cjs$9.restPositionals({
|
|
10913
10846
|
type: sandboxName,
|
|
10914
10847
|
description: "more sandboxes to remove"
|
|
10915
10848
|
}),
|
|
@@ -10937,7 +10870,7 @@ const remove = import_cjs$11.command({
|
|
|
10937
10870
|
|
|
10938
10871
|
//#endregion
|
|
10939
10872
|
//#region src/commands/cp.ts
|
|
10940
|
-
var import_cjs$
|
|
10873
|
+
var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10941
10874
|
init_source();
|
|
10942
10875
|
const parseLocalOrRemotePath = async (input) => {
|
|
10943
10876
|
const parts = input.split(":");
|
|
@@ -10959,18 +10892,18 @@ const parseLocalOrRemotePath = async (input) => {
|
|
|
10959
10892
|
path: input
|
|
10960
10893
|
};
|
|
10961
10894
|
};
|
|
10962
|
-
const localOrRemote = import_cjs$
|
|
10963
|
-
const cp = import_cjs$
|
|
10895
|
+
const localOrRemote = import_cjs$8.extendType(import_cjs$8.string, { from: parseLocalOrRemotePath });
|
|
10896
|
+
const cp = import_cjs$8.command({
|
|
10964
10897
|
name: "copy",
|
|
10965
10898
|
description: "Copy files between your local filesystem and a remote sandbox",
|
|
10966
10899
|
aliases: ["cp"],
|
|
10967
10900
|
args: {
|
|
10968
|
-
source: import_cjs$
|
|
10901
|
+
source: import_cjs$8.positional({
|
|
10969
10902
|
displayName: `src`,
|
|
10970
10903
|
description: `The source file to copy from local file system, or a sandbox_name:path from a remote sandbox`,
|
|
10971
10904
|
type: localOrRemote
|
|
10972
10905
|
}),
|
|
10973
|
-
dest: import_cjs$
|
|
10906
|
+
dest: import_cjs$8.positional({
|
|
10974
10907
|
displayName: `dst`,
|
|
10975
10908
|
description: `The destination file to copy to local file system, or a sandbox_name:path to a remote sandbox`,
|
|
10976
10909
|
type: localOrRemote
|
|
@@ -11017,10 +10950,10 @@ const cp = import_cjs$10.command({
|
|
|
11017
10950
|
|
|
11018
10951
|
//#endregion
|
|
11019
10952
|
//#region src/commands/logout.ts
|
|
11020
|
-
var import_cjs$
|
|
10953
|
+
var import_cjs$7 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11021
10954
|
init_source();
|
|
11022
10955
|
const debug = createDebugger("sandbox:logout");
|
|
11023
|
-
const logout = import_cjs$
|
|
10956
|
+
const logout = import_cjs$7.command({
|
|
11024
10957
|
name: "logout",
|
|
11025
10958
|
description: "Log out of the Sandbox CLI",
|
|
11026
10959
|
args: {},
|
|
@@ -11039,27 +10972,27 @@ const logout = import_cjs$9.command({
|
|
|
11039
10972
|
|
|
11040
10973
|
//#endregion
|
|
11041
10974
|
//#region src/commands/snapshot.ts
|
|
11042
|
-
var import_cjs$
|
|
10975
|
+
var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11043
10976
|
init_source();
|
|
11044
10977
|
var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
|
|
11045
10978
|
const args = {
|
|
11046
|
-
stop: import_cjs$
|
|
10979
|
+
stop: import_cjs$6.flag({
|
|
11047
10980
|
long: "stop",
|
|
11048
10981
|
description: "Confirm that the sandbox will be stopped when snapshotting"
|
|
11049
10982
|
}),
|
|
11050
|
-
silent: import_cjs$
|
|
10983
|
+
silent: import_cjs$6.flag({
|
|
11051
10984
|
long: "silent",
|
|
11052
10985
|
description: "Don't write snapshot ID to stdout"
|
|
11053
10986
|
}),
|
|
11054
|
-
expiration: import_cjs$
|
|
10987
|
+
expiration: import_cjs$6.option({
|
|
11055
10988
|
long: "expiration",
|
|
11056
|
-
type: import_cjs$
|
|
10989
|
+
type: import_cjs$6.optional(Duration),
|
|
11057
10990
|
description: "The expiration time of the snapshot. Use 0 for no expiration."
|
|
11058
10991
|
}),
|
|
11059
|
-
sandbox: import_cjs$
|
|
10992
|
+
sandbox: import_cjs$6.positional({ type: sandboxName }),
|
|
11060
10993
|
scope
|
|
11061
10994
|
};
|
|
11062
|
-
const snapshot = import_cjs$
|
|
10995
|
+
const snapshot = import_cjs$6.command({
|
|
11063
10996
|
name: "snapshot",
|
|
11064
10997
|
description: "Take a snapshot of the filesystem of a sandbox",
|
|
11065
10998
|
args,
|
|
@@ -11162,34 +11095,34 @@ function renderSnapshotTree(params) {
|
|
|
11162
11095
|
|
|
11163
11096
|
//#endregion
|
|
11164
11097
|
//#region src/commands/snapshots.ts
|
|
11165
|
-
var import_cjs$
|
|
11166
|
-
var import_cjs$
|
|
11098
|
+
var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11099
|
+
var import_cjs$5 = require_cjs();
|
|
11167
11100
|
init_source();
|
|
11168
|
-
const list$
|
|
11101
|
+
const list$2 = import_cjs$4.command({
|
|
11169
11102
|
name: "list",
|
|
11170
11103
|
aliases: ["ls"],
|
|
11171
11104
|
description: "List snapshots for the specified account and project.",
|
|
11172
11105
|
args: {
|
|
11173
11106
|
scope,
|
|
11174
|
-
name: import_cjs$
|
|
11175
|
-
type: import_cjs$
|
|
11107
|
+
name: import_cjs$4.option({
|
|
11108
|
+
type: import_cjs$4.optional(sandboxName),
|
|
11176
11109
|
long: "name",
|
|
11177
11110
|
description: "Filter snapshots by sandbox."
|
|
11178
11111
|
}),
|
|
11179
|
-
sortOrder: import_cjs$
|
|
11112
|
+
sortOrder: import_cjs$4.option({
|
|
11180
11113
|
long: "sort-order",
|
|
11181
11114
|
description: "Sort order. Options: asc, desc (default)",
|
|
11182
|
-
type: import_cjs$
|
|
11115
|
+
type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
|
|
11183
11116
|
}),
|
|
11184
|
-
limit: import_cjs$
|
|
11117
|
+
limit: import_cjs$4.option({
|
|
11185
11118
|
long: "limit",
|
|
11186
11119
|
description: "Maximum number of snapshots per page (default 50).",
|
|
11187
|
-
type: import_cjs$
|
|
11120
|
+
type: import_cjs$4.optional(import_cjs$4.number)
|
|
11188
11121
|
}),
|
|
11189
|
-
cursor: import_cjs$
|
|
11122
|
+
cursor: import_cjs$4.option({
|
|
11190
11123
|
long: "cursor",
|
|
11191
11124
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
11192
|
-
type: import_cjs$
|
|
11125
|
+
type: import_cjs$4.optional(import_cjs$4.string)
|
|
11193
11126
|
})
|
|
11194
11127
|
},
|
|
11195
11128
|
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, sortOrder, limit, cursor }) {
|
|
@@ -11229,12 +11162,12 @@ const list$3 = import_cjs$6.command({
|
|
|
11229
11162
|
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
11230
11163
|
}
|
|
11231
11164
|
});
|
|
11232
|
-
const get = import_cjs$
|
|
11165
|
+
const get = import_cjs$4.command({
|
|
11233
11166
|
name: "get",
|
|
11234
11167
|
description: "Get details of a snapshot.",
|
|
11235
11168
|
args: {
|
|
11236
11169
|
scope,
|
|
11237
|
-
snapshotId: import_cjs$
|
|
11170
|
+
snapshotId: import_cjs$4.positional({
|
|
11238
11171
|
type: snapshotId,
|
|
11239
11172
|
description: "Snapshot ID to retrieve"
|
|
11240
11173
|
})
|
|
@@ -11272,16 +11205,16 @@ const get = import_cjs$6.command({
|
|
|
11272
11205
|
}));
|
|
11273
11206
|
}
|
|
11274
11207
|
});
|
|
11275
|
-
const remove$
|
|
11208
|
+
const remove$1 = import_cjs$4.command({
|
|
11276
11209
|
name: "delete",
|
|
11277
11210
|
aliases: ["rm", "remove"],
|
|
11278
11211
|
description: "Delete one or more snapshots.",
|
|
11279
11212
|
args: {
|
|
11280
|
-
snapshotId: import_cjs$
|
|
11213
|
+
snapshotId: import_cjs$4.positional({
|
|
11281
11214
|
type: snapshotId,
|
|
11282
11215
|
description: "Snapshot ID to delete"
|
|
11283
11216
|
}),
|
|
11284
|
-
snapshotIds: import_cjs$
|
|
11217
|
+
snapshotIds: import_cjs$4.restPositionals({
|
|
11285
11218
|
type: snapshotId,
|
|
11286
11219
|
description: "More snapshots IDs to delete"
|
|
11287
11220
|
}),
|
|
@@ -11310,29 +11243,29 @@ const remove$2 = import_cjs$6.command({
|
|
|
11310
11243
|
}
|
|
11311
11244
|
}
|
|
11312
11245
|
});
|
|
11313
|
-
const tree = import_cjs$
|
|
11246
|
+
const tree = import_cjs$4.command({
|
|
11314
11247
|
name: "tree",
|
|
11315
11248
|
description: "Show the snapshot ancestry tree for a sandbox.",
|
|
11316
11249
|
args: {
|
|
11317
11250
|
scope,
|
|
11318
|
-
sandboxName: import_cjs$
|
|
11251
|
+
sandboxName: import_cjs$4.positional({
|
|
11319
11252
|
type: sandboxName,
|
|
11320
11253
|
description: "Sandbox name"
|
|
11321
11254
|
}),
|
|
11322
|
-
sortOrder: import_cjs$
|
|
11255
|
+
sortOrder: import_cjs$4.option({
|
|
11323
11256
|
long: "sort-order",
|
|
11324
11257
|
description: "Sort order. Options: asc, desc (default). 'desc' walks ancestors, 'asc' walks descendants. Requires --cursor.",
|
|
11325
|
-
type: import_cjs$
|
|
11258
|
+
type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
|
|
11326
11259
|
}),
|
|
11327
|
-
limit: import_cjs$
|
|
11260
|
+
limit: import_cjs$4.option({
|
|
11328
11261
|
long: "limit",
|
|
11329
11262
|
description: "Maximum number of snapshots per page (1–10, default 10).",
|
|
11330
|
-
type: import_cjs$
|
|
11263
|
+
type: import_cjs$4.optional(import_cjs$4.number)
|
|
11331
11264
|
}),
|
|
11332
|
-
cursor: import_cjs$
|
|
11265
|
+
cursor: import_cjs$4.option({
|
|
11333
11266
|
long: "cursor",
|
|
11334
11267
|
description: "Pagination cursor from a previous 'More ancestors' or 'More descendants' hint.",
|
|
11335
|
-
type: import_cjs$
|
|
11268
|
+
type: import_cjs$4.optional(import_cjs$4.string)
|
|
11336
11269
|
})
|
|
11337
11270
|
},
|
|
11338
11271
|
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxName: name, sortOrder, limit, cursor }) {
|
|
@@ -11453,14 +11386,14 @@ const tree = import_cjs$6.command({
|
|
|
11453
11386
|
if (result.descendants.pagination.next !== null) console.log(`More descendants: sandbox snapshots tree ${name} --sort-order asc${limitArg} --cursor ${result.descendants.pagination.next}`);
|
|
11454
11387
|
}
|
|
11455
11388
|
});
|
|
11456
|
-
const snapshots = (0, import_cjs$
|
|
11389
|
+
const snapshots = (0, import_cjs$5.subcommands)({
|
|
11457
11390
|
name: "snapshots",
|
|
11458
11391
|
description: "Manage sandbox snapshots",
|
|
11459
11392
|
cmds: {
|
|
11460
|
-
list: list$
|
|
11393
|
+
list: list$2,
|
|
11461
11394
|
get,
|
|
11462
11395
|
tree,
|
|
11463
|
-
delete: remove$
|
|
11396
|
+
delete: remove$1
|
|
11464
11397
|
}
|
|
11465
11398
|
});
|
|
11466
11399
|
const SnapshotStatusColor = new Map([
|
|
@@ -11471,37 +11404,37 @@ const SnapshotStatusColor = new Map([
|
|
|
11471
11404
|
|
|
11472
11405
|
//#endregion
|
|
11473
11406
|
//#region src/commands/sessions.ts
|
|
11474
|
-
var import_cjs$
|
|
11475
|
-
var import_cjs$
|
|
11407
|
+
var import_cjs$2 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11408
|
+
var import_cjs$3 = require_cjs();
|
|
11476
11409
|
init_source();
|
|
11477
|
-
const list$
|
|
11410
|
+
const list$1 = import_cjs$2.command({
|
|
11478
11411
|
name: "list",
|
|
11479
11412
|
aliases: ["ls"],
|
|
11480
11413
|
description: "List sessions from a sandbox",
|
|
11481
11414
|
args: {
|
|
11482
|
-
all: import_cjs$
|
|
11415
|
+
all: import_cjs$2.flag({
|
|
11483
11416
|
long: "all",
|
|
11484
11417
|
short: "a",
|
|
11485
11418
|
description: "Show all sessions (default shows just running)"
|
|
11486
11419
|
}),
|
|
11487
|
-
sandbox: import_cjs$
|
|
11420
|
+
sandbox: import_cjs$2.positional({
|
|
11488
11421
|
type: sandboxName,
|
|
11489
11422
|
description: "Sandbox name to list sessions for"
|
|
11490
11423
|
}),
|
|
11491
|
-
sortOrder: import_cjs$
|
|
11424
|
+
sortOrder: import_cjs$2.option({
|
|
11492
11425
|
long: "sort-order",
|
|
11493
11426
|
description: "Sort order. Options: asc, desc (default)",
|
|
11494
|
-
type: import_cjs$
|
|
11427
|
+
type: import_cjs$2.optional(import_cjs$2.oneOf(["asc", "desc"]))
|
|
11495
11428
|
}),
|
|
11496
|
-
limit: import_cjs$
|
|
11429
|
+
limit: import_cjs$2.option({
|
|
11497
11430
|
long: "limit",
|
|
11498
11431
|
description: "Maximum number of sessions per page (default 50).",
|
|
11499
|
-
type: import_cjs$
|
|
11432
|
+
type: import_cjs$2.optional(import_cjs$2.number)
|
|
11500
11433
|
}),
|
|
11501
|
-
cursor: import_cjs$
|
|
11434
|
+
cursor: import_cjs$2.option({
|
|
11502
11435
|
long: "cursor",
|
|
11503
11436
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
11504
|
-
type: import_cjs$
|
|
11437
|
+
type: import_cjs$2.optional(import_cjs$2.string)
|
|
11505
11438
|
}),
|
|
11506
11439
|
scope
|
|
11507
11440
|
},
|
|
@@ -11557,10 +11490,10 @@ const list$2 = import_cjs$4.command({
|
|
|
11557
11490
|
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
11558
11491
|
}
|
|
11559
11492
|
});
|
|
11560
|
-
const sessions = (0, import_cjs$
|
|
11493
|
+
const sessions = (0, import_cjs$3.subcommands)({
|
|
11561
11494
|
name: "sessions",
|
|
11562
11495
|
description: "Manage sandbox sessions",
|
|
11563
|
-
cmds: { list: list$
|
|
11496
|
+
cmds: { list: list$1 }
|
|
11564
11497
|
});
|
|
11565
11498
|
const SessionStatusColor = {
|
|
11566
11499
|
running: source_default.cyan,
|
|
@@ -11574,18 +11507,18 @@ const SessionStatusColor = {
|
|
|
11574
11507
|
|
|
11575
11508
|
//#endregion
|
|
11576
11509
|
//#region src/commands/config.ts
|
|
11577
|
-
var import_cjs$
|
|
11510
|
+
var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11578
11511
|
init_source();
|
|
11579
11512
|
var import_ms = /* @__PURE__ */ __toESM(require_ms());
|
|
11580
|
-
const vcpusCommand = import_cjs$
|
|
11513
|
+
const vcpusCommand = import_cjs$1.command({
|
|
11581
11514
|
name: "vcpus",
|
|
11582
11515
|
description: "Update the vCPU count of a sandbox",
|
|
11583
11516
|
args: {
|
|
11584
|
-
sandbox: import_cjs$
|
|
11517
|
+
sandbox: import_cjs$1.positional({
|
|
11585
11518
|
type: sandboxName,
|
|
11586
11519
|
description: "Sandbox name to update"
|
|
11587
11520
|
}),
|
|
11588
|
-
count: import_cjs$
|
|
11521
|
+
count: import_cjs$1.positional({
|
|
11589
11522
|
type: vcpusType,
|
|
11590
11523
|
description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
|
|
11591
11524
|
}),
|
|
@@ -11610,15 +11543,15 @@ const vcpusCommand = import_cjs$3.command({
|
|
|
11610
11543
|
}
|
|
11611
11544
|
}
|
|
11612
11545
|
});
|
|
11613
|
-
const timeoutCommand = import_cjs$
|
|
11546
|
+
const timeoutCommand = import_cjs$1.command({
|
|
11614
11547
|
name: "timeout",
|
|
11615
11548
|
description: "Update the timeout of a sandbox (will be applied to all new sessions)",
|
|
11616
11549
|
args: {
|
|
11617
|
-
sandbox: import_cjs$
|
|
11550
|
+
sandbox: import_cjs$1.positional({
|
|
11618
11551
|
type: sandboxName,
|
|
11619
11552
|
description: "Sandbox name to update"
|
|
11620
11553
|
}),
|
|
11621
|
-
duration: import_cjs$
|
|
11554
|
+
duration: import_cjs$1.positional({
|
|
11622
11555
|
type: Duration,
|
|
11623
11556
|
description: "The maximum duration a sandbox can run for. Example: 5m, 1h"
|
|
11624
11557
|
}),
|
|
@@ -11643,17 +11576,17 @@ const timeoutCommand = import_cjs$3.command({
|
|
|
11643
11576
|
}
|
|
11644
11577
|
}
|
|
11645
11578
|
});
|
|
11646
|
-
const persistentCommand = import_cjs$
|
|
11579
|
+
const persistentCommand = import_cjs$1.command({
|
|
11647
11580
|
name: "persistent",
|
|
11648
11581
|
description: "Enable or disable automatic restore of the filesystem between sessions",
|
|
11649
11582
|
args: {
|
|
11650
|
-
sandbox: import_cjs$
|
|
11583
|
+
sandbox: import_cjs$1.positional({
|
|
11651
11584
|
type: sandboxName,
|
|
11652
11585
|
description: "Sandbox name to update"
|
|
11653
11586
|
}),
|
|
11654
|
-
value: import_cjs$
|
|
11587
|
+
value: import_cjs$1.positional({
|
|
11655
11588
|
type: {
|
|
11656
|
-
...import_cjs$
|
|
11589
|
+
...import_cjs$1.oneOf(["true", "false"]),
|
|
11657
11590
|
displayName: "true|false"
|
|
11658
11591
|
},
|
|
11659
11592
|
description: "Enable or disable automatic restore of the filesystem between sessions"
|
|
@@ -11679,15 +11612,15 @@ const persistentCommand = import_cjs$3.command({
|
|
|
11679
11612
|
}
|
|
11680
11613
|
}
|
|
11681
11614
|
});
|
|
11682
|
-
const snapshotExpirationCommand = import_cjs$
|
|
11615
|
+
const snapshotExpirationCommand = import_cjs$1.command({
|
|
11683
11616
|
name: "snapshot-expiration",
|
|
11684
11617
|
description: "Update the default snapshot expiration of a sandbox",
|
|
11685
11618
|
args: {
|
|
11686
|
-
sandbox: import_cjs$
|
|
11619
|
+
sandbox: import_cjs$1.positional({
|
|
11687
11620
|
type: sandboxName,
|
|
11688
11621
|
description: "Sandbox name to update"
|
|
11689
11622
|
}),
|
|
11690
|
-
duration: import_cjs$
|
|
11623
|
+
duration: import_cjs$1.positional({
|
|
11691
11624
|
type: SnapshotExpiration,
|
|
11692
11625
|
description: "Snapshot expiration duration (e.g. 7d, 30d) or \"none\" for no expiration"
|
|
11693
11626
|
}),
|
|
@@ -11713,22 +11646,22 @@ const snapshotExpirationCommand = import_cjs$3.command({
|
|
|
11713
11646
|
}
|
|
11714
11647
|
}
|
|
11715
11648
|
});
|
|
11716
|
-
const keepLastCountType = import_cjs$
|
|
11649
|
+
const keepLastCountType = import_cjs$1.extendType(import_cjs$1.number, {
|
|
11717
11650
|
displayName: "COUNT",
|
|
11718
11651
|
async from(n) {
|
|
11719
11652
|
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).`);
|
|
11720
11653
|
return n;
|
|
11721
11654
|
}
|
|
11722
11655
|
});
|
|
11723
|
-
const keepLastSnapshotsCommand = import_cjs$
|
|
11656
|
+
const keepLastSnapshotsCommand = import_cjs$1.command({
|
|
11724
11657
|
name: "keep-last-snapshots",
|
|
11725
11658
|
description: "Update the snapshot retention policy (keep only the N most recent snapshots) of a sandbox",
|
|
11726
11659
|
args: {
|
|
11727
|
-
sandbox: import_cjs$
|
|
11660
|
+
sandbox: import_cjs$1.positional({
|
|
11728
11661
|
type: sandboxName,
|
|
11729
11662
|
description: "Sandbox name to update"
|
|
11730
11663
|
}),
|
|
11731
|
-
count: import_cjs$
|
|
11664
|
+
count: import_cjs$1.positional({
|
|
11732
11665
|
type: keepLastCountType,
|
|
11733
11666
|
description: "Number of most recent snapshots to keep (1-10). Pass 0 to remove the policy."
|
|
11734
11667
|
}),
|
|
@@ -11761,15 +11694,15 @@ const keepLastSnapshotsCommand = import_cjs$3.command({
|
|
|
11761
11694
|
}
|
|
11762
11695
|
}
|
|
11763
11696
|
});
|
|
11764
|
-
const keepLastSnapshotsForCommand = import_cjs$
|
|
11697
|
+
const keepLastSnapshotsForCommand = import_cjs$1.command({
|
|
11765
11698
|
name: "keep-last-snapshots-for",
|
|
11766
11699
|
description: "Update the expiration applied to snapshots kept by the retention policy",
|
|
11767
11700
|
args: {
|
|
11768
|
-
sandbox: import_cjs$
|
|
11701
|
+
sandbox: import_cjs$1.positional({
|
|
11769
11702
|
type: sandboxName,
|
|
11770
11703
|
description: "Sandbox name to update"
|
|
11771
11704
|
}),
|
|
11772
|
-
duration: import_cjs$
|
|
11705
|
+
duration: import_cjs$1.positional({
|
|
11773
11706
|
type: SnapshotExpiration,
|
|
11774
11707
|
description: "Expiration for kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
11775
11708
|
}),
|
|
@@ -11801,17 +11734,17 @@ const keepLastSnapshotsForCommand = import_cjs$3.command({
|
|
|
11801
11734
|
}
|
|
11802
11735
|
}
|
|
11803
11736
|
});
|
|
11804
|
-
const deleteEvictedSnapshotsCommand = import_cjs$
|
|
11737
|
+
const deleteEvictedSnapshotsCommand = import_cjs$1.command({
|
|
11805
11738
|
name: "delete-evicted-snapshots",
|
|
11806
11739
|
description: "When \"true\" (the default), snapshots evicted by the keep-last-snapshots policy are deleted immediately; when \"false\", they keep the default expiration.",
|
|
11807
11740
|
args: {
|
|
11808
|
-
sandbox: import_cjs$
|
|
11741
|
+
sandbox: import_cjs$1.positional({
|
|
11809
11742
|
type: sandboxName,
|
|
11810
11743
|
description: "Sandbox name to update"
|
|
11811
11744
|
}),
|
|
11812
|
-
value: import_cjs$
|
|
11745
|
+
value: import_cjs$1.positional({
|
|
11813
11746
|
type: {
|
|
11814
|
-
...import_cjs$
|
|
11747
|
+
...import_cjs$1.oneOf(["true", "false"]),
|
|
11815
11748
|
displayName: "true|false"
|
|
11816
11749
|
},
|
|
11817
11750
|
description: "Whether to delete evicted snapshots immediately (\"true\") or let them keep the default expiration (\"false\")."
|
|
@@ -11843,15 +11776,15 @@ const deleteEvictedSnapshotsCommand = import_cjs$3.command({
|
|
|
11843
11776
|
}
|
|
11844
11777
|
}
|
|
11845
11778
|
});
|
|
11846
|
-
const currentSnapshotCommand = import_cjs$
|
|
11779
|
+
const currentSnapshotCommand = import_cjs$1.command({
|
|
11847
11780
|
name: "current-snapshot",
|
|
11848
11781
|
description: "Update the current snapshot of a sandbox",
|
|
11849
11782
|
args: {
|
|
11850
|
-
sandbox: import_cjs$
|
|
11783
|
+
sandbox: import_cjs$1.positional({
|
|
11851
11784
|
type: sandboxName,
|
|
11852
11785
|
description: "Sandbox name to update"
|
|
11853
11786
|
}),
|
|
11854
|
-
snapshotId: import_cjs$
|
|
11787
|
+
snapshotId: import_cjs$1.positional({
|
|
11855
11788
|
type: snapshotId,
|
|
11856
11789
|
description: "Snapshot ID to set as the current snapshot"
|
|
11857
11790
|
}),
|
|
@@ -11877,11 +11810,11 @@ const currentSnapshotCommand = import_cjs$3.command({
|
|
|
11877
11810
|
}
|
|
11878
11811
|
}
|
|
11879
11812
|
});
|
|
11880
|
-
const portsCommand = import_cjs$
|
|
11813
|
+
const portsCommand = import_cjs$1.command({
|
|
11881
11814
|
name: "ports",
|
|
11882
11815
|
description: "Update the published ports of a sandbox. Replaces all existing published ports.",
|
|
11883
11816
|
args: {
|
|
11884
|
-
sandbox: import_cjs$
|
|
11817
|
+
sandbox: import_cjs$1.positional({
|
|
11885
11818
|
type: sandboxName,
|
|
11886
11819
|
description: "Sandbox name to update"
|
|
11887
11820
|
}),
|
|
@@ -11918,11 +11851,11 @@ const portsCommand = import_cjs$3.command({
|
|
|
11918
11851
|
}
|
|
11919
11852
|
}
|
|
11920
11853
|
});
|
|
11921
|
-
const listCommand = import_cjs$
|
|
11854
|
+
const listCommand = import_cjs$1.command({
|
|
11922
11855
|
name: "list",
|
|
11923
11856
|
description: "Display the current configuration of a sandbox",
|
|
11924
11857
|
args: {
|
|
11925
|
-
sandbox: import_cjs$
|
|
11858
|
+
sandbox: import_cjs$1.positional({
|
|
11926
11859
|
type: sandboxName,
|
|
11927
11860
|
description: "Sandbox name to inspect"
|
|
11928
11861
|
}),
|
|
@@ -11997,16 +11930,16 @@ const listCommand = import_cjs$3.command({
|
|
|
11997
11930
|
}));
|
|
11998
11931
|
}
|
|
11999
11932
|
});
|
|
12000
|
-
const networkPolicyCommand = import_cjs$
|
|
11933
|
+
const networkPolicyCommand = import_cjs$1.command({
|
|
12001
11934
|
name: "network-policy",
|
|
12002
11935
|
description: `Update the network policy of a sandbox`,
|
|
12003
11936
|
args: {
|
|
12004
|
-
sandbox: import_cjs$
|
|
11937
|
+
sandbox: import_cjs$1.positional({ type: sandboxName }),
|
|
12005
11938
|
...networkPolicyArgs,
|
|
12006
|
-
mode: import_cjs$
|
|
11939
|
+
mode: import_cjs$1.option({
|
|
12007
11940
|
long: "mode",
|
|
12008
11941
|
description: `Alias for --network-policy.`,
|
|
12009
|
-
type: import_cjs$
|
|
11942
|
+
type: import_cjs$1.optional(networkPolicyMode)
|
|
12010
11943
|
}),
|
|
12011
11944
|
scope
|
|
12012
11945
|
},
|
|
@@ -12038,15 +11971,15 @@ const networkPolicyCommand = import_cjs$3.command({
|
|
|
12038
11971
|
}
|
|
12039
11972
|
}
|
|
12040
11973
|
});
|
|
12041
|
-
const tagsCommand = import_cjs$
|
|
11974
|
+
const tagsCommand = import_cjs$1.command({
|
|
12042
11975
|
name: "tags",
|
|
12043
11976
|
description: "Update the tags of a sandbox. Replaces all existing tags with the provided tags.",
|
|
12044
11977
|
args: {
|
|
12045
|
-
sandbox: import_cjs$
|
|
11978
|
+
sandbox: import_cjs$1.positional({
|
|
12046
11979
|
type: sandboxName,
|
|
12047
11980
|
description: "Sandbox name to update"
|
|
12048
11981
|
}),
|
|
12049
|
-
tags: import_cjs$
|
|
11982
|
+
tags: import_cjs$1.multioption({
|
|
12050
11983
|
long: "tag",
|
|
12051
11984
|
short: "t",
|
|
12052
11985
|
type: ObjectFromKeyValue,
|
|
@@ -12095,7 +12028,7 @@ function formatPorts(sandbox) {
|
|
|
12095
12028
|
function getPublishedRoutes(sandbox) {
|
|
12096
12029
|
return sandbox.routes.filter((route) => route.port !== sandbox.interactivePort);
|
|
12097
12030
|
}
|
|
12098
|
-
const config = import_cjs$
|
|
12031
|
+
const config = import_cjs$1.subcommands({
|
|
12099
12032
|
name: "config",
|
|
12100
12033
|
description: "View and update sandbox configuration",
|
|
12101
12034
|
cmds: {
|
|
@@ -12114,181 +12047,6 @@ const config = import_cjs$3.subcommands({
|
|
|
12114
12047
|
}
|
|
12115
12048
|
});
|
|
12116
12049
|
|
|
12117
|
-
//#endregion
|
|
12118
|
-
//#region src/commands/drives.ts
|
|
12119
|
-
var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
|
|
12120
|
-
var import_cjs$2 = require_cjs();
|
|
12121
|
-
init_source();
|
|
12122
|
-
const list$1 = import_cjs$1.command({
|
|
12123
|
-
name: "list",
|
|
12124
|
-
aliases: ["ls"],
|
|
12125
|
-
description: "List drives for the specified account and project.",
|
|
12126
|
-
args: {
|
|
12127
|
-
scope,
|
|
12128
|
-
namePrefix: import_cjs$1.option({
|
|
12129
|
-
long: "name-prefix",
|
|
12130
|
-
description: "Filter drives by name prefix.",
|
|
12131
|
-
type: import_cjs$1.optional(import_cjs$1.string)
|
|
12132
|
-
}),
|
|
12133
|
-
sortOrder: import_cjs$1.option({
|
|
12134
|
-
long: "sort-order",
|
|
12135
|
-
description: "Sort order. Options: asc, desc (default).",
|
|
12136
|
-
type: import_cjs$1.optional(import_cjs$1.oneOf(["asc", "desc"]))
|
|
12137
|
-
}),
|
|
12138
|
-
limit: import_cjs$1.option({
|
|
12139
|
-
long: "limit",
|
|
12140
|
-
description: "Maximum number of drives per page (default 50).",
|
|
12141
|
-
type: import_cjs$1.optional(import_cjs$1.number)
|
|
12142
|
-
}),
|
|
12143
|
-
cursor: import_cjs$1.option({
|
|
12144
|
-
long: "cursor",
|
|
12145
|
-
description: "Pagination cursor from a previous 'More results' hint.",
|
|
12146
|
-
type: import_cjs$1.optional(import_cjs$1.string)
|
|
12147
|
-
})
|
|
12148
|
-
},
|
|
12149
|
-
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, namePrefix, sortOrder, limit, cursor }) {
|
|
12150
|
-
const { drives: drives$1, pagination } = await (async () => {
|
|
12151
|
-
try {
|
|
12152
|
-
var _usingCtx$1 = _usingCtx();
|
|
12153
|
-
const _spinner$1 = _usingCtx$1.u(acquireRelease(() => ora("Fetching drives...").start(), (s$1) => s$1.stop()));
|
|
12154
|
-
return driveClient.list({
|
|
12155
|
-
token: token$1,
|
|
12156
|
-
teamId: team$1,
|
|
12157
|
-
projectId: project$1,
|
|
12158
|
-
limit: limit ?? 50,
|
|
12159
|
-
...cursor && { cursor },
|
|
12160
|
-
...namePrefix && {
|
|
12161
|
-
namePrefix,
|
|
12162
|
-
sortBy: "name"
|
|
12163
|
-
},
|
|
12164
|
-
...sortOrder && { sortOrder }
|
|
12165
|
-
});
|
|
12166
|
-
} catch (_) {
|
|
12167
|
-
_usingCtx$1.e = _;
|
|
12168
|
-
} finally {
|
|
12169
|
-
_usingCtx$1.d();
|
|
12170
|
-
}
|
|
12171
|
-
})();
|
|
12172
|
-
printDrives(drives$1);
|
|
12173
|
-
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
12174
|
-
}
|
|
12175
|
-
});
|
|
12176
|
-
const getOrCreate = import_cjs$1.command({
|
|
12177
|
-
name: "get-or-create",
|
|
12178
|
-
description: "Create a drive if it does not already exist, or retrieve it.",
|
|
12179
|
-
args: {
|
|
12180
|
-
name: import_cjs$1.positional({
|
|
12181
|
-
type: driveName,
|
|
12182
|
-
description: "Drive name to create or retrieve"
|
|
12183
|
-
}),
|
|
12184
|
-
maxSize: import_cjs$1.option({
|
|
12185
|
-
long: "max-size",
|
|
12186
|
-
description: "Maximum drive size in bytes. If omitted, a default of 100 GiB is used.",
|
|
12187
|
-
type: import_cjs$1.optional(driveMaxSize)
|
|
12188
|
-
}),
|
|
12189
|
-
scope
|
|
12190
|
-
},
|
|
12191
|
-
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, maxSize }) {
|
|
12192
|
-
const drive = await (async () => {
|
|
12193
|
-
try {
|
|
12194
|
-
var _usingCtx3 = _usingCtx();
|
|
12195
|
-
const _spinner$1 = _usingCtx3.u(acquireRelease(() => ora("Creating drive...").start(), (s$1) => s$1.stop()));
|
|
12196
|
-
return driveClient.getOrCreate({
|
|
12197
|
-
token: token$1,
|
|
12198
|
-
teamId: team$1,
|
|
12199
|
-
projectId: project$1,
|
|
12200
|
-
name,
|
|
12201
|
-
maxSize
|
|
12202
|
-
});
|
|
12203
|
-
} catch (_) {
|
|
12204
|
-
_usingCtx3.e = _;
|
|
12205
|
-
} finally {
|
|
12206
|
-
_usingCtx3.d();
|
|
12207
|
-
}
|
|
12208
|
-
})();
|
|
12209
|
-
process.stderr.write("✅ Drive " + source_default.cyan(drive.name) + " ready.\n");
|
|
12210
|
-
process.stderr.write(source_default.dim(" │ ") + "max size: " + source_default.cyan(formatDriveSize(drive)) + "\n");
|
|
12211
|
-
process.stderr.write(source_default.dim(" ╰ ") + "created: " + source_default.cyan(timeAgo(drive.createdAt)) + "\n");
|
|
12212
|
-
}
|
|
12213
|
-
});
|
|
12214
|
-
const remove$1 = import_cjs$1.command({
|
|
12215
|
-
name: "delete",
|
|
12216
|
-
aliases: ["rm", "remove"],
|
|
12217
|
-
description: "Delete one or more drives.",
|
|
12218
|
-
args: {
|
|
12219
|
-
name: import_cjs$1.positional({
|
|
12220
|
-
type: driveName,
|
|
12221
|
-
description: "Drive name to delete"
|
|
12222
|
-
}),
|
|
12223
|
-
names: import_cjs$1.restPositionals({
|
|
12224
|
-
type: driveName,
|
|
12225
|
-
description: "More drive names to delete"
|
|
12226
|
-
}),
|
|
12227
|
-
scope
|
|
12228
|
-
},
|
|
12229
|
-
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, names }) {
|
|
12230
|
-
const tasks = Array.from(new Set([name, ...names]), (driveName$1) => {
|
|
12231
|
-
return {
|
|
12232
|
-
title: `Deleting drive ${driveName$1}`,
|
|
12233
|
-
async task() {
|
|
12234
|
-
const drive = await getDriveByName({
|
|
12235
|
-
token: token$1,
|
|
12236
|
-
teamId: team$1,
|
|
12237
|
-
projectId: project$1,
|
|
12238
|
-
name: driveName$1
|
|
12239
|
-
});
|
|
12240
|
-
if (drive.currentSandboxName || drive.currentSessionId) throw new Error(`Drive ${driveName$1} is attached to a sandbox and cannot be deleted.`);
|
|
12241
|
-
await driveClient.delete(drive);
|
|
12242
|
-
}
|
|
12243
|
-
};
|
|
12244
|
-
});
|
|
12245
|
-
try {
|
|
12246
|
-
await new Listr(tasks, { concurrent: true }).run();
|
|
12247
|
-
} catch {
|
|
12248
|
-
process.exitCode = 1;
|
|
12249
|
-
}
|
|
12250
|
-
}
|
|
12251
|
-
});
|
|
12252
|
-
const drives = (0, import_cjs$2.subcommands)({
|
|
12253
|
-
name: "drives",
|
|
12254
|
-
description: "Manage sandbox drives",
|
|
12255
|
-
cmds: {
|
|
12256
|
-
list: list$1,
|
|
12257
|
-
"get-or-create": getOrCreate,
|
|
12258
|
-
delete: remove$1
|
|
12259
|
-
}
|
|
12260
|
-
});
|
|
12261
|
-
function printDrives(drives$1) {
|
|
12262
|
-
console.log(table({
|
|
12263
|
-
rows: drives$1,
|
|
12264
|
-
columns: {
|
|
12265
|
-
NAME: { value: (v) => v.name },
|
|
12266
|
-
CREATED: { value: (v) => timeAgo(v.createdAt) },
|
|
12267
|
-
UPDATED: { value: (v) => timeAgo(v.updatedAt) },
|
|
12268
|
-
SIZE: { value: formatDriveSize },
|
|
12269
|
-
["ATTACHED SANDBOX"]: { value: (v) => v.currentSandboxName ?? "-" },
|
|
12270
|
-
["ATTACHED SESSION"]: { value: (v) => v.currentSessionId ?? "-" }
|
|
12271
|
-
}
|
|
12272
|
-
}));
|
|
12273
|
-
}
|
|
12274
|
-
function formatDriveSize(drive) {
|
|
12275
|
-
return drive.maxSize === void 0 ? "-" : formatBytes(drive.maxSize);
|
|
12276
|
-
}
|
|
12277
|
-
async function getDriveByName({ token: token$1, teamId, projectId, name }) {
|
|
12278
|
-
const { drives: drives$1 } = await driveClient.list({
|
|
12279
|
-
token: token$1,
|
|
12280
|
-
teamId,
|
|
12281
|
-
projectId,
|
|
12282
|
-
namePrefix: name,
|
|
12283
|
-
sortBy: "name",
|
|
12284
|
-
sortOrder: "asc",
|
|
12285
|
-
limit: 50
|
|
12286
|
-
});
|
|
12287
|
-
const drive = drives$1.find((drive$1) => drive$1.name === name);
|
|
12288
|
-
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"));
|
|
12289
|
-
return drive;
|
|
12290
|
-
}
|
|
12291
|
-
|
|
12292
12050
|
//#endregion
|
|
12293
12051
|
//#region src/app.ts
|
|
12294
12052
|
var import_cjs = require_cjs();
|
|
@@ -12311,7 +12069,6 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
12311
12069
|
snapshot,
|
|
12312
12070
|
snapshots,
|
|
12313
12071
|
sessions,
|
|
12314
|
-
drives,
|
|
12315
12072
|
...!opts?.withoutAuth && {
|
|
12316
12073
|
login,
|
|
12317
12074
|
logout
|
|
@@ -12335,4 +12092,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
12335
12092
|
|
|
12336
12093
|
//#endregion
|
|
12337
12094
|
export { source_exports as a, init_source as i, printTopLevelError as n, require_cjs as r, app as t };
|
|
12338
|
-
//# sourceMappingURL=app-
|
|
12095
|
+
//# sourceMappingURL=app-COCOUOVi.mjs.map
|