sandcovery 0.5.0 → 0.6.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.
@@ -1,15 +1,32 @@
1
- import { E as fromJsonString, Fr as isString, Gn as isSuccess, Kn as try_, Mr as hasProperty, R as optional, S as decodeUnknownOption, Wn as isFailure, _ as Struct, c as Json, g as String$1, h as Record, n as Boolean, nr as getOrUndefined, w as decodeUnknownSync } from "./Schema-fLas6rbA.mjs";
2
- import { A as remoteCell, B as exitCodeOf, C as clearLine, D as spinnerFrame, E as plainPrefix, F as isDigit, H as usageFailure, L as isUpper, M as remoteText, N as noop, O as theme, P as consistsOf, R as isWordCharacter, T as glyph, U as Canceled, V as statusOf$1, _ as lastValue, a as version, b as readOptionToken, c as writePrivateFile, d as modeOf, f as productVariable, g as isOptionValue, h as isOptionToken, i as SETUP_MARK, j as remoteLine, k as escapeUnprintable, l as enabledVariable, m as flagOf, o as configDirectory, p as closest, r as CLI, t as BIN, u as guidanceOn, v as parseFailure, w as ellipsis, x as rerunArgv, y as parseLeaf, z as CliFailure } from "./spec-cGDeWJ3v.mjs";
3
- import { n as SANDCOVERY_ORIGIN } from "./origin-5maEGWRg.mjs";
4
- import { n as sendTelemetry$1, t as loopbackOrigin } from "./telemetry-BYnuVdoZ.mjs";
1
+ import { Br as isString, E as decodeUnknownSync, Ir as hasProperty, Jn as isSuccess, O as fromJsonString, V as optional, Yn as try_, _ as String$1, c as Json, g as Record, n as Boolean, or as getOrUndefined, qn as isFailure, v as Struct, w as decodeUnknownOption } from "./Schema-CoX0a2_o.mjs";
2
+ import { $ as exitCodeOf, A as isOptionValue, B as plainPrefix, C as enabledVariable, D as closest, E as productVariable, F as rerunArgv, G as remoteLine, H as theme, J as isDigit, K as remoteText, L as clearLine, M as parseFailure, N as parseLeaf, O as flagOf, P as readOptionToken, Q as CliFailure, R as ellipsis, S as writePrivateFile, T as modeOf, U as escapeUnprintable, V as spinnerFrame, W as remoteCell, X as isUpper, Z as isWordCharacter, b as configDirectory, d as BIN, et as statusOf$1, it as IDLE_WATCHER_ENV, j as lastValue, k as isOptionToken, l as setupDropIns, nt as Canceled, ot as watchIdle, p as CLI, q as consistsOf, r as forwardPorts, st as noop, t as FORWARDER_ENV, tt as usageFailure, w as guidanceOn, y as version, z as glyph } from "./port-forwarder-Du1VlKxg.mjs";
3
+ import { m as SANDCOVERY_ORIGIN } from "./src-lrpT0LG_.mjs";
4
+ import { n as sendTelemetry$1, t as loopbackOrigin } from "./telemetry-DBPKT8Ap.mjs";
5
5
  import "./posthog-project-CdWw_ofg.mjs";
6
6
  import http from "node:http";
7
+ import readline from "node:readline";
7
8
  import fs from "node:fs";
8
9
  import path from "node:path";
9
10
  import { buffer } from "node:stream/consumers";
10
- import readline from "node:readline";
11
- import crypto from "node:crypto";
12
- import os from "node:os";
11
+ // ../../node_modules/.pnpm/es-toolkit@1.53.1/node_modules/es-toolkit/dist/math/sum.mjs
12
+ /**
13
+ * Calculates the sum of an array of numbers.
14
+ *
15
+ * This function takes an array of numbers and returns the sum of all the elements in the array.
16
+ *
17
+ * @param nums - An array of numbers to be summed.
18
+ * @returns The sum of all the numbers in the array.
19
+ *
20
+ * @example
21
+ * const numbers = [1, 2, 3, 4, 5];
22
+ * const result = sum(numbers);
23
+ * // result will be 15
24
+ */
25
+ function sum(nums) {
26
+ let result = 0;
27
+ for (let i = 0; i < nums.length; i++) result += nums[i];
28
+ return result;
29
+ }
13
30
  // ../cli-core/src/layout.ts
