sandcovery 0.4.0 → 0.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.
@@ -1,2531 +0,0 @@
1
- import { I as TaggedError, L as millis, R as seconds, z as toMillis } from "./Schema-CFI3ZMu8.mjs";
2
- import { D as CARD_FEE_TERMS, O as CREDIT_PURCHASE_MAX_MICRO_USD, _ as SandboxStatus, c as SpendLimit, j as MICRO_USD_PER_DOLLAR, k as CREDIT_PURCHASE_MIN_MICRO_USD, o as KeyKind, x as ProviderSort, y as DEFAULT_SLUG } from "./origin-BTx2gX8x.mjs";
3
- import fs from "node:fs";
4
- import path from "node:path";
5
- import crypto from "node:crypto";
6
- import os from "node:os";
7
- // ../cli-core/src/canceled.ts
8
- var Canceled = class extends TaggedError("Canceled") {};
9
- // ../cli-core/src/failure.ts
10
- const classExitCodes = {
11
- authentication: 1,
12
- bug: 1,
13
- config: 1,
14
- conflict: 1,
15
- limit: 1,
16
- missing_input: 2,
17
- network: 1,
18
- not_found: 1,
19
- permission: 1,
20
- platform: 1,
21
- rate_limit: 1,
22
- unknown_outcome: 1,
23
- usage: 2
24
- };
25
- const blockedClasses = /* @__PURE__ */ new Set([
26
- "authentication",
27
- "limit",
28
- "missing_input",
29
- "permission",
30
- "usage"
31
- ]);
32
- const reasons = {
33
- agreement_accepted: "conflict",
34
- agreement_changed: "conflict",
35
- agreement_not_accepted: "conflict",
36
- api_error: "platform",
37
- campaign_funding_active: "conflict",
38
- campaign_match_delivered: "conflict",
39
- campaign_request_denied: "conflict",
40
- campaign_status_locked: "conflict",
41
- concurrency_limit_reached: "limit",
42
- confirmation_required: "missing_input",
43
- conflict: "conflict",
44
- contract_locked: "conflict",
45
- domain_taken: "conflict",
46
- internal_error: "bug",
47
- invalid_arguments: "usage",
48
- invalid_config: "config",
49
- login_locked: "conflict",
50
- login_required: "authentication",
51
- market_information_locked: "conflict",
52
- missing_command: "usage",
53
- missing_installation: "missing_input",
54
- missing_job: "missing_input",
55
- missing_key: "missing_input",
56
- missing_path: "missing_input",
57
- missing_port: "missing_input",
58
- missing_provider: "missing_input",
59
- missing_query: "missing_input",
60
- missing_run: "missing_input",
61
- missing_sandbox: "missing_input",
62
- missing_site: "missing_input",
63
- missing_value: "missing_input",
64
- mode_not_entitled: "conflict",
65
- network_error: "network",
66
- no_contact: "not_found",
67
- no_provider_available: "platform",
68
- not_found: "not_found",
69
- out_of_credits: "limit",
70
- permission_denied: "permission",
71
- proof_not_found: "conflict",
72
- provider_error: "platform",
73
- rate_limited: "rate_limit",
74
- redirected: "network",
75
- site_exists: "conflict",
76
- site_taken: "conflict",
77
- site_unverified: "conflict",
78
- spawn_failed: "platform",
79
- spend_limit_reached: "limit",
80
- stale_login: "conflict",
81
- subscription_required: "limit",
82
- team_has_site: "conflict",
83
- token_expired: "authentication",
84
- token_scope_required: "permission",
85
- tool_refused: "conflict",
86
- turn_failed: "platform",
87
- unknown_command: "usage",
88
- unknown_option: "usage",
89
- unknown_outcome: "unknown_outcome",
90
- unsupported: "conflict"
91
- };
92
- var CliFailure = class extends TaggedError("CliFailure") {};
93
- const exitCodeOf = (reason) => classExitCodes[reasons[reason]];
94
- const statusOf = ({ blocked, reason }) => blocked === true || blockedClasses.has(reasons[reason]) ? "action_required" : "error";
95
- const usageFailure = ({ help, issues, message, reason = "invalid_arguments" }) => new CliFailure({
96
- issues,
97
- message,
98
- reason,
99
- recovery: [{
100
- instruction: "See all options",
101
- next: { argv: [...help, "--help"] }
102
- }]
103
- });
104
- // ../cli-core/src/characters.ts
105
- const between = (character, low, high) => character.length === 1 && character >= low && character <= high;
106
- const isDigit = (character) => between(character, "0", "9");
107
- const isUpper = (character) => between(character, "A", "Z");
108
- const isWordCharacter = (character) => isDigit(character) || isUpper(character) || between(character, "a", "z") || character === "_";
109
- const consistsOf = (text, allowed) => text !== "" && text.split("").every(allowed);
110
- const isDigits = (text) => consistsOf(text, isDigit);
111
- const codePoints = (text) => Array.from(text, (point) => point);
112
- // ../cli-core/src/sanitize.ts
113
- const ESC = 27;
114
- const BEL = 7;
115
- const TAB = 9;
116
- const LINE_FEED = 10;
117
- const CARRIAGE_RETURN = 13;
118
- const DELETE = 127;
119
- const C1_END = 159;
120
- const SPACE = 32;
121
- const CSI_FINAL_START = 64;
122
- const CSI_FINAL_END = 126;
123
- const C1_CSI = 155;
124
- const C1_OSC = 157;
125
- const C1_ST = 156;
126
- const stringIntroducers = /* @__PURE__ */ new Set([
127
- "P",
128
- "X",
129
- "^",
130
- "_"
131
- ]);
132
- const c1StringIntroducers = /* @__PURE__ */ new Set([
133
- 144,
134
- 152,
135
- 158,
136
- 159
137
- ]);
138
- const formatRanges = [
139
- [1564, 1564],
140
- [8203, 8207],
141
- [8234, 8238],
142
- [8288, 8303],
143
- [65279, 65279]
144
- ];
145
- const isFormatCharacter = (point) => formatRanges.some(([low, high]) => point >= low && point <= high);
146
- const keptControls = /* @__PURE__ */ new Set([
147
- TAB,
148
- LINE_FEED,
149
- CARRIAGE_RETURN
150
- ]);
151
- const isC0Control = (point) => point < SPACE && !keptControls.has(point);
152
- const isC1Control = (point) => point >= DELETE && point <= C1_END;
153
- const isStrippedControl = (point) => isC0Control(point) || isC1Control(point);
154
- const pointAt = (characters, index) => characters[index]?.codePointAt(0) ?? -1;
155
- const skipControlSequence = (characters, start) => {
156
- let index = start;
157
- while (index < characters.length) {
158
- const point = pointAt(characters, index);
159
- if (point >= CSI_FINAL_START && point <= CSI_FINAL_END) return index + 1;
160
- index += 1;
161
- }
162
- return index;
163
- };
164
- const skipUntilTerminator = (characters, start, { bell }) => {
165
- let index = start;
166
- while (index < characters.length) {
167
- const point = pointAt(characters, index);
168
- if (bell && point === BEL || point === C1_ST) return index + 1;
169
- if (point === ESC && characters[index + 1] === "\\") return index + 2;
170
- index += 1;
171
- }
172
- return index;
173
- };
174
- const skipEscape = (characters, start) => {
175
- const introducer = characters[start + 1];
176
- if (introducer === "[") return skipControlSequence(characters, start + 2);
177
- if (introducer === "]") return skipUntilTerminator(characters, start + 2, { bell: true });
178
- if (introducer !== void 0 && stringIntroducers.has(introducer)) return skipUntilTerminator(characters, start + 2, { bell: false });
179
- return Math.min(start + 2, characters.length);
180
- };
181
- const skipC1 = (characters, start, point) => {
182
- if (point === C1_CSI) return skipControlSequence(characters, start + 1);
183
- if (point === C1_OSC) return skipUntilTerminator(characters, start + 1, { bell: true });
184
- return c1StringIntroducers.has(point) ? skipUntilTerminator(characters, start + 1, { bell: false }) : start + 1;
185
- };
186
- const escapedPoint = (point) => point > 255 ? `\\u{${point.toString(16)}}` : `\\x${point.toString(16).padStart(2, "0")}`;
187
- const escapeUnprintable = (text) => codePoints(text).map((character) => {
188
- const point = character.codePointAt(0) ?? 0;
189
- return isStrippedControl(point) || isFormatCharacter(point) ? escapedPoint(point) : character;
190
- }).join("");
191
- const remoteText = (text) => {
192
- const characters = codePoints(text);
193
- const kept = [];
194
- let index = 0;
195
- while (index < characters.length) {
196
- const point = pointAt(characters, index);
197
- if (point === ESC) index = skipEscape(characters, index);
198
- else if (isC1Control(point)) index = skipC1(characters, index, point);
199
- else {
200
- if (!isStrippedControl(point) && !isFormatCharacter(point)) kept.push(characters[index] ?? "");
201
- index += 1;
202
- }
203
- }
204
- return kept.join("");
205
- };
206
- const remoteLine = (text) => remoteText(text).replaceAll("\r\n", "\\n").replaceAll("\n", "\\n").replaceAll("\r", "\\r");
207
- const remoteCell = ({ separated, text }) => {
208
- const tab = separated ? "\\t" : " ";
209
- return remoteLine(text).replaceAll(" ", () => tab);
210
- };
211
- // ../cli-core/src/theme.ts
212
- const weights = {
213
- bold: [1, 22],
214
- faint: [2, 22],
215
- underline: [4, 24]
216
- };
217
- const hues = {
218
- cyan: [36, 39],
219
- green: [32, 39],
220
- magenta: [35, 39],
221
- red: [31, 39],
222
- yellow: [33, 39]
223
- };
224
- const wrap = ([open, close], text) => `\u001B[${String(open)}m${text}\u001B[${String(close)}m`;
225
- const weighted = (style, weight, text) => style.rich && style.color ? wrap(weights[weight], text) : text;
226
- const tinted = (style, hue, text) => style.rich && style.color ? wrap(hues[hue], text) : text;
227
- const richGlyphs = {
228
- error: "✗",
229
- success: "✓",
230
- warning: "!"
231
- };
232
- const glyphHues = {
233
- error: "red",
234
- success: "green",
235
- warning: "yellow"
236
- };
237
- const glyph = (style, kind) => tinted(style, glyphHues[kind], richGlyphs[kind]);
238
- const plainPrefixes = {
239
- error: "Error:",
240
- warning: "Warning:"
241
- };
242
- const plainPrefix = (style, kind) => style.color ? wrap(hues[glyphHues[kind]], plainPrefixes[kind]) : plainPrefixes[kind];
243
- const ellipsis = (style) => style.rich ? "…" : "...";
244
- const theme = {
245
- command: (style, text) => tinted(style, "cyan", text),
246
- heading: (style, text) => style.rich && style.color ? wrap(weights.bold, wrap(hues.magenta, text)) : text,
247
- link: (style, text) => weighted(style, "underline", text),
248
- name: (style, text) => weighted(style, "bold", text),
249
- optional: (style, text) => weighted(style, "faint", text),
250
- outcome: (style, text) => weighted(style, "bold", text)
251
- };
252
- const SPINNER_FRAMES = [
253
- "⠋",
254
- "⠙",
255
- "⠹",
256
- "⠸",
257
- "⠼",
258
- "⠴",
259
- "⠦",
260
- "⠧",
261
- "⠇",
262
- "⠏"
263
- ];
264
- const spinnerFrame = (tick) => SPINNER_FRAMES[tick % SPINNER_FRAMES.length] ?? "";
265
- const clearLine = "\r\x1B[2K";
266
- // ../cli-core/src/parse.ts
267
- const distance = (left, right) => {
268
- const rightCharacters = codePoints(right);
269
- const previous = Array.from({ length: rightCharacters.length + 1 }, (_, index) => index);
270
- for (const [row, leftCharacter] of codePoints(left).entries()) {
271
- let diagonal = previous[0] ?? 0;
272
- previous[0] = row + 1;
273
- for (const [column, rightCharacter] of rightCharacters.entries()) {
274
- const above = previous[column + 1] ?? 0;
275
- const before = previous[column] ?? 0;
276
- previous[column + 1] = Math.min(above + 1, before + 1, diagonal + (leftCharacter === rightCharacter ? 0 : 1));
277
- diagonal = above;
278
- }
279
- }
280
- return previous[rightCharacters.length] ?? 0;
281
- };
282
- const closest = ({ candidates, token }) => {
283
- const limit = Math.max(1, Math.floor(token.length / 3));
284
- const [best, runnerUp] = candidates.flatMap((candidate) => {
285
- const score = distance(token, candidate);
286
- return score <= limit ? [{
287
- candidate,
288
- score
289
- }] : [];
290
- }).toSorted((left, right) => left.score - right.score);
291
- if (best === void 0 || runnerUp !== void 0 && runnerUp.score === best.score) return;
292
- return best.candidate;
293
- };
294
- const findOption = ({ name, options }) => options.find((option) => option.name === name);
295
- const gluedValue = ({ head, shorts }) => {
296
- const flags = [];
297
- for (const character of head.slice(1, -1)) {
298
- const option = shorts.get(character);
299
- if (option === void 0) return;
300
- flags.push(character);
301
- if (option.kind === "value") {
302
- const hint = option.hint ?? "<VALUE>";
303
- return {
304
- separated: [...flags.map((flag) => `-${flag}`), hint].join(" "),
305
- spelled: `-${flags.join("")}${hint}`
306
- };
307
- }
308
- }
309
- };
310
- const readShort = ({ explicit, head, options }) => {
311
- const shorts = new Map(options.flatMap((option) => option.short === void 0 ? [] : [[option.short, option]]));
312
- const glued = gluedValue({
313
- head,
314
- shorts
315
- });
316
- return {
317
- explicit,
318
- negated: false,
319
- option: head.length === 2 ? shorts.get(head.slice(1)) : void 0,
320
- spelled: glued?.spelled ?? head,
321
- suggestion: glued?.separated
322
- };
323
- };
324
- const readLong = ({ explicit, head, options }) => {
325
- const name = head.slice(2);
326
- const direct = findOption({
327
- name,
328
- options
329
- });
330
- if (direct !== void 0 || !name.startsWith("no-")) return {
331
- explicit,
332
- negated: false,
333
- option: direct,
334
- spelled: head
335
- };
336
- const negated = findOption({
337
- name: name.slice(3),
338
- options
339
- });
340
- const usable = negated?.negatable === true && negated.kind === "flag";
341
- return {
342
- explicit,
343
- negated: usable,
344
- option: usable ? negated : void 0,
345
- spelled: head
346
- };
347
- };
348
- const readOptionToken = ({ options, token }) => {
349
- const equals = token.indexOf("=");
350
- const head = equals === -1 ? token : token.slice(0, equals);
351
- const explicit = equals === -1 ? null : token.slice(equals + 1);
352
- const read = head.startsWith("--") ? readLong({
353
- explicit,
354
- head,
355
- options
356
- }) : readShort({
357
- explicit,
358
- head,
359
- options
360
- });
361
- if (read.option !== void 0) return read;
362
- const similar = closest({
363
- candidates: [...new Set(options.map((option) => `--${option.name}`))],
364
- token: head
365
- });
366
- return {
367
- ...read,
368
- suggestion: similar ?? read.suggestion
369
- };
370
- };
371
- const booleanText = /* @__PURE__ */ new Map([["false", false], ["true", true]]);
372
- const isOptionToken = (token) => token.startsWith("-") && token !== "-";
373
- const isOptionValue = (token) => !isOptionToken(token) || Number.isFinite(Number(token));
374
- const flagOf = (options, name) => {
375
- const value = options[name];
376
- return value?.kind === "flag" ? value.value : void 0;
377
- };
378
- const valuesOf = (options, name) => {
379
- const value = options[name];
380
- return value?.kind === "value" ? value.values : [];
381
- };
382
- const lastValue = (options, name) => valuesOf(options, name).at(-1);
383
- const rerunArgv = ({ arguments: positionals, options, path }) => {
384
- const flags = Object.entries(options).flatMap(([name, value]) => {
385
- if (name === "token") return [];
386
- if (value.kind === "flag") return [value.value ? `--${name}` : `--no-${name}`];
387
- return value.values.flatMap((text) => [`--${name}`, text]);
388
- });
389
- return [
390
- ...path,
391
- ...Object.values(positionals).flat(),
392
- ...flags
393
- ];
394
- };
395
- const record = (state, option, next) => {
396
- const previous = state.values.get(option.name);
397
- state.used.push(option.name);
398
- if (previous === void 0) {
399
- state.values.set(option.name, next);
400
- return;
401
- }
402
- const repeat = option.repeat ?? "error";
403
- if (repeat === "error") {
404
- state.issues.push({
405
- field: `--${option.name}`,
406
- message: `Can't use --${option.name} more than once.`,
407
- reason: "invalid_arguments"
408
- });
409
- return;
410
- }
411
- if (repeat === "append" && previous.kind === "value" && next.kind === "value") {
412
- state.values.set(option.name, {
413
- kind: "value",
414
- values: [...previous.values, ...next.values]
415
- });
416
- return;
417
- }
418
- state.values.set(option.name, next);
419
- };
420
- const takePositional = (state, token) => {
421
- state.positionals.push(token);
422
- state.index += 1;
423
- };
424
- const unknownOption = (state, read) => {
425
- const hint = read.suggestion === void 0 ? "" : ` Did you mean ${read.suggestion}?`;
426
- state.issues.push({
427
- field: read.spelled,
428
- message: `Unknown option ${read.spelled} for ${state.command}.${hint}`,
429
- reason: "unknown_option"
430
- });
431
- };
432
- const takeFlag = (state, read, option) => {
433
- const parsed = read.explicit === null ? !read.negated : booleanText.get(read.explicit.toLowerCase());
434
- if (parsed === void 0 || read.negated && read.explicit !== null) {
435
- state.issues.push({
436
- field: `--${option.name}`,
437
- message: `--${option.name} takes no value other than true or false.`,
438
- reason: "invalid_arguments"
439
- });
440
- return;
441
- }
442
- record(state, option, {
443
- kind: "flag",
444
- value: parsed
445
- });
446
- };
447
- const takeValue = (state, read, option) => {
448
- if (read.explicit !== null) {
449
- record(state, option, {
450
- kind: "value",
451
- values: [read.explicit]
452
- });
453
- return;
454
- }
455
- const next = state.tokens[state.index];
456
- if (next === void 0 || !isOptionValue(next)) {
457
- const example = option.hint === void 0 ? "" : `, such as ${option.hint}`;
458
- state.issues.push({
459
- field: `--${option.name}`,
460
- message: `--${option.name} needs a value${example}.`,
461
- reason: "invalid_arguments"
462
- });
463
- return;
464
- }
465
- record(state, option, {
466
- kind: "value",
467
- values: [next]
468
- });
469
- state.index += 1;
470
- };
471
- const takeOption = (state, token) => {
472
- const read = readOptionToken({
473
- options: state.options,
474
- token
475
- });
476
- state.index += 1;
477
- if (read.option === void 0) unknownOption(state, read);
478
- else if (read.option.kind === "flag") takeFlag(state, read, read.option);
479
- else takeValue(state, read, read.option);
480
- };
481
- const assignArguments = ({ argumentSpecs, command, issues, positionals }) => {
482
- const assigned = /* @__PURE__ */ new Map();
483
- let cursor = 0;
484
- for (const spec of argumentSpecs) {
485
- const taken = spec.variadic === true ? positionals.slice(cursor) : positionals.slice(cursor, cursor + 1);
486
- assigned.set(spec.name, taken);
487
- cursor += taken.length;
488
- if (spec.optional !== true && taken.length === 0) {
489
- const missing = spec.missing ?? {
490
- message: `Can't run ${command} without <${spec.name}>.`,
491
- reason: "invalid_arguments"
492
- };
493
- issues.push({
494
- field: `<${spec.name}>`,
495
- message: missing.message,
496
- reason: missing.reason
497
- });
498
- }
499
- }
500
- const extra = positionals.slice(cursor);
501
- if (extra.length > 0) issues.push({
502
- field: extra.join(" "),
503
- message: `Unexpected argument ${extra.join(" ")} for ${command}.`,
504
- reason: "invalid_arguments"
505
- });
506
- return Object.fromEntries(assigned);
507
- };
508
- const parseLeaf = ({ arguments: argumentSpecs, command, options, tokens }) => {
509
- const state = {
510
- command,
511
- index: 0,
512
- issues: [],
513
- literal: false,
514
- options,
515
- positionals: [],
516
- tokens,
517
- used: [],
518
- values: /* @__PURE__ */ new Map()
519
- };
520
- while (state.index < tokens.length) {
521
- const token = tokens[state.index] ?? "";
522
- if (state.literal || !isOptionToken(token)) takePositional(state, token);
523
- else if (token === "--") {
524
- state.literal = true;
525
- state.index += 1;
526
- } else takeOption(state, token);
527
- }
528
- const argumentIssues = [];
529
- const assigned = assignArguments({
530
- argumentSpecs,
531
- command,
532
- issues: argumentIssues,
533
- positionals: state.positionals
534
- });
535
- const unknown = state.issues.findIndex((issue) => issue.reason === "unknown_option");
536
- return {
537
- input: {
538
- arguments: assigned,
539
- options: Object.fromEntries(state.values),
540
- used: state.used
541
- },
542
- issues: unknown === -1 ? [...state.issues, ...argumentIssues] : state.issues.slice(0, unknown + 1)
543
- };
544
- };
545
- const parseFailure = ({ bin, issues, path }) => {
546
- const [first] = issues;
547
- const several = issues.length > 1;
548
- return usageFailure({
549
- help: path,
550
- issues: issues.map(({ field, message }) => ({
551
- field,
552
- message
553
- })),
554
- message: several ? `Can't run ${[bin, ...path].join(" ")}. ${String(issues.length)} inputs are invalid.` : first?.message ?? "",
555
- reason: first?.reason ?? "invalid_arguments"
556
- });
557
- };
558
- millis(50);
559
- toMillis(seconds(90));
560
- seconds(20);
561
- TaggedError("LockHeld");
562
- const configDirectory = ({ bin, cwd, override }) => override === void 0 ? path.join(os.homedir(), ".config", bin) : path.resolve(cwd ?? process.cwd(), override);
563
- const writePrivateFile = ({ file, text }) => {
564
- const directory = path.dirname(file);
565
- fs.mkdirSync(directory, {
566
- mode: 448,
567
- recursive: true
568
- });
569
- const pending = path.join(directory, `.${path.basename(file)}.${crypto.randomBytes(8).toString("hex")}.tmp`);
570
- fs.writeFileSync(pending, text, {
571
- flag: "wx",
572
- mode: 384
573
- });
574
- fs.renameSync(pending, file);
575
- };
576
- // package.json
577
- var version = "0.4.0";
578
- // src/cli/spec.ts
579
- const BIN = "sandcovery";
580
- const NULLABLE_TEXT = "string | null";
581
- const NULLABLE_NUMBER = "number | null";
582
- const SANDBOX = "<SANDBOX>";
583
- const SPEND_LIMIT = "spend-limit";
584
- const NEEDS_MANAGEMENT = "Needs a management key.";
585
- const CLEARABLE = {
586
- "expires-at": "expires_at",
587
- "max-concurrent": "max_concurrent_sandboxes",
588
- "max-ttl": "max_ttl_seconds",
589
- provider: "allowed_providers",
590
- "spend-limit": "spend_limit"
591
- };
592
- const flag = (option) => ({
593
- ...option,
594
- kind: "flag",
595
- negatable: true,
596
- repeat: "last"
597
- });
598
- const json = flag({
599
- name: "json",
600
- summary: "Print the result as one JSON document"
601
- });
602
- const baseUrl = {
603
- defaultText: "https://www.sandcovery.com; SANDCOVERY_BASE_URL also sets it",
604
- hint: "<URL>",
605
- kind: "value",
606
- name: "base-url",
607
- summary: "Sandcovery origin to send requests to"
608
- };
609
- const usageKey = {
610
- hint: "<KEY>",
611
- kind: "value",
612
- name: "key",
613
- summary: "Show only this API key, by its ID"
614
- };
615
- const yes = flag({
616
- name: "yes",
617
- short: "y",
618
- summary: "Confirm without a prompt, after a person has approved"
619
- });
620
- const limit = (noun) => ({
621
- defaultText: "20",
622
- hint: "<NUMBER>",
623
- kind: "value",
624
- name: "limit",
625
- short: "n",
626
- summary: `Number of ${noun} on the page, from 1 to ${String(100)}`
627
- });
628
- const next = {
629
- hint: "<CURSOR>",
630
- kind: "value",
631
- name: "next",
632
- summary: "Continue after a page, from the cursor that page printed"
633
- };
634
- const env = {
635
- hint: "<NAME=VALUE>",
636
- kind: "value",
637
- name: "env",
638
- repeat: "append",
639
- short: "e",
640
- summary: "Environment variable to set; repeat for each one"
641
- };
642
- const provider = (summary) => ({
643
- hint: "<PROVIDER>",
644
- kind: "value",
645
- name: "provider",
646
- repeat: "append",
647
- short: "p",
648
- summary
649
- });
650
- const required = ({ message, name, reason, summary }) => ({
651
- missing: {
652
- message,
653
- reason
654
- },
655
- name,
656
- summary
657
- });
658
- const sandboxArgument = (verb) => required({
659
- message: `Can't ${verb} without a sandbox ID.`,
660
- name: "sandbox",
661
- reason: "missing_sandbox",
662
- summary: "Sandbox ID, such as sbx_ and a UUID, as sandcovery sandboxes list prints it"
663
- });
664
- const keyArgument = (verb) => required({
665
- message: `Can't ${verb} without a key ID.`,
666
- name: "key",
667
- reason: "missing_key",
668
- summary: "Key ID, such as key_ or mkey_ and a UUID, as sandcovery keys list prints it"
669
- });
670
- const providerArgument = (verb) => required({
671
- message: `Can't ${verb} without a provider.`,
672
- name: "provider",
673
- reason: "missing_provider",
674
- summary: "Provider, such as e2b, as sandcovery providers list prints it"
675
- });
676
- const pathArgument = (verb) => required({
677
- message: `Can't ${verb} without a path in the sandbox.`,
678
- name: "path",
679
- reason: "missing_path",
680
- summary: "Path in the sandbox"
681
- });
682
- const SANDBOX_RESULT = [
683
- {
684
- name: "sandbox.id",
685
- type: "string"
686
- },
687
- {
688
- name: "sandbox.status",
689
- type: "string"
690
- },
691
- {
692
- name: "sandbox.provider",
693
- type: NULLABLE_TEXT
694
- },
695
- {
696
- name: "sandbox.expires_at",
697
- type: "string"
698
- }
699
- ];
700
- const sandboxLeaf = ({ name, notes, result = SANDBOX_RESULT, summary, verb }) => ({
701
- arguments: [sandboxArgument(verb)],
702
- examples: [{
703
- argv: [
704
- "sandboxes",
705
- name,
706
- SANDBOX
707
- ],
708
- summary
709
- }],
710
- kind: "leaf",
711
- name,
712
- notes,
713
- options: [baseUrl, json],
714
- result,
715
- summary
716
- });
717
- const keyPolicyOptions = [
718
- {
719
- hint: "<TIME>",
720
- kind: "value",
721
- name: "expires-at",
722
- summary: "When the key stops working, as a UTC time such as 2026-12-31T00:00:00.000Z"
723
- },
724
- {
725
- hint: "<NUMBER>",
726
- kind: "value",
727
- name: "max-concurrent",
728
- summary: "Most sandboxes the key can run at once"
729
- },
730
- {
731
- hint: "<SECONDS>",
732
- kind: "value",
733
- name: "max-ttl",
734
- summary: "Longest TTL, in seconds, the key can give a sandbox"
735
- },
736
- provider("Provider the key can create sandboxes on; repeat for each one"),
737
- {
738
- hint: "<USD>",
739
- kind: "value",
740
- name: SPEND_LIMIT,
741
- summary: "Most the key can spend per --spend-period, in US dollars, such as 25 or 0.50"
742
- },
743
- {
744
- defaultText: "month",
745
- hint: "<PERIOD>",
746
- kind: "value",
747
- name: "spend-period",
748
- summary: "Period --spend-limit applies to",
749
- values: SpendLimit.fields.period.literals
750
- }
751
- ];
752
- const KEY_RESULT = [
753
- {
754
- name: "key.id",
755
- type: "string"
756
- },
757
- {
758
- name: "key.kind",
759
- type: "\"api\" | \"management\""
760
- },
761
- {
762
- name: "key.name",
763
- type: "string"
764
- },
765
- {
766
- name: "key.start",
767
- type: "string"
768
- },
769
- {
770
- name: "key.revoked_at",
771
- type: NULLABLE_TEXT
772
- }
773
- ];
774
- const sandboxSpecOptions = [
775
- env,
776
- {
777
- hint: "<SECONDS>",
778
- kind: "value",
779
- name: "idle-timeout",
780
- summary: "Seconds without a command after which the provider may pause the sandbox"
781
- },
782
- {
783
- hint: "<IMAGE>",
784
- kind: "value",
785
- name: "image",
786
- summary: "Image to start from, on providers that run custom images"
787
- },
788
- {
789
- hint: "<PORT>",
790
- kind: "value",
791
- name: "port",
792
- repeat: "append",
793
- summary: "Port to expose for previews; repeat for each one"
794
- },
795
- provider("Provider to run on; repeat to allow several, tried in the order given"),
796
- {
797
- defaultText: "the provider's",
798
- hint: "<REGION>",
799
- kind: "value",
800
- name: "region",
801
- short: "r",
802
- summary: "Region to run in, such as us, eu, or asia"
803
- },
804
- {
805
- defaultText: DEFAULT_SLUG,
806
- hint: "<SLUG>",
807
- kind: "value",
808
- name: "slug",
809
- repeat: "append",
810
- short: "s",
811
- summary: "Provider and size as <provider>/<vcpu>x<memory_gib>, such as sandcovery/2x4, boat/2x4, or sandcovery/nx16:fastest, routed as :cheapest unless it ends in :fastest or :most-reliable; repeat to try each slug in order"
812
- },
813
- {
814
- defaultText: "price",
815
- hint: "<SORT>",
816
- kind: "value",
817
- name: "sort",
818
- summary: "How to rank each slug's candidates; a slug's routing suffix must agree with it",
819
- values: ProviderSort.literals
820
- },
821
- {
822
- defaultText: "the key's maximum",
823
- hint: "<SECONDS>",
824
- kind: "value",
825
- name: "ttl",
826
- summary: "Seconds until Sandcovery destroys the sandbox"
827
- }
828
- ];
829
- const sandboxesList = {
830
- arguments: [],
831
- examples: [{
832
- argv: ["sandboxes", "list"],
833
- summary: "List your newest sandboxes"
834
- }, {
835
- argv: [
836
- "sandboxes",
837
- "list",
838
- "--status",
839
- "running",
840
- "--json"
841
- ],
842
- summary: "List running sandboxes in a script"
843
- }],
844
- kind: "leaf",
845
- name: "list",
846
- notes: ["Sandboxes list newest first, one page per run. --next continues after the page that printed it."],
847
- options: [
848
- baseUrl,
849
- json,
850
- limit("sandboxes"),
851
- next,
852
- {
853
- hint: "<STATUS>",
854
- kind: "value",
855
- name: "status",
856
- summary: "List only sandboxes in this status",
857
- values: SandboxStatus.literals
858
- }
859
- ],
860
- result: [
861
- {
862
- name: "sandboxes",
863
- type: "array"
864
- },
865
- {
866
- name: "sandboxes[].id",
867
- type: "string"
868
- },
869
- {
870
- name: "sandboxes[].status",
871
- type: "string"
872
- },
873
- {
874
- name: "next_cursor",
875
- type: NULLABLE_TEXT
876
- }
877
- ],
878
- shortcuts: ["ls"],
879
- summary: "List your sandboxes, newest first"
880
- };
881
- const sandboxesCreate = {
882
- arguments: [],
883
- examples: [
884
- {
885
- argv: ["sandboxes", "create"],
886
- summary: `Create a ${DEFAULT_SLUG} sandbox on the best provider`
887
- },
888
- {
889
- argv: [
890
- "sandboxes",
891
- "create",
892
- "--slug",
893
- "sandcovery/4x8:cheapest",
894
- "--ttl",
895
- "600",
896
- "--json"
897
- ],
898
- summary: "Create the cheapest 4x8 sandbox for 10 minutes in a script"
899
- },
900
- {
901
- argv: [
902
- "sandboxes",
903
- "create",
904
- "--slug",
905
- "boat/2x4",
906
- "--slug",
907
- "sandcovery/nx4:cheapest"
908
- ],
909
- summary: "Try boat at 2x4 first, then the cheapest provider with 4 GiB at any vCPU count"
910
- },
911
- {
912
- argv: [
913
- "sandboxes",
914
- "create",
915
- "--provider",
916
- "e2b",
917
- "--provider",
918
- "daytona"
919
- ],
920
- summary: "Try E2B first, then Daytona"
921
- }
922
- ],
923
- kind: "leaf",
924
- name: "create",
925
- notes: [
926
- "A slug pins a provider, or routes across every candidate provider when it starts with sandcovery/. Each slug falls back across its candidates on capacity, quota, timeout, and server errors, unless --no-fallbacks is given, and then the create moves to the next --slug.",
927
- "Each create sends an idempotency key, so the CLI retries a create that got no answer without making a second sandbox.",
928
- "When stdout is not a terminal, the command prints the sandbox ID there."
929
- ],
930
- options: [
931
- baseUrl,
932
- flag({
933
- name: "fallbacks",
934
- summary: "Fall back to the next provider when one fails; --no-fallbacks stops at the first failure"
935
- }),
936
- json,
937
- ...sandboxSpecOptions,
938
- {
939
- hint: "<SNAPSHOT>",
940
- kind: "value",
941
- name: "snapshot",
942
- summary: "Snapshot ID to restore, as sandcovery sandboxes snapshot prints it"
943
- }
944
- ],
945
- result: [...SANDBOX_RESULT, {
946
- name: "sandbox.attempts",
947
- type: "array"
948
- }],
949
- summary: "Create a sandbox"
950
- };
951
- const sandboxesExec = {
952
- arguments: [sandboxArgument("run a command"), {
953
- missing: {
954
- message: "Can't run a command without the command, after --.",
955
- reason: "missing_command"
956
- },
957
- name: "command",
958
- summary: "Command to run, after --; like ssh, its words join with spaces and run in the sandbox's shell",
959
- variadic: true
960
- }],
961
- examples: [
962
- {
963
- argv: [
964
- "sandboxes",
965
- "exec",
966
- SANDBOX,
967
- "--",
968
- "ls",
969
- "-la"
970
- ],
971
- summary: "List the working directory"
972
- },
973
- {
974
- argv: [
975
- "sandboxes",
976
- "exec",
977
- SANDBOX,
978
- "--json",
979
- "--",
980
- "npm",
981
- "test"
982
- ],
983
- summary: "Run the tests and read their output and exit code in a script"
984
- },
985
- {
986
- argv: [
987
- "sandboxes",
988
- "exec",
989
- SANDBOX,
990
- "--detach",
991
- "--",
992
- "node",
993
- "server.js",
994
- ">server.log",
995
- "2>&1"
996
- ],
997
- summary: "Start a server that keeps running after the CLI exits"
998
- }
999
- ],
1000
- kind: "leaf",
1001
- name: "exec",
1002
- notes: [
1003
- "The command's stdout and stderr stream to this terminal's, and the CLI exits with the command's exit code.",
1004
- "With --json, the CLI waits for the command and prints its stdout, stderr, exit code, and duration as one document.",
1005
- "With --detach, the CLI returns once the provider starts the command, which keeps running until it exits or the sandbox ends, and its output is not kept, so redirect it to a file to read it later. A provider with no detached commands answers unsupported.",
1006
- "The CLI never retries a command, since running it twice may change the sandbox twice."
1007
- ],
1008
- options: [
1009
- baseUrl,
1010
- {
1011
- hint: "<DIR>",
1012
- kind: "value",
1013
- name: "cwd",
1014
- summary: "Directory in the sandbox to run the command in"
1015
- },
1016
- flag({
1017
- name: "detach",
1018
- summary: "Start the command and return at once, leaving it running in the sandbox"
1019
- }),
1020
- env,
1021
- json,
1022
- {
1023
- hint: "<SECONDS>",
1024
- kind: "value",
1025
- name: "timeout",
1026
- summary: "Seconds after which the provider stops the command"
1027
- }
1028
- ],
1029
- result: [
1030
- {
1031
- name: "exec.exit_code",
1032
- type: "number"
1033
- },
1034
- {
1035
- name: "exec.stdout",
1036
- type: "string"
1037
- },
1038
- {
1039
- name: "exec.stderr",
1040
- type: "string"
1041
- },
1042
- {
1043
- name: "exec.duration_ms",
1044
- type: "number"
1045
- },
1046
- {
1047
- name: "exec.started_at",
1048
- type: "string"
1049
- }
1050
- ],
1051
- summary: "Run a command in a sandbox"
1052
- };
1053
- const sandboxesDestroy = {
1054
- arguments: [sandboxArgument("destroy a sandbox")],
1055
- examples: [{
1056
- argv: [
1057
- "sandboxes",
1058
- "destroy",
1059
- SANDBOX
1060
- ],
1061
- summary: "Destroy a sandbox after a prompt"
1062
- }, {
1063
- argv: [
1064
- "sandboxes",
1065
- "destroy",
1066
- SANDBOX,
1067
- "--yes"
1068
- ],
1069
- summary: "Destroy it in a script, after a person approved"
1070
- }],
1071
- kind: "leaf",
1072
- name: "destroy",
1073
- notes: ["Destroying a sandbox deletes its files and stops its commands. It asks first, and needs --yes without a terminal.", "Destroying a sandbox that already ended changes nothing."],
1074
- options: [
1075
- baseUrl,
1076
- json,
1077
- yes
1078
- ],
1079
- result: SANDBOX_RESULT,
1080
- shortcuts: ["delete", "rm"],
1081
- summary: "Destroy a sandbox and everything in it"
1082
- };
1083
- const sandboxesPortsInspect = {
1084
- arguments: [sandboxArgument("preview a port"), required({
1085
- message: "Can't preview a port without its number.",
1086
- name: "port",
1087
- reason: "missing_port",
1088
- summary: "Port the sandbox exposes, as sandcovery sandboxes create --port set it"
1089
- })],
1090
- examples: [{
1091
- argv: [
1092
- "sandboxes",
1093
- "ports",
1094
- "inspect",
1095
- SANDBOX,
1096
- "3000"
1097
- ],
1098
- summary: "Print a port's preview URL"
1099
- }],
1100
- kind: "leaf",
1101
- name: "inspect",
1102
- notes: ["Prints the preview URL and any headers a request to it needs. The headers can grant access to the sandbox, so treat them as secrets."],
1103
- options: [baseUrl, json],
1104
- result: [
1105
- {
1106
- name: "preview.url",
1107
- type: "string"
1108
- },
1109
- {
1110
- name: "preview.headers",
1111
- secret: true,
1112
- type: "object"
1113
- },
1114
- {
1115
- name: "preview.expires_at",
1116
- type: NULLABLE_TEXT
1117
- }
1118
- ],
1119
- summary: "Print a port's preview URL"
1120
- };
1121
- const filesList = {
1122
- arguments: [sandboxArgument("list files"), pathArgument("list files")],
1123
- examples: [{
1124
- argv: [
1125
- "sandboxes",
1126
- "files",
1127
- "list",
1128
- SANDBOX,
1129
- "logs"
1130
- ],
1131
- summary: "List a directory"
1132
- }],
1133
- kind: "leaf",
1134
- name: "list",
1135
- notes: ["Lists the entries of one directory, without descending into subdirectories."],
1136
- options: [baseUrl, json],
1137
- result: [{
1138
- name: "files.path",
1139
- type: "string"
1140
- }, {
1141
- name: "files.entries",
1142
- type: "array"
1143
- }],
1144
- shortcuts: ["ls"],
1145
- summary: "List a directory in a sandbox"
1146
- };
1147
- const filesRead = {
1148
- arguments: [sandboxArgument("read a file"), pathArgument("read a file")],
1149
- examples: [{
1150
- argv: [
1151
- "sandboxes",
1152
- "files",
1153
- "read",
1154
- SANDBOX,
1155
- "logs/out.txt"
1156
- ],
1157
- summary: "Print a file"
1158
- }, {
1159
- argv: [
1160
- "sandboxes",
1161
- "files",
1162
- "read",
1163
- SANDBOX,
1164
- "build.tar"
1165
- ],
1166
- summary: "Copy a file out, with stdout redirected to a local file"
1167
- }],
1168
- kind: "leaf",
1169
- name: "read",
1170
- notes: ["Writes the file's bytes to stdout unchanged when stdout is not a terminal."],
1171
- options: [baseUrl],
1172
- result: [],
1173
- shortcuts: ["cat"],
1174
- summary: "Print a file from a sandbox"
1175
- };
1176
- const filesWrite = {
1177
- arguments: [sandboxArgument("write a file"), pathArgument("write a file")],
1178
- examples: [{
1179
- argv: [
1180
- "sandboxes",
1181
- "files",
1182
- "write",
1183
- SANDBOX,
1184
- "in.txt",
1185
- "--from",
1186
- "in.txt"
1187
- ],
1188
- summary: "Copy a local file into a sandbox"
1189
- }, {
1190
- argv: [
1191
- "sandboxes",
1192
- "files",
1193
- "write",
1194
- SANDBOX,
1195
- "in.txt",
1196
- "--from",
1197
- "-"
1198
- ],
1199
- summary: "Write stdin to a file"
1200
- }],
1201
- kind: "leaf",
1202
- name: "write",
1203
- notes: ["Replaces the file at the path when one exists."],
1204
- options: [
1205
- baseUrl,
1206
- {
1207
- hint: "<FILE|->",
1208
- kind: "value",
1209
- name: "from",
1210
- required: true,
1211
- stdin: true,
1212
- summary: "Local file to upload, or - for stdin"
1213
- },
1214
- json
1215
- ],
1216
- result: [{
1217
- name: "file.path",
1218
- type: "string"
1219
- }, {
1220
- name: "file.size_bytes",
1221
- type: NULLABLE_NUMBER
1222
- }],
1223
- summary: "Write a file into a sandbox"
1224
- };
1225
- const docker = {
1226
- arguments: [{
1227
- name: "args",
1228
- optional: true,
1229
- summary: "Arguments for docker, every word passed on unchanged, so sandcovery options such as --base-url go before docker",
1230
- variadic: true
1231
- }],
1232
- examples: [
1233
- {
1234
- argv: [
1235
- "docker",
1236
- "build",
1237
- "--tag",
1238
- "app",
1239
- "."
1240
- ],
1241
- summary: "Build an image from the working directory in a sandbox"
1242
- },
1243
- {
1244
- argv: [
1245
- "docker",
1246
- "run",
1247
- "--rm",
1248
- "app"
1249
- ],
1250
- summary: "Run a container from it in the same sandbox"
1251
- },
1252
- {
1253
- argv: [
1254
- "docker",
1255
- "compose",
1256
- "up",
1257
- "--build",
1258
- "--detach"
1259
- ],
1260
- summary: "Start the Compose project in the working directory"
1261
- }
1262
- ],
1263
- kind: "leaf",
1264
- name: "docker",
1265
- notes: [
1266
- "Runs the Docker CLI in a sandbox with every word after docker, streams its stdout and stderr to this terminal's, and exits with its exit code.",
1267
- "The first command starts a sandbox on a provider that runs Docker, as Sandcovery CI runners do, and later commands reuse it until it ends at its TTL, so images, containers, and volumes carry over between commands. sandcovery sandboxes destroy ends it sooner.",
1268
- "build, buildx, builder, compose, and image build first copy the working directory into the sandbox, up to 100 MiB packed, so their relative paths resolve as they do here. Every other path names a file in the sandbox, as with a remote Docker daemon.",
1269
- "The command reads no stdin and gets no terminal, its output arrives as text, and it stops after an hour, so docker run -it, docker login --password-stdin, and docker save to stdout do not work."
1270
- ],
1271
- options: [baseUrl],
1272
- passthrough: true,
1273
- result: [],
1274
- summary: "Run a docker command in a sandbox"
1275
- };
1276
- const sandboxes = {
1277
- children: [
1278
- sandboxesList,
1279
- sandboxesCreate,
1280
- sandboxLeaf({
1281
- name: "inspect",
1282
- notes: ["Prints the sandbox, its cost so far, and every create attempt."],
1283
- result: [...SANDBOX_RESULT, {
1284
- name: "sandbox.cost",
1285
- type: "object"
1286
- }],
1287
- summary: "Show one sandbox",
1288
- verb: "show a sandbox"
1289
- }),
1290
- sandboxesExec,
1291
- sandboxesDestroy,
1292
- sandboxLeaf({
1293
- name: "pause",
1294
- notes: ["Pausing keeps the memory and files where the provider can. The TTL keeps counting."],
1295
- summary: "Pause a sandbox",
1296
- verb: "pause a sandbox"
1297
- }),
1298
- sandboxLeaf({
1299
- name: "resume",
1300
- notes: ["Resumes a paused sandbox with its files as they were."],
1301
- summary: "Resume a paused sandbox",
1302
- verb: "resume a sandbox"
1303
- }),
1304
- sandboxLeaf({
1305
- name: "snapshot",
1306
- notes: ["Saves the sandbox as a snapshot that sandcovery sandboxes create --snapshot restores."],
1307
- result: [{
1308
- name: "snapshot.id",
1309
- type: "string"
1310
- }, {
1311
- name: "snapshot.provider",
1312
- type: "string"
1313
- }],
1314
- summary: "Snapshot a sandbox",
1315
- verb: "snapshot a sandbox"
1316
- }),
1317
- {
1318
- children: [
1319
- filesList,
1320
- filesRead,
1321
- filesWrite
1322
- ],
1323
- kind: "group",
1324
- name: "files",
1325
- shortcuts: ["file"],
1326
- summary: "List, read, and write files in a sandbox"
1327
- },
1328
- {
1329
- children: [sandboxesPortsInspect],
1330
- defaultChild: "inspect",
1331
- kind: "group",
1332
- name: "ports",
1333
- shortcuts: ["port"],
1334
- summary: "Preview a sandbox's ports"
1335
- }
1336
- ],
1337
- kind: "group",
1338
- name: "sandboxes",
1339
- shortcuts: ["sandbox", "sbx"],
1340
- summary: "Create, run, and destroy sandboxes"
1341
- };
1342
- const keysCreate = {
1343
- arguments: [],
1344
- examples: [{
1345
- argv: [
1346
- "keys",
1347
- "create",
1348
- "--name",
1349
- "ci"
1350
- ],
1351
- summary: "Create an API key for CI"
1352
- }, {
1353
- argv: [
1354
- "keys",
1355
- "create",
1356
- "--name",
1357
- "ci",
1358
- "--max-ttl",
1359
- "3600",
1360
- "--spend-limit",
1361
- "50",
1362
- "--json"
1363
- ],
1364
- summary: "Create a capped API key in a script"
1365
- }],
1366
- kind: "leaf",
1367
- name: "create",
1368
- notes: ["Prints the secret once. Sandcovery keeps only its first 12 characters, so store it before you close the terminal.", NEEDS_MANAGEMENT],
1369
- options: [
1370
- baseUrl,
1371
- json,
1372
- ...keyPolicyOptions,
1373
- {
1374
- defaultText: "api",
1375
- hint: "<KIND>",
1376
- kind: "value",
1377
- name: "kind",
1378
- summary: "api for sandboxes, or management for keys, usage, and credentials",
1379
- values: KeyKind.literals
1380
- },
1381
- {
1382
- hint: "<NAME>",
1383
- kind: "value",
1384
- name: "name",
1385
- required: true,
1386
- summary: "Name to recognize the key by, up to 100 characters"
1387
- }
1388
- ],
1389
- result: [...KEY_RESULT, {
1390
- name: "secret",
1391
- secret: true,
1392
- type: "string"
1393
- }],
1394
- summary: "Create an API key or management key"
1395
- };
1396
- const keysUpdate = {
1397
- arguments: [keyArgument("update a key")],
1398
- examples: [{
1399
- argv: [
1400
- "keys",
1401
- "update",
1402
- "<KEY>",
1403
- "--max-ttl",
1404
- "7200"
1405
- ],
1406
- summary: "Raise a key's longest TTL"
1407
- }, {
1408
- argv: [
1409
- "keys",
1410
- "update",
1411
- "<KEY>",
1412
- "--clear",
1413
- SPEND_LIMIT
1414
- ],
1415
- summary: "Remove a key's spend limit"
1416
- }],
1417
- kind: "leaf",
1418
- name: "update",
1419
- notes: ["Changes only the fields you pass. --clear removes a limit or expiry, so the key has none.", NEEDS_MANAGEMENT],
1420
- options: [
1421
- baseUrl,
1422
- {
1423
- hint: "<FIELD>",
1424
- kind: "value",
1425
- name: "clear",
1426
- repeat: "append",
1427
- summary: "Field to remove; repeat for each one",
1428
- values: Object.keys(CLEARABLE)
1429
- },
1430
- json,
1431
- ...keyPolicyOptions,
1432
- {
1433
- hint: "<NAME>",
1434
- kind: "value",
1435
- name: "name",
1436
- summary: "New name for the key"
1437
- }
1438
- ],
1439
- result: KEY_RESULT,
1440
- summary: "Change a key's name, expiry, or limits"
1441
- };
1442
- const keys = {
1443
- children: [
1444
- {
1445
- arguments: [],
1446
- examples: [{
1447
- argv: ["keys", "list"],
1448
- summary: "List your keys"
1449
- }],
1450
- kind: "leaf",
1451
- name: "list",
1452
- notes: ["Lists every key, revoked ones included, with the first 12 characters of each secret. Needs a management key."],
1453
- options: [baseUrl, json],
1454
- result: [
1455
- {
1456
- name: "keys",
1457
- type: "array"
1458
- },
1459
- {
1460
- name: "keys[].id",
1461
- type: "string"
1462
- },
1463
- {
1464
- name: "keys[].kind",
1465
- type: "\"api\" | \"management\""
1466
- },
1467
- {
1468
- name: "keys[].name",
1469
- type: "string"
1470
- },
1471
- {
1472
- name: "keys[].start",
1473
- type: "string"
1474
- }
1475
- ],
1476
- shortcuts: ["ls"],
1477
- summary: "List your keys"
1478
- },
1479
- keysCreate,
1480
- {
1481
- arguments: [keyArgument("show a key")],
1482
- examples: [{
1483
- argv: [
1484
- "keys",
1485
- "inspect",
1486
- "<KEY>"
1487
- ],
1488
- summary: "Show a key and its spend"
1489
- }],
1490
- kind: "leaf",
1491
- name: "inspect",
1492
- notes: [NEEDS_MANAGEMENT],
1493
- options: [baseUrl, json],
1494
- result: KEY_RESULT,
1495
- summary: "Show one key"
1496
- },
1497
- keysUpdate,
1498
- {
1499
- arguments: [keyArgument("revoke a key")],
1500
- examples: [{
1501
- argv: [
1502
- "keys",
1503
- "revoke",
1504
- "<KEY>"
1505
- ],
1506
- summary: "Revoke a key after a prompt"
1507
- }, {
1508
- argv: [
1509
- "keys",
1510
- "revoke",
1511
- "<KEY>",
1512
- "--yes"
1513
- ],
1514
- summary: "Revoke it in a script, after a person approved"
1515
- }],
1516
- kind: "leaf",
1517
- name: "revoke",
1518
- notes: ["A revoked key stops working at once and cannot be restored. Its sandboxes keep running until their TTL.", "It asks first, and needs --yes without a terminal. Needs a management key."],
1519
- options: [
1520
- baseUrl,
1521
- json,
1522
- yes
1523
- ],
1524
- result: KEY_RESULT,
1525
- shortcuts: ["delete", "rm"],
1526
- summary: "Revoke a key"
1527
- }
1528
- ],
1529
- defaultChild: "list",
1530
- kind: "group",
1531
- name: "keys",
1532
- shortcuts: ["key"],
1533
- summary: "Manage API keys and management keys"
1534
- };
1535
- const credentialField = {
1536
- hint: "<NAME=VALUE>",
1537
- kind: "value",
1538
- name: "field",
1539
- repeat: "append",
1540
- summary: "Credential field to set; repeat for each one"
1541
- };
1542
- const credentialSource = {
1543
- hint: "<FILE|->",
1544
- kind: "value",
1545
- name: "from",
1546
- stdin: true,
1547
- summary: "JSON object of the fields, from a file or - for stdin"
1548
- };
1549
- const storedCredential = [
1550
- {
1551
- name: "credential.id",
1552
- type: "string"
1553
- },
1554
- {
1555
- name: "credential.provider",
1556
- type: "string"
1557
- },
1558
- {
1559
- name: "credential.hint",
1560
- type: "string"
1561
- }
1562
- ];
1563
- const credentials = {
1564
- children: [
1565
- {
1566
- arguments: [],
1567
- examples: [{
1568
- argv: ["credentials", "list"],
1569
- summary: "List your provider credentials"
1570
- }],
1571
- kind: "leaf",
1572
- name: "list",
1573
- notes: ["Shows a hint of each credential, never the credential. Needs a management key.", "A provider's credentials are listed in the order a create tries them. Without Pro, a create uses only each provider's first credential."],
1574
- options: [baseUrl, json],
1575
- result: [
1576
- {
1577
- name: "credentials",
1578
- type: "array"
1579
- },
1580
- {
1581
- name: "credentials[].id",
1582
- type: "string"
1583
- },
1584
- {
1585
- name: "credentials[].provider",
1586
- type: "string"
1587
- },
1588
- {
1589
- name: "credentials[].hint",
1590
- type: "string"
1591
- }
1592
- ],
1593
- shortcuts: ["ls"],
1594
- summary: "List your provider credentials"
1595
- },
1596
- {
1597
- arguments: [providerArgument("set a credential")],
1598
- examples: [{
1599
- argv: [
1600
- "credentials",
1601
- "set",
1602
- "e2b",
1603
- "--from",
1604
- "-"
1605
- ],
1606
- summary: "Set the E2B credential from a JSON object on stdin"
1607
- }, {
1608
- argv: [
1609
- "credentials",
1610
- "set",
1611
- "e2b",
1612
- "--field",
1613
- "api_key=<KEY>"
1614
- ],
1615
- summary: "Set it from an option"
1616
- }],
1617
- kind: "leaf",
1618
- name: "set",
1619
- notes: [
1620
- "Each provider names its fields in sandcovery providers inspect. Sandboxes on that provider then run on your account.",
1621
- "It replaces the credential when you hold exactly one for the provider, and fails when you hold more; then add the new one and delete the old one.",
1622
- "Prefer --from -, since options show in process lists. Sandcovery seals the values and never returns them. Needs a management key."
1623
- ],
1624
- options: [
1625
- baseUrl,
1626
- credentialField,
1627
- credentialSource,
1628
- json
1629
- ],
1630
- result: storedCredential,
1631
- summary: "Set or replace a provider credential"
1632
- },
1633
- {
1634
- arguments: [providerArgument("add a credential")],
1635
- examples: [{
1636
- argv: [
1637
- "credentials",
1638
- "add",
1639
- "e2b",
1640
- "--from",
1641
- "-"
1642
- ],
1643
- summary: "Add another E2B credential from a JSON object on stdin"
1644
- }, {
1645
- argv: [
1646
- "credentials",
1647
- "add",
1648
- "e2b",
1649
- "--field",
1650
- "api_key=<KEY>"
1651
- ],
1652
- summary: "Add it from an option"
1653
- }],
1654
- kind: "leaf",
1655
- name: "add",
1656
- notes: ["A create tries your credentials for a provider in the order you added them, and falls back to the next one on capacity, quota, a provider error, or a timeout.", "More than one credential for a provider needs Pro. Prefer --from -, since options show in process lists. Needs a management key."],
1657
- options: [
1658
- baseUrl,
1659
- credentialField,
1660
- credentialSource,
1661
- json
1662
- ],
1663
- result: storedCredential,
1664
- summary: "Add another provider credential"
1665
- },
1666
- {
1667
- arguments: [providerArgument("delete a credential")],
1668
- examples: [{
1669
- argv: [
1670
- "credentials",
1671
- "delete",
1672
- "e2b"
1673
- ],
1674
- summary: "Delete every E2B credential after a prompt"
1675
- }, {
1676
- argv: [
1677
- "credentials",
1678
- "delete",
1679
- "e2b",
1680
- "--id",
1681
- "<CREDENTIAL>"
1682
- ],
1683
- summary: "Delete one E2B credential by its ID"
1684
- }],
1685
- kind: "leaf",
1686
- name: "delete",
1687
- notes: ["Without --id, it deletes every credential of the provider, and new sandboxes on that provider then run on Sandcovery's account. A credential that live sandboxes use cannot be deleted.", "It asks first, and needs --yes without a terminal. Needs a management key."],
1688
- options: [
1689
- baseUrl,
1690
- {
1691
- hint: "<CREDENTIAL>",
1692
- kind: "value",
1693
- name: "id",
1694
- summary: "Delete only the credential with this ID"
1695
- },
1696
- json,
1697
- yes
1698
- ],
1699
- result: [{
1700
- name: "credential.provider",
1701
- type: "string"
1702
- }, {
1703
- name: "outcome",
1704
- type: "\"deleted\""
1705
- }],
1706
- shortcuts: ["rm"],
1707
- summary: "Delete provider credentials"
1708
- },
1709
- {
1710
- arguments: [],
1711
- examples: [{
1712
- argv: ["credentials", "offer"],
1713
- summary: "Show the free vCPU-hours your keys have earned"
1714
- }],
1715
- kind: "leaf",
1716
- name: "offer",
1717
- notes: ["Shows the provider Sandcovery pays for, the keys counted toward the free vCPU-hours, and the vCPU-hours left. It fails as not found while no offer runs. Needs a management key."],
1718
- options: [baseUrl, json],
1719
- result: [
1720
- {
1721
- name: "offer.provider",
1722
- type: "string"
1723
- },
1724
- {
1725
- name: "offer.keys_counted",
1726
- type: "number"
1727
- },
1728
- {
1729
- name: "offer.remaining_vcpu_seconds",
1730
- type: "number"
1731
- }
1732
- ],
1733
- summary: "Show the free vCPU-hours offer"
1734
- }
1735
- ],
1736
- defaultChild: "list",
1737
- kind: "group",
1738
- name: "credentials",
1739
- shortcuts: ["credential"],
1740
- summary: "Run sandboxes on your own provider accounts"
1741
- };
1742
- const providers = {
1743
- children: [{
1744
- arguments: [],
1745
- examples: [{
1746
- argv: ["providers", "list"],
1747
- summary: "Compare the providers' prices and status"
1748
- }, {
1749
- argv: [
1750
- "providers",
1751
- "list",
1752
- "--routed"
1753
- ],
1754
- summary: "List only the providers Sandcovery routes sandboxes to"
1755
- }],
1756
- kind: "leaf",
1757
- name: "list",
1758
- notes: [
1759
- "Lists each provider with its status, 2x4 price per hour, and median create latency.",
1760
- "A provider Sandcovery does not route to yet shows as Coming Soon.",
1761
- "Coming Soon also marks each figure or fact Sandcovery does not publish, and --json adds every fact with the page it was read from.",
1762
- "With --routed, it lists only the providers on the provider board, and --json prints their board entries."
1763
- ],
1764
- options: [
1765
- baseUrl,
1766
- json,
1767
- flag({
1768
- name: "routed",
1769
- summary: "List only the providers Sandcovery routes to"
1770
- })
1771
- ],
1772
- result: [
1773
- {
1774
- name: "providers",
1775
- type: "array"
1776
- },
1777
- {
1778
- name: "providers[].provider",
1779
- type: "string"
1780
- },
1781
- {
1782
- name: "providers[].routed",
1783
- type: "boolean"
1784
- },
1785
- {
1786
- name: "providers[].status",
1787
- type: "string"
1788
- }
1789
- ],
1790
- shortcuts: ["ls"],
1791
- summary: "List the providers"
1792
- }, {
1793
- arguments: [providerArgument("show a provider")],
1794
- examples: [{
1795
- argv: [
1796
- "providers",
1797
- "inspect",
1798
- "e2b"
1799
- ],
1800
- summary: "Show E2B's prices, limits, and credential fields"
1801
- }],
1802
- kind: "leaf",
1803
- name: "inspect",
1804
- notes: ["Shows the prices of each size, the features and limits, and the fields sandcovery credentials set takes."],
1805
- options: [baseUrl, json],
1806
- result: [
1807
- {
1808
- name: "provider.provider",
1809
- type: "string"
1810
- },
1811
- {
1812
- name: "provider.features",
1813
- type: "object"
1814
- },
1815
- {
1816
- name: "provider.credential_fields",
1817
- type: "array"
1818
- }
1819
- ],
1820
- summary: "Show one provider"
1821
- }],
1822
- defaultChild: "list",
1823
- kind: "group",
1824
- name: "providers",
1825
- shortcuts: ["provider"],
1826
- summary: "Compare the sandbox providers"
1827
- };
1828
- const usage = {
1829
- children: [
1830
- {
1831
- arguments: [],
1832
- examples: [{
1833
- argv: ["usage", "inspect"],
1834
- summary: "Show this month's usage"
1835
- }, {
1836
- argv: [
1837
- "usage",
1838
- "inspect",
1839
- "--from",
1840
- "2026-10-01",
1841
- "--to",
1842
- "2026-10-31",
1843
- "--json"
1844
- ],
1845
- summary: "Read October's usage in a script"
1846
- }],
1847
- kind: "leaf",
1848
- name: "inspect",
1849
- notes: ["Shows sandboxes, sandbox time, vCPU and memory time, and estimated cost per UTC day, key, and provider, at most 92 days at once, plus GPU time once any sandbox ran a GPU. Needs a management key."],
1850
- options: [
1851
- baseUrl,
1852
- {
1853
- defaultText: "the first day of this UTC month",
1854
- hint: "<DAY>",
1855
- kind: "value",
1856
- name: "from",
1857
- summary: "First UTC day, such as 2026-11-01"
1858
- },
1859
- json,
1860
- usageKey,
1861
- {
1862
- defaultText: "today, in UTC",
1863
- hint: "<DAY>",
1864
- kind: "value",
1865
- name: "to",
1866
- summary: "Last UTC day, such as 2026-11-30"
1867
- }
1868
- ],
1869
- result: [
1870
- {
1871
- name: "usage",
1872
- type: "array"
1873
- },
1874
- {
1875
- name: "usage[].date",
1876
- type: "string"
1877
- },
1878
- {
1879
- name: "usage[].estimated_micro_usd",
1880
- type: "number"
1881
- }
1882
- ],
1883
- summary: "Show usage and cost per day"
1884
- },
1885
- {
1886
- arguments: [],
1887
- examples: [{
1888
- argv: ["usage", "live"],
1889
- summary: "Show the sandboxes live now and their cost per hour"
1890
- }],
1891
- kind: "leaf",
1892
- name: "live",
1893
- notes: ["Shows the sandboxes live at this moment per key, provider, and status, with their vCPUs, memory, GPUs, cost per hour, and cost so far. Needs a management key."],
1894
- options: [
1895
- baseUrl,
1896
- json,
1897
- usageKey
1898
- ],
1899
- result: [
1900
- {
1901
- name: "at",
1902
- type: "string"
1903
- },
1904
- {
1905
- name: "live",
1906
- type: "array"
1907
- },
1908
- {
1909
- name: "live[].hourly_micro_usd",
1910
- type: "number"
1911
- },
1912
- {
1913
- name: "live[].sandbox_count",
1914
- type: "number"
1915
- }
1916
- ],
1917
- summary: "Show the sandboxes live now"
1918
- },
1919
- {
1920
- arguments: [],
1921
- examples: [{
1922
- argv: ["usage", "totals"],
1923
- summary: "Show today's, this week's, this month's, and all usage"
1924
- }],
1925
- kind: "leaf",
1926
- name: "totals",
1927
- notes: ["Shows sandboxes, sandbox time, vCPU and memory time, and estimated cost from the start of the UTC day, ISO week, and UTC month to now, and in total, plus GPU time once any sandbox ran a GPU. Needs a management key."],
1928
- options: [
1929
- baseUrl,
1930
- json,
1931
- usageKey
1932
- ],
1933
- result: [
1934
- {
1935
- name: "at",
1936
- type: "string"
1937
- },
1938
- {
1939
- name: "totals",
1940
- type: "array"
1941
- },
1942
- {
1943
- name: "totals[].period",
1944
- type: "string"
1945
- },
1946
- {
1947
- name: "totals[].estimated_micro_usd",
1948
- type: "number"
1949
- }
1950
- ],
1951
- summary: "Show usage totals by day, week, month, and in total"
1952
- },
1953
- {
1954
- arguments: [],
1955
- examples: [{
1956
- argv: [
1957
- "usage",
1958
- "estimate",
1959
- "--slug",
1960
- "sandcovery/4x8",
1961
- "--ttl",
1962
- "3600"
1963
- ],
1964
- summary: "Price a 4x8 sandbox for an hour"
1965
- }],
1966
- kind: "leaf",
1967
- name: "estimate",
1968
- notes: ["Prices the spec on each provider that can run it, in routing order, at the size each slug runs there, without creating anything."],
1969
- options: [
1970
- baseUrl,
1971
- json,
1972
- ...sandboxSpecOptions
1973
- ],
1974
- result: [
1975
- {
1976
- name: "estimates",
1977
- type: "array"
1978
- },
1979
- {
1980
- name: "estimates[].provider",
1981
- type: "string"
1982
- },
1983
- {
1984
- name: "estimates[].slug",
1985
- type: "string"
1986
- },
1987
- {
1988
- name: "estimates[].ttl_micro_usd",
1989
- type: "number"
1990
- }
1991
- ],
1992
- summary: "Price a sandbox before creating it"
1993
- }
1994
- ],
1995
- defaultChild: "inspect",
1996
- kind: "group",
1997
- name: "usage",
1998
- summary: "Show usage and price sandboxes"
1999
- };
2000
- const stats = {
2001
- children: [{
2002
- arguments: [],
2003
- examples: [{
2004
- argv: ["stats", "inspect"],
2005
- summary: "Show your organization's level, streak, and badges"
2006
- }, {
2007
- argv: [
2008
- "stats",
2009
- "inspect",
2010
- "--json"
2011
- ],
2012
- summary: "Read the badges in a script"
2013
- }],
2014
- kind: "leaf",
2015
- name: "inspect",
2016
- notes: ["Reads every sandbox the organization started. Level 1 starts at 1 vCPU-hour, and each level after it takes ten times as many. Takes an API key or a management key."],
2017
- options: [baseUrl, json],
2018
- result: [
2019
- {
2020
- name: "stats",
2021
- type: "object"
2022
- },
2023
- {
2024
- name: "stats.level",
2025
- type: "number"
2026
- },
2027
- {
2028
- name: "stats.badges",
2029
- type: "array"
2030
- }
2031
- ],
2032
- summary: "Show level, streak, records, and badges"
2033
- }],
2034
- defaultChild: "inspect",
2035
- kind: "group",
2036
- name: "stats",
2037
- summary: "Show your organization's level, streak, and badges"
2038
- };
2039
- const activity = {
2040
- children: [{
2041
- arguments: [],
2042
- examples: [{
2043
- argv: ["activity", "list"],
2044
- summary: "List the newest sandbox events"
2045
- }],
2046
- kind: "leaf",
2047
- name: "list",
2048
- notes: ["Lists creates, create attempts, pauses, snapshots, and ends, newest first, one page per run."],
2049
- options: [
2050
- baseUrl,
2051
- json,
2052
- limit("events"),
2053
- next
2054
- ],
2055
- result: [
2056
- {
2057
- name: "activity",
2058
- type: "array"
2059
- },
2060
- {
2061
- name: "activity[].action",
2062
- type: "string"
2063
- },
2064
- {
2065
- name: "next_cursor",
2066
- type: NULLABLE_TEXT
2067
- }
2068
- ],
2069
- shortcuts: ["ls"],
2070
- summary: "List sandbox events, newest first"
2071
- }],
2072
- defaultChild: "list",
2073
- kind: "group",
2074
- name: "activity",
2075
- summary: "Read what happened to your sandboxes"
2076
- };
2077
- const billing = {
2078
- children: [{
2079
- arguments: [],
2080
- examples: [{
2081
- argv: ["billing", "inspect"],
2082
- summary: "Show the plan and the credit balance"
2083
- }],
2084
- kind: "leaf",
2085
- name: "inspect",
2086
- notes: [`Shows the plan, the credit balance, and the Pro price. It fails as not found while billing is not open. ${NEEDS_MANAGEMENT}`],
2087
- options: [baseUrl, json],
2088
- result: [
2089
- {
2090
- name: "billing.plan",
2091
- type: "\"free\" | \"pro\""
2092
- },
2093
- {
2094
- name: "billing.credit_balance_micro_usd",
2095
- type: "number"
2096
- },
2097
- {
2098
- name: "billing.pro_price",
2099
- type: "object | null"
2100
- }
2101
- ],
2102
- summary: "Show the plan and credits"
2103
- }, {
2104
- arguments: [],
2105
- examples: [{
2106
- argv: [
2107
- "billing",
2108
- "buy-credits",
2109
- "--amount",
2110
- "100"
2111
- ],
2112
- summary: "Start a 100 USD credit purchase"
2113
- }],
2114
- kind: "leaf",
2115
- name: "buy-credits",
2116
- notes: [`Prints the Stripe Checkout page that takes the payment. The credits are the amount less the processing fee of ${CARD_FEE_TERMS}, and arrive once Stripe confirms the payment. ${NEEDS_MANAGEMENT}`],
2117
- options: [
2118
- {
2119
- hint: "<USD>",
2120
- kind: "value",
2121
- name: "amount",
2122
- required: true,
2123
- summary: `Whole US dollars to pay, from ${String(CREDIT_PURCHASE_MIN_MICRO_USD / MICRO_USD_PER_DOLLAR)} to ${String(CREDIT_PURCHASE_MAX_MICRO_USD / MICRO_USD_PER_DOLLAR)}`
2124
- },
2125
- baseUrl,
2126
- json
2127
- ],
2128
- result: [{
2129
- name: "checkout.url",
2130
- type: "string"
2131
- }],
2132
- summary: "Buy credits through Stripe Checkout"
2133
- }],
2134
- defaultChild: "inspect",
2135
- kind: "group",
2136
- name: "billing",
2137
- summary: "Show the plan and buy credits"
2138
- };
2139
- const pricing = {
2140
- children: [{
2141
- arguments: [],
2142
- examples: [{
2143
- argv: ["pricing", "inspect"],
2144
- summary: "Show the Pro price and the credit terms"
2145
- }],
2146
- kind: "leaf",
2147
- name: "inspect",
2148
- notes: ["Shows the Pro price, the smallest and largest credit purchase, and the processing fee that comes out of each purchase. It needs no key, and the Pro price reads Not on sale while Pro is not on sale."],
2149
- options: [baseUrl, json],
2150
- result: [{
2151
- name: "pricing.pro_price",
2152
- type: "object | null"
2153
- }, {
2154
- name: "pricing.credits",
2155
- type: "object"
2156
- }],
2157
- summary: "Show the Pro price and credit terms"
2158
- }],
2159
- defaultChild: "inspect",
2160
- kind: "group",
2161
- name: "pricing",
2162
- summary: "Show the Pro price and the credit terms"
2163
- };
2164
- const ci = {
2165
- children: [{
2166
- children: [{
2167
- arguments: [],
2168
- examples: [{
2169
- argv: [
2170
- "ci",
2171
- "jobs",
2172
- "list"
2173
- ],
2174
- summary: "List the newest CI jobs"
2175
- }],
2176
- kind: "leaf",
2177
- name: "list",
2178
- notes: ["Lists each GitHub Actions job that asked for a Sandcovery runner label, newest first, one page per run."],
2179
- options: [
2180
- baseUrl,
2181
- json,
2182
- limit("jobs"),
2183
- next
2184
- ],
2185
- result: [
2186
- {
2187
- name: "jobs",
2188
- type: "array"
2189
- },
2190
- {
2191
- name: "jobs[].id",
2192
- type: "string"
2193
- },
2194
- {
2195
- name: "jobs[].status",
2196
- type: "\"queued\" | \"in_progress\" | \"completed\""
2197
- },
2198
- {
2199
- name: "jobs[].cost_micro_usd",
2200
- type: NULLABLE_NUMBER
2201
- },
2202
- {
2203
- name: "next_cursor",
2204
- type: NULLABLE_TEXT
2205
- }
2206
- ],
2207
- shortcuts: ["ls"],
2208
- summary: "List CI jobs, newest first"
2209
- }, {
2210
- arguments: [required({
2211
- message: "Can't show a CI job without its ID.",
2212
- name: "job",
2213
- reason: "missing_job",
2214
- summary: "CI job ID, such as cij_ and a UUID, as sandcovery ci jobs list prints it"
2215
- })],
2216
- examples: [{
2217
- argv: [
2218
- "ci",
2219
- "jobs",
2220
- "inspect",
2221
- "<JOB>"
2222
- ],
2223
- summary: "Show a job's provider, wait, and cost"
2224
- }],
2225
- kind: "leaf",
2226
- name: "inspect",
2227
- notes: ["Shows the provider, wait, duration, and list-price cost of a job, beside what it costs on a GitHub-hosted runner."],
2228
- options: [baseUrl, json],
2229
- result: [
2230
- {
2231
- name: "job.id",
2232
- type: "string"
2233
- },
2234
- {
2235
- name: "job.provider",
2236
- type: NULLABLE_TEXT
2237
- },
2238
- {
2239
- name: "job.github_hosted_cost_micro_usd",
2240
- type: NULLABLE_NUMBER
2241
- }
2242
- ],
2243
- summary: "Show one CI job"
2244
- }],
2245
- defaultChild: "list",
2246
- kind: "group",
2247
- name: "jobs",
2248
- shortcuts: ["job"],
2249
- summary: "Read GitHub Actions jobs that ran on Sandcovery CI"
2250
- }, {
2251
- children: [{
2252
- arguments: [],
2253
- examples: [{
2254
- argv: [
2255
- "ci",
2256
- "installations",
2257
- "list"
2258
- ],
2259
- summary: "List the linked GitHub installations"
2260
- }],
2261
- kind: "leaf",
2262
- name: "list",
2263
- notes: [`Lists each linked installation with the API key that creates its runners. An organization owner or admin links one from the dashboard. ${NEEDS_MANAGEMENT}`],
2264
- options: [baseUrl, json],
2265
- result: [
2266
- {
2267
- name: "installations",
2268
- type: "array"
2269
- },
2270
- {
2271
- name: "installations[].installation_id",
2272
- type: "number"
2273
- },
2274
- {
2275
- name: "installations[].api_key_id",
2276
- type: "string"
2277
- }
2278
- ],
2279
- shortcuts: ["ls"],
2280
- summary: "List linked GitHub installations"
2281
- }, {
2282
- arguments: [required({
2283
- message: "Can't unlink an installation without its ID.",
2284
- name: "installation",
2285
- reason: "missing_installation",
2286
- summary: "GitHub installation ID, as sandcovery ci installations list prints it"
2287
- })],
2288
- examples: [{
2289
- argv: [
2290
- "ci",
2291
- "installations",
2292
- "unlink",
2293
- "<INSTALLATION>"
2294
- ],
2295
- summary: "Unlink an installation after a prompt"
2296
- }, {
2297
- argv: [
2298
- "ci",
2299
- "installations",
2300
- "unlink",
2301
- "<INSTALLATION>",
2302
- "--yes"
2303
- ],
2304
- summary: "Unlink it in a script, after a person approved"
2305
- }],
2306
- kind: "leaf",
2307
- name: "unlink",
2308
- notes: ["Its jobs start no more runners, and a runner already started ends when its job completes or at its TTL. The GitHub App stays installed until you uninstall it on GitHub.", `It asks first, and needs --yes without a terminal. ${NEEDS_MANAGEMENT}`],
2309
- options: [
2310
- baseUrl,
2311
- json,
2312
- yes
2313
- ],
2314
- result: [{
2315
- name: "installation.installation_id",
2316
- type: "number"
2317
- }, {
2318
- name: "outcome",
2319
- type: "\"unlinked\""
2320
- }],
2321
- shortcuts: ["delete", "rm"],
2322
- summary: "Unlink a GitHub installation"
2323
- }],
2324
- defaultChild: "list",
2325
- kind: "group",
2326
- name: "installations",
2327
- shortcuts: ["installation"],
2328
- summary: "Manage GitHub installations linked to Sandcovery CI"
2329
- }],
2330
- kind: "group",
2331
- name: "ci",
2332
- summary: "Run GitHub Actions jobs on sandboxes"
2333
- };
2334
- const telemetryLeaf = ({ name, summary }) => ({
2335
- arguments: [],
2336
- examples: [{
2337
- argv: [
2338
- "cli",
2339
- "telemetry",
2340
- name
2341
- ],
2342
- summary
2343
- }],
2344
- kind: "leaf",
2345
- name,
2346
- notes: ["Telemetry records command paths, option names, failure reasons, and exit codes, never values, paths, or remote data. SANDCOVERY_TELEMETRY_DISABLED=1 turns it off and wins over this setting."],
2347
- options: [json],
2348
- result: [{
2349
- name: "telemetry.enabled",
2350
- type: "boolean"
2351
- }, {
2352
- name: "telemetry.source",
2353
- type: "\"default\" | \"environment\" | \"settings\""
2354
- }],
2355
- summary
2356
- });
2357
- const help = {
2358
- children: [{
2359
- arguments: [{
2360
- missing: {
2361
- message: "Can't search commands without a query.",
2362
- reason: "missing_query"
2363
- },
2364
- name: "query",
2365
- summary: "Words to look for",
2366
- variadic: true
2367
- }],
2368
- examples: [{
2369
- argv: [
2370
- "help",
2371
- "search",
2372
- "destroy"
2373
- ],
2374
- summary: "Find the command for a task"
2375
- }],
2376
- kind: "leaf",
2377
- name: "search",
2378
- notes: ["Matches summaries, command names, and examples, works offline, and prints up to 10 commands."],
2379
- options: [json],
2380
- result: [{
2381
- name: "commands[].path",
2382
- type: "string"
2383
- }, {
2384
- name: "commands[].summary",
2385
- type: "string"
2386
- }],
2387
- summary: "Find commands by task"
2388
- }],
2389
- kind: "group",
2390
- name: "help",
2391
- options: [flag({
2392
- name: "all",
2393
- summary: "List every command"
2394
- })],
2395
- summary: "Show help for a command"
2396
- };
2397
- const CLI = {
2398
- bin: BIN,
2399
- globals: [
2400
- flag({
2401
- name: "debug",
2402
- short: "d",
2403
- summary: "Print diagnostic detail on stderr, with secrets left out"
2404
- }),
2405
- {
2406
- defaultText: "~/.config/sandcovery",
2407
- hint: "<DIR>",
2408
- kind: "value",
2409
- name: "global-config",
2410
- short: "Q",
2411
- summary: "Directory that holds the CLI settings"
2412
- },
2413
- flag({
2414
- name: "help",
2415
- short: "h",
2416
- summary: "Show help for the command and do nothing else"
2417
- }),
2418
- flag({
2419
- name: "no-color",
2420
- summary: "Turn off color"
2421
- }),
2422
- flag({
2423
- name: "non-interactive",
2424
- summary: "Never prompt; fail and name the missing input instead"
2425
- }),
2426
- {
2427
- hint: "<KEY>",
2428
- kind: "value",
2429
- name: "token",
2430
- short: "t",
2431
- summary: "API key or management key to authenticate with; prefer SANDCOVERY_API_KEY, since options show in process lists"
2432
- },
2433
- flag({
2434
- name: "version",
2435
- short: "v",
2436
- summary: "Print the CLI version"
2437
- })
2438
- ],
2439
- learnMore: "https://www.sandcovery.com/docs",
2440
- root: {
2441
- children: [
2442
- sandboxes,
2443
- docker,
2444
- keys,
2445
- credentials,
2446
- providers,
2447
- usage,
2448
- stats,
2449
- activity,
2450
- billing,
2451
- pricing,
2452
- ci,
2453
- help,
2454
- {
2455
- children: [{
2456
- children: [
2457
- telemetryLeaf({
2458
- name: "status",
2459
- summary: "Show whether telemetry is on"
2460
- }),
2461
- telemetryLeaf({
2462
- name: "enable",
2463
- summary: "Turn telemetry on"
2464
- }),
2465
- telemetryLeaf({
2466
- name: "disable",
2467
- summary: "Turn telemetry off"
2468
- })
2469
- ],
2470
- kind: "group",
2471
- name: "telemetry",
2472
- summary: "Turn usage data on or off, or show its status"
2473
- }],
2474
- kind: "group",
2475
- name: "cli",
2476
- summary: "Change settings of this CLI"
2477
- }
2478
- ],
2479
- kind: "group",
2480
- name: BIN,
2481
- notes: [
2482
- "SANDCOVERY_API_KEY holds an API key or management key from the dashboard; --token wins over it, an empty value counts as unset, and the CLI never saves it.",
2483
- "SANDCOVERY_BASE_URL sets the origin; --base-url wins over it. SANDCOVERY_TELEMETRY_DISABLED=1 turns telemetry off. SANDCOVERY_GUIDANCE_DISABLED=1 hides optional next steps. SANDCOVERY_ACCESSIBLE=1 prints words instead of status glyphs.",
2484
- "NO_COLOR or --no-color turns color off, FORCE_COLOR turns it on, and CI makes every command non-interactive."
2485
- ],
2486
- summary: "Create, run, and destroy sandboxes on any provider with one key"
2487
- },
2488
- tasks: [
2489
- {
2490
- paths: [
2491
- ["sandboxes", "create"],
2492
- ["sandboxes", "exec"],
2493
- ["sandboxes", "list"],
2494
- ["sandboxes", "destroy"],
2495
- ["sandboxes", "files"],
2496
- ["docker"]
2497
- ],
2498
- title: "Sandboxes"
2499
- },
2500
- {
2501
- paths: [
2502
- ["providers", "list"],
2503
- ["pricing", "inspect"],
2504
- ["usage", "estimate"],
2505
- ["usage", "inspect"],
2506
- ["usage", "live"],
2507
- ["usage", "totals"],
2508
- ["stats", "inspect"]
2509
- ],
2510
- title: "Providers and Cost"
2511
- },
2512
- {
2513
- paths: [
2514
- ["keys"],
2515
- ["credentials"],
2516
- ["activity", "list"],
2517
- ["billing"]
2518
- ],
2519
- title: "Account"
2520
- },
2521
- {
2522
- paths: [
2523
- ["help"],
2524
- ["help", "search"],
2525
- ["cli", "telemetry"]
2526
- ],
2527
- title: "Help and Settings"
2528
- }
2529
- ]
2530
- };
2531
- export { isUpper as A, escapeUnprintable as C, consistsOf as D, remoteText as E, usageFailure as F, Canceled as I, CliFailure as M, exitCodeOf as N, isDigit as O, statusOf as P, theme as S, remoteLine as T, clearLine as _, configDirectory as a, plainPrefix as b, flagOf as c, lastValue as d, parseFailure as f, valuesOf as g, rerunArgv as h, version as i, isWordCharacter as j, isDigits as k, isOptionToken as l, readOptionToken as m, CLEARABLE as n, writePrivateFile as o, parseLeaf as p, CLI as r, closest as s, BIN as t, isOptionValue as u, ellipsis as v, remoteCell as w, spinnerFrame as x, glyph as y };