sandbox 3.4.0 → 3.5.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.
- package/dist/{app-CsBNEDNb.mjs → app-CFX0H5jm.mjs} +501 -237
- package/dist/app-CFX0H5jm.mjs.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/sandbox.mjs +2 -11
- package/dist/sandbox.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/app-CsBNEDNb.mjs.map +0 -1
|
@@ -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, Sandbox, Snapshot, StreamError } from "@vercel/sandbox";
|
|
22
|
+
import { APIError, Drive, 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$4, 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$4.length;
|
|
487
487
|
for (i = 0; i < len; i++) {
|
|
488
|
-
candidate = list$
|
|
488
|
+
candidate = list$4[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$4[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$4;
|
|
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$4(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$34 = /* @__PURE__ */ __toESM(require_cjs());
|
|
2998
2998
|
const runtimeType = {
|
|
2999
|
-
...import_cjs$
|
|
2999
|
+
...import_cjs$34.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$34.option({
|
|
3008
3008
|
long: "runtime",
|
|
3009
|
-
type: import_cjs$
|
|
3009
|
+
type: import_cjs$34.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$33 = require_cjs();
|
|
3134
3134
|
init_source();
|
|
3135
|
-
const Duration = (0, import_cjs$
|
|
3135
|
+
const Duration = (0, import_cjs$33.extendType)(import_cjs$33.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$29.extendType)(import_cjs$29.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$32 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3152
|
+
const timeout = import_cjs$32.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$28.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$31 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3163
|
+
const vcpusType = import_cjs$31.extendType(import_cjs$31.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$31.option({
|
|
3171
3171
|
long: "vcpus",
|
|
3172
|
-
type: import_cjs$
|
|
3172
|
+
type: import_cjs$31.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$30 = /* @__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$30.command({
|
|
6755
6755
|
name: "login",
|
|
6756
6756
|
description: "Log in to the Sandbox CLI",
|
|
6757
6757
|
args: {},
|
|
@@ -6969,7 +6969,7 @@ 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$29 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6973
6973
|
init_source();
|
|
6974
6974
|
var import_dist = require_dist();
|
|
6975
6975
|
const debug$7 = createDebugger("sandbox:args:auth");
|
|
@@ -6986,11 +6986,11 @@ function isTokenFresh() {
|
|
|
6986
6986
|
function markTokenAsFresh() {
|
|
6987
6987
|
freshTokenAcquiredAt = Date.now();
|
|
6988
6988
|
}
|
|
6989
|
-
const token = import_cjs$
|
|
6989
|
+
const token = import_cjs$29.option({
|
|
6990
6990
|
long: "token",
|
|
6991
6991
|
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
6992
|
type: {
|
|
6993
|
-
...import_cjs$
|
|
6993
|
+
...import_cjs$29.string,
|
|
6994
6994
|
displayName: "pat_or_oidc",
|
|
6995
6995
|
defaultValueIsSerializable: false,
|
|
6996
6996
|
onMissing: async () => {
|
|
@@ -7173,30 +7173,30 @@ function getAuthFailureStatus(error) {
|
|
|
7173
7173
|
|
|
7174
7174
|
//#endregion
|
|
7175
7175
|
//#region src/args/scope.ts
|
|
7176
|
-
var import_cjs$
|
|
7176
|
+
var import_cjs$28 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7177
7177
|
init_source();
|
|
7178
7178
|
const debug$4 = createDebugger("sandbox:scope");
|
|
7179
|
-
const project = import_cjs$
|
|
7179
|
+
const project = import_cjs$28.option({
|
|
7180
7180
|
long: "project",
|
|
7181
7181
|
type: {
|
|
7182
|
-
...import_cjs$
|
|
7182
|
+
...import_cjs$28.optional(import_cjs$28.string),
|
|
7183
7183
|
displayName: "my-project"
|
|
7184
7184
|
},
|
|
7185
7185
|
description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
|
|
7186
7186
|
});
|
|
7187
7187
|
/** Parser for the `--team` option. */
|
|
7188
|
-
const teamParser = import_cjs$
|
|
7188
|
+
const teamParser = import_cjs$28.option({
|
|
7189
7189
|
long: "team",
|
|
7190
7190
|
type: {
|
|
7191
|
-
...import_cjs$
|
|
7191
|
+
...import_cjs$28.optional(import_cjs$28.string),
|
|
7192
7192
|
displayName: "my-team"
|
|
7193
7193
|
}
|
|
7194
7194
|
});
|
|
7195
7195
|
/** Parser for the `--scope` option. */
|
|
7196
|
-
const scopeParser = import_cjs$
|
|
7196
|
+
const scopeParser = import_cjs$28.option({
|
|
7197
7197
|
long: "scope",
|
|
7198
7198
|
type: {
|
|
7199
|
-
...import_cjs$
|
|
7199
|
+
...import_cjs$28.optional(import_cjs$28.string),
|
|
7200
7200
|
displayName: "my-team"
|
|
7201
7201
|
},
|
|
7202
7202
|
description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
|
|
@@ -7286,7 +7286,7 @@ const scope = {
|
|
|
7286
7286
|
|
|
7287
7287
|
//#endregion
|
|
7288
7288
|
//#region package.json
|
|
7289
|
-
var version = "3.
|
|
7289
|
+
var version = "3.5.0-beta.0";
|
|
7290
7290
|
|
|
7291
7291
|
//#endregion
|
|
7292
7292
|
//#region src/error.ts
|
|
@@ -7416,6 +7416,17 @@ const snapshotClient = {
|
|
|
7416
7416
|
...params
|
|
7417
7417
|
}))
|
|
7418
7418
|
};
|
|
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
|
+
};
|
|
7419
7430
|
const fetchWithUserAgent = (input, init$1) => {
|
|
7420
7431
|
const headers = new Headers(init$1?.headers ?? (input && typeof input === "object" && "headers" in input ? input?.headers : {}));
|
|
7421
7432
|
let agent = `vercel/sandbox-cli/${version}`;
|
|
@@ -7438,9 +7449,9 @@ async function withErrorHandling(factory) {
|
|
|
7438
7449
|
|
|
7439
7450
|
//#endregion
|
|
7440
7451
|
//#region src/args/snapshot-id.ts
|
|
7441
|
-
var import_cjs$
|
|
7452
|
+
var import_cjs$27 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7442
7453
|
init_source();
|
|
7443
|
-
const snapshotId = import_cjs$
|
|
7454
|
+
const snapshotId = import_cjs$27.extendType(import_cjs$27.string, {
|
|
7444
7455
|
displayName: "snapshot_id",
|
|
7445
7456
|
description: "The ID of the snapshot",
|
|
7446
7457
|
async from(s$1) {
|
|
@@ -7451,13 +7462,13 @@ const snapshotId = import_cjs$23.extendType(import_cjs$23.string, {
|
|
|
7451
7462
|
|
|
7452
7463
|
//#endregion
|
|
7453
7464
|
//#region src/args/ports.ts
|
|
7454
|
-
var import_cjs$
|
|
7465
|
+
var import_cjs$26 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7455
7466
|
init_source();
|
|
7456
|
-
const publishPorts = import_cjs$
|
|
7467
|
+
const publishPorts = import_cjs$26.multioption({
|
|
7457
7468
|
long: "publish-port",
|
|
7458
7469
|
short: "p",
|
|
7459
7470
|
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
7460
|
-
type: import_cjs$
|
|
7471
|
+
type: import_cjs$26.array(import_cjs$26.extendType(import_cjs$26.number, {
|
|
7461
7472
|
displayName: "PORT",
|
|
7462
7473
|
async from(number) {
|
|
7463
7474
|
if (!Number.isInteger(number) || number < 1024 || number > 65535) throw new Error([
|
|
@@ -7472,8 +7483,8 @@ const publishPorts = import_cjs$22.multioption({
|
|
|
7472
7483
|
|
|
7473
7484
|
//#endregion
|
|
7474
7485
|
//#region src/types/snapshot-expiration.ts
|
|
7475
|
-
var import_cjs$
|
|
7476
|
-
const SnapshotExpiration = (0, import_cjs$
|
|
7486
|
+
var import_cjs$25 = require_cjs();
|
|
7487
|
+
const SnapshotExpiration = (0, import_cjs$25.extendType)(import_cjs$25.string, {
|
|
7477
7488
|
displayName: "DURATION|none",
|
|
7478
7489
|
description: "A duration (e.g. 7d, 30d) or \"none\" for no expiration",
|
|
7479
7490
|
async from(value) {
|
|
@@ -7484,15 +7495,15 @@ const SnapshotExpiration = (0, import_cjs$21.extendType)(import_cjs$21.string, {
|
|
|
7484
7495
|
|
|
7485
7496
|
//#endregion
|
|
7486
7497
|
//#region src/args/snapshot-retention.ts
|
|
7487
|
-
var import_cjs$
|
|
7488
|
-
const snapshotExpiration = import_cjs$
|
|
7498
|
+
var import_cjs$24 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7499
|
+
const snapshotExpiration = import_cjs$24.option({
|
|
7489
7500
|
long: "snapshot-expiration",
|
|
7490
|
-
type: import_cjs$
|
|
7501
|
+
type: import_cjs$24.optional(SnapshotExpiration),
|
|
7491
7502
|
description: "Default snapshot expiration. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
7492
7503
|
});
|
|
7493
|
-
const keepLastSnapshots = import_cjs$
|
|
7504
|
+
const keepLastSnapshots = import_cjs$24.option({
|
|
7494
7505
|
long: "keep-last-snapshots",
|
|
7495
|
-
type: import_cjs$
|
|
7506
|
+
type: import_cjs$24.optional(import_cjs$24.extendType(import_cjs$24.number, {
|
|
7496
7507
|
displayName: "COUNT",
|
|
7497
7508
|
async from(n) {
|
|
7498
7509
|
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.`);
|
|
@@ -7501,15 +7512,15 @@ const keepLastSnapshots = import_cjs$20.option({
|
|
|
7501
7512
|
})),
|
|
7502
7513
|
description: "Keep only the N most recent snapshots of this sandbox (1-10)."
|
|
7503
7514
|
});
|
|
7504
|
-
const keepLastSnapshotsFor = import_cjs$
|
|
7515
|
+
const keepLastSnapshotsFor = import_cjs$24.option({
|
|
7505
7516
|
long: "keep-last-snapshots-for",
|
|
7506
|
-
type: import_cjs$
|
|
7517
|
+
type: import_cjs$24.optional(SnapshotExpiration),
|
|
7507
7518
|
description: "Expiration applied to kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
7508
7519
|
});
|
|
7509
|
-
const deleteEvictedSnapshots = import_cjs$
|
|
7520
|
+
const deleteEvictedSnapshots = import_cjs$24.option({
|
|
7510
7521
|
long: "delete-evicted-snapshots",
|
|
7511
|
-
type: import_cjs$
|
|
7512
|
-
...import_cjs$
|
|
7522
|
+
type: import_cjs$24.optional({
|
|
7523
|
+
...import_cjs$24.oneOf(["true", "false"]),
|
|
7513
7524
|
displayName: "true|false"
|
|
7514
7525
|
}),
|
|
7515
7526
|
description: "When \"true\" (the default), evicted snapshots are deleted immediately; when \"false\", they keep the default expiration."
|
|
@@ -7523,9 +7534,9 @@ const snapshotRetentionArgs = {
|
|
|
7523
7534
|
|
|
7524
7535
|
//#endregion
|
|
7525
7536
|
//#region src/args/sandbox-name.ts
|
|
7526
|
-
var import_cjs$
|
|
7537
|
+
var import_cjs$23 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7527
7538
|
init_source();
|
|
7528
|
-
const sandboxName = import_cjs$
|
|
7539
|
+
const sandboxName = import_cjs$23.extendType(import_cjs$23.string, {
|
|
7529
7540
|
displayName: "name",
|
|
7530
7541
|
description: "The name of the sandbox",
|
|
7531
7542
|
async from(s$1) {
|
|
@@ -7702,9 +7713,9 @@ function toEnvArray(env$2) {
|
|
|
7702
7713
|
|
|
7703
7714
|
//#endregion
|
|
7704
7715
|
//#region src/args/key-value-pair.ts
|
|
7705
|
-
var import_cjs$
|
|
7716
|
+
var import_cjs$22 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7706
7717
|
init_source();
|
|
7707
|
-
const KeyValuePair = import_cjs$
|
|
7718
|
+
const KeyValuePair = import_cjs$22.extendType(import_cjs$22.string, {
|
|
7708
7719
|
displayName: "key=value",
|
|
7709
7720
|
async from(input) {
|
|
7710
7721
|
if (!input.includes("=")) return {
|
|
@@ -7718,7 +7729,7 @@ const KeyValuePair = import_cjs$18.extendType(import_cjs$18.string, {
|
|
|
7718
7729
|
};
|
|
7719
7730
|
}
|
|
7720
7731
|
});
|
|
7721
|
-
const ObjectFromKeyValue = import_cjs$
|
|
7732
|
+
const ObjectFromKeyValue = import_cjs$22.extendType(import_cjs$22.array(KeyValuePair), { async from(input) {
|
|
7722
7733
|
const obj = Object.create(null);
|
|
7723
7734
|
const missingVars = [];
|
|
7724
7735
|
for (const { key, value } of input) if (value === void 0) missingVars.push(key);
|
|
@@ -7732,28 +7743,28 @@ const ObjectFromKeyValue = import_cjs$18.extendType(import_cjs$18.array(KeyValue
|
|
|
7732
7743
|
|
|
7733
7744
|
//#endregion
|
|
7734
7745
|
//#region src/commands/exec.ts
|
|
7735
|
-
var import_cjs$
|
|
7746
|
+
var import_cjs$21 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7736
7747
|
var import_ms$5 = /* @__PURE__ */ __toESM(require_ms());
|
|
7737
7748
|
init_source();
|
|
7738
7749
|
const args$4 = {
|
|
7739
|
-
sandbox: import_cjs$
|
|
7740
|
-
command: import_cjs$
|
|
7750
|
+
sandbox: import_cjs$21.positional({ type: sandboxName }),
|
|
7751
|
+
command: import_cjs$21.positional({
|
|
7741
7752
|
displayName: "command",
|
|
7742
7753
|
description: "The executable to invoke"
|
|
7743
7754
|
}),
|
|
7744
|
-
args: import_cjs$
|
|
7755
|
+
args: import_cjs$21.rest({
|
|
7745
7756
|
displayName: "args",
|
|
7746
7757
|
description: "arguments to pass to the command"
|
|
7747
7758
|
}),
|
|
7748
|
-
asSudo: import_cjs$
|
|
7759
|
+
asSudo: import_cjs$21.flag({
|
|
7749
7760
|
long: "sudo",
|
|
7750
7761
|
description: "Give extended privileges to the command."
|
|
7751
7762
|
}),
|
|
7752
|
-
interactive: import_cjs$
|
|
7763
|
+
interactive: import_cjs$21.flag({
|
|
7753
7764
|
long: "interactive",
|
|
7754
7765
|
short: "i",
|
|
7755
7766
|
description: "Run the command in a secure interactive shell",
|
|
7756
|
-
type: import_cjs$
|
|
7767
|
+
type: import_cjs$21.extendType(import_cjs$21.boolean, {
|
|
7757
7768
|
defaultValue() {
|
|
7758
7769
|
return false;
|
|
7759
7770
|
},
|
|
@@ -7763,35 +7774,35 @@ const args$4 = {
|
|
|
7763
7774
|
}
|
|
7764
7775
|
})
|
|
7765
7776
|
}),
|
|
7766
|
-
skipExtendingTimeout: import_cjs$
|
|
7777
|
+
skipExtendingTimeout: import_cjs$21.flag({
|
|
7767
7778
|
long: "no-extend-timeout",
|
|
7768
7779
|
description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
|
|
7769
7780
|
}),
|
|
7770
|
-
tty: import_cjs$
|
|
7781
|
+
tty: import_cjs$21.flag({
|
|
7771
7782
|
long: "tty",
|
|
7772
7783
|
short: "t",
|
|
7773
7784
|
description: "Allocate a tty for an interactive command. This is a no-op."
|
|
7774
7785
|
}),
|
|
7775
|
-
cwd: import_cjs$
|
|
7786
|
+
cwd: import_cjs$21.option({
|
|
7776
7787
|
long: "workdir",
|
|
7777
7788
|
short: "w",
|
|
7778
7789
|
description: "The working directory to run the command in",
|
|
7779
|
-
type: import_cjs$
|
|
7790
|
+
type: import_cjs$21.optional(import_cjs$21.string)
|
|
7780
7791
|
}),
|
|
7781
|
-
envVars: import_cjs$
|
|
7792
|
+
envVars: import_cjs$21.multioption({
|
|
7782
7793
|
long: "env",
|
|
7783
7794
|
short: "e",
|
|
7784
7795
|
type: ObjectFromKeyValue,
|
|
7785
7796
|
description: "Environment variables to set for the command"
|
|
7786
7797
|
}),
|
|
7787
|
-
timeout: import_cjs$
|
|
7798
|
+
timeout: import_cjs$21.option({
|
|
7788
7799
|
long: "timeout",
|
|
7789
|
-
type: import_cjs$
|
|
7800
|
+
type: import_cjs$21.optional(Duration),
|
|
7790
7801
|
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."
|
|
7791
7802
|
}),
|
|
7792
7803
|
scope
|
|
7793
7804
|
};
|
|
7794
|
-
const exec = import_cjs$
|
|
7805
|
+
const exec = import_cjs$21.command({
|
|
7795
7806
|
name: "exec",
|
|
7796
7807
|
description: "Execute a command in an existing sandbox",
|
|
7797
7808
|
args: args$4,
|
|
@@ -7832,9 +7843,9 @@ const exec = import_cjs$17.command({
|
|
|
7832
7843
|
|
|
7833
7844
|
//#endregion
|
|
7834
7845
|
//#region src/args/network-policy.ts
|
|
7835
|
-
var import_cjs$
|
|
7846
|
+
var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7836
7847
|
init_source();
|
|
7837
|
-
const networkPolicyMode = import_cjs$
|
|
7848
|
+
const networkPolicyMode = import_cjs$20.extendType(import_cjs$20.string, {
|
|
7838
7849
|
displayName: "MODE",
|
|
7839
7850
|
async from(value) {
|
|
7840
7851
|
const validModes = ["allow-all", "deny-all"];
|
|
@@ -7842,28 +7853,28 @@ const networkPolicyMode = import_cjs$16.extendType(import_cjs$16.string, {
|
|
|
7842
7853
|
return value;
|
|
7843
7854
|
}
|
|
7844
7855
|
});
|
|
7845
|
-
const networkPolicy = import_cjs$
|
|
7856
|
+
const networkPolicy = import_cjs$20.option({
|
|
7846
7857
|
long: "network-policy",
|
|
7847
7858
|
description: `Network policy mode: "allow-all" or "deny-all"
|
|
7848
7859
|
- allow-all: sandbox can access any website/domain
|
|
7849
7860
|
- deny-all: sandbox has no network access
|
|
7850
7861
|
Omit this option and use --allowed-domain / --allowed-cidr / --denied-cidr for custom policies.`,
|
|
7851
|
-
type: import_cjs$
|
|
7862
|
+
type: import_cjs$20.optional(networkPolicyMode)
|
|
7852
7863
|
});
|
|
7853
|
-
const allowedDomains = import_cjs$
|
|
7864
|
+
const allowedDomains = import_cjs$20.multioption({
|
|
7854
7865
|
long: "allowed-domain",
|
|
7855
7866
|
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.`,
|
|
7856
|
-
type: import_cjs$
|
|
7867
|
+
type: import_cjs$20.array(import_cjs$20.string)
|
|
7857
7868
|
});
|
|
7858
|
-
const allowedCIDRs = import_cjs$
|
|
7869
|
+
const allowedCIDRs = import_cjs$20.multioption({
|
|
7859
7870
|
long: "allowed-cidr",
|
|
7860
7871
|
description: `CIDR to allow traffic to (creates a custom network policy). Takes precedence over 'allowed-domain'.`,
|
|
7861
|
-
type: import_cjs$
|
|
7872
|
+
type: import_cjs$20.array(import_cjs$20.string)
|
|
7862
7873
|
});
|
|
7863
|
-
const deniedCIDRs = import_cjs$
|
|
7874
|
+
const deniedCIDRs = import_cjs$20.multioption({
|
|
7864
7875
|
long: "denied-cidr",
|
|
7865
7876
|
description: `CIDR to deny traffic to (creates a custom network policy). Takes precedence over allowed domains/CIDRs.`,
|
|
7866
|
-
type: import_cjs$
|
|
7877
|
+
type: import_cjs$20.array(import_cjs$20.string)
|
|
7867
7878
|
});
|
|
7868
7879
|
const networkPolicyArgs = {
|
|
7869
7880
|
networkPolicy,
|
|
@@ -7957,61 +7968,114 @@ function printSandboxSummary(opts) {
|
|
|
7957
7968
|
} else process.stderr.write(source_default.dim(" ╰ ") + "project: " + source_default.cyan(projectDisplay) + "\n");
|
|
7958
7969
|
}
|
|
7959
7970
|
|
|
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
|
+
|
|
7960
8023
|
//#endregion
|
|
7961
8024
|
//#region src/commands/create.ts
|
|
7962
|
-
var import_cjs$
|
|
8025
|
+
var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7963
8026
|
var import_ms$3 = /* @__PURE__ */ __toESM(require_ms());
|
|
7964
8027
|
init_source();
|
|
7965
8028
|
const args$3 = {
|
|
7966
|
-
name: import_cjs$
|
|
8029
|
+
name: import_cjs$18.option({
|
|
7967
8030
|
long: "name",
|
|
7968
8031
|
description: "A user-chosen name for the sandbox. It must be unique per project.",
|
|
7969
|
-
type: import_cjs$
|
|
8032
|
+
type: import_cjs$18.optional(import_cjs$18.string)
|
|
7970
8033
|
}),
|
|
7971
|
-
nonPersistent: import_cjs$
|
|
8034
|
+
nonPersistent: import_cjs$18.flag({
|
|
7972
8035
|
long: "non-persistent",
|
|
7973
8036
|
description: "Disable automatic restore of the filesystem between sessions."
|
|
7974
8037
|
}),
|
|
7975
8038
|
runtime,
|
|
7976
|
-
image: import_cjs$
|
|
8039
|
+
image: import_cjs$18.option({
|
|
7977
8040
|
long: "image",
|
|
7978
8041
|
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).",
|
|
7979
|
-
type: import_cjs$
|
|
8042
|
+
type: import_cjs$18.optional(import_cjs$18.string)
|
|
7980
8043
|
}),
|
|
7981
8044
|
timeout,
|
|
7982
8045
|
vcpus,
|
|
7983
8046
|
ports: publishPorts,
|
|
7984
|
-
silent: import_cjs$
|
|
8047
|
+
silent: import_cjs$18.flag({
|
|
7985
8048
|
long: "silent",
|
|
7986
8049
|
description: "Don't write sandbox name to stdout"
|
|
7987
8050
|
}),
|
|
7988
|
-
snapshot: import_cjs$
|
|
8051
|
+
snapshot: import_cjs$18.option({
|
|
7989
8052
|
long: "snapshot",
|
|
7990
8053
|
short: "s",
|
|
7991
8054
|
description: "Start the sandbox from a snapshot ID",
|
|
7992
|
-
type: import_cjs$
|
|
8055
|
+
type: import_cjs$18.optional(snapshotId)
|
|
7993
8056
|
}),
|
|
7994
|
-
connect: import_cjs$
|
|
8057
|
+
connect: import_cjs$18.flag({
|
|
7995
8058
|
long: "connect",
|
|
7996
8059
|
description: "Start an interactive shell session after creating the sandbox"
|
|
7997
8060
|
}),
|
|
7998
|
-
envVars: import_cjs$
|
|
8061
|
+
envVars: import_cjs$18.multioption({
|
|
7999
8062
|
long: "env",
|
|
8000
8063
|
short: "e",
|
|
8001
8064
|
type: ObjectFromKeyValue,
|
|
8002
8065
|
description: "Default environment variables for sandbox commands"
|
|
8003
8066
|
}),
|
|
8004
|
-
tags: import_cjs$
|
|
8067
|
+
tags: import_cjs$18.multioption({
|
|
8005
8068
|
long: "tag",
|
|
8006
8069
|
short: "t",
|
|
8007
8070
|
type: ObjectFromKeyValue,
|
|
8008
8071
|
description: "Key-value tags to associate with the sandbox (e.g. --tag env=staging)"
|
|
8009
8072
|
}),
|
|
8073
|
+
mounts,
|
|
8010
8074
|
...snapshotRetentionArgs,
|
|
8011
8075
|
...networkPolicyArgs,
|
|
8012
8076
|
scope
|
|
8013
8077
|
};
|
|
8014
|
-
const create = import_cjs$
|
|
8078
|
+
const create = import_cjs$18.command({
|
|
8015
8079
|
name: "create",
|
|
8016
8080
|
description: "Create a sandbox in the specified account and project.",
|
|
8017
8081
|
args: args$3,
|
|
@@ -8019,7 +8083,7 @@ const create = import_cjs$15.command({
|
|
|
8019
8083
|
description: "Create and connect to a sandbox without a network access",
|
|
8020
8084
|
command: `sandbox run --network-policy=none --connect`
|
|
8021
8085
|
}],
|
|
8022
|
-
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 }) {
|
|
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, 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 }) {
|
|
8023
8087
|
if (image && runtime$1) throw new Error("--image and --runtime cannot be used together.");
|
|
8024
8088
|
const networkPolicy$1 = buildNetworkPolicy({
|
|
8025
8089
|
networkPolicy: networkPolicyMode$1,
|
|
@@ -8035,6 +8099,7 @@ const create = import_cjs$15.command({
|
|
|
8035
8099
|
const persistent = !nonPersistent;
|
|
8036
8100
|
const resources = vcpus$1 ? { vcpus: vcpus$1 } : void 0;
|
|
8037
8101
|
const tagsObj = Object.keys(tags).length > 0 ? tags : void 0;
|
|
8102
|
+
const mountsObj = Object.keys(mounts$1).length > 0 ? mounts$1 : void 0;
|
|
8038
8103
|
const spinner = silent ? void 0 : ora("Creating sandbox...").start();
|
|
8039
8104
|
const sandbox = snapshot$1 ? await sandboxClient.create({
|
|
8040
8105
|
name,
|
|
@@ -8051,6 +8116,7 @@ const create = import_cjs$15.command({
|
|
|
8051
8116
|
networkPolicy: networkPolicy$1,
|
|
8052
8117
|
env: envVars,
|
|
8053
8118
|
tags: tagsObj,
|
|
8119
|
+
mounts: mountsObj,
|
|
8054
8120
|
persistent,
|
|
8055
8121
|
snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
|
|
8056
8122
|
keepLastSnapshots: keepLastSnapshotsPayload,
|
|
@@ -8067,6 +8133,7 @@ const create = import_cjs$15.command({
|
|
|
8067
8133
|
networkPolicy: networkPolicy$1,
|
|
8068
8134
|
env: envVars,
|
|
8069
8135
|
tags: tagsObj,
|
|
8136
|
+
mounts: mountsObj,
|
|
8070
8137
|
persistent,
|
|
8071
8138
|
snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
|
|
8072
8139
|
keepLastSnapshots: keepLastSnapshotsPayload,
|
|
@@ -8100,48 +8167,71 @@ const create = import_cjs$15.command({
|
|
|
8100
8167
|
}
|
|
8101
8168
|
});
|
|
8102
8169
|
|
|
8170
|
+
//#endregion
|
|
8171
|
+
//#region src/util/omit.ts
|
|
8172
|
+
function omit(obj, ...keys) {
|
|
8173
|
+
const result = { ...obj };
|
|
8174
|
+
for (const key of keys) delete result[key];
|
|
8175
|
+
return result;
|
|
8176
|
+
}
|
|
8177
|
+
|
|
8178
|
+
//#endregion
|
|
8179
|
+
//#region src/commands/sh.ts
|
|
8180
|
+
var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8181
|
+
const sh = import_cjs$17.command({
|
|
8182
|
+
name: "sh",
|
|
8183
|
+
description: "Create a sandbox and start an interactive shell",
|
|
8184
|
+
args: omit(args$3, "connect"),
|
|
8185
|
+
async handler(args$5) {
|
|
8186
|
+
return create.handler({
|
|
8187
|
+
...args$5,
|
|
8188
|
+
connect: true
|
|
8189
|
+
});
|
|
8190
|
+
}
|
|
8191
|
+
});
|
|
8192
|
+
|
|
8103
8193
|
//#endregion
|
|
8104
8194
|
//#region src/commands/fork.ts
|
|
8105
|
-
var import_cjs$
|
|
8195
|
+
var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8106
8196
|
var import_ms$2 = /* @__PURE__ */ __toESM(require_ms());
|
|
8107
8197
|
init_source();
|
|
8108
8198
|
const args$2 = {
|
|
8109
|
-
source: import_cjs$
|
|
8199
|
+
source: import_cjs$16.positional({
|
|
8110
8200
|
displayName: "source",
|
|
8111
8201
|
description: "Name of the source sandbox to fork from.",
|
|
8112
8202
|
type: sandboxName
|
|
8113
8203
|
}),
|
|
8114
|
-
name: import_cjs$
|
|
8204
|
+
name: import_cjs$16.option({
|
|
8115
8205
|
long: "name",
|
|
8116
8206
|
description: "A user-chosen name for the forked sandbox. Must be unique per project.",
|
|
8117
|
-
type: import_cjs$
|
|
8207
|
+
type: import_cjs$16.optional(import_cjs$16.string)
|
|
8118
8208
|
}),
|
|
8119
|
-
nonPersistent: import_cjs$
|
|
8209
|
+
nonPersistent: import_cjs$16.flag({
|
|
8120
8210
|
long: "non-persistent",
|
|
8121
8211
|
description: "Disable automatic restore of the filesystem between sessions."
|
|
8122
8212
|
}),
|
|
8123
|
-
timeout: import_cjs$
|
|
8213
|
+
timeout: import_cjs$16.option({
|
|
8124
8214
|
long: "timeout",
|
|
8125
|
-
type: import_cjs$
|
|
8215
|
+
type: import_cjs$16.optional(Duration),
|
|
8126
8216
|
description: "Override the maximum sandbox runtime (inherited from source if omitted). Example: 5m, 30m"
|
|
8127
8217
|
}),
|
|
8128
8218
|
vcpus,
|
|
8129
8219
|
ports: publishPorts,
|
|
8130
|
-
silent: import_cjs$
|
|
8220
|
+
silent: import_cjs$16.flag({
|
|
8131
8221
|
long: "silent",
|
|
8132
8222
|
description: "Don't write sandbox name to stdout"
|
|
8133
8223
|
}),
|
|
8134
|
-
connect: import_cjs$
|
|
8224
|
+
connect: import_cjs$16.flag({
|
|
8135
8225
|
long: "connect",
|
|
8136
8226
|
description: "Start an interactive shell session after creating the forked sandbox"
|
|
8137
8227
|
}),
|
|
8138
|
-
envVars: import_cjs$
|
|
8228
|
+
envVars: import_cjs$16.multioption({
|
|
8139
8229
|
long: "env",
|
|
8140
8230
|
short: "e",
|
|
8141
8231
|
type: ObjectFromKeyValue,
|
|
8142
8232
|
description: "Environment variables to set on the fork. Env vars from the source sandbox are not copied (encrypted server-side)."
|
|
8143
8233
|
}),
|
|
8144
|
-
tags: import_cjs$
|
|
8234
|
+
tags: import_cjs$16.multioption({
|
|
8145
8235
|
long: "tag",
|
|
8146
8236
|
short: "t",
|
|
8147
8237
|
type: ObjectFromKeyValue,
|
|
@@ -8151,7 +8241,7 @@ const args$2 = {
|
|
|
8151
8241
|
...networkPolicyArgs,
|
|
8152
8242
|
scope
|
|
8153
8243
|
};
|
|
8154
|
-
const fork = import_cjs$
|
|
8244
|
+
const fork = import_cjs$16.command({
|
|
8155
8245
|
name: "fork",
|
|
8156
8246
|
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.",
|
|
8157
8247
|
args: args$2,
|
|
@@ -8222,30 +8312,22 @@ const fork = import_cjs$14.command({
|
|
|
8222
8312
|
}
|
|
8223
8313
|
});
|
|
8224
8314
|
|
|
8225
|
-
//#endregion
|
|
8226
|
-
//#region src/util/omit.ts
|
|
8227
|
-
function omit(obj, ...keys) {
|
|
8228
|
-
const result = { ...obj };
|
|
8229
|
-
for (const key of keys) delete result[key];
|
|
8230
|
-
return result;
|
|
8231
|
-
}
|
|
8232
|
-
|
|
8233
8315
|
//#endregion
|
|
8234
8316
|
//#region src/commands/run.ts
|
|
8235
|
-
var import_cjs$
|
|
8317
|
+
var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8236
8318
|
const args$1 = {
|
|
8237
8319
|
...args$3,
|
|
8238
8320
|
...omit(args$4, "sandbox", "timeout"),
|
|
8239
|
-
removeAfterUse: import_cjs$
|
|
8321
|
+
removeAfterUse: import_cjs$15.flag({
|
|
8240
8322
|
long: "rm",
|
|
8241
8323
|
description: "Automatically remove the sandbox when the command exits."
|
|
8242
8324
|
}),
|
|
8243
|
-
stopAfterUse: import_cjs$
|
|
8325
|
+
stopAfterUse: import_cjs$15.flag({
|
|
8244
8326
|
long: "stop",
|
|
8245
8327
|
description: "Stop the sandbox when the command exits."
|
|
8246
8328
|
})
|
|
8247
8329
|
};
|
|
8248
|
-
const run = import_cjs$
|
|
8330
|
+
const run = import_cjs$15.command({
|
|
8249
8331
|
name: "run",
|
|
8250
8332
|
description: "Create and run a command in a sandbox",
|
|
8251
8333
|
args: args$1,
|
|
@@ -8287,51 +8369,51 @@ const run = import_cjs$13.command({
|
|
|
8287
8369
|
|
|
8288
8370
|
//#endregion
|
|
8289
8371
|
//#region src/commands/list.ts
|
|
8290
|
-
var import_cjs$
|
|
8372
|
+
var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8291
8373
|
init_source();
|
|
8292
|
-
const list = import_cjs$
|
|
8374
|
+
const list = import_cjs$14.command({
|
|
8293
8375
|
name: "list",
|
|
8294
8376
|
aliases: ["ls"],
|
|
8295
8377
|
description: "List all sandboxes for the specified account and project.",
|
|
8296
8378
|
args: {
|
|
8297
|
-
all: import_cjs$
|
|
8379
|
+
all: import_cjs$14.flag({
|
|
8298
8380
|
long: "all",
|
|
8299
8381
|
short: "a",
|
|
8300
8382
|
description: "Show all sandboxes (default shows just running)"
|
|
8301
8383
|
}),
|
|
8302
|
-
namePrefix: import_cjs$
|
|
8384
|
+
namePrefix: import_cjs$14.option({
|
|
8303
8385
|
long: "name-prefix",
|
|
8304
8386
|
description: "Filter sandboxes by name prefix",
|
|
8305
|
-
type: import_cjs$
|
|
8387
|
+
type: import_cjs$14.optional(import_cjs$14.string)
|
|
8306
8388
|
}),
|
|
8307
|
-
sortBy: import_cjs$
|
|
8389
|
+
sortBy: import_cjs$14.option({
|
|
8308
8390
|
long: "sort-by",
|
|
8309
8391
|
description: "Sort sandboxes by field. Options: createdAt (default), name, statusUpdatedAt",
|
|
8310
|
-
type: import_cjs$
|
|
8392
|
+
type: import_cjs$14.optional(import_cjs$14.oneOf([
|
|
8311
8393
|
"createdAt",
|
|
8312
8394
|
"name",
|
|
8313
8395
|
"statusUpdatedAt"
|
|
8314
8396
|
]))
|
|
8315
8397
|
}),
|
|
8316
|
-
sortOrder: import_cjs$
|
|
8398
|
+
sortOrder: import_cjs$14.option({
|
|
8317
8399
|
long: "sort-order",
|
|
8318
8400
|
description: "Sort order. Options: asc, desc (default)",
|
|
8319
|
-
type: import_cjs$
|
|
8401
|
+
type: import_cjs$14.optional(import_cjs$14.oneOf(["asc", "desc"]))
|
|
8320
8402
|
}),
|
|
8321
|
-
tags: import_cjs$
|
|
8403
|
+
tags: import_cjs$14.multioption({
|
|
8322
8404
|
long: "tag",
|
|
8323
8405
|
description: "Filter sandboxes by tag. Format: \"key=value\"",
|
|
8324
8406
|
type: ObjectFromKeyValue
|
|
8325
8407
|
}),
|
|
8326
|
-
limit: import_cjs$
|
|
8408
|
+
limit: import_cjs$14.option({
|
|
8327
8409
|
long: "limit",
|
|
8328
8410
|
description: "Maximum number of sandboxes per page (default 50).",
|
|
8329
|
-
type: import_cjs$
|
|
8411
|
+
type: import_cjs$14.optional(import_cjs$14.number)
|
|
8330
8412
|
}),
|
|
8331
|
-
cursor: import_cjs$
|
|
8413
|
+
cursor: import_cjs$14.option({
|
|
8332
8414
|
long: "cursor",
|
|
8333
8415
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
8334
|
-
type: import_cjs$
|
|
8416
|
+
type: import_cjs$14.optional(import_cjs$14.string)
|
|
8335
8417
|
}),
|
|
8336
8418
|
scope
|
|
8337
8419
|
},
|
|
@@ -8385,6 +8467,7 @@ const list = import_cjs$12.command({
|
|
|
8385
8467
|
return "-";
|
|
8386
8468
|
} },
|
|
8387
8469
|
SNAPSHOT: { value: (s$1) => s$1.currentSnapshotId ?? "-" },
|
|
8470
|
+
MOUNTS: { value: (s$1) => formatMounts(s$1.mounts) },
|
|
8388
8471
|
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(", ") : "-" }
|
|
8389
8472
|
};
|
|
8390
8473
|
if (all) {
|
|
@@ -8407,11 +8490,15 @@ const SandboxStatusColor = {
|
|
|
8407
8490
|
snapshotting: source_default.blue,
|
|
8408
8491
|
aborted: source_default.gray.dim
|
|
8409
8492
|
};
|
|
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
|
+
}
|
|
8410
8497
|
|
|
8411
8498
|
//#endregion
|
|
8412
8499
|
//#region src/commands/connect.ts
|
|
8413
|
-
var import_cjs$
|
|
8414
|
-
const connect = import_cjs$
|
|
8500
|
+
var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8501
|
+
const connect = import_cjs$13.command({
|
|
8415
8502
|
name: "connect",
|
|
8416
8503
|
aliases: ["ssh", "shell"],
|
|
8417
8504
|
description: "Start an interactive shell in an existing sandbox",
|
|
@@ -8429,7 +8516,7 @@ const connect = import_cjs$11.command({
|
|
|
8429
8516
|
|
|
8430
8517
|
//#endregion
|
|
8431
8518
|
//#region src/commands/stop.ts
|
|
8432
|
-
var import_cjs$
|
|
8519
|
+
var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
|
|
8433
8520
|
init_source();
|
|
8434
8521
|
function c(label, value) {
|
|
8435
8522
|
return {
|
|
@@ -8482,15 +8569,15 @@ function printStopResult(name, sandbox, sessionSnapshot) {
|
|
|
8482
8569
|
]] : []
|
|
8483
8570
|
]);
|
|
8484
8571
|
}
|
|
8485
|
-
const stop = import_cjs$
|
|
8572
|
+
const stop = import_cjs$12.command({
|
|
8486
8573
|
name: "stop",
|
|
8487
8574
|
description: "Stop the current session of one or more sandboxes",
|
|
8488
8575
|
args: {
|
|
8489
|
-
sandboxName: import_cjs$
|
|
8576
|
+
sandboxName: import_cjs$12.positional({
|
|
8490
8577
|
type: sandboxName,
|
|
8491
8578
|
description: "A sandbox name to stop"
|
|
8492
8579
|
}),
|
|
8493
|
-
sandboxNames: import_cjs$
|
|
8580
|
+
sandboxNames: import_cjs$12.restPositionals({
|
|
8494
8581
|
type: sandboxName,
|
|
8495
8582
|
description: "More sandboxes to stop"
|
|
8496
8583
|
}),
|
|
@@ -10812,17 +10899,17 @@ var Listr = class {
|
|
|
10812
10899
|
|
|
10813
10900
|
//#endregion
|
|
10814
10901
|
//#region src/commands/remove.ts
|
|
10815
|
-
var import_cjs$
|
|
10816
|
-
const remove = import_cjs$
|
|
10902
|
+
var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10903
|
+
const remove = import_cjs$11.command({
|
|
10817
10904
|
name: "remove",
|
|
10818
10905
|
aliases: ["rm"],
|
|
10819
10906
|
description: "Permanently remove one or more sandboxes",
|
|
10820
10907
|
args: {
|
|
10821
|
-
sandboxName: import_cjs$
|
|
10908
|
+
sandboxName: import_cjs$11.positional({
|
|
10822
10909
|
type: sandboxName,
|
|
10823
10910
|
description: "a sandbox name to remove"
|
|
10824
10911
|
}),
|
|
10825
|
-
sandboxNames: import_cjs$
|
|
10912
|
+
sandboxNames: import_cjs$11.restPositionals({
|
|
10826
10913
|
type: sandboxName,
|
|
10827
10914
|
description: "more sandboxes to remove"
|
|
10828
10915
|
}),
|
|
@@ -10850,7 +10937,7 @@ const remove = import_cjs$9.command({
|
|
|
10850
10937
|
|
|
10851
10938
|
//#endregion
|
|
10852
10939
|
//#region src/commands/cp.ts
|
|
10853
|
-
var import_cjs$
|
|
10940
|
+
var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10854
10941
|
init_source();
|
|
10855
10942
|
const parseLocalOrRemotePath = async (input) => {
|
|
10856
10943
|
const parts = input.split(":");
|
|
@@ -10872,18 +10959,18 @@ const parseLocalOrRemotePath = async (input) => {
|
|
|
10872
10959
|
path: input
|
|
10873
10960
|
};
|
|
10874
10961
|
};
|
|
10875
|
-
const localOrRemote = import_cjs$
|
|
10876
|
-
const cp = import_cjs$
|
|
10962
|
+
const localOrRemote = import_cjs$10.extendType(import_cjs$10.string, { from: parseLocalOrRemotePath });
|
|
10963
|
+
const cp = import_cjs$10.command({
|
|
10877
10964
|
name: "copy",
|
|
10878
10965
|
description: "Copy files between your local filesystem and a remote sandbox",
|
|
10879
10966
|
aliases: ["cp"],
|
|
10880
10967
|
args: {
|
|
10881
|
-
source: import_cjs$
|
|
10968
|
+
source: import_cjs$10.positional({
|
|
10882
10969
|
displayName: `src`,
|
|
10883
10970
|
description: `The source file to copy from local file system, or a sandbox_name:path from a remote sandbox`,
|
|
10884
10971
|
type: localOrRemote
|
|
10885
10972
|
}),
|
|
10886
|
-
dest: import_cjs$
|
|
10973
|
+
dest: import_cjs$10.positional({
|
|
10887
10974
|
displayName: `dst`,
|
|
10888
10975
|
description: `The destination file to copy to local file system, or a sandbox_name:path to a remote sandbox`,
|
|
10889
10976
|
type: localOrRemote
|
|
@@ -10930,10 +11017,10 @@ const cp = import_cjs$8.command({
|
|
|
10930
11017
|
|
|
10931
11018
|
//#endregion
|
|
10932
11019
|
//#region src/commands/logout.ts
|
|
10933
|
-
var import_cjs$
|
|
11020
|
+
var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10934
11021
|
init_source();
|
|
10935
11022
|
const debug = createDebugger("sandbox:logout");
|
|
10936
|
-
const logout = import_cjs$
|
|
11023
|
+
const logout = import_cjs$9.command({
|
|
10937
11024
|
name: "logout",
|
|
10938
11025
|
description: "Log out of the Sandbox CLI",
|
|
10939
11026
|
args: {},
|
|
@@ -10952,27 +11039,27 @@ const logout = import_cjs$7.command({
|
|
|
10952
11039
|
|
|
10953
11040
|
//#endregion
|
|
10954
11041
|
//#region src/commands/snapshot.ts
|
|
10955
|
-
var import_cjs$
|
|
11042
|
+
var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10956
11043
|
init_source();
|
|
10957
11044
|
var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
|
|
10958
11045
|
const args = {
|
|
10959
|
-
stop: import_cjs$
|
|
11046
|
+
stop: import_cjs$8.flag({
|
|
10960
11047
|
long: "stop",
|
|
10961
11048
|
description: "Confirm that the sandbox will be stopped when snapshotting"
|
|
10962
11049
|
}),
|
|
10963
|
-
silent: import_cjs$
|
|
11050
|
+
silent: import_cjs$8.flag({
|
|
10964
11051
|
long: "silent",
|
|
10965
11052
|
description: "Don't write snapshot ID to stdout"
|
|
10966
11053
|
}),
|
|
10967
|
-
expiration: import_cjs$
|
|
11054
|
+
expiration: import_cjs$8.option({
|
|
10968
11055
|
long: "expiration",
|
|
10969
|
-
type: import_cjs$
|
|
11056
|
+
type: import_cjs$8.optional(Duration),
|
|
10970
11057
|
description: "The expiration time of the snapshot. Use 0 for no expiration."
|
|
10971
11058
|
}),
|
|
10972
|
-
sandbox: import_cjs$
|
|
11059
|
+
sandbox: import_cjs$8.positional({ type: sandboxName }),
|
|
10973
11060
|
scope
|
|
10974
11061
|
};
|
|
10975
|
-
const snapshot = import_cjs$
|
|
11062
|
+
const snapshot = import_cjs$8.command({
|
|
10976
11063
|
name: "snapshot",
|
|
10977
11064
|
description: "Take a snapshot of the filesystem of a sandbox",
|
|
10978
11065
|
args,
|
|
@@ -11075,34 +11162,34 @@ function renderSnapshotTree(params) {
|
|
|
11075
11162
|
|
|
11076
11163
|
//#endregion
|
|
11077
11164
|
//#region src/commands/snapshots.ts
|
|
11078
|
-
var import_cjs$
|
|
11079
|
-
var import_cjs$
|
|
11165
|
+
var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11166
|
+
var import_cjs$7 = require_cjs();
|
|
11080
11167
|
init_source();
|
|
11081
|
-
const list$
|
|
11168
|
+
const list$3 = import_cjs$6.command({
|
|
11082
11169
|
name: "list",
|
|
11083
11170
|
aliases: ["ls"],
|
|
11084
11171
|
description: "List snapshots for the specified account and project.",
|
|
11085
11172
|
args: {
|
|
11086
11173
|
scope,
|
|
11087
|
-
name: import_cjs$
|
|
11088
|
-
type: import_cjs$
|
|
11174
|
+
name: import_cjs$6.option({
|
|
11175
|
+
type: import_cjs$6.optional(sandboxName),
|
|
11089
11176
|
long: "name",
|
|
11090
11177
|
description: "Filter snapshots by sandbox."
|
|
11091
11178
|
}),
|
|
11092
|
-
sortOrder: import_cjs$
|
|
11179
|
+
sortOrder: import_cjs$6.option({
|
|
11093
11180
|
long: "sort-order",
|
|
11094
11181
|
description: "Sort order. Options: asc, desc (default)",
|
|
11095
|
-
type: import_cjs$
|
|
11182
|
+
type: import_cjs$6.optional(import_cjs$6.oneOf(["asc", "desc"]))
|
|
11096
11183
|
}),
|
|
11097
|
-
limit: import_cjs$
|
|
11184
|
+
limit: import_cjs$6.option({
|
|
11098
11185
|
long: "limit",
|
|
11099
11186
|
description: "Maximum number of snapshots per page (default 50).",
|
|
11100
|
-
type: import_cjs$
|
|
11187
|
+
type: import_cjs$6.optional(import_cjs$6.number)
|
|
11101
11188
|
}),
|
|
11102
|
-
cursor: import_cjs$
|
|
11189
|
+
cursor: import_cjs$6.option({
|
|
11103
11190
|
long: "cursor",
|
|
11104
11191
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
11105
|
-
type: import_cjs$
|
|
11192
|
+
type: import_cjs$6.optional(import_cjs$6.string)
|
|
11106
11193
|
})
|
|
11107
11194
|
},
|
|
11108
11195
|
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, sortOrder, limit, cursor }) {
|
|
@@ -11142,12 +11229,12 @@ const list$2 = import_cjs$4.command({
|
|
|
11142
11229
|
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
11143
11230
|
}
|
|
11144
11231
|
});
|
|
11145
|
-
const get = import_cjs$
|
|
11232
|
+
const get = import_cjs$6.command({
|
|
11146
11233
|
name: "get",
|
|
11147
11234
|
description: "Get details of a snapshot.",
|
|
11148
11235
|
args: {
|
|
11149
11236
|
scope,
|
|
11150
|
-
snapshotId: import_cjs$
|
|
11237
|
+
snapshotId: import_cjs$6.positional({
|
|
11151
11238
|
type: snapshotId,
|
|
11152
11239
|
description: "Snapshot ID to retrieve"
|
|
11153
11240
|
})
|
|
@@ -11185,16 +11272,16 @@ const get = import_cjs$4.command({
|
|
|
11185
11272
|
}));
|
|
11186
11273
|
}
|
|
11187
11274
|
});
|
|
11188
|
-
const remove$
|
|
11275
|
+
const remove$2 = import_cjs$6.command({
|
|
11189
11276
|
name: "delete",
|
|
11190
11277
|
aliases: ["rm", "remove"],
|
|
11191
11278
|
description: "Delete one or more snapshots.",
|
|
11192
11279
|
args: {
|
|
11193
|
-
snapshotId: import_cjs$
|
|
11280
|
+
snapshotId: import_cjs$6.positional({
|
|
11194
11281
|
type: snapshotId,
|
|
11195
11282
|
description: "Snapshot ID to delete"
|
|
11196
11283
|
}),
|
|
11197
|
-
snapshotIds: import_cjs$
|
|
11284
|
+
snapshotIds: import_cjs$6.restPositionals({
|
|
11198
11285
|
type: snapshotId,
|
|
11199
11286
|
description: "More snapshots IDs to delete"
|
|
11200
11287
|
}),
|
|
@@ -11223,29 +11310,29 @@ const remove$1 = import_cjs$4.command({
|
|
|
11223
11310
|
}
|
|
11224
11311
|
}
|
|
11225
11312
|
});
|
|
11226
|
-
const tree = import_cjs$
|
|
11313
|
+
const tree = import_cjs$6.command({
|
|
11227
11314
|
name: "tree",
|
|
11228
11315
|
description: "Show the snapshot ancestry tree for a sandbox.",
|
|
11229
11316
|
args: {
|
|
11230
11317
|
scope,
|
|
11231
|
-
sandboxName: import_cjs$
|
|
11318
|
+
sandboxName: import_cjs$6.positional({
|
|
11232
11319
|
type: sandboxName,
|
|
11233
11320
|
description: "Sandbox name"
|
|
11234
11321
|
}),
|
|
11235
|
-
sortOrder: import_cjs$
|
|
11322
|
+
sortOrder: import_cjs$6.option({
|
|
11236
11323
|
long: "sort-order",
|
|
11237
11324
|
description: "Sort order. Options: asc, desc (default). 'desc' walks ancestors, 'asc' walks descendants. Requires --cursor.",
|
|
11238
|
-
type: import_cjs$
|
|
11325
|
+
type: import_cjs$6.optional(import_cjs$6.oneOf(["asc", "desc"]))
|
|
11239
11326
|
}),
|
|
11240
|
-
limit: import_cjs$
|
|
11327
|
+
limit: import_cjs$6.option({
|
|
11241
11328
|
long: "limit",
|
|
11242
11329
|
description: "Maximum number of snapshots per page (1–10, default 10).",
|
|
11243
|
-
type: import_cjs$
|
|
11330
|
+
type: import_cjs$6.optional(import_cjs$6.number)
|
|
11244
11331
|
}),
|
|
11245
|
-
cursor: import_cjs$
|
|
11332
|
+
cursor: import_cjs$6.option({
|
|
11246
11333
|
long: "cursor",
|
|
11247
11334
|
description: "Pagination cursor from a previous 'More ancestors' or 'More descendants' hint.",
|
|
11248
|
-
type: import_cjs$
|
|
11335
|
+
type: import_cjs$6.optional(import_cjs$6.string)
|
|
11249
11336
|
})
|
|
11250
11337
|
},
|
|
11251
11338
|
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxName: name, sortOrder, limit, cursor }) {
|
|
@@ -11366,14 +11453,14 @@ const tree = import_cjs$4.command({
|
|
|
11366
11453
|
if (result.descendants.pagination.next !== null) console.log(`More descendants: sandbox snapshots tree ${name} --sort-order asc${limitArg} --cursor ${result.descendants.pagination.next}`);
|
|
11367
11454
|
}
|
|
11368
11455
|
});
|
|
11369
|
-
const snapshots = (0, import_cjs$
|
|
11456
|
+
const snapshots = (0, import_cjs$7.subcommands)({
|
|
11370
11457
|
name: "snapshots",
|
|
11371
11458
|
description: "Manage sandbox snapshots",
|
|
11372
11459
|
cmds: {
|
|
11373
|
-
list: list$
|
|
11460
|
+
list: list$3,
|
|
11374
11461
|
get,
|
|
11375
11462
|
tree,
|
|
11376
|
-
delete: remove$
|
|
11463
|
+
delete: remove$2
|
|
11377
11464
|
}
|
|
11378
11465
|
});
|
|
11379
11466
|
const SnapshotStatusColor = new Map([
|
|
@@ -11384,37 +11471,37 @@ const SnapshotStatusColor = new Map([
|
|
|
11384
11471
|
|
|
11385
11472
|
//#endregion
|
|
11386
11473
|
//#region src/commands/sessions.ts
|
|
11387
|
-
var import_cjs$
|
|
11388
|
-
var import_cjs$
|
|
11474
|
+
var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11475
|
+
var import_cjs$5 = require_cjs();
|
|
11389
11476
|
init_source();
|
|
11390
|
-
const list$
|
|
11477
|
+
const list$2 = import_cjs$4.command({
|
|
11391
11478
|
name: "list",
|
|
11392
11479
|
aliases: ["ls"],
|
|
11393
11480
|
description: "List sessions from a sandbox",
|
|
11394
11481
|
args: {
|
|
11395
|
-
all: import_cjs$
|
|
11482
|
+
all: import_cjs$4.flag({
|
|
11396
11483
|
long: "all",
|
|
11397
11484
|
short: "a",
|
|
11398
11485
|
description: "Show all sessions (default shows just running)"
|
|
11399
11486
|
}),
|
|
11400
|
-
sandbox: import_cjs$
|
|
11487
|
+
sandbox: import_cjs$4.positional({
|
|
11401
11488
|
type: sandboxName,
|
|
11402
11489
|
description: "Sandbox name to list sessions for"
|
|
11403
11490
|
}),
|
|
11404
|
-
sortOrder: import_cjs$
|
|
11491
|
+
sortOrder: import_cjs$4.option({
|
|
11405
11492
|
long: "sort-order",
|
|
11406
11493
|
description: "Sort order. Options: asc, desc (default)",
|
|
11407
|
-
type: import_cjs$
|
|
11494
|
+
type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
|
|
11408
11495
|
}),
|
|
11409
|
-
limit: import_cjs$
|
|
11496
|
+
limit: import_cjs$4.option({
|
|
11410
11497
|
long: "limit",
|
|
11411
11498
|
description: "Maximum number of sessions per page (default 50).",
|
|
11412
|
-
type: import_cjs$
|
|
11499
|
+
type: import_cjs$4.optional(import_cjs$4.number)
|
|
11413
11500
|
}),
|
|
11414
|
-
cursor: import_cjs$
|
|
11501
|
+
cursor: import_cjs$4.option({
|
|
11415
11502
|
long: "cursor",
|
|
11416
11503
|
description: "Pagination cursor from a previous 'More results' hint.",
|
|
11417
|
-
type: import_cjs$
|
|
11504
|
+
type: import_cjs$4.optional(import_cjs$4.string)
|
|
11418
11505
|
}),
|
|
11419
11506
|
scope
|
|
11420
11507
|
},
|
|
@@ -11470,10 +11557,10 @@ const list$1 = import_cjs$2.command({
|
|
|
11470
11557
|
if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
|
|
11471
11558
|
}
|
|
11472
11559
|
});
|
|
11473
|
-
const sessions = (0, import_cjs$
|
|
11560
|
+
const sessions = (0, import_cjs$5.subcommands)({
|
|
11474
11561
|
name: "sessions",
|
|
11475
11562
|
description: "Manage sandbox sessions",
|
|
11476
|
-
cmds: { list: list$
|
|
11563
|
+
cmds: { list: list$2 }
|
|
11477
11564
|
});
|
|
11478
11565
|
const SessionStatusColor = {
|
|
11479
11566
|
running: source_default.cyan,
|
|
@@ -11487,18 +11574,18 @@ const SessionStatusColor = {
|
|
|
11487
11574
|
|
|
11488
11575
|
//#endregion
|
|
11489
11576
|
//#region src/commands/config.ts
|
|
11490
|
-
var import_cjs$
|
|
11577
|
+
var import_cjs$3 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11491
11578
|
init_source();
|
|
11492
11579
|
var import_ms = /* @__PURE__ */ __toESM(require_ms());
|
|
11493
|
-
const vcpusCommand = import_cjs$
|
|
11580
|
+
const vcpusCommand = import_cjs$3.command({
|
|
11494
11581
|
name: "vcpus",
|
|
11495
11582
|
description: "Update the vCPU count of a sandbox",
|
|
11496
11583
|
args: {
|
|
11497
|
-
sandbox: import_cjs$
|
|
11584
|
+
sandbox: import_cjs$3.positional({
|
|
11498
11585
|
type: sandboxName,
|
|
11499
11586
|
description: "Sandbox name to update"
|
|
11500
11587
|
}),
|
|
11501
|
-
count: import_cjs$
|
|
11588
|
+
count: import_cjs$3.positional({
|
|
11502
11589
|
type: vcpusType,
|
|
11503
11590
|
description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
|
|
11504
11591
|
}),
|
|
@@ -11523,15 +11610,15 @@ const vcpusCommand = import_cjs$1.command({
|
|
|
11523
11610
|
}
|
|
11524
11611
|
}
|
|
11525
11612
|
});
|
|
11526
|
-
const timeoutCommand = import_cjs$
|
|
11613
|
+
const timeoutCommand = import_cjs$3.command({
|
|
11527
11614
|
name: "timeout",
|
|
11528
11615
|
description: "Update the timeout of a sandbox (will be applied to all new sessions)",
|
|
11529
11616
|
args: {
|
|
11530
|
-
sandbox: import_cjs$
|
|
11617
|
+
sandbox: import_cjs$3.positional({
|
|
11531
11618
|
type: sandboxName,
|
|
11532
11619
|
description: "Sandbox name to update"
|
|
11533
11620
|
}),
|
|
11534
|
-
duration: import_cjs$
|
|
11621
|
+
duration: import_cjs$3.positional({
|
|
11535
11622
|
type: Duration,
|
|
11536
11623
|
description: "The maximum duration a sandbox can run for. Example: 5m, 1h"
|
|
11537
11624
|
}),
|
|
@@ -11556,17 +11643,17 @@ const timeoutCommand = import_cjs$1.command({
|
|
|
11556
11643
|
}
|
|
11557
11644
|
}
|
|
11558
11645
|
});
|
|
11559
|
-
const persistentCommand = import_cjs$
|
|
11646
|
+
const persistentCommand = import_cjs$3.command({
|
|
11560
11647
|
name: "persistent",
|
|
11561
11648
|
description: "Enable or disable automatic restore of the filesystem between sessions",
|
|
11562
11649
|
args: {
|
|
11563
|
-
sandbox: import_cjs$
|
|
11650
|
+
sandbox: import_cjs$3.positional({
|
|
11564
11651
|
type: sandboxName,
|
|
11565
11652
|
description: "Sandbox name to update"
|
|
11566
11653
|
}),
|
|
11567
|
-
value: import_cjs$
|
|
11654
|
+
value: import_cjs$3.positional({
|
|
11568
11655
|
type: {
|
|
11569
|
-
...import_cjs$
|
|
11656
|
+
...import_cjs$3.oneOf(["true", "false"]),
|
|
11570
11657
|
displayName: "true|false"
|
|
11571
11658
|
},
|
|
11572
11659
|
description: "Enable or disable automatic restore of the filesystem between sessions"
|
|
@@ -11592,15 +11679,15 @@ const persistentCommand = import_cjs$1.command({
|
|
|
11592
11679
|
}
|
|
11593
11680
|
}
|
|
11594
11681
|
});
|
|
11595
|
-
const snapshotExpirationCommand = import_cjs$
|
|
11682
|
+
const snapshotExpirationCommand = import_cjs$3.command({
|
|
11596
11683
|
name: "snapshot-expiration",
|
|
11597
11684
|
description: "Update the default snapshot expiration of a sandbox",
|
|
11598
11685
|
args: {
|
|
11599
|
-
sandbox: import_cjs$
|
|
11686
|
+
sandbox: import_cjs$3.positional({
|
|
11600
11687
|
type: sandboxName,
|
|
11601
11688
|
description: "Sandbox name to update"
|
|
11602
11689
|
}),
|
|
11603
|
-
duration: import_cjs$
|
|
11690
|
+
duration: import_cjs$3.positional({
|
|
11604
11691
|
type: SnapshotExpiration,
|
|
11605
11692
|
description: "Snapshot expiration duration (e.g. 7d, 30d) or \"none\" for no expiration"
|
|
11606
11693
|
}),
|
|
@@ -11626,22 +11713,22 @@ const snapshotExpirationCommand = import_cjs$1.command({
|
|
|
11626
11713
|
}
|
|
11627
11714
|
}
|
|
11628
11715
|
});
|
|
11629
|
-
const keepLastCountType = import_cjs$
|
|
11716
|
+
const keepLastCountType = import_cjs$3.extendType(import_cjs$3.number, {
|
|
11630
11717
|
displayName: "COUNT",
|
|
11631
11718
|
async from(n) {
|
|
11632
11719
|
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).`);
|
|
11633
11720
|
return n;
|
|
11634
11721
|
}
|
|
11635
11722
|
});
|
|
11636
|
-
const keepLastSnapshotsCommand = import_cjs$
|
|
11723
|
+
const keepLastSnapshotsCommand = import_cjs$3.command({
|
|
11637
11724
|
name: "keep-last-snapshots",
|
|
11638
11725
|
description: "Update the snapshot retention policy (keep only the N most recent snapshots) of a sandbox",
|
|
11639
11726
|
args: {
|
|
11640
|
-
sandbox: import_cjs$
|
|
11727
|
+
sandbox: import_cjs$3.positional({
|
|
11641
11728
|
type: sandboxName,
|
|
11642
11729
|
description: "Sandbox name to update"
|
|
11643
11730
|
}),
|
|
11644
|
-
count: import_cjs$
|
|
11731
|
+
count: import_cjs$3.positional({
|
|
11645
11732
|
type: keepLastCountType,
|
|
11646
11733
|
description: "Number of most recent snapshots to keep (1-10). Pass 0 to remove the policy."
|
|
11647
11734
|
}),
|
|
@@ -11674,15 +11761,15 @@ const keepLastSnapshotsCommand = import_cjs$1.command({
|
|
|
11674
11761
|
}
|
|
11675
11762
|
}
|
|
11676
11763
|
});
|
|
11677
|
-
const keepLastSnapshotsForCommand = import_cjs$
|
|
11764
|
+
const keepLastSnapshotsForCommand = import_cjs$3.command({
|
|
11678
11765
|
name: "keep-last-snapshots-for",
|
|
11679
11766
|
description: "Update the expiration applied to snapshots kept by the retention policy",
|
|
11680
11767
|
args: {
|
|
11681
|
-
sandbox: import_cjs$
|
|
11768
|
+
sandbox: import_cjs$3.positional({
|
|
11682
11769
|
type: sandboxName,
|
|
11683
11770
|
description: "Sandbox name to update"
|
|
11684
11771
|
}),
|
|
11685
|
-
duration: import_cjs$
|
|
11772
|
+
duration: import_cjs$3.positional({
|
|
11686
11773
|
type: SnapshotExpiration,
|
|
11687
11774
|
description: "Expiration for kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
|
|
11688
11775
|
}),
|
|
@@ -11714,17 +11801,17 @@ const keepLastSnapshotsForCommand = import_cjs$1.command({
|
|
|
11714
11801
|
}
|
|
11715
11802
|
}
|
|
11716
11803
|
});
|
|
11717
|
-
const deleteEvictedSnapshotsCommand = import_cjs$
|
|
11804
|
+
const deleteEvictedSnapshotsCommand = import_cjs$3.command({
|
|
11718
11805
|
name: "delete-evicted-snapshots",
|
|
11719
11806
|
description: "When \"true\" (the default), snapshots evicted by the keep-last-snapshots policy are deleted immediately; when \"false\", they keep the default expiration.",
|
|
11720
11807
|
args: {
|
|
11721
|
-
sandbox: import_cjs$
|
|
11808
|
+
sandbox: import_cjs$3.positional({
|
|
11722
11809
|
type: sandboxName,
|
|
11723
11810
|
description: "Sandbox name to update"
|
|
11724
11811
|
}),
|
|
11725
|
-
value: import_cjs$
|
|
11812
|
+
value: import_cjs$3.positional({
|
|
11726
11813
|
type: {
|
|
11727
|
-
...import_cjs$
|
|
11814
|
+
...import_cjs$3.oneOf(["true", "false"]),
|
|
11728
11815
|
displayName: "true|false"
|
|
11729
11816
|
},
|
|
11730
11817
|
description: "Whether to delete evicted snapshots immediately (\"true\") or let them keep the default expiration (\"false\")."
|
|
@@ -11756,15 +11843,15 @@ const deleteEvictedSnapshotsCommand = import_cjs$1.command({
|
|
|
11756
11843
|
}
|
|
11757
11844
|
}
|
|
11758
11845
|
});
|
|
11759
|
-
const currentSnapshotCommand = import_cjs$
|
|
11846
|
+
const currentSnapshotCommand = import_cjs$3.command({
|
|
11760
11847
|
name: "current-snapshot",
|
|
11761
11848
|
description: "Update the current snapshot of a sandbox",
|
|
11762
11849
|
args: {
|
|
11763
|
-
sandbox: import_cjs$
|
|
11850
|
+
sandbox: import_cjs$3.positional({
|
|
11764
11851
|
type: sandboxName,
|
|
11765
11852
|
description: "Sandbox name to update"
|
|
11766
11853
|
}),
|
|
11767
|
-
snapshotId: import_cjs$
|
|
11854
|
+
snapshotId: import_cjs$3.positional({
|
|
11768
11855
|
type: snapshotId,
|
|
11769
11856
|
description: "Snapshot ID to set as the current snapshot"
|
|
11770
11857
|
}),
|
|
@@ -11790,11 +11877,11 @@ const currentSnapshotCommand = import_cjs$1.command({
|
|
|
11790
11877
|
}
|
|
11791
11878
|
}
|
|
11792
11879
|
});
|
|
11793
|
-
const portsCommand = import_cjs$
|
|
11880
|
+
const portsCommand = import_cjs$3.command({
|
|
11794
11881
|
name: "ports",
|
|
11795
11882
|
description: "Update the published ports of a sandbox. Replaces all existing published ports.",
|
|
11796
11883
|
args: {
|
|
11797
|
-
sandbox: import_cjs$
|
|
11884
|
+
sandbox: import_cjs$3.positional({
|
|
11798
11885
|
type: sandboxName,
|
|
11799
11886
|
description: "Sandbox name to update"
|
|
11800
11887
|
}),
|
|
@@ -11831,11 +11918,11 @@ const portsCommand = import_cjs$1.command({
|
|
|
11831
11918
|
}
|
|
11832
11919
|
}
|
|
11833
11920
|
});
|
|
11834
|
-
const listCommand = import_cjs$
|
|
11921
|
+
const listCommand = import_cjs$3.command({
|
|
11835
11922
|
name: "list",
|
|
11836
11923
|
description: "Display the current configuration of a sandbox",
|
|
11837
11924
|
args: {
|
|
11838
|
-
sandbox: import_cjs$
|
|
11925
|
+
sandbox: import_cjs$3.positional({
|
|
11839
11926
|
type: sandboxName,
|
|
11840
11927
|
description: "Sandbox name to inspect"
|
|
11841
11928
|
}),
|
|
@@ -11910,16 +11997,16 @@ const listCommand = import_cjs$1.command({
|
|
|
11910
11997
|
}));
|
|
11911
11998
|
}
|
|
11912
11999
|
});
|
|
11913
|
-
const networkPolicyCommand = import_cjs$
|
|
12000
|
+
const networkPolicyCommand = import_cjs$3.command({
|
|
11914
12001
|
name: "network-policy",
|
|
11915
12002
|
description: `Update the network policy of a sandbox`,
|
|
11916
12003
|
args: {
|
|
11917
|
-
sandbox: import_cjs$
|
|
12004
|
+
sandbox: import_cjs$3.positional({ type: sandboxName }),
|
|
11918
12005
|
...networkPolicyArgs,
|
|
11919
|
-
mode: import_cjs$
|
|
12006
|
+
mode: import_cjs$3.option({
|
|
11920
12007
|
long: "mode",
|
|
11921
12008
|
description: `Alias for --network-policy.`,
|
|
11922
|
-
type: import_cjs$
|
|
12009
|
+
type: import_cjs$3.optional(networkPolicyMode)
|
|
11923
12010
|
}),
|
|
11924
12011
|
scope
|
|
11925
12012
|
},
|
|
@@ -11951,15 +12038,15 @@ const networkPolicyCommand = import_cjs$1.command({
|
|
|
11951
12038
|
}
|
|
11952
12039
|
}
|
|
11953
12040
|
});
|
|
11954
|
-
const tagsCommand = import_cjs$
|
|
12041
|
+
const tagsCommand = import_cjs$3.command({
|
|
11955
12042
|
name: "tags",
|
|
11956
12043
|
description: "Update the tags of a sandbox. Replaces all existing tags with the provided tags.",
|
|
11957
12044
|
args: {
|
|
11958
|
-
sandbox: import_cjs$
|
|
12045
|
+
sandbox: import_cjs$3.positional({
|
|
11959
12046
|
type: sandboxName,
|
|
11960
12047
|
description: "Sandbox name to update"
|
|
11961
12048
|
}),
|
|
11962
|
-
tags: import_cjs$
|
|
12049
|
+
tags: import_cjs$3.multioption({
|
|
11963
12050
|
long: "tag",
|
|
11964
12051
|
short: "t",
|
|
11965
12052
|
type: ObjectFromKeyValue,
|
|
@@ -12008,7 +12095,7 @@ function formatPorts(sandbox) {
|
|
|
12008
12095
|
function getPublishedRoutes(sandbox) {
|
|
12009
12096
|
return sandbox.routes.filter((route) => route.port !== sandbox.interactivePort);
|
|
12010
12097
|
}
|
|
12011
|
-
const config = import_cjs$
|
|
12098
|
+
const config = import_cjs$3.subcommands({
|
|
12012
12099
|
name: "config",
|
|
12013
12100
|
description: "View and update sandbox configuration",
|
|
12014
12101
|
cmds: {
|
|
@@ -12027,6 +12114,181 @@ const config = import_cjs$1.subcommands({
|
|
|
12027
12114
|
}
|
|
12028
12115
|
});
|
|
12029
12116
|
|
|
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
|
+
|
|
12030
12292
|
//#endregion
|
|
12031
12293
|
//#region src/app.ts
|
|
12032
12294
|
var import_cjs = require_cjs();
|
|
@@ -12037,6 +12299,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
12037
12299
|
cmds: {
|
|
12038
12300
|
list,
|
|
12039
12301
|
create,
|
|
12302
|
+
sh,
|
|
12040
12303
|
fork,
|
|
12041
12304
|
config,
|
|
12042
12305
|
copy: cp,
|
|
@@ -12048,6 +12311,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
12048
12311
|
snapshot,
|
|
12049
12312
|
snapshots,
|
|
12050
12313
|
sessions,
|
|
12314
|
+
drives,
|
|
12051
12315
|
...!opts?.withoutAuth && {
|
|
12052
12316
|
login,
|
|
12053
12317
|
logout
|
|
@@ -12056,7 +12320,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
12056
12320
|
examples: [
|
|
12057
12321
|
{
|
|
12058
12322
|
description: "Create a sandbox and start a shell",
|
|
12059
|
-
command: "sandbox
|
|
12323
|
+
command: "sandbox sh"
|
|
12060
12324
|
},
|
|
12061
12325
|
{
|
|
12062
12326
|
description: "Run a command in a new sandbox",
|
|
@@ -12071,4 +12335,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
12071
12335
|
|
|
12072
12336
|
//#endregion
|
|
12073
12337
|
export { source_exports as a, init_source as i, printTopLevelError as n, require_cjs as r, app as t };
|
|
12074
|
-
//# sourceMappingURL=app-
|
|
12338
|
+
//# sourceMappingURL=app-CFX0H5jm.mjs.map
|