@gitkraken/core-gitlens 0.68.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/dist/git/providers/diff.d.ts +10 -1
- package/dist/git/providers/status.d.ts +2 -0
- package/dist/git/service.d.ts +5 -1
- package/dist/git/service.js +8 -4
- package/dist/git/service.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +9 -0
- package/dist/git/watching/worktreeSummary.js +17 -5
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +8 -1
- package/dist/git-cli/cliGitProvider.js +14 -3
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/exec.d.ts +2 -2
- package/dist/git-cli/exec/exec.js +2 -2
- package/dist/git-cli/exec/git.js +4 -3
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/indexRefresh.d.ts +38 -6
- package/dist/git-cli/exec/indexRefresh.js +84 -3
- package/dist/git-cli/exec/indexRefresh.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts +4 -1
- package/dist/git-cli/providers/diff.js +17 -1
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +4 -0
- package/dist/git-cli/providers/status.js +113 -16
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/service.d.ts +13 -1
- package/dist/git-cli/service.js +1 -0
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -1
- package/dist/plus/integrations/index.js +9 -0
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +15 -0
- package/dist/plus/integrations/integrationService.js +35 -4
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +6 -0
- package/dist/plus/integrations/models/asanaTaskWrites.d.ts +155 -0
- package/dist/plus/integrations/models/asanaTaskWrites.js +0 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts +6 -1
- package/dist/plus/integrations/models/issuesIntegration.js +25 -0
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +3 -1
- package/dist/plus/integrations/providers/asana.js +10 -0
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/asanaTaskWriteTransport.d.ts +40 -0
- package/dist/plus/integrations/providers/asanaTaskWriteTransport.js +122 -0
- package/dist/plus/integrations/providers/asanaTaskWriteTransport.js.map +1 -0
- package/dist/plus/integrations/providers/asanaTaskWrites.d.ts +38 -0
- package/dist/plus/integrations/providers/asanaTaskWrites.js +521 -0
- package/dist/plus/integrations/providers/asanaTaskWrites.js.map +1 -0
- package/dist/plus/integrations/providers/trello.js +6 -23
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/providers/trelloCardWriteTransport.d.ts +3 -4
- package/dist/plus/integrations/providers/trelloCardWriteTransport.js +19 -40
- package/dist/plus/integrations/providers/trelloCardWriteTransport.js.map +1 -1
- package/dist/plus/integrations/providers/utils/writeTransport.d.ts +28 -0
- package/dist/plus/integrations/providers/utils/writeTransport.js +60 -0
- package/dist/plus/integrations/providers/utils/writeTransport.js.map +1 -0
- package/dist/utils/env/browser/platform.d.ts +1 -0
- package/dist/utils/env/browser/platform.js +4 -1
- package/dist/utils/env/browser/platform.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +1 -0
- package/dist/utils/env/node/exec.js +9 -3
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/env/node/platform.d.ts +1 -0
- package/dist/utils/env/node/platform.js +4 -1
- package/dist/utils/env/node/platform.js.map +1 -1
- package/dist/utils/platform.d.ts +2 -2
- package/dist/utils/platform.js +2 -2
- package/docs/integrations.md +25 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","names":["joinPaths"],"sources":["../../../../../utils/src/env/node/exec.ts"],"sourcesContent":["import type { ChildProcess, ExecFileException, ExecFileOptions } from 'child_process';\nimport { execFile, spawn } from 'child_process';\nimport type { Stats } from 'fs';\nimport { access, constants } from 'fs';\nimport { stat } from 'fs/promises';\nimport { join as joinPaths } from 'path';\nimport * as process from 'process';\nimport type { Readable, Writable } from 'stream';\nimport type { CancellationReason } from '../../cancellation.js';\nimport { getScopedLogger, maybeStartScopedLogger } from '../../logger.scoped.js';\nimport { isWindows } from './platform.js';\n\n// -- Error types --\n\ninterface RunErrorContext {\n\tmessage: string;\n\tcmd?: string | undefined;\n\tkilled?: boolean | undefined;\n\tcode?: string | number | null | undefined;\n\tsignal?: NodeJS.Signals | undefined;\n\tsyscall?: string | undefined;\n}\n\nexport class RunError extends Error {\n\treadonly cmd?: string | undefined;\n\treadonly killed?: boolean | undefined;\n\treadonly code?: string | number | undefined;\n\treadonly signal?: NodeJS.Signals | undefined;\n\treadonly syscall?: string | undefined;\n\treadonly stdout: string;\n\treadonly stderr: string;\n\n\tconstructor(context: RunErrorContext, stdout: string, stderr: string) {\n\t\tsuper(context.message);\n\n\t\tthis.cmd = context.cmd;\n\t\tthis.killed = context.killed;\n\t\tthis.code = context.code ?? undefined;\n\t\tthis.signal = context.signal;\n\t\tthis.syscall = context.syscall;\n\t\tthis.stdout = stdout?.trim() ?? '';\n\t\tthis.stderr = stderr?.trim() ?? '';\n\n\t\tthis.name = 'RunError';\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\nexport class CancelledRunError extends RunError {\n\treadonly reason: CancellationReason;\n\n\tconstructor(\n\t\tcmd: string,\n\t\tkilled: boolean,\n\t\tcode?: number | string | undefined,\n\t\tsignal: NodeJS.Signals = 'SIGTERM',\n\t\treason: CancellationReason = 'unknown',\n\t) {\n\t\tsuper(\n\t\t\t{ message: `Operation cancelled; command=${cmd}`, cmd: cmd, killed: killed, code: code, signal: signal },\n\t\t\t'',\n\t\t\t'',\n\t\t);\n\n\t\tthis.reason = reason;\n\n\t\tthis.name = 'CancelledRunError';\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\n// -- Execution utilities --\n\nconst slashesRegex = /[\\\\/]/;\nconst ps1Regex = /\\.ps1$/i;\nconst batOrCmdRegex = /\\.(bat|cmd)$/i;\nconst jsRegex = /\\.(js)$/i;\n\n/**\n * Search PATH to see if a file exists in any of the path folders.\n *\n * @param {string} exe The file to search for\n * @return {string} A fully qualified path, or the original path if nothing\n * is found\n *\n * @private\n */\nasync function runDownPath(exe: string): Promise<string> {\n\t// NB: Windows won't search PATH looking for executables in spawn like\n\t// Posix does\n\n\t// Files with any directory path don't get this applied\n\tif (slashesRegex.test(exe)) return exe;\n\n\tconst target = joinPaths('.', exe);\n\ttry {\n\t\tconst stats = await stat(target);\n\t\tif (stats?.isFile() && isExecutable(stats)) return target;\n\t} catch {}\n\n\tconst path = process.env.PATH;\n\tif (path != null && path.length !== 0) {\n\t\tconst haystack = path.split(isWindows ? ';' : ':');\n\t\tfor (const p of haystack) {\n\t\t\tconst needle = joinPaths(p, exe);\n\t\t\ttry {\n\t\t\t\tconst stats = await stat(needle);\n\t\t\t\tif (stats?.isFile() && isExecutable(stats)) return needle;\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\treturn exe;\n}\n\nfunction isExecutable(stats: Stats) {\n\tif (isWindows) return true;\n\n\tconst isGroup = stats.gid ? stats.gid === process.getgid?.() : true;\n\tconst isUser = stats.uid ? stats.uid === process.getuid?.() : true;\n\n\treturn Boolean(stats.mode & 0o0001 || (stats.mode & 0o0010 && isGroup) || (stats.mode & 0o0100 && isUser));\n}\n\n/**\n * Finds the executable and parameters to run on Windows. This method\n * mimics the POSIX behavior of being able to run scripts as executables by\n * replacing the passed-in executable with the script runner, for PowerShell,\n * CMD, and node scripts.\n *\n * This method also does the work of running down PATH, which spawn on Windows\n * also doesn't do, unlike on POSIX.\n */\nexport async function findExecutable(exe: string, args: string[]): Promise<{ cmd: string; args: string[] }> {\n\t// POSIX can just execute scripts directly, no need for silly goosery\n\tif (!isWindows) return { cmd: await runDownPath(exe), args: args };\n\n\tif (!(await fsExists(exe))) {\n\t\t// NB: When you write something like `surf-client ... -- surf-build` on Windows,\n\t\t// a shell would normally convert that to surf-build.cmd, but since it's passed\n\t\t// in as an argument, it doesn't happen\n\t\tconst possibleExts = ['.exe', '.bat', '.cmd', '.ps1'];\n\t\tfor (const ext of possibleExts) {\n\t\t\tconst possibleFullPath = await runDownPath(`${exe}${ext}`);\n\n\t\t\tif (await fsExists(possibleFullPath)) return findExecutable(possibleFullPath, args);\n\t\t}\n\t}\n\n\tif (ps1Regex.test(exe)) {\n\t\tconst cmd = joinPaths(\n\t\t\tprocess.env.SYSTEMROOT ?? 'C:\\\\WINDOWS',\n\t\t\t'System32',\n\t\t\t'WindowsPowerShell',\n\t\t\t'v1.0',\n\t\t\t'PowerShell.exe',\n\t\t);\n\t\tconst psargs = ['-ExecutionPolicy', 'Unrestricted', '-NoLogo', '-NonInteractive', '-File', exe];\n\n\t\treturn { cmd: cmd, args: [...psargs, ...args] };\n\t}\n\n\tif (batOrCmdRegex.test(exe)) {\n\t\tconst cmd = joinPaths(process.env.SYSTEMROOT ?? 'C:\\\\WINDOWS', 'System32', 'cmd.exe');\n\t\tconst cmdArgs = ['/C', exe, ...args];\n\n\t\treturn { cmd: cmd, args: cmdArgs };\n\t}\n\n\tif (jsRegex.test(exe)) {\n\t\tconst cmd = process.execPath;\n\t\tconst nodeArgs = [exe];\n\n\t\treturn { cmd: cmd, args: [...nodeArgs, ...args] };\n\t}\n\n\treturn { cmd: exe, args: args };\n}\n\n/** What core uses of a spawned process; Node's `ChildProcess` satisfies it */\nexport interface SpawnedProcess {\n\treadonly stdin: Writable | null;\n\treadonly stdout: Readable | null;\n\treadonly stderr: Readable | null;\n\treadonly killed: boolean;\n\treadonly exitCode: number | null;\n\treadonly spawnargs: string[];\n\t/** Used to stop a run that passes its `maxBuffer`; without it the run destroys the output streams instead */\n\tkill?(signal?: NodeJS.Signals): boolean;\n\tonce(event: 'error', listener: (error: Error) => void): this;\n\tonce(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;\n\tremoveAllListeners(): this;\n}\n\nexport interface ProcessSpawnOptions {\n\treadonly cwd?: string;\n\t/** The child's whole environment, not additions to the spawner's own; an `undefined` value leaves the key out */\n\treadonly env?: Record<string, string | undefined>;\n\t/** Milliseconds; absent means none */\n\treadonly timeout?: number;\n\treadonly signal?: AbortSignal;\n\t/** A `null` entry means `'pipe'` */\n\treadonly stdio?: ['pipe' | 'ignore', null, null];\n}\n\n/**\n * Launches a process in place of Node's `spawn`, and must behave as it does:\n * - pipe stdout and stderr, and stdin unless `stdio[0]` is `'ignore'`, which leaves `stdin` null\n * - honour `signal`, including one already aborted: kill with SIGTERM, then emit `'error'` with `name` `AbortError`,\n * unless the process has already exited\n * - honour `timeout`: kill with SIGTERM and set `killed`, without emitting `'error'`\n * - report a killed process's `'close'` with a null code and its signal, not an exit code such as 143\n * - on Windows, end the process's whole tree when killing it (timeout, abort, or `kill`): a launcher such as Git for\n * Windows' `cmd\\git.exe` runs the real git as a child holding the same pipes, so killing only the launcher leaves\n * them open and `'close'` never comes\n * - emit no event before returning, `'error'` at most once, and `'close'` exactly once and last: also after `'error'`\n * (a failed launch, an abort), and only after `stdout` and `stderr` have ended or been destroyed, with `exitCode`\n * and `killed` already set\n * - close the child's stdout when `stdout` is destroyed, which is how a reader that stops early ends the process\n */\nexport type ProcessSpawner = (command: string, args: readonly string[], options: ProcessSpawnOptions) => SpawnedProcess;\n\n/**\n * The default {@link ProcessSpawner}: Node's `spawn`, but with its `timeout` handled here. Node clears its timeout\n * timer only on `'exit'`, which a failed launch (e.g. a missing `cwd`) never emits, so the timer outlives the\n * process and keeps Node alive for the full timeout. This mirrors Node's timeout handling but also clears on\n * `'close'`, as https://github.com/nodejs/node/pull/65506 does; remove it once the minimum supported Node/Electron\n * includes that fix.\n */\nexport function spawnProcess(command: string, args: readonly string[], options: ProcessSpawnOptions): ChildProcess {\n\tconst { timeout, ...spawnOptions } = options;\n\t// Node's own validation, thrown before anything spawns\n\tif (timeout != null && !(Number.isInteger(timeout) && timeout >= 0)) {\n\t\tconst ex = new RangeError(\n\t\t\t`The value of \"timeout\" is out of range. It must be an unsigned integer. Received ${String(timeout)}`,\n\t\t);\n\t\t(ex as RangeError & { code: string }).code = 'ERR_OUT_OF_RANGE';\n\t\tthrow ex;\n\t}\n\n\tconst child = spawn(command, args, spawnOptions);\n\tif (isWindows) {\n\t\tkillTreeOnKill(child);\n\t}\n\n\tif (timeout != null && timeout > 0) {\n\t\tkillOnTimeout(child, timeout);\n\t}\n\n\treturn child;\n}\n\n/** Node's spawn `timeout`, but also cleared on `'close'`; see {@link spawnProcess} */\nfunction killOnTimeout(child: ChildProcess, timeout: number): void {\n\tlet timeoutId: ReturnType<typeof setTimeout> | undefined = setTimeout(() => {\n\t\tif (timeoutId != null) {\n\t\t\ttry {\n\t\t\t\tchild.kill();\n\t\t\t} catch (ex) {\n\t\t\t\tchild.emit('error', ex);\n\t\t\t}\n\t\t\ttimeoutId = undefined;\n\t\t}\n\t}, timeout);\n\n\tconst clear = () => {\n\t\tif (timeoutId != null) {\n\t\t\tclearTimeout(timeoutId);\n\t\t\ttimeoutId = undefined;\n\t\t}\n\t};\n\t// `'exit'` keeps Node's timing; `'close'` covers a launch that fails and never exits\n\tchild.once('exit', clear);\n\tchild.once('close', clear);\n}\n\nconst taskkillTimeout = 5000;\n\n/**\n * Makes `kill` end the child's whole tree (Windows only). There `kill` terminates just the child, and a launcher such\n * as Git for Windows' `cmd\\git.exe` runs the real git as its own child on the same stdout and stderr, so the pipes\n * stay open and `'close'` never comes. Node's abort and timeout paths call the instance's `kill`, so this covers them.\n */\nfunction killTreeOnKill(child: ChildProcess): void {\n\tconst kill = child.kill.bind(child);\n\tconst mutable = child as { killed: boolean; exitCode: number | null; signalCode: NodeJS.Signals | null };\n\tlet killing = false;\n\n\tchild.kill = (signal?: NodeJS.Signals | number): boolean => {\n\t\tif (child.pid == null || child.exitCode !== null || child.signalCode !== null || typeof signal === 'number') {\n\t\t\treturn kill(signal);\n\t\t}\n\t\tif (killing) return true;\n\n\t\tkilling = true;\n\t\tconst killSignal = signal ?? 'SIGTERM';\n\t\tmutable.killed = true;\n\n\t\t// Killed from outside, the child exits with taskkill's code 1 and no signal; report it as Node's own kill\n\t\t// would, a null code and the signal, which is what every caller keys on\n\t\tlet exitCode: number | null = child.exitCode;\n\t\tObject.defineProperty(child, 'exitCode', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tget: () => exitCode,\n\t\t\tset: (value: number | null) => {\n\t\t\t\tif (value === 1) {\n\t\t\t\t\texitCode = null;\n\t\t\t\t\tmutable.signalCode = killSignal;\n\t\t\t\t} else {\n\t\t\t\t\texitCode = value;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\t// Once it's killed, a descendant left alive (taskkill failed, or its parent was already gone) can still hold the\n\t\t// pipes; destroying them lets `'close'` come anyway. A child that exited on its own keeps its output\n\t\tchild.once('exit', (_code, exitSignal) => {\n\t\t\tif (exitSignal == null) return;\n\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t});\n\n\t\t// taskkill failed: fall back to Node's kill, unless the child already exited on its own\n\t\tlet failed = false;\n\t\tconst fail = () => {\n\t\t\tif (failed || child.exitCode !== null || child.signalCode !== null) return;\n\n\t\t\tfailed = true;\n\t\t\ttry {\n\t\t\t\tkill(killSignal);\n\t\t\t} catch {}\n\t\t};\n\n\t\ttry {\n\t\t\t// By absolute path: Windows searches the current directory before PATH for a bare name. Its own time limit\n\t\t\t// keeps a stalled taskkill from leaving the kill, and so the run, hanging\n\t\t\tconst taskkill = spawn(\n\t\t\t\tjoinPaths(process.env.SystemRoot || 'C:\\\\Windows', 'System32', 'taskkill.exe'),\n\t\t\t\t['/T', '/F', '/PID', String(child.pid)],\n\t\t\t\t{ stdio: 'ignore', windowsHide: true },\n\t\t\t);\n\t\t\tkillOnTimeout(taskkill, taskkillTimeout);\n\t\t\ttaskkill.once('error', fail);\n\t\t\ttaskkill.once('exit', code => {\n\t\t\t\tif (code !== 0) {\n\t\t\t\t\tfail();\n\t\t\t\t}\n\t\t\t});\n\t\t} catch {\n\t\t\tfail();\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\nexport interface RunOptions<TEncoding = BufferEncoding | 'buffer'> {\n\tcwd?: string;\n\treadonly env?: Record<string, string | undefined>;\n\treadonly encoding?: TEncoding;\n\t/**\n\t * Decodes non-UTF-8 output. Called when `encoding` is not utf8/binary/buffer.\n\t * Provided by the host via the `GitOptions.decode` option.\n\t * If absent and a non-UTF-8 encoding is requested, throws at runtime.\n\t */\n\treadonly decode?: (data: Uint8Array, options?: { readonly encoding: string }) => string | Promise<string>;\n\t/**\n\t * The most bytes each of stdout and stderr may produce; past it the process is killed and the run rejects\n\t * with a `RunError` whose `code` is `ERR_CHILD_PROCESS_STDIO_MAXBUFFER`.\n\t *\n\t * If not specified, `run` allows 1000MB per stream and `runSpawn` allows unlimited output.\n\t */\n\treadonly maxBuffer?: number;\n\treadonly cancellation?: AbortSignal;\n\t/**\n\t * An optional string or buffer which will be written to\n\t * the child process stdin stream immediately immediately\n\t * after spawning the process.\n\t */\n\treadonly stdin?: string | Buffer;\n\t/**\n\t * The encoding to use when writing to stdin, if the stdin\n\t * parameter is a string.\n\t */\n\treadonly stdinEncoding?: string;\n\treadonly timeout?: number;\n\t/**\n\t * When true, suppresses the `[EXEC]` stderr warning emitted on debug-enabled scopes.\n\t * Use for commands whose failure is expected (e.g. paired with `errors: 'ignore'`).\n\t */\n\treadonly quiet?: boolean;\n\t/** Launches the process; defaults to {@link spawnProcess}. Only used by `runSpawn` */\n\treadonly spawn?: ProcessSpawner;\n}\n\nconst bufferExceededRegex = /stdout maxBuffer( length)? exceeded/;\n\ntype ExitCodeOnlyRunOptions<TEncoding = BufferEncoding | 'buffer'> = RunOptions<TEncoding> & { exitCodeOnly: true };\n\nexport function run(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | string,\n\toptions: ExitCodeOnlyRunOptions<BufferEncoding>,\n): Promise<number>;\nexport function run(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | string,\n\toptions?: RunOptions<BufferEncoding>,\n): Promise<string>;\nexport function run<T extends number | string>(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | string,\n\toptions?: RunOptions<BufferEncoding> & { exitCodeOnly?: boolean },\n): Promise<T> {\n\tconst scope = getScopedLogger() ?? maybeStartScopedLogger('Exec.run');\n\n\tconst { stdin, stdinEncoding, cancellation, decode, ...opts }: RunOptions<BufferEncoding> & ExecFileOptions = {\n\t\tmaxBuffer: 1000 * 1024 * 1024,\n\t\t...options,\n\t};\n\n\tconst promise = new Promise<T>((resolve, reject) => {\n\t\tconst proc = execFile(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\t{ ...opts, signal: cancellation },\n\t\t\tasync (error: ExecFileException | null, stdout, stderr) => {\n\t\t\t\tif (options?.exitCodeOnly) {\n\t\t\t\t\tresolve((error?.code ?? proc.exitCode) as T);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (error != null) {\n\t\t\t\t\tif (error.signal === 'SIGTERM') {\n\t\t\t\t\t\treject(\n\t\t\t\t\t\t\tnew CancelledRunError(\n\t\t\t\t\t\t\t\t`${command} ${args.join(' ')}`,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\terror.code ?? undefined,\n\t\t\t\t\t\t\t\terror.signal,\n\t\t\t\t\t\t\t\tcancellation?.aborted ? 'aborted' : error.killed ? 'timeout' : 'unknown',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (bufferExceededRegex.test(error.message)) {\n\t\t\t\t\t\terror.message = `Command output exceeded the allocated stdout buffer. Set 'options.maxBuffer' to a larger value than ${opts.maxBuffer} bytes`;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet stdoutDecoded: string;\n\t\t\t\t\tlet stderrDecoded: string;\n\t\t\t\t\tif (encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer') {\n\t\t\t\t\t\t// stdout & stderr can be `Buffer` or `string\n\t\t\t\t\t\t// oxlint-disable-next-line typescript/no-unnecessary-type-conversion\n\t\t\t\t\t\tstdoutDecoded = stdout.toString();\n\t\t\t\t\t\t// oxlint-disable-next-line typescript/no-unnecessary-type-conversion\n\t\t\t\t\t\tstderrDecoded = stderr.toString();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (decode == null) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstdoutDecoded = await decode(\n\t\t\t\t\t\t\tBuffer.from(stdout, 'binary'),\n\t\t\t\t\t\t\tencoding ? { encoding: encoding } : undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstderrDecoded = await decode(\n\t\t\t\t\t\t\tBuffer.from(stderr, 'binary'),\n\t\t\t\t\t\t\tencoding ? { encoding: encoding } : undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treject(new RunError(error, stdoutDecoded, stderrDecoded));\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (stderr && !options?.quiet && scope?.enabled('debug')) {\n\t\t\t\t\tscope?.warn(`[EXEC] '${command} ${args.join(' ')}' \\u2022 ${stderr}`);\n\t\t\t\t}\n\n\t\t\t\tif (encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer') {\n\t\t\t\t\tresolve(stdout as T);\n\t\t\t\t} else {\n\t\t\t\t\tif (decode == null) {\n\t\t\t\t\t\tthrow new Error(`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`);\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve(\n\t\t\t\t\t\t(await decode(\n\t\t\t\t\t\t\tBuffer.from(stdout, 'binary'),\n\t\t\t\t\t\t\tencoding ? { encoding: encoding } : undefined,\n\t\t\t\t\t\t)) as T,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\tif (stdin != null) {\n\t\t\tendStdin(proc.stdin, stdin, stdinEncoding);\n\t\t}\n\t});\n\n\treturn promise.finally(() => scope?.[Symbol.dispose]());\n}\n\n/**\n * Writes a child's whole input and closes it. A child can exit, or be killed on cancellation, before reading all of\n * it, and the pipe then errors (EPIPE, or EOF on Windows). Unlistened, that error is thrown as an uncaught exception\n * and takes down the whole host process, so it is dropped: the child's exit status and stderr already report the\n * failure, and a child that chose to stop reading answered from what it read.\n */\nexport function endStdin(stream: Writable | null, stdin: string | Buffer, stdinEncoding: string | undefined): void {\n\tif (stream == null) return;\n\n\tstream.on('error', () => {});\n\tif (typeof stdin === 'string') {\n\t\tstream.end(stdin, (stdinEncoding ?? 'utf8') as BufferEncoding);\n\t} else {\n\t\tstream.end(stdin);\n\t}\n}\n\nexport interface RunExitResult {\n\t/**\n\t * The process's exit code. ABSENT when the process never exited normally — killed by a signal, in which\n\t * case {@link signal} is set. Deliberately optional rather than defaulted to `0`: a signalled process\n\t * reported as `exitCode: 0` is indistinguishable from a clean success, so callers would read a partial\n\t * or empty stdout as a complete answer.\n\t */\n\treadonly exitCode?: number;\n\t/** Set when the process was terminated by a signal instead of exiting; {@link exitCode} is then absent. */\n\treadonly signal?: NodeJS.Signals;\n\t/** Whether Node itself killed the process (its spawn `timeout`), as opposed to an external signal. */\n\treadonly killed?: boolean;\n}\n\nexport interface RunResult<T extends string | Buffer> extends RunExitResult {\n\tstdout: T;\n\tstderr: T;\n}\n\nexport function runSpawn(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | 'buffer' | string,\n\toptions: ExitCodeOnlyRunOptions,\n): Promise<RunExitResult>;\nexport function runSpawn<T extends string | Buffer>(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | 'buffer' | string,\n\toptions: RunOptions,\n): Promise<RunResult<T>>;\nexport function runSpawn<T extends string | Buffer>(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | 'buffer' | string,\n\toptions: RunOptions & { exitCodeOnly?: boolean },\n): Promise<RunExitResult | RunResult<T>> {\n\tconst scope = getScopedLogger() ?? maybeStartScopedLogger('Exec.runSpawn');\n\n\tconst { stdin, stdinEncoding, cancellation, decode, spawn: spawner, ...opts }: RunOptions = options;\n\n\tconst promise = new Promise<RunExitResult | RunResult<T>>((resolve, reject) => {\n\t\tconst proc = (spawner ?? spawnProcess)(command, args, {\n\t\t\tcwd: opts.cwd,\n\t\t\tenv: opts.env,\n\t\t\t// 0 disables it, which the spawner contract spells as absent\n\t\t\ttimeout: opts.timeout === 0 ? undefined : opts.timeout,\n\t\t\tsignal: cancellation,\n\t\t\tstdio: [stdin != null ? 'pipe' : 'ignore', null, null],\n\t\t});\n\t\tconst errorEncoding = encoding === 'buffer' ? 'utf8' : encoding;\n\n\t\tconst maxBuffer = opts.maxBuffer != null && opts.maxBuffer > 0 ? opts.maxBuffer : undefined;\n\t\tlet limitHit = false;\n\n\t\tfunction collector(buffers: Buffer[], name: 'stdout' | 'stderr'): (data: Buffer) => void {\n\t\t\tlet size = 0;\n\t\t\treturn (data: Buffer) => {\n\t\t\t\tif (limitHit) return;\n\n\t\t\t\tsize += data.length;\n\t\t\t\tif (maxBuffer != null && size > maxBuffer) {\n\t\t\t\t\texceedLimit(name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tbuffers.push(data);\n\t\t\t};\n\t\t}\n\n\t\tconst stdoutBuffers: Buffer[] = [];\n\t\tconst collectStdout = collector(stdoutBuffers, 'stdout');\n\t\tproc.stdout?.on('data', collectStdout);\n\n\t\tconst stderrBuffers: Buffer[] = [];\n\t\tconst collectStderr = collector(stderrBuffers, 'stderr');\n\t\tproc.stderr?.on('data', collectStderr);\n\n\t\t// Settles the run as soon as a stream passes the limit. Destroying the streams ends a spawner whose process\n\t\t// has no `kill`, and the late `'close'` or `'error'` is ignored through `limitHit`\n\t\tfunction exceedLimit(name: 'stdout' | 'stderr'): void {\n\t\t\tlimitHit = true;\n\t\t\tstdoutBuffers.length = 0;\n\t\t\tstderrBuffers.length = 0;\n\t\t\tproc.stdout?.off('data', collectStdout);\n\t\t\tproc.stderr?.off('data', collectStderr);\n\n\t\t\ttry {\n\t\t\t\tproc.kill?.();\n\t\t\t} catch {}\n\t\t\tproc.stdout?.destroy();\n\t\t\tproc.stderr?.destroy();\n\n\t\t\treject(\n\t\t\t\tnew RunError(\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: `Command output exceeded the allocated ${name} buffer. Set 'options.maxBuffer' to a larger value than ${maxBuffer} bytes`,\n\t\t\t\t\t\tcmd: `${command} ${args.join(' ')}`,\n\t\t\t\t\t\tkilled: true,\n\t\t\t\t\t\tcode: 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER',\n\t\t\t\t\t},\n\t\t\t\t\t'',\n\t\t\t\t\t'',\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tfunction getStdio<T>(\n\t\t\tencoding: BufferEncoding | 'buffer' | string,\n\t\t): { stdout: T; stderr: T } | Promise<{ stdout: T; stderr: T }> {\n\t\t\tconst stdout = Buffer.concat(stdoutBuffers);\n\t\t\tconst stderr = Buffer.concat(stderrBuffers);\n\t\t\tif (encoding === 'utf8' || encoding === 'binary') {\n\t\t\t\treturn { stdout: stdout.toString(encoding) as T, stderr: stderr.toString(encoding) as T };\n\t\t\t}\n\t\t\tif (encoding === 'buffer') {\n\t\t\t\treturn { stdout: stdout as T, stderr: stderr as T };\n\t\t\t}\n\n\t\t\tif (decode == null) {\n\t\t\t\tthrow new Error(`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`);\n\t\t\t}\n\n\t\t\treturn Promise.all([\n\t\t\t\tdecode(stdout, encoding ? { encoding: encoding } : undefined),\n\t\t\t\tdecode(stderr, encoding ? { encoding: encoding } : undefined),\n\t\t\t]).then(([decodedStdout, decodedStderr]) => ({\n\t\t\t\tstdout: decodedStdout as T,\n\t\t\t\tstderr: decodedStderr as T,\n\t\t\t}));\n\t\t}\n\n\t\t// An async listener's throw would be an unhandled rejection that leaves the promise pending forever, so\n\t\t// anything it throws (an undecodable output, a failing `decode`) rejects the run instead. It rejects as\n\t\t// thrown: wrapped in a `RunError` with the exit code, a clean exit would read as a run with no output\n\t\tconst rejectThrown = (ex: unknown): void => reject(ex instanceof Error ? ex : new Error(String(ex)));\n\t\tproc.once('error', ex => void onError(ex).catch(rejectThrown));\n\t\tproc.once('close', (code, signal) => void onClose(code, signal).catch(rejectThrown));\n\n\t\tasync function onError(ex: Error): Promise<void> {\n\t\t\tif (limitHit) return;\n\n\t\t\tif (ex?.name === 'AbortError') {\n\t\t\t\treject(new CancelledRunError(`${command} ${args.join(' ')}`, true, undefined, undefined, 'aborted'));\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The launch failure is what the caller acts on, so output that can't be decoded is left out of it\n\t\t\tlet stdout = '';\n\t\t\tlet stderr = '';\n\t\t\ttry {\n\t\t\t\tconst stdio = getStdio<string>(errorEncoding);\n\t\t\t\t({ stdout, stderr } = stdio instanceof Promise ? await stdio : stdio);\n\t\t\t} catch {}\n\n\t\t\treject(new RunError(ex, stdout, stderr));\n\t\t}\n\n\t\tasync function onClose(code: number | null, signal: NodeJS.Signals | null): Promise<void> {\n\t\t\tif (limitHit) return;\n\n\t\t\tif (options?.exitCodeOnly) {\n\t\t\t\t// Resolves unconditionally, so this is the one path that can hand back a signalled run. `code`\n\t\t\t\t// is null exactly when the process was killed — report the signal rather than coercing to `0`,\n\t\t\t\t// which would claim a clean success for a command that never finished. Note this returns BEFORE\n\t\t\t\t// the SIGTERM-to-cancellation diversion below, so callers have to classify that themselves.\n\t\t\t\tresolve({ exitCode: code ?? undefined, signal: signal ?? undefined, killed: proc.killed });\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (code !== 0 || signal) {\n\t\t\t\tconst stdio = getStdio<string>(errorEncoding);\n\t\t\t\tconst { stdout, stderr } = stdio instanceof Promise ? await stdio : stdio;\n\t\t\t\tif (stderr.length && !options?.quiet && scope?.enabled('debug')) {\n\t\t\t\t\tscope?.warn(`[EXEC] '${command} ${args.join(' ')}' \\u2022 ${stderr}`);\n\t\t\t\t}\n\n\t\t\t\tif (signal === 'SIGTERM') {\n\t\t\t\t\t// Only Node's spawn `timeout` kills it (a caller abort rejected above, from `'error'`); an\n\t\t\t\t\t// external SIGTERM leaves `proc.killed` false\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew CancelledRunError(\n\t\t\t\t\t\t\t`${command} ${args.join(' ')}`,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tcode ?? undefined,\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tproc.killed ? 'timeout' : 'unknown',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\treject(\n\t\t\t\t\tnew RunError(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmessage: `Command failed with exit code ${code}`,\n\t\t\t\t\t\t\tcode: code,\n\t\t\t\t\t\t\tsignal: signal ?? undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstdout,\n\t\t\t\t\t\tstderr,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst stdio = getStdio<T>(encoding);\n\t\t\tconst { stdout, stderr } = stdio instanceof Promise ? await stdio : stdio;\n\t\t\tif (stderr.length && !options?.quiet && scope?.enabled('debug')) {\n\t\t\t\tscope?.warn(\n\t\t\t\t\t`[EXEC] '${command} ${args.join(' ')}' \\u2022 ${typeof stderr === 'string' ? stderr : stderr.toString()}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// The guard above already rejected every non-zero and every signalled close, so this is a clean\n\t\t\t// zero exit — `code` cannot be null here. (The optional typing exists for the `exitCodeOnly`\n\t\t\t// branch, which is where a codeless result can genuinely surface.)\n\t\t\tresolve({ exitCode: code ?? undefined, signal: signal ?? undefined, stdout: stdout, stderr: stderr });\n\t\t}\n\n\t\t// Only a host spawner can leave these out; reading no output as empty would pass for a clean answer\n\t\tif (proc.stdout == null || proc.stderr == null) {\n\t\t\treject(new Error(`'${command}' was spawned without stdout and stderr pipes`));\n\t\t}\n\n\t\tif (stdin != null) {\n\t\t\tendStdin(proc.stdin, stdin, stdinEncoding);\n\t\t}\n\t});\n\n\treturn promise.finally(() => scope?.[Symbol.dispose]());\n}\n\nexport async function fsExists(path: string): Promise<boolean> {\n\treturn new Promise<boolean>(resolve => access(path, constants.F_OK, err => resolve(err == null)));\n}\n"],"mappings":";;;;;;;;AAuBA,IAAa,WAAb,cAA8B,MAAM;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA0B,QAAgB,QAAgB;EACrE,MAAM,QAAQ,OAAO;EAErB,KAAK,MAAM,QAAQ;EACnB,KAAK,SAAS,QAAQ;EACtB,KAAK,OAAO,QAAQ,QAAQ,KAAA;EAC5B,KAAK,SAAS,QAAQ;EACtB,KAAK,UAAU,QAAQ;EACvB,KAAK,SAAS,QAAQ,KAAK,KAAK;EAChC,KAAK,SAAS,QAAQ,KAAK,KAAK;EAEhC,KAAK,OAAO;EACZ,MAAM,oBAAoB,MAAM,UAAU;CAC3C;AACD;AAEA,IAAa,oBAAb,cAAuC,SAAS;CAC/C;CAEA,YACC,KACA,QACA,MACA,SAAyB,WACzB,SAA6B,WAC5B;EACD,MACC;GAAE,SAAS,gCAAgC;GAAY;GAAa;GAAc;GAAc;EAAO,GACvG,IACA,EACD;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,SAAS,SAAS,OAAO,QAAQ,OAAO,GAC7D,OAAO,KAAK,WAAW,QAAQ,GAAG,KAAK,KAAK,GAAG,EAAE,WAAW,QAAQ;IAGrE,IAAI,WAAW,WAAW;KAGzB,OACC,IAAI,kBACH,GAAG,QAAQ,GAAG,KAAK,KAAK,GAAG,KAC3B,MACA,QAAQ,KAAA,GACR,QACA,KAAK,SAAS,YAAY,SAC3B,CACD;KAEA;IACD;IAEA,OACC,IAAI,SACH;KACC,SAAS,iCAAiC;KACpC;KACN,QAAQ,UAAU,KAAA;IACnB,GACA,QACA,MACD,CACD;IAEA;GACD;GAEA,MAAM,QAAQ,SAAY,QAAQ;GAClC,MAAM,EAAE,QAAQ,WAAW,iBAAiB,UAAU,MAAM,QAAQ;GACpE,IAAI,OAAO,UAAU,CAAC,SAAS,SAAS,OAAO,QAAQ,OAAO,GAC7D,OAAO,KACN,WAAW,QAAQ,GAAG,KAAK,KAAK,GAAG,EAAE,WAAW,OAAO,WAAW,WAAW,SAAS,OAAO,SAAS,GACvG;GAMD,QAAQ;IAAE,UAAU,QAAQ,KAAA;IAAW,QAAQ,UAAU,KAAA;IAAmB;IAAgB;GAAO,CAAC;EACrG;EAGA,IAAI,KAAK,UAAU,QAAQ,KAAK,UAAU,MACzC,uBAAO,IAAI,MAAM,IAAI,QAAQ,8CAA8C,CAAC;EAG7E,IAAI,SAAS,MACZ,SAAS,KAAK,OAAO,OAAO,aAAa;CAE3C,CAEa,CAAC,CAAC,cAAc,QAAQ,OAAO,QAAQ,CAAC,CAAC;AACvD;AAEA,eAAsB,SAAS,MAAgC;CAC9D,OAAO,IAAI,SAAiB,YAAW,OAAO,MAAM,UAAU,OAAM,QAAO,QAAQ,OAAO,IAAI,CAAC,CAAC;AACjG"}
|
|
1
|
+
{"version":3,"file":"exec.js","names":["joinPaths"],"sources":["../../../../../utils/src/env/node/exec.ts"],"sourcesContent":["import type { ChildProcess, ExecFileException, ExecFileOptions } from 'child_process';\nimport { execFile, spawn } from 'child_process';\nimport type { Stats } from 'fs';\nimport { access, constants } from 'fs';\nimport { stat } from 'fs/promises';\nimport { join as joinPaths } from 'path';\nimport * as process from 'process';\nimport type { Readable, Writable } from 'stream';\nimport type { CancellationReason } from '../../cancellation.js';\nimport { getScopedLogger, maybeStartScopedLogger } from '../../logger.scoped.js';\nimport { isWindows } from './platform.js';\n\n// -- Error types --\n\ninterface RunErrorContext {\n\tmessage: string;\n\tcmd?: string | undefined;\n\tkilled?: boolean | undefined;\n\tcode?: string | number | null | undefined;\n\tsignal?: NodeJS.Signals | undefined;\n\tsyscall?: string | undefined;\n}\n\nexport class RunError extends Error {\n\treadonly cmd?: string | undefined;\n\treadonly killed?: boolean | undefined;\n\treadonly code?: string | number | undefined;\n\treadonly signal?: NodeJS.Signals | undefined;\n\treadonly syscall?: string | undefined;\n\treadonly stdout: string;\n\treadonly stderr: string;\n\n\tconstructor(context: RunErrorContext, stdout: string, stderr: string) {\n\t\tsuper(context.message);\n\n\t\tthis.cmd = context.cmd;\n\t\tthis.killed = context.killed;\n\t\tthis.code = context.code ?? undefined;\n\t\tthis.signal = context.signal;\n\t\tthis.syscall = context.syscall;\n\t\tthis.stdout = stdout?.trim() ?? '';\n\t\tthis.stderr = stderr?.trim() ?? '';\n\n\t\tthis.name = 'RunError';\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\nexport class CancelledRunError extends RunError {\n\treadonly reason: CancellationReason;\n\n\tconstructor(\n\t\tcmd: string,\n\t\tkilled: boolean,\n\t\tcode?: number | string | undefined,\n\t\tsignal: NodeJS.Signals = 'SIGTERM',\n\t\treason: CancellationReason = 'unknown',\n\t) {\n\t\tsuper(\n\t\t\t{ message: `Operation cancelled; command=${cmd}`, cmd: cmd, killed: killed, code: code, signal: signal },\n\t\t\t'',\n\t\t\t'',\n\t\t);\n\n\t\tthis.reason = reason;\n\n\t\tthis.name = 'CancelledRunError';\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\n// -- Execution utilities --\n\nconst slashesRegex = /[\\\\/]/;\nconst ps1Regex = /\\.ps1$/i;\nconst batOrCmdRegex = /\\.(bat|cmd)$/i;\nconst jsRegex = /\\.(js)$/i;\n\n/**\n * Search PATH to see if a file exists in any of the path folders.\n *\n * @param {string} exe The file to search for\n * @return {string} A fully qualified path, or the original path if nothing\n * is found\n *\n * @private\n */\nasync function runDownPath(exe: string): Promise<string> {\n\t// NB: Windows won't search PATH looking for executables in spawn like\n\t// Posix does\n\n\t// Files with any directory path don't get this applied\n\tif (slashesRegex.test(exe)) return exe;\n\n\tconst target = joinPaths('.', exe);\n\ttry {\n\t\tconst stats = await stat(target);\n\t\tif (stats?.isFile() && isExecutable(stats)) return target;\n\t} catch {}\n\n\tconst path = process.env.PATH;\n\tif (path != null && path.length !== 0) {\n\t\tconst haystack = path.split(isWindows ? ';' : ':');\n\t\tfor (const p of haystack) {\n\t\t\tconst needle = joinPaths(p, exe);\n\t\t\ttry {\n\t\t\t\tconst stats = await stat(needle);\n\t\t\t\tif (stats?.isFile() && isExecutable(stats)) return needle;\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\treturn exe;\n}\n\nfunction isExecutable(stats: Stats) {\n\tif (isWindows) return true;\n\n\tconst isGroup = stats.gid ? stats.gid === process.getgid?.() : true;\n\tconst isUser = stats.uid ? stats.uid === process.getuid?.() : true;\n\n\treturn Boolean(stats.mode & 0o0001 || (stats.mode & 0o0010 && isGroup) || (stats.mode & 0o0100 && isUser));\n}\n\n/**\n * Finds the executable and parameters to run on Windows. This method\n * mimics the POSIX behavior of being able to run scripts as executables by\n * replacing the passed-in executable with the script runner, for PowerShell,\n * CMD, and node scripts.\n *\n * This method also does the work of running down PATH, which spawn on Windows\n * also doesn't do, unlike on POSIX.\n */\nexport async function findExecutable(exe: string, args: string[]): Promise<{ cmd: string; args: string[] }> {\n\t// POSIX can just execute scripts directly, no need for silly goosery\n\tif (!isWindows) return { cmd: await runDownPath(exe), args: args };\n\n\tif (!(await fsExists(exe))) {\n\t\t// NB: When you write something like `surf-client ... -- surf-build` on Windows,\n\t\t// a shell would normally convert that to surf-build.cmd, but since it's passed\n\t\t// in as an argument, it doesn't happen\n\t\tconst possibleExts = ['.exe', '.bat', '.cmd', '.ps1'];\n\t\tfor (const ext of possibleExts) {\n\t\t\tconst possibleFullPath = await runDownPath(`${exe}${ext}`);\n\n\t\t\tif (await fsExists(possibleFullPath)) return findExecutable(possibleFullPath, args);\n\t\t}\n\t}\n\n\tif (ps1Regex.test(exe)) {\n\t\tconst cmd = joinPaths(\n\t\t\tprocess.env.SYSTEMROOT ?? 'C:\\\\WINDOWS',\n\t\t\t'System32',\n\t\t\t'WindowsPowerShell',\n\t\t\t'v1.0',\n\t\t\t'PowerShell.exe',\n\t\t);\n\t\tconst psargs = ['-ExecutionPolicy', 'Unrestricted', '-NoLogo', '-NonInteractive', '-File', exe];\n\n\t\treturn { cmd: cmd, args: [...psargs, ...args] };\n\t}\n\n\tif (batOrCmdRegex.test(exe)) {\n\t\tconst cmd = joinPaths(process.env.SYSTEMROOT ?? 'C:\\\\WINDOWS', 'System32', 'cmd.exe');\n\t\tconst cmdArgs = ['/C', exe, ...args];\n\n\t\treturn { cmd: cmd, args: cmdArgs };\n\t}\n\n\tif (jsRegex.test(exe)) {\n\t\tconst cmd = process.execPath;\n\t\tconst nodeArgs = [exe];\n\n\t\treturn { cmd: cmd, args: [...nodeArgs, ...args] };\n\t}\n\n\treturn { cmd: exe, args: args };\n}\n\n/** What core uses of a spawned process; Node's `ChildProcess` satisfies it */\nexport interface SpawnedProcess {\n\treadonly stdin: Writable | null;\n\treadonly stdout: Readable | null;\n\treadonly stderr: Readable | null;\n\treadonly killed: boolean;\n\treadonly exitCode: number | null;\n\treadonly spawnargs: string[];\n\t/** Used to stop a run that passes its `maxBuffer`; without it the run destroys the output streams instead */\n\tkill?(signal?: NodeJS.Signals): boolean;\n\tonce(event: 'error', listener: (error: Error) => void): this;\n\tonce(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;\n\tremoveAllListeners(): this;\n}\n\nexport interface ProcessSpawnOptions {\n\treadonly cwd?: string;\n\t/** The child's whole environment, not additions to the spawner's own; an `undefined` value leaves the key out */\n\treadonly env?: Record<string, string | undefined>;\n\t/** Milliseconds; absent means none */\n\treadonly timeout?: number;\n\treadonly signal?: AbortSignal;\n\t/** A `null` entry means `'pipe'` */\n\treadonly stdio?: ['pipe' | 'ignore', null, null];\n}\n\n/**\n * Launches a process in place of Node's `spawn`, and must behave as it does:\n * - pipe stdout and stderr, and stdin unless `stdio[0]` is `'ignore'`, which leaves `stdin` null\n * - honour `signal`, including one already aborted: kill with SIGTERM, then emit `'error'` with `name` `AbortError`,\n * unless the process has already exited\n * - honour `timeout`: kill with SIGTERM and set `killed`, without emitting `'error'`\n * - report a killed process's `'close'` with a null code and its signal, not an exit code such as 143\n * - on Windows, end the process's whole tree when killing it (timeout, abort, or `kill`): a launcher such as Git for\n * Windows' `cmd\\git.exe` runs the real git as a child holding the same pipes, so killing only the launcher leaves\n * them open and `'close'` never comes\n * - emit no event before returning, `'error'` at most once, and `'close'` exactly once and last: also after `'error'`\n * (a failed launch, an abort), and only after `stdout` and `stderr` have ended or been destroyed, with `exitCode`\n * and `killed` already set\n * - close the child's stdout when `stdout` is destroyed, which is how a reader that stops early ends the process\n */\nexport type ProcessSpawner = (command: string, args: readonly string[], options: ProcessSpawnOptions) => SpawnedProcess;\n\n/**\n * The default {@link ProcessSpawner}: Node's `spawn`, but with its `timeout` handled here. Node clears its timeout\n * timer only on `'exit'`, which a failed launch (e.g. a missing `cwd`) never emits, so the timer outlives the\n * process and keeps Node alive for the full timeout. This mirrors Node's timeout handling but also clears on\n * `'close'`, as https://github.com/nodejs/node/pull/65506 does; remove it once the minimum supported Node/Electron\n * includes that fix.\n */\nexport function spawnProcess(command: string, args: readonly string[], options: ProcessSpawnOptions): ChildProcess {\n\tconst { timeout, ...spawnOptions } = options;\n\t// Node's own validation, thrown before anything spawns\n\tif (timeout != null && !(Number.isInteger(timeout) && timeout >= 0)) {\n\t\tconst ex = new RangeError(\n\t\t\t`The value of \"timeout\" is out of range. It must be an unsigned integer. Received ${String(timeout)}`,\n\t\t);\n\t\t(ex as RangeError & { code: string }).code = 'ERR_OUT_OF_RANGE';\n\t\tthrow ex;\n\t}\n\n\tconst child = spawn(command, args, spawnOptions);\n\tif (isWindows) {\n\t\tkillTreeOnKill(child);\n\t}\n\n\tif (timeout != null && timeout > 0) {\n\t\tkillOnTimeout(child, timeout);\n\t}\n\n\treturn child;\n}\n\n/** Node's spawn `timeout`, but also cleared on `'close'`; see {@link spawnProcess} */\nfunction killOnTimeout(child: ChildProcess, timeout: number): void {\n\tlet timeoutId: ReturnType<typeof setTimeout> | undefined = setTimeout(() => {\n\t\tif (timeoutId != null) {\n\t\t\ttry {\n\t\t\t\tchild.kill();\n\t\t\t} catch (ex) {\n\t\t\t\tchild.emit('error', ex);\n\t\t\t}\n\t\t\ttimeoutId = undefined;\n\t\t}\n\t}, timeout);\n\n\tconst clear = () => {\n\t\tif (timeoutId != null) {\n\t\t\tclearTimeout(timeoutId);\n\t\t\ttimeoutId = undefined;\n\t\t}\n\t};\n\t// `'exit'` keeps Node's timing; `'close'` covers a launch that fails and never exits\n\tchild.once('exit', clear);\n\tchild.once('close', clear);\n}\n\nconst taskkillTimeout = 5000;\n\n/**\n * Makes `kill` end the child's whole tree (Windows only). There `kill` terminates just the child, and a launcher such\n * as Git for Windows' `cmd\\git.exe` runs the real git as its own child on the same stdout and stderr, so the pipes\n * stay open and `'close'` never comes. Node's abort and timeout paths call the instance's `kill`, so this covers them.\n */\nfunction killTreeOnKill(child: ChildProcess): void {\n\tconst kill = child.kill.bind(child);\n\tconst mutable = child as { killed: boolean; exitCode: number | null; signalCode: NodeJS.Signals | null };\n\tlet killing = false;\n\n\tchild.kill = (signal?: NodeJS.Signals | number): boolean => {\n\t\tif (child.pid == null || child.exitCode !== null || child.signalCode !== null || typeof signal === 'number') {\n\t\t\treturn kill(signal);\n\t\t}\n\t\tif (killing) return true;\n\n\t\tkilling = true;\n\t\tconst killSignal = signal ?? 'SIGTERM';\n\t\tmutable.killed = true;\n\n\t\t// Killed from outside, the child exits with taskkill's code 1 and no signal; report it as Node's own kill\n\t\t// would, a null code and the signal, which is what every caller keys on\n\t\tlet exitCode: number | null = child.exitCode;\n\t\tObject.defineProperty(child, 'exitCode', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tget: () => exitCode,\n\t\t\tset: (value: number | null) => {\n\t\t\t\tif (value === 1) {\n\t\t\t\t\texitCode = null;\n\t\t\t\t\tmutable.signalCode = killSignal;\n\t\t\t\t} else {\n\t\t\t\t\texitCode = value;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\t// Once it's killed, a descendant left alive (taskkill failed, or its parent was already gone) can still hold the\n\t\t// pipes; destroying them lets `'close'` come anyway. A child that exited on its own keeps its output\n\t\tchild.once('exit', (_code, exitSignal) => {\n\t\t\tif (exitSignal == null) return;\n\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t});\n\n\t\t// taskkill failed: fall back to Node's kill, unless the child already exited on its own\n\t\tlet failed = false;\n\t\tconst fail = () => {\n\t\t\tif (failed || child.exitCode !== null || child.signalCode !== null) return;\n\n\t\t\tfailed = true;\n\t\t\ttry {\n\t\t\t\tkill(killSignal);\n\t\t\t} catch {}\n\t\t};\n\n\t\ttry {\n\t\t\t// By absolute path: Windows searches the current directory before PATH for a bare name. Its own time limit\n\t\t\t// keeps a stalled taskkill from leaving the kill, and so the run, hanging\n\t\t\tconst taskkill = spawn(\n\t\t\t\tjoinPaths(process.env.SystemRoot || 'C:\\\\Windows', 'System32', 'taskkill.exe'),\n\t\t\t\t['/T', '/F', '/PID', String(child.pid)],\n\t\t\t\t{ stdio: 'ignore', windowsHide: true },\n\t\t\t);\n\t\t\tkillOnTimeout(taskkill, taskkillTimeout);\n\t\t\ttaskkill.once('error', fail);\n\t\t\ttaskkill.once('exit', code => {\n\t\t\t\tif (code !== 0) {\n\t\t\t\t\tfail();\n\t\t\t\t}\n\t\t\t});\n\t\t} catch {\n\t\t\tfail();\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\nexport interface RunOptions<TEncoding = BufferEncoding | 'buffer'> {\n\tcwd?: string;\n\treadonly env?: Record<string, string | undefined>;\n\treadonly encoding?: TEncoding;\n\t/**\n\t * Decodes non-UTF-8 output. Called when `encoding` is not utf8/binary/buffer.\n\t * Provided by the host via the `GitOptions.decode` option.\n\t * If absent and a non-UTF-8 encoding is requested, throws at runtime.\n\t */\n\treadonly decode?: (data: Uint8Array, options?: { readonly encoding: string }) => string | Promise<string>;\n\t/**\n\t * The most bytes each of stdout and stderr may produce; past it the process is killed and the run rejects\n\t * with a `RunError` whose `code` is `ERR_CHILD_PROCESS_STDIO_MAXBUFFER`.\n\t *\n\t * If not specified, `run` allows 1000MB per stream and `runSpawn` allows unlimited output.\n\t */\n\treadonly maxBuffer?: number;\n\treadonly cancellation?: AbortSignal;\n\t/**\n\t * An optional string or buffer which will be written to\n\t * the child process stdin stream immediately immediately\n\t * after spawning the process.\n\t */\n\treadonly stdin?: string | Buffer;\n\t/**\n\t * The encoding to use when writing to stdin, if the stdin\n\t * parameter is a string.\n\t */\n\treadonly stdinEncoding?: string;\n\treadonly timeout?: number;\n\t/**\n\t * When true, suppresses the `[EXEC]` stderr warning emitted on debug-enabled scopes.\n\t * Use for commands whose failure is expected (e.g. paired with `errors: 'ignore'`).\n\t */\n\treadonly quiet?: boolean;\n\t/** Launches the process; defaults to {@link spawnProcess}. Only used by `runSpawn` */\n\treadonly spawn?: ProcessSpawner;\n}\n\nconst bufferExceededRegex = /stdout maxBuffer( length)? exceeded/;\n\nexport function withoutTrace2EventLines(text: string): string {\n\tif (!text.includes('{\"event\":')) return text;\n\n\treturn text\n\t\t.split('\\n')\n\t\t.filter(line => !line.startsWith('{\"event\":'))\n\t\t.join('\\n');\n}\n\ntype ExitCodeOnlyRunOptions<TEncoding = BufferEncoding | 'buffer'> = RunOptions<TEncoding> & { exitCodeOnly: true };\n\nexport function run(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | string,\n\toptions: ExitCodeOnlyRunOptions<BufferEncoding>,\n): Promise<number>;\nexport function run(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | string,\n\toptions?: RunOptions<BufferEncoding>,\n): Promise<string>;\nexport function run<T extends number | string>(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | string,\n\toptions?: RunOptions<BufferEncoding> & { exitCodeOnly?: boolean },\n): Promise<T> {\n\tconst scope = getScopedLogger() ?? maybeStartScopedLogger('Exec.run');\n\n\tconst { stdin, stdinEncoding, cancellation, decode, ...opts }: RunOptions<BufferEncoding> & ExecFileOptions = {\n\t\tmaxBuffer: 1000 * 1024 * 1024,\n\t\t...options,\n\t};\n\n\tconst promise = new Promise<T>((resolve, reject) => {\n\t\tconst proc = execFile(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\t{ ...opts, signal: cancellation },\n\t\t\tasync (error: ExecFileException | null, stdout, stderr) => {\n\t\t\t\tif (options?.exitCodeOnly) {\n\t\t\t\t\tresolve((error?.code ?? proc.exitCode) as T);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (error != null) {\n\t\t\t\t\tif (error.signal === 'SIGTERM') {\n\t\t\t\t\t\treject(\n\t\t\t\t\t\t\tnew CancelledRunError(\n\t\t\t\t\t\t\t\t`${command} ${args.join(' ')}`,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\terror.code ?? undefined,\n\t\t\t\t\t\t\t\terror.signal,\n\t\t\t\t\t\t\t\tcancellation?.aborted ? 'aborted' : error.killed ? 'timeout' : 'unknown',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (bufferExceededRegex.test(error.message)) {\n\t\t\t\t\t\terror.message = `Command output exceeded the allocated stdout buffer. Set 'options.maxBuffer' to a larger value than ${opts.maxBuffer} bytes`;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet stdoutDecoded: string;\n\t\t\t\t\tlet stderrDecoded: string;\n\t\t\t\t\tif (encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer') {\n\t\t\t\t\t\t// stdout & stderr can be `Buffer` or `string\n\t\t\t\t\t\t// oxlint-disable-next-line typescript/no-unnecessary-type-conversion\n\t\t\t\t\t\tstdoutDecoded = stdout.toString();\n\t\t\t\t\t\t// oxlint-disable-next-line typescript/no-unnecessary-type-conversion\n\t\t\t\t\t\tstderrDecoded = stderr.toString();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (decode == null) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstdoutDecoded = await decode(\n\t\t\t\t\t\t\tBuffer.from(stdout, 'binary'),\n\t\t\t\t\t\t\tencoding ? { encoding: encoding } : undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstderrDecoded = await decode(\n\t\t\t\t\t\t\tBuffer.from(stderr, 'binary'),\n\t\t\t\t\t\t\tencoding ? { encoding: encoding } : undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treject(new RunError(error, stdoutDecoded, stderrDecoded));\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (stderr && !options?.quiet && scope?.enabled('debug')) {\n\t\t\t\t\tscope?.warn(`[EXEC] '${command} ${args.join(' ')}' \\u2022 ${stderr}`);\n\t\t\t\t}\n\n\t\t\t\tif (encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer') {\n\t\t\t\t\tresolve(stdout as T);\n\t\t\t\t} else {\n\t\t\t\t\tif (decode == null) {\n\t\t\t\t\t\tthrow new Error(`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`);\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve(\n\t\t\t\t\t\t(await decode(\n\t\t\t\t\t\t\tBuffer.from(stdout, 'binary'),\n\t\t\t\t\t\t\tencoding ? { encoding: encoding } : undefined,\n\t\t\t\t\t\t)) as T,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\tif (stdin != null) {\n\t\t\tendStdin(proc.stdin, stdin, stdinEncoding);\n\t\t}\n\t});\n\n\treturn promise.finally(() => scope?.[Symbol.dispose]());\n}\n\n/**\n * Writes a child's whole input and closes it. A child can exit, or be killed on cancellation, before reading all of\n * it, and the pipe then errors (EPIPE, or EOF on Windows). Unlistened, that error is thrown as an uncaught exception\n * and takes down the whole host process, so it is dropped: the child's exit status and stderr already report the\n * failure, and a child that chose to stop reading answered from what it read.\n */\nexport function endStdin(stream: Writable | null, stdin: string | Buffer, stdinEncoding: string | undefined): void {\n\tif (stream == null) return;\n\n\tstream.on('error', () => {});\n\tif (typeof stdin === 'string') {\n\t\tstream.end(stdin, (stdinEncoding ?? 'utf8') as BufferEncoding);\n\t} else {\n\t\tstream.end(stdin);\n\t}\n}\n\nexport interface RunExitResult {\n\t/**\n\t * The process's exit code. ABSENT when the process never exited normally — killed by a signal, in which\n\t * case {@link signal} is set. Deliberately optional rather than defaulted to `0`: a signalled process\n\t * reported as `exitCode: 0` is indistinguishable from a clean success, so callers would read a partial\n\t * or empty stdout as a complete answer.\n\t */\n\treadonly exitCode?: number;\n\t/** Set when the process was terminated by a signal instead of exiting; {@link exitCode} is then absent. */\n\treadonly signal?: NodeJS.Signals;\n\t/** Whether Node itself killed the process (its spawn `timeout`), as opposed to an external signal. */\n\treadonly killed?: boolean;\n}\n\nexport interface RunResult<T extends string | Buffer> extends RunExitResult {\n\tstdout: T;\n\tstderr: T;\n}\n\nexport function runSpawn(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | 'buffer' | string,\n\toptions: ExitCodeOnlyRunOptions,\n): Promise<RunExitResult>;\nexport function runSpawn<T extends string | Buffer>(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | 'buffer' | string,\n\toptions: RunOptions,\n): Promise<RunResult<T>>;\nexport function runSpawn<T extends string | Buffer>(\n\tcommand: string,\n\targs: readonly string[],\n\tencoding: BufferEncoding | 'buffer' | string,\n\toptions: RunOptions & { exitCodeOnly?: boolean },\n): Promise<RunExitResult | RunResult<T>> {\n\tconst scope = getScopedLogger() ?? maybeStartScopedLogger('Exec.runSpawn');\n\n\tconst { stdin, stdinEncoding, cancellation, decode, spawn: spawner, ...opts }: RunOptions = options;\n\n\tconst promise = new Promise<RunExitResult | RunResult<T>>((resolve, reject) => {\n\t\tconst proc = (spawner ?? spawnProcess)(command, args, {\n\t\t\tcwd: opts.cwd,\n\t\t\tenv: opts.env,\n\t\t\t// 0 disables it, which the spawner contract spells as absent\n\t\t\ttimeout: opts.timeout === 0 ? undefined : opts.timeout,\n\t\t\tsignal: cancellation,\n\t\t\tstdio: [stdin != null ? 'pipe' : 'ignore', null, null],\n\t\t});\n\t\tconst errorEncoding = encoding === 'buffer' ? 'utf8' : encoding;\n\n\t\tconst maxBuffer = opts.maxBuffer != null && opts.maxBuffer > 0 ? opts.maxBuffer : undefined;\n\t\tlet limitHit = false;\n\n\t\tfunction collector(buffers: Buffer[], name: 'stdout' | 'stderr'): (data: Buffer) => void {\n\t\t\tlet size = 0;\n\t\t\treturn (data: Buffer) => {\n\t\t\t\tif (limitHit) return;\n\n\t\t\t\tsize += data.length;\n\t\t\t\tif (maxBuffer != null && size > maxBuffer) {\n\t\t\t\t\texceedLimit(name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tbuffers.push(data);\n\t\t\t};\n\t\t}\n\n\t\tconst stdoutBuffers: Buffer[] = [];\n\t\tconst collectStdout = collector(stdoutBuffers, 'stdout');\n\t\tproc.stdout?.on('data', collectStdout);\n\n\t\tconst stderrBuffers: Buffer[] = [];\n\t\tconst collectStderr = collector(stderrBuffers, 'stderr');\n\t\tproc.stderr?.on('data', collectStderr);\n\n\t\t// Settles the run as soon as a stream passes the limit. Destroying the streams ends a spawner whose process\n\t\t// has no `kill`, and the late `'close'` or `'error'` is ignored through `limitHit`\n\t\tfunction exceedLimit(name: 'stdout' | 'stderr'): void {\n\t\t\tlimitHit = true;\n\t\t\tstdoutBuffers.length = 0;\n\t\t\tstderrBuffers.length = 0;\n\t\t\tproc.stdout?.off('data', collectStdout);\n\t\t\tproc.stderr?.off('data', collectStderr);\n\n\t\t\ttry {\n\t\t\t\tproc.kill?.();\n\t\t\t} catch {}\n\t\t\tproc.stdout?.destroy();\n\t\t\tproc.stderr?.destroy();\n\n\t\t\treject(\n\t\t\t\tnew RunError(\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: `Command output exceeded the allocated ${name} buffer. Set 'options.maxBuffer' to a larger value than ${maxBuffer} bytes`,\n\t\t\t\t\t\tcmd: `${command} ${args.join(' ')}`,\n\t\t\t\t\t\tkilled: true,\n\t\t\t\t\t\tcode: 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER',\n\t\t\t\t\t},\n\t\t\t\t\t'',\n\t\t\t\t\t'',\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tfunction getStdio<T>(\n\t\t\tencoding: BufferEncoding | 'buffer' | string,\n\t\t): { stdout: T; stderr: T } | Promise<{ stdout: T; stderr: T }> {\n\t\t\tconst stdout = Buffer.concat(stdoutBuffers);\n\t\t\tconst stderr = Buffer.concat(stderrBuffers);\n\t\t\tif (encoding === 'utf8' || encoding === 'binary') {\n\t\t\t\treturn { stdout: stdout.toString(encoding) as T, stderr: stderr.toString(encoding) as T };\n\t\t\t}\n\t\t\tif (encoding === 'buffer') {\n\t\t\t\treturn { stdout: stdout as T, stderr: stderr as T };\n\t\t\t}\n\n\t\t\tif (decode == null) {\n\t\t\t\tthrow new Error(`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`);\n\t\t\t}\n\n\t\t\treturn Promise.all([\n\t\t\t\tdecode(stdout, encoding ? { encoding: encoding } : undefined),\n\t\t\t\tdecode(stderr, encoding ? { encoding: encoding } : undefined),\n\t\t\t]).then(([decodedStdout, decodedStderr]) => ({\n\t\t\t\tstdout: decodedStdout as T,\n\t\t\t\tstderr: decodedStderr as T,\n\t\t\t}));\n\t\t}\n\n\t\t// An async listener's throw would be an unhandled rejection that leaves the promise pending forever, so\n\t\t// anything it throws (an undecodable output, a failing `decode`) rejects the run instead. It rejects as\n\t\t// thrown: wrapped in a `RunError` with the exit code, a clean exit would read as a run with no output\n\t\tconst rejectThrown = (ex: unknown): void => reject(ex instanceof Error ? ex : new Error(String(ex)));\n\t\tproc.once('error', ex => void onError(ex).catch(rejectThrown));\n\t\tproc.once('close', (code, signal) => void onClose(code, signal).catch(rejectThrown));\n\n\t\tasync function onError(ex: Error): Promise<void> {\n\t\t\tif (limitHit) return;\n\n\t\t\tif (ex?.name === 'AbortError') {\n\t\t\t\treject(new CancelledRunError(`${command} ${args.join(' ')}`, true, undefined, undefined, 'aborted'));\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The launch failure is what the caller acts on, so output that can't be decoded is left out of it\n\t\t\tlet stdout = '';\n\t\t\tlet stderr = '';\n\t\t\ttry {\n\t\t\t\tconst stdio = getStdio<string>(errorEncoding);\n\t\t\t\t({ stdout, stderr } = stdio instanceof Promise ? await stdio : stdio);\n\t\t\t} catch {}\n\n\t\t\treject(new RunError(ex, stdout, stderr));\n\t\t}\n\n\t\tasync function onClose(code: number | null, signal: NodeJS.Signals | null): Promise<void> {\n\t\t\tif (limitHit) return;\n\n\t\t\tif (options?.exitCodeOnly) {\n\t\t\t\t// Resolves unconditionally, so this is the one path that can hand back a signalled run. `code`\n\t\t\t\t// is null exactly when the process was killed — report the signal rather than coercing to `0`,\n\t\t\t\t// which would claim a clean success for a command that never finished. Note this returns BEFORE\n\t\t\t\t// the SIGTERM-to-cancellation diversion below, so callers have to classify that themselves.\n\t\t\t\tresolve({ exitCode: code ?? undefined, signal: signal ?? undefined, killed: proc.killed });\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (code !== 0 || signal) {\n\t\t\t\tconst stdio = getStdio<string>(errorEncoding);\n\t\t\t\tconst { stdout, stderr } = stdio instanceof Promise ? await stdio : stdio;\n\t\t\t\tconst loggedStderr =\n\t\t\t\t\t!options?.quiet && scope?.enabled('debug') ? withoutTrace2EventLines(stderr) : undefined;\n\t\t\t\tif (loggedStderr) {\n\t\t\t\t\tscope?.warn(`[EXEC] '${command} ${args.join(' ')}' \\u2022 ${loggedStderr}`);\n\t\t\t\t}\n\n\t\t\t\tif (signal === 'SIGTERM') {\n\t\t\t\t\t// Only Node's spawn `timeout` kills it (a caller abort rejected above, from `'error'`); an\n\t\t\t\t\t// external SIGTERM leaves `proc.killed` false\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew CancelledRunError(\n\t\t\t\t\t\t\t`${command} ${args.join(' ')}`,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tcode ?? undefined,\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tproc.killed ? 'timeout' : 'unknown',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\treject(\n\t\t\t\t\tnew RunError(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmessage: `Command failed with exit code ${code}`,\n\t\t\t\t\t\t\tcode: code,\n\t\t\t\t\t\t\tsignal: signal ?? undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstdout,\n\t\t\t\t\t\tstderr,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst stdio = getStdio<T>(encoding);\n\t\t\tconst { stdout, stderr } = stdio instanceof Promise ? await stdio : stdio;\n\t\t\tconst loggedStderr =\n\t\t\t\tstderr.length && !options?.quiet && scope?.enabled('debug')\n\t\t\t\t\t? withoutTrace2EventLines(typeof stderr === 'string' ? stderr : stderr.toString())\n\t\t\t\t\t: undefined;\n\t\t\tif (loggedStderr) {\n\t\t\t\tscope?.warn(`[EXEC] '${command} ${args.join(' ')}' \\u2022 ${loggedStderr}`);\n\t\t\t}\n\n\t\t\t// The guard above already rejected every non-zero and every signalled close, so this is a clean\n\t\t\t// zero exit — `code` cannot be null here. (The optional typing exists for the `exitCodeOnly`\n\t\t\t// branch, which is where a codeless result can genuinely surface.)\n\t\t\tresolve({ exitCode: code ?? undefined, signal: signal ?? undefined, stdout: stdout, stderr: stderr });\n\t\t}\n\n\t\t// Only a host spawner can leave these out; reading no output as empty would pass for a clean answer\n\t\tif (proc.stdout == null || proc.stderr == null) {\n\t\t\treject(new Error(`'${command}' was spawned without stdout and stderr pipes`));\n\t\t}\n\n\t\tif (stdin != null) {\n\t\t\tendStdin(proc.stdin, stdin, stdinEncoding);\n\t\t}\n\t});\n\n\treturn promise.finally(() => scope?.[Symbol.dispose]());\n}\n\nexport async function fsExists(path: string): Promise<boolean> {\n\treturn new Promise<boolean>(resolve => access(path, constants.F_OK, err => resolve(err == null)));\n}\n"],"mappings":";;;;;;;;AAuBA,IAAa,WAAb,cAA8B,MAAM;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA0B,QAAgB,QAAgB;EACrE,MAAM,QAAQ,OAAO;EAErB,KAAK,MAAM,QAAQ;EACnB,KAAK,SAAS,QAAQ;EACtB,KAAK,OAAO,QAAQ,QAAQ,KAAA;EAC5B,KAAK,SAAS,QAAQ;EACtB,KAAK,UAAU,QAAQ;EACvB,KAAK,SAAS,QAAQ,KAAK,KAAK;EAChC,KAAK,SAAS,QAAQ,KAAK,KAAK;EAEhC,KAAK,OAAO;EACZ,MAAM,oBAAoB,MAAM,UAAU;CAC3C;AACD;AAEA,IAAa,oBAAb,cAAuC,SAAS;CAC/C;CAEA,YACC,KACA,QACA,MACA,SAAyB,WACzB,SAA6B,WA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OAAO,aAAa;CAE3C,CAEa,CAAC,CAAC,cAAc,QAAQ,OAAO,QAAQ,CAAC,CAAC;AACvD;AAEA,eAAsB,SAAS,MAAgC;CAC9D,OAAO,IAAI,SAAiB,YAAW,OAAO,MAAM,UAAU,OAAM,QAAO,QAAQ,OAAO,IAAI,CAAC,CAAC;AACjG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export declare const isWindows: boolean;
|
|
3
3
|
export declare const isLinux: boolean;
|
|
4
4
|
export declare const isMac: boolean;
|
|
5
|
+
export declare function getAltKeySymbol(): string;
|
|
5
6
|
export declare function getShiftKeySymbol(): string;
|
|
6
7
|
//#endregion
|
|
7
8
|
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -3,10 +3,13 @@ import { platform } from "node:process";
|
|
|
3
3
|
const isWindows = platform === "win32";
|
|
4
4
|
const isLinux = platform === "linux";
|
|
5
5
|
const isMac = platform === "darwin";
|
|
6
|
+
function getAltKeySymbol() {
|
|
7
|
+
return isMac ? "⌥" : "Alt";
|
|
8
|
+
}
|
|
6
9
|
function getShiftKeySymbol() {
|
|
7
10
|
return isMac ? "⇧" : "Shift";
|
|
8
11
|
}
|
|
9
12
|
//#endregion
|
|
10
|
-
export { getShiftKeySymbol, isLinux, isMac, isWindows };
|
|
13
|
+
export { getAltKeySymbol, getShiftKeySymbol, isLinux, isMac, isWindows };
|
|
11
14
|
|
|
12
15
|
//# sourceMappingURL=platform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","names":[],"sources":["../../../../../utils/src/env/node/platform.ts"],"sourcesContent":["import { platform } from 'node:process';\n\nexport const isWindows: boolean = platform === 'win32';\nexport const isLinux: boolean = platform === 'linux';\nexport const isMac: boolean = platform === 'darwin';\n\nexport function getShiftKeySymbol(): string {\n\treturn isMac ? '⇧' : 'Shift';\n}\n"],"mappings":";;AAEA,MAAa,YAAqB,aAAa;AAC/C,MAAa,UAAmB,aAAa;AAC7C,MAAa,QAAiB,aAAa;AAE3C,SAAgB,oBAA4B;CAC3C,OAAO,QAAQ,MAAM;AACtB"}
|
|
1
|
+
{"version":3,"file":"platform.js","names":[],"sources":["../../../../../utils/src/env/node/platform.ts"],"sourcesContent":["import { platform } from 'node:process';\n\nexport const isWindows: boolean = platform === 'win32';\nexport const isLinux: boolean = platform === 'linux';\nexport const isMac: boolean = platform === 'darwin';\n\nexport function getAltKeySymbol(): string {\n\treturn isMac ? '⌥' : 'Alt';\n}\n\nexport function getShiftKeySymbol(): string {\n\treturn isMac ? '⇧' : 'Shift';\n}\n"],"mappings":";;AAEA,MAAa,YAAqB,aAAa;AAC/C,MAAa,UAAmB,aAAa;AAC7C,MAAa,QAAiB,aAAa;AAE3C,SAAgB,kBAA0B;CACzC,OAAO,QAAQ,MAAM;AACtB;AAEA,SAAgB,oBAA4B;CAC3C,OAAO,QAAQ,MAAM;AACtB"}
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getShiftKeySymbol, isLinux, isMac, isWindows } from "#env/platform.js";
|
|
2
|
-
export { getShiftKeySymbol, isLinux, isMac, isWindows };
|
|
1
|
+
import { getAltKeySymbol, getShiftKeySymbol, isLinux, isMac, isWindows } from "#env/platform.js";
|
|
2
|
+
export { getAltKeySymbol, getShiftKeySymbol, isLinux, isMac, isWindows };
|
package/dist/utils/platform.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getShiftKeySymbol, isLinux, isMac, isWindows } from "#env/platform.js";
|
|
2
|
-
export { getShiftKeySymbol, isLinux, isMac, isWindows };
|
|
1
|
+
import { getAltKeySymbol, getShiftKeySymbol, isLinux, isMac, isWindows } from "#env/platform.js";
|
|
2
|
+
export { getAltKeySymbol, getShiftKeySymbol, isLinux, isMac, isWindows };
|
package/docs/integrations.md
CHANGED
|
@@ -1247,6 +1247,31 @@ Core sends each mutation once. See [Linear's GraphQL API](https://linear.app/dev
|
|
|
1247
1247
|
[GraphQL schema](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/objects/Mutation)
|
|
1248
1248
|
and [delete and archive guidance](https://linear.app/docs/delete-archive-issues).
|
|
1249
1249
|
|
|
1250
|
+
### Asana task writes
|
|
1251
|
+
|
|
1252
|
+
Import the Asana methods and types from `@gitkraken/core-gitlens/plus/integrations/index.js`. All calls use the explicitly selected `connectionId` and its OAuth token. Reads accept an optional `expectedAccountId`. Every mutation requires the viewer GID from `getAsanaTaskWriteAccount` or a previous read. Successful calls return the authenticated `account` with its `id`, `name`, and `email`. Every Asana identifier is a GID string.
|
|
1253
|
+
|
|
1254
|
+
| Method | Input beyond the connection and account | Success |
|
|
1255
|
+
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
1256
|
+
| `getAsanaTaskWriteAccount` | None | The current Asana user. |
|
|
1257
|
+
| `getAsanaTaskCreateOptions` | Optional `workspaceId`, and optional `projectIds` within that workspace | Workspaces with their unarchived projects, or the pinned projects with their sections. |
|
|
1258
|
+
| `resolveAsanaTaskWriteTarget` | `task` as a GID or an `app.asana.com` task URL, and optional `workspaceId` and `projectId` | Current task, workspace, every membership, the pinned project's membership, and individual capabilities. |
|
|
1259
|
+
| `writeAsanaTask` with `action: 'create'` | `workspaceId`, `projectId`, nonblank `name`, optional `notes`, and optional `sectionId` of that project | Created task and its membership in the project. |
|
|
1260
|
+
| `writeAsanaTask` with `action: 'edit'` | `workspaceId`, `projectId`, `taskId`, optional current `sectionId`, and at least one of `name` or `notes` | Updated task. An omitted value is preserved. An empty `notes` clears the notes. |
|
|
1261
|
+
| `writeAsanaTask` with `action: 'complete'` or `'reopen'` | `workspaceId`, `projectId`, `taskId`, and optional current `sectionId` | Updated task with `completed: true` or `false`, respectively. |
|
|
1262
|
+
| `writeAsanaTask` with `action: 'move'` | `workspaceId`, `projectId`, `taskId`, current `sectionId` (or `null`), and `destinationSectionId` of the same project | Updated task with both `sourceSection` and `destinationSection`. |
|
|
1263
|
+
| `deleteAsanaTask` | `workspaceId`, `projectId`, `taskId`, resolved `sectionId`, `completed`, `modifiedAt`, and `membershipProjectIds` values, and `confirmed: true` | Pre-delete task, workspace, project, and membership with `deletion.trashed: true`. |
|
|
1264
|
+
|
|
1265
|
+
Task receipts include the GID `id`, `name`, `notes`, permalink `url`, `completed`, `modifiedAt`, `workspaceId`, every direct project membership in Asana's order with its nullable section, `inheritedProjects` with the projects a subtask belongs to only through an ancestor (absent when Asana's response omits `effective_memberships`), and the `assignee` with its `id`, nullable `name`, and nullable 60×60 `avatarUrl`. `assignee` is `null` for an unassigned task and absent when Asana's response omits it. Point reads accept task URLs in the `/0/<context>/<task>`, `/1/<workspace>/task/<task>`, and `/1/<workspace>/project/<project>/task/<task>` forms. The task GID is the identity; a URL's workspace or project must agree with explicit pins. The `/0/<context>/` segment can name a project, a tag, My Tasks, or a search, so Core ignores it and mutations rely on the explicit `projectId`. A read without a project works for a generic link and reports `project-required` for every action. [Asana task API](https://developers.asana.com/reference/tasks), [URL formats](https://forum.asana.com/t/upcoming-new-v1-asana-url-format-in-the-browser/1011489)
|
|
1266
|
+
|
|
1267
|
+
A task can belong to several projects. Every mutation requires exactly one direct membership in the pinned project, or returns `not-in-project`. A project the task only inherits from an ancestor has no section placement and cannot be pinned for any action, including editing and completion, so pin one of the task's direct projects. Editing and completion change the task in every project. A move changes only the section of the pinned project's membership. The destination section must belong to the pinned project, because adding a task to a section of another project would add the task to that project. Core never requests a membership change, but Asana has no conditional move: if the task is removed from the pinned project between Core's final read and the move, the move adds it back, and the receipt cannot tell that apart from a plain move. [Add task to section](https://developers.asana.com/reference/addtaskforsection), [create a task](https://developers.asana.com/reference/createtask)
|
|
1268
|
+
|
|
1269
|
+
Asana has no per-task permission read, so allowed actions are reported as `status: 'unknown'` and Asana decides on dispatch. The GitKraken Asana authorization requests `tasks:write` but not `tasks:delete`, which `DELETE /tasks/{gid}` requires. When the scopes the GitKraken backend reports for the connection omit `tasks:delete`, the delete capability is `insufficient-scope` and `deleteAsanaTask` refuses before dispatch. A 403 is reported as `insufficient-scope` only when Asana names the missing scope; otherwise it is `forbidden`. A 402 returns `payment-required` for premium-only features, and a 451 returns `legal-block`. [OAuth scopes](https://developers.asana.com/docs/oauth-scopes), [errors](https://developers.asana.com/docs/errors)
|
|
1270
|
+
|
|
1271
|
+
For deletion, resolve the exact target before presenting it for confirmation. Call `deleteAsanaTask` only after approval and carry the resolved viewer, workspace, project, task, and current section, plus the confirmed `completed` and `modifiedAt` values and the project GIDs of every confirmed membership, both direct and in `inheritedProjects`, because a deleted subtask also disappears from the projects it inherits. Asana does not update `modified_at` when a task joins or leaves a project, so Core refuses with `conflict` when the final read shows a different set of projects, and with `unknown` when a membership in it has no readable project or the read omits `effective_memberships`. Deletion moves the task to the deleting user's trash for 30 days and removes it from every project. [Delete a task](https://developers.asana.com/reference/deletetask)
|
|
1272
|
+
|
|
1273
|
+
Core revalidates the session, viewer, project, sections when needed, and finally the task and its membership before dispatch. Asana's write endpoints have no atomic precondition, so an external change can race the final read. A preflight refusal returns `mutationDispatched: false`. A definitive provider rejection returns a typed reason such as `forbidden`, `not-found`, `invalid-input` (with Asana's `messages`), or `rate-limit`. A lost or ambiguous mutation response returns `applied: 'maybe'`. A confirmed mutation whose session check or read-back fails returns `applied: 'yes'` with the `taskId` when known and no receipt; a read-back that does not show the requested change returns `conflict`. A success status with an empty, malformed, HTML, or other non-JSON body, or JSON whose `data` is not an object, proves nothing about Asana and returns `applied: 'maybe'`. Reconcile both outcomes using a read before attempting another write. Completion and moves reuse provider-apis' Asana client over Core's single-attempt request. The integration runtime's `http.fetch` must send `POST /tasks`, `PUT` and `DELETE /tasks/{gid}`, and `POST /sections/{gid}/addTask` in a single attempt.
|
|
1274
|
+
|
|
1250
1275
|
### Trello card writes
|
|
1251
1276
|
|
|
1252
1277
|
Import the Trello methods and types from `@gitkraken/core-gitlens/plus/integrations/index.js`. All calls use the explicitly selected `connectionId` and its paired Trello app key and token. Discovery and point reads accept an optional `expectedAccountId`. Every mutation requires the Trello member ID from discovery or the read path. Successful calls return the authenticated `account` with its `id`, `username`, and `name`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/core-gitlens",
|
|
3
3
|
"description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.70.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "GitKraken",
|