14
31
  const combining = /\p{M}/u;
15
32
  const pictographic = /\p{Extended_Pictographic}/u;
@@ -82,25 +99,6 @@ const twoColumn = ({ decorate = (text) => text, entries, indentBy, width }) => {
82
99
  return [`${lead}${" ".repeat(column - indentBy - displayWidth(syntax))}${first}`, ...indent(rest, column)];
83
100
  });
84
101
  };
85
- // ../../node_modules/.pnpm/es-toolkit@1.53.1/node_modules/es-toolkit/dist/math/sum.mjs
86
- /**
87
- * Calculates the sum of an array of numbers.
88
- *
89
- * This function takes an array of numbers and returns the sum of all the elements in the array.
90
- *
91
- * @param nums - An array of numbers to be summed.
92
- * @returns The sum of all the numbers in the array.
93
- *
94
- * @example
95
- * const numbers = [1, 2, 3, 4, 5];
96
- * const result = sum(numbers);
97
- * // result will be 15
98
- */
99
- function sum(nums) {
100
- let result = 0;
101
- for (let i = 0; i < nums.length; i++) result += nums[i];
102
- return result;
103
- }
104
102
  // ../../node_modules/.pnpm/es-toolkit@1.53.1/node_modules/es-toolkit/dist/object/omitBy.mjs
