@candor.sh/cli 0.5.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.
- package/dist/index.cjs +184 -749
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -1149,10 +1149,10 @@ var require_suggestSimilar = __commonJS({
|
|
|
1149
1149
|
var require_command = __commonJS({
|
|
1150
1150
|
"../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js"(exports2) {
|
|
1151
1151
|
var EventEmitter = require("node:events").EventEmitter;
|
|
1152
|
-
var
|
|
1153
|
-
var
|
|
1154
|
-
var
|
|
1155
|
-
var
|
|
1152
|
+
var childProcess = require("node:child_process");
|
|
1153
|
+
var path = require("node:path");
|
|
1154
|
+
var fs = require("node:fs");
|
|
1155
|
+
var process3 = require("node:process");
|
|
1156
1156
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1157
1157
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1158
1158
|
var { Help: Help2, stripColor } = require_help();
|
|
@@ -1199,13 +1199,13 @@ var require_command = __commonJS({
|
|
|
1199
1199
|
this._showSuggestionAfterError = true;
|
|
1200
1200
|
this._savedState = null;
|
|
1201
1201
|
this._outputConfiguration = {
|
|
1202
|
-
writeOut: (str) =>
|
|
1203
|
-
writeErr: (str) =>
|
|
1202
|
+
writeOut: (str) => process3.stdout.write(str),
|
|
1203
|
+
writeErr: (str) => process3.stderr.write(str),
|
|
1204
1204
|
outputError: (str, write) => write(str),
|
|
1205
|
-
getOutHelpWidth: () =>
|
|
1206
|
-
getErrHelpWidth: () =>
|
|
1207
|
-
getOutHasColors: () => useColor() ?? (
|
|
1208
|
-
getErrHasColors: () => useColor() ?? (
|
|
1205
|
+
getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : void 0,
|
|
1206
|
+
getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : void 0,
|
|
1207
|
+
getOutHasColors: () => useColor() ?? (process3.stdout.isTTY && process3.stdout.hasColors?.()),
|
|
1208
|
+
getErrHasColors: () => useColor() ?? (process3.stderr.isTTY && process3.stderr.hasColors?.()),
|
|
1209
1209
|
stripColor: (str) => stripColor(str)
|
|
1210
1210
|
};
|
|
1211
1211
|
this._hidden = false;
|
|
@@ -1588,7 +1588,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1588
1588
|
if (this._exitCallback) {
|
|
1589
1589
|
this._exitCallback(new CommanderError2(exitCode, code, message));
|
|
1590
1590
|
}
|
|
1591
|
-
|
|
1591
|
+
process3.exit(exitCode);
|
|
1592
1592
|
}
|
|
1593
1593
|
/**
|
|
1594
1594
|
* Register callback `fn` for the command.
|
|
@@ -1986,16 +1986,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1986
1986
|
}
|
|
1987
1987
|
parseOptions = parseOptions || {};
|
|
1988
1988
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
1989
|
-
if (
|
|
1989
|
+
if (process3.versions?.electron) {
|
|
1990
1990
|
parseOptions.from = "electron";
|
|
1991
1991
|
}
|
|
1992
|
-
const execArgv =
|
|
1992
|
+
const execArgv = process3.execArgv ?? [];
|
|
1993
1993
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
|
|
1994
1994
|
parseOptions.from = "eval";
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
1997
1997
|
if (argv === void 0) {
|
|
1998
|
-
argv =
|
|
1998
|
+
argv = process3.argv;
|
|
1999
1999
|
}
|
|
2000
2000
|
this.rawArgs = argv.slice();
|
|
2001
2001
|
let userArgs;
|
|
@@ -2006,7 +2006,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2006
2006
|
userArgs = argv.slice(2);
|
|
2007
2007
|
break;
|
|
2008
2008
|
case "electron":
|
|
2009
|
-
if (
|
|
2009
|
+
if (process3.defaultApp) {
|
|
2010
2010
|
this._scriptPath = argv[1];
|
|
2011
2011
|
userArgs = argv.slice(2);
|
|
2012
2012
|
} else {
|
|
@@ -2132,7 +2132,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2132
2132
|
* @param {string} subcommandName
|
|
2133
2133
|
*/
|
|
2134
2134
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2135
|
-
if (
|
|
2135
|
+
if (fs.existsSync(executableFile)) return;
|
|
2136
2136
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
2137
2137
|
const executableMissing = `'${executableFile}' does not exist
|
|
2138
2138
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -2150,11 +2150,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2150
2150
|
let launchWithNode = false;
|
|
2151
2151
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2152
2152
|
function findFile(baseDir, baseName) {
|
|
2153
|
-
const localBin =
|
|
2154
|
-
if (
|
|
2155
|
-
if (sourceExt.includes(
|
|
2153
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
2154
|
+
if (fs.existsSync(localBin)) return localBin;
|
|
2155
|
+
if (sourceExt.includes(path.extname(baseName))) return void 0;
|
|
2156
2156
|
const foundExt = sourceExt.find(
|
|
2157
|
-
(ext) =>
|
|
2157
|
+
(ext) => fs.existsSync(`${localBin}${ext}`)
|
|
2158
2158
|
);
|
|
2159
2159
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2160
2160
|
return void 0;
|
|
@@ -2166,21 +2166,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2166
2166
|
if (this._scriptPath) {
|
|
2167
2167
|
let resolvedScriptPath;
|
|
2168
2168
|
try {
|
|
2169
|
-
resolvedScriptPath =
|
|
2169
|
+
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
2170
2170
|
} catch {
|
|
2171
2171
|
resolvedScriptPath = this._scriptPath;
|
|
2172
2172
|
}
|
|
2173
|
-
executableDir =
|
|
2174
|
-
|
|
2173
|
+
executableDir = path.resolve(
|
|
2174
|
+
path.dirname(resolvedScriptPath),
|
|
2175
2175
|
executableDir
|
|
2176
2176
|
);
|
|
2177
2177
|
}
|
|
2178
2178
|
if (executableDir) {
|
|
2179
2179
|
let localFile = findFile(executableDir, executableFile);
|
|
2180
2180
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2181
|
-
const legacyName =
|
|
2181
|
+
const legacyName = path.basename(
|
|
2182
2182
|
this._scriptPath,
|
|
2183
|
-
|
|
2183
|
+
path.extname(this._scriptPath)
|
|
2184
2184
|
);
|
|
2185
2185
|
if (legacyName !== this._name) {
|
|
2186
2186
|
localFile = findFile(
|
|
@@ -2191,15 +2191,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2191
2191
|
}
|
|
2192
2192
|
executableFile = localFile || executableFile;
|
|
2193
2193
|
}
|
|
2194
|
-
launchWithNode = sourceExt.includes(
|
|
2194
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
2195
2195
|
let proc;
|
|
2196
|
-
if (
|
|
2196
|
+
if (process3.platform !== "win32") {
|
|
2197
2197
|
if (launchWithNode) {
|
|
2198
2198
|
args.unshift(executableFile);
|
|
2199
|
-
args = incrementNodeInspectorPort(
|
|
2200
|
-
proc =
|
|
2199
|
+
args = incrementNodeInspectorPort(process3.execArgv).concat(args);
|
|
2200
|
+
proc = childProcess.spawn(process3.argv[0], args, { stdio: "inherit" });
|
|
2201
2201
|
} else {
|
|
2202
|
-
proc =
|
|
2202
|
+
proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
2203
2203
|
}
|
|
2204
2204
|
} else {
|
|
2205
2205
|
this._checkForMissingExecutable(
|
|
@@ -2208,13 +2208,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2208
2208
|
subcommand._name
|
|
2209
2209
|
);
|
|
2210
2210
|
args.unshift(executableFile);
|
|
2211
|
-
args = incrementNodeInspectorPort(
|
|
2212
|
-
proc =
|
|
2211
|
+
args = incrementNodeInspectorPort(process3.execArgv).concat(args);
|
|
2212
|
+
proc = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
|
|
2213
2213
|
}
|
|
2214
2214
|
if (!proc.killed) {
|
|
2215
2215
|
const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
2216
2216
|
signals.forEach((signal) => {
|
|
2217
|
-
|
|
2217
|
+
process3.on(signal, () => {
|
|
2218
2218
|
if (proc.killed === false && proc.exitCode === null) {
|
|
2219
2219
|
proc.kill(signal);
|
|
2220
2220
|
}
|
|
@@ -2225,7 +2225,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2225
2225
|
proc.on("close", (code) => {
|
|
2226
2226
|
code = code ?? 1;
|
|
2227
2227
|
if (!exitCallback) {
|
|
2228
|
-
|
|
2228
|
+
process3.exit(code);
|
|
2229
2229
|
} else {
|
|
2230
2230
|
exitCallback(
|
|
2231
2231
|
new CommanderError2(
|
|
@@ -2247,7 +2247,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2247
2247
|
throw new Error(`'${executableFile}' not executable`);
|
|
2248
2248
|
}
|
|
2249
2249
|
if (!exitCallback) {
|
|
2250
|
-
|
|
2250
|
+
process3.exit(1);
|
|
2251
2251
|
} else {
|
|
2252
2252
|
const wrappedError = new CommanderError2(
|
|
2253
2253
|
1,
|
|
@@ -2742,13 +2742,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2742
2742
|
*/
|
|
2743
2743
|
_parseOptionsEnv() {
|
|
2744
2744
|
this.options.forEach((option) => {
|
|
2745
|
-
if (option.envVar && option.envVar in
|
|
2745
|
+
if (option.envVar && option.envVar in process3.env) {
|
|
2746
2746
|
const optionKey = option.attributeName();
|
|
2747
2747
|
if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
|
|
2748
2748
|
this.getOptionValueSource(optionKey)
|
|
2749
2749
|
)) {
|
|
2750
2750
|
if (option.required || option.optional) {
|
|
2751
|
-
this.emit(`optionEnv:${option.name()}`,
|
|
2751
|
+
this.emit(`optionEnv:${option.name()}`, process3.env[option.envVar]);
|
|
2752
2752
|
} else {
|
|
2753
2753
|
this.emit(`optionEnv:${option.name()}`);
|
|
2754
2754
|
}
|
|
@@ -3038,7 +3038,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3038
3038
|
* @return {Command}
|
|
3039
3039
|
*/
|
|
3040
3040
|
nameFromFilename(filename) {
|
|
3041
|
-
this._name =
|
|
3041
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
3042
3042
|
return this;
|
|
3043
3043
|
}
|
|
3044
3044
|
/**
|
|
@@ -3052,9 +3052,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3052
3052
|
* @param {string} [path]
|
|
3053
3053
|
* @return {(string|null|Command)}
|
|
3054
3054
|
*/
|
|
3055
|
-
executableDir(
|
|
3056
|
-
if (
|
|
3057
|
-
this._executableDir =
|
|
3055
|
+
executableDir(path2) {
|
|
3056
|
+
if (path2 === void 0) return this._executableDir;
|
|
3057
|
+
this._executableDir = path2;
|
|
3058
3058
|
return this;
|
|
3059
3059
|
}
|
|
3060
3060
|
/**
|
|
@@ -3203,7 +3203,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3203
3203
|
*/
|
|
3204
3204
|
help(contextOptions) {
|
|
3205
3205
|
this.outputHelp(contextOptions);
|
|
3206
|
-
let exitCode = Number(
|
|
3206
|
+
let exitCode = Number(process3.exitCode ?? 0);
|
|
3207
3207
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
3208
3208
|
exitCode = 1;
|
|
3209
3209
|
}
|
|
@@ -3293,9 +3293,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3293
3293
|
});
|
|
3294
3294
|
}
|
|
3295
3295
|
function useColor() {
|
|
3296
|
-
if (
|
|
3296
|
+
if (process3.env.NO_COLOR || process3.env.FORCE_COLOR === "0" || process3.env.FORCE_COLOR === "false")
|
|
3297
3297
|
return false;
|
|
3298
|
-
if (
|
|
3298
|
+
if (process3.env.FORCE_COLOR || process3.env.CLICOLOR_FORCE !== void 0)
|
|
3299
3299
|
return true;
|
|
3300
3300
|
return void 0;
|
|
3301
3301
|
}
|
|
@@ -3326,596 +3326,6 @@ var require_commander = __commonJS({
|
|
|
3326
3326
|
}
|
|
3327
3327
|
});
|
|
3328
3328
|
|
|
3329
|
-
// ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
3330
|
-
function hasDockerEnv() {
|
|
3331
|
-
try {
|
|
3332
|
-
import_node_fs.default.statSync("/.dockerenv");
|
|
3333
|
-
return true;
|
|
3334
|
-
} catch {
|
|
3335
|
-
return false;
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
function hasDockerCGroup() {
|
|
3339
|
-
try {
|
|
3340
|
-
return import_node_fs.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
3341
|
-
} catch {
|
|
3342
|
-
return false;
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
function isDocker() {
|
|
3346
|
-
if (isDockerCached === void 0) {
|
|
3347
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
3348
|
-
}
|
|
3349
|
-
return isDockerCached;
|
|
3350
|
-
}
|
|
3351
|
-
var import_node_fs, isDockerCached;
|
|
3352
|
-
var init_is_docker = __esm({
|
|
3353
|
-
"../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js"() {
|
|
3354
|
-
import_node_fs = __toESM(require("node:fs"), 1);
|
|
3355
|
-
}
|
|
3356
|
-
});
|
|
3357
|
-
|
|
3358
|
-
// ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
3359
|
-
function isInsideContainer() {
|
|
3360
|
-
if (cachedResult === void 0) {
|
|
3361
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
3362
|
-
}
|
|
3363
|
-
return cachedResult;
|
|
3364
|
-
}
|
|
3365
|
-
var import_node_fs2, cachedResult, hasContainerEnv;
|
|
3366
|
-
var init_is_inside_container = __esm({
|
|
3367
|
-
"../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js"() {
|
|
3368
|
-
import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
3369
|
-
init_is_docker();
|
|
3370
|
-
hasContainerEnv = () => {
|
|
3371
|
-
try {
|
|
3372
|
-
import_node_fs2.default.statSync("/run/.containerenv");
|
|
3373
|
-
return true;
|
|
3374
|
-
} catch {
|
|
3375
|
-
return false;
|
|
3376
|
-
}
|
|
3377
|
-
};
|
|
3378
|
-
}
|
|
3379
|
-
});
|
|
3380
|
-
|
|
3381
|
-
// ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
|
|
3382
|
-
var import_node_process, import_node_os, import_node_fs3, isWsl, is_wsl_default;
|
|
3383
|
-
var init_is_wsl = __esm({
|
|
3384
|
-
"../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js"() {
|
|
3385
|
-
import_node_process = __toESM(require("node:process"), 1);
|
|
3386
|
-
import_node_os = __toESM(require("node:os"), 1);
|
|
3387
|
-
import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
3388
|
-
init_is_inside_container();
|
|
3389
|
-
isWsl = () => {
|
|
3390
|
-
if (import_node_process.default.platform !== "linux") {
|
|
3391
|
-
return false;
|
|
3392
|
-
}
|
|
3393
|
-
if (import_node_os.default.release().toLowerCase().includes("microsoft")) {
|
|
3394
|
-
if (isInsideContainer()) {
|
|
3395
|
-
return false;
|
|
3396
|
-
}
|
|
3397
|
-
return true;
|
|
3398
|
-
}
|
|
3399
|
-
try {
|
|
3400
|
-
if (import_node_fs3.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
3401
|
-
return !isInsideContainer();
|
|
3402
|
-
}
|
|
3403
|
-
} catch {
|
|
3404
|
-
}
|
|
3405
|
-
if (import_node_fs3.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || import_node_fs3.default.existsSync("/run/WSL")) {
|
|
3406
|
-
return !isInsideContainer();
|
|
3407
|
-
}
|
|
3408
|
-
return false;
|
|
3409
|
-
};
|
|
3410
|
-
is_wsl_default = import_node_process.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
3411
|
-
}
|
|
3412
|
-
});
|
|
3413
|
-
|
|
3414
|
-
// ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
|
|
3415
|
-
var import_node_process2, import_promises, wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath;
|
|
3416
|
-
var init_wsl_utils = __esm({
|
|
3417
|
-
"../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js"() {
|
|
3418
|
-
import_node_process2 = __toESM(require("node:process"), 1);
|
|
3419
|
-
import_promises = __toESM(require("node:fs/promises"), 1);
|
|
3420
|
-
init_is_wsl();
|
|
3421
|
-
init_is_wsl();
|
|
3422
|
-
wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
3423
|
-
const defaultMountPoint = "/mnt/";
|
|
3424
|
-
let mountPoint;
|
|
3425
|
-
return async function() {
|
|
3426
|
-
if (mountPoint) {
|
|
3427
|
-
return mountPoint;
|
|
3428
|
-
}
|
|
3429
|
-
const configFilePath = "/etc/wsl.conf";
|
|
3430
|
-
let isConfigFileExists = false;
|
|
3431
|
-
try {
|
|
3432
|
-
await import_promises.default.access(configFilePath, import_promises.constants.F_OK);
|
|
3433
|
-
isConfigFileExists = true;
|
|
3434
|
-
} catch {
|
|
3435
|
-
}
|
|
3436
|
-
if (!isConfigFileExists) {
|
|
3437
|
-
return defaultMountPoint;
|
|
3438
|
-
}
|
|
3439
|
-
const configContent = await import_promises.default.readFile(configFilePath, { encoding: "utf8" });
|
|
3440
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
3441
|
-
if (!configMountPoint) {
|
|
3442
|
-
return defaultMountPoint;
|
|
3443
|
-
}
|
|
3444
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
3445
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
3446
|
-
return mountPoint;
|
|
3447
|
-
};
|
|
3448
|
-
})();
|
|
3449
|
-
powerShellPathFromWsl = async () => {
|
|
3450
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
3451
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
3452
|
-
};
|
|
3453
|
-
powerShellPath = async () => {
|
|
3454
|
-
if (is_wsl_default) {
|
|
3455
|
-
return powerShellPathFromWsl();
|
|
3456
|
-
}
|
|
3457
|
-
return `${import_node_process2.default.env.SYSTEMROOT || import_node_process2.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
3458
|
-
};
|
|
3459
|
-
}
|
|
3460
|
-
});
|
|
3461
|
-
|
|
3462
|
-
// ../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
|
|
3463
|
-
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
3464
|
-
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
3465
|
-
Object.defineProperty(object, propertyName, {
|
|
3466
|
-
configurable: true,
|
|
3467
|
-
enumerable: true,
|
|
3468
|
-
get() {
|
|
3469
|
-
const result = valueGetter();
|
|
3470
|
-
define(result);
|
|
3471
|
-
return result;
|
|
3472
|
-
},
|
|
3473
|
-
set(value) {
|
|
3474
|
-
define(value);
|
|
3475
|
-
}
|
|
3476
|
-
});
|
|
3477
|
-
return object;
|
|
3478
|
-
}
|
|
3479
|
-
var init_define_lazy_prop = __esm({
|
|
3480
|
-
"../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js"() {
|
|
3481
|
-
}
|
|
3482
|
-
});
|
|
3483
|
-
|
|
3484
|
-
// ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
3485
|
-
async function defaultBrowserId() {
|
|
3486
|
-
if (import_node_process3.default.platform !== "darwin") {
|
|
3487
|
-
throw new Error("macOS only");
|
|
3488
|
-
}
|
|
3489
|
-
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
3490
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
3491
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
3492
|
-
if (browserId === "com.apple.safari") {
|
|
3493
|
-
return "com.apple.Safari";
|
|
3494
|
-
}
|
|
3495
|
-
return browserId;
|
|
3496
|
-
}
|
|
3497
|
-
var import_node_util, import_node_process3, import_node_child_process, execFileAsync;
|
|
3498
|
-
var init_default_browser_id = __esm({
|
|
3499
|
-
"../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js"() {
|
|
3500
|
-
import_node_util = require("node:util");
|
|
3501
|
-
import_node_process3 = __toESM(require("node:process"), 1);
|
|
3502
|
-
import_node_child_process = require("node:child_process");
|
|
3503
|
-
execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
3504
|
-
}
|
|
3505
|
-
});
|
|
3506
|
-
|
|
3507
|
-
// ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
3508
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
3509
|
-
if (import_node_process4.default.platform !== "darwin") {
|
|
3510
|
-
throw new Error("macOS only");
|
|
3511
|
-
}
|
|
3512
|
-
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
3513
|
-
const execOptions = {};
|
|
3514
|
-
if (signal) {
|
|
3515
|
-
execOptions.signal = signal;
|
|
3516
|
-
}
|
|
3517
|
-
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
3518
|
-
return stdout.trim();
|
|
3519
|
-
}
|
|
3520
|
-
var import_node_process4, import_node_util2, import_node_child_process2, execFileAsync2;
|
|
3521
|
-
var init_run_applescript = __esm({
|
|
3522
|
-
"../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js"() {
|
|
3523
|
-
import_node_process4 = __toESM(require("node:process"), 1);
|
|
3524
|
-
import_node_util2 = require("node:util");
|
|
3525
|
-
import_node_child_process2 = require("node:child_process");
|
|
3526
|
-
execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
|
|
3527
|
-
}
|
|
3528
|
-
});
|
|
3529
|
-
|
|
3530
|
-
// ../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js
|
|
3531
|
-
async function bundleName(bundleId) {
|
|
3532
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
3533
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
3534
|
-
}
|
|
3535
|
-
var init_bundle_name = __esm({
|
|
3536
|
-
"../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js"() {
|
|
3537
|
-
init_run_applescript();
|
|
3538
|
-
}
|
|
3539
|
-
});
|
|
3540
|
-
|
|
3541
|
-
// ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js
|
|
3542
|
-
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
3543
|
-
const { stdout } = await _execFileAsync("reg", [
|
|
3544
|
-
"QUERY",
|
|
3545
|
-
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
3546
|
-
"/v",
|
|
3547
|
-
"ProgId"
|
|
3548
|
-
]);
|
|
3549
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
3550
|
-
if (!match) {
|
|
3551
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
3552
|
-
}
|
|
3553
|
-
const { id } = match.groups;
|
|
3554
|
-
const dotIndex = id.lastIndexOf(".");
|
|
3555
|
-
const hyphenIndex = id.lastIndexOf("-");
|
|
3556
|
-
const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
|
|
3557
|
-
const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
|
|
3558
|
-
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
3559
|
-
}
|
|
3560
|
-
var import_node_util3, import_node_child_process3, execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
|
|
3561
|
-
var init_windows = __esm({
|
|
3562
|
-
"../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js"() {
|
|
3563
|
-
import_node_util3 = require("node:util");
|
|
3564
|
-
import_node_child_process3 = require("node:child_process");
|
|
3565
|
-
execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
|
|
3566
|
-
windowsBrowserProgIds = {
|
|
3567
|
-
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
3568
|
-
// The missing `L` is correct.
|
|
3569
|
-
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
3570
|
-
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
3571
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
3572
|
-
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
3573
|
-
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
3574
|
-
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
3575
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
3576
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
3577
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
3578
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
3579
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
3580
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
3581
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
3582
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
3583
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
3584
|
-
};
|
|
3585
|
-
_windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
3586
|
-
UnknownBrowserError = class extends Error {
|
|
3587
|
-
};
|
|
3588
|
-
}
|
|
3589
|
-
});
|
|
3590
|
-
|
|
3591
|
-
// ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
|
|
3592
|
-
async function defaultBrowser2() {
|
|
3593
|
-
if (import_node_process5.default.platform === "darwin") {
|
|
3594
|
-
const id = await defaultBrowserId();
|
|
3595
|
-
const name = await bundleName(id);
|
|
3596
|
-
return { name, id };
|
|
3597
|
-
}
|
|
3598
|
-
if (import_node_process5.default.platform === "linux") {
|
|
3599
|
-
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
3600
|
-
const id = stdout.trim();
|
|
3601
|
-
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
3602
|
-
return { name, id };
|
|
3603
|
-
}
|
|
3604
|
-
if (import_node_process5.default.platform === "win32") {
|
|
3605
|
-
return defaultBrowser();
|
|
3606
|
-
}
|
|
3607
|
-
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
3608
|
-
}
|
|
3609
|
-
var import_node_util4, import_node_process5, import_node_child_process4, execFileAsync4, titleize;
|
|
3610
|
-
var init_default_browser = __esm({
|
|
3611
|
-
"../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js"() {
|
|
3612
|
-
import_node_util4 = require("node:util");
|
|
3613
|
-
import_node_process5 = __toESM(require("node:process"), 1);
|
|
3614
|
-
import_node_child_process4 = require("node:child_process");
|
|
3615
|
-
init_default_browser_id();
|
|
3616
|
-
init_bundle_name();
|
|
3617
|
-
init_windows();
|
|
3618
|
-
execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
3619
|
-
titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
3620
|
-
}
|
|
3621
|
-
});
|
|
3622
|
-
|
|
3623
|
-
// ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
|
|
3624
|
-
var open_exports = {};
|
|
3625
|
-
__export(open_exports, {
|
|
3626
|
-
apps: () => apps,
|
|
3627
|
-
default: () => open_default,
|
|
3628
|
-
openApp: () => openApp
|
|
3629
|
-
});
|
|
3630
|
-
async function getWindowsDefaultBrowserFromWsl() {
|
|
3631
|
-
const powershellPath = await powerShellPath();
|
|
3632
|
-
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
3633
|
-
const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
|
|
3634
|
-
const { stdout } = await execFile5(
|
|
3635
|
-
powershellPath,
|
|
3636
|
-
[
|
|
3637
|
-
"-NoProfile",
|
|
3638
|
-
"-NonInteractive",
|
|
3639
|
-
"-ExecutionPolicy",
|
|
3640
|
-
"Bypass",
|
|
3641
|
-
"-EncodedCommand",
|
|
3642
|
-
encodedCommand
|
|
3643
|
-
],
|
|
3644
|
-
{ encoding: "utf8" }
|
|
3645
|
-
);
|
|
3646
|
-
const progId = stdout.trim();
|
|
3647
|
-
const browserMap = {
|
|
3648
|
-
ChromeHTML: "com.google.chrome",
|
|
3649
|
-
BraveHTML: "com.brave.Browser",
|
|
3650
|
-
MSEdgeHTM: "com.microsoft.edge",
|
|
3651
|
-
FirefoxURL: "org.mozilla.firefox"
|
|
3652
|
-
};
|
|
3653
|
-
return browserMap[progId] ? { id: browserMap[progId] } : {};
|
|
3654
|
-
}
|
|
3655
|
-
function detectArchBinary(binary) {
|
|
3656
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
3657
|
-
return binary;
|
|
3658
|
-
}
|
|
3659
|
-
const { [arch]: archBinary } = binary;
|
|
3660
|
-
if (!archBinary) {
|
|
3661
|
-
throw new Error(`${arch} is not supported`);
|
|
3662
|
-
}
|
|
3663
|
-
return archBinary;
|
|
3664
|
-
}
|
|
3665
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
3666
|
-
if (wsl && is_wsl_default) {
|
|
3667
|
-
return detectArchBinary(wsl);
|
|
3668
|
-
}
|
|
3669
|
-
if (!platformBinary) {
|
|
3670
|
-
throw new Error(`${platform} is not supported`);
|
|
3671
|
-
}
|
|
3672
|
-
return detectArchBinary(platformBinary);
|
|
3673
|
-
}
|
|
3674
|
-
var import_node_process6, import_node_buffer, import_node_path, import_node_url, import_node_util5, import_node_child_process5, import_promises2, import_meta, execFile5, __dirname, localXdgOpenPath, platform, arch, pTryEach, baseOpen, open, openApp, apps, open_default;
|
|
3675
|
-
var init_open = __esm({
|
|
3676
|
-
"../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"() {
|
|
3677
|
-
import_node_process6 = __toESM(require("node:process"), 1);
|
|
3678
|
-
import_node_buffer = require("node:buffer");
|
|
3679
|
-
import_node_path = __toESM(require("node:path"), 1);
|
|
3680
|
-
import_node_url = require("node:url");
|
|
3681
|
-
import_node_util5 = require("node:util");
|
|
3682
|
-
import_node_child_process5 = __toESM(require("node:child_process"), 1);
|
|
3683
|
-
import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
3684
|
-
init_wsl_utils();
|
|
3685
|
-
init_define_lazy_prop();
|
|
3686
|
-
init_default_browser();
|
|
3687
|
-
init_is_inside_container();
|
|
3688
|
-
import_meta = {};
|
|
3689
|
-
execFile5 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
|
|
3690
|
-
__dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
3691
|
-
localXdgOpenPath = import_node_path.default.join(__dirname, "xdg-open");
|
|
3692
|
-
({ platform, arch } = import_node_process6.default);
|
|
3693
|
-
pTryEach = async (array, mapper) => {
|
|
3694
|
-
let latestError;
|
|
3695
|
-
for (const item of array) {
|
|
3696
|
-
try {
|
|
3697
|
-
return await mapper(item);
|
|
3698
|
-
} catch (error) {
|
|
3699
|
-
latestError = error;
|
|
3700
|
-
}
|
|
3701
|
-
}
|
|
3702
|
-
throw latestError;
|
|
3703
|
-
};
|
|
3704
|
-
baseOpen = async (options) => {
|
|
3705
|
-
options = {
|
|
3706
|
-
wait: false,
|
|
3707
|
-
background: false,
|
|
3708
|
-
newInstance: false,
|
|
3709
|
-
allowNonzeroExitCode: false,
|
|
3710
|
-
...options
|
|
3711
|
-
};
|
|
3712
|
-
if (Array.isArray(options.app)) {
|
|
3713
|
-
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
3714
|
-
...options,
|
|
3715
|
-
app: singleApp
|
|
3716
|
-
}));
|
|
3717
|
-
}
|
|
3718
|
-
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
3719
|
-
appArguments = [...appArguments];
|
|
3720
|
-
if (Array.isArray(app)) {
|
|
3721
|
-
return pTryEach(app, (appName) => baseOpen({
|
|
3722
|
-
...options,
|
|
3723
|
-
app: {
|
|
3724
|
-
name: appName,
|
|
3725
|
-
arguments: appArguments
|
|
3726
|
-
}
|
|
3727
|
-
}));
|
|
3728
|
-
}
|
|
3729
|
-
if (app === "browser" || app === "browserPrivate") {
|
|
3730
|
-
const ids = {
|
|
3731
|
-
"com.google.chrome": "chrome",
|
|
3732
|
-
"google-chrome.desktop": "chrome",
|
|
3733
|
-
"com.brave.Browser": "brave",
|
|
3734
|
-
"org.mozilla.firefox": "firefox",
|
|
3735
|
-
"firefox.desktop": "firefox",
|
|
3736
|
-
"com.microsoft.msedge": "edge",
|
|
3737
|
-
"com.microsoft.edge": "edge",
|
|
3738
|
-
"com.microsoft.edgemac": "edge",
|
|
3739
|
-
"microsoft-edge.desktop": "edge"
|
|
3740
|
-
};
|
|
3741
|
-
const flags = {
|
|
3742
|
-
chrome: "--incognito",
|
|
3743
|
-
brave: "--incognito",
|
|
3744
|
-
firefox: "--private-window",
|
|
3745
|
-
edge: "--inPrivate"
|
|
3746
|
-
};
|
|
3747
|
-
const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
|
|
3748
|
-
if (browser.id in ids) {
|
|
3749
|
-
const browserName = ids[browser.id];
|
|
3750
|
-
if (app === "browserPrivate") {
|
|
3751
|
-
appArguments.push(flags[browserName]);
|
|
3752
|
-
}
|
|
3753
|
-
return baseOpen({
|
|
3754
|
-
...options,
|
|
3755
|
-
app: {
|
|
3756
|
-
name: apps[browserName],
|
|
3757
|
-
arguments: appArguments
|
|
3758
|
-
}
|
|
3759
|
-
});
|
|
3760
|
-
}
|
|
3761
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
3762
|
-
}
|
|
3763
|
-
let command;
|
|
3764
|
-
const cliArguments = [];
|
|
3765
|
-
const childProcessOptions = {};
|
|
3766
|
-
if (platform === "darwin") {
|
|
3767
|
-
command = "open";
|
|
3768
|
-
if (options.wait) {
|
|
3769
|
-
cliArguments.push("--wait-apps");
|
|
3770
|
-
}
|
|
3771
|
-
if (options.background) {
|
|
3772
|
-
cliArguments.push("--background");
|
|
3773
|
-
}
|
|
3774
|
-
if (options.newInstance) {
|
|
3775
|
-
cliArguments.push("--new");
|
|
3776
|
-
}
|
|
3777
|
-
if (app) {
|
|
3778
|
-
cliArguments.push("-a", app);
|
|
3779
|
-
}
|
|
3780
|
-
} else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
|
|
3781
|
-
command = await powerShellPath();
|
|
3782
|
-
cliArguments.push(
|
|
3783
|
-
"-NoProfile",
|
|
3784
|
-
"-NonInteractive",
|
|
3785
|
-
"-ExecutionPolicy",
|
|
3786
|
-
"Bypass",
|
|
3787
|
-
"-EncodedCommand"
|
|
3788
|
-
);
|
|
3789
|
-
if (!is_wsl_default) {
|
|
3790
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
3791
|
-
}
|
|
3792
|
-
const encodedArguments = ["Start"];
|
|
3793
|
-
if (options.wait) {
|
|
3794
|
-
encodedArguments.push("-Wait");
|
|
3795
|
-
}
|
|
3796
|
-
if (app) {
|
|
3797
|
-
encodedArguments.push(`"\`"${app}\`""`);
|
|
3798
|
-
if (options.target) {
|
|
3799
|
-
appArguments.push(options.target);
|
|
3800
|
-
}
|
|
3801
|
-
} else if (options.target) {
|
|
3802
|
-
encodedArguments.push(`"${options.target}"`);
|
|
3803
|
-
}
|
|
3804
|
-
if (appArguments.length > 0) {
|
|
3805
|
-
appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
|
|
3806
|
-
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
3807
|
-
}
|
|
3808
|
-
options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
3809
|
-
} else {
|
|
3810
|
-
if (app) {
|
|
3811
|
-
command = app;
|
|
3812
|
-
} else {
|
|
3813
|
-
const isBundled = !__dirname || __dirname === "/";
|
|
3814
|
-
let exeLocalXdgOpen = false;
|
|
3815
|
-
try {
|
|
3816
|
-
await import_promises2.default.access(localXdgOpenPath, import_promises2.constants.X_OK);
|
|
3817
|
-
exeLocalXdgOpen = true;
|
|
3818
|
-
} catch {
|
|
3819
|
-
}
|
|
3820
|
-
const useSystemXdgOpen = import_node_process6.default.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
3821
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
3822
|
-
}
|
|
3823
|
-
if (appArguments.length > 0) {
|
|
3824
|
-
cliArguments.push(...appArguments);
|
|
3825
|
-
}
|
|
3826
|
-
if (!options.wait) {
|
|
3827
|
-
childProcessOptions.stdio = "ignore";
|
|
3828
|
-
childProcessOptions.detached = true;
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
if (platform === "darwin" && appArguments.length > 0) {
|
|
3832
|
-
cliArguments.push("--args", ...appArguments);
|
|
3833
|
-
}
|
|
3834
|
-
if (options.target) {
|
|
3835
|
-
cliArguments.push(options.target);
|
|
3836
|
-
}
|
|
3837
|
-
const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
|
|
3838
|
-
if (options.wait) {
|
|
3839
|
-
return new Promise((resolve, reject) => {
|
|
3840
|
-
subprocess.once("error", reject);
|
|
3841
|
-
subprocess.once("close", (exitCode) => {
|
|
3842
|
-
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
3843
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
3844
|
-
return;
|
|
3845
|
-
}
|
|
3846
|
-
resolve(subprocess);
|
|
3847
|
-
});
|
|
3848
|
-
});
|
|
3849
|
-
}
|
|
3850
|
-
subprocess.unref();
|
|
3851
|
-
return subprocess;
|
|
3852
|
-
};
|
|
3853
|
-
open = (target, options) => {
|
|
3854
|
-
if (typeof target !== "string") {
|
|
3855
|
-
throw new TypeError("Expected a `target`");
|
|
3856
|
-
}
|
|
3857
|
-
return baseOpen({
|
|
3858
|
-
...options,
|
|
3859
|
-
target
|
|
3860
|
-
});
|
|
3861
|
-
};
|
|
3862
|
-
openApp = (name, options) => {
|
|
3863
|
-
if (typeof name !== "string" && !Array.isArray(name)) {
|
|
3864
|
-
throw new TypeError("Expected a valid `name`");
|
|
3865
|
-
}
|
|
3866
|
-
const { arguments: appArguments = [] } = options ?? {};
|
|
3867
|
-
if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
|
|
3868
|
-
throw new TypeError("Expected `appArguments` as Array type");
|
|
3869
|
-
}
|
|
3870
|
-
return baseOpen({
|
|
3871
|
-
...options,
|
|
3872
|
-
app: {
|
|
3873
|
-
name,
|
|
3874
|
-
arguments: appArguments
|
|
3875
|
-
}
|
|
3876
|
-
});
|
|
3877
|
-
};
|
|
3878
|
-
apps = {};
|
|
3879
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
3880
|
-
darwin: "google chrome",
|
|
3881
|
-
win32: "chrome",
|
|
3882
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
3883
|
-
}, {
|
|
3884
|
-
wsl: {
|
|
3885
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
3886
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
3887
|
-
}
|
|
3888
|
-
}));
|
|
3889
|
-
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
3890
|
-
darwin: "brave browser",
|
|
3891
|
-
win32: "brave",
|
|
3892
|
-
linux: ["brave-browser", "brave"]
|
|
3893
|
-
}, {
|
|
3894
|
-
wsl: {
|
|
3895
|
-
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
3896
|
-
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
3897
|
-
}
|
|
3898
|
-
}));
|
|
3899
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
3900
|
-
darwin: "firefox",
|
|
3901
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
3902
|
-
linux: "firefox"
|
|
3903
|
-
}, {
|
|
3904
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
3905
|
-
}));
|
|
3906
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
3907
|
-
darwin: "microsoft edge",
|
|
3908
|
-
win32: "msedge",
|
|
3909
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
3910
|
-
}, {
|
|
3911
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
3912
|
-
}));
|
|
3913
|
-
defineLazyProperty(apps, "browser", () => "browser");
|
|
3914
|
-
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
3915
|
-
open_default = open;
|
|
3916
|
-
}
|
|
3917
|
-
});
|
|
3918
|
-
|
|
3919
3329
|
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
3920
3330
|
function assembleStyles() {
|
|
3921
3331
|
const codes = /* @__PURE__ */ new Map();
|
|
@@ -4108,7 +3518,7 @@ var init_ansi_styles = __esm({
|
|
|
4108
3518
|
});
|
|
4109
3519
|
|
|
4110
3520
|
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
4111
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args :
|
|
3521
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
|
4112
3522
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
4113
3523
|
const position = argv.indexOf(prefix + flag);
|
|
4114
3524
|
const terminatorPosition = argv.indexOf("--");
|
|
@@ -4163,8 +3573,8 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
4163
3573
|
if (env.TERM === "dumb") {
|
|
4164
3574
|
return min;
|
|
4165
3575
|
}
|
|
4166
|
-
if (
|
|
4167
|
-
const osRelease =
|
|
3576
|
+
if (import_node_process.default.platform === "win32") {
|
|
3577
|
+
const osRelease = import_node_os.default.release().split(".");
|
|
4168
3578
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
4169
3579
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
4170
3580
|
}
|
|
@@ -4223,13 +3633,13 @@ function createSupportsColor(stream, options = {}) {
|
|
|
4223
3633
|
});
|
|
4224
3634
|
return translateLevel(level);
|
|
4225
3635
|
}
|
|
4226
|
-
var
|
|
3636
|
+
var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
|
|
4227
3637
|
var init_supports_color = __esm({
|
|
4228
3638
|
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
4229
|
-
|
|
4230
|
-
|
|
3639
|
+
import_node_process = __toESM(require("node:process"), 1);
|
|
3640
|
+
import_node_os = __toESM(require("node:os"), 1);
|
|
4231
3641
|
import_node_tty = __toESM(require("node:tty"), 1);
|
|
4232
|
-
({ env } =
|
|
3642
|
+
({ env } = import_node_process.default);
|
|
4233
3643
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
4234
3644
|
flagForceColor = 0;
|
|
4235
3645
|
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
@@ -4400,18 +3810,18 @@ var init_source = __esm({
|
|
|
4400
3810
|
}
|
|
4401
3811
|
}
|
|
4402
3812
|
});
|
|
4403
|
-
createStyler = (
|
|
3813
|
+
createStyler = (open, close, parent) => {
|
|
4404
3814
|
let openAll;
|
|
4405
3815
|
let closeAll;
|
|
4406
3816
|
if (parent === void 0) {
|
|
4407
|
-
openAll =
|
|
3817
|
+
openAll = open;
|
|
4408
3818
|
closeAll = close;
|
|
4409
3819
|
} else {
|
|
4410
|
-
openAll = parent.openAll +
|
|
3820
|
+
openAll = parent.openAll + open;
|
|
4411
3821
|
closeAll = close + parent.closeAll;
|
|
4412
3822
|
}
|
|
4413
3823
|
return {
|
|
4414
|
-
open
|
|
3824
|
+
open,
|
|
4415
3825
|
close,
|
|
4416
3826
|
openAll,
|
|
4417
3827
|
closeAll,
|
|
@@ -4525,9 +3935,9 @@ var require_path = __commonJS({
|
|
|
4525
3935
|
"use strict";
|
|
4526
3936
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4527
3937
|
exports2.convertPosixPathToPattern = exports2.convertWindowsPathToPattern = exports2.convertPathToPattern = exports2.escapePosixPath = exports2.escapeWindowsPath = exports2.escape = exports2.removeLeadingDotSegment = exports2.makeAbsolute = exports2.unixify = void 0;
|
|
4528
|
-
var
|
|
4529
|
-
var
|
|
4530
|
-
var IS_WINDOWS_PLATFORM =
|
|
3938
|
+
var os2 = require("os");
|
|
3939
|
+
var path = require("path");
|
|
3940
|
+
var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
|
4531
3941
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
4532
3942
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
4533
3943
|
var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
@@ -4538,7 +3948,7 @@ var require_path = __commonJS({
|
|
|
4538
3948
|
}
|
|
4539
3949
|
exports2.unixify = unixify;
|
|
4540
3950
|
function makeAbsolute(cwd, filepath) {
|
|
4541
|
-
return
|
|
3951
|
+
return path.resolve(cwd, filepath);
|
|
4542
3952
|
}
|
|
4543
3953
|
exports2.makeAbsolute = makeAbsolute;
|
|
4544
3954
|
function removeLeadingDotSegment(entry) {
|
|
@@ -4658,9 +4068,9 @@ var require_is_glob = __commonJS({
|
|
|
4658
4068
|
}
|
|
4659
4069
|
}
|
|
4660
4070
|
if (str[index] === "\\") {
|
|
4661
|
-
var
|
|
4071
|
+
var open = str[index + 1];
|
|
4662
4072
|
index += 2;
|
|
4663
|
-
var close = chars[
|
|
4073
|
+
var close = chars[open];
|
|
4664
4074
|
if (close) {
|
|
4665
4075
|
var n = str.indexOf(close, index);
|
|
4666
4076
|
if (n !== -1) {
|
|
@@ -4686,9 +4096,9 @@ var require_is_glob = __commonJS({
|
|
|
4686
4096
|
return true;
|
|
4687
4097
|
}
|
|
4688
4098
|
if (str[index] === "\\") {
|
|
4689
|
-
var
|
|
4099
|
+
var open = str[index + 1];
|
|
4690
4100
|
index += 2;
|
|
4691
|
-
var close = chars[
|
|
4101
|
+
var close = chars[open];
|
|
4692
4102
|
if (close) {
|
|
4693
4103
|
var n = str.indexOf(close, index);
|
|
4694
4104
|
if (n !== -1) {
|
|
@@ -5652,7 +5062,7 @@ var require_parse = __commonJS({
|
|
|
5652
5062
|
continue;
|
|
5653
5063
|
}
|
|
5654
5064
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
5655
|
-
const
|
|
5065
|
+
const open = value;
|
|
5656
5066
|
let next;
|
|
5657
5067
|
if (options.keepQuotes !== true) {
|
|
5658
5068
|
value = "";
|
|
@@ -5662,7 +5072,7 @@ var require_parse = __commonJS({
|
|
|
5662
5072
|
value += next + advance();
|
|
5663
5073
|
continue;
|
|
5664
5074
|
}
|
|
5665
|
-
if (next ===
|
|
5075
|
+
if (next === open) {
|
|
5666
5076
|
if (options.keepQuotes === true) value += next;
|
|
5667
5077
|
break;
|
|
5668
5078
|
}
|
|
@@ -5705,8 +5115,8 @@ var require_parse = __commonJS({
|
|
|
5705
5115
|
if (value === CHAR_COMMA && depth > 0) {
|
|
5706
5116
|
if (block.ranges > 0) {
|
|
5707
5117
|
block.ranges = 0;
|
|
5708
|
-
const
|
|
5709
|
-
block.nodes = [
|
|
5118
|
+
const open = block.nodes.shift();
|
|
5119
|
+
block.nodes = [open, { type: "text", value: stringify(block) }];
|
|
5710
5120
|
}
|
|
5711
5121
|
push({ type: "comma", value });
|
|
5712
5122
|
block.commas++;
|
|
@@ -5835,7 +5245,7 @@ var require_braces = __commonJS({
|
|
|
5835
5245
|
var require_constants2 = __commonJS({
|
|
5836
5246
|
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
5837
5247
|
"use strict";
|
|
5838
|
-
var
|
|
5248
|
+
var path = require("path");
|
|
5839
5249
|
var WIN_SLASH = "\\\\/";
|
|
5840
5250
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
5841
5251
|
var DOT_LITERAL = "\\.";
|
|
@@ -6005,7 +5415,7 @@ var require_constants2 = __commonJS({
|
|
|
6005
5415
|
/* | */
|
|
6006
5416
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
6007
5417
|
/* \uFEFF */
|
|
6008
|
-
SEP:
|
|
5418
|
+
SEP: path.sep,
|
|
6009
5419
|
/**
|
|
6010
5420
|
* Create EXTGLOB_CHARS
|
|
6011
5421
|
*/
|
|
@@ -6032,7 +5442,7 @@ var require_constants2 = __commonJS({
|
|
|
6032
5442
|
var require_utils2 = __commonJS({
|
|
6033
5443
|
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports2) {
|
|
6034
5444
|
"use strict";
|
|
6035
|
-
var
|
|
5445
|
+
var path = require("path");
|
|
6036
5446
|
var win32 = process.platform === "win32";
|
|
6037
5447
|
var {
|
|
6038
5448
|
REGEX_BACKSLASH,
|
|
@@ -6061,7 +5471,7 @@ var require_utils2 = __commonJS({
|
|
|
6061
5471
|
if (options && typeof options.windows === "boolean") {
|
|
6062
5472
|
return options.windows;
|
|
6063
5473
|
}
|
|
6064
|
-
return win32 === true ||
|
|
5474
|
+
return win32 === true || path.sep === "\\";
|
|
6065
5475
|
};
|
|
6066
5476
|
exports2.escapeLast = (input, char, lastIdx) => {
|
|
6067
5477
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -6800,15 +6210,15 @@ var require_parse2 = __commonJS({
|
|
|
6800
6210
|
}
|
|
6801
6211
|
if (value === "{" && opts.nobrace !== true) {
|
|
6802
6212
|
increment("braces");
|
|
6803
|
-
const
|
|
6213
|
+
const open = {
|
|
6804
6214
|
type: "brace",
|
|
6805
6215
|
value,
|
|
6806
6216
|
output: "(",
|
|
6807
6217
|
outputIndex: state.output.length,
|
|
6808
6218
|
tokensIndex: state.tokens.length
|
|
6809
6219
|
};
|
|
6810
|
-
braces.push(
|
|
6811
|
-
push(
|
|
6220
|
+
braces.push(open);
|
|
6221
|
+
push(open);
|
|
6812
6222
|
continue;
|
|
6813
6223
|
}
|
|
6814
6224
|
if (value === "}") {
|
|
@@ -7196,7 +6606,7 @@ var require_parse2 = __commonJS({
|
|
|
7196
6606
|
var require_picomatch = __commonJS({
|
|
7197
6607
|
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
7198
6608
|
"use strict";
|
|
7199
|
-
var
|
|
6609
|
+
var path = require("path");
|
|
7200
6610
|
var scan = require_scan();
|
|
7201
6611
|
var parse = require_parse2();
|
|
7202
6612
|
var utils = require_utils2();
|
|
@@ -7281,7 +6691,7 @@ var require_picomatch = __commonJS({
|
|
|
7281
6691
|
};
|
|
7282
6692
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
7283
6693
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
7284
|
-
return regex.test(
|
|
6694
|
+
return regex.test(path.basename(input));
|
|
7285
6695
|
};
|
|
7286
6696
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
7287
6697
|
picomatch.parse = (pattern, options) => {
|
|
@@ -7508,7 +6918,7 @@ var require_pattern = __commonJS({
|
|
|
7508
6918
|
"use strict";
|
|
7509
6919
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7510
6920
|
exports2.isAbsolute = exports2.partitionAbsoluteAndRelative = exports2.removeDuplicateSlashes = exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
|
|
7511
|
-
var
|
|
6921
|
+
var path = require("path");
|
|
7512
6922
|
var globParent = require_glob_parent();
|
|
7513
6923
|
var micromatch = require_micromatch();
|
|
7514
6924
|
var GLOBSTAR = "**";
|
|
@@ -7603,7 +7013,7 @@ var require_pattern = __commonJS({
|
|
|
7603
7013
|
}
|
|
7604
7014
|
exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
7605
7015
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
7606
|
-
const basename2 =
|
|
7016
|
+
const basename2 = path.basename(pattern);
|
|
7607
7017
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename2);
|
|
7608
7018
|
}
|
|
7609
7019
|
exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -7661,7 +7071,7 @@ var require_pattern = __commonJS({
|
|
|
7661
7071
|
}
|
|
7662
7072
|
exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
7663
7073
|
function isAbsolute(pattern) {
|
|
7664
|
-
return
|
|
7074
|
+
return path.isAbsolute(pattern);
|
|
7665
7075
|
}
|
|
7666
7076
|
exports2.isAbsolute = isAbsolute;
|
|
7667
7077
|
}
|
|
@@ -7836,10 +7246,10 @@ var require_utils3 = __commonJS({
|
|
|
7836
7246
|
exports2.array = array;
|
|
7837
7247
|
var errno = require_errno();
|
|
7838
7248
|
exports2.errno = errno;
|
|
7839
|
-
var
|
|
7840
|
-
exports2.fs =
|
|
7841
|
-
var
|
|
7842
|
-
exports2.path =
|
|
7249
|
+
var fs = require_fs();
|
|
7250
|
+
exports2.fs = fs;
|
|
7251
|
+
var path = require_path();
|
|
7252
|
+
exports2.path = path;
|
|
7843
7253
|
var pattern = require_pattern();
|
|
7844
7254
|
exports2.pattern = pattern;
|
|
7845
7255
|
var stream = require_stream();
|
|
@@ -7951,8 +7361,8 @@ var require_async = __commonJS({
|
|
|
7951
7361
|
"use strict";
|
|
7952
7362
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7953
7363
|
exports2.read = void 0;
|
|
7954
|
-
function read(
|
|
7955
|
-
settings.fs.lstat(
|
|
7364
|
+
function read(path, settings, callback) {
|
|
7365
|
+
settings.fs.lstat(path, (lstatError, lstat) => {
|
|
7956
7366
|
if (lstatError !== null) {
|
|
7957
7367
|
callFailureCallback(callback, lstatError);
|
|
7958
7368
|
return;
|
|
@@ -7961,7 +7371,7 @@ var require_async = __commonJS({
|
|
|
7961
7371
|
callSuccessCallback(callback, lstat);
|
|
7962
7372
|
return;
|
|
7963
7373
|
}
|
|
7964
|
-
settings.fs.stat(
|
|
7374
|
+
settings.fs.stat(path, (statError, stat) => {
|
|
7965
7375
|
if (statError !== null) {
|
|
7966
7376
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
7967
7377
|
callFailureCallback(callback, statError);
|
|
@@ -7993,13 +7403,13 @@ var require_sync = __commonJS({
|
|
|
7993
7403
|
"use strict";
|
|
7994
7404
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7995
7405
|
exports2.read = void 0;
|
|
7996
|
-
function read(
|
|
7997
|
-
const lstat = settings.fs.lstatSync(
|
|
7406
|
+
function read(path, settings) {
|
|
7407
|
+
const lstat = settings.fs.lstatSync(path);
|
|
7998
7408
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
7999
7409
|
return lstat;
|
|
8000
7410
|
}
|
|
8001
7411
|
try {
|
|
8002
|
-
const stat = settings.fs.statSync(
|
|
7412
|
+
const stat = settings.fs.statSync(path);
|
|
8003
7413
|
if (settings.markSymbolicLink) {
|
|
8004
7414
|
stat.isSymbolicLink = () => true;
|
|
8005
7415
|
}
|
|
@@ -8021,12 +7431,12 @@ var require_fs2 = __commonJS({
|
|
|
8021
7431
|
"use strict";
|
|
8022
7432
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8023
7433
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
8024
|
-
var
|
|
7434
|
+
var fs = require("fs");
|
|
8025
7435
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
8026
|
-
lstat:
|
|
8027
|
-
stat:
|
|
8028
|
-
lstatSync:
|
|
8029
|
-
statSync:
|
|
7436
|
+
lstat: fs.lstat,
|
|
7437
|
+
stat: fs.stat,
|
|
7438
|
+
lstatSync: fs.lstatSync,
|
|
7439
|
+
statSync: fs.statSync
|
|
8030
7440
|
};
|
|
8031
7441
|
function createFileSystemAdapter(fsMethods) {
|
|
8032
7442
|
if (fsMethods === void 0) {
|
|
@@ -8043,12 +7453,12 @@ var require_settings = __commonJS({
|
|
|
8043
7453
|
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
|
|
8044
7454
|
"use strict";
|
|
8045
7455
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8046
|
-
var
|
|
7456
|
+
var fs = require_fs2();
|
|
8047
7457
|
var Settings = class {
|
|
8048
7458
|
constructor(_options = {}) {
|
|
8049
7459
|
this._options = _options;
|
|
8050
7460
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
8051
|
-
this.fs =
|
|
7461
|
+
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
8052
7462
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
8053
7463
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
8054
7464
|
}
|
|
@@ -8070,17 +7480,17 @@ var require_out = __commonJS({
|
|
|
8070
7480
|
var sync = require_sync();
|
|
8071
7481
|
var settings_1 = require_settings();
|
|
8072
7482
|
exports2.Settings = settings_1.default;
|
|
8073
|
-
function stat(
|
|
7483
|
+
function stat(path, optionsOrSettingsOrCallback, callback) {
|
|
8074
7484
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
8075
|
-
async.read(
|
|
7485
|
+
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
|
8076
7486
|
return;
|
|
8077
7487
|
}
|
|
8078
|
-
async.read(
|
|
7488
|
+
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
|
8079
7489
|
}
|
|
8080
7490
|
exports2.stat = stat;
|
|
8081
|
-
function statSync2(
|
|
7491
|
+
function statSync2(path, optionsOrSettings) {
|
|
8082
7492
|
const settings = getSettings(optionsOrSettings);
|
|
8083
|
-
return sync.read(
|
|
7493
|
+
return sync.read(path, settings);
|
|
8084
7494
|
}
|
|
8085
7495
|
exports2.statSync = statSync2;
|
|
8086
7496
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -8203,8 +7613,8 @@ var require_utils4 = __commonJS({
|
|
|
8203
7613
|
"use strict";
|
|
8204
7614
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8205
7615
|
exports2.fs = void 0;
|
|
8206
|
-
var
|
|
8207
|
-
exports2.fs =
|
|
7616
|
+
var fs = require_fs3();
|
|
7617
|
+
exports2.fs = fs;
|
|
8208
7618
|
}
|
|
8209
7619
|
});
|
|
8210
7620
|
|
|
@@ -8296,16 +7706,16 @@ var require_async2 = __commonJS({
|
|
|
8296
7706
|
return;
|
|
8297
7707
|
}
|
|
8298
7708
|
const tasks = names.map((name) => {
|
|
8299
|
-
const
|
|
7709
|
+
const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
8300
7710
|
return (done) => {
|
|
8301
|
-
fsStat.stat(
|
|
7711
|
+
fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
|
|
8302
7712
|
if (error !== null) {
|
|
8303
7713
|
done(error);
|
|
8304
7714
|
return;
|
|
8305
7715
|
}
|
|
8306
7716
|
const entry = {
|
|
8307
7717
|
name,
|
|
8308
|
-
path
|
|
7718
|
+
path,
|
|
8309
7719
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
8310
7720
|
};
|
|
8311
7721
|
if (settings.stats) {
|
|
@@ -8399,14 +7809,14 @@ var require_fs4 = __commonJS({
|
|
|
8399
7809
|
"use strict";
|
|
8400
7810
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8401
7811
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
8402
|
-
var
|
|
7812
|
+
var fs = require("fs");
|
|
8403
7813
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
8404
|
-
lstat:
|
|
8405
|
-
stat:
|
|
8406
|
-
lstatSync:
|
|
8407
|
-
statSync:
|
|
8408
|
-
readdir:
|
|
8409
|
-
readdirSync:
|
|
7814
|
+
lstat: fs.lstat,
|
|
7815
|
+
stat: fs.stat,
|
|
7816
|
+
lstatSync: fs.lstatSync,
|
|
7817
|
+
statSync: fs.statSync,
|
|
7818
|
+
readdir: fs.readdir,
|
|
7819
|
+
readdirSync: fs.readdirSync
|
|
8410
7820
|
};
|
|
8411
7821
|
function createFileSystemAdapter(fsMethods) {
|
|
8412
7822
|
if (fsMethods === void 0) {
|
|
@@ -8423,15 +7833,15 @@ var require_settings2 = __commonJS({
|
|
|
8423
7833
|
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
|
|
8424
7834
|
"use strict";
|
|
8425
7835
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8426
|
-
var
|
|
7836
|
+
var path = require("path");
|
|
8427
7837
|
var fsStat = require_out();
|
|
8428
|
-
var
|
|
7838
|
+
var fs = require_fs4();
|
|
8429
7839
|
var Settings = class {
|
|
8430
7840
|
constructor(_options = {}) {
|
|
8431
7841
|
this._options = _options;
|
|
8432
7842
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
8433
|
-
this.fs =
|
|
8434
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
7843
|
+
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
7844
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
|
8435
7845
|
this.stats = this._getValue(this._options.stats, false);
|
|
8436
7846
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
8437
7847
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -8458,17 +7868,17 @@ var require_out2 = __commonJS({
|
|
|
8458
7868
|
var sync = require_sync2();
|
|
8459
7869
|
var settings_1 = require_settings2();
|
|
8460
7870
|
exports2.Settings = settings_1.default;
|
|
8461
|
-
function scandir(
|
|
7871
|
+
function scandir(path, optionsOrSettingsOrCallback, callback) {
|
|
8462
7872
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
8463
|
-
async.read(
|
|
7873
|
+
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
|
8464
7874
|
return;
|
|
8465
7875
|
}
|
|
8466
|
-
async.read(
|
|
7876
|
+
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
|
8467
7877
|
}
|
|
8468
7878
|
exports2.scandir = scandir;
|
|
8469
|
-
function scandirSync(
|
|
7879
|
+
function scandirSync(path, optionsOrSettings) {
|
|
8470
7880
|
const settings = getSettings(optionsOrSettings);
|
|
8471
|
-
return sync.read(
|
|
7881
|
+
return sync.read(path, settings);
|
|
8472
7882
|
}
|
|
8473
7883
|
exports2.scandirSync = scandirSync;
|
|
8474
7884
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -9115,7 +8525,7 @@ var require_settings3 = __commonJS({
|
|
|
9115
8525
|
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
|
|
9116
8526
|
"use strict";
|
|
9117
8527
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9118
|
-
var
|
|
8528
|
+
var path = require("path");
|
|
9119
8529
|
var fsScandir = require_out2();
|
|
9120
8530
|
var Settings = class {
|
|
9121
8531
|
constructor(_options = {}) {
|
|
@@ -9125,7 +8535,7 @@ var require_settings3 = __commonJS({
|
|
|
9125
8535
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
9126
8536
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
9127
8537
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
9128
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
8538
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
|
9129
8539
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
9130
8540
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
9131
8541
|
fs: this._options.fs,
|
|
@@ -9187,7 +8597,7 @@ var require_reader2 = __commonJS({
|
|
|
9187
8597
|
"../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js"(exports2) {
|
|
9188
8598
|
"use strict";
|
|
9189
8599
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9190
|
-
var
|
|
8600
|
+
var path = require("path");
|
|
9191
8601
|
var fsStat = require_out();
|
|
9192
8602
|
var utils = require_utils3();
|
|
9193
8603
|
var Reader = class {
|
|
@@ -9200,7 +8610,7 @@ var require_reader2 = __commonJS({
|
|
|
9200
8610
|
});
|
|
9201
8611
|
}
|
|
9202
8612
|
_getFullEntryPath(filepath) {
|
|
9203
|
-
return
|
|
8613
|
+
return path.resolve(this._settings.cwd, filepath);
|
|
9204
8614
|
}
|
|
9205
8615
|
_makeEntry(stats, pattern) {
|
|
9206
8616
|
const entry = {
|
|
@@ -9616,7 +9026,7 @@ var require_provider = __commonJS({
|
|
|
9616
9026
|
"../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js"(exports2) {
|
|
9617
9027
|
"use strict";
|
|
9618
9028
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9619
|
-
var
|
|
9029
|
+
var path = require("path");
|
|
9620
9030
|
var deep_1 = require_deep();
|
|
9621
9031
|
var entry_1 = require_entry();
|
|
9622
9032
|
var error_1 = require_error2();
|
|
@@ -9630,7 +9040,7 @@ var require_provider = __commonJS({
|
|
|
9630
9040
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
9631
9041
|
}
|
|
9632
9042
|
_getRootDirectory(task) {
|
|
9633
|
-
return
|
|
9043
|
+
return path.resolve(this._settings.cwd, task.base);
|
|
9634
9044
|
}
|
|
9635
9045
|
_getReaderOptions(task) {
|
|
9636
9046
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -9811,16 +9221,16 @@ var require_settings4 = __commonJS({
|
|
|
9811
9221
|
"use strict";
|
|
9812
9222
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9813
9223
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
9814
|
-
var
|
|
9815
|
-
var
|
|
9816
|
-
var CPU_COUNT = Math.max(
|
|
9224
|
+
var fs = require("fs");
|
|
9225
|
+
var os2 = require("os");
|
|
9226
|
+
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
|
9817
9227
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
9818
|
-
lstat:
|
|
9819
|
-
lstatSync:
|
|
9820
|
-
stat:
|
|
9821
|
-
statSync:
|
|
9822
|
-
readdir:
|
|
9823
|
-
readdirSync:
|
|
9228
|
+
lstat: fs.lstat,
|
|
9229
|
+
lstatSync: fs.lstatSync,
|
|
9230
|
+
stat: fs.stat,
|
|
9231
|
+
statSync: fs.statSync,
|
|
9232
|
+
readdir: fs.readdir,
|
|
9233
|
+
readdirSync: fs.readdirSync
|
|
9824
9234
|
};
|
|
9825
9235
|
var Settings = class {
|
|
9826
9236
|
constructor(_options = {}) {
|
|
@@ -9985,6 +9395,8 @@ var {
|
|
|
9985
9395
|
|
|
9986
9396
|
// src/commands/init.ts
|
|
9987
9397
|
var import_crypto = require("crypto");
|
|
9398
|
+
var import_child_process = require("child_process");
|
|
9399
|
+
var import_readline = require("readline");
|
|
9988
9400
|
var import_fs2 = require("fs");
|
|
9989
9401
|
var import_path2 = require("path");
|
|
9990
9402
|
var import_os2 = require("os");
|
|
@@ -10028,12 +9440,12 @@ function getConfigPath() {
|
|
|
10028
9440
|
var SKILL_CONTENT = '# Candor \u2014 AI-Moderated User Studies & Human Evaluation\n\nCandor lets you create and manage AI-moderated user studies and human evaluation jobs directly from the terminal. Use `candor study` for product research (AI voice interviews with real users) and `candor eval` for quick human labeling, ranking, and evaluation tasks.\n\n## Available Commands\n\nRun these via the Bash tool. Always use `--json` for machine-readable output. Run any command with `--help` for full usage details (e.g. `candor eval create --help`).\n\n### Studies (product research)\n\n- `candor study create --url <url> --goal "<goal>" [--participants N] --json` \u2014 Create a study\n- `candor study list --json` \u2014 List all studies (or `candor study --json`)\n- `candor study status <study-id> --json` \u2014 Check participant progress\n- `candor study findings <study-id> --json` \u2014 Get prioritized feedback (P0\u2013P3)\n- `candor study approve <study-id> --json` \u2014 Approve recruitment (human-in-the-loop gate)\n\n### Evals (quick human evaluation / labeling)\n\n- `candor eval create --goal "<goal>" --items "<item1,item2,...>" [--type pairwise_comparison] [--workers N] [--reward <cents>] --json` \u2014 Create an eval. Items can be text labels, file paths (audio/image/video), glob patterns (`*.mp3`), or a CSV file.\n- `candor eval list --json` \u2014 List all evals\n- `candor eval approve <eval-id> --json` \u2014 Launch eval\n- `candor eval status <eval-id> [--live] --json` \u2014 Check eval progress (use `--live` for real-time monitoring)\n- `candor eval results <eval-id> --json` \u2014 View results and rankings\n- `candor eval cancel <eval-id> --json` \u2014 Cancel eval and stop recruiting (keeps collected responses)\n\n## Workflow\n\n### Creating a Study\n\n1. **Infer context** \u2014 If the user doesn\'t provide a URL, check:\n - `package.json` `homepage` field\n - README for a deployed URL\n - Ask the user if nothing is found\n2. **Run `candor study create`** with the product URL and goal\n3. **Show the study summary** including:\n - Drafted study script (sections, questions, tasks)\n - Participant count and demographic filters\n - Estimated cost per session\n4. **Wait for explicit approval** \u2014 Do NOT run `candor study approve` without the user saying "yes", "approve", "go ahead", or similar\n5. **On approval**, run `candor study approve <study-id>` to begin recruiting\n\n### Creating an Eval\n\nEvals are for quick human evaluation tasks like labeling, ranking, rating, or comparing items. They return results in minutes.\n\n**When to use eval vs study:**\n- Use `candor eval` when the user wants to label, rank, rate, compare, or categorize items (audio files, images, text, etc.)\n- Use `candor study` when the user wants qualitative product feedback from real users\n\n**Choosing the right task type:**\n- `pairwise_comparison` \u2014 Best for ranking. Workers compare pairs and pick a winner. Produces a stack ranking with win rates. Use when the user says "rank", "compare", "which is better", "stack rank".\n- `categorical_label` \u2014 Workers assign a label from a set of categories. Use when the user says "label", "categorize", "classify", "tag".\n- `rating_scale` \u2014 Workers rate items on a numeric scale. Use when the user says "rate", "score", "quality score".\n- `free_text` \u2014 Workers provide open-ended text feedback.\n\n**Workflow:**\n1. **Identify the items** \u2014 Find the files or values the user wants evaluated. The `--items` flag is comma-separated and the CLI auto-detects the type of each token:\n - **Text labels**: `--items "option_a,option_b,option_c"` \u2014 plain strings, no upload\n - **File paths**: `--items "sample_a.mp3,sample_b.mp3"` \u2014 if the path exists on disk and has a supported media extension, it\'s uploaded automatically\n - **Glob patterns**: `--items "*.mp3"` or `--items "outputs/*.png"` \u2014 expanded to matching files, then uploaded. Use this when the user says "these audio files" or "all the PNGs in that folder"\n - **CSV file**: `--items "items.csv"` \u2014 a single CSV path. Rows are parsed into items. See CSV format below.\n - **Mixed**: You can mix types in one command: `--items "baseline.mp3,challenger.mp3,control_text"`\n\n **Supported media types** (auto-detected by extension): audio (mp3, wav, ogg, flac, m4a, aac, webm, wma), image (png, jpg, jpeg, gif, webp, svg, bmp, tiff), video (mp4, mov, avi, mkv, wmv). Files with unsupported extensions are treated as text labels.\n\n **Size limits**: 100 MB per file, 1 GB total, max 50 files per eval.\n\n2. **Infer the task type** \u2014 The API infers the task type from the `--goal` string using keyword matching. You don\'t need to pass `--type` unless you want to override. If the goal is vague, it defaults to `pairwise_comparison`.\n3. **Design the eval** \u2014 The API auto-generates the experiment design (randomized pairs, worker counts, etc.) from the goal and items. If the user is prescriptive about methodology, pass their preferences.\n4. **Create the eval** \u2014 Run `candor eval create` with goal and items. Files are uploaded during creation (before approval), so the approve step is fast.\n5. **Show the plan** \u2014 Display task type, item count, pair count, estimated cost and time.\n6. **Wait for approval** \u2014 Do NOT launch without explicit confirmation.\n7. **Launch** \u2014 Run `candor eval approve <id>` to begin recruiting workers.\n8. **Monitor** \u2014 Run `candor eval status <id> --live` (without `--json`) so the user sees a live-updating progress bar, worker activity feed, and completion status in their terminal. This is the best way to keep the user informed while workers complete tasks.\n9. **Results** \u2014 Use `candor eval results <id>` to show rankings and agreement metrics.\n10. **Cancel** (if needed) \u2014 Use `candor eval cancel <id>` to stop recruiting while keeping collected responses. Uploaded files are cleaned up automatically on completion or cancel.\n\n**CSV format:**\n\nWhen `--items` points to a `.csv` file, the CLI parses it row by row:\n- **Single column** \u2014 each value is auto-detected (URL, file path, or text label)\n- **Two+ columns** \u2014 first column is the label, second is the URL or file path\n- **Header row** \u2014 auto-detected if first row contains "label", "url", "path", or "file"\n- **URLs** (`https://...`) are passed through as asset URLs directly \u2014 no upload needed\n- **Local file paths** in the CSV are uploaded just like inline file paths\n\nExample CSV with URLs (no upload):\n```csv\nlabel,url\nModel A,https://example.com/audio/model_a.mp3\nModel B,https://example.com/audio/model_b.mp3\n```\n\nExample CSV with local files (uploaded automatically):\n```csv\noutputs/model_a.mp3\noutputs/model_b.mp3\n```\n\n**How to build the --items flag:**\n\nWhen the user mentions files, use Bash tools to find them first, then pass them to `candor eval create`:\n- User says "evaluate the audio files in outputs/" \u2192 run `ls outputs/*.mp3` to confirm they exist, then `--items "outputs/*.mp3"`\n- User says "compare these two images" and you see `a.png`, `b.png` in cwd \u2192 `--items "a.png,b.png"`\n- User has a spreadsheet of URLs \u2192 save as CSV, then `--items "urls.csv"`\n- User says "rank A, B, C" (no files) \u2192 `--items "A,B,C"` (text labels)\n\n**Example natural language \u2192 eval mapping:**\n\n| User says | Task type | Items |\n|-----------|-----------|-------|\n| "rank these audio samples by TTS quality" | pairwise_comparison | `--items "*.mp3"` (glob) |\n| "label these images as cat or dog" | categorical_label | `--items "*.png"` (glob) |\n| "rate these UI mockups on a 1-5 scale" | rating_scale | `--items "mockup_a.png,mockup_b.png"` (files) |\n| "which of these headlines is more engaging" | pairwise_comparison | `--items "Headline A,Headline B"` (text) |\n| "evaluate the samples in results.csv" | pairwise_comparison | `--items "results.csv"` (CSV) |\n\n### Pricing evals (`--reward`)\n\nThe `--reward` flag sets the payment **per assignment** (a batch of tasks a single worker completes) in cents. Getting this right is critical \u2014 underpaying means workers ignore your HIT and results take hours; paying well means results in minutes.\n\n**How to estimate reward:**\n\n1. **Estimate time per task** based on what the worker has to do:\n - Read two short text labels and pick one: ~5 seconds\n - View two images and compare: ~10\u201315 seconds\n - Listen to two audio clips (each 5\u201315s) and compare: ~20\u201340 seconds\n - Watch two short videos and compare: ~30\u201360 seconds\n - Rate or label a single item (text/image): ~5\u201310 seconds\n - Rate or label a single audio/video item: ~15\u201330 seconds\n\n2. **Multiply by tasks per assignment.** The API auto-sets batch size, but typical values:\n - Pairwise with N items \u2192 N\xD7(N-1)/2 pairs, batched into groups of ~5\u201310\n - Single-item tasks \u2192 batched into groups of ~5\u201310\n\n3. **Target $15\u201320/hour equivalent** for fast pickup. This is above the MTurk average and ensures your HITs are grabbed immediately.\n\n4. **Calculate:** `reward_cents = (time_per_task_seconds \xD7 tasks_per_batch / 60) \xD7 (hourly_rate / 60) \xD7 100`\n\n**Quick reference (for fast pickup):**\n\n| Scenario | Items | Est. time/assignment | Recommended `--reward` |\n|----------|-------|---------------------|----------------------|\n| Compare short text labels | 3\u20135 items | ~30 sec | `15` (15\xA2) |\n| Compare images | 3\u20135 items | ~1\u20132 min | `40` (40\xA2) |\n| Compare audio clips (<15s each) | 3\u20135 items | ~2\u20133 min | `60` (60\xA2) |\n| Compare audio clips (<15s each) | 6\u201310 items | ~5\u20138 min | `150` ($1.50) |\n| Compare short videos | 3\u20135 items | ~3\u20135 min | `100` ($1.00) |\n| Label/rate images | 10 items | ~2 min | `50` (50\xA2) |\n| Label/rate audio clips | 10 items | ~5 min | `125` ($1.25) |\n\n**Rules of thumb:**\n- When in doubt, round up \u2014 the cost difference is small but pickup speed difference is large\n- Audio/video evals cost more because workers spend real time consuming media\n- More items = more pairs (pairwise grows quadratically) = longer assignments = higher reward needed\n- If the user doesn\'t specify a budget, use these guidelines. If they ask for cheaper, warn that lower rewards mean slower results.\n- The default of 5\xA2 is only appropriate for very quick text-only tasks with few items. **Always override it** for media evals.\n\n### Checking Results\n\n- Use `candor study status <id> --json` to show completion progress\n- Use `candor study findings <id> --json` to show prioritized findings\n- Use `candor eval status <id> --json` to show eval progress\n- Use `candor eval results <id> --json` to show rankings and agreement metrics\n- Offer to create GitHub issues for P0/P1 items if the user wants\n\n## Billing & Balance\n\nLaunching evals and studies requires a funded balance. Costs include a 40% Candor platform fee on top of worker payments.\n\n- **First time**: `candor init` opens Stripe to add a card. New users get **$5 free credit**.\n- **Balance check**: Balance is shown during `candor init` and at `candor eval create` (as `Est. cost`).\n- **Charge timing**: Balance is debited when you run `candor eval approve` or `candor study approve` \u2014 not at draft creation.\n- **Insufficient funds**: If balance is too low, the CLI shows the shortfall and a URL to add funds. The user pays via Stripe Checkout (minimum $10 top-up), then re-runs the approve command.\n- **Auto-reload**: Users can configure auto-reload at https://candor.sh/billing \u2014 set a threshold and target, and the saved card is charged automatically.\n- **Cancellation refund**: `candor eval cancel` refunds the proportional cost of incomplete tasks.\n- **Billing dashboard**: https://candor.sh/billing shows balance, transaction history, and auto-reload settings.\n\nWhen a 402 error occurs, show the balance shortfall and the top-up URL. Do not retry \u2014 the user needs to add funds first.\n\n## Important Rules\n\n- NEVER approve a study or launch an eval without explicit human confirmation\n- ALWAYS show cost estimate before launching\n- Evals are billed per assignment. Use the pricing guide above to set `--reward` appropriately \u2014 this directly affects how fast workers pick up the job\n- If Candor is not initialized, tell the user to run `candor init` first\n';
|
|
10029
9441
|
|
|
10030
9442
|
// src/api.ts
|
|
10031
|
-
async function apiRequest(
|
|
9443
|
+
async function apiRequest(path, options = {}) {
|
|
10032
9444
|
const config = loadConfig();
|
|
10033
9445
|
if (!config.apiKey) {
|
|
10034
9446
|
throw new AuthError("Not authenticated. Run 'candor init' first.");
|
|
10035
9447
|
}
|
|
10036
|
-
const res = await fetch(`${config.apiUrl}${
|
|
9448
|
+
const res = await fetch(`${config.apiUrl}${path}`, {
|
|
10037
9449
|
method: options.method || "GET",
|
|
10038
9450
|
headers: {
|
|
10039
9451
|
Authorization: `Bearer ${config.apiKey}`,
|
|
@@ -10079,9 +9491,18 @@ var InsufficientBalanceError = class extends Error {
|
|
|
10079
9491
|
|
|
10080
9492
|
// src/commands/init.ts
|
|
10081
9493
|
var CLAUDE_SKILLS_DIR = (0, import_path2.join)((0, import_os2.homedir)(), ".claude", "skills", "candor");
|
|
10082
|
-
|
|
10083
|
-
const
|
|
10084
|
-
|
|
9494
|
+
function openBrowser(url) {
|
|
9495
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
9496
|
+
(0, import_child_process.exec)(`${cmd} ${JSON.stringify(url)}`);
|
|
9497
|
+
}
|
|
9498
|
+
function waitForEnter(prompt) {
|
|
9499
|
+
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
9500
|
+
return new Promise((resolve) => {
|
|
9501
|
+
rl.question(prompt, () => {
|
|
9502
|
+
rl.close();
|
|
9503
|
+
resolve();
|
|
9504
|
+
});
|
|
9505
|
+
});
|
|
10085
9506
|
}
|
|
10086
9507
|
async function pollForAuth(tempToken, apiUrl) {
|
|
10087
9508
|
for (let attempts = 0; attempts < 120; attempts++) {
|
|
@@ -10126,9 +9547,9 @@ async function initCommand(options) {
|
|
|
10126
9547
|
} else {
|
|
10127
9548
|
const tempToken = (0, import_crypto.randomBytes)(16).toString("hex");
|
|
10128
9549
|
const authUrl = `${config.apiUrl.replace("api.", "")}/auth/cli?token=${tempToken}`;
|
|
10129
|
-
console.log(chalk2.dim(" -> Opening candor.sh to sign in & add your card..."));
|
|
10130
9550
|
try {
|
|
10131
|
-
await
|
|
9551
|
+
await waitForEnter(chalk2.dim(" Press Enter to open candor.sh in your browser..."));
|
|
9552
|
+
openBrowser(authUrl);
|
|
10132
9553
|
} catch {
|
|
10133
9554
|
console.log(chalk2.yellow(` Open this URL manually: ${authUrl}`));
|
|
10134
9555
|
}
|
|
@@ -10184,14 +9605,28 @@ async function initCommand(options) {
|
|
|
10184
9605
|
|
|
10185
9606
|
// src/commands/login.ts
|
|
10186
9607
|
var import_crypto2 = require("crypto");
|
|
9608
|
+
var import_child_process2 = require("child_process");
|
|
9609
|
+
var import_readline2 = require("readline");
|
|
9610
|
+
function openUrl(url) {
|
|
9611
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
9612
|
+
(0, import_child_process2.exec)(`${cmd} ${JSON.stringify(url)}`);
|
|
9613
|
+
}
|
|
9614
|
+
function waitForEnter2(prompt) {
|
|
9615
|
+
const rl = (0, import_readline2.createInterface)({ input: process.stdin, output: process.stdout });
|
|
9616
|
+
return new Promise((resolve) => {
|
|
9617
|
+
rl.question(prompt, () => {
|
|
9618
|
+
rl.close();
|
|
9619
|
+
resolve();
|
|
9620
|
+
});
|
|
9621
|
+
});
|
|
9622
|
+
}
|
|
10187
9623
|
async function loginCommand() {
|
|
10188
9624
|
const chalk2 = (await Promise.resolve().then(() => (init_source(), source_exports))).default;
|
|
10189
|
-
const open2 = (await Promise.resolve().then(() => (init_open(), open_exports))).default;
|
|
10190
9625
|
const config = loadConfig();
|
|
10191
9626
|
const tempToken = (0, import_crypto2.randomBytes)(16).toString("hex");
|
|
10192
9627
|
const authUrl = `${config.apiUrl.replace("api.", "")}/auth/cli?token=${tempToken}`;
|
|
10193
|
-
|
|
10194
|
-
|
|
9628
|
+
await waitForEnter2(chalk2.dim("Press Enter to open candor.sh in your browser..."));
|
|
9629
|
+
openUrl(authUrl);
|
|
10195
9630
|
for (let attempts = 0; attempts < 120; attempts++) {
|
|
10196
9631
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
10197
9632
|
try {
|
|
@@ -10228,7 +9663,7 @@ async function logoutCommand() {
|
|
|
10228
9663
|
|
|
10229
9664
|
// src/commands/doctor.ts
|
|
10230
9665
|
var import_fs3 = require("fs");
|
|
10231
|
-
var
|
|
9666
|
+
var import_child_process3 = require("child_process");
|
|
10232
9667
|
var import_path3 = require("path");
|
|
10233
9668
|
var import_os3 = require("os");
|
|
10234
9669
|
async function doctorCommand() {
|
|
@@ -10238,10 +9673,10 @@ async function doctorCommand() {
|
|
|
10238
9673
|
console.log(chalk2.bold("Candor Doctor"));
|
|
10239
9674
|
console.log();
|
|
10240
9675
|
try {
|
|
10241
|
-
const version = (0,
|
|
9676
|
+
const version = (0, import_child_process3.execSync)("candor --version 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
10242
9677
|
console.log(chalk2.green(` + candor CLI installed (v${version})`));
|
|
10243
9678
|
try {
|
|
10244
|
-
const latest = (0,
|
|
9679
|
+
const latest = (0, import_child_process3.execSync)("npm view @candor.sh/cli version 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
10245
9680
|
if (latest && latest !== version) {
|
|
10246
9681
|
console.log(chalk2.yellow(` Update available: v${latest} (run 'candor update')`));
|
|
10247
9682
|
}
|
|
@@ -10490,17 +9925,17 @@ async function statusCommand(id, options) {
|
|
|
10490
9925
|
}
|
|
10491
9926
|
|
|
10492
9927
|
// src/commands/update.ts
|
|
10493
|
-
var
|
|
9928
|
+
var import_child_process4 = require("child_process");
|
|
10494
9929
|
var import_fs4 = require("fs");
|
|
10495
9930
|
var import_path4 = require("path");
|
|
10496
|
-
var
|
|
9931
|
+
var import_meta = {};
|
|
10497
9932
|
async function updateCommand() {
|
|
10498
9933
|
const chalk2 = (await Promise.resolve().then(() => (init_source(), source_exports))).default;
|
|
10499
9934
|
const currentVersion = getCurrentVersion();
|
|
10500
9935
|
console.log();
|
|
10501
9936
|
console.log(chalk2.dim(` Current version: ${currentVersion}`));
|
|
10502
9937
|
try {
|
|
10503
|
-
const latest = (0,
|
|
9938
|
+
const latest = (0, import_child_process4.execSync)("npm view @candor.sh/cli version 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
10504
9939
|
if (latest === currentVersion) {
|
|
10505
9940
|
console.log(chalk2.green(` + Already on the latest version (${currentVersion})`));
|
|
10506
9941
|
console.log();
|
|
@@ -10512,12 +9947,12 @@ async function updateCommand() {
|
|
|
10512
9947
|
console.log(chalk2.dim(" -> Updating to latest..."));
|
|
10513
9948
|
}
|
|
10514
9949
|
try {
|
|
10515
|
-
(0,
|
|
9950
|
+
(0, import_child_process4.execSync)("npm install -g @candor.sh/cli@latest", {
|
|
10516
9951
|
stdio: "inherit"
|
|
10517
9952
|
});
|
|
10518
9953
|
console.log(chalk2.green(" + Updated successfully"));
|
|
10519
9954
|
console.log(chalk2.dim(" -> Updating skill file..."));
|
|
10520
|
-
(0,
|
|
9955
|
+
(0, import_child_process4.execSync)("candor init --skill-only 2>/dev/null || true", { stdio: "ignore" });
|
|
10521
9956
|
console.log();
|
|
10522
9957
|
} catch (err) {
|
|
10523
9958
|
console.log(chalk2.red(` ! Update failed: ${err instanceof Error ? err.message : err}`));
|
|
@@ -10527,11 +9962,11 @@ async function updateCommand() {
|
|
|
10527
9962
|
}
|
|
10528
9963
|
}
|
|
10529
9964
|
function getCurrentVersion() {
|
|
10530
|
-
if ("0.5.
|
|
10531
|
-
return "0.5.
|
|
9965
|
+
if ("0.5.1") {
|
|
9966
|
+
return "0.5.1";
|
|
10532
9967
|
}
|
|
10533
9968
|
try {
|
|
10534
|
-
const pkgPath = (0, import_path4.join)((0, import_path4.dirname)(new URL(
|
|
9969
|
+
const pkgPath = (0, import_path4.join)((0, import_path4.dirname)(new URL(import_meta.url).pathname), "..", "package.json");
|
|
10535
9970
|
const pkg = JSON.parse((0, import_fs4.readFileSync)(pkgPath, "utf-8"));
|
|
10536
9971
|
return pkg.version;
|
|
10537
9972
|
} catch {
|
|
@@ -11291,7 +10726,7 @@ async function balanceCommand(options) {
|
|
|
11291
10726
|
|
|
11292
10727
|
// src/index.ts
|
|
11293
10728
|
var program2 = new Command();
|
|
11294
|
-
program2.name("candor").description("AI-moderated user studies, wired into your dev workflow").version("0.5.
|
|
10729
|
+
program2.name("candor").description("AI-moderated user studies, wired into your dev workflow").version("0.5.1").enablePositionalOptions();
|
|
11295
10730
|
program2.command("init").description("Set up Candor: authenticate and configure Claude Code integration").option("--skill-only", "Only reinstall the skill file").action(initCommand);
|
|
11296
10731
|
program2.command("login").description("Re-authenticate with Candor").action(loginCommand);
|
|
11297
10732
|
program2.command("logout").description("Log out and clear stored credentials").action(logoutCommand);
|