105
103
  /**
106
104
  * Creates a new object composed of the properties that do not satisfy the predicate function.
@@ -1109,399 +1107,6 @@ const telemetryCommand = ({ action, bin, env = process.env, file, io }) => {
1109
1107
  file
1110
1108
  }), enabled ? "enabled" : "disabled");
1111
1109
  };
1112
- // src/cli/commands/setup.ts
1113
- const DROP_INS = [{
1114
- binary: "sandcovery-docker",
1115
- tool: "docker"
1116
- }, {
1117
- binary: "sandcovery-kubectl",
1118
- tool: "kubectl"
1119
- }];
1120
- const LINE_MARK = ` ${SETUP_MARK}`;
1121
- const SHIM_HEAD = `#!/bin/sh\n${SETUP_MARK}\n`;
1122
- const BASH_LOGIN = [
1123
- ".bash_profile",
1124
- ".bash_login",
1125
- ".profile"
1126
- ];
1127
- const ZSH_FILES = [".zshenv", ".zshrc"];
1128
- const FILE_TYPE_UNIT = 4096;
1129
- const UNREACHABLE = /* @__PURE__ */ new Set([
1130
- "EACCES",
1131
- "EEXIST",
1132
- "EISDIR",
1133
- "ENOTDIR",
1134
- "EPERM",
1135
- "EROFS"
1136
- ]);
1137
- const EMPTY = {
1138
- changes: [],
1139
- edits: []
1140
- };
1141
- const joined = (plans) => ({
1142
- changes: plans.flatMap(({ changes }) => changes),
1143
- edits: plans.flatMap(({ edits }) => edits)
1144
- });
1145
- const touched = ({ file, verb, work }) => {
1146
- const done = try_(work);
1147
- if (isSuccess(done)) return done.success;
1148
- const { failure } = done;
1149
- const code = hasProperty(failure, "code") && isString(failure.code) ? failure.code : "";
1150
- if (!UNREACHABLE.has(code)) throw failure;
1151
- throw new CliFailure({
1152
- message: verb === "read" ? `Can't read ${file} (${code}). Nothing was changed.` : `Can't write ${file} (${code}). Run the command again once it is writable, and it lists what is left.`,
1153
- reason: "permission_denied"
1154
- });
1155
- };
1156
- const statOf = (file) => touched({
1157
- file,
1158
- verb: "read",
1159
- work: () => fs.lstatSync(file, { throwIfNoEntry: false })
1160
- });
1161
- const textOf = (file) => fs.existsSync(file) ? touched({
1162
- file,
1163
- verb: "read",
1164
- work: () => fs.readFileSync(file, "utf-8")
1165
- }) : void 0;
1166
- const envValue = (name) => {
1167
- const value = process.env[name];
1168
- return value === void 0 || value === "" ? void 0 : value;
1169
- };
1170
- const fishQuoted = (text) => text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("$", "\\$");
1171
- const posixQuoted = (text) => fishQuoted(text).replaceAll("`", "\\`");
1172
- const posixLine = (shims) => `export PATH="${posixQuoted(shims)}:$PATH"${LINE_MARK}`;
1173
- const fishLine = (shims) => `set -gx PATH "${fishQuoted(shims)}" $PATH${LINE_MARK}`;
1174
- const shimText = (binary) => `${SHIM_HEAD}exec ${binary} "$@"\n`;
1175
- const executable = (file) => {
1176
- const found = try_(() => {
1177
- fs.accessSync(file, fs.constants.X_OK);
1178
- return fs.statSync(file).isFile();
1179
- });
1180
- return isSuccess(found) && found.success;
1181
- };
1182
- const onPath = ({ name, shims }) => (process.env.PATH ?? "").split(path.delimiter).flatMap((folder) => path.isAbsolute(folder) && path.resolve(folder) !== shims ? [path.join(folder, name)] : []).find(executable) ?? null;
1183
- const zshFolder = (home) => envValue("ZDOTDIR") ?? home;
1184
- const fishConfig = (configHome) => path.join(configHome, "fish", "config.fish");
1185
- const defaultConfigHome = (home) => path.join(home, ".config");
1186
- const shellsOf = (home) => {
1187
- const bashLogin = BASH_LOGIN.map((name) => path.join(home, name)).find((file) => fs.existsSync(file)) ?? path.join(home, ".profile");
1188
- return [
1189
- {
1190
- files: [path.join(home, ".bashrc"), bashLogin],
1191
- line: posixLine,
1192
- name: "bash"
1193
- },
1194
- {
1195
- files: ZSH_FILES.map((name) => path.join(zshFolder(home), name)),
1196
- line: posixLine,
1197
- name: "zsh"
1198
- },
1199
- {
1200
- files: [fishConfig(envValue("XDG_CONFIG_HOME") ?? defaultConfigHome(home))],
1201
- line: fishLine,
1202
- name: "fish"
1203
- }
1204
- ];
1205
- };
1206
- const everyStartupFile = (home) => [.../* @__PURE__ */ new Set([
1207
- ...[".bashrc", ...BASH_LOGIN].map((name) => path.join(home, name)),
1208
- ...[zshFolder(home), home].flatMap((folder) => ZSH_FILES.map((name) => path.join(folder, name))),
1209
- ...[envValue("XDG_CONFIG_HOME") ?? defaultConfigHome(home), defaultConfigHome(home)].map(fishConfig)
1210
- ])];
1211
- const appended = (line) => (text) => {
1212
- if (text.split("\n").includes(line)) return text;
1213
- return `${text}${text === "" || text.endsWith("\n") ? "" : "\n"}${line}\n`;
1214
- };
1215
- const withoutMarked = (text) => text.split("\n").filter((line) => !line.endsWith(LINE_MARK)).join("\n");
1216
- const folderEntries = (folder) => statOf(folder)?.isDirectory() === true ? touched({
1217
- file: folder,
1218
- verb: "read",
1219
- work: () => fs.readdirSync(folder)
1220
- }).map((name) => path.join(folder, name)).toSorted() : [];
1221
- const isOwnShim = (file) => statOf(file)?.isFile() === true && (textOf(file) ?? "").startsWith(SHIM_HEAD);
1222
- const shimDeletion = (file) => ({
1223
- changes: [{
1224
- action: "delete",
1225
- file,
1226
- line: null,
1227
- summary: "Delete this shim",
1228
- text: null
1229
- }],
1230
- edits: [{
1231
- file,
1232
- kind: "delete"
1233
- }]
1234
- });
1235
- const shimWrite = ({ binary, shims, tool }) => {
1236
- const file = path.join(shims, tool);
1237
- const text = shimText(binary);
1238
- const stat = statOf(file);
1239
- if (stat !== void 0) {
1240
- const current = stat.isFile() ? textOf(file) : void 0;
1241
- if (current === text) return EMPTY;
1242
- if (current === void 0 || !current.startsWith(SHIM_HEAD)) throw new CliFailure({
1243
- message: `Can't write the ${tool} shim. ${file} is not a file sandcovery setup wrote, so it stays as it is.`,
1244
- reason: "conflict",
1245
- recovery: [{ instruction: `Move ${file} out of ${shims}, then run sandcovery setup again` }]
1246
- });
1247
- }
1248
- return {
1249
- changes: [{
1250
- action: "write",
1251
- file,
1252
- line: null,
1253
- summary: `Write a shim that runs ${binary}`,
1254
- text
1255
- }],
1256
- edits: [{
1257
- file,
1258
- kind: "shim",
1259
- text
1260
- }]
1261
- };
1262
- };
1263
- const shimPlan = ({ dropIns, shims }) => {
1264
- const wanted = dropIns.filter(({ installed }) => installed);
1265
- const tools = new Set(wanted.map(({ tool }) => tool));
1266
- return joined([...wanted.map(({ binary, tool }) => shimWrite({
1267
- binary,
1268
- shims,
1269
- tool
1270
- })), ...folderEntries(shims).flatMap((file) => tools.has(path.basename(file)) || !isOwnShim(file) ? [] : [shimDeletion(file)])]);
1271
- };
1272
- const lineAddition = ({ file, text }) => {
1273
- const current = textOf(file) ?? "";
1274
- return appended(text)(current) === current ? EMPTY : {
1275
- changes: [{
1276
- action: "append",
1277
- file,
1278
- line: null,
1279
- summary: `Add: ${text}`,
1280
- text
1281
- }],
1282
- edits: [{
1283
- change: appended(text),
1284
- file,
1285
- kind: "startup"
1286
- }]
1287
- };
1288
- };
1289
- const linePlan = ({ home, shims }) => {
1290
- const login = path.basename(envValue("SHELL") ?? "");
1291
- return joined(shellsOf(home).flatMap(({ files, line, name }) => name === login || files.some((file) => fs.existsSync(file)) ? files.map((file) => lineAddition({
1292
- file,
1293
- text: line(shims)
1294
- })) : []));
1295
- };
1296
- const lineRemovals = (file) => {
1297
- const text = textOf(file);
1298
- if (text === void 0) return EMPTY;
1299
- const marked = text.split("\n").flatMap((line, index) => line.endsWith(LINE_MARK) ? [{
1300
- line: index + 1,
1301
- text: line
1302
- }] : []);
1303
- if (marked.length === 0) return EMPTY;
1304
- const deletion = withoutMarked(text) === "" && statOf(file)?.isFile() === true ? [{
1305
- action: "delete",
1306
- file,
1307
- line: null,
1308
- summary: "Delete this file, which holds nothing else",
1309
- text: null
1310
- }] : [];
1311
- return {
1312
- changes: [...marked.map(({ line, text: content }) => ({
1313
- action: "remove",
1314
- file,
1315
- line,
1316
- summary: `Remove line ${String(line)}: ${content}`,
1317
- text: content
1318
- })), ...deletion],
1319
- edits: [{
1320
- change: withoutMarked,
1321
- file,
1322
- kind: "startup"
1323
- }]
1324
- };
1325
- };
1326
- const undoPlan = ({ home, shims }) => {
1327
- const entries = folderEntries(shims);
1328
- const own = entries.filter(isOwnShim);
1329
- const folderGoes = statOf(shims)?.isDirectory() === true && own.length === entries.length;
1330
- return joined([
1331
- ...everyStartupFile(home).map(lineRemovals),
1332
- ...own.map(shimDeletion),
1333
- folderGoes ? {
1334
- changes: [{
1335
- action: "delete",
1336
- file: shims,
1337
- line: null,
1338
- summary: "Delete this empty folder",
1339
- text: null
1340
- }],
1341
- edits: [{
1342
- file: shims,
1343
- kind: "folder"
1344
- }]
1345
- } : EMPTY
1346
- ]);
1347
- };
1348
- const replaceText = ({ file, mode, text }) => {
1349
- const folder = path.dirname(file);
1350
- fs.mkdirSync(folder, { recursive: true });
1351
- const pending = path.join(folder, `.${path.basename(file)}.${crypto.randomBytes(8).toString("hex")}.tmp`);
1352
- fs.writeFileSync(pending, text, { flag: "wx" });
1353
- if (mode !== void 0) fs.chmodSync(pending, mode);
1354
- fs.renameSync(pending, file);
1355
- };
1356
- const rewrite = ({ change, file }) => {
1357
- const target = fs.existsSync(file) ? fs.realpathSync(file) : file;
1358
- const before = textOf(target) ?? "";
1359
- const after = change(before);
1360
- if (after === before) return;
1361
- if (after === "" && statOf(file)?.isFile() === true) {
1362
- fs.rmSync(file);
1363
- return;
1364
- }
1365
- const stat = statOf(target);
1366
- replaceText({
1367
- file: target,
1368
- mode: stat === void 0 ? void 0 : stat.mode % FILE_TYPE_UNIT,
1369
- text: after
1370
- });
1371
- };
1372
- const apply = (edit) => {
1373
- touched({
1374
- file: edit.file,
1375
- verb: "write",
1376
- work: () => {
1377
- if (edit.kind === "startup") rewrite(edit);
1378
- else if (edit.kind === "shim") {
1379
- fs.mkdirSync(path.dirname(edit.file), {
1380
- mode: 448,
1381
- recursive: true
1382
- });
1383
- replaceText({
1384
- file: edit.file,
1385
- mode: 493,
1386
- text: edit.text
1387
- });
1388
- } else if (edit.kind === "delete") fs.rmSync(edit.file, { force: true });
1389
- else if (fs.readdirSync(edit.file).length === 0) fs.rmdirSync(edit.file);
1390
- }
1391
- });
1392
- };
1393
- const resultOf = ({ changes, dropIns }) => ({
1394
- changes: changes.map(({ action, file, line, text }) => ({
1395
- action,
1396
- file,
1397
- line,
1398
- text
1399
- })),
1400
- drop_ins: dropIns
1401
- });
1402
- const toolNotes = (dropIns) => dropIns.map(({ binary, installed, real_path: realPath, tool }) => {
1403
- if (!installed) return `${tool} stays as it is, since ${binary} isn't installed.`;
1404
- return realPath === null ? `${tool} runs ${binary} in each new terminal.` : `${tool} runs ${binary} in each new terminal. Your own ${tool} stays at ${realPath} and runs by that full path.`;
1405
- });
1406
- const confirmed = async ({ changes, context, dropIns, notes, undo }) => {
1407
- context.io.context(changes.map(({ file, summary }) => ({
1408
- label: file,
1409
- value: summary
1410
- })));
1411
- context.io.note(notes);
1412
- if (flagOf(context.options, "yes") === true) return;
1413
- if (!context.mode.interactive || context.prompter === void 0) throw new CliFailure({
1414
- data: resultOf({
1415
- changes,
1416
- dropIns
1417
- }),
1418
- message: `Can't ${undo ? "undo sandcovery setup" : "set up drop-ins"} without --yes in non-interactive mode.`,
1419
- reason: "confirmation_required",
1420
- recovery: [{
1421
- instruction: "After a person approves the changes listed, run",
1422
- next: {
1423
- argv: [...context.rerun, "--yes"],
1424
- when: "Only after a human approves the listed changes"
1425
- }
1426
- }],
1427
- userActionRequired: true
1428
- });
1429
- if (!await context.prompter.confirm("Make these changes?")) throw new Canceled({
1430
- remote: "none",
1431
- signal: "SIGINT"
1432
- });
1433
- };
1434
- const shimFolder = (context) => {
1435
- const shims = path.join(path.dirname(context.settingsFile), "bin");
1436
- const characters = new Set(shims);
1437
- if (characters.has(path.delimiter) || characters.has("\n")) throw new CliFailure({
1438
- message: `Can't put ${shims} on PATH, since PATH can't hold a folder whose name has a colon or a line break.`,
1439
- reason: "invalid_arguments",
1440
- recovery: [{ instruction: "Choose another settings folder with --global-config" }]
1441
- });
1442
- return shims;
1443
- };
1444
- const setupDropIns = async (context) => {
1445
- if (process.platform === "win32") throw new CliFailure({
1446
- message: "Can't set up drop-ins on Windows. sandcovery setup changes the startup files of bash, zsh, and fish.",
1447
- reason: "unsupported"
1448
- });
1449
- const undo = flagOf(context.options, "undo") === true;
1450
- const home = os.homedir();
1451
- const shims = shimFolder(context);
1452
- const dropIns = DROP_INS.map(({ binary, tool }) => ({
1453
- binary,
1454
- installed: onPath({
1455
- name: binary,
1456
- shims
1457
- }) !== null,
1458
- real_path: onPath({
1459
- name: tool,
1460
- shims
1461
- }),
1462
- tool
1463
- }));
1464
- if (!undo && dropIns.every(({ installed }) => !installed)) throw new CliFailure({
1465
- message: `Can't set up drop-ins. None of ${DROP_INS.map(({ binary }) => binary).join(", ")} is on PATH.`,
1466
- notes: ["They come with the sandcovery npm package: npm install --global sandcovery."],
1467
- reason: "not_found"
1468
- });
1469
- const plan = undo ? undoPlan({
1470
- home,
1471
- shims
1472
- }) : joined([shimPlan({
1473
- dropIns,
1474
- shims
1475
- }), linePlan({
1476
- home,
1477
- shims
1478
- })]);
1479
- const notes = undo ? [] : toolNotes(dropIns);
1480
- if (plan.changes.length === 0) {
1481
- context.io.note([undo ? "Nothing to undo." : "Nothing to change.", ...notes]);
1482
- return { document: resultOf({
1483
- changes: [],
1484
- dropIns
1485
- }) };
1486
- }
1487
- await confirmed({
1488
- changes: plan.changes,
1489
- context,
1490
- dropIns,
1491
- notes,
1492
- undo
1493
- });
1494
- for (const edit of plan.edits) apply(edit);
1495
- context.io.receipt({
1496
- outcome: undo ? "Undone" : "Set up",
1497
- target: shims
1498
- });
1499
- if (!undo) context.io.note(["Open a new terminal, so the shims come first on PATH there."]);
1500
- return { document: resultOf({
1501
- changes: plan.changes,
1502
- dropIns
1503
- }) };
1504
- };
1505
1110
  // src/cli/local.ts
1506
1111
  const helpSearch = (context) => {
1507
1112
  const query = (context.arguments.query ?? []).join(" ");
@@ -1704,6 +1309,7 @@ const runCommand = async ({ invocation, session }) => {
1704
1309
  arguments: input.arguments,
1705
1310
  debug: debugLine(session),
1706
1311
  dropIn: session.dropIn,
1312
+ entry: session.entry,
1707
1313
  io: session.out,
1708
1314
  mode: session.mode,
1709
1315
  now: /* @__PURE__ */ new Date(),
@@ -1734,7 +1340,7 @@ const runCommand = async ({ invocation, session }) => {
1734
1340
  try {
1735
1341
  const local = LOCAL_COMMANDS.get(key);
1736
1342
  if (local !== void 0) return await local(context);
1737
- const { HANDLERS } = await import("./handlers-qYjkPftS.mjs");
1343
+ const { HANDLERS } = await import("./handlers-U3pqRNro.mjs");
1738
1344
  const handler = HANDLERS.get(key);
1739
1345
  if (handler === void 0) throw internalFailure(invocation.path);
1740
1346
  return await handler(context);
@@ -1886,7 +1492,7 @@ const originFor = (options) => {
1886
1492
  const chosen = [lastValue(options, "base-url"), process.env.SANDCOVERY_BASE_URL].find((value) => value !== void 0 && value.trim() !== "");
1887
1493
  return chosen === void 0 ? SANDCOVERY_ORIGIN : URL.parse(chosen.trim())?.origin ?? chosen;
1888
1494
  };
1889
- const run = async ({ argv, dropIn = false, io, signal }) => {
1495
+ const run = async ({ argv, dropIn = false, entry, io, signal }) => {
1890
1496
  const line = readCommandLine({
1891
1497
  argv,
1892
1498
  cli: CLI,
@@ -1905,6 +1511,7 @@ const run = async ({ argv, dropIn = false, io, signal }) => {
1905
1511
  });
1906
1512
  const session = {
1907
1513
  dropIn,
1514
+ entry,
1908
1515
  globals,
1909
1516
  invocation,
1910
1517
  io,
@@ -1960,8 +1567,12 @@ const applyProxyFromEnv = () => {
1960
1567
  };
1961
1568
  const start = async ({ argv, dropIn = false }) => {
1962
1569
  const event = process.env.__SANDCOVERY_TELEMETRY_EVENT;
1570
+ const forwarder = process.env[FORWARDER_ENV];
1571
+ const idle = process.env[IDLE_WATCHER_ENV];
1963
1572
  applyProxyFromEnv();
1964
- if (event === void 0) {
1573
+ if (forwarder !== void 0) await forwardPorts(forwarder);
1574
+ else if (idle !== void 0) await watchIdle(idle);
1575
+ else if (event === void 0) {
1965
1576
  quietOnBrokenPipe(process.stdout);
1966
1577
  quietOnBrokenPipe(process.stderr);
1967
1578
  const controller = new AbortController();
@@ -1972,6 +1583,7 @@ const start = async ({ argv, dropIn = false }) => {
1972
1583
  process.exitCode = await run({
1973
1584
  argv,
1974
1585
  dropIn,
1586
+ entry: process.argv[1],
1975
1587
  io: {
1976
1588
  stderr: process.stderr,
1977
1589
  stdin: process.stdin,
@@ -1980,7 +1592,7 @@ const start = async ({ argv, dropIn = false }) => {
1980
1592
  signal: controller.signal
1981
1593
  });
1982
1594
  } else {
1983
- const [{ deliverTelemetry }, project] = await Promise.all([import("./telemetry-delivery-8t5RXWli.mjs"), import("./posthog-project-BpOd2VxW.mjs")]);
1595
+ const [{ deliverTelemetry }, project] = await Promise.all([import("./telemetry-delivery-BSGibWPJ.mjs"), import("./posthog-project-BpOd2VxW.mjs")]);
1984
1596
  await deliverTelemetry({
1985
1597
  host: process.env.__SANDCOVERY_POSTHOG_HOST,
1986
1598
  productionHost: project.POSTHOG_INGEST_HOST,
@@ -1,8 +1,8 @@
1
- import { E as fromJsonString, R as optional, S as decodeUnknownOption, _ as Struct, g as String$1, rr as isNone, s as Int, t as ArraySchema } from "./Schema-fLas6rbA.mjs";
2
- import { t as loopbackOrigin } from "./telemetry-BYnuVdoZ.mjs";
1
+ import { O as fromJsonString, V as optional, _ as String$1, s as Int, sr as isNone, t as ArraySchema, v as Struct, w as decodeUnknownOption } from "./Schema-CoX0a2_o.mjs";
2
+ import { t as loopbackOrigin } from "./telemetry-DBPKT8Ap.mjs";
3
+ import { createInterface } from "node:readline";
3
4
  import { constants } from "node:fs";
4
5
  import { isAbsolute } from "node:path";
5
- import { createInterface } from "node:readline";
6
6
  import { platform, release } from "node:os";
7
7
  import { dirname, isAbsolute as isAbsolute$1, posix as posix$1, relative, sep } from "path";
8
8
  import { open } from "node:fs/promises";