@acidicsoil/portable-capabilities 0.1.0 → 0.1.2

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/error.js", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/argument.js", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/help.js", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/option.js", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/suggestSimilar.js", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/command.js", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/index.js", "../packages/cli/src/program.ts", "../packages/compiler/src/diagnostics/diagnostic.ts", "../packages/schemas/src/output-schema.ts", "../packages/schemas/src/schema-registry.ts", "../packages/schemas/src/validate-document.ts", "../packages/compiler/src/output/normalize-file-set.ts", "../packages/compiler/src/output/write-file-set.ts", "../packages/compiler/src/policy/effects-policy.ts", "../packages/compiler/src/policy/exception-policy.ts", "../packages/compiler/src/provenance/digest.ts", "../packages/compiler/src/resolve/resolve-contract-library.ts", "../packages/compiler/src/resolve/resolve-system.ts", "../packages/contracts/src/compatibility.ts", "../packages/contracts/src/operational-contract.ts", "../packages/contracts/src/projection-plan.ts", "../packages/compiler/src/source/load-document.ts", "../node_modules/.pnpm/commander@14.0.0/node_modules/commander/esm.mjs", "../packages/cli/src/installation/lifecycle.ts", "../packages/cli/src/installation/manifest.ts", "../packages/cli/src/installation/preflight.ts", "../packages/cli/src/invocation/executor.ts", "../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/file-url.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/parameters.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/template.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/utils/uint-array.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/main-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/specific.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/utils/standard-stream.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/values.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/log.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/escape.js", "../node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js", "../node_modules/.pnpm/figures@6.1.0/node_modules/figures/index.js", "../node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/default.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/custom.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/start.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/info.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/return/duration.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/command.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/options.js", "../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js", "../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js", "../node_modules/.pnpm/unicorn-magic@0.3.0/node_modules/unicorn-magic/node.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/kill.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/return/final-error.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/signal.js", "../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/main.js", "../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/realtime.js", "../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/signals.js", "../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/core.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/utils/abort-signal.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/cancel.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/graceful.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/send.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/validation.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/utils/deferred.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/strict.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/utils/max-listeners.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/forward.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/incoming.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/reference.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/outgoing.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/graceful.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/timeout.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/node.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/ipc-input.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/encoding-option.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/command-file.js", "../node_modules/.pnpm/which-command@0.1.0/node_modules/which-command/index.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/cwd.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/shell.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/return/message.js", "../node_modules/.pnpm/strip-final-newline@4.0.0/node_modules/strip-final-newline/index.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/index.js", "../node_modules/.pnpm/is-stream@4.0.1/node_modules/is-stream/index.js", "../node_modules/.pnpm/@sec-ant+readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/contents.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/utils.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array-buffer.js", "../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/string.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/max-buffer.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/return/result.js", "../node_modules/.pnpm/parse-ms@4.0.0/node_modules/parse-ms/index.js", "../node_modules/.pnpm/pretty-ms@9.3.0/node_modules/pretty-ms/index.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/error.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/complete.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/return/reject.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/handle-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/type.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/object-mode.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/normalize.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/direction.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/array.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/stdio-option.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/native.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/arguments/fd-options.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/input-option.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/duplicate.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/handle.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/strip-newline.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/generator.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/split.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/validate.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/encoding-transform.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/run-async.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/transform/run-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/input-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/output-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/output.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/all-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/exit-async.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/exit-sync.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/main-async.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/methods.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/get-one.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/get-each.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/return/early-error.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/stdio/handle-async.js", "../node_modules/.pnpm/@sindresorhus+merge-streams@4.0.0/node_modules/@sindresorhus/merge-streams/index.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/pipeline.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/output-async.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/kill-descendants.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/terminate/cleanup.js", "../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/src/signals.ts", "../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/src/index.ts", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/concurrent.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/iterate.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/iterable.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/readable.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/shared.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/wait-stream.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/web.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/pipe/pipe-arguments.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/pipe/throw.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/pipe/sequence.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/pipe/streaming.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/pipe/abort.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/pipe/setup.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/io/contents.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/stdio.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/all-async.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/resolve/wait-subprocess.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/verbose/ipc.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/ipc/buffer-messages.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/writable.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/duplex.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/convert/add.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/promise.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/bind.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/create.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/lib/methods/script.js", "../node_modules/.pnpm/execa@10.0.0/node_modules/execa/index.js", "../packages/cli/src/invocation/resolve-entrypoint.ts", "../packages/renderer-core/src/instruction-sections.ts", "../packages/renderer-core/src/native-adapter.ts", "../packages/renderer-core/src/projection.ts", "../packages/cli/src/output/format.ts", "../packages/cli/src/release.ts", "../packages/adapters/antigravity/src/index.ts", "../packages/adapters/claude-code/src/index.ts", "../packages/adapters/codex/src/index.ts", "../packages/adapters/dcode/src/index.ts", "../packages/adapters/oh-my-pi/src/index.ts", "../packages/adapters/opencode/src/index.ts", "../packages/adapters/pi/src/index.ts", "../packages/adapters/reference/src/reference-adapter.ts", "../packages/cli/src/services/tracer.ts", "../packages/cli/src/entry.ts"],
4
+ "sourcesContent": ["/**\n * CommanderError class\n */\nclass CommanderError extends Error {\n /**\n * Constructs the CommanderError class\n * @param {number} exitCode suggested exit code which could be used with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n */\n constructor(exitCode, code, message) {\n super(message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n this.code = code;\n this.exitCode = exitCode;\n this.nestedError = undefined;\n }\n}\n\n/**\n * InvalidArgumentError class\n */\nclass InvalidArgumentError extends CommanderError {\n /**\n * Constructs the InvalidArgumentError class\n * @param {string} [message] explanation of why argument is invalid\n */\n constructor(message) {\n super(1, 'commander.invalidArgument', message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n }\n}\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\n", "const { InvalidArgumentError } = require('./error.js');\n\nclass Argument {\n /**\n * Initialize a new command argument with the given name and description.\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @param {string} name\n * @param {string} [description]\n */\n\n constructor(name, description) {\n this.description = description || '';\n this.variadic = false;\n this.parseArg = undefined;\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.argChoices = undefined;\n\n switch (name[0]) {\n case '<': // e.g. <required>\n this.required = true;\n this._name = name.slice(1, -1);\n break;\n case '[': // e.g. [optional]\n this.required = false;\n this._name = name.slice(1, -1);\n break;\n default:\n this.required = true;\n this._name = name;\n break;\n }\n\n if (this._name.length > 3 && this._name.slice(-3) === '...') {\n this.variadic = true;\n this._name = this._name.slice(0, -3);\n }\n }\n\n /**\n * Return argument name.\n *\n * @return {string}\n */\n\n name() {\n return this._name;\n }\n\n /**\n * @package\n */\n\n _concatValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n return previous.concat(value);\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Argument}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI command arguments into argument values.\n *\n * @param {Function} [fn]\n * @return {Argument}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Only allow argument value to be one of choices.\n *\n * @param {string[]} values\n * @return {Argument}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._concatValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Make argument required.\n *\n * @returns {Argument}\n */\n argRequired() {\n this.required = true;\n return this;\n }\n\n /**\n * Make argument optional.\n *\n * @returns {Argument}\n */\n argOptional() {\n this.required = false;\n return this;\n }\n}\n\n/**\n * Takes an argument and returns its human readable equivalent for help usage.\n *\n * @param {Argument} arg\n * @return {string}\n * @private\n */\n\nfunction humanReadableArgName(arg) {\n const nameOutput = arg.name() + (arg.variadic === true ? '...' : '');\n\n return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';\n}\n\nexports.Argument = Argument;\nexports.humanReadableArgName = humanReadableArgName;\n", "const { humanReadableArgName } = require('./argument.js');\n\n/**\n * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`\n * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types\n * @typedef { import(\"./argument.js\").Argument } Argument\n * @typedef { import(\"./command.js\").Command } Command\n * @typedef { import(\"./option.js\").Option } Option\n */\n\n// Although this is a class, methods are static in style to allow override using subclass or just functions.\nclass Help {\n constructor() {\n this.helpWidth = undefined;\n this.minWidthToWrap = 40;\n this.sortSubcommands = false;\n this.sortOptions = false;\n this.showGlobalOptions = false;\n }\n\n /**\n * prepareContext is called by Commander after applying overrides from `Command.configureHelp()`\n * and just before calling `formatHelp()`.\n *\n * Commander just uses the helpWidth and the rest is provided for optional use by more complex subclasses.\n *\n * @param {{ error?: boolean, helpWidth?: number, outputHasColors?: boolean }} contextOptions\n */\n prepareContext(contextOptions) {\n this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;\n }\n\n /**\n * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.\n *\n * @param {Command} cmd\n * @returns {Command[]}\n */\n\n visibleCommands(cmd) {\n const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);\n const helpCommand = cmd._getHelpCommand();\n if (helpCommand && !helpCommand._hidden) {\n visibleCommands.push(helpCommand);\n }\n if (this.sortSubcommands) {\n visibleCommands.sort((a, b) => {\n // @ts-ignore: because overloaded return type\n return a.name().localeCompare(b.name());\n });\n }\n return visibleCommands;\n }\n\n /**\n * Compare options for sort.\n *\n * @param {Option} a\n * @param {Option} b\n * @returns {number}\n */\n compareOptions(a, b) {\n const getSortKey = (option) => {\n // WYSIWYG for order displayed in help. Short used for comparison if present. No special handling for negated.\n return option.short\n ? option.short.replace(/^-/, '')\n : option.long.replace(/^--/, '');\n };\n return getSortKey(a).localeCompare(getSortKey(b));\n }\n\n /**\n * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleOptions(cmd) {\n const visibleOptions = cmd.options.filter((option) => !option.hidden);\n // Built-in help option.\n const helpOption = cmd._getHelpOption();\n if (helpOption && !helpOption.hidden) {\n // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs.\n const removeShort = helpOption.short && cmd._findOption(helpOption.short);\n const removeLong = helpOption.long && cmd._findOption(helpOption.long);\n if (!removeShort && !removeLong) {\n visibleOptions.push(helpOption); // no changes needed\n } else if (helpOption.long && !removeLong) {\n visibleOptions.push(\n cmd.createOption(helpOption.long, helpOption.description),\n );\n } else if (helpOption.short && !removeShort) {\n visibleOptions.push(\n cmd.createOption(helpOption.short, helpOption.description),\n );\n }\n }\n if (this.sortOptions) {\n visibleOptions.sort(this.compareOptions);\n }\n return visibleOptions;\n }\n\n /**\n * Get an array of the visible global options. (Not including help.)\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleGlobalOptions(cmd) {\n if (!this.showGlobalOptions) return [];\n\n const globalOptions = [];\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n const visibleOptions = ancestorCmd.options.filter(\n (option) => !option.hidden,\n );\n globalOptions.push(...visibleOptions);\n }\n if (this.sortOptions) {\n globalOptions.sort(this.compareOptions);\n }\n return globalOptions;\n }\n\n /**\n * Get an array of the arguments if any have a description.\n *\n * @param {Command} cmd\n * @returns {Argument[]}\n */\n\n visibleArguments(cmd) {\n // Side effect! Apply the legacy descriptions before the arguments are displayed.\n if (cmd._argsDescription) {\n cmd.registeredArguments.forEach((argument) => {\n argument.description =\n argument.description || cmd._argsDescription[argument.name()] || '';\n });\n }\n\n // If there are any arguments with a description then return all the arguments.\n if (cmd.registeredArguments.find((argument) => argument.description)) {\n return cmd.registeredArguments;\n }\n return [];\n }\n\n /**\n * Get the command term to show in the list of subcommands.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandTerm(cmd) {\n // Legacy. Ignores custom usage string, and nested commands.\n const args = cmd.registeredArguments\n .map((arg) => humanReadableArgName(arg))\n .join(' ');\n return (\n cmd._name +\n (cmd._aliases[0] ? '|' + cmd._aliases[0] : '') +\n (cmd.options.length ? ' [options]' : '') + // simplistic check for non-help option\n (args ? ' ' + args : '')\n );\n }\n\n /**\n * Get the option term to show in the list of options.\n *\n * @param {Option} option\n * @returns {string}\n */\n\n optionTerm(option) {\n return option.flags;\n }\n\n /**\n * Get the argument term to show in the list of arguments.\n *\n * @param {Argument} argument\n * @returns {string}\n */\n\n argumentTerm(argument) {\n return argument.name();\n }\n\n /**\n * Get the longest command term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestSubcommandTermLength(cmd, helper) {\n return helper.visibleCommands(cmd).reduce((max, command) => {\n return Math.max(\n max,\n this.displayWidth(\n helper.styleSubcommandTerm(helper.subcommandTerm(command)),\n ),\n );\n }, 0);\n }\n\n /**\n * Get the longest option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestOptionTermLength(cmd, helper) {\n return helper.visibleOptions(cmd).reduce((max, option) => {\n return Math.max(\n max,\n this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),\n );\n }, 0);\n }\n\n /**\n * Get the longest global option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestGlobalOptionTermLength(cmd, helper) {\n return helper.visibleGlobalOptions(cmd).reduce((max, option) => {\n return Math.max(\n max,\n this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),\n );\n }, 0);\n }\n\n /**\n * Get the longest argument term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestArgumentTermLength(cmd, helper) {\n return helper.visibleArguments(cmd).reduce((max, argument) => {\n return Math.max(\n max,\n this.displayWidth(\n helper.styleArgumentTerm(helper.argumentTerm(argument)),\n ),\n );\n }, 0);\n }\n\n /**\n * Get the command usage to be displayed at the top of the built-in help.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandUsage(cmd) {\n // Usage\n let cmdName = cmd._name;\n if (cmd._aliases[0]) {\n cmdName = cmdName + '|' + cmd._aliases[0];\n }\n let ancestorCmdNames = '';\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames;\n }\n return ancestorCmdNames + cmdName + ' ' + cmd.usage();\n }\n\n /**\n * Get the description for the command.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.description();\n }\n\n /**\n * Get the subcommand summary to show in the list of subcommands.\n * (Fallback to description for backwards compatibility.)\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.summary() || cmd.description();\n }\n\n /**\n * Get the option description to show in the list of options.\n *\n * @param {Option} option\n * @return {string}\n */\n\n optionDescription(option) {\n const extraInfo = [];\n\n if (option.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (option.defaultValue !== undefined) {\n // default for boolean and negated more for programmer than end user,\n // but show true/false for boolean option as may be for hand-rolled env or config processing.\n const showDefault =\n option.required ||\n option.optional ||\n (option.isBoolean() && typeof option.defaultValue === 'boolean');\n if (showDefault) {\n extraInfo.push(\n `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`,\n );\n }\n }\n // preset for boolean and negated are more for programmer than end user\n if (option.presetArg !== undefined && option.optional) {\n extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);\n }\n if (option.envVar !== undefined) {\n extraInfo.push(`env: ${option.envVar}`);\n }\n if (extraInfo.length > 0) {\n const extraDescription = `(${extraInfo.join(', ')})`;\n if (option.description) {\n return `${option.description} ${extraDescription}`;\n }\n return extraDescription;\n }\n\n return option.description;\n }\n\n /**\n * Get the argument description to show in the list of arguments.\n *\n * @param {Argument} argument\n * @return {string}\n */\n\n argumentDescription(argument) {\n const extraInfo = [];\n if (argument.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (argument.defaultValue !== undefined) {\n extraInfo.push(\n `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`,\n );\n }\n if (extraInfo.length > 0) {\n const extraDescription = `(${extraInfo.join(', ')})`;\n if (argument.description) {\n return `${argument.description} ${extraDescription}`;\n }\n return extraDescription;\n }\n return argument.description;\n }\n\n /**\n * Format a list of items, given a heading and an array of formatted items.\n *\n * @param {string} heading\n * @param {string[]} items\n * @param {Help} helper\n * @returns string[]\n */\n formatItemList(heading, items, helper) {\n if (items.length === 0) return [];\n\n return [helper.styleTitle(heading), ...items, ''];\n }\n\n /**\n * Group items by their help group heading.\n *\n * @param {Command[] | Option[]} unsortedItems\n * @param {Command[] | Option[]} visibleItems\n * @param {Function} getGroup\n * @returns {Map<string, Command[] | Option[]>}\n */\n groupItems(unsortedItems, visibleItems, getGroup) {\n const result = new Map();\n // Add groups in order of appearance in unsortedItems.\n unsortedItems.forEach((item) => {\n const group = getGroup(item);\n if (!result.has(group)) result.set(group, []);\n });\n // Add items in order of appearance in visibleItems.\n visibleItems.forEach((item) => {\n const group = getGroup(item);\n if (!result.has(group)) {\n result.set(group, []);\n }\n result.get(group).push(item);\n });\n return result;\n }\n\n /**\n * Generate the built-in help text.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {string}\n */\n\n formatHelp(cmd, helper) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth ?? 80; // in case prepareContext() was not called\n\n function callFormatItem(term, description) {\n return helper.formatItem(term, termWidth, description, helper);\n }\n\n // Usage\n let output = [\n `${helper.styleTitle('Usage:')} ${helper.styleUsage(helper.commandUsage(cmd))}`,\n '',\n ];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(\n helper.styleCommandDescription(commandDescription),\n helpWidth,\n ),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument) => {\n return callFormatItem(\n helper.styleArgumentTerm(helper.argumentTerm(argument)),\n helper.styleArgumentDescription(helper.argumentDescription(argument)),\n );\n });\n output = output.concat(\n this.formatItemList('Arguments:', argumentList, helper),\n );\n\n // Options\n const optionGroups = this.groupItems(\n cmd.options,\n helper.visibleOptions(cmd),\n (option) => option.helpGroupHeading ?? 'Options:',\n );\n optionGroups.forEach((options, group) => {\n const optionList = options.map((option) => {\n return callFormatItem(\n helper.styleOptionTerm(helper.optionTerm(option)),\n helper.styleOptionDescription(helper.optionDescription(option)),\n );\n });\n output = output.concat(this.formatItemList(group, optionList, helper));\n });\n\n if (helper.showGlobalOptions) {\n const globalOptionList = helper\n .visibleGlobalOptions(cmd)\n .map((option) => {\n return callFormatItem(\n helper.styleOptionTerm(helper.optionTerm(option)),\n helper.styleOptionDescription(helper.optionDescription(option)),\n );\n });\n output = output.concat(\n this.formatItemList('Global Options:', globalOptionList, helper),\n );\n }\n\n // Commands\n const commandGroups = this.groupItems(\n cmd.commands,\n helper.visibleCommands(cmd),\n (sub) => sub.helpGroup() || 'Commands:',\n );\n commandGroups.forEach((commands, group) => {\n const commandList = commands.map((sub) => {\n return callFormatItem(\n helper.styleSubcommandTerm(helper.subcommandTerm(sub)),\n helper.styleSubcommandDescription(helper.subcommandDescription(sub)),\n );\n });\n output = output.concat(this.formatItemList(group, commandList, helper));\n });\n\n return output.join('\\n');\n }\n\n /**\n * Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations.\n *\n * @param {string} str\n * @returns {number}\n */\n displayWidth(str) {\n return stripColor(str).length;\n }\n\n /**\n * Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.\n *\n * @param {string} str\n * @returns {string}\n */\n styleTitle(str) {\n return str;\n }\n\n styleUsage(str) {\n // Usage has lots of parts the user might like to color separately! Assume default usage string which is formed like:\n // command subcommand [options] [command] <foo> [bar]\n return str\n .split(' ')\n .map((word) => {\n if (word === '[options]') return this.styleOptionText(word);\n if (word === '[command]') return this.styleSubcommandText(word);\n if (word[0] === '[' || word[0] === '<')\n return this.styleArgumentText(word);\n return this.styleCommandText(word); // Restrict to initial words?\n })\n .join(' ');\n }\n styleCommandDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleOptionDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleSubcommandDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleArgumentDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleDescriptionText(str) {\n return str;\n }\n styleOptionTerm(str) {\n return this.styleOptionText(str);\n }\n styleSubcommandTerm(str) {\n // This is very like usage with lots of parts! Assume default string which is formed like:\n // subcommand [options] <foo> [bar]\n return str\n .split(' ')\n .map((word) => {\n if (word === '[options]') return this.styleOptionText(word);\n if (word[0] === '[' || word[0] === '<')\n return this.styleArgumentText(word);\n return this.styleSubcommandText(word); // Restrict to initial words?\n })\n .join(' ');\n }\n styleArgumentTerm(str) {\n return this.styleArgumentText(str);\n }\n styleOptionText(str) {\n return str;\n }\n styleArgumentText(str) {\n return str;\n }\n styleSubcommandText(str) {\n return str;\n }\n styleCommandText(str) {\n return str;\n }\n\n /**\n * Calculate the pad width from the maximum term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n padWidth(cmd, helper) {\n return Math.max(\n helper.longestOptionTermLength(cmd, helper),\n helper.longestGlobalOptionTermLength(cmd, helper),\n helper.longestSubcommandTermLength(cmd, helper),\n helper.longestArgumentTermLength(cmd, helper),\n );\n }\n\n /**\n * Detect manually wrapped and indented strings by checking for line break followed by whitespace.\n *\n * @param {string} str\n * @returns {boolean}\n */\n preformatted(str) {\n return /\\n[^\\S\\r\\n]/.test(str);\n }\n\n /**\n * Format the \"item\", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.\n *\n * So \"TTT\", 5, \"DDD DDDD DD DDD\" might be formatted for this.helpWidth=17 like so:\n * TTT DDD DDDD\n * DD DDD\n *\n * @param {string} term\n * @param {number} termWidth\n * @param {string} description\n * @param {Help} helper\n * @returns {string}\n */\n formatItem(term, termWidth, description, helper) {\n const itemIndent = 2;\n const itemIndentStr = ' '.repeat(itemIndent);\n if (!description) return itemIndentStr + term;\n\n // Pad the term out to a consistent width, so descriptions are aligned.\n const paddedTerm = term.padEnd(\n termWidth + term.length - helper.displayWidth(term),\n );\n\n // Format the description.\n const spacerWidth = 2; // between term and description\n const helpWidth = this.helpWidth ?? 80; // in case prepareContext() was not called\n const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;\n let formattedDescription;\n if (\n remainingWidth < this.minWidthToWrap ||\n helper.preformatted(description)\n ) {\n formattedDescription = description;\n } else {\n const wrappedDescription = helper.boxWrap(description, remainingWidth);\n formattedDescription = wrappedDescription.replace(\n /\\n/g,\n '\\n' + ' '.repeat(termWidth + spacerWidth),\n );\n }\n\n // Construct and overall indent.\n return (\n itemIndentStr +\n paddedTerm +\n ' '.repeat(spacerWidth) +\n formattedDescription.replace(/\\n/g, `\\n${itemIndentStr}`)\n );\n }\n\n /**\n * Wrap a string at whitespace, preserving existing line breaks.\n * Wrapping is skipped if the width is less than `minWidthToWrap`.\n *\n * @param {string} str\n * @param {number} width\n * @returns {string}\n */\n boxWrap(str, width) {\n if (width < this.minWidthToWrap) return str;\n\n const rawLines = str.split(/\\r\\n|\\n/);\n // split up text by whitespace\n const chunkPattern = /[\\s]*[^\\s]+/g;\n const wrappedLines = [];\n rawLines.forEach((line) => {\n const chunks = line.match(chunkPattern);\n if (chunks === null) {\n wrappedLines.push('');\n return;\n }\n\n let sumChunks = [chunks.shift()];\n let sumWidth = this.displayWidth(sumChunks[0]);\n chunks.forEach((chunk) => {\n const visibleWidth = this.displayWidth(chunk);\n // Accumulate chunks while they fit into width.\n if (sumWidth + visibleWidth <= width) {\n sumChunks.push(chunk);\n sumWidth += visibleWidth;\n return;\n }\n wrappedLines.push(sumChunks.join(''));\n\n const nextChunk = chunk.trimStart(); // trim space at line break\n sumChunks = [nextChunk];\n sumWidth = this.displayWidth(nextChunk);\n });\n wrappedLines.push(sumChunks.join(''));\n });\n\n return wrappedLines.join('\\n');\n }\n}\n\n/**\n * Strip style ANSI escape sequences from the string. In particular, SGR (Select Graphic Rendition) codes.\n *\n * @param {string} str\n * @returns {string}\n * @package\n */\n\nfunction stripColor(str) {\n // eslint-disable-next-line no-control-regex\n const sgrPattern = /\\x1b\\[\\d*(;\\d*)*m/g;\n return str.replace(sgrPattern, '');\n}\n\nexports.Help = Help;\nexports.stripColor = stripColor;\n", "const { InvalidArgumentError } = require('./error.js');\n\nclass Option {\n /**\n * Initialize a new `Option` with the given `flags` and `description`.\n *\n * @param {string} flags\n * @param {string} [description]\n */\n\n constructor(flags, description) {\n this.flags = flags;\n this.description = description || '';\n\n this.required = flags.includes('<'); // A value must be supplied when the option is specified.\n this.optional = flags.includes('['); // A value is optional when the option is specified.\n // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument\n this.variadic = /\\w\\.\\.\\.[>\\]]$/.test(flags); // The option can take multiple values.\n this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.\n const optionFlags = splitOptionFlags(flags);\n this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).\n this.long = optionFlags.longFlag;\n this.negate = false;\n if (this.long) {\n this.negate = this.long.startsWith('--no-');\n }\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.presetArg = undefined;\n this.envVar = undefined;\n this.parseArg = undefined;\n this.hidden = false;\n this.argChoices = undefined;\n this.conflictsWith = [];\n this.implied = undefined;\n this.helpGroupHeading = undefined; // soft initialised when option added to command\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Option}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Preset to use when option used without option-argument, especially optional but also boolean and negated.\n * The custom processing (parseArg) is called.\n *\n * @example\n * new Option('--color').default('GREYSCALE').preset('RGB');\n * new Option('--donate [amount]').preset('20').argParser(parseFloat);\n *\n * @param {*} arg\n * @return {Option}\n */\n\n preset(arg) {\n this.presetArg = arg;\n return this;\n }\n\n /**\n * Add option name(s) that conflict with this option.\n * An error will be displayed if conflicting options are found during parsing.\n *\n * @example\n * new Option('--rgb').conflicts('cmyk');\n * new Option('--js').conflicts(['ts', 'jsx']);\n *\n * @param {(string | string[])} names\n * @return {Option}\n */\n\n conflicts(names) {\n this.conflictsWith = this.conflictsWith.concat(names);\n return this;\n }\n\n /**\n * Specify implied option values for when this option is set and the implied options are not.\n *\n * The custom processing (parseArg) is not called on the implied values.\n *\n * @example\n * program\n * .addOption(new Option('--log', 'write logging information to file'))\n * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));\n *\n * @param {object} impliedOptionValues\n * @return {Option}\n */\n implies(impliedOptionValues) {\n let newImplied = impliedOptionValues;\n if (typeof impliedOptionValues === 'string') {\n // string is not documented, but easy mistake and we can do what user probably intended.\n newImplied = { [impliedOptionValues]: true };\n }\n this.implied = Object.assign(this.implied || {}, newImplied);\n return this;\n }\n\n /**\n * Set environment variable to check for option value.\n *\n * An environment variable is only used if when processed the current option value is\n * undefined, or the source of the current value is 'default' or 'config' or 'env'.\n *\n * @param {string} name\n * @return {Option}\n */\n\n env(name) {\n this.envVar = name;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI option arguments into option values.\n *\n * @param {Function} [fn]\n * @return {Option}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Whether the option is mandatory and must have a value after parsing.\n *\n * @param {boolean} [mandatory=true]\n * @return {Option}\n */\n\n makeOptionMandatory(mandatory = true) {\n this.mandatory = !!mandatory;\n return this;\n }\n\n /**\n * Hide option in help.\n *\n * @param {boolean} [hide=true]\n * @return {Option}\n */\n\n hideHelp(hide = true) {\n this.hidden = !!hide;\n return this;\n }\n\n /**\n * @package\n */\n\n _concatValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n return previous.concat(value);\n }\n\n /**\n * Only allow option value to be one of choices.\n *\n * @param {string[]} values\n * @return {Option}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._concatValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Return option name.\n *\n * @return {string}\n */\n\n name() {\n if (this.long) {\n return this.long.replace(/^--/, '');\n }\n return this.short.replace(/^-/, '');\n }\n\n /**\n * Return option name, in a camelcase format that can be used\n * as an object attribute key.\n *\n * @return {string}\n */\n\n attributeName() {\n if (this.negate) {\n return camelcase(this.name().replace(/^no-/, ''));\n }\n return camelcase(this.name());\n }\n\n /**\n * Set the help group heading.\n *\n * @param {string} heading\n * @return {Option}\n */\n helpGroup(heading) {\n this.helpGroupHeading = heading;\n return this;\n }\n\n /**\n * Check if `arg` matches the short or long flag.\n *\n * @param {string} arg\n * @return {boolean}\n * @package\n */\n\n is(arg) {\n return this.short === arg || this.long === arg;\n }\n\n /**\n * Return whether a boolean option.\n *\n * Options are one of boolean, negated, required argument, or optional argument.\n *\n * @return {boolean}\n * @package\n */\n\n isBoolean() {\n return !this.required && !this.optional && !this.negate;\n }\n}\n\n/**\n * This class is to make it easier to work with dual options, without changing the existing\n * implementation. We support separate dual options for separate positive and negative options,\n * like `--build` and `--no-build`, which share a single option value. This works nicely for some\n * use cases, but is tricky for others where we want separate behaviours despite\n * the single shared option value.\n */\nclass DualOptions {\n /**\n * @param {Option[]} options\n */\n constructor(options) {\n this.positiveOptions = new Map();\n this.negativeOptions = new Map();\n this.dualOptions = new Set();\n options.forEach((option) => {\n if (option.negate) {\n this.negativeOptions.set(option.attributeName(), option);\n } else {\n this.positiveOptions.set(option.attributeName(), option);\n }\n });\n this.negativeOptions.forEach((value, key) => {\n if (this.positiveOptions.has(key)) {\n this.dualOptions.add(key);\n }\n });\n }\n\n /**\n * Did the value come from the option, and not from possible matching dual option?\n *\n * @param {*} value\n * @param {Option} option\n * @returns {boolean}\n */\n valueFromOption(value, option) {\n const optionKey = option.attributeName();\n if (!this.dualOptions.has(optionKey)) return true;\n\n // Use the value to deduce if (probably) came from the option.\n const preset = this.negativeOptions.get(optionKey).presetArg;\n const negativeValue = preset !== undefined ? preset : false;\n return option.negate === (negativeValue === value);\n }\n}\n\n/**\n * Convert string from kebab-case to camelCase.\n *\n * @param {string} str\n * @return {string}\n * @private\n */\n\nfunction camelcase(str) {\n return str.split('-').reduce((str, word) => {\n return str + word[0].toUpperCase() + word.slice(1);\n });\n}\n\n/**\n * Split the short and long flag out of something like '-m,--mixed <value>'\n *\n * @private\n */\n\nfunction splitOptionFlags(flags) {\n let shortFlag;\n let longFlag;\n // short flag, single dash and single character\n const shortFlagExp = /^-[^-]$/;\n // long flag, double dash and at least one character\n const longFlagExp = /^--[^-]/;\n\n const flagParts = flags.split(/[ |,]+/).concat('guard');\n // Normal is short and/or long.\n if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();\n if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();\n // Long then short. Rarely used but fine.\n if (!shortFlag && shortFlagExp.test(flagParts[0]))\n shortFlag = flagParts.shift();\n // Allow two long flags, like '--ws, --workspace'\n // This is the supported way to have a shortish option flag.\n if (!shortFlag && longFlagExp.test(flagParts[0])) {\n shortFlag = longFlag;\n longFlag = flagParts.shift();\n }\n\n // Check for unprocessed flag. Fail noisily rather than silently ignore.\n if (flagParts[0].startsWith('-')) {\n const unsupportedFlag = flagParts[0];\n const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;\n if (/^-[^-][^-]/.test(unsupportedFlag))\n throw new Error(\n `${baseError}\n- a short flag is a single dash and a single character\n - either use a single dash and a single character (for a short flag)\n - or use a double dash for a long option (and can have two, like '--ws, --workspace')`,\n );\n if (shortFlagExp.test(unsupportedFlag))\n throw new Error(`${baseError}\n- too many short flags`);\n if (longFlagExp.test(unsupportedFlag))\n throw new Error(`${baseError}\n- too many long flags`);\n\n throw new Error(`${baseError}\n- unrecognised flag format`);\n }\n if (shortFlag === undefined && longFlag === undefined)\n throw new Error(\n `option creation failed due to no flags found in '${flags}'.`,\n );\n\n return { shortFlag, longFlag };\n}\n\nexports.Option = Option;\nexports.DualOptions = DualOptions;\n", "const maxDistance = 3;\n\nfunction editDistance(a, b) {\n // https://en.wikipedia.org/wiki/Damerau\u2013Levenshtein_distance\n // Calculating optimal string alignment distance, no substring is edited more than once.\n // (Simple implementation.)\n\n // Quick early exit, return worst case.\n if (Math.abs(a.length - b.length) > maxDistance)\n return Math.max(a.length, b.length);\n\n // distance between prefix substrings of a and b\n const d = [];\n\n // pure deletions turn a into empty string\n for (let i = 0; i <= a.length; i++) {\n d[i] = [i];\n }\n // pure insertions turn empty string into b\n for (let j = 0; j <= b.length; j++) {\n d[0][j] = j;\n }\n\n // fill matrix\n for (let j = 1; j <= b.length; j++) {\n for (let i = 1; i <= a.length; i++) {\n let cost = 1;\n if (a[i - 1] === b[j - 1]) {\n cost = 0;\n } else {\n cost = 1;\n }\n d[i][j] = Math.min(\n d[i - 1][j] + 1, // deletion\n d[i][j - 1] + 1, // insertion\n d[i - 1][j - 1] + cost, // substitution\n );\n // transposition\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);\n }\n }\n }\n\n return d[a.length][b.length];\n}\n\n/**\n * Find close matches, restricted to same number of edits.\n *\n * @param {string} word\n * @param {string[]} candidates\n * @returns {string}\n */\n\nfunction suggestSimilar(word, candidates) {\n if (!candidates || candidates.length === 0) return '';\n // remove possible duplicates\n candidates = Array.from(new Set(candidates));\n\n const searchingOptions = word.startsWith('--');\n if (searchingOptions) {\n word = word.slice(2);\n candidates = candidates.map((candidate) => candidate.slice(2));\n }\n\n let similar = [];\n let bestDistance = maxDistance;\n const minSimilarity = 0.4;\n candidates.forEach((candidate) => {\n if (candidate.length <= 1) return; // no one character guesses\n\n const distance = editDistance(word, candidate);\n const length = Math.max(word.length, candidate.length);\n const similarity = (length - distance) / length;\n if (similarity > minSimilarity) {\n if (distance < bestDistance) {\n // better edit distance, throw away previous worse matches\n bestDistance = distance;\n similar = [candidate];\n } else if (distance === bestDistance) {\n similar.push(candidate);\n }\n }\n });\n\n similar.sort((a, b) => a.localeCompare(b));\n if (searchingOptions) {\n similar = similar.map((candidate) => `--${candidate}`);\n }\n\n if (similar.length > 1) {\n return `\\n(Did you mean one of ${similar.join(', ')}?)`;\n }\n if (similar.length === 1) {\n return `\\n(Did you mean ${similar[0]}?)`;\n }\n return '';\n}\n\nexports.suggestSimilar = suggestSimilar;\n", "const EventEmitter = require('node:events').EventEmitter;\nconst childProcess = require('node:child_process');\nconst path = require('node:path');\nconst fs = require('node:fs');\nconst process = require('node:process');\n\nconst { Argument, humanReadableArgName } = require('./argument.js');\nconst { CommanderError } = require('./error.js');\nconst { Help, stripColor } = require('./help.js');\nconst { Option, DualOptions } = require('./option.js');\nconst { suggestSimilar } = require('./suggestSimilar');\n\nclass Command extends EventEmitter {\n /**\n * Initialize a new `Command`.\n *\n * @param {string} [name]\n */\n\n constructor(name) {\n super();\n /** @type {Command[]} */\n this.commands = [];\n /** @type {Option[]} */\n this.options = [];\n this.parent = null;\n this._allowUnknownOption = false;\n this._allowExcessArguments = false;\n /** @type {Argument[]} */\n this.registeredArguments = [];\n this._args = this.registeredArguments; // deprecated old name\n /** @type {string[]} */\n this.args = []; // cli args with options removed\n this.rawArgs = [];\n this.processedArgs = []; // like .args but after custom processing and collecting variadic\n this._scriptPath = null;\n this._name = name || '';\n this._optionValues = {};\n this._optionValueSources = {}; // default, env, cli etc\n this._storeOptionsAsProperties = false;\n this._actionHandler = null;\n this._executableHandler = false;\n this._executableFile = null; // custom name for executable\n this._executableDir = null; // custom search directory for subcommands\n this._defaultCommandName = null;\n this._exitCallback = null;\n this._aliases = [];\n this._combineFlagAndOptionalValue = true;\n this._description = '';\n this._summary = '';\n this._argsDescription = undefined; // legacy\n this._enablePositionalOptions = false;\n this._passThroughOptions = false;\n this._lifeCycleHooks = {}; // a hash of arrays\n /** @type {(boolean | string)} */\n this._showHelpAfterError = false;\n this._showSuggestionAfterError = true;\n this._savedState = null; // used in save/restoreStateBeforeParse\n\n // see configureOutput() for docs\n this._outputConfiguration = {\n writeOut: (str) => process.stdout.write(str),\n writeErr: (str) => process.stderr.write(str),\n outputError: (str, write) => write(str),\n getOutHelpWidth: () =>\n process.stdout.isTTY ? process.stdout.columns : undefined,\n getErrHelpWidth: () =>\n process.stderr.isTTY ? process.stderr.columns : undefined,\n getOutHasColors: () =>\n useColor() ?? (process.stdout.isTTY && process.stdout.hasColors?.()),\n getErrHasColors: () =>\n useColor() ?? (process.stderr.isTTY && process.stderr.hasColors?.()),\n stripColor: (str) => stripColor(str),\n };\n\n this._hidden = false;\n /** @type {(Option | null | undefined)} */\n this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled.\n this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited\n /** @type {Command} */\n this._helpCommand = undefined; // lazy initialised, inherited\n this._helpConfiguration = {};\n /** @type {string | undefined} */\n this._helpGroupHeading = undefined; // soft initialised when added to parent\n /** @type {string | undefined} */\n this._defaultCommandGroup = undefined;\n /** @type {string | undefined} */\n this._defaultOptionGroup = undefined;\n }\n\n /**\n * Copy settings that are useful to have in common across root command and subcommands.\n *\n * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)\n *\n * @param {Command} sourceCommand\n * @return {Command} `this` command for chaining\n */\n copyInheritedSettings(sourceCommand) {\n this._outputConfiguration = sourceCommand._outputConfiguration;\n this._helpOption = sourceCommand._helpOption;\n this._helpCommand = sourceCommand._helpCommand;\n this._helpConfiguration = sourceCommand._helpConfiguration;\n this._exitCallback = sourceCommand._exitCallback;\n this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;\n this._combineFlagAndOptionalValue =\n sourceCommand._combineFlagAndOptionalValue;\n this._allowExcessArguments = sourceCommand._allowExcessArguments;\n this._enablePositionalOptions = sourceCommand._enablePositionalOptions;\n this._showHelpAfterError = sourceCommand._showHelpAfterError;\n this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;\n\n return this;\n }\n\n /**\n * @returns {Command[]}\n * @private\n */\n\n _getCommandAndAncestors() {\n const result = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n for (let command = this; command; command = command.parent) {\n result.push(command);\n }\n return result;\n }\n\n /**\n * Define a command.\n *\n * There are two styles of command: pay attention to where to put the description.\n *\n * @example\n * // Command implemented using action handler (description is supplied separately to `.command`)\n * program\n * .command('clone <source> [destination]')\n * .description('clone a repository into a newly created directory')\n * .action((source, destination) => {\n * console.log('clone command called');\n * });\n *\n * // Command implemented using separate executable file (description is second parameter to `.command`)\n * program\n * .command('start <service>', 'start named service')\n * .command('stop [service]', 'stop named service, or all if no name supplied');\n *\n * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`\n * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)\n * @param {object} [execOpts] - configuration options (for executable)\n * @return {Command} returns new command for action handler, or `this` for executable command\n */\n\n command(nameAndArgs, actionOptsOrExecDesc, execOpts) {\n let desc = actionOptsOrExecDesc;\n let opts = execOpts;\n if (typeof desc === 'object' && desc !== null) {\n opts = desc;\n desc = null;\n }\n opts = opts || {};\n const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);\n\n const cmd = this.createCommand(name);\n if (desc) {\n cmd.description(desc);\n cmd._executableHandler = true;\n }\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden\n cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor\n if (args) cmd.arguments(args);\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd.copyInheritedSettings(this);\n\n if (desc) return this;\n return cmd;\n }\n\n /**\n * Factory routine to create a new unattached command.\n *\n * See .command() for creating an attached subcommand, which uses this routine to\n * create the command. You can override createCommand to customise subcommands.\n *\n * @param {string} [name]\n * @return {Command} new command\n */\n\n createCommand(name) {\n return new Command(name);\n }\n\n /**\n * You can customise the help with a subclass of Help by overriding createHelp,\n * or by overriding Help properties using configureHelp().\n *\n * @return {Help}\n */\n\n createHelp() {\n return Object.assign(new Help(), this.configureHelp());\n }\n\n /**\n * You can customise the help by overriding Help properties using configureHelp(),\n * or with a subclass of Help by overriding createHelp().\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureHelp(configuration) {\n if (configuration === undefined) return this._helpConfiguration;\n\n this._helpConfiguration = configuration;\n return this;\n }\n\n /**\n * The default output goes to stdout and stderr. You can customise this for special\n * applications. You can also customise the display of errors by overriding outputError.\n *\n * The configuration properties are all functions:\n *\n * // change how output being written, defaults to stdout and stderr\n * writeOut(str)\n * writeErr(str)\n * // change how output being written for errors, defaults to writeErr\n * outputError(str, write) // used for displaying errors and not used for displaying help\n * // specify width for wrapping help\n * getOutHelpWidth()\n * getErrHelpWidth()\n * // color support, currently only used with Help\n * getOutHasColors()\n * getErrHasColors()\n * stripColor() // used to remove ANSI escape codes if output does not have colors\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureOutput(configuration) {\n if (configuration === undefined) return this._outputConfiguration;\n\n this._outputConfiguration = Object.assign(\n {},\n this._outputConfiguration,\n configuration,\n );\n return this;\n }\n\n /**\n * Display the help or a custom message after an error occurs.\n *\n * @param {(boolean|string)} [displayHelp]\n * @return {Command} `this` command for chaining\n */\n showHelpAfterError(displayHelp = true) {\n if (typeof displayHelp !== 'string') displayHelp = !!displayHelp;\n this._showHelpAfterError = displayHelp;\n return this;\n }\n\n /**\n * Display suggestion of similar commands for unknown commands, or options for unknown options.\n *\n * @param {boolean} [displaySuggestion]\n * @return {Command} `this` command for chaining\n */\n showSuggestionAfterError(displaySuggestion = true) {\n this._showSuggestionAfterError = !!displaySuggestion;\n return this;\n }\n\n /**\n * Add a prepared subcommand.\n *\n * See .command() for creating an attached subcommand which inherits settings from its parent.\n *\n * @param {Command} cmd - new subcommand\n * @param {object} [opts] - configuration options\n * @return {Command} `this` command for chaining\n */\n\n addCommand(cmd, opts) {\n if (!cmd._name) {\n throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`);\n }\n\n opts = opts || {};\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation\n\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd._checkForBrokenPassThrough();\n\n return this;\n }\n\n /**\n * Factory routine to create a new unattached argument.\n *\n * See .argument() for creating an attached argument, which uses this routine to\n * create the argument. You can override createArgument to return a custom argument.\n *\n * @param {string} name\n * @param {string} [description]\n * @return {Argument} new argument\n */\n\n createArgument(name, description) {\n return new Argument(name, description);\n }\n\n /**\n * Define argument syntax for command.\n *\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @example\n * program.argument('<input-file>');\n * program.argument('[output-file]');\n *\n * @param {string} name\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom argument processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n argument(name, description, parseArg, defaultValue) {\n const argument = this.createArgument(name, description);\n if (typeof parseArg === 'function') {\n argument.default(defaultValue).argParser(parseArg);\n } else {\n argument.default(parseArg);\n }\n this.addArgument(argument);\n return this;\n }\n\n /**\n * Define argument syntax for command, adding multiple at once (without descriptions).\n *\n * See also .argument().\n *\n * @example\n * program.arguments('<cmd> [env]');\n *\n * @param {string} names\n * @return {Command} `this` command for chaining\n */\n\n arguments(names) {\n names\n .trim()\n .split(/ +/)\n .forEach((detail) => {\n this.argument(detail);\n });\n return this;\n }\n\n /**\n * Define argument syntax for command, adding a prepared argument.\n *\n * @param {Argument} argument\n * @return {Command} `this` command for chaining\n */\n addArgument(argument) {\n const previousArgument = this.registeredArguments.slice(-1)[0];\n if (previousArgument && previousArgument.variadic) {\n throw new Error(\n `only the last argument can be variadic '${previousArgument.name()}'`,\n );\n }\n if (\n argument.required &&\n argument.defaultValue !== undefined &&\n argument.parseArg === undefined\n ) {\n throw new Error(\n `a default value for a required argument is never used: '${argument.name()}'`,\n );\n }\n this.registeredArguments.push(argument);\n return this;\n }\n\n /**\n * Customise or override default help command. By default a help command is automatically added if your command has subcommands.\n *\n * @example\n * program.helpCommand('help [cmd]');\n * program.helpCommand('help [cmd]', 'show help');\n * program.helpCommand(false); // suppress default help command\n * program.helpCommand(true); // add help command even if no subcommands\n *\n * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added\n * @param {string} [description] - custom description\n * @return {Command} `this` command for chaining\n */\n\n helpCommand(enableOrNameAndArgs, description) {\n if (typeof enableOrNameAndArgs === 'boolean') {\n this._addImplicitHelpCommand = enableOrNameAndArgs;\n if (enableOrNameAndArgs && this._defaultCommandGroup) {\n // make the command to store the group\n this._initCommandGroup(this._getHelpCommand());\n }\n return this;\n }\n\n const nameAndArgs = enableOrNameAndArgs ?? 'help [command]';\n const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);\n const helpDescription = description ?? 'display help for command';\n\n const helpCommand = this.createCommand(helpName);\n helpCommand.helpOption(false);\n if (helpArgs) helpCommand.arguments(helpArgs);\n if (helpDescription) helpCommand.description(helpDescription);\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n // init group unless lazy create\n if (enableOrNameAndArgs || description) this._initCommandGroup(helpCommand);\n\n return this;\n }\n\n /**\n * Add prepared custom help command.\n *\n * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()`\n * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only\n * @return {Command} `this` command for chaining\n */\n addHelpCommand(helpCommand, deprecatedDescription) {\n // If not passed an object, call through to helpCommand for backwards compatibility,\n // as addHelpCommand was originally used like helpCommand is now.\n if (typeof helpCommand !== 'object') {\n this.helpCommand(helpCommand, deprecatedDescription);\n return this;\n }\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n this._initCommandGroup(helpCommand);\n return this;\n }\n\n /**\n * Lazy create help command.\n *\n * @return {(Command|null)}\n * @package\n */\n _getHelpCommand() {\n const hasImplicitHelpCommand =\n this._addImplicitHelpCommand ??\n (this.commands.length &&\n !this._actionHandler &&\n !this._findCommand('help'));\n\n if (hasImplicitHelpCommand) {\n if (this._helpCommand === undefined) {\n this.helpCommand(undefined, undefined); // use default name and description\n }\n return this._helpCommand;\n }\n return null;\n }\n\n /**\n * Add hook for life cycle event.\n *\n * @param {string} event\n * @param {Function} listener\n * @return {Command} `this` command for chaining\n */\n\n hook(event, listener) {\n const allowedValues = ['preSubcommand', 'preAction', 'postAction'];\n if (!allowedValues.includes(event)) {\n throw new Error(`Unexpected value for event passed to hook : '${event}'.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n if (this._lifeCycleHooks[event]) {\n this._lifeCycleHooks[event].push(listener);\n } else {\n this._lifeCycleHooks[event] = [listener];\n }\n return this;\n }\n\n /**\n * Register callback to use as replacement for calling process.exit.\n *\n * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing\n * @return {Command} `this` command for chaining\n */\n\n exitOverride(fn) {\n if (fn) {\n this._exitCallback = fn;\n } else {\n this._exitCallback = (err) => {\n if (err.code !== 'commander.executeSubCommandAsync') {\n throw err;\n } else {\n // Async callback from spawn events, not useful to throw.\n }\n };\n }\n return this;\n }\n\n /**\n * Call process.exit, and _exitCallback if defined.\n *\n * @param {number} exitCode exit code for using with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n * @return never\n * @private\n */\n\n _exit(exitCode, code, message) {\n if (this._exitCallback) {\n this._exitCallback(new CommanderError(exitCode, code, message));\n // Expecting this line is not reached.\n }\n process.exit(exitCode);\n }\n\n /**\n * Register callback `fn` for the command.\n *\n * @example\n * program\n * .command('serve')\n * .description('start service')\n * .action(function() {\n * // do work here\n * });\n *\n * @param {Function} fn\n * @return {Command} `this` command for chaining\n */\n\n action(fn) {\n const listener = (args) => {\n // The .action callback takes an extra parameter which is the command or options.\n const expectedArgsCount = this.registeredArguments.length;\n const actionArgs = args.slice(0, expectedArgsCount);\n if (this._storeOptionsAsProperties) {\n actionArgs[expectedArgsCount] = this; // backwards compatible \"options\"\n } else {\n actionArgs[expectedArgsCount] = this.opts();\n }\n actionArgs.push(this);\n\n return fn.apply(this, actionArgs);\n };\n this._actionHandler = listener;\n return this;\n }\n\n /**\n * Factory routine to create a new unattached option.\n *\n * See .option() for creating an attached option, which uses this routine to\n * create the option. You can override createOption to return a custom option.\n *\n * @param {string} flags\n * @param {string} [description]\n * @return {Option} new option\n */\n\n createOption(flags, description) {\n return new Option(flags, description);\n }\n\n /**\n * Wrap parseArgs to catch 'commander.invalidArgument'.\n *\n * @param {(Option | Argument)} target\n * @param {string} value\n * @param {*} previous\n * @param {string} invalidArgumentMessage\n * @private\n */\n\n _callParseArg(target, value, previous, invalidArgumentMessage) {\n try {\n return target.parseArg(value, previous);\n } catch (err) {\n if (err.code === 'commander.invalidArgument') {\n const message = `${invalidArgumentMessage} ${err.message}`;\n this.error(message, { exitCode: err.exitCode, code: err.code });\n }\n throw err;\n }\n }\n\n /**\n * Check for option flag conflicts.\n * Register option if no conflicts found, or throw on conflict.\n *\n * @param {Option} option\n * @private\n */\n\n _registerOption(option) {\n const matchingOption =\n (option.short && this._findOption(option.short)) ||\n (option.long && this._findOption(option.long));\n if (matchingOption) {\n const matchingFlag =\n option.long && this._findOption(option.long)\n ? option.long\n : option.short;\n throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'\n- already used by option '${matchingOption.flags}'`);\n }\n\n this._initOptionGroup(option);\n this.options.push(option);\n }\n\n /**\n * Check for command name and alias conflicts with existing commands.\n * Register command if no conflicts found, or throw on conflict.\n *\n * @param {Command} command\n * @private\n */\n\n _registerCommand(command) {\n const knownBy = (cmd) => {\n return [cmd.name()].concat(cmd.aliases());\n };\n\n const alreadyUsed = knownBy(command).find((name) =>\n this._findCommand(name),\n );\n if (alreadyUsed) {\n const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|');\n const newCmd = knownBy(command).join('|');\n throw new Error(\n `cannot add command '${newCmd}' as already have command '${existingCmd}'`,\n );\n }\n\n this._initCommandGroup(command);\n this.commands.push(command);\n }\n\n /**\n * Add an option.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addOption(option) {\n this._registerOption(option);\n\n const oname = option.name();\n const name = option.attributeName();\n\n // store default value\n if (option.negate) {\n // --no-foo is special and defaults foo to true, unless a --foo option is already defined\n const positiveLongFlag = option.long.replace(/^--no-/, '--');\n if (!this._findOption(positiveLongFlag)) {\n this.setOptionValueWithSource(\n name,\n option.defaultValue === undefined ? true : option.defaultValue,\n 'default',\n );\n }\n } else if (option.defaultValue !== undefined) {\n this.setOptionValueWithSource(name, option.defaultValue, 'default');\n }\n\n // handler for cli and env supplied values\n const handleOptionValue = (val, invalidValueMessage, valueSource) => {\n // val is null for optional option used without an optional-argument.\n // val is undefined for boolean and negated option.\n if (val == null && option.presetArg !== undefined) {\n val = option.presetArg;\n }\n\n // custom processing\n const oldValue = this.getOptionValue(name);\n if (val !== null && option.parseArg) {\n val = this._callParseArg(option, val, oldValue, invalidValueMessage);\n } else if (val !== null && option.variadic) {\n val = option._concatValue(val, oldValue);\n }\n\n // Fill-in appropriate missing values. Long winded but easy to follow.\n if (val == null) {\n if (option.negate) {\n val = false;\n } else if (option.isBoolean() || option.optional) {\n val = true;\n } else {\n val = ''; // not normal, parseArg might have failed or be a mock function for testing\n }\n }\n this.setOptionValueWithSource(name, val, valueSource);\n };\n\n this.on('option:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'cli');\n });\n\n if (option.envVar) {\n this.on('optionEnv:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'env');\n });\n }\n\n return this;\n }\n\n /**\n * Internal implementation shared by .option() and .requiredOption()\n *\n * @return {Command} `this` command for chaining\n * @private\n */\n _optionEx(config, flags, description, fn, defaultValue) {\n if (typeof flags === 'object' && flags instanceof Option) {\n throw new Error(\n 'To add an Option object use addOption() instead of option() or requiredOption()',\n );\n }\n const option = this.createOption(flags, description);\n option.makeOptionMandatory(!!config.mandatory);\n if (typeof fn === 'function') {\n option.default(defaultValue).argParser(fn);\n } else if (fn instanceof RegExp) {\n // deprecated\n const regex = fn;\n fn = (val, def) => {\n const m = regex.exec(val);\n return m ? m[0] : def;\n };\n option.default(defaultValue).argParser(fn);\n } else {\n option.default(fn);\n }\n\n return this.addOption(option);\n }\n\n /**\n * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. A required\n * option-argument is indicated by `<>` and an optional option-argument by `[]`.\n *\n * See the README for more details, and see also addOption() and requiredOption().\n *\n * @example\n * program\n * .option('-p, --pepper', 'add pepper')\n * .option('--pt, --pizza-type <TYPE>', 'type of pizza') // required option-argument\n * .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default\n * .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n option(flags, description, parseArg, defaultValue) {\n return this._optionEx({}, flags, description, parseArg, defaultValue);\n }\n\n /**\n * Add a required option which must have a value after parsing. This usually means\n * the option must be specified on the command line. (Otherwise the same as .option().)\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n requiredOption(flags, description, parseArg, defaultValue) {\n return this._optionEx(\n { mandatory: true },\n flags,\n description,\n parseArg,\n defaultValue,\n );\n }\n\n /**\n * Alter parsing of short flags with optional values.\n *\n * @example\n * // for `.option('-f,--flag [value]'):\n * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour\n * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`\n *\n * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.\n * @return {Command} `this` command for chaining\n */\n combineFlagAndOptionalValue(combine = true) {\n this._combineFlagAndOptionalValue = !!combine;\n return this;\n }\n\n /**\n * Allow unknown options on the command line.\n *\n * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options.\n * @return {Command} `this` command for chaining\n */\n allowUnknownOption(allowUnknown = true) {\n this._allowUnknownOption = !!allowUnknown;\n return this;\n }\n\n /**\n * Allow excess command-arguments on the command line. Pass false to make excess arguments an error.\n *\n * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments.\n * @return {Command} `this` command for chaining\n */\n allowExcessArguments(allowExcess = true) {\n this._allowExcessArguments = !!allowExcess;\n return this;\n }\n\n /**\n * Enable positional options. Positional means global options are specified before subcommands which lets\n * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.\n * The default behaviour is non-positional and global options may appear anywhere on the command line.\n *\n * @param {boolean} [positional]\n * @return {Command} `this` command for chaining\n */\n enablePositionalOptions(positional = true) {\n this._enablePositionalOptions = !!positional;\n return this;\n }\n\n /**\n * Pass through options that come after command-arguments rather than treat them as command-options,\n * so actual command-options come before command-arguments. Turning this on for a subcommand requires\n * positional options to have been enabled on the program (parent commands).\n * The default behaviour is non-positional and options may appear before or after command-arguments.\n *\n * @param {boolean} [passThrough] for unknown options.\n * @return {Command} `this` command for chaining\n */\n passThroughOptions(passThrough = true) {\n this._passThroughOptions = !!passThrough;\n this._checkForBrokenPassThrough();\n return this;\n }\n\n /**\n * @private\n */\n\n _checkForBrokenPassThrough() {\n if (\n this.parent &&\n this._passThroughOptions &&\n !this.parent._enablePositionalOptions\n ) {\n throw new Error(\n `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`,\n );\n }\n }\n\n /**\n * Whether to store option values as properties on command object,\n * or store separately (specify false). In both cases the option values can be accessed using .opts().\n *\n * @param {boolean} [storeAsProperties=true]\n * @return {Command} `this` command for chaining\n */\n\n storeOptionsAsProperties(storeAsProperties = true) {\n if (this.options.length) {\n throw new Error('call .storeOptionsAsProperties() before adding options');\n }\n if (Object.keys(this._optionValues).length) {\n throw new Error(\n 'call .storeOptionsAsProperties() before setting option values',\n );\n }\n this._storeOptionsAsProperties = !!storeAsProperties;\n return this;\n }\n\n /**\n * Retrieve option value.\n *\n * @param {string} key\n * @return {object} value\n */\n\n getOptionValue(key) {\n if (this._storeOptionsAsProperties) {\n return this[key];\n }\n return this._optionValues[key];\n }\n\n /**\n * Store option value.\n *\n * @param {string} key\n * @param {object} value\n * @return {Command} `this` command for chaining\n */\n\n setOptionValue(key, value) {\n return this.setOptionValueWithSource(key, value, undefined);\n }\n\n /**\n * Store option value and where the value came from.\n *\n * @param {string} key\n * @param {object} value\n * @param {string} source - expected values are default/config/env/cli/implied\n * @return {Command} `this` command for chaining\n */\n\n setOptionValueWithSource(key, value, source) {\n if (this._storeOptionsAsProperties) {\n this[key] = value;\n } else {\n this._optionValues[key] = value;\n }\n this._optionValueSources[key] = source;\n return this;\n }\n\n /**\n * Get source of option value.\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSource(key) {\n return this._optionValueSources[key];\n }\n\n /**\n * Get source of option value. See also .optsWithGlobals().\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSourceWithGlobals(key) {\n // global overwrites local, like optsWithGlobals\n let source;\n this._getCommandAndAncestors().forEach((cmd) => {\n if (cmd.getOptionValueSource(key) !== undefined) {\n source = cmd.getOptionValueSource(key);\n }\n });\n return source;\n }\n\n /**\n * Get user arguments from implied or explicit arguments.\n * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches.\n *\n * @private\n */\n\n _prepareUserArgs(argv, parseOptions) {\n if (argv !== undefined && !Array.isArray(argv)) {\n throw new Error('first parameter to parse must be array or undefined');\n }\n parseOptions = parseOptions || {};\n\n // auto-detect argument conventions if nothing supplied\n if (argv === undefined && parseOptions.from === undefined) {\n if (process.versions?.electron) {\n parseOptions.from = 'electron';\n }\n // check node specific options for scenarios where user CLI args follow executable without scriptname\n const execArgv = process.execArgv ?? [];\n if (\n execArgv.includes('-e') ||\n execArgv.includes('--eval') ||\n execArgv.includes('-p') ||\n execArgv.includes('--print')\n ) {\n parseOptions.from = 'eval'; // internal usage, not documented\n }\n }\n\n // default to using process.argv\n if (argv === undefined) {\n argv = process.argv;\n }\n this.rawArgs = argv.slice();\n\n // extract the user args and scriptPath\n let userArgs;\n switch (parseOptions.from) {\n case undefined:\n case 'node':\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n break;\n case 'electron':\n // @ts-ignore: because defaultApp is an unknown property\n if (process.defaultApp) {\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n } else {\n userArgs = argv.slice(1);\n }\n break;\n case 'user':\n userArgs = argv.slice(0);\n break;\n case 'eval':\n userArgs = argv.slice(1);\n break;\n default:\n throw new Error(\n `unexpected parse option { from: '${parseOptions.from}' }`,\n );\n }\n\n // Find default name for program from arguments.\n if (!this._name && this._scriptPath)\n this.nameFromFilename(this._scriptPath);\n this._name = this._name || 'program';\n\n return userArgs;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Use parseAsync instead of parse if any of your action handlers are async.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * program.parse(); // parse process.argv and auto-detect electron and special node flags\n * program.parse(process.argv); // assume argv[0] is app and argv[1] is script\n * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv] - optional, defaults to process.argv\n * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron\n * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'\n * @return {Command} `this` command for chaining\n */\n\n parse(argv, parseOptions) {\n this._prepareForParse();\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n this._parseCommand([], userArgs);\n\n return this;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags\n * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script\n * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv]\n * @param {object} [parseOptions]\n * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'\n * @return {Promise}\n */\n\n async parseAsync(argv, parseOptions) {\n this._prepareForParse();\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n await this._parseCommand([], userArgs);\n\n return this;\n }\n\n _prepareForParse() {\n if (this._savedState === null) {\n this.saveStateBeforeParse();\n } else {\n this.restoreStateBeforeParse();\n }\n }\n\n /**\n * Called the first time parse is called to save state and allow a restore before subsequent calls to parse.\n * Not usually called directly, but available for subclasses to save their custom state.\n *\n * This is called in a lazy way. Only commands used in parsing chain will have state saved.\n */\n saveStateBeforeParse() {\n this._savedState = {\n // name is stable if supplied by author, but may be unspecified for root command and deduced during parsing\n _name: this._name,\n // option values before parse have default values (including false for negated options)\n // shallow clones\n _optionValues: { ...this._optionValues },\n _optionValueSources: { ...this._optionValueSources },\n };\n }\n\n /**\n * Restore state before parse for calls after the first.\n * Not usually called directly, but available for subclasses to save their custom state.\n *\n * This is called in a lazy way. Only commands used in parsing chain will have state restored.\n */\n restoreStateBeforeParse() {\n if (this._storeOptionsAsProperties)\n throw new Error(`Can not call parse again when storeOptionsAsProperties is true.\n- either make a new Command for each call to parse, or stop storing options as properties`);\n\n // clear state from _prepareUserArgs\n this._name = this._savedState._name;\n this._scriptPath = null;\n this.rawArgs = [];\n // clear state from setOptionValueWithSource\n this._optionValues = { ...this._savedState._optionValues };\n this._optionValueSources = { ...this._savedState._optionValueSources };\n // clear state from _parseCommand\n this.args = [];\n // clear state from _processArguments\n this.processedArgs = [];\n }\n\n /**\n * Throw if expected executable is missing. Add lots of help for author.\n *\n * @param {string} executableFile\n * @param {string} executableDir\n * @param {string} subcommandName\n */\n _checkForMissingExecutable(executableFile, executableDir, subcommandName) {\n if (fs.existsSync(executableFile)) return;\n\n const executableDirMessage = executableDir\n ? `searched for local subcommand relative to directory '${executableDir}'`\n : 'no directory for search for local subcommand, use .executableDir() to supply a custom directory';\n const executableMissing = `'${executableFile}' does not exist\n - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${executableDirMessage}`;\n throw new Error(executableMissing);\n }\n\n /**\n * Execute a sub-command executable.\n *\n * @private\n */\n\n _executeSubCommand(subcommand, args) {\n args = args.slice();\n let launchWithNode = false; // Use node for source targets so do not need to get permissions correct, and on Windows.\n const sourceExt = ['.js', '.ts', '.tsx', '.mjs', '.cjs'];\n\n function findFile(baseDir, baseName) {\n // Look for specified file\n const localBin = path.resolve(baseDir, baseName);\n if (fs.existsSync(localBin)) return localBin;\n\n // Stop looking if candidate already has an expected extension.\n if (sourceExt.includes(path.extname(baseName))) return undefined;\n\n // Try all the extensions.\n const foundExt = sourceExt.find((ext) =>\n fs.existsSync(`${localBin}${ext}`),\n );\n if (foundExt) return `${localBin}${foundExt}`;\n\n return undefined;\n }\n\n // Not checking for help first. Unlikely to have mandatory and executable, and can't robustly test for help flags in external command.\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // executableFile and executableDir might be full path, or just a name\n let executableFile =\n subcommand._executableFile || `${this._name}-${subcommand._name}`;\n let executableDir = this._executableDir || '';\n if (this._scriptPath) {\n let resolvedScriptPath; // resolve possible symlink for installed npm binary\n try {\n resolvedScriptPath = fs.realpathSync(this._scriptPath);\n } catch {\n resolvedScriptPath = this._scriptPath;\n }\n executableDir = path.resolve(\n path.dirname(resolvedScriptPath),\n executableDir,\n );\n }\n\n // Look for a local file in preference to a command in PATH.\n if (executableDir) {\n let localFile = findFile(executableDir, executableFile);\n\n // Legacy search using prefix of script name instead of command name\n if (!localFile && !subcommand._executableFile && this._scriptPath) {\n const legacyName = path.basename(\n this._scriptPath,\n path.extname(this._scriptPath),\n );\n if (legacyName !== this._name) {\n localFile = findFile(\n executableDir,\n `${legacyName}-${subcommand._name}`,\n );\n }\n }\n executableFile = localFile || executableFile;\n }\n\n launchWithNode = sourceExt.includes(path.extname(executableFile));\n\n let proc;\n if (process.platform !== 'win32') {\n if (launchWithNode) {\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n\n proc = childProcess.spawn(process.argv[0], args, { stdio: 'inherit' });\n } else {\n proc = childProcess.spawn(executableFile, args, { stdio: 'inherit' });\n }\n } else {\n this._checkForMissingExecutable(\n executableFile,\n executableDir,\n subcommand._name,\n );\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n proc = childProcess.spawn(process.execPath, args, { stdio: 'inherit' });\n }\n\n if (!proc.killed) {\n // testing mainly to avoid leak warnings during unit tests with mocked spawn\n const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];\n signals.forEach((signal) => {\n process.on(signal, () => {\n if (proc.killed === false && proc.exitCode === null) {\n // @ts-ignore because signals not typed to known strings\n proc.kill(signal);\n }\n });\n });\n }\n\n // By default terminate process when spawned process terminates.\n const exitCallback = this._exitCallback;\n proc.on('close', (code) => {\n code = code ?? 1; // code is null if spawned process terminated due to a signal\n if (!exitCallback) {\n process.exit(code);\n } else {\n exitCallback(\n new CommanderError(\n code,\n 'commander.executeSubCommandAsync',\n '(close)',\n ),\n );\n }\n });\n proc.on('error', (err) => {\n // @ts-ignore: because err.code is an unknown property\n if (err.code === 'ENOENT') {\n this._checkForMissingExecutable(\n executableFile,\n executableDir,\n subcommand._name,\n );\n // @ts-ignore: because err.code is an unknown property\n } else if (err.code === 'EACCES') {\n throw new Error(`'${executableFile}' not executable`);\n }\n if (!exitCallback) {\n process.exit(1);\n } else {\n const wrappedError = new CommanderError(\n 1,\n 'commander.executeSubCommandAsync',\n '(error)',\n );\n wrappedError.nestedError = err;\n exitCallback(wrappedError);\n }\n });\n\n // Store the reference to the child process\n this.runningCommand = proc;\n }\n\n /**\n * @private\n */\n\n _dispatchSubcommand(commandName, operands, unknown) {\n const subCommand = this._findCommand(commandName);\n if (!subCommand) this.help({ error: true });\n\n subCommand._prepareForParse();\n let promiseChain;\n promiseChain = this._chainOrCallSubCommandHook(\n promiseChain,\n subCommand,\n 'preSubcommand',\n );\n promiseChain = this._chainOrCall(promiseChain, () => {\n if (subCommand._executableHandler) {\n this._executeSubCommand(subCommand, operands.concat(unknown));\n } else {\n return subCommand._parseCommand(operands, unknown);\n }\n });\n return promiseChain;\n }\n\n /**\n * Invoke help directly if possible, or dispatch if necessary.\n * e.g. help foo\n *\n * @private\n */\n\n _dispatchHelpCommand(subcommandName) {\n if (!subcommandName) {\n this.help();\n }\n const subCommand = this._findCommand(subcommandName);\n if (subCommand && !subCommand._executableHandler) {\n subCommand.help();\n }\n\n // Fallback to parsing the help flag to invoke the help.\n return this._dispatchSubcommand(\n subcommandName,\n [],\n [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help'],\n );\n }\n\n /**\n * Check this.args against expected this.registeredArguments.\n *\n * @private\n */\n\n _checkNumberOfArguments() {\n // too few\n this.registeredArguments.forEach((arg, i) => {\n if (arg.required && this.args[i] == null) {\n this.missingArgument(arg.name());\n }\n });\n // too many\n if (\n this.registeredArguments.length > 0 &&\n this.registeredArguments[this.registeredArguments.length - 1].variadic\n ) {\n return;\n }\n if (this.args.length > this.registeredArguments.length) {\n this._excessArguments(this.args);\n }\n }\n\n /**\n * Process this.args using this.registeredArguments and save as this.processedArgs!\n *\n * @private\n */\n\n _processArguments() {\n const myParseArg = (argument, value, previous) => {\n // Extra processing for nice error message on parsing failure.\n let parsedValue = value;\n if (value !== null && argument.parseArg) {\n const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;\n parsedValue = this._callParseArg(\n argument,\n value,\n previous,\n invalidValueMessage,\n );\n }\n return parsedValue;\n };\n\n this._checkNumberOfArguments();\n\n const processedArgs = [];\n this.registeredArguments.forEach((declaredArg, index) => {\n let value = declaredArg.defaultValue;\n if (declaredArg.variadic) {\n // Collect together remaining arguments for passing together as an array.\n if (index < this.args.length) {\n value = this.args.slice(index);\n if (declaredArg.parseArg) {\n value = value.reduce((processed, v) => {\n return myParseArg(declaredArg, v, processed);\n }, declaredArg.defaultValue);\n }\n } else if (value === undefined) {\n value = [];\n }\n } else if (index < this.args.length) {\n value = this.args[index];\n if (declaredArg.parseArg) {\n value = myParseArg(declaredArg, value, declaredArg.defaultValue);\n }\n }\n processedArgs[index] = value;\n });\n this.processedArgs = processedArgs;\n }\n\n /**\n * Once we have a promise we chain, but call synchronously until then.\n *\n * @param {(Promise|undefined)} promise\n * @param {Function} fn\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCall(promise, fn) {\n // thenable\n if (promise && promise.then && typeof promise.then === 'function') {\n // already have a promise, chain callback\n return promise.then(() => fn());\n }\n // callback might return a promise\n return fn();\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallHooks(promise, event) {\n let result = promise;\n const hooks = [];\n this._getCommandAndAncestors()\n .reverse()\n .filter((cmd) => cmd._lifeCycleHooks[event] !== undefined)\n .forEach((hookedCommand) => {\n hookedCommand._lifeCycleHooks[event].forEach((callback) => {\n hooks.push({ hookedCommand, callback });\n });\n });\n if (event === 'postAction') {\n hooks.reverse();\n }\n\n hooks.forEach((hookDetail) => {\n result = this._chainOrCall(result, () => {\n return hookDetail.callback(hookDetail.hookedCommand, this);\n });\n });\n return result;\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {Command} subCommand\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallSubCommandHook(promise, subCommand, event) {\n let result = promise;\n if (this._lifeCycleHooks[event] !== undefined) {\n this._lifeCycleHooks[event].forEach((hook) => {\n result = this._chainOrCall(result, () => {\n return hook(this, subCommand);\n });\n });\n }\n return result;\n }\n\n /**\n * Process arguments in context of this command.\n * Returns action result, in case it is a promise.\n *\n * @private\n */\n\n _parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n this._parseOptionsEnv(); // after cli, so parseArg not called on both cli and env\n this._parseOptionsImplied();\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n }\n if (\n this._getHelpCommand() &&\n operands[0] === this._getHelpCommand().name()\n ) {\n return this._dispatchHelpCommand(operands[1]);\n }\n if (this._defaultCommandName) {\n this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command\n return this._dispatchSubcommand(\n this._defaultCommandName,\n operands,\n unknown,\n );\n }\n if (\n this.commands.length &&\n this.args.length === 0 &&\n !this._actionHandler &&\n !this._defaultCommandName\n ) {\n // probably missing subcommand and no handler, user needs help (and exit)\n this.help({ error: true });\n }\n\n this._outputHelpIfRequested(parsed.unknown);\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // We do not always call this check to avoid masking a \"better\" error, like unknown command.\n const checkForUnknownOptions = () => {\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n };\n\n const commandEvent = `command:${this.name()}`;\n if (this._actionHandler) {\n checkForUnknownOptions();\n this._processArguments();\n\n let promiseChain;\n promiseChain = this._chainOrCallHooks(promiseChain, 'preAction');\n promiseChain = this._chainOrCall(promiseChain, () =>\n this._actionHandler(this.processedArgs),\n );\n if (this.parent) {\n promiseChain = this._chainOrCall(promiseChain, () => {\n this.parent.emit(commandEvent, operands, unknown); // legacy\n });\n }\n promiseChain = this._chainOrCallHooks(promiseChain, 'postAction');\n return promiseChain;\n }\n if (this.parent && this.parent.listenerCount(commandEvent)) {\n checkForUnknownOptions();\n this._processArguments();\n this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (operands.length) {\n if (this._findCommand('*')) {\n // legacy default command\n return this._dispatchSubcommand('*', operands, unknown);\n }\n if (this.listenerCount('command:*')) {\n // skip option check, emit event for possible misspelling suggestion\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n } else {\n checkForUnknownOptions();\n this._processArguments();\n }\n } else if (this.commands.length) {\n checkForUnknownOptions();\n // This command has subcommands and nothing hooked up at this level, so display help (and exit).\n this.help({ error: true });\n } else {\n checkForUnknownOptions();\n this._processArguments();\n // fall through for caller to handle after calling .parse()\n }\n }\n\n /**\n * Find matching command.\n *\n * @private\n * @return {Command | undefined}\n */\n _findCommand(name) {\n if (!name) return undefined;\n return this.commands.find(\n (cmd) => cmd._name === name || cmd._aliases.includes(name),\n );\n }\n\n /**\n * Return an option matching `arg` if any.\n *\n * @param {string} arg\n * @return {Option}\n * @package\n */\n\n _findOption(arg) {\n return this.options.find((option) => option.is(arg));\n }\n\n /**\n * Display an error message if a mandatory option does not have a value.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n\n _checkForMissingMandatoryOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd.options.forEach((anOption) => {\n if (\n anOption.mandatory &&\n cmd.getOptionValue(anOption.attributeName()) === undefined\n ) {\n cmd.missingMandatoryOptionValue(anOption);\n }\n });\n });\n }\n\n /**\n * Display an error message if conflicting options are used together in this.\n *\n * @private\n */\n _checkForConflictingLocalOptions() {\n const definedNonDefaultOptions = this.options.filter((option) => {\n const optionKey = option.attributeName();\n if (this.getOptionValue(optionKey) === undefined) {\n return false;\n }\n return this.getOptionValueSource(optionKey) !== 'default';\n });\n\n const optionsWithConflicting = definedNonDefaultOptions.filter(\n (option) => option.conflictsWith.length > 0,\n );\n\n optionsWithConflicting.forEach((option) => {\n const conflictingAndDefined = definedNonDefaultOptions.find((defined) =>\n option.conflictsWith.includes(defined.attributeName()),\n );\n if (conflictingAndDefined) {\n this._conflictingOption(option, conflictingAndDefined);\n }\n });\n }\n\n /**\n * Display an error message if conflicting options are used together.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n _checkForConflictingOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd._checkForConflictingLocalOptions();\n });\n }\n\n /**\n * Parse options from `argv` removing known options,\n * and return argv split into operands and unknown arguments.\n *\n * Side effects: modifies command by storing options. Does not reset state if called again.\n *\n * Examples:\n *\n * argv => operands, unknown\n * --known kkk op => [op], []\n * op --known kkk => [op], []\n * sub --unknown uuu op => [sub], [--unknown uuu op]\n * sub -- --unknown uuu op => [sub --unknown uuu op], []\n *\n * @param {string[]} argv\n * @return {{operands: string[], unknown: string[]}}\n */\n\n parseOptions(argv) {\n const operands = []; // operands, not options or values\n const unknown = []; // first unknown option and remaining unknown args\n let dest = operands;\n const args = argv.slice();\n\n function maybeOption(arg) {\n return arg.length > 1 && arg[0] === '-';\n }\n\n const negativeNumberArg = (arg) => {\n // return false if not a negative number\n if (!/^-\\d*\\.?\\d+(e[+-]?\\d+)?$/.test(arg)) return false;\n // negative number is ok unless digit used as an option in command hierarchy\n return !this._getCommandAndAncestors().some((cmd) =>\n cmd.options\n .map((opt) => opt.short)\n .some((short) => /^-\\d$/.test(short)),\n );\n };\n\n // parse options\n let activeVariadicOption = null;\n while (args.length) {\n const arg = args.shift();\n\n // literal\n if (arg === '--') {\n if (dest === unknown) dest.push(arg);\n dest.push(...args);\n break;\n }\n\n if (\n activeVariadicOption &&\n (!maybeOption(arg) || negativeNumberArg(arg))\n ) {\n this.emit(`option:${activeVariadicOption.name()}`, arg);\n continue;\n }\n activeVariadicOption = null;\n\n if (maybeOption(arg)) {\n const option = this._findOption(arg);\n // recognised option, call listener to assign value with possible custom processing\n if (option) {\n if (option.required) {\n const value = args.shift();\n if (value === undefined) this.optionMissingArgument(option);\n this.emit(`option:${option.name()}`, value);\n } else if (option.optional) {\n let value = null;\n // historical behaviour is optional value is following arg unless an option\n if (\n args.length > 0 &&\n (!maybeOption(args[0]) || negativeNumberArg(args[0]))\n ) {\n value = args.shift();\n }\n this.emit(`option:${option.name()}`, value);\n } else {\n // boolean flag\n this.emit(`option:${option.name()}`);\n }\n activeVariadicOption = option.variadic ? option : null;\n continue;\n }\n }\n\n // Look for combo options following single dash, eat first one if known.\n if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {\n const option = this._findOption(`-${arg[1]}`);\n if (option) {\n if (\n option.required ||\n (option.optional && this._combineFlagAndOptionalValue)\n ) {\n // option with value following in same argument\n this.emit(`option:${option.name()}`, arg.slice(2));\n } else {\n // boolean option, emit and put back remainder of arg for further processing\n this.emit(`option:${option.name()}`);\n args.unshift(`-${arg.slice(2)}`);\n }\n continue;\n }\n }\n\n // Look for known long flag with value, like --foo=bar\n if (/^--[^=]+=/.test(arg)) {\n const index = arg.indexOf('=');\n const option = this._findOption(arg.slice(0, index));\n if (option && (option.required || option.optional)) {\n this.emit(`option:${option.name()}`, arg.slice(index + 1));\n continue;\n }\n }\n\n // Not a recognised option by this command.\n // Might be a command-argument, or subcommand option, or unknown option, or help command or option.\n\n // An unknown option means further arguments also classified as unknown so can be reprocessed by subcommands.\n // A negative number in a leaf command is not an unknown option.\n if (\n dest === operands &&\n maybeOption(arg) &&\n !(this.commands.length === 0 && negativeNumberArg(arg))\n ) {\n dest = unknown;\n }\n\n // If using positionalOptions, stop processing our options at subcommand.\n if (\n (this._enablePositionalOptions || this._passThroughOptions) &&\n operands.length === 0 &&\n unknown.length === 0\n ) {\n if (this._findCommand(arg)) {\n operands.push(arg);\n if (args.length > 0) unknown.push(...args);\n break;\n } else if (\n this._getHelpCommand() &&\n arg === this._getHelpCommand().name()\n ) {\n operands.push(arg);\n if (args.length > 0) operands.push(...args);\n break;\n } else if (this._defaultCommandName) {\n unknown.push(arg);\n if (args.length > 0) unknown.push(...args);\n break;\n }\n }\n\n // If using passThroughOptions, stop processing options at first command-argument.\n if (this._passThroughOptions) {\n dest.push(arg);\n if (args.length > 0) dest.push(...args);\n break;\n }\n\n // add arg\n dest.push(arg);\n }\n\n return { operands, unknown };\n }\n\n /**\n * Return an object containing local option values as key-value pairs.\n *\n * @return {object}\n */\n opts() {\n if (this._storeOptionsAsProperties) {\n // Preserve original behaviour so backwards compatible when still using properties\n const result = {};\n const len = this.options.length;\n\n for (let i = 0; i < len; i++) {\n const key = this.options[i].attributeName();\n result[key] =\n key === this._versionOptionName ? this._version : this[key];\n }\n return result;\n }\n\n return this._optionValues;\n }\n\n /**\n * Return an object containing merged local and global option values as key-value pairs.\n *\n * @return {object}\n */\n optsWithGlobals() {\n // globals overwrite locals\n return this._getCommandAndAncestors().reduce(\n (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),\n {},\n );\n }\n\n /**\n * Display error message and exit (or call exitOverride).\n *\n * @param {string} message\n * @param {object} [errorOptions]\n * @param {string} [errorOptions.code] - an id string representing the error\n * @param {number} [errorOptions.exitCode] - used with process.exit\n */\n error(message, errorOptions) {\n // output handling\n this._outputConfiguration.outputError(\n `${message}\\n`,\n this._outputConfiguration.writeErr,\n );\n if (typeof this._showHelpAfterError === 'string') {\n this._outputConfiguration.writeErr(`${this._showHelpAfterError}\\n`);\n } else if (this._showHelpAfterError) {\n this._outputConfiguration.writeErr('\\n');\n this.outputHelp({ error: true });\n }\n\n // exit handling\n const config = errorOptions || {};\n const exitCode = config.exitCode || 1;\n const code = config.code || 'commander.error';\n this._exit(exitCode, code, message);\n }\n\n /**\n * Apply any option related environment variables, if option does\n * not have a value from cli or client code.\n *\n * @private\n */\n _parseOptionsEnv() {\n this.options.forEach((option) => {\n if (option.envVar && option.envVar in process.env) {\n const optionKey = option.attributeName();\n // Priority check. Do not overwrite cli or options from unknown source (client-code).\n if (\n this.getOptionValue(optionKey) === undefined ||\n ['default', 'config', 'env'].includes(\n this.getOptionValueSource(optionKey),\n )\n ) {\n if (option.required || option.optional) {\n // option can take a value\n // keep very simple, optional always takes value\n this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);\n } else {\n // boolean\n // keep very simple, only care that envVar defined and not the value\n this.emit(`optionEnv:${option.name()}`);\n }\n }\n }\n });\n }\n\n /**\n * Apply any implied option values, if option is undefined or default value.\n *\n * @private\n */\n _parseOptionsImplied() {\n const dualHelper = new DualOptions(this.options);\n const hasCustomOptionValue = (optionKey) => {\n return (\n this.getOptionValue(optionKey) !== undefined &&\n !['default', 'implied'].includes(this.getOptionValueSource(optionKey))\n );\n };\n this.options\n .filter(\n (option) =>\n option.implied !== undefined &&\n hasCustomOptionValue(option.attributeName()) &&\n dualHelper.valueFromOption(\n this.getOptionValue(option.attributeName()),\n option,\n ),\n )\n .forEach((option) => {\n Object.keys(option.implied)\n .filter((impliedKey) => !hasCustomOptionValue(impliedKey))\n .forEach((impliedKey) => {\n this.setOptionValueWithSource(\n impliedKey,\n option.implied[impliedKey],\n 'implied',\n );\n });\n });\n }\n\n /**\n * Argument `name` is missing.\n *\n * @param {string} name\n * @private\n */\n\n missingArgument(name) {\n const message = `error: missing required argument '${name}'`;\n this.error(message, { code: 'commander.missingArgument' });\n }\n\n /**\n * `Option` is missing an argument.\n *\n * @param {Option} option\n * @private\n */\n\n optionMissingArgument(option) {\n const message = `error: option '${option.flags}' argument missing`;\n this.error(message, { code: 'commander.optionMissingArgument' });\n }\n\n /**\n * `Option` does not have a value, and is a mandatory option.\n *\n * @param {Option} option\n * @private\n */\n\n missingMandatoryOptionValue(option) {\n const message = `error: required option '${option.flags}' not specified`;\n this.error(message, { code: 'commander.missingMandatoryOptionValue' });\n }\n\n /**\n * `Option` conflicts with another option.\n *\n * @param {Option} option\n * @param {Option} conflictingOption\n * @private\n */\n _conflictingOption(option, conflictingOption) {\n // The calling code does not know whether a negated option is the source of the\n // value, so do some work to take an educated guess.\n const findBestOptionFromValue = (option) => {\n const optionKey = option.attributeName();\n const optionValue = this.getOptionValue(optionKey);\n const negativeOption = this.options.find(\n (target) => target.negate && optionKey === target.attributeName(),\n );\n const positiveOption = this.options.find(\n (target) => !target.negate && optionKey === target.attributeName(),\n );\n if (\n negativeOption &&\n ((negativeOption.presetArg === undefined && optionValue === false) ||\n (negativeOption.presetArg !== undefined &&\n optionValue === negativeOption.presetArg))\n ) {\n return negativeOption;\n }\n return positiveOption || option;\n };\n\n const getErrorMessage = (option) => {\n const bestOption = findBestOptionFromValue(option);\n const optionKey = bestOption.attributeName();\n const source = this.getOptionValueSource(optionKey);\n if (source === 'env') {\n return `environment variable '${bestOption.envVar}'`;\n }\n return `option '${bestOption.flags}'`;\n };\n\n const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;\n this.error(message, { code: 'commander.conflictingOption' });\n }\n\n /**\n * Unknown option `flag`.\n *\n * @param {string} flag\n * @private\n */\n\n unknownOption(flag) {\n if (this._allowUnknownOption) return;\n let suggestion = '';\n\n if (flag.startsWith('--') && this._showSuggestionAfterError) {\n // Looping to pick up the global options too\n let candidateFlags = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n do {\n const moreFlags = command\n .createHelp()\n .visibleOptions(command)\n .filter((option) => option.long)\n .map((option) => option.long);\n candidateFlags = candidateFlags.concat(moreFlags);\n command = command.parent;\n } while (command && !command._enablePositionalOptions);\n suggestion = suggestSimilar(flag, candidateFlags);\n }\n\n const message = `error: unknown option '${flag}'${suggestion}`;\n this.error(message, { code: 'commander.unknownOption' });\n }\n\n /**\n * Excess arguments, more than expected.\n *\n * @param {string[]} receivedArgs\n * @private\n */\n\n _excessArguments(receivedArgs) {\n if (this._allowExcessArguments) return;\n\n const expected = this.registeredArguments.length;\n const s = expected === 1 ? '' : 's';\n const forSubcommand = this.parent ? ` for '${this.name()}'` : '';\n const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;\n this.error(message, { code: 'commander.excessArguments' });\n }\n\n /**\n * Unknown command.\n *\n * @private\n */\n\n unknownCommand() {\n const unknownName = this.args[0];\n let suggestion = '';\n\n if (this._showSuggestionAfterError) {\n const candidateNames = [];\n this.createHelp()\n .visibleCommands(this)\n .forEach((command) => {\n candidateNames.push(command.name());\n // just visible alias\n if (command.alias()) candidateNames.push(command.alias());\n });\n suggestion = suggestSimilar(unknownName, candidateNames);\n }\n\n const message = `error: unknown command '${unknownName}'${suggestion}`;\n this.error(message, { code: 'commander.unknownCommand' });\n }\n\n /**\n * Get or set the program version.\n *\n * This method auto-registers the \"-V, --version\" option which will print the version number.\n *\n * You can optionally supply the flags and description to override the defaults.\n *\n * @param {string} [str]\n * @param {string} [flags]\n * @param {string} [description]\n * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments\n */\n\n version(str, flags, description) {\n if (str === undefined) return this._version;\n this._version = str;\n flags = flags || '-V, --version';\n description = description || 'output the version number';\n const versionOption = this.createOption(flags, description);\n this._versionOptionName = versionOption.attributeName();\n this._registerOption(versionOption);\n\n this.on('option:' + versionOption.name(), () => {\n this._outputConfiguration.writeOut(`${str}\\n`);\n this._exit(0, 'commander.version', str);\n });\n return this;\n }\n\n /**\n * Set the description.\n *\n * @param {string} [str]\n * @param {object} [argsDescription]\n * @return {(string|Command)}\n */\n description(str, argsDescription) {\n if (str === undefined && argsDescription === undefined)\n return this._description;\n this._description = str;\n if (argsDescription) {\n this._argsDescription = argsDescription;\n }\n return this;\n }\n\n /**\n * Set the summary. Used when listed as subcommand of parent.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n summary(str) {\n if (str === undefined) return this._summary;\n this._summary = str;\n return this;\n }\n\n /**\n * Set an alias for the command.\n *\n * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.\n *\n * @param {string} [alias]\n * @return {(string|Command)}\n */\n\n alias(alias) {\n if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility\n\n /** @type {Command} */\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n if (\n this.commands.length !== 0 &&\n this.commands[this.commands.length - 1]._executableHandler\n ) {\n // assume adding alias for last added executable subcommand, rather than this\n command = this.commands[this.commands.length - 1];\n }\n\n if (alias === command._name)\n throw new Error(\"Command alias can't be the same as its name\");\n const matchingCommand = this.parent?._findCommand(alias);\n if (matchingCommand) {\n // c.f. _registerCommand\n const existingCmd = [matchingCommand.name()]\n .concat(matchingCommand.aliases())\n .join('|');\n throw new Error(\n `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`,\n );\n }\n\n command._aliases.push(alias);\n return this;\n }\n\n /**\n * Set aliases for the command.\n *\n * Only the first alias is shown in the auto-generated help.\n *\n * @param {string[]} [aliases]\n * @return {(string[]|Command)}\n */\n\n aliases(aliases) {\n // Getter for the array of aliases is the main reason for having aliases() in addition to alias().\n if (aliases === undefined) return this._aliases;\n\n aliases.forEach((alias) => this.alias(alias));\n return this;\n }\n\n /**\n * Set / get the command usage `str`.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n usage(str) {\n if (str === undefined) {\n if (this._usage) return this._usage;\n\n const args = this.registeredArguments.map((arg) => {\n return humanReadableArgName(arg);\n });\n return []\n .concat(\n this.options.length || this._helpOption !== null ? '[options]' : [],\n this.commands.length ? '[command]' : [],\n this.registeredArguments.length ? args : [],\n )\n .join(' ');\n }\n\n this._usage = str;\n return this;\n }\n\n /**\n * Get or set the name of the command.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n name(str) {\n if (str === undefined) return this._name;\n this._name = str;\n return this;\n }\n\n /**\n * Set/get the help group heading for this subcommand in parent command's help.\n *\n * @param {string} [heading]\n * @return {Command | string}\n */\n\n helpGroup(heading) {\n if (heading === undefined) return this._helpGroupHeading ?? '';\n this._helpGroupHeading = heading;\n return this;\n }\n\n /**\n * Set/get the default help group heading for subcommands added to this command.\n * (This does not override a group set directly on the subcommand using .helpGroup().)\n *\n * @example\n * program.commandsGroup('Development Commands:);\n * program.command('watch')...\n * program.command('lint')...\n * ...\n *\n * @param {string} [heading]\n * @returns {Command | string}\n */\n commandsGroup(heading) {\n if (heading === undefined) return this._defaultCommandGroup ?? '';\n this._defaultCommandGroup = heading;\n return this;\n }\n\n /**\n * Set/get the default help group heading for options added to this command.\n * (This does not override a group set directly on the option using .helpGroup().)\n *\n * @example\n * program\n * .optionsGroup('Development Options:')\n * .option('-d, --debug', 'output extra debugging')\n * .option('-p, --profile', 'output profiling information')\n *\n * @param {string} [heading]\n * @returns {Command | string}\n */\n optionsGroup(heading) {\n if (heading === undefined) return this._defaultOptionGroup ?? '';\n this._defaultOptionGroup = heading;\n return this;\n }\n\n /**\n * @param {Option} option\n * @private\n */\n _initOptionGroup(option) {\n if (this._defaultOptionGroup && !option.helpGroupHeading)\n option.helpGroup(this._defaultOptionGroup);\n }\n\n /**\n * @param {Command} cmd\n * @private\n */\n _initCommandGroup(cmd) {\n if (this._defaultCommandGroup && !cmd.helpGroup())\n cmd.helpGroup(this._defaultCommandGroup);\n }\n\n /**\n * Set the name of the command from script filename, such as process.argv[1],\n * or require.main.filename, or __filename.\n *\n * (Used internally and public although not documented in README.)\n *\n * @example\n * program.nameFromFilename(require.main.filename);\n *\n * @param {string} filename\n * @return {Command}\n */\n\n nameFromFilename(filename) {\n this._name = path.basename(filename, path.extname(filename));\n\n return this;\n }\n\n /**\n * Get or set the directory for searching for executable subcommands of this command.\n *\n * @example\n * program.executableDir(__dirname);\n * // or\n * program.executableDir('subcommands');\n *\n * @param {string} [path]\n * @return {(string|null|Command)}\n */\n\n executableDir(path) {\n if (path === undefined) return this._executableDir;\n this._executableDir = path;\n return this;\n }\n\n /**\n * Return program help documentation.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout\n * @return {string}\n */\n\n helpInformation(contextOptions) {\n const helper = this.createHelp();\n const context = this._getOutputContext(contextOptions);\n helper.prepareContext({\n error: context.error,\n helpWidth: context.helpWidth,\n outputHasColors: context.hasColors,\n });\n const text = helper.formatHelp(this, helper);\n if (context.hasColors) return text;\n return this._outputConfiguration.stripColor(text);\n }\n\n /**\n * @typedef HelpContext\n * @type {object}\n * @property {boolean} error\n * @property {number} helpWidth\n * @property {boolean} hasColors\n * @property {function} write - includes stripColor if needed\n *\n * @returns {HelpContext}\n * @private\n */\n\n _getOutputContext(contextOptions) {\n contextOptions = contextOptions || {};\n const error = !!contextOptions.error;\n let baseWrite;\n let hasColors;\n let helpWidth;\n if (error) {\n baseWrite = (str) => this._outputConfiguration.writeErr(str);\n hasColors = this._outputConfiguration.getErrHasColors();\n helpWidth = this._outputConfiguration.getErrHelpWidth();\n } else {\n baseWrite = (str) => this._outputConfiguration.writeOut(str);\n hasColors = this._outputConfiguration.getOutHasColors();\n helpWidth = this._outputConfiguration.getOutHelpWidth();\n }\n const write = (str) => {\n if (!hasColors) str = this._outputConfiguration.stripColor(str);\n return baseWrite(str);\n };\n return { error, write, hasColors, helpWidth };\n }\n\n /**\n * Output help information for this command.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n outputHelp(contextOptions) {\n let deprecatedCallback;\n if (typeof contextOptions === 'function') {\n deprecatedCallback = contextOptions;\n contextOptions = undefined;\n }\n\n const outputContext = this._getOutputContext(contextOptions);\n /** @type {HelpTextEventContext} */\n const eventContext = {\n error: outputContext.error,\n write: outputContext.write,\n command: this,\n };\n\n this._getCommandAndAncestors()\n .reverse()\n .forEach((command) => command.emit('beforeAllHelp', eventContext));\n this.emit('beforeHelp', eventContext);\n\n let helpInformation = this.helpInformation({ error: outputContext.error });\n if (deprecatedCallback) {\n helpInformation = deprecatedCallback(helpInformation);\n if (\n typeof helpInformation !== 'string' &&\n !Buffer.isBuffer(helpInformation)\n ) {\n throw new Error('outputHelp callback must return a string or a Buffer');\n }\n }\n outputContext.write(helpInformation);\n\n if (this._getHelpOption()?.long) {\n this.emit(this._getHelpOption().long); // deprecated\n }\n this.emit('afterHelp', eventContext);\n this._getCommandAndAncestors().forEach((command) =>\n command.emit('afterAllHelp', eventContext),\n );\n }\n\n /**\n * You can pass in flags and a description to customise the built-in help option.\n * Pass in false to disable the built-in help option.\n *\n * @example\n * program.helpOption('-?, --help' 'show help'); // customise\n * program.helpOption(false); // disable\n *\n * @param {(string | boolean)} flags\n * @param {string} [description]\n * @return {Command} `this` command for chaining\n */\n\n helpOption(flags, description) {\n // Support enabling/disabling built-in help option.\n if (typeof flags === 'boolean') {\n if (flags) {\n if (this._helpOption === null) this._helpOption = undefined; // reenable\n if (this._defaultOptionGroup) {\n // make the option to store the group\n this._initOptionGroup(this._getHelpOption());\n }\n } else {\n this._helpOption = null; // disable\n }\n return this;\n }\n\n // Customise flags and description.\n this._helpOption = this.createOption(\n flags ?? '-h, --help',\n description ?? 'display help for command',\n );\n // init group unless lazy create\n if (flags || description) this._initOptionGroup(this._helpOption);\n\n return this;\n }\n\n /**\n * Lazy create help option.\n * Returns null if has been disabled with .helpOption(false).\n *\n * @returns {(Option | null)} the help option\n * @package\n */\n _getHelpOption() {\n // Lazy create help option on demand.\n if (this._helpOption === undefined) {\n this.helpOption(undefined, undefined);\n }\n return this._helpOption;\n }\n\n /**\n * Supply your own option to use for the built-in help option.\n * This is an alternative to using helpOption() to customise the flags and description etc.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addHelpOption(option) {\n this._helpOption = option;\n this._initOptionGroup(option);\n return this;\n }\n\n /**\n * Output help information and exit.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n help(contextOptions) {\n this.outputHelp(contextOptions);\n let exitCode = Number(process.exitCode ?? 0); // process.exitCode does allow a string or an integer, but we prefer just a number\n if (\n exitCode === 0 &&\n contextOptions &&\n typeof contextOptions !== 'function' &&\n contextOptions.error\n ) {\n exitCode = 1;\n }\n // message: do not have all displayed text available so only passing placeholder.\n this._exit(exitCode, 'commander.help', '(outputHelp)');\n }\n\n /**\n * // Do a little typing to coordinate emit and listener for the help text events.\n * @typedef HelpTextEventContext\n * @type {object}\n * @property {boolean} error\n * @property {Command} command\n * @property {function} write\n */\n\n /**\n * Add additional text to be displayed with the built-in help.\n *\n * Position is 'before' or 'after' to affect just this command,\n * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.\n *\n * @param {string} position - before or after built-in help\n * @param {(string | Function)} text - string to add, or a function returning a string\n * @return {Command} `this` command for chaining\n */\n\n addHelpText(position, text) {\n const allowedValues = ['beforeAll', 'before', 'after', 'afterAll'];\n if (!allowedValues.includes(position)) {\n throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n\n const helpEvent = `${position}Help`;\n this.on(helpEvent, (/** @type {HelpTextEventContext} */ context) => {\n let helpStr;\n if (typeof text === 'function') {\n helpStr = text({ error: context.error, command: context.command });\n } else {\n helpStr = text;\n }\n // Ignore falsy value when nothing to output.\n if (helpStr) {\n context.write(`${helpStr}\\n`);\n }\n });\n return this;\n }\n\n /**\n * Output help information if help flags specified\n *\n * @param {Array} args - array of options to search for help flags\n * @private\n */\n\n _outputHelpIfRequested(args) {\n const helpOption = this._getHelpOption();\n const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));\n if (helpRequested) {\n this.outputHelp();\n // (Do not have all displayed text available so only passing placeholder.)\n this._exit(0, 'commander.helpDisplayed', '(outputHelp)');\n }\n }\n}\n\n/**\n * Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command).\n *\n * @param {string[]} args - array of arguments from node.execArgv\n * @returns {string[]}\n * @private\n */\n\nfunction incrementNodeInspectorPort(args) {\n // Testing for these options:\n // --inspect[=[host:]port]\n // --inspect-brk[=[host:]port]\n // --inspect-port=[host:]port\n return args.map((arg) => {\n if (!arg.startsWith('--inspect')) {\n return arg;\n }\n let debugOption;\n let debugHost = '127.0.0.1';\n let debugPort = '9229';\n let match;\n if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {\n // e.g. --inspect\n debugOption = match[1];\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null\n ) {\n debugOption = match[1];\n if (/^\\d+$/.test(match[3])) {\n // e.g. --inspect=1234\n debugPort = match[3];\n } else {\n // e.g. --inspect=localhost\n debugHost = match[3];\n }\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\\d+)$/)) !== null\n ) {\n // e.g. --inspect=localhost:1234\n debugOption = match[1];\n debugHost = match[3];\n debugPort = match[4];\n }\n\n if (debugOption && debugPort !== '0') {\n return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;\n }\n return arg;\n });\n}\n\n/**\n * @returns {boolean | undefined}\n * @package\n */\nfunction useColor() {\n // Test for common conventions.\n // NB: the observed behaviour is in combination with how author adds color! For example:\n // - we do not test NODE_DISABLE_COLORS, but util:styletext does\n // - we do test NO_COLOR, but Chalk does not\n //\n // References:\n // https://no-color.org\n // https://bixense.com/clicolors/\n // https://github.com/nodejs/node/blob/0a00217a5f67ef4a22384cfc80eb6dd9a917fdc1/lib/internal/tty.js#L109\n // https://github.com/chalk/supports-color/blob/c214314a14bcb174b12b3014b2b0a8de375029ae/index.js#L33\n // (https://force-color.org recent web page from 2023, does not match major javascript implementations)\n\n if (\n process.env.NO_COLOR ||\n process.env.FORCE_COLOR === '0' ||\n process.env.FORCE_COLOR === 'false'\n )\n return false;\n if (process.env.FORCE_COLOR || process.env.CLICOLOR_FORCE !== undefined)\n return true;\n return undefined;\n}\n\nexports.Command = Command;\nexports.useColor = useColor; // exporting for tests\n", "const { Argument } = require('./lib/argument.js');\nconst { Command } = require('./lib/command.js');\nconst { CommanderError, InvalidArgumentError } = require('./lib/error.js');\nconst { Help } = require('./lib/help.js');\nconst { Option } = require('./lib/option.js');\n\nexports.program = new Command();\n\nexports.createCommand = (name) => new Command(name);\nexports.createOption = (flags, description) => new Option(flags, description);\nexports.createArgument = (name, description) => new Argument(name, description);\n\n/**\n * Expose classes\n */\n\nexports.Command = Command;\nexports.Option = Option;\nexports.Argument = Argument;\nexports.Help = Help;\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\nexports.InvalidOptionArgumentError = InvalidArgumentError; // Deprecated\n", "import { readFile } from \"node:fs/promises\";\nimport { resolveSystem, writeFileSetAtomically } from \"@portable-capabilities/compiler\";\nimport type { Effects } from \"@portable-capabilities/contracts\";\nimport { Command } from \"commander\";\nimport {\n downgradePackage,\n installPackage,\n recoverInstallation,\n removeInstallation,\n statusInstallation,\n upgradePackage,\n} from \"./installation/lifecycle.js\";\nimport { executeInvocation, persistInvocation } from \"./invocation/executor.js\";\nimport { resolveVerifiedCapabilityEntrypoint } from \"./invocation/resolve-entrypoint.js\";\nimport { type OutputFormat, writeEnvelope } from \"./output/format.js\";\nimport { cliVersion } from \"./release.js\";\nimport {\n buildProduction,\n inspectProduction,\n testProduction,\n validateProduction,\n} from \"./services/tracer.js\";\n\nfunction formatOf(options: { format?: string }): OutputFormat {\n return options.format === \"json\" ? \"json\" : \"human\";\n}\nfunction common(command: Command): Command {\n return command.option(\"--format <format>\", \"human or json\", \"human\");\n}\n\nfunction writeLifecycleResult(\n command: string,\n lifecycle: Awaited<ReturnType<typeof installPackage>>,\n options: { format?: string },\n): void {\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command,\n ok: lifecycle.ok,\n data: lifecycle,\n diagnostics: lifecycle.diagnostics.map((message) => ({\n code: \"CLI_INSTALLATION\",\n message,\n })),\n },\n formatOf(options),\n );\n if (!lifecycle.ok) process.exitCode = 4;\n}\nexport function createProgram(): Command {\n const program = new Command()\n .name(\"portable-capabilities\")\n .version(cliVersion)\n .description(\"Portable analytical capability compiler\");\n common(\n program\n .command(\"build\")\n .argument(\"<manifest>\", \"system manifest\")\n .option(\"--output <dir>\")\n .option(\"--target <ids...>\")\n .option(\"--role <ids...>\"),\n ).action(async (manifest, options) => {\n const system = await resolveSystem(manifest);\n const result = await buildProduction(system, {\n targets: options.target,\n roles: options.role,\n });\n if (options.output) await writeFileSetAtomically(options.output, result.files);\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command: \"build\",\n ok: true,\n data: { digest: result.digest, files: result.files.map((f) => f.path) },\n diagnostics: [],\n },\n formatOf(options),\n );\n });\n common(\n program\n .command(\"validate\")\n .argument(\"<manifest>\", \"system manifest\")\n .option(\"--target <ids...>\")\n .option(\"--role <ids...>\"),\n ).action(async (manifest, options) => {\n const system = await resolveSystem(manifest);\n const result = await validateProduction(system, {\n targets: options.target,\n roles: options.role,\n });\n const diagnostics = result.cells.flatMap((cell) =>\n Object.entries(cell.categories).flatMap(([category, verification]) =>\n verification.valid\n ? []\n : verification.diagnostics.map((message) => ({\n code: \"CLI_VALIDATION\",\n path: `${cell.runtimeId}/${cell.roleId}/${category}`,\n message,\n })),\n ),\n );\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command: \"validate\",\n ok: result.cells.every((cell) => cell.valid),\n data: {\n manifest,\n targets: result.build.targets,\n roles: result.build.roles,\n cells: result.cells,\n },\n diagnostics,\n },\n formatOf(options),\n );\n if (!result.cells.every((cell) => cell.valid)) process.exitCode = 1;\n });\n common(\n program\n .command(\"test\")\n .argument(\"<manifest>\", \"system manifest\")\n .option(\"--target <ids...>\")\n .option(\"--role <ids...>\"),\n ).action(async (manifest, options) => {\n const system = await resolveSystem(manifest);\n const result = await testProduction(system, {\n targets: options.target,\n roles: options.role,\n });\n const failed = result.cells.filter((cell) => !cell.passed);\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command: \"test\",\n ok: result.passed,\n data: result,\n diagnostics: failed.flatMap((cell) =>\n cell.layers.flatMap((layer) =>\n layer.status === \"passed\"\n ? []\n : layer.diagnostics.map((message) => ({\n code: \"CLI_CONFORMANCE_FAILED\",\n path: `${cell.runtimeId}/${cell.roleId}/${layer.layer}`,\n message,\n })),\n ),\n ),\n },\n formatOf(options),\n );\n if (!result.passed) process.exitCode = 1;\n });\n common(\n program\n .command(\"diff\")\n .argument(\"<manifest>\", \"system manifest\")\n .option(\"--against <file>\")\n .option(\"--target <ids...>\")\n .option(\"--role <ids...>\"),\n ).action(async (manifest, options) => {\n const system = await resolveSystem(manifest);\n const actual = await buildProduction(system, {\n targets: options.target,\n roles: options.role,\n });\n const expected = options.against\n ? (await readFile(options.against, \"utf8\")).trim()\n : (\n await buildProduction(system, {\n targets: options.target,\n roles: options.role,\n })\n ).digest;\n const changed = expected !== actual.digest;\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command: \"diff\",\n ok: !changed,\n data: {\n changed,\n actual: actual.digest,\n expected,\n strategy: options.against ? \"against-file\" : \"independent-double-generation\",\n },\n diagnostics: changed\n ? [\n {\n code: \"CLI_DRIFT\",\n message: \"Independent generated digests differ\",\n remediation: \"Inspect canonical inputs and generation determinism\",\n },\n ]\n : [],\n },\n formatOf(options),\n );\n if (changed) process.exitCode = 2;\n });\n common(\n program\n .command(\"inspect\")\n .argument(\"<manifest>\", \"system manifest\")\n .requiredOption(\"--target <id>\")\n .requiredOption(\"--role <id>\"),\n ).action(async (manifest, options) => {\n const system = await resolveSystem(manifest);\n const result = await inspectProduction(system, {\n target: options.target,\n role: options.role,\n });\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command: \"inspect\",\n ok: true,\n data: {\n systemId: result.systemId,\n digest: result.digest,\n canonical: result.lock.graph.role,\n operational: result.lock.graph.operationalSkill,\n projection: result.lock.graph.primitivePlan,\n runtime: result.lock.graph.runtimeProfile,\n resources: result.lock.graph.resources,\n integrity: result.lock.integrity,\n exceptions: {\n exceptionId:\n (result.lock.graph.primitivePlan as { exceptionId?: string | null }).exceptionId ??\n null,\n provenance:\n (result.lock.graph.primitivePlan as { provenance?: readonly string[] }).provenance ??\n [],\n },\n installation: {\n state: \"generated\",\n ownedPaths: result.files.map((file) => file.path),\n },\n },\n diagnostics: [],\n },\n formatOf(options),\n );\n });\n common(\n program\n .command(\"invoke\")\n .requiredOption(\"--package-root <dir>\")\n .requiredOption(\"--runtime <id>\")\n .requiredOption(\"--role <id>\")\n .option(\"--timeout <ms>\", \"timeout\", \"30000\")\n .option(\"--trace-dir <dir>\", \"trace directory\", \".portable-capabilities/traces\"),\n ).action(async (options) => {\n const resolved = await resolveVerifiedCapabilityEntrypoint({\n packageRoot: options.packageRoot,\n runtimeId: options.runtime,\n roleId: options.role,\n });\n const primitivePlan = resolved.lock.graph.primitivePlan as { readonly effects: Effects };\n const result = await executeInvocation({\n schemaVersion: \"1.0.0\",\n runtimeId: options.runtime,\n roleId: options.role,\n executable: resolved.executable,\n argv: resolved.argv,\n cwd: options.packageRoot,\n sourceWorkspace: process.cwd(),\n timeoutMs: Number(options.timeout),\n environment: {},\n effects: {\n filesystem: \"read-only\",\n shell: \"denied\",\n network: \"inherited\",\n repositoryWrites: \"denied\",\n },\n nativePermissions: primitivePlan.effects,\n });\n await persistInvocation(result, options.traceDir);\n const ok = result.exitCode === 0 && !result.timedOut && result.violations.length === 0;\n writeEnvelope(\n {\n schemaVersion: \"1.0.0\",\n command: \"invoke\",\n ok,\n data: result,\n diagnostics: ok\n ? []\n : result.violations.length > 0\n ? result.violations.map((violation) => ({\n code: violation.code,\n message: violation.message,\n remediation: \"Inspect the persisted invocation trace and confinement evidence\",\n }))\n : [\n {\n code: \"CLI_INVOKE_FAILED\",\n message: \"Runtime process failed\",\n remediation: \"Inspect normalized stderr and exit status\",\n },\n ],\n },\n formatOf(options),\n );\n if (!ok) process.exitCode = 3;\n });\n common(\n program\n .command(\"install\")\n .requiredOption(\"--source <dir>\")\n .requiredOption(\"--target <dir>\")\n .requiredOption(\"--runtime <id>\")\n .requiredOption(\"--package-version <version>\")\n .option(\"--capability <ids...>\", \"install only the selected capability role IDs\")\n .option(\"--all-capabilities\", \"install every capability in the source package\")\n .option(\"--dry-run\"),\n ).action(async (options) => {\n writeLifecycleResult(\n \"install\",\n await installPackage({\n sourceRoot: options.source,\n targetRoot: options.target,\n runtimeId: options.runtime,\n packageVersion: options.packageVersion,\n capabilityIds: options.capability,\n allCapabilities: Boolean(options.allCapabilities),\n dryRun: Boolean(options.dryRun),\n }),\n options,\n );\n });\n\n common(program.command(\"status\").requiredOption(\"--target <dir>\")).action(async (options) => {\n writeLifecycleResult(\"status\", await statusInstallation(options.target), options);\n });\n\n for (const [name, operation] of [\n [\"upgrade\", upgradePackage],\n [\"downgrade\", downgradePackage],\n ] as const) {\n common(\n program\n .command(name)\n .requiredOption(\"--source <dir>\")\n .requiredOption(\"--target <dir>\")\n .requiredOption(\"--runtime <id>\")\n .requiredOption(\"--package-version <version>\"),\n ).action(async (options) => {\n writeLifecycleResult(\n name,\n await operation({\n sourceRoot: options.source,\n targetRoot: options.target,\n runtimeId: options.runtime,\n packageVersion: options.packageVersion,\n }),\n options,\n );\n });\n }\n\n common(program.command(\"recover\").requiredOption(\"--target <dir>\")).action(async (options) => {\n writeLifecycleResult(\"recover\", await recoverInstallation(options.target), options);\n });\n\n common(program.command(\"remove\").requiredOption(\"--target <dir>\")).action(async (options) => {\n writeLifecycleResult(\"remove\", await removeInstallation(options.target), options);\n });\n\n return program;\n}\n", "export interface Diagnostic {\n readonly ruleCode: string;\n readonly severity: \"error\" | \"warning\";\n readonly file: string;\n readonly path: string;\n readonly message: string;\n readonly remediation: string;\n}\nexport class DiagnosticError extends Error {\n constructor(public readonly diagnostics: readonly Diagnostic[]) {\n super(diagnostics.map((d) => `${d.ruleCode} ${d.file}${d.path}: ${d.message}`).join(\"\\n\"));\n this.name = \"DiagnosticError\";\n }\n}\n", "import { Ajv2020, type AnySchema, type ErrorObject, type ValidateFunction } from \"ajv/dist/2020.js\";\n\nfunction createValidator(): Ajv2020 {\n const ajv = new Ajv2020({\n allErrors: true,\n strict: true,\n allowUnionTypes: true,\n validateSchema: true,\n });\n ajv.addKeyword({\n keyword: \"x-material-claim-fields\",\n schemaType: \"array\",\n valid: true,\n });\n return ajv;\n}\n\nfunction formatErrors(errors: readonly ErrorObject[] | null | undefined): string {\n return (errors ?? [])\n .map((error) => `${error.instancePath || \"/\"}: ${error.message ?? error.keyword}`)\n .join(\"; \");\n}\n\nexport function compileOutputSchema(schema: unknown, source: string): ValidateFunction {\n try {\n return createValidator().compile(schema as AnySchema);\n } catch (error) {\n throw new Error(`Invalid JSON Schema Draft 2020-12 at ${source}: ${String(error)}`);\n }\n}\n\nexport function validateOutputAgainstSchema(\n schema: unknown,\n value: unknown,\n source = \"<bundled-output-schema>\",\n): readonly string[] {\n const validate = compileOutputSchema(schema, source);\n return validate(value)\n ? []\n : Object.freeze(formatErrors(validate.errors).split(\"; \").filter(Boolean));\n}\n\nexport function materialClaimFieldsFromSchema(schema: unknown): readonly string[] {\n if (!schema || typeof schema !== \"object\") {\n throw new Error(\"Output schema must be an object\");\n }\n const fields = (schema as { \"x-material-claim-fields\"?: unknown })[\"x-material-claim-fields\"];\n if (!Array.isArray(fields) || fields.length === 0) {\n throw new Error(\"Output schema has no x-material-claim-fields declaration\");\n }\n if (!fields.every((field) => typeof field === \"string\" && field.trim().length > 0)) {\n throw new Error(\"Output schema material claim fields must be non-empty strings\");\n }\n const unique = new Set(fields);\n if (unique.size !== fields.length) {\n throw new Error(\"Output schema material claim fields must be unique\");\n }\n return Object.freeze([...fields]);\n}\n", "import { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { Ajv2020, type ErrorObject } from \"ajv/dist/2020.js\";\nexport interface SchemaDiagnostic {\n readonly ruleCode: string;\n readonly severity: \"error\" | \"warning\";\n readonly file: string;\n readonly path: string;\n readonly message: string;\n readonly remediation: string;\n}\nconst ajv = new Ajv2020({\n allErrors: true,\n strict: true,\n formats: { date: /^\\d{4}-\\d{2}-\\d{2}$/ },\n});\nconst kinds = [\n \"capability-system\",\n \"role\",\n \"runtime-profile\",\n \"exception\",\n \"operation\",\n \"family\",\n \"evidence-ledger\",\n] as const;\n\nfunction schemaPath(kind: SchemaKind, version: string): string {\n const filename =\n kind === \"evidence-ledger\" && version === \"1.0\"\n ? \"evidence-ledger-1.0.schema.json\"\n : `${kind}.schema.json`;\n return fileURLToPath(new URL(`../schemas/${filename}`, import.meta.url));\n}\n\nfor (const kind of kinds) {\n ajv.addSchema(JSON.parse(readFileSync(schemaPath(kind, \"1.0\"), \"utf8\")));\n}\najv.addSchema(JSON.parse(readFileSync(schemaPath(\"evidence-ledger\", \"1.1\"), \"utf8\")));\n\nexport type SchemaKind = (typeof kinds)[number];\nexport const registeredSchemaVersions: Readonly<Record<SchemaKind, readonly string[]>> =\n Object.freeze({\n \"capability-system\": [\"1.0\"],\n role: [\"1.0\"],\n \"runtime-profile\": [\"1.0\"],\n exception: [\"1.0\"],\n operation: [\"1.0\"],\n family: [\"1.0\"],\n \"evidence-ledger\": [\"1.0\", \"1.1\"],\n });\n\nexport function schemaIdFor(kind: SchemaKind, version: string): string {\n return `https://portable-capabilities.dev/schemas/${kind}/${version}`;\n}\n\nexport function schemaDocument(kind: SchemaKind, version: string): string {\n if (!registeredSchemaVersions[kind].includes(version)) {\n throw new Error(`Unknown schema version ${version} for ${kind}`);\n }\n return readFileSync(schemaPath(kind, version), \"utf8\");\n}\n\nfunction schemaVersionOf(data: unknown): string | undefined {\n if (!data || typeof data !== \"object\") return undefined;\n const value = (data as { schemaVersion?: unknown }).schemaVersion;\n return typeof value === \"string\" ? value : undefined;\n}\n\nexport function validateByKind(\n kind: SchemaKind,\n data: unknown,\n file: string,\n): readonly SchemaDiagnostic[] {\n const version = schemaVersionOf(data);\n if (!version || !registeredSchemaVersions[kind].includes(version)) {\n return [\n {\n ruleCode: \"SCHEMA_VERSION_UNKNOWN\",\n severity: \"error\",\n file,\n path: \"/schemaVersion\",\n message: `Unknown schema version ${version ?? \"<missing>\"} for ${kind}`,\n remediation: `Use one of: ${registeredSchemaVersions[kind].join(\", \")}.`,\n },\n ];\n }\n const validate = ajv.getSchema(schemaIdFor(kind, version));\n if (!validate)\n return [\n {\n ruleCode: \"SCHEMA_VERSION_UNKNOWN\",\n severity: \"error\",\n file,\n path: \"\",\n message: `Unknown schema for ${kind}`,\n remediation: \"Use schemaVersion 1.0.\",\n },\n ];\n if (validate(data)) return [];\n return (validate.errors ?? []).map((e: ErrorObject) => ({\n ruleCode: \"SCHEMA_INVALID\",\n severity: \"error\",\n file,\n path: e.instancePath || \"/\",\n message: e.message ?? \"Schema validation failed\",\n remediation: \"Correct the value to match the versioned schema.\",\n }));\n}\n", "import { validateByKind } from \"./schema-registry.js\";\n\nexport interface SystemManifest {\n schemaVersion: \"1.0\";\n id: string;\n roles: string[];\n runtimes: string[];\n exceptions?: string[];\n}\n\nexport function validateSystemManifest(data: unknown): asserts data is SystemManifest {\n const diagnostics = validateByKind(\"capability-system\", data, \"<system-manifest>\");\n if (diagnostics.length > 0) {\n throw new Error(\n `Invalid system manifest: ${diagnostics\n .map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`)\n .join(\"; \")}`,\n );\n }\n}\n", "import { posix } from \"node:path\";\nimport type { GeneratedFile } from \"@portable-capabilities/renderer-core\";\n\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\nexport function normalizeFileSet(files: readonly GeneratedFile[]): readonly GeneratedFile[] {\n const seen = new Set<string>();\n return [...files]\n .map((file) => {\n const path = file.path.replaceAll(\"\\\\\", \"/\");\n if (posix.isAbsolute(path) || path.split(\"/\").includes(\"..\") || path === \".\" || path === \"\")\n throw new Error(`Unsafe generated path: ${file.path}`);\n const normalizedPath = posix.normalize(path);\n if (seen.has(normalizedPath)) throw new Error(`Duplicate generated path: ${normalizedPath}`);\n seen.add(normalizedPath);\n const text = decoder.decode(file.content).replace(/\\r\\n?/g, \"\\n\").replace(/\\n*$/, \"\\n\");\n return Object.freeze({ path: normalizedPath, content: encoder.encode(text) });\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n}\n", "import { mkdir, mkdtemp, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join, resolve, sep } from \"node:path\";\nimport type { GeneratedFile } from \"@portable-capabilities/renderer-core\";\nexport async function writeFileSetAtomically(\n root: string,\n files: readonly GeneratedFile[],\n): Promise<void> {\n const destination = resolve(root);\n const parent = dirname(destination);\n await mkdir(parent, { recursive: true });\n const stage = await mkdtemp(join(parent, \".cap-stage-\"));\n try {\n for (const file of files) {\n const target = resolve(stage, file.path);\n if (!target.startsWith(stage + sep))\n throw new Error(`Output path escapes root: ${file.path}`);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, file.content);\n }\n const backup = `${destination}.backup-${process.pid}`;\n await rm(backup, { recursive: true, force: true });\n try {\n await rename(destination, backup);\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code !== \"ENOENT\") throw e;\n }\n await rename(stage, destination);\n await rm(backup, { recursive: true, force: true });\n } catch (error) {\n await rm(stage, { recursive: true, force: true });\n throw error;\n }\n}\n", "import type { Effects } from \"@portable-capabilities/contracts\";\nimport type { Diagnostic } from \"../diagnostics/diagnostic.js\";\nexport const DEFAULT_EFFECTS: Effects = Object.freeze({\n filesystem: \"read-only\",\n shell: \"denied\",\n network: \"inherited\",\n repositoryWrites: \"denied\",\n});\nexport function validateEffectsPolicy(\n effects: Partial<Effects> | undefined,\n file: string,\n): { effects: Effects; diagnostics: readonly Diagnostic[] } {\n const resolved = Object.freeze({ ...DEFAULT_EFFECTS, ...(effects ?? {}) }) as Effects;\n const diagnostics: Diagnostic[] = [];\n if (\n resolved.filesystem !== \"read-only\" ||\n resolved.shell !== \"denied\" ||\n resolved.repositoryWrites !== \"denied\"\n )\n diagnostics.push({\n ruleCode: \"POL_UNSAFE_EFFECTS\",\n severity: \"error\",\n file,\n path: \"/effects\",\n message: \"Analytical roles must remain read-only with shell and repository writes denied.\",\n remediation: \"Move mutation behavior to a separate execution contract.\",\n });\n return { effects: resolved, diagnostics };\n}\n", "import type { Diagnostic } from \"../diagnostics/diagnostic.js\";\nexport interface RuntimeException {\n runtime: string;\n scope: string;\n tests: string[];\n reviewDate: string;\n}\nexport function validateExceptionPolicy(\n exception: RuntimeException,\n file: string,\n today = new Date(),\n): readonly Diagnostic[] {\n const out: Diagnostic[] = [];\n if (!/^(role|capability):[^*]+$/.test(exception.scope))\n out.push({\n ruleCode: \"POL_EXCEPTION_SCOPE\",\n severity: \"error\",\n file,\n path: \"/scope\",\n message: \"Exception scope must name one role or capability.\",\n remediation: \"Use role:<id> or capability:<id> without wildcards.\",\n });\n if (!exception.tests?.length)\n out.push({\n ruleCode: \"POL_EXCEPTION_TESTS\",\n severity: \"error\",\n file,\n path: \"/tests\",\n message: \"Exception requires test references.\",\n remediation: \"Add at least one conformance test ID.\",\n });\n if (new Date(`${exception.reviewDate}T00:00:00Z`) < today)\n out.push({\n ruleCode: \"POL_EXCEPTION_STALE\",\n severity: \"error\",\n file,\n path: \"/reviewDate\",\n message: \"Exception review date is stale.\",\n remediation: \"Review the exception and set a future review date.\",\n });\n return out;\n}\n", "import { createHash } from \"node:crypto\";\nimport type { GeneratedFile } from \"@portable-capabilities/renderer-core\";\n\nfunction normalize(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(normalize);\n }\n if (value && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, item]) => [key, normalize(item)]),\n );\n }\n return value;\n}\n\nexport function stableDigest(value: unknown): string {\n return createHash(\"sha256\")\n .update(JSON.stringify(normalize(value)))\n .digest(\"hex\");\n}\n\nexport function computeFileSetDigest(files: readonly GeneratedFile[]): string {\n return stableDigest(\n files.map((file) => ({ path: file.path, bytes: Buffer.from(file.content).toString(\"base64\") })),\n );\n}\n\nexport interface DigestLayer<T> {\n readonly algorithm: \"sha256\";\n readonly parent: string | null;\n readonly digest: string;\n readonly inputs: T;\n}\n\nfunction layer<T>(parent: string | null, inputs: T): DigestLayer<T> {\n return Object.freeze({\n algorithm: \"sha256\",\n parent,\n digest: stableDigest({ parent, inputs }),\n inputs,\n });\n}\n\nexport function canonicalGraphDigest(inputs: {\n readonly roles: unknown;\n readonly families: unknown;\n readonly operations: unknown;\n readonly schemas: unknown;\n readonly taxonomy: unknown;\n readonly resources: unknown;\n readonly nodes: unknown;\n readonly edges: unknown;\n}): DigestLayer<typeof inputs> {\n return layer(null, inputs);\n}\n\nexport function projectionPlanDigest(\n parent: DigestLayer<unknown>,\n inputs: {\n readonly runtimeProfile: unknown;\n readonly runtimeVersion: string;\n readonly provenance: unknown;\n readonly primitivePlan: unknown;\n readonly effects: unknown;\n readonly instructions: unknown;\n readonly exceptions: unknown;\n },\n): DigestLayer<typeof inputs> {\n return layer(parent.digest, inputs);\n}\n\nexport function generatedPackageDigest(\n parent: DigestLayer<unknown>,\n inputs: {\n readonly files: readonly { path: string; digest: string; mode: number }[];\n readonly resources: readonly string[];\n },\n): DigestLayer<typeof inputs> {\n return layer(parent.digest, inputs);\n}\n\nexport function installationManifestDigest(\n parent: DigestLayer<unknown>,\n inputs: {\n readonly target: string;\n readonly runtimeIdentity: string;\n readonly ownedPaths: readonly string[];\n readonly currentDigests: Readonly<Record<string, string>>;\n readonly journalVersion: string;\n readonly lifecycleState: string;\n },\n): DigestLayer<typeof inputs> {\n return layer(parent.digest, inputs);\n}\n\nexport function verifyDigestParent(\n child: DigestLayer<unknown>,\n parent: DigestLayer<unknown>,\n): void {\n if (child.parent !== parent.digest) throw new Error(\"Digest parent mismatch\");\n if (child.digest !== stableDigest({ parent: child.parent, inputs: child.inputs })) {\n throw new Error(\"Digest layer tampering detected\");\n }\n}\n", "import { createHash } from \"node:crypto\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { relative, resolve } from \"node:path\";\nimport type {\n FamilyDefinition,\n FieldProvenance,\n OperationDefinition,\n ResolvedFamily,\n ResolvedOperation,\n ResolvedRole,\n RoleDefinition,\n} from \"@portable-capabilities/contracts\";\nimport { compileOutputSchema, validateByKind } from \"@portable-capabilities/schemas\";\nimport { parse } from \"yaml\";\nimport { DiagnosticError } from \"../diagnostics/diagnostic.js\";\nimport { validateEffectsPolicy } from \"../policy/effects-policy.js\";\n\ninterface OutputSchemaDocument extends Record<string, unknown> {\n readonly $schema?: unknown;\n readonly type?: unknown;\n readonly required?: unknown;\n readonly properties?: unknown;\n}\n\nasync function loadYaml<T>(file: string): Promise<T> {\n return parse(await readFile(file, \"utf8\")) as T;\n}\n\nfunction assertValid(kind: \"operation\" | \"family\" | \"role\", data: unknown, file: string): void {\n const diagnostics = validateByKind(kind, data, file);\n if (diagnostics.length) throw new DiagnosticError(diagnostics);\n}\n\nasync function loadDirectory<T>(\n dir: string,\n kind: \"operation\" | \"family\" | \"role\",\n): Promise<readonly (T & { sourceFile: string })[]> {\n const names = (await readdir(dir)).filter((name) => name.endsWith(\".yaml\")).sort();\n return Promise.all(\n names.map(async (name) => {\n const file = resolve(dir, name);\n const data = await loadYaml<T>(file);\n assertValid(kind, data, file);\n return Object.freeze({ ...data, sourceFile: file });\n }),\n );\n}\n\nexport interface ResolvedContractLibrary {\n readonly operations: readonly ResolvedOperation[];\n readonly families: readonly ResolvedFamily[];\n readonly roles: readonly ResolvedRole[];\n}\n\nexport async function resolveContractLibrary(\n root = process.cwd(),\n): Promise<ResolvedContractLibrary> {\n const operations = (await loadDirectory<OperationDefinition>(\n resolve(root, \"canonical/operations\"),\n \"operation\",\n )) as readonly ResolvedOperation[];\n const families = (await loadDirectory<FamilyDefinition>(\n resolve(root, \"canonical/families\"),\n \"family\",\n )) as readonly ResolvedFamily[];\n const roleDocs = await loadDirectory<RoleDefinition>(resolve(root, \"canonical/roles\"), \"role\");\n const operationMap = new Map(operations.map((item) => [`${item.id}@${item.version}`, item]));\n const familyMap = new Map(families.map((item) => [`${item.id}@${item.version}`, item]));\n const ids = new Set<string>();\n const roles = await Promise.all(\n roleDocs.map(async (role) => {\n if (ids.has(role.id)) throw new Error(`Duplicate role id: ${role.id}`);\n ids.add(role.id);\n const family = familyMap.get(`${role.family.id}@${role.family.version}`);\n if (!family)\n throw new Error(\n `Unknown family reference ${role.family.id}@${role.family.version} in ${role.id}`,\n );\n const resolvedOperations = role.pipeline.map((ref) => {\n const operation = operationMap.get(`${ref.id}@${ref.version}`);\n if (!operation)\n throw new Error(`Unknown operation reference ${ref.id}@${ref.version} in ${role.id}`);\n if (!family.allowedOperations.includes(ref.id))\n throw new Error(`Operation ${ref.id} is not allowed by family ${family.id}`);\n return operation;\n });\n const policy = validateEffectsPolicy(role.effects, role.sourceFile);\n if (policy.diagnostics.length) throw new DiagnosticError(policy.diagnostics);\n\n const schemaFile = resolve(root, role.output.schema);\n const schemaRelative = relative(root, schemaFile);\n if (schemaRelative.startsWith(\"..\") || resolve(root, schemaRelative) !== schemaFile) {\n throw new Error(\n `${role.sourceFile}#/output/schema escapes canonical root: ${role.output.schema}`,\n );\n }\n let schemaContent: string;\n let schema: OutputSchemaDocument;\n try {\n schemaContent = await readFile(schemaFile, \"utf8\");\n schema = JSON.parse(schemaContent) as OutputSchemaDocument;\n } catch (error) {\n throw new Error(\n `${role.sourceFile}#/output/schema cannot resolve ${role.output.schema}: ${String(error)}`,\n );\n }\n if (schema.$schema !== \"https://json-schema.org/draft/2020-12/schema\") {\n throw new Error(`${schemaFile}#/$schema must declare JSON Schema Draft 2020-12`);\n }\n if (\n schema.type !== \"object\" ||\n !Array.isArray(schema.required) ||\n typeof schema.properties !== \"object\"\n ) {\n throw new Error(`${schemaFile} must define an object schema with required and properties`);\n }\n compileOutputSchema(schema, `${role.sourceFile}#/output/schema -> ${schemaFile}`);\n const outputSchema = Object.freeze({\n sourceFile: schemaFile,\n canonicalPath: role.output.schema,\n packagePath: \"resources/output.schema.json\",\n mediaType: \"application/schema+json\",\n content: schemaContent.endsWith(\"\\n\") ? schemaContent : `${schemaContent}\\n`,\n digest: createHash(\"sha256\").update(schemaContent).digest(\"hex\"),\n });\n const provenance: Record<string, FieldProvenance> = {\n id: { owner: \"role\", id: role.id, source: { file: role.sourceFile, path: \"/id\" } },\n purpose: {\n owner: \"role\",\n id: role.id,\n source: { file: role.sourceFile, path: \"/purpose\" },\n },\n family: { owner: \"family\", id: family.id, source: { file: family.sourceFile } },\n pipeline: {\n owner: \"operation\",\n id: resolvedOperations.map((item) => item.id).join(\",\"),\n source: { file: role.sourceFile, path: \"/pipeline\" },\n },\n effects: {\n owner: \"system\",\n id: \"safe-effects-policy\",\n source: { file: role.sourceFile, path: \"/effects\" },\n },\n };\n return Object.freeze({\n ...role,\n effects: policy.effects,\n operations: Object.freeze(resolvedOperations),\n resolvedFamily: family,\n outputSchema,\n provenance: Object.freeze(provenance),\n });\n }),\n );\n return Object.freeze({\n operations: Object.freeze([...operations]),\n families: Object.freeze([...families]),\n roles: Object.freeze(roles.sort((a, b) => a.id.localeCompare(b.id))),\n });\n}\n", "import { access } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\nimport {\n type ResolvedCapabilitySystem,\n type ResolvedRole,\n type RuntimeProfileDefinition,\n validateCompatibilityRange,\n} from \"@portable-capabilities/contracts\";\nimport { validateByKind, validateSystemManifest } from \"@portable-capabilities/schemas\";\nimport { DiagnosticError } from \"../diagnostics/diagnostic.js\";\nimport { type RuntimeException, validateExceptionPolicy } from \"../policy/exception-policy.js\";\nimport { loadDocument } from \"../source/load-document.js\";\nimport { resolveContractLibrary } from \"./resolve-contract-library.js\";\n\ninterface RoleDoc {\n schemaVersion: \"1.0\";\n id: string;\n purpose: string;\n effects?: Partial<ResolvedRole[\"effects\"]>;\n}\ntype RuntimeDoc = RuntimeProfileDefinition;\ninterface ExceptionDoc extends RuntimeException {\n schemaVersion: \"1.0\";\n id: string;\n rationale: string;\n impact: string;\n fallback: string;\n provenance: string;\n}\n\nfunction assertValid(\n kind: Parameters<typeof validateByKind>[0],\n data: unknown,\n file: string,\n): void {\n const diagnostics = validateByKind(kind, data, file);\n if (diagnostics.length) throw new DiagnosticError(diagnostics);\n}\n\nasync function canonicalRootFromRole(roleFile: string): Promise<string> {\n let current = dirname(roleFile);\n while (true) {\n try {\n await access(resolve(current, \"canonical/operations\"));\n await access(resolve(current, \"canonical/families\"));\n await access(resolve(current, \"canonical/roles\"));\n return current;\n } catch {\n const parent = dirname(current);\n if (parent === current) {\n throw new Error(`Unable to locate canonical library root from ${roleFile}`);\n }\n current = parent;\n }\n }\n}\n\nexport async function resolveSystem(file: string): Promise<ResolvedCapabilitySystem> {\n const root = await loadDocument(file);\n validateSystemManifest(root.data);\n assertValid(\"capability-system\", root.data, root.file);\n const base = dirname(root.file);\n const firstRole = root.data.roles[0];\n if (!firstRole) throw new Error(`${root.file}: capability system requires at least one role`);\n const canonicalRoot = await canonicalRootFromRole(resolve(base, firstRole));\n const library = await resolveContractLibrary(canonicalRoot);\n const roles = await Promise.all(\n root.data.roles.map(async (ref) => {\n const doc = await loadDocument<RoleDoc>(resolve(base, ref));\n assertValid(\"role\", doc.data, doc.file);\n const role = library.roles.find((candidate) => candidate.id === doc.data.id);\n if (!role) throw new Error(`Unknown canonical role ${doc.data.id}`);\n return role;\n }),\n );\n const runtimes = await Promise.all(\n root.data.runtimes.map(async (ref) => {\n const doc = await loadDocument<RuntimeDoc>(resolve(base, ref));\n assertValid(\"runtime-profile\", doc.data, doc.file);\n const rangeDiagnostics = validateCompatibilityRange(doc.data.compatibility);\n if (rangeDiagnostics.length) {\n throw new Error(`${doc.file}: ${rangeDiagnostics.join(\"; \")}`);\n }\n return Object.freeze({\n ...doc.data,\n capabilities: Object.freeze({ ...doc.data.capabilities }),\n supportedPrimitives: Object.freeze([...doc.data.supportedPrimitives]),\n unsupportedPrimitives: Object.freeze([...doc.data.unsupportedPrimitives]),\n limitations: Object.freeze([...doc.data.limitations]),\n provenance: Object.freeze({\n ...doc.data.provenance,\n sources: Object.freeze([...doc.data.provenance.sources]),\n }),\n compatibility: Object.freeze({\n ...doc.data.compatibility,\n testedVersions: Object.freeze([...doc.data.compatibility.testedVersions]),\n harness: Object.freeze({ ...doc.data.compatibility.harness }),\n approval: Object.freeze({ ...doc.data.compatibility.approval }),\n }),\n fallbacks: Object.freeze({ ...doc.data.fallbacks }),\n sourceFile: doc.file,\n });\n }),\n );\n const exceptions = await Promise.all(\n (root.data.exceptions ?? []).map(async (ref) => {\n const doc = await loadDocument<ExceptionDoc>(resolve(base, ref));\n assertValid(\"exception\", doc.data, doc.file);\n const diagnostics = validateExceptionPolicy(doc.data, doc.file);\n if (diagnostics.length) throw new DiagnosticError(diagnostics);\n return Object.freeze({\n id: doc.data.id,\n runtime: doc.data.runtime,\n scope: doc.data.scope,\n sourceFile: doc.file,\n });\n }),\n );\n return Object.freeze({\n id: root.data.id,\n sourceFile: root.file,\n roles: Object.freeze(roles.sort((a, b) => a.id.localeCompare(b.id))),\n runtimes: Object.freeze(runtimes.sort((a, b) => a.id.localeCompare(b.id))),\n exceptions: Object.freeze(exceptions.sort((a, b) => a.id.localeCompare(b.id))),\n });\n}\n", "import type { RuntimeCompatibility, TestedRuntimeVersion } from \"./types.js\";\n\nfunction parseVersion(version: string): readonly [number, number, number, string] {\n const match = /^(\\d+)\\.(\\d+)\\.(\\d+)(.*)$/.exec(version);\n if (!match) throw new Error(`Invalid semantic version: ${version}`);\n return [Number(match[1]), Number(match[2]), Number(match[3]), match[4] ?? \"\"];\n}\n\nfunction compareVersions(left: string, right: string): number {\n const [aMajor, aMinor, aPatch, aSuffix] = parseVersion(left);\n const [bMajor, bMinor, bPatch, bSuffix] = parseVersion(right);\n for (const delta of [aMajor - bMajor, aMinor - bMinor, aPatch - bPatch]) {\n if (delta !== 0) return delta;\n }\n return aSuffix.localeCompare(bSuffix);\n}\n\nexport interface EvidenceDerivedCompatibilityRange {\n readonly minimum: string | null;\n readonly maximum: string | null;\n readonly range: string | null;\n}\n\nexport function compatibilityRangeFromEvidence(\n testedVersions: readonly TestedRuntimeVersion[],\n): EvidenceDerivedCompatibilityRange {\n if (testedVersions.length === 0) {\n return Object.freeze({ minimum: null, maximum: null, range: null });\n }\n const versions = [...new Set(testedVersions.map((item) => item.version))].sort(compareVersions);\n const minimum = versions[0] ?? null;\n const maximum = versions.at(-1) ?? null;\n return Object.freeze({\n minimum,\n maximum,\n range: minimum && maximum ? `>=${minimum} <=${maximum}` : null,\n });\n}\n\nexport function validateCompatibilityRange(compatibility: RuntimeCompatibility): readonly string[] {\n const expected = compatibilityRangeFromEvidence(compatibility.testedVersions);\n const diagnostics: string[] = [];\n if (compatibility.minimumSupportedVersion !== expected.minimum) {\n diagnostics.push(\"minimum supported version does not match reviewed evidence\");\n }\n if (compatibility.maximumKnownCompatibleVersion !== expected.maximum) {\n diagnostics.push(\"maximum known compatible version does not match reviewed evidence\");\n }\n if (compatibility.maximumKnownCompatibleRange !== expected.range) {\n diagnostics.push(\"maximum known compatible range does not match reviewed evidence\");\n }\n return Object.freeze(diagnostics);\n}\n", "export interface OperationalSkillContract {\n readonly activation: readonly string[];\n readonly inputs: readonly string[];\n readonly procedure: readonly string[];\n readonly decisions: readonly string[];\n readonly resources: readonly string[];\n readonly ambiguityAndAbstention: readonly string[];\n readonly stopConditions: readonly string[];\n readonly outputConstruction: readonly string[];\n readonly validation: readonly string[];\n readonly examples: readonly string[];\n}\n\nexport const operationalSectionNames = Object.freeze([\n \"activation\",\n \"inputs\",\n \"procedure\",\n \"decisions\",\n \"resources\",\n \"ambiguityAndAbstention\",\n \"stopConditions\",\n \"outputConstruction\",\n \"validation\",\n \"examples\",\n] as const);\n\nexport function validateOperationalSkillContract(contract: OperationalSkillContract): void {\n for (const section of operationalSectionNames) {\n const entries = contract[section];\n if (!Array.isArray(entries) || entries.length === 0 || entries.some((entry) => !entry.trim())) {\n throw new Error(`Missing operational section: ${section}`);\n }\n }\n}\n", "import { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { parse } from \"yaml\";\nimport type { Effects, ResolvedRole, RuntimePrimitive, RuntimeProfileDefinition } from \"./types.js\";\n\nexport type CompatibilityDisposition =\n | \"static-passed\"\n | \"local-client-behavior-passed\"\n | \"hosted-certification-passed\"\n | \"failed\"\n | \"unsupported\"\n | \"unavailable\"\n | \"stale\"\n | \"reviewed-exception\";\n\nexport interface PrimitivePlan {\n readonly roleId: string;\n readonly runtimeId: RuntimeProfileDefinition[\"id\"];\n readonly behavioralCore: string;\n readonly primitive: RuntimePrimitive;\n readonly context: \"primary\" | \"isolated\" | \"forked\";\n readonly isolation: \"none\" | \"package\" | \"fork\";\n readonly permission: string;\n readonly fallback: string | null;\n readonly emittedFiles: readonly string[];\n readonly discovery: {\n readonly authoritativeNativeFiles: readonly string[];\n readonly portableEnvelopeFiles: readonly string[];\n };\n readonly effects: Effects;\n readonly compatibility: {\n readonly outcome: CompatibilityDisposition;\n readonly testedVersion: string | null;\n readonly harnessIdentity: string;\n readonly harnessEvidence: string;\n readonly approvalStatus: \"pending\" | \"approved\" | \"rejected\";\n };\n readonly provenance: readonly string[];\n readonly exceptionId: string | null;\n}\n\ninterface PrimitivePolicy {\n readonly familyPreferences: Readonly<Record<string, readonly RuntimePrimitive[]>>;\n readonly clients: Readonly<\n Record<\n string,\n {\n readonly root: string;\n readonly capabilities: readonly RuntimePrimitive[];\n readonly activation: Readonly<Record<string, string>>;\n readonly evidence: readonly string[];\n }\n >\n >;\n}\n\nlet cachedPolicy: PrimitivePolicy | undefined;\nexport function loadRuntimePrimitivePolicy(sourceFile?: string): PrimitivePolicy {\n const policyPath = sourceFile\n ? resolve(dirname(dirname(sourceFile)), \"runtime-primitive-policy.yaml\")\n : resolve(process.cwd(), \"canonical/runtime-primitive-policy.yaml\");\n cachedPolicy ??= parse(readFileSync(policyPath, \"utf8\")) as PrimitivePolicy;\n return cachedPolicy;\n}\n\nfunction plannedFiles(\n roleId: string,\n primitive: RuntimePrimitive,\n runtimeId: string,\n sourceFile?: string,\n): readonly string[] {\n const client = loadRuntimePrimitivePolicy(sourceFile).clients[runtimeId];\n if (!client) throw new Error(`Missing primitive policy client: ${runtimeId}`);\n const root = `${client.root.replace(/\\/$/, \"\")}/${roleId}`;\n const activation =\n primitive === \"skill\" ? undefined : client.activation[primitive]?.replace(\"{role}\", roleId);\n if (primitive !== \"skill\" && !activation)\n throw new Error(`Missing activation path for ${runtimeId}/${primitive}`);\n return Object.freeze([\n `${root}/SKILL.md`,\n `${root}/resources/contract.json`,\n `${root}/resources/evidence-ledger-1.0.schema.json`,\n `${root}/resources/evidence-ledger.schema.json`,\n `${root}/resources/output.schema.json`,\n `${root}/portable/registration.json`,\n `${root}/portable/permissions.json`,\n `${root}/capability.lock.json`,\n ...(activation ? [activation] : []),\n ]);\n}\n\nfunction plannedDiscovery(\n roleId: string,\n primitive: RuntimePrimitive,\n runtimeId: string,\n sourceFile?: string,\n): PrimitivePlan[\"discovery\"] {\n const client = loadRuntimePrimitivePolicy(sourceFile).clients[runtimeId];\n if (!client) throw new Error(`Missing primitive policy client: ${runtimeId}`);\n const root = `${client.root.replace(/\\/$/, \"\")}/${roleId}`;\n const activation =\n primitive === \"skill\" ? undefined : client.activation[primitive]?.replace(\"{role}\", roleId);\n const authoritativeNativeFiles = Object.freeze([\n `${root}/SKILL.md`,\n ...(activation ? [activation] : []),\n ]);\n const portableEnvelopeFiles = Object.freeze([\n `${root}/portable/registration.json`,\n `${root}/portable/permissions.json`,\n ]);\n return Object.freeze({ authoritativeNativeFiles, portableEnvelopeFiles });\n}\n\nexport function createPrimitivePlan(\n role: ResolvedRole,\n runtime: RuntimeProfileDefinition,\n): PrimitivePlan {\n const policy = loadRuntimePrimitivePolicy(role.sourceFile);\n const client = policy.clients[runtime.id];\n if (!client) throw new Error(`Missing primitive policy client: ${runtime.id}`);\n const candidates = policy.familyPreferences[role.family.id] ?? [\"skill\"];\n const preferred = candidates.find((primitive) => client.capabilities.includes(primitive));\n if (!preferred)\n throw new Error(`Runtime ${runtime.id} has no compatible primitive for ${role.id}`);\n if (!runtime.supportedPrimitives.includes(preferred))\n throw new Error(`Profile/policy capability drift: ${runtime.id}/${preferred}`);\n\n const testedVersion = runtime.compatibility.testedVersions[0]?.version ?? null;\n const outcome: CompatibilityDisposition =\n runtime.compatibility.outcome === \"supported\" &&\n runtime.compatibility.harness.availability === \"available\" &&\n testedVersion\n ? \"static-passed\"\n : runtime.compatibility.outcome === \"unsupported\"\n ? \"unsupported\"\n : \"unavailable\";\n const context: PrimitivePlan[\"context\"] =\n preferred === \"command\" || preferred === \"rule\"\n ? \"primary\"\n : preferred === \"agent\"\n ? \"forked\"\n : \"isolated\";\n const isolation: PrimitivePlan[\"isolation\"] =\n context === \"primary\" ? \"none\" : context === \"forked\" ? \"fork\" : \"package\";\n\n return Object.freeze({\n roleId: role.id,\n runtimeId: runtime.id,\n behavioralCore: `${client.root}/${role.id}/SKILL.md`,\n primitive: preferred,\n context,\n isolation,\n permission: runtime.permissionModel,\n fallback: preferred === \"skill\" ? null : (runtime.fallbacks[preferred] ?? \"skill-resource\"),\n emittedFiles: plannedFiles(role.id, preferred, runtime.id, role.sourceFile),\n discovery: plannedDiscovery(role.id, preferred, runtime.id, role.sourceFile),\n effects: role.effects,\n compatibility: Object.freeze({\n outcome,\n testedVersion,\n harnessIdentity: runtime.compatibility.harness.identity,\n harnessEvidence: runtime.compatibility.harness.evidence,\n approvalStatus: runtime.compatibility.approval.status,\n }),\n provenance: Object.freeze([...runtime.provenance.sources, ...client.evidence, role.sourceFile]),\n exceptionId: null,\n });\n}\n\nexport function validatePrimitivePlan(\n plan: PrimitivePlan,\n runtime: RuntimeProfileDefinition,\n): readonly string[] {\n const diagnostics: string[] = [];\n if (!runtime.supportedPrimitives.includes(plan.primitive))\n diagnostics.push(`unsupported primitive: ${plan.primitive}`);\n if (plan.compatibility.outcome.endsWith(\"-passed\") && !plan.compatibility.testedVersion)\n diagnostics.push(\"passed plan missing exact tested version\");\n if (!plan.compatibility.harnessIdentity || !plan.compatibility.harnessEvidence)\n diagnostics.push(\"missing harness provenance\");\n if (\n plan.compatibility.outcome !== \"static-passed\" &&\n plan.compatibility.outcome.endsWith(\"-passed\")\n )\n diagnostics.push(\"profile-derived plan cannot claim behavioral evidence\");\n if (plan.exceptionId && plan.compatibility.approvalStatus !== \"approved\")\n diagnostics.push(\"unapproved exception\");\n if (runtime.supportedPrimitives.includes(plan.primitive)) {\n const expected = plannedFiles(plan.roleId, plan.primitive, runtime.id);\n if (JSON.stringify(plan.emittedFiles) !== JSON.stringify(expected))\n diagnostics.push(\"planned emitted files do not match governed policy\");\n const discovery = plannedDiscovery(plan.roleId, plan.primitive, runtime.id);\n if (\n JSON.stringify(plan.discovery.authoritativeNativeFiles) !==\n JSON.stringify(discovery.authoritativeNativeFiles)\n )\n diagnostics.push(\"authoritative native discovery files do not match governed policy\");\n if (\n JSON.stringify(plan.discovery.portableEnvelopeFiles) !==\n JSON.stringify(discovery.portableEnvelopeFiles)\n )\n diagnostics.push(\"portable envelope files do not match governed policy\");\n if (\n plan.discovery.authoritativeNativeFiles.some((path) =>\n plan.discovery.portableEnvelopeFiles.includes(path),\n )\n )\n diagnostics.push(\"portable envelope mislabeled as authoritative native discovery\");\n for (const path of [\n ...plan.discovery.authoritativeNativeFiles,\n ...plan.discovery.portableEnvelopeFiles,\n ]) {\n if (!plan.emittedFiles.includes(path))\n diagnostics.push(`discovery file is not emitted: ${path}`);\n }\n }\n return diagnostics;\n}\n", "import { readFile } from \"node:fs/promises\";\nimport { extname, resolve } from \"node:path\";\nimport { parseDocument } from \"yaml\";\n\nexport interface SourceDocument<T = unknown> {\n readonly file: string;\n readonly data: T;\n}\n\nexport async function loadDocument<T = unknown>(file: string): Promise<SourceDocument<T>> {\n const absolute = resolve(file);\n const text = await readFile(absolute, \"utf8\");\n if (extname(absolute).toLowerCase() === \".json\") {\n return { file: absolute, data: JSON.parse(text) as T };\n }\n const document = parseDocument(text, { prettyErrors: true, strict: true });\n if (document.errors.length > 0) throw document.errors[0];\n return { file: absolute, data: document.toJS({ maxAliasCount: 0 }) as T };\n}\n", "import commander from './index.js';\n\n// wrapper to provide named exports for ESM.\nexport const {\n program,\n createCommand,\n createArgument,\n createOption,\n CommanderError,\n InvalidArgumentError,\n InvalidOptionArgumentError, // deprecated old name\n Command,\n Argument,\n Option,\n Help,\n} = commander;\n", "import { chmod, copyFile, lstat, mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport type {\n CapabilityLock,\n InstallationEntry,\n InstallationManifest,\n InstallationResult,\n InstallationState,\n InstalledPackageIdentity,\n} from \"@portable-capabilities/contracts\";\nimport {\n classifyManifestEntries,\n digestFile,\n entryFor,\n installationManifestName,\n installationOwnershipDigest,\n journalPath,\n manifestPath,\n packageEntriesDigest,\n readInstallationManifest,\n writeInstallationManifest,\n} from \"./manifest.js\";\nimport { listPackageFiles, preflightInstallation } from \"./preflight.js\";\n\nexport type LifecycleFaultPoint =\n | \"after-stage\"\n | \"after-backup\"\n | \"after-write\"\n | \"after-remove\"\n | \"after-manifest\"\n | \"during-rollback\";\n\nexport interface LifecycleOptions {\n readonly sourceRoot: string;\n readonly targetRoot: string;\n readonly runtimeId: string;\n readonly packageVersion: string;\n readonly capabilityIds?: readonly string[];\n readonly allCapabilities?: boolean;\n readonly dryRun?: boolean;\n readonly faultInjector?: (point: LifecycleFaultPoint, path?: string) => void | Promise<void>;\n}\n\ninterface TransactionMutation {\n readonly path: string;\n readonly kind: \"write\" | \"remove\";\n readonly hadOriginal: boolean;\n}\n\ninterface TransactionJournal {\n readonly schemaVersion: \"1.0\";\n readonly operation: InstallationResult[\"operation\"];\n readonly state: \"started\" | \"committed\" | \"rolled-back\" | \"rollback-failed\";\n readonly updatedAt: string;\n readonly transactionRoot?: string;\n readonly mutations?: readonly TransactionMutation[];\n readonly manifestHadOriginal?: boolean;\n}\n\ninterface ReconcilePlan {\n readonly writes: readonly InstallationEntry[];\n readonly removes: readonly string[];\n readonly preserved: readonly string[];\n readonly nextManifest?: InstallationManifest;\n}\n\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await lstat(path);\n return true;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return false;\n throw error;\n }\n}\n\nasync function inject(\n options: Pick<LifecycleOptions, \"faultInjector\">,\n point: LifecycleFaultPoint,\n path?: string,\n): Promise<void> {\n await options.faultInjector?.(point, path);\n}\n\nasync function writeJournal(\n targetRoot: string,\n journal: Omit<TransactionJournal, \"schemaVersion\" | \"updatedAt\">,\n): Promise<void> {\n await mkdir(targetRoot, { recursive: true });\n const path = journalPath(targetRoot);\n const temporary = `${path}.tmp-${process.pid}`;\n await writeFile(\n temporary,\n `${JSON.stringify({\n schemaVersion: \"1.0\",\n ...journal,\n updatedAt: new Date().toISOString(),\n } satisfies TransactionJournal)}\\n`,\n );\n await rename(temporary, path);\n}\n\nasync function copyAtomically(source: string, target: string, mode: number): Promise<void> {\n await mkdir(dirname(target), { recursive: true });\n const temporary = `${target}.pc-stage-${process.pid}`;\n await copyFile(source, temporary);\n await chmod(temporary, mode);\n await rename(temporary, target);\n}\n\nasync function desiredEntries(\n sourceRoot: string,\n files: readonly string[],\n): Promise<InstallationEntry[]> {\n const entries: InstallationEntry[] = [];\n for (const file of files) entries.push(await entryFor(join(sourceRoot, file), file));\n return entries;\n}\n\nasync function selectedPackageFiles(options: LifecycleOptions): Promise<readonly string[]> {\n const files = await listPackageFiles(options.sourceRoot);\n const capabilityIds = Object.freeze(\n [...new Set(options.capabilityIds ?? [])].sort((left, right) => left.localeCompare(right)),\n );\n if (options.allCapabilities && capabilityIds.length > 0) {\n throw new Error(\"Choose either all capabilities or a capability subset, not both\");\n }\n if (options.allCapabilities || capabilityIds.length === 0) return files;\n\n const packages: Array<{\n readonly roleId: string;\n readonly runtimeId: string;\n readonly root: string;\n }> = [];\n for (const lockPath of files.filter((path) => path.endsWith(\"/capability.lock.json\"))) {\n const lock = JSON.parse(\n await readFile(join(options.sourceRoot, lockPath), \"utf8\"),\n ) as CapabilityLock;\n if (lock.schemaVersion !== \"2.0.0\" || !lock.roleId || !lock.runtimeId) {\n throw new Error(`Invalid capability package identity: ${lockPath}`);\n }\n packages.push({ roleId: lock.roleId, runtimeId: lock.runtimeId, root: dirname(lockPath) });\n }\n if (packages.length === 0) {\n throw new Error(\"Capability subset selection requires capability.lock.json package identities\");\n }\n for (const capabilityId of capabilityIds) {\n const candidates = packages.filter(\n (item) => item.runtimeId === options.runtimeId && item.roleId === capabilityId,\n );\n if (candidates.length > 1) {\n throw new Error(\n `Ambiguous capability for runtime ${options.runtimeId}: ${capabilityId} (${candidates.length} packages)`,\n );\n }\n }\n\n const matching = packages.filter(\n (item) => item.runtimeId === options.runtimeId && capabilityIds.includes(item.roleId),\n );\n const matchedIds = new Set(matching.map((item) => item.roleId));\n const missing = capabilityIds.filter((id) => !matchedIds.has(id));\n if (missing.length > 0) {\n throw new Error(`Unknown capabilities for runtime ${options.runtimeId}: ${missing.join(\", \")}`);\n }\n\n const allRoots = packages.map((item) => item.root);\n const selectedRoots = new Set(matching.map((item) => item.root));\n return Object.freeze(\n files.filter((path) => {\n const packageRoot = allRoots.find((root) => path === root || path.startsWith(`${root}/`));\n return packageRoot === undefined || selectedRoots.has(packageRoot);\n }),\n );\n}\n\nasync function installedPackageIdentities(\n sourceRoot: string,\n entries: readonly InstallationEntry[],\n): Promise<readonly InstalledPackageIdentity[]> {\n const identities: InstalledPackageIdentity[] = [];\n for (const entry of entries.filter((item) => item.path.endsWith(\"/capability.lock.json\"))) {\n const lock = JSON.parse(await readFile(join(sourceRoot, entry.path), \"utf8\")) as CapabilityLock;\n if (\n lock.schemaVersion !== \"2.0.0\" ||\n !lock.integrity?.package?.digest ||\n lock.generatedDigest !== lock.integrity.package.digest\n ) {\n throw new Error(`Invalid capability package identity: ${entry.path}`);\n }\n identities.push({\n lockPath: entry.path,\n roleId: lock.roleId,\n runtimeId: lock.runtimeId,\n packageDigest: lock.integrity.package.digest,\n });\n }\n return Object.freeze(\n identities.sort((left, right) => left.lockPath.localeCompare(right.lockPath)),\n );\n}\n\nfunction result(\n operation: InstallationResult[\"operation\"],\n state: InstallationState,\n values: Partial<InstallationResult> = {},\n): InstallationResult {\n return {\n operation,\n ok: values.ok ?? true,\n dryRun: values.dryRun ?? false,\n state,\n collisions: values.collisions ?? [],\n installed: values.installed ?? [],\n preserved: values.preserved ?? [],\n removed: values.removed ?? [],\n diagnostics: values.diagnostics ?? [],\n ...(values.manifest ? { manifest: values.manifest } : {}),\n };\n}\n\nasync function planReconciliation(\n options: LifecycleOptions,\n manifest: InstallationManifest | undefined,\n desired: readonly InstallationEntry[],\n): Promise<ReconcilePlan> {\n const classifications = manifest\n ? await classifyManifestEntries(manifest)\n : { unchanged: [], modified: [], missing: [] };\n const packageIdentities = await installedPackageIdentities(options.sourceRoot, desired);\n const unchanged = new Set(classifications.unchanged.map((entry) => entry.path));\n const modified = new Set(classifications.modified.map((entry) => entry.path));\n const missing = new Set(classifications.missing.map((entry) => entry.path));\n const desiredPaths = new Set(desired.map((entry) => entry.path));\n const writes: InstallationEntry[] = [];\n const removes: string[] = [];\n const preserved: string[] = [];\n const nextEntries: InstallationEntry[] = [];\n\n for (const entry of desired) {\n if (modified.has(entry.path)) {\n preserved.push(entry.path);\n const previous = manifest?.entries.find((item) => item.path === entry.path);\n if (previous) nextEntries.push(previous);\n continue;\n }\n let currentDigest: string | undefined;\n try {\n currentDigest = await digestFile(join(options.targetRoot, entry.path));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n if (currentDigest !== entry.digest) writes.push(entry);\n nextEntries.push(entry);\n }\n\n for (const previous of manifest?.entries ?? []) {\n if (desiredPaths.has(previous.path) || missing.has(previous.path)) continue;\n if (unchanged.has(previous.path)) removes.push(previous.path);\n else {\n preserved.push(previous.path);\n nextEntries.push(previous);\n }\n }\n\n const unchangedReinstall =\n manifest !== undefined &&\n writes.length === 0 &&\n removes.length === 0 &&\n preserved.length === 0 &&\n manifest.runtimeId === options.runtimeId &&\n manifest.packageVersion === options.packageVersion;\n const sortedEntries = Object.freeze(\n nextEntries.sort((left, right) => left.path.localeCompare(right.path)),\n );\n const packageDigest = packageEntriesDigest(sortedEntries, packageIdentities);\n const manifestBase = {\n runtimeId: options.runtimeId,\n packageVersion: options.packageVersion,\n targetRoot: options.targetRoot,\n journalVersion: \"1.0\" as const,\n lifecycleState: preserved.length ? (\"modified\" as const) : (\"healthy\" as const),\n packageIdentities,\n entries: sortedEntries,\n };\n const nextManifest: InstallationManifest = unchangedReinstall\n ? manifest\n : {\n schemaVersion: \"1.1.0\",\n ...manifestBase,\n installedAt: new Date().toISOString(),\n packageDigest,\n installationDigest: installationOwnershipDigest(packageDigest, manifestBase),\n };\n return { writes, removes, preserved, nextManifest };\n}\n\nasync function backupPath(\n targetRoot: string,\n transactionRoot: string,\n path: string,\n): Promise<boolean> {\n const source = join(targetRoot, path);\n if (!(await pathExists(source))) return false;\n const target = join(transactionRoot, \"backup\", path);\n await mkdir(dirname(target), { recursive: true });\n await copyFile(source, target);\n return true;\n}\n\nasync function restoreTransaction(\n targetRoot: string,\n transactionRoot: string,\n mutations: readonly TransactionMutation[],\n manifestHadOriginal: boolean,\n options: Pick<LifecycleOptions, \"faultInjector\">,\n): Promise<void> {\n for (const mutation of [...mutations].reverse()) {\n await inject(options, \"during-rollback\", mutation.path);\n const target = join(targetRoot, mutation.path);\n const backup = join(transactionRoot, \"backup\", mutation.path);\n if (mutation.hadOriginal) {\n await copyAtomically(backup, target, (await lstat(backup)).mode & 0o777);\n if ((await digestFile(target)) !== (await digestFile(backup))) {\n throw new Error(`Rollback verification failed: ${mutation.path}`);\n }\n } else {\n await rm(target, { force: true });\n }\n }\n\n const manifestTarget = manifestPath(targetRoot);\n const manifestBackup = join(transactionRoot, \"manifest.backup\");\n if (manifestHadOriginal) {\n await copyAtomically(\n manifestBackup,\n manifestTarget,\n (await lstat(manifestBackup)).mode & 0o777,\n );\n if ((await digestFile(manifestTarget)) !== (await digestFile(manifestBackup))) {\n throw new Error(\"Rollback verification failed: installation manifest\");\n }\n } else {\n await rm(manifestTarget, { force: true });\n }\n}\n\nasync function commitPlan(\n operation: InstallationResult[\"operation\"],\n options: LifecycleOptions,\n plan: ReconcilePlan,\n): Promise<InstallationResult> {\n if (\n plan.nextManifest &&\n plan.writes.length === 0 &&\n plan.removes.length === 0 &&\n plan.preserved.length === 0 &&\n (await readInstallationManifest(options.targetRoot)) === plan.nextManifest\n ) {\n return result(operation, plan.nextManifest.lifecycleState, { manifest: plan.nextManifest });\n }\n\n await mkdir(options.targetRoot, { recursive: true });\n const transactionRoot = join(\n options.targetRoot,\n `.portable-capabilities-transaction-${process.pid}-${Date.now()}`,\n );\n const mutations: TransactionMutation[] = [];\n const manifestHadOriginal = await pathExists(manifestPath(options.targetRoot));\n await mkdir(join(transactionRoot, \"stage\"), { recursive: true });\n\n try {\n for (const entry of plan.writes) {\n const staged = join(transactionRoot, \"stage\", entry.path);\n await mkdir(dirname(staged), { recursive: true });\n await copyFile(join(options.sourceRoot, entry.path), staged);\n await chmod(staged, entry.mode);\n await inject(options, \"after-stage\", entry.path);\n }\n\n const plannedPaths = [\n ...plan.writes.map((entry) => ({ path: entry.path, kind: \"write\" as const })),\n ...plan.removes.map((path) => ({ path, kind: \"remove\" as const })),\n ];\n for (const planned of plannedPaths) {\n const hadOriginal = await backupPath(options.targetRoot, transactionRoot, planned.path);\n mutations.push({ ...planned, hadOriginal });\n await inject(options, \"after-backup\", planned.path);\n }\n if (manifestHadOriginal) {\n await copyFile(manifestPath(options.targetRoot), join(transactionRoot, \"manifest.backup\"));\n }\n\n await writeJournal(options.targetRoot, {\n operation,\n state: \"started\",\n transactionRoot,\n mutations,\n manifestHadOriginal,\n });\n\n for (const entry of plan.writes) {\n const staged = join(transactionRoot, \"stage\", entry.path);\n const target = join(options.targetRoot, entry.path);\n await mkdir(dirname(target), { recursive: true });\n await rename(staged, target);\n await inject(options, \"after-write\", entry.path);\n }\n for (const path of plan.removes) {\n await rm(join(options.targetRoot, path), { force: true });\n await inject(options, \"after-remove\", path);\n }\n\n if (plan.nextManifest) await writeInstallationManifest(plan.nextManifest);\n else await rm(manifestPath(options.targetRoot), { force: true });\n await inject(options, \"after-manifest\", installationManifestName);\n await writeJournal(options.targetRoot, { operation, state: \"committed\" });\n await rm(transactionRoot, { recursive: true, force: true });\n return result(operation, plan.nextManifest?.lifecycleState ?? \"removed\", {\n installed: plan.writes.map((entry) => entry.path),\n preserved: plan.preserved,\n removed: plan.removes,\n ...(plan.nextManifest ? { manifest: plan.nextManifest } : {}),\n });\n } catch (error) {\n try {\n await restoreTransaction(\n options.targetRoot,\n transactionRoot,\n mutations,\n manifestHadOriginal,\n options,\n );\n await writeJournal(options.targetRoot, { operation, state: \"rolled-back\" });\n await rm(transactionRoot, { recursive: true, force: true });\n return result(operation, \"interrupted\", {\n ok: false,\n diagnostics: [(error as Error).message, \"transaction restored and verified\"],\n });\n } catch (rollbackError) {\n await writeJournal(options.targetRoot, {\n operation,\n state: \"rollback-failed\",\n transactionRoot,\n mutations,\n manifestHadOriginal,\n });\n return result(operation, \"interrupted\", {\n ok: false,\n diagnostics: [\n (error as Error).message,\n `rollback failed: ${(rollbackError as Error).message}`,\n ],\n });\n }\n }\n}\n\nexport async function installPackage(options: LifecycleOptions): Promise<InstallationResult> {\n return reconcilePackage(\"install\", options);\n}\n\nexport async function upgradePackage(options: LifecycleOptions): Promise<InstallationResult> {\n return reconcilePackage(\"upgrade\", options);\n}\n\nexport async function downgradePackage(options: LifecycleOptions): Promise<InstallationResult> {\n return reconcilePackage(\"downgrade\", options);\n}\n\nasync function reconcilePackage(\n operation: \"install\" | \"upgrade\" | \"downgrade\",\n options: LifecycleOptions,\n): Promise<InstallationResult> {\n let manifest: InstallationManifest | undefined;\n try {\n manifest = await readInstallationManifest(options.targetRoot);\n } catch (error) {\n return result(operation, \"stale-manifest\", {\n ok: false,\n dryRun: Boolean(options.dryRun),\n diagnostics: [(error as Error).message],\n });\n }\n\n let files: readonly string[];\n try {\n files = await selectedPackageFiles(options);\n } catch (error) {\n return result(operation, \"degraded\", {\n ok: false,\n dryRun: Boolean(options.dryRun),\n diagnostics: [(error as Error).message],\n });\n }\n\n const preflight = await preflightInstallation({\n sourceRoot: options.sourceRoot,\n targetRoot: options.targetRoot,\n files,\n ...(manifest ? { manifest } : {}),\n });\n if (preflight.collisions.length) {\n return result(operation, \"degraded\", {\n ok: false,\n dryRun: Boolean(options.dryRun),\n collisions: preflight.collisions,\n });\n }\n\n const desired = await desiredEntries(options.sourceRoot, preflight.files);\n const plan = await planReconciliation(options, manifest, desired);\n if (options.dryRun) {\n return result(operation, manifest ? \"healthy\" : \"missing\", {\n dryRun: true,\n installed: plan.writes.map((entry) => entry.path),\n preserved: plan.preserved,\n removed: plan.removes,\n ...(manifest ? { manifest } : {}),\n });\n }\n return commitPlan(operation, options, plan);\n}\n\nexport async function statusInstallation(targetRoot: string): Promise<InstallationResult> {\n let manifest: InstallationManifest | undefined;\n try {\n manifest = await readInstallationManifest(targetRoot);\n } catch (error) {\n return result(\"status\", \"stale-manifest\", {\n ok: false,\n diagnostics: [(error as Error).message],\n });\n }\n if (!manifest) return result(\"status\", \"missing\", { ok: false });\n const classifications = await classifyManifestEntries(manifest);\n const state: InstallationState = classifications.modified.length\n ? \"modified\"\n : classifications.missing.length\n ? \"degraded\"\n : \"healthy\";\n return result(\"status\", state, {\n ok: state === \"healthy\",\n preserved: classifications.modified.map((entry) => entry.path),\n diagnostics: classifications.missing.map((entry) => `missing: ${entry.path}`),\n manifest,\n });\n}\n\nexport async function removeInstallation(\n targetRoot: string,\n faultInjector?: LifecycleOptions[\"faultInjector\"],\n): Promise<InstallationResult> {\n const manifest = await readInstallationManifest(targetRoot);\n if (!manifest) return result(\"remove\", \"missing\", { ok: false });\n const classifications = await classifyManifestEntries(manifest);\n const unchanged = new Set(classifications.unchanged.map((entry) => entry.path));\n const removes = manifest.entries\n .filter((entry) => unchanged.has(entry.path))\n .map((entry) => entry.path);\n const preserved = manifest.entries.filter((entry) => !unchanged.has(entry.path));\n const nextManifest: InstallationManifest | undefined = preserved.length\n ? (() => {\n const entries = Object.freeze(preserved);\n const preservedPaths = new Set(entries.map((entry) => entry.path));\n const packageIdentities = Object.freeze(\n manifest.packageIdentities.filter((identity) => preservedPaths.has(identity.lockPath)),\n );\n const packageDigest = packageEntriesDigest(entries, packageIdentities);\n const base = {\n runtimeId: manifest.runtimeId,\n packageVersion: manifest.packageVersion,\n targetRoot: manifest.targetRoot,\n journalVersion: manifest.journalVersion,\n lifecycleState: \"modified\" as const,\n packageIdentities,\n entries,\n };\n return {\n ...manifest,\n ...base,\n packageDigest,\n installationDigest: installationOwnershipDigest(packageDigest, base),\n };\n })()\n : undefined;\n return commitPlan(\n \"remove\",\n {\n sourceRoot: targetRoot,\n targetRoot,\n runtimeId: manifest.runtimeId,\n packageVersion: manifest.packageVersion,\n ...(faultInjector ? { faultInjector } : {}),\n },\n {\n writes: [],\n removes,\n preserved: preserved.map((entry) => entry.path),\n ...(nextManifest ? { nextManifest } : {}),\n },\n );\n}\n\nexport async function recoverInstallation(targetRoot: string): Promise<InstallationResult> {\n try {\n const journal = JSON.parse(\n await readFile(journalPath(targetRoot), \"utf8\"),\n ) as TransactionJournal;\n if (\n (journal.state === \"started\" || journal.state === \"rollback-failed\") &&\n journal.transactionRoot &&\n journal.mutations\n ) {\n await restoreTransaction(\n targetRoot,\n journal.transactionRoot,\n journal.mutations,\n journal.manifestHadOriginal ?? false,\n {},\n );\n await writeJournal(targetRoot, { operation: \"recover\", state: \"rolled-back\" });\n await rm(journal.transactionRoot, { recursive: true, force: true });\n }\n const status = await statusInstallation(targetRoot);\n return { ...status, operation: \"recover\" };\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return result(\"recover\", \"missing\", { ok: false });\n }\n return result(\"recover\", \"interrupted\", {\n ok: false,\n diagnostics: [(error as Error).message],\n });\n }\n}\n", "import { createHash } from \"node:crypto\";\nimport { mkdir, readFile, rename, stat, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport type {\n InstallationEntry,\n InstallationManifest,\n InstalledPackageIdentity,\n} from \"@portable-capabilities/contracts\";\n\nexport const installationManifestName = \".portable-capabilities-manifest.json\";\nexport const installationJournalName = \".portable-capabilities-journal.json\";\n\nexport function digestBytes(bytes: Uint8Array): string {\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nfunction normalizeDigestValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(normalizeDigestValue);\n if (value && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .filter(([, item]) => item !== undefined)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, item]) => [key, normalizeDigestValue(item)]),\n );\n }\n return value;\n}\n\nfunction stableManifestDigest(value: unknown): string {\n return digestBytes(new TextEncoder().encode(JSON.stringify(normalizeDigestValue(value))));\n}\n\nexport function packageEntriesDigest(\n entries: readonly InstallationEntry[],\n packageIdentities: readonly InstalledPackageIdentity[] = [],\n): string {\n return stableManifestDigest({\n entries: [...entries]\n .sort((left, right) => left.path.localeCompare(right.path))\n .map((entry) => ({ path: entry.path, digest: entry.digest, mode: entry.mode })),\n packageIdentities: [...packageIdentities].sort((left, right) =>\n left.lockPath.localeCompare(right.lockPath),\n ),\n });\n}\n\nexport function installationOwnershipDigest(\n packageDigest: string,\n manifest: Pick<\n InstallationManifest,\n | \"runtimeId\"\n | \"packageVersion\"\n | \"targetRoot\"\n | \"journalVersion\"\n | \"lifecycleState\"\n | \"packageIdentities\"\n | \"entries\"\n >,\n): string {\n return stableManifestDigest({\n parent: packageDigest,\n inputs: {\n runtimeId: manifest.runtimeId,\n packageVersion: manifest.packageVersion,\n targetRoot: manifest.targetRoot,\n journalVersion: manifest.journalVersion,\n lifecycleState: manifest.lifecycleState,\n packageIdentities: [...manifest.packageIdentities].sort((left, right) =>\n left.lockPath.localeCompare(right.lockPath),\n ),\n entries: [...manifest.entries].sort((left, right) => left.path.localeCompare(right.path)),\n },\n });\n}\n\nexport function verifyInstallationManifestDigest(manifest: InstallationManifest): void {\n const packageDigest = packageEntriesDigest(manifest.entries, manifest.packageIdentities);\n if (manifest.packageDigest !== packageDigest) {\n throw new Error(\"Installation package digest mismatch\");\n }\n const installationDigest = installationOwnershipDigest(packageDigest, manifest);\n if (manifest.installationDigest !== installationDigest) {\n throw new Error(\"Installation manifest digest mismatch\");\n }\n}\n\nexport async function digestFile(path: string): Promise<string> {\n return digestBytes(await readFile(path));\n}\n\nexport function manifestPath(targetRoot: string): string {\n return join(targetRoot, installationManifestName);\n}\n\nexport function journalPath(targetRoot: string): string {\n return join(targetRoot, installationJournalName);\n}\n\nexport async function readInstallationManifest(\n targetRoot: string,\n): Promise<InstallationManifest | undefined> {\n try {\n const parsed = JSON.parse(\n await readFile(manifestPath(targetRoot), \"utf8\"),\n ) as InstallationManifest;\n if (parsed.schemaVersion !== \"1.1.0\" || !Array.isArray(parsed.entries)) {\n throw new Error(\"Invalid installation manifest shape\");\n }\n verifyInstallationManifestDigest(parsed);\n return parsed;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return undefined;\n throw error;\n }\n}\n\nexport async function writeInstallationManifest(manifest: InstallationManifest): Promise<void> {\n const path = manifestPath(manifest.targetRoot);\n await mkdir(dirname(path), { recursive: true });\n const temporary = `${path}.tmp-${process.pid}`;\n await writeFile(temporary, `${JSON.stringify(manifest, null, 2)}\\n`);\n await rename(temporary, path);\n}\n\nexport async function classifyManifestEntries(manifest: InstallationManifest): Promise<{\n readonly unchanged: readonly InstallationEntry[];\n readonly modified: readonly InstallationEntry[];\n readonly missing: readonly InstallationEntry[];\n}> {\n const unchanged: InstallationEntry[] = [];\n const modified: InstallationEntry[] = [];\n const missing: InstallationEntry[] = [];\n for (const entry of manifest.entries) {\n const path = join(manifest.targetRoot, entry.path);\n try {\n const current = await digestFile(path);\n if (current === entry.digest) unchanged.push(entry);\n else modified.push(entry);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") missing.push(entry);\n else throw error;\n }\n }\n return {\n unchanged: Object.freeze(unchanged),\n modified: Object.freeze(modified),\n missing: Object.freeze(missing),\n };\n}\n\nexport async function entryFor(path: string, relativePath: string): Promise<InstallationEntry> {\n const metadata = await stat(path);\n return Object.freeze({\n path: relativePath,\n digest: await digestFile(path),\n mode: metadata.mode & 0o777,\n });\n}\n", "import { constants } from \"node:fs\";\nimport { access, lstat, readdir } from \"node:fs/promises\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport type { InstallationCollision, InstallationManifest } from \"@portable-capabilities/contracts\";\nimport { installationJournalName, installationManifestName } from \"./manifest.js\";\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await lstat(path);\n return true;\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === \"ENOENT\" || code === \"ENOTDIR\") return false;\n throw error;\n }\n}\n\nexport async function listPackageFiles(root: string, current = root): Promise<readonly string[]> {\n const files: string[] = [];\n for (const entry of await readdir(current, { withFileTypes: true })) {\n if ([installationManifestName, installationJournalName].includes(entry.name)) continue;\n const path = join(current, entry.name);\n if (entry.isSymbolicLink()) throw new Error(`Package source contains symlink: ${path}`);\n if (entry.isDirectory()) files.push(...(await listPackageFiles(root, path)));\n else if (entry.isFile()) files.push(relative(root, path).replaceAll(\"\\\\\", \"/\"));\n }\n return Object.freeze(files.sort());\n}\n\nasync function nearestExisting(path: string): Promise<string> {\n let current = resolve(path);\n while (!(await exists(current))) {\n const parent = dirname(current);\n if (parent === current) return current;\n current = parent;\n }\n return current;\n}\n\nasync function symlinkCollision(targetRoot: string): Promise<InstallationCollision | undefined> {\n let current = resolve(targetRoot);\n const target = current;\n while (true) {\n if (await exists(current)) {\n const metadata = await lstat(current);\n if (metadata.isSymbolicLink()) {\n return {\n code: current === target ? \"TARGET_SYMLINK\" : \"ANCESTOR_SYMLINK\",\n path: current,\n message: \"Installation target may not traverse a symlink.\",\n };\n }\n }\n const parent = dirname(current);\n if (parent === current) return undefined;\n current = parent;\n }\n}\n\nexport async function preflightInstallation(options: {\n readonly sourceRoot: string;\n readonly targetRoot: string;\n readonly manifest?: InstallationManifest;\n readonly files?: readonly string[];\n}): Promise<{\n readonly files: readonly string[];\n readonly collisions: readonly InstallationCollision[];\n}> {\n const files = options.files ?? (await listPackageFiles(options.sourceRoot));\n const collisions: InstallationCollision[] = [];\n const symlink = await symlinkCollision(options.targetRoot);\n if (symlink) collisions.push(symlink);\n\n const writableRoot = await nearestExisting(options.targetRoot);\n try {\n await access(writableRoot, constants.W_OK);\n } catch {\n collisions.push({\n code: \"READ_ONLY_TARGET\",\n path: writableRoot,\n message: \"Installation target is not writable.\",\n });\n }\n\n const caseMap = new Map<string, string>();\n const owned = new Set(options.manifest?.entries.map((entry) => entry.path) ?? []);\n for (const file of files) {\n const folded = file.toLocaleLowerCase(\"en-US\");\n const prior = caseMap.get(folded);\n if (prior && prior !== file) {\n collisions.push({\n code: \"CASE_COLLISION\",\n path: file,\n message: `Package paths differ only by case: ${prior} and ${file}`,\n });\n } else caseMap.set(folded, file);\n\n const segments = file.split(\"/\");\n let blockedByPathType = false;\n for (let index = 1; index < segments.length; index += 1) {\n const ancestor = join(options.targetRoot, ...segments.slice(0, index));\n if (await exists(ancestor)) {\n const metadata = await lstat(ancestor);\n if (!metadata.isDirectory()) {\n collisions.push({\n code: \"PATH_TYPE_COLLISION\",\n path: file,\n message: `Target ancestor is not a directory: ${ancestor}`,\n });\n blockedByPathType = true;\n break;\n }\n }\n }\n if (blockedByPathType) continue;\n\n const target = join(options.targetRoot, file);\n if (!(await exists(target))) continue;\n const sourceMetadata = await lstat(join(options.sourceRoot, file));\n const targetMetadata = await lstat(target);\n if (sourceMetadata.isFile() !== targetMetadata.isFile()) {\n collisions.push({\n code: \"PATH_TYPE_COLLISION\",\n path: file,\n message: \"Source and target path types differ.\",\n });\n } else if (!owned.has(file)) {\n collisions.push({\n code: \"UNMANAGED_COLLISION\",\n path: file,\n message: \"Target path exists but is not owned by the installation manifest.\",\n });\n }\n }\n\n return { files, collisions: Object.freeze(collisions) };\n}\n", "import { createHash } from \"node:crypto\";\nimport { constants } from \"node:fs\";\nimport { access, appendFile, lstat, mkdir, readdir, readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type {\n InvocationRequest,\n InvocationResult,\n InvocationSandboxEvidence,\n} from \"@portable-capabilities/contracts\";\nimport { execa } from \"execa\";\n\nconst bubblewrapExecutable = \"/usr/bin/bwrap\";\nfunction inheritedPath(): string | undefined {\n // biome-ignore lint/complexity/useLiteralKeys: ProcessEnv is an index signature under noPropertyAccessFromIndexSignature.\n return process.env[\"PATH\"];\n}\n\nconst sandboxEvidence: InvocationSandboxEvidence = Object.freeze({\n identity: \"bubblewrap\",\n executable: bubblewrapExecutable,\n policy: \"host-read-only-private-tmp\",\n consumerMount: \"/mnt\",\n hostFilesystemReadOnly: true,\n privateTmp: true,\n sourceWorkspaceHidden: true,\n childProcessesConfined: true,\n});\n\nfunction assertSafe(request: InvocationRequest): void {\n if (request.effects.shell !== \"denied\" || request.effects.repositoryWrites !== \"denied\") {\n throw new Error(\"Invocation requires denied shell and repository-write effects\");\n }\n if (request.effects.filesystem !== \"read-only\") {\n throw new Error(\"Invocation requires a read-only filesystem effect\");\n }\n if (request.timeoutMs <= 0 || request.timeoutMs > 120_000) {\n throw new Error(\"Invalid invocation timeout\");\n }\n}\n\nasync function assertSandboxAvailable(): Promise<void> {\n try {\n await access(bubblewrapExecutable, constants.X_OK);\n } catch {\n throw new Error(`Required invocation sandbox is unavailable: ${bubblewrapExecutable}`);\n }\n}\n\nasync function assertNoSymlinks(current: string): Promise<void> {\n for (const entry of await readdir(current, { withFileTypes: true })) {\n const path = join(current, entry.name);\n const stat = await lstat(path);\n if (stat.isSymbolicLink()) throw new Error(`Invocation root contains symlink: ${path}`);\n if (stat.isDirectory()) await assertNoSymlinks(path);\n }\n}\n\nasync function treeDigest(root: string): Promise<string> {\n const hash = createHash(\"sha256\");\n async function visit(current: string, relative = \"\"): Promise<void> {\n const entries = await readdir(current, { withFileTypes: true });\n for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {\n if ([\".git\", \"node_modules\", \".turbo\"].includes(entry.name)) continue;\n const path = join(current, entry.name);\n const child = relative ? `${relative}/${entry.name}` : entry.name;\n hash.update(entry.isDirectory() ? `d:${child}` : `f:${child}`);\n if (entry.isDirectory()) await visit(path, child);\n else hash.update(await readFile(path));\n }\n }\n await visit(root);\n return hash.digest(\"hex\");\n}\n\nasync function sourceWorkspaceDigest(root: string): Promise<string> {\n const head = await execa(\"git\", [\"-C\", root, \"rev-parse\", \"HEAD\"], { reject: false });\n const status = await execa(\n \"git\",\n [\"-C\", root, \"status\", \"--porcelain=v1\", \"--untracked-files=no\"],\n { reject: false },\n );\n if (head.exitCode === 0 && status.exitCode === 0) {\n return createHash(\"sha256\")\n .update(head.stdout)\n .update(\"\\n\")\n .update(status.stdout)\n .digest(\"hex\");\n }\n return treeDigest(root);\n}\n\nfunction safeEffects(effects: InvocationRequest[\"effects\"]): boolean {\n return (\n effects.filesystem === \"read-only\" &&\n effects.shell === \"denied\" &&\n effects.repositoryWrites === \"denied\"\n );\n}\n\nfunction permissionEvidence(request: InvocationRequest) {\n const nativeValid = safeEffects(request.nativePermissions);\n const launcherValid = safeEffects(request.effects);\n const diagnostics: string[] = [];\n if (!nativeValid) diagnostics.push(\"runtime-native permission configuration is unsafe\");\n if (!launcherValid) diagnostics.push(\"launcher confinement effects are unsafe\");\n if (JSON.stringify(request.nativePermissions) !== JSON.stringify(request.effects)) {\n diagnostics.push(\"runtime-native permissions do not match launcher confinement effects\");\n }\n return Object.freeze({\n native: Object.freeze({ effects: request.nativePermissions, valid: nativeValid }),\n launcher: Object.freeze({\n effects: request.effects,\n sandbox: sandboxEvidence,\n valid: launcherValid,\n }),\n composed: diagnostics.length === 0,\n diagnostics: Object.freeze(diagnostics),\n });\n}\n\nfunction redact(value: string, environment: Readonly<Record<string, string>>): string {\n return Object.values(environment).reduce(\n (text, secret) => (secret ? text.replaceAll(secret, \"[REDACTED]\") : text),\n value,\n );\n}\n\nfunction sandboxArguments(request: InvocationRequest): string[] {\n const args = [\n \"--die-with-parent\",\n \"--new-session\",\n \"--unshare-all\",\n ...(request.effects.network === \"inherited\" ? [\"--share-net\"] : []),\n \"--ro-bind\",\n \"/\",\n \"/\",\n \"--tmpfs\",\n \"/tmp\",\n ...(request.sourceWorkspace.startsWith(\"/tmp/\") ? [] : [\"--tmpfs\", request.sourceWorkspace]),\n \"--proc\",\n \"/proc\",\n \"--dev\",\n \"/dev\",\n \"--ro-bind\",\n request.cwd,\n \"/mnt\",\n \"--chdir\",\n \"/mnt\",\n \"--dir\",\n \"/tmp/home\",\n \"--clearenv\",\n \"--setenv\",\n \"PATH\",\n inheritedPath() ?? \"\",\n \"--setenv\",\n \"HOME\",\n \"/tmp/home\",\n ];\n for (const [key, value] of Object.entries(request.environment).sort(([a], [b]) =>\n a.localeCompare(b),\n )) {\n args.push(\"--setenv\", key, value);\n }\n args.push(\"--\", request.executable, ...request.argv);\n return args;\n}\n\nexport async function executeInvocation(request: InvocationRequest): Promise<InvocationResult> {\n assertSafe(request);\n await assertSandboxAvailable();\n await assertNoSymlinks(request.cwd);\n const before = Object.freeze({\n sourceWorkspaceDigest: await sourceWorkspaceDigest(request.sourceWorkspace),\n consumerRootDigest: await treeDigest(request.cwd),\n });\n const permissions = permissionEvidence(request);\n const started = performance.now();\n const outcome = await execa(bubblewrapExecutable, sandboxArguments(request), {\n cwd: \"/\",\n env: { PATH: inheritedPath() },\n reject: false,\n timeout: request.timeoutMs,\n shell: false,\n maxBuffer: 1024 * 1024,\n });\n const durationMs = Math.round(performance.now() - started);\n const stdout = redact(outcome.stdout, request.environment);\n const stderr = redact(outcome.stderr, request.environment);\n const after = Object.freeze({\n sourceWorkspaceDigest: await sourceWorkspaceDigest(request.sourceWorkspace),\n consumerRootDigest: await treeDigest(request.cwd),\n });\n const violations = [\n ...(before.sourceWorkspaceDigest === after.sourceWorkspaceDigest\n ? []\n : [\n {\n code: \"SOURCE_WORKSPACE_MUTATED\" as const,\n message: \"Source workspace integrity changed\",\n },\n ]),\n ...(before.consumerRootDigest === after.consumerRootDigest\n ? []\n : [{ code: \"CONSUMER_ROOT_MUTATED\" as const, message: \"Consumer root integrity changed\" }]),\n ...(permissions.native.valid\n ? []\n : [\n {\n code: \"NATIVE_PERMISSION_UNSAFE\" as const,\n message: \"Runtime-native permissions are unsafe\",\n },\n ]),\n ...(permissions.composed\n ? []\n : [\n {\n code: \"PERMISSION_COMPOSITION_MISMATCH\" as const,\n message: permissions.diagnostics.join(\"; \"),\n },\n ]),\n ...(outcome.exitCode === 0\n ? []\n : [\n {\n code: \"PROCESS_FAILED\" as const,\n message: `Runtime process exited ${String(outcome.exitCode)}`,\n },\n ]),\n ...(outcome.timedOut\n ? [{ code: \"PROCESS_TIMED_OUT\" as const, message: \"Runtime process timed out\" }]\n : []),\n ];\n const traceId = createHash(\"sha256\")\n .update(\n JSON.stringify({\n request,\n sandbox: sandboxEvidence,\n before,\n after,\n permissions,\n violations,\n stdout,\n stderr,\n exitCode: outcome.exitCode,\n signal: outcome.signal,\n }),\n )\n .digest(\"hex\");\n return {\n schemaVersion: \"1.1.0\",\n runtimeId: request.runtimeId,\n roleId: request.roleId,\n executable: request.executable,\n argv: request.argv,\n cwd: request.cwd,\n stdout,\n stderr,\n exitCode: outcome.exitCode ?? null,\n ...(outcome.signal ? { signal: outcome.signal } : {}),\n timedOut: outcome.timedOut,\n durationMs,\n sandbox: sandboxEvidence,\n integrity: Object.freeze({ before, after }),\n permissions,\n violations: Object.freeze(violations),\n traceId,\n };\n}\n\nexport async function persistInvocation(result: InvocationResult, root: string): Promise<void> {\n const artifacts = join(root, \"artifacts\");\n await mkdir(artifacts, { recursive: true });\n const serialized = `${JSON.stringify(result)}\\n`;\n await writeFile(join(artifacts, `${result.traceId}.json`), serialized);\n await appendFile(join(root, \"invocations.jsonl\"), serialized);\n}\n", "export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n", "import {fileURLToPath} from 'node:url';\n\n// Allow some arguments/options to be either a file path string or a file URL\nexport const safeNormalizeFileUrl = (file, name) => {\n\tconst fileString = normalizeFileUrl(normalizeDenoExecPath(file));\n\n\tif (typeof fileString !== 'string') {\n\t\tthrow new TypeError(`${name} must be a string or a file URL: ${fileString}.`);\n\t}\n\n\treturn fileString;\n};\n\n// In Deno node:process execPath is a special object, not just a string:\n// https://github.com/denoland/deno/blob/f460188e583f00144000aa0d8ade08218d47c3c1/ext/node/polyfills/process.ts#L344\nconst normalizeDenoExecPath = file => isDenoExecPath(file)\n\t? file.toString()\n\t: file;\n\nexport const isDenoExecPath = file => typeof file !== 'string'\n\t&& file\n\t&& Object.getPrototypeOf(file) === String.prototype;\n\n// Same but also allows other values, e.g. `boolean` for the `shell` option\nexport const normalizeFileUrl = file => file instanceof URL ? fileURLToPath(file) : file;\n", "import isPlainObject from 'is-plain-obj';\nimport {safeNormalizeFileUrl} from '../arguments/file-url.js';\n\n// The command `arguments` and `options` are both optional.\n// This also does basic validation on them and on the command file.\nexport const normalizeParameters = (rawFile, rawArguments = [], rawOptions = {}) => {\n\tconst filePath = safeNormalizeFileUrl(rawFile, 'First argument');\n\tconst [commandArguments, options] = isPlainObject(rawArguments)\n\t\t? [[], rawArguments]\n\t\t: [rawArguments, rawOptions];\n\n\tif (!Array.isArray(commandArguments)) {\n\t\tthrow new TypeError(`Second argument must be either an array of arguments or an options object: ${commandArguments}`);\n\t}\n\n\tif (commandArguments.some(commandArgument => typeof commandArgument === 'object' && commandArgument !== null)) {\n\t\tthrow new TypeError(`Second argument must be an array of strings: ${commandArguments}`);\n\t}\n\n\tconst normalizedArguments = commandArguments.map(String);\n\tconst nullByteArgument = normalizedArguments.find(normalizedArgument => normalizedArgument.includes('\\0'));\n\tif (nullByteArgument !== undefined) {\n\t\tthrow new TypeError(`Arguments cannot contain null bytes (\"\\\\0\"): ${nullByteArgument}`);\n\t}\n\n\tif (!isPlainObject(options)) {\n\t\tthrow new TypeError(`Last argument must be an options object: ${options}`);\n\t}\n\n\t// Prevent prototype pollution by copying only own properties to a null-prototype object\n\treturn [filePath, normalizedArguments, {__proto__: null, ...options}];\n};\n", "import {ChildProcess} from 'node:child_process';\nimport isPlainObject from 'is-plain-obj';\nimport {isUint8Array, uint8ArrayToString} from '../utils/uint-array.js';\n\n// Check whether the template string syntax is being used\nexport const isTemplateString = templates => Array.isArray(templates) && Array.isArray(templates.raw);\n\n// Convert execa`file ...commandArguments` to execa(file, commandArguments)\nexport const parseTemplates = (templates, expressions) => {\n\tlet tokens = [];\n\n\tfor (const [index, template] of templates.entries()) {\n\t\ttokens = parseTemplate({\n\t\t\ttemplates,\n\t\t\texpressions,\n\t\t\ttokens,\n\t\t\tindex,\n\t\t\ttemplate,\n\t\t});\n\t}\n\n\tif (tokens.length === 0) {\n\t\tthrow new TypeError('Template script must not be empty');\n\t}\n\n\tconst [file, ...commandArguments] = tokens;\n\treturn [file, commandArguments, {}];\n};\n\nconst parseTemplate = ({templates, expressions, tokens, index, template}) => {\n\tif (template === undefined) {\n\t\tthrow new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);\n\t}\n\n\tconst {nextTokens, leadingWhitespaces, trailingWhitespaces} = splitByWhitespaces(template, templates.raw[index]);\n\tconst newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);\n\n\tif (index === expressions.length) {\n\t\treturn newTokens;\n\t}\n\n\tconst expression = expressions[index];\n\tconst expressionTokens = Array.isArray(expression)\n\t\t? expression.map(expression => parseExpression(expression))\n\t\t: [parseExpression(expression)];\n\treturn concatTokens(newTokens, expressionTokens, trailingWhitespaces);\n};\n\n// Like `string.split(/[ \\t\\r\\n]+/)` except newlines and tabs are:\n// - ignored when input as a backslash sequence like: `echo foo\\n bar`\n// - not ignored when input directly\n// The only way to distinguish those in JavaScript is to use a tagged template and compare:\n// - the first array argument, which does not escape backslash sequences\n// - its `raw` property, which escapes them\nconst splitByWhitespaces = (template, rawTemplate) => {\n\tif (rawTemplate.length === 0) {\n\t\treturn {nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false};\n\t}\n\n\tconst nextTokens = [];\n\tlet templateStart = 0;\n\tconst isLeadingWhitespaces = DELIMITERS.has(rawTemplate[0]);\n\n\tfor (\n\t\tlet templateIndex = 0, rawIndex = 0;\n\t\ttemplateIndex < template.length;\n\t\ttemplateIndex += 1, rawIndex += 1\n\t) {\n\t\tconst rawCharacter = rawTemplate[rawIndex];\n\t\tif (DELIMITERS.has(rawCharacter)) {\n\t\t\tif (templateStart !== templateIndex) {\n\t\t\t\tnextTokens.push(template.slice(templateStart, templateIndex));\n\t\t\t}\n\n\t\t\ttemplateStart = templateIndex + 1;\n\t\t} else if (rawCharacter === '\\\\') {\n\t\t\tconst nextRawCharacter = rawTemplate[rawIndex + 1];\n\t\t\tif (nextRawCharacter === '\\n') {\n\t\t\t\t// Handles escaped newlines in templates\n\t\t\t\ttemplateIndex -= 1;\n\t\t\t\trawIndex += 1;\n\t\t\t} else if (nextRawCharacter === 'u' && rawTemplate[rawIndex + 2] === '{') {\n\t\t\t\trawIndex = rawTemplate.indexOf('}', rawIndex + 3);\n\t\t\t} else {\n\t\t\t\trawIndex += ESCAPE_LENGTH[nextRawCharacter] ?? 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isTrailingWhitespaces = templateStart === template.length;\n\tif (!isTrailingWhitespaces) {\n\t\tnextTokens.push(template.slice(templateStart));\n\t}\n\n\treturn {nextTokens, leadingWhitespaces: isLeadingWhitespaces, trailingWhitespaces: isTrailingWhitespaces};\n};\n\nconst DELIMITERS = new Set([' ', '\\t', '\\r', '\\n']);\n\n// Number of characters in backslash escape sequences: \\0 \\xXX or \\uXXXX\n// \\cX is allowed in RegExps but not in strings\n// Octal sequences are not allowed in strict mode\nconst ESCAPE_LENGTH = {x: 3, u: 5};\n\nconst concatTokens = (tokens, nextTokens, isSeparated) => isSeparated\n\t|| tokens.length === 0\n\t|| nextTokens.length === 0\n\t? [...tokens, ...nextTokens]\n\t: [\n\t\t...tokens.slice(0, -1),\n\t\t`${tokens.at(-1)}${nextTokens[0]}`,\n\t\t...nextTokens.slice(1),\n\t];\n\n// Handle `${expression}` inside the template string syntax\nconst parseExpression = expression => {\n\tconst typeOfExpression = typeof expression;\n\n\tif (typeOfExpression === 'string') {\n\t\treturn expression;\n\t}\n\n\tif (typeOfExpression === 'number') {\n\t\treturn String(expression);\n\t}\n\n\tif (isPlainObject(expression) && ('stdout' in expression || 'isMaxBuffer' in expression)) {\n\t\treturn getSubprocessResult(expression);\n\t}\n\n\tif (expression instanceof ChildProcess || Object.prototype.toString.call(expression) === '[object Promise]') {\n\t\t// eslint-disable-next-line no-template-curly-in-string\n\t\tthrow new TypeError('Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.');\n\t}\n\n\tthrow new TypeError(`Unexpected \"${typeOfExpression}\" in template expression`);\n};\n\nconst getSubprocessResult = ({stdout}) => {\n\tif (typeof stdout === 'string') {\n\t\treturn stdout;\n\t}\n\n\tif (isUint8Array(stdout)) {\n\t\treturn uint8ArrayToString(stdout);\n\t}\n\n\tif (stdout === undefined) {\n\t\tthrow new TypeError('Missing result.stdout in template expression. This is probably due to the previous subprocess\\' \"stdout\" option.');\n\t}\n\n\tthrow new TypeError(`Unexpected \"${typeof stdout}\" stdout in template expression`);\n};\n", "import {StringDecoder} from 'node:string_decoder';\n\nconst {toString: objectToString} = Object.prototype;\n\nexport const isArrayBuffer = value => objectToString.call(value) === '[object ArrayBuffer]';\n\n// Is either Uint8Array or Buffer\nexport const isUint8Array = value => objectToString.call(value) === '[object Uint8Array]';\n\nexport const bufferToUint8Array = buffer => new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);\n\nconst textEncoder = new TextEncoder();\nconst stringToUint8Array = string => textEncoder.encode(string);\n\nconst textDecoder = new TextDecoder();\nexport const uint8ArrayToString = uint8Array => textDecoder.decode(uint8Array);\n\nexport const joinToString = (uint8ArraysOrStrings, encoding) => {\n\tconst strings = uint8ArraysToStrings(uint8ArraysOrStrings, encoding);\n\treturn strings.join('');\n};\n\nconst uint8ArraysToStrings = (uint8ArraysOrStrings, encoding) => {\n\tif (encoding === 'utf8' && uint8ArraysOrStrings.every(uint8ArrayOrString => typeof uint8ArrayOrString === 'string')) {\n\t\treturn uint8ArraysOrStrings;\n\t}\n\n\tconst decoder = new StringDecoder(encoding);\n\tconst strings = uint8ArraysOrStrings\n\t\t.map(uint8ArrayOrString => typeof uint8ArrayOrString === 'string'\n\t\t\t? stringToUint8Array(uint8ArrayOrString)\n\t\t\t: uint8ArrayOrString)\n\t\t.map(uint8Array => decoder.write(uint8Array));\n\tconst finalString = decoder.end();\n\treturn finalString === '' ? strings : [...strings, finalString];\n};\n\nexport const joinToUint8Array = uint8ArraysOrStrings => {\n\tif (uint8ArraysOrStrings.length === 1 && isUint8Array(uint8ArraysOrStrings[0])) {\n\t\treturn uint8ArraysOrStrings[0];\n\t}\n\n\treturn concatUint8Arrays(stringsToUint8Arrays(uint8ArraysOrStrings));\n};\n\nconst stringsToUint8Arrays = uint8ArraysOrStrings => uint8ArraysOrStrings.map(uint8ArrayOrString => typeof uint8ArrayOrString === 'string'\n\t? stringToUint8Array(uint8ArrayOrString)\n\t: uint8ArrayOrString);\n\nexport const concatUint8Arrays = uint8Arrays => {\n\tconst result = new Uint8Array(getJoinLength(uint8Arrays));\n\n\tlet index = 0;\n\tfor (const uint8Array of uint8Arrays) {\n\t\tresult.set(uint8Array, index);\n\t\tindex += uint8Array.length;\n\t}\n\n\treturn result;\n};\n\nconst getJoinLength = uint8Arrays => {\n\tlet joinLength = 0;\n\tfor (const uint8Array of uint8Arrays) {\n\t\tjoinLength += uint8Array.length;\n\t}\n\n\treturn joinLength;\n};\n", "import {spawnSync} from 'node:child_process';\nimport {handleCommand} from '../arguments/command.js';\nimport {normalizeOptions} from '../arguments/options.js';\nimport {concatenateShell} from '../arguments/shell.js';\nimport {makeError, makeEarlyError, makeSuccessResult} from '../return/result.js';\nimport {handleResult} from '../return/reject.js';\nimport {handleStdioSync} from '../stdio/handle-sync.js';\nimport {stripNewline} from '../io/strip-newline.js';\nimport {addInputOptionsSync} from '../io/input-sync.js';\nimport {transformOutputSync} from '../io/output-sync.js';\nimport {getMaxBufferSync} from '../io/max-buffer.js';\nimport {getAllSync} from '../resolve/all-sync.js';\nimport {getExitResultSync} from '../resolve/exit-sync.js';\n\n// Main shared logic for all sync methods: `execaSync()`, `$.sync()`\nexport const execaCoreSync = (rawFile, rawArguments, rawOptions) => {\n\tconst {file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors} = handleSyncArguments(rawFile, rawArguments, rawOptions);\n\tconst result = spawnSubprocessSync({\n\t\tfile,\n\t\tcommandArguments,\n\t\toptions,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tverboseInfo,\n\t\tfileDescriptors,\n\t\tstartTime,\n\t});\n\treturn handleResult(result, verboseInfo, options);\n};\n\n// Compute arguments to pass to `child_process.spawnSync()`\nconst handleSyncArguments = (rawFile, rawArguments, rawOptions) => {\n\tconst {command, escapedCommand, startTime, verboseInfo} = handleCommand(rawFile, rawArguments, rawOptions);\n\tconst syncOptions = normalizeSyncOptions(rawOptions);\n\tconst {file, commandArguments, options} = normalizeOptions(rawFile, rawArguments, syncOptions);\n\tvalidateSyncOptions(options);\n\tconst fileDescriptors = handleStdioSync(options, verboseInfo);\n\treturn {\n\t\tfile,\n\t\tcommandArguments,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstartTime,\n\t\tverboseInfo,\n\t\toptions,\n\t\tfileDescriptors,\n\t};\n};\n\n// Options normalization logic specific to sync methods\nconst normalizeSyncOptions = options => options.node && !options.ipc ? {...options, ipc: false} : options;\n\n// Options validation logic specific to sync methods\nconst validateSyncOptions = ({ipc, ipcInput, detached, cancelSignal, killDescendants}) => {\n\tif (ipcInput) {\n\t\tthrowInvalidSyncOption('ipcInput');\n\t}\n\n\tif (ipc) {\n\t\tthrowInvalidSyncOption('ipc: true');\n\t}\n\n\tif (detached) {\n\t\tthrowInvalidSyncOption('detached: true');\n\t}\n\n\tif (killDescendants) {\n\t\tthrowInvalidSyncOption('killDescendants: true');\n\t}\n\n\tif (cancelSignal) {\n\t\tthrowInvalidSyncOption('cancelSignal');\n\t}\n};\n\nconst throwInvalidSyncOption = value => {\n\tthrow new TypeError(`The \"${value}\" option cannot be used with synchronous methods.`);\n};\n\nconst spawnSubprocessSync = ({file, commandArguments, options, command, escapedCommand, verboseInfo, fileDescriptors, startTime}) => {\n\tconst syncResult = runSubprocessSync({\n\t\tfile,\n\t\tcommandArguments,\n\t\toptions,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tfileDescriptors,\n\t\tstartTime,\n\t});\n\tif (syncResult.failed) {\n\t\treturn syncResult;\n\t}\n\n\tconst {resultError, exitCode, signal, timedOut, isMaxBuffer} = getExitResultSync(syncResult, options);\n\tconst {output, error = resultError} = transformOutputSync({\n\t\tfileDescriptors,\n\t\tsyncResult,\n\t\toptions,\n\t\tisMaxBuffer,\n\t\tverboseInfo,\n\t});\n\tconst stdio = output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber));\n\tconst all = stripNewline(getAllSync(output, options), options, 'all');\n\treturn getSyncResult({\n\t\terror,\n\t\texitCode,\n\t\tsignal,\n\t\ttimedOut,\n\t\tisMaxBuffer,\n\t\tstdio,\n\t\tall,\n\t\toptions,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstartTime,\n\t});\n};\n\nconst runSubprocessSync = ({file, commandArguments, options, command, escapedCommand, fileDescriptors, startTime}) => {\n\ttry {\n\t\taddInputOptionsSync(fileDescriptors, options);\n\t\tconst normalizedOptions = normalizeSpawnSyncOptions(options);\n\t\treturn spawnSync(...concatenateShell(file, commandArguments, normalizedOptions));\n\t} catch (error) {\n\t\treturn makeEarlyError({\n\t\t\terror,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tfileDescriptors,\n\t\t\toptions,\n\t\t\tstartTime,\n\t\t\tisSync: true,\n\t\t});\n\t}\n};\n\n// The `encoding` option is handled by Execa, not by `child_process.spawnSync()`\nconst normalizeSpawnSyncOptions = ({encoding, maxBuffer, ...options}) => ({...options, encoding: 'buffer', maxBuffer: getMaxBufferSync(maxBuffer)});\n\nconst getSyncResult = ({error, exitCode, signal, timedOut, isMaxBuffer, stdio, all, options, command, escapedCommand, startTime}) => error === undefined\n\t? makeSuccessResult({\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstdio,\n\t\tall,\n\t\tipcOutput: [],\n\t\toptions,\n\t\tstartTime,\n\t})\n\t: makeError({\n\t\terror,\n\t\tcommand,\n\t\tescapedCommand,\n\t\ttimedOut,\n\t\tisCanceled: false,\n\t\tisGracefullyCanceled: false,\n\t\tisMaxBuffer,\n\t\tisForcefullyTerminated: false,\n\t\texitCode,\n\t\tsignal,\n\t\tstdio,\n\t\tall,\n\t\tipcOutput: [],\n\t\toptions,\n\t\tstartTime,\n\t\tisSync: true,\n\t});\n", "import {debuglog} from 'node:util';\nimport isPlainObject from 'is-plain-obj';\nimport {STANDARD_STREAMS_ALIASES} from '../utils/standard-stream.js';\n\n// Some options can have different values for `stdout`/`stderr`/`fd3`.\n// This normalizes those to array of values.\n// For example, `{verbose: {stdout: 'none', stderr: 'full'}}` becomes `{verbose: ['none', 'none', 'full']}`\nexport const normalizeFdSpecificOptions = options => {\n\tconst optionsCopy = {...options};\n\n\tfor (const optionName of FD_SPECIFIC_OPTIONS) {\n\t\toptionsCopy[optionName] = normalizeFdSpecificOption(options, optionName);\n\t}\n\n\treturn optionsCopy;\n};\n\nexport const normalizeFdSpecificOption = (options, optionName) => {\n\tconst stdioLength = getStdioLength(options);\n\tconst optionBaseArray = Array.from({length: stdioLength + 1});\n\tconst optionArray = normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName, stdioLength);\n\treturn addDefaultValue(optionArray, optionName);\n};\n\nconst getStdioLength = ({stdio}) => Array.isArray(stdio)\n\t? Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length)\n\t: STANDARD_STREAMS_ALIASES.length;\n\nconst normalizeFdSpecificValue = (optionValue, optionArray, optionName, stdioLength) => isPlainObject(optionValue)\n\t? normalizeOptionObject(optionValue, optionArray, optionName, stdioLength)\n\t: optionArray.fill(optionValue);\n\nconst normalizeOptionObject = (optionValue, optionArray, optionName, stdioLength) => {\n\tfor (const fdName of Object.keys(optionValue).sort(compareFdName)) {\n\t\tfor (const fdNumber of parseFdName(fdName, optionName, stdioLength)) {\n\t\t\toptionArray[fdNumber] = optionValue[fdName];\n\t\t}\n\t}\n\n\treturn optionArray;\n};\n\n// Ensure priority order when setting both `stdout`/`stderr`, `fd1`/`fd2`, and `all`\nconst compareFdName = (fdNameA, fdNameB) => getFdNameOrder(fdNameA) < getFdNameOrder(fdNameB) ? 1 : -1;\n\nconst getFdNameOrder = fdName => {\n\tif (fdName === 'stdout' || fdName === 'stderr') {\n\t\treturn 0;\n\t}\n\n\treturn fdName === 'all' ? 2 : 1;\n};\n\nconst parseFdName = (fdName, optionName, stdioLength) => {\n\tif (fdName === 'ipc') {\n\t\treturn [stdioLength];\n\t}\n\n\tconst fdNumber = parseFd(fdName);\n\tif (fdNumber === undefined || fdNumber === 0) {\n\t\tthrow new TypeError(`\"${optionName}.${fdName}\" is invalid.\nIt must be \"${optionName}.stdout\", \"${optionName}.stderr\", \"${optionName}.all\", \"${optionName}.ipc\", or \"${optionName}.fd3\", \"${optionName}.fd4\" (and so on).`);\n\t}\n\n\tif (fdNumber !== 'all' && fdNumber >= stdioLength) {\n\t\tthrow new TypeError(`\"${optionName}.${fdName}\" is invalid: that file descriptor does not exist.\nPlease set the \"stdio\" option to ensure that file descriptor exists.`);\n\t}\n\n\treturn fdNumber === 'all' ? [1, 2] : [fdNumber];\n};\n\n// Use the same syntax for fd-specific options and the `from`/`to` options\nexport const parseFd = fdName => {\n\tif (fdName === 'all') {\n\t\treturn fdName;\n\t}\n\n\tif (STANDARD_STREAMS_ALIASES.includes(fdName)) {\n\t\treturn STANDARD_STREAMS_ALIASES.indexOf(fdName);\n\t}\n\n\tconst regexpResult = FD_REGEXP.exec(fdName);\n\tif (regexpResult !== null) {\n\t\treturn Number(regexpResult.groups.fdNumber);\n\t}\n};\n\nconst FD_REGEXP = /^fd(?<fdNumber>\\d+)$/;\n\nconst addDefaultValue = (optionArray, optionName) => optionArray.map(optionValue => optionValue === undefined\n\t? DEFAULT_OPTIONS[optionName]\n\t: optionValue);\n\n// Default value for the `verbose` option\nconst verboseDefault = debuglog('execa').enabled ? 'full' : 'none';\n\nconst DEFAULT_OPTIONS = {\n\tlines: false,\n\tbuffer: true,\n\tmaxBuffer: 1000 * 1000 * 100,\n\tverbose: verboseDefault,\n\tstripFinalNewline: true,\n};\n\n// List of options which can have different values for `stdout`/`stderr`\nexport const FD_SPECIFIC_OPTIONS = ['lines', 'buffer', 'maxBuffer', 'verbose', 'stripFinalNewline'];\n\n// Retrieve fd-specific option\nexport const getFdSpecificValue = (optionArray, fdNumber) => fdNumber === 'ipc'\n\t? optionArray.at(-1)\n\t: optionArray[fdNumber];\n", "import process from 'node:process';\n\nexport const isStandardStream = stream => STANDARD_STREAMS.includes(stream);\nexport const STANDARD_STREAMS = [process.stdin, process.stdout, process.stderr];\nexport const STANDARD_STREAMS_ALIASES = ['stdin', 'stdout', 'stderr'];\nexport const getStreamName = fdNumber => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;\n", "import {getFdSpecificValue} from '../arguments/specific.js';\n\n// The `verbose` option can have different values for `stdout`/`stderr`\nexport const isVerbose = ({verbose}, fdNumber) => getFdVerbose(verbose, fdNumber) !== 'none';\n\n// Whether IPC and output and logged\nexport const isFullVerbose = ({verbose}, fdNumber) => !['none', 'short'].includes(getFdVerbose(verbose, fdNumber));\n\n// The `verbose` option can be a function to customize logging\nexport const getVerboseFunction = ({verbose}, fdNumber) => {\n\tconst fdVerbose = getFdVerbose(verbose, fdNumber);\n\treturn isVerboseFunction(fdVerbose) ? fdVerbose : undefined;\n};\n\n// When using `verbose: {stdout, stderr, fd3, ipc}`:\n// - `verbose.stdout|stderr|fd3` is used for 'output'\n// - `verbose.ipc` is only used for 'ipc'\n// - highest `verbose.*` value is used for 'command', 'error' and 'duration'\nconst getFdVerbose = (verbose, fdNumber) => fdNumber === undefined\n\t? getFdGenericVerbose(verbose)\n\t: getFdSpecificValue(verbose, fdNumber);\n\n// When using `verbose: {stdout, stderr, fd3, ipc}` and logging is not specific to a file descriptor.\n// We then use the highest `verbose.*` value, using the following order:\n// - function > 'full' > 'short' > 'none'\n// - if several functions are defined: stdout > stderr > fd3 > ipc\nconst getFdGenericVerbose = verbose => verbose.find(fdVerbose => isVerboseFunction(fdVerbose))\n\t?? VERBOSE_VALUES.findLast(fdVerbose => verbose.includes(fdVerbose));\n\n// Whether the `verbose` option is customized using a function\nexport const isVerboseFunction = fdVerbose => typeof fdVerbose === 'function';\n\nexport const VERBOSE_VALUES = ['none', 'short', 'full'];\n", "import {inspect} from 'node:util';\nimport {escapeLines} from '../arguments/escape.js';\nimport {defaultVerboseFunction} from './default.js';\nimport {applyVerboseOnLines} from './custom.js';\n\n// This prints on stderr.\n// If the subprocess prints on stdout and is using `stdout: 'inherit'`,\n// there is a chance both writes will compete (introducing a race condition).\n// This means their respective order is not deterministic.\n// In particular, this means the verbose command lines might be after the start of the subprocess output.\n// Using synchronous I/O does not solve this problem.\n// However, this only seems to happen when the stdout/stderr target\n// (e.g. a terminal) is being written to by many subprocesses at once, which is unlikely in real scenarios.\nexport const verboseLog = ({type, verboseMessage, fdNumber, verboseInfo, result}) => {\n\tconst verboseObject = getVerboseObject({type, result, verboseInfo});\n\tconst printedLines = getPrintedLines(verboseMessage, verboseObject);\n\tconst finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);\n\tif (finalLines !== '') {\n\t\tconsole.warn(finalLines.slice(0, -1));\n\t}\n};\n\nconst getVerboseObject = ({type, result, verboseInfo}) => {\n\tconst {escapedCommand, commandId, rawOptions} = verboseInfo;\n\tconst {piped = false, ...options} = rawOptions;\n\treturn {\n\t\ttype,\n\t\tescapedCommand,\n\t\tcommandId: `${commandId}`,\n\t\ttimestamp: new Date(),\n\t\tpiped,\n\t\tresult,\n\t\toptions,\n\t};\n};\n\nconst getPrintedLines = (verboseMessage, verboseObject) => verboseMessage\n\t.split('\\n')\n\t.map(message => getPrintedLine({...verboseObject, message}));\n\nconst getPrintedLine = verboseObject => {\n\tconst verboseLine = defaultVerboseFunction(verboseObject);\n\treturn {verboseLine, verboseObject};\n};\n\n// Serialize any type to a line string, for logging\nexport const serializeVerboseMessage = message => {\n\tconst messageString = typeof message === 'string' ? message : inspect(message);\n\tconst escapedMessage = escapeLines(messageString);\n\treturn escapedMessage.replaceAll('\\t', () => ' '.repeat(TAB_SIZE));\n};\n\n// Same as `util.inspect()`\nconst TAB_SIZE = 2;\n", "import {platform} from 'node:process';\nimport {stripVTControlCharacters} from 'node:util';\n\n// Compute `result.command` and `result.escapedCommand`\nexport const joinCommand = (filePath, rawArguments) => {\n\tconst fileAndArguments = [filePath, ...rawArguments];\n\tconst command = fileAndArguments.join(' ');\n\tconst escapedCommand = fileAndArguments\n\t\t.map(fileAndArgument => quoteString(escapeControlCharacters(fileAndArgument)))\n\t\t.join(' ');\n\treturn {command, escapedCommand};\n};\n\n// Remove ANSI sequences and escape control characters and newlines\nexport const escapeLines = lines => stripVTControlCharacters(lines)\n\t.split('\\n')\n\t.map(line => escapeControlCharacters(line))\n\t.join('\\n');\n\nconst escapeControlCharacters = line => line.replaceAll(SPECIAL_CHAR_REGEXP, character => escapeControlCharacter(character));\n\nconst escapeControlCharacter = character => {\n\tconst commonEscape = COMMON_ESCAPES[character];\n\tif (commonEscape !== undefined) {\n\t\treturn commonEscape;\n\t}\n\n\tconst codepoint = character.codePointAt(0);\n\tconst codepointHex = codepoint.toString(16);\n\treturn codepoint <= ASTRAL_START\n\t\t? `\\\\u${codepointHex.padStart(4, '0')}`\n\t\t: `\\\\U${codepointHex}`;\n};\n\n// Characters that would create issues when printed are escaped using the \\u or \\U notation.\n// Those include control characters and newlines.\n// The \\u and \\U notation is Bash specific, but there is no way to do this in a shell-agnostic way.\n// Some shells do not even have a way to print those characters in an escaped fashion.\n// Therefore, we prioritize printing those safely, instead of allowing those to be copy-pasted.\n// List of Unicode character categories: https://www.fileformat.info/info/unicode/category/index.htm\nconst getSpecialCharRegExp = () => {\n\ttry {\n\t\t// This throws when using Node.js without ICU support.\n\t\t// When using a RegExp literal, this would throw at parsing-time, instead of runtime.\n\t\t// eslint-disable-next-line prefer-regex-literals\n\t\treturn new RegExp('\\\\p{Separator}|\\\\p{Other}', 'gu');\n\t} catch {\n\t\t// Similar to the above RegExp, but works even when Node.js has been built without ICU support.\n\t\t// Unlike the above RegExp, it only covers whitespaces and C0/C1 control characters.\n\t\t// It does not cover some edge cases, such as Unicode reserved characters.\n\t\t// See https://github.com/sindresorhus/execa/issues/1143\n\t\t// eslint-disable-next-line no-control-regex, regexp/no-control-character, unicorn/prefer-unicode-code-point-escapes\n\t\treturn /[\\s\\u0000-\\u001F\\u007F-\\u009F\\u00AD]/g;\n\t}\n};\n\nconst SPECIAL_CHAR_REGEXP = getSpecialCharRegExp();\n\n// Accepted by $'...' in Bash.\n// Exclude \\a \\e \\v which are accepted in Bash but not in JavaScript (except \\v) and JSON.\nconst COMMON_ESCAPES = {\n\t' ': ' ',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n};\n\n// Up until that codepoint, \\u notation can be used instead of \\U\nconst ASTRAL_START = 65_535;\n\n// Some characters are shell-specific, i.e. need to be escaped when the command is copy-pasted then run.\n// Escaping is shell-specific. We cannot know which shell is used: `process.platform` detection is not enough.\n// For example, Windows users could be using `cmd.exe`, Powershell or Bash for Windows which all use different escaping.\n// We use '...' on Unix, which is POSIX shell compliant and escape all characters but ' so this is fairly safe.\n// On Windows, we assume cmd.exe is used and escape with \"...\", which also works with Powershell.\nconst quoteString = escapedArgument => {\n\tif (NO_ESCAPE_REGEXP.test(escapedArgument)) {\n\t\treturn escapedArgument;\n\t}\n\n\treturn platform === 'win32'\n\t\t? `\"${escapedArgument.replaceAll('\"', '\"\"')}\"`\n\t\t: `'${escapedArgument.replaceAll('\\'', '\\'\\\\\\'\\'')}'`;\n};\n\nconst NO_ESCAPE_REGEXP = /^[\\w\\-./]+$/;\n", "import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tconst {env} = process;\n\tconst {TERM, TERM_PROGRAM} = env;\n\n\tif (process.platform !== 'win32') {\n\t\treturn TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| TERM_PROGRAM === 'vscode'\n\t\t|| TERM === 'xterm-256color'\n\t\t|| TERM === 'alacritty'\n\t\t|| TERM === 'rxvt-unicode'\n\t\t|| TERM === 'rxvt-unicode-256color'\n\t\t|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n", "import isUnicodeSupported from 'is-unicode-supported';\n\nconst common = {\n\tcircleQuestionMark: '(?)',\n\tquestionMarkPrefix: '(?)',\n\tsquare: '\u2588',\n\tsquareDarkShade: '\u2593',\n\tsquareMediumShade: '\u2592',\n\tsquareLightShade: '\u2591',\n\tsquareTop: '\u2580',\n\tsquareBottom: '\u2584',\n\tsquareLeft: '\u258C',\n\tsquareRight: '\u2590',\n\tsquareCenter: '\u25A0',\n\tbullet: '\u25CF',\n\tdot: '\u2024',\n\tellipsis: '\u2026',\n\tpointerSmall: '\u203A',\n\ttriangleUp: '\u25B2',\n\ttriangleUpSmall: '\u25B4',\n\ttriangleDown: '\u25BC',\n\ttriangleDownSmall: '\u25BE',\n\ttriangleLeftSmall: '\u25C2',\n\ttriangleRightSmall: '\u25B8',\n\thome: '\u2302',\n\theart: '\u2665',\n\tmusicNote: '\u266A',\n\tmusicNoteBeamed: '\u266B',\n\tarrowUp: '\u2191',\n\tarrowDown: '\u2193',\n\tarrowLeft: '\u2190',\n\tarrowRight: '\u2192',\n\tarrowLeftRight: '\u2194',\n\tarrowUpDown: '\u2195',\n\talmostEqual: '\u2248',\n\tnotEqual: '\u2260',\n\tlessOrEqual: '\u2264',\n\tgreaterOrEqual: '\u2265',\n\tidentical: '\u2261',\n\tinfinity: '\u221E',\n\tsubscriptZero: '\u2080',\n\tsubscriptOne: '\u2081',\n\tsubscriptTwo: '\u2082',\n\tsubscriptThree: '\u2083',\n\tsubscriptFour: '\u2084',\n\tsubscriptFive: '\u2085',\n\tsubscriptSix: '\u2086',\n\tsubscriptSeven: '\u2087',\n\tsubscriptEight: '\u2088',\n\tsubscriptNine: '\u2089',\n\toneHalf: '\u00BD',\n\toneThird: '\u2153',\n\toneQuarter: '\u00BC',\n\toneFifth: '\u2155',\n\toneSixth: '\u2159',\n\toneEighth: '\u215B',\n\ttwoThirds: '\u2154',\n\ttwoFifths: '\u2156',\n\tthreeQuarters: '\u00BE',\n\tthreeFifths: '\u2157',\n\tthreeEighths: '\u215C',\n\tfourFifths: '\u2158',\n\tfiveSixths: '\u215A',\n\tfiveEighths: '\u215D',\n\tsevenEighths: '\u215E',\n\tline: '\u2500',\n\tlineBold: '\u2501',\n\tlineDouble: '\u2550',\n\tlineDashed0: '\u2504',\n\tlineDashed1: '\u2505',\n\tlineDashed2: '\u2508',\n\tlineDashed3: '\u2509',\n\tlineDashed4: '\u254C',\n\tlineDashed5: '\u254D',\n\tlineDashed6: '\u2574',\n\tlineDashed7: '\u2576',\n\tlineDashed8: '\u2578',\n\tlineDashed9: '\u257A',\n\tlineDashed10: '\u257C',\n\tlineDashed11: '\u257E',\n\tlineDashed12: '\u2212',\n\tlineDashed13: '\u2013',\n\tlineDashed14: '\u2010',\n\tlineDashed15: '\u2043',\n\tlineVertical: '\u2502',\n\tlineVerticalBold: '\u2503',\n\tlineVerticalDouble: '\u2551',\n\tlineVerticalDashed0: '\u2506',\n\tlineVerticalDashed1: '\u2507',\n\tlineVerticalDashed2: '\u250A',\n\tlineVerticalDashed3: '\u250B',\n\tlineVerticalDashed4: '\u254E',\n\tlineVerticalDashed5: '\u254F',\n\tlineVerticalDashed6: '\u2575',\n\tlineVerticalDashed7: '\u2577',\n\tlineVerticalDashed8: '\u2579',\n\tlineVerticalDashed9: '\u257B',\n\tlineVerticalDashed10: '\u257D',\n\tlineVerticalDashed11: '\u257F',\n\tlineDownLeft: '\u2510',\n\tlineDownLeftArc: '\u256E',\n\tlineDownBoldLeftBold: '\u2513',\n\tlineDownBoldLeft: '\u2512',\n\tlineDownLeftBold: '\u2511',\n\tlineDownDoubleLeftDouble: '\u2557',\n\tlineDownDoubleLeft: '\u2556',\n\tlineDownLeftDouble: '\u2555',\n\tlineDownRight: '\u250C',\n\tlineDownRightArc: '\u256D',\n\tlineDownBoldRightBold: '\u250F',\n\tlineDownBoldRight: '\u250E',\n\tlineDownRightBold: '\u250D',\n\tlineDownDoubleRightDouble: '\u2554',\n\tlineDownDoubleRight: '\u2553',\n\tlineDownRightDouble: '\u2552',\n\tlineUpLeft: '\u2518',\n\tlineUpLeftArc: '\u256F',\n\tlineUpBoldLeftBold: '\u251B',\n\tlineUpBoldLeft: '\u251A',\n\tlineUpLeftBold: '\u2519',\n\tlineUpDoubleLeftDouble: '\u255D',\n\tlineUpDoubleLeft: '\u255C',\n\tlineUpLeftDouble: '\u255B',\n\tlineUpRight: '\u2514',\n\tlineUpRightArc: '\u2570',\n\tlineUpBoldRightBold: '\u2517',\n\tlineUpBoldRight: '\u2516',\n\tlineUpRightBold: '\u2515',\n\tlineUpDoubleRightDouble: '\u255A',\n\tlineUpDoubleRight: '\u2559',\n\tlineUpRightDouble: '\u2558',\n\tlineUpDownLeft: '\u2524',\n\tlineUpBoldDownBoldLeftBold: '\u252B',\n\tlineUpBoldDownBoldLeft: '\u2528',\n\tlineUpDownLeftBold: '\u2525',\n\tlineUpBoldDownLeftBold: '\u2529',\n\tlineUpDownBoldLeftBold: '\u252A',\n\tlineUpDownBoldLeft: '\u2527',\n\tlineUpBoldDownLeft: '\u2526',\n\tlineUpDoubleDownDoubleLeftDouble: '\u2563',\n\tlineUpDoubleDownDoubleLeft: '\u2562',\n\tlineUpDownLeftDouble: '\u2561',\n\tlineUpDownRight: '\u251C',\n\tlineUpBoldDownBoldRightBold: '\u2523',\n\tlineUpBoldDownBoldRight: '\u2520',\n\tlineUpDownRightBold: '\u251D',\n\tlineUpBoldDownRightBold: '\u2521',\n\tlineUpDownBoldRightBold: '\u2522',\n\tlineUpDownBoldRight: '\u251F',\n\tlineUpBoldDownRight: '\u251E',\n\tlineUpDoubleDownDoubleRightDouble: '\u2560',\n\tlineUpDoubleDownDoubleRight: '\u255F',\n\tlineUpDownRightDouble: '\u255E',\n\tlineDownLeftRight: '\u252C',\n\tlineDownBoldLeftBoldRightBold: '\u2533',\n\tlineDownLeftBoldRightBold: '\u252F',\n\tlineDownBoldLeftRight: '\u2530',\n\tlineDownBoldLeftBoldRight: '\u2531',\n\tlineDownBoldLeftRightBold: '\u2532',\n\tlineDownLeftRightBold: '\u252E',\n\tlineDownLeftBoldRight: '\u252D',\n\tlineDownDoubleLeftDoubleRightDouble: '\u2566',\n\tlineDownDoubleLeftRight: '\u2565',\n\tlineDownLeftDoubleRightDouble: '\u2564',\n\tlineUpLeftRight: '\u2534',\n\tlineUpBoldLeftBoldRightBold: '\u253B',\n\tlineUpLeftBoldRightBold: '\u2537',\n\tlineUpBoldLeftRight: '\u2538',\n\tlineUpBoldLeftBoldRight: '\u2539',\n\tlineUpBoldLeftRightBold: '\u253A',\n\tlineUpLeftRightBold: '\u2536',\n\tlineUpLeftBoldRight: '\u2535',\n\tlineUpDoubleLeftDoubleRightDouble: '\u2569',\n\tlineUpDoubleLeftRight: '\u2568',\n\tlineUpLeftDoubleRightDouble: '\u2567',\n\tlineUpDownLeftRight: '\u253C',\n\tlineUpBoldDownBoldLeftBoldRightBold: '\u254B',\n\tlineUpDownBoldLeftBoldRightBold: '\u2548',\n\tlineUpBoldDownLeftBoldRightBold: '\u2547',\n\tlineUpBoldDownBoldLeftRightBold: '\u254A',\n\tlineUpBoldDownBoldLeftBoldRight: '\u2549',\n\tlineUpBoldDownLeftRight: '\u2540',\n\tlineUpDownBoldLeftRight: '\u2541',\n\tlineUpDownLeftBoldRight: '\u253D',\n\tlineUpDownLeftRightBold: '\u253E',\n\tlineUpBoldDownBoldLeftRight: '\u2542',\n\tlineUpDownLeftBoldRightBold: '\u253F',\n\tlineUpBoldDownLeftBoldRight: '\u2543',\n\tlineUpBoldDownLeftRightBold: '\u2544',\n\tlineUpDownBoldLeftBoldRight: '\u2545',\n\tlineUpDownBoldLeftRightBold: '\u2546',\n\tlineUpDoubleDownDoubleLeftDoubleRightDouble: '\u256C',\n\tlineUpDoubleDownDoubleLeftRight: '\u256B',\n\tlineUpDownLeftDoubleRightDouble: '\u256A',\n\tlineCross: '\u2573',\n\tlineBackslash: '\u2572',\n\tlineSlash: '\u2571',\n};\n\nconst specialMainSymbols = {\n\ttick: '\u2714',\n\tinfo: '\u2139',\n\twarning: '\u26A0',\n\tcross: '\u2718',\n\tsquareSmall: '\u25FB',\n\tsquareSmallFilled: '\u25FC',\n\tcircle: '\u25EF',\n\tcircleFilled: '\u25C9',\n\tcircleDotted: '\u25CC',\n\tcircleDouble: '\u25CE',\n\tcircleCircle: '\u24DE',\n\tcircleCross: '\u24E7',\n\tcirclePipe: '\u24BE',\n\tradioOn: '\u25C9',\n\tradioOff: '\u25EF',\n\tcheckboxOn: '\u2612',\n\tcheckboxOff: '\u2610',\n\tcheckboxCircleOn: '\u24E7',\n\tcheckboxCircleOff: '\u24BE',\n\tpointer: '\u276F',\n\ttriangleUpOutline: '\u25B3',\n\ttriangleLeft: '\u25C0',\n\ttriangleRight: '\u25B6',\n\tlozenge: '\u25C6',\n\tlozengeOutline: '\u25C7',\n\thamburger: '\u2630',\n\tsmiley: '\u32E1',\n\tmustache: '\u0DF4',\n\tstar: '\u2605',\n\tplay: '\u25B6',\n\tnodejs: '\u2B22',\n\toneSeventh: '\u2150',\n\toneNinth: '\u2151',\n\toneTenth: '\u2152',\n};\n\nconst specialFallbackSymbols = {\n\ttick: '\u221A',\n\tinfo: 'i',\n\twarning: '\u203C',\n\tcross: '\u00D7',\n\tsquareSmall: '\u25A1',\n\tsquareSmallFilled: '\u25A0',\n\tcircle: '( )',\n\tcircleFilled: '(*)',\n\tcircleDotted: '( )',\n\tcircleDouble: '( )',\n\tcircleCircle: '(\u25CB)',\n\tcircleCross: '(\u00D7)',\n\tcirclePipe: '(\u2502)',\n\tradioOn: '(*)',\n\tradioOff: '( )',\n\tcheckboxOn: '[\u00D7]',\n\tcheckboxOff: '[ ]',\n\tcheckboxCircleOn: '(\u00D7)',\n\tcheckboxCircleOff: '( )',\n\tpointer: '>',\n\ttriangleUpOutline: '\u2206',\n\ttriangleLeft: '\u25C4',\n\ttriangleRight: '\u25BA',\n\tlozenge: '\u2666',\n\tlozengeOutline: '\u25CA',\n\thamburger: '\u2261',\n\tsmiley: '\u263A',\n\tmustache: '\u250C\u2500\u2510',\n\tstar: '\u2736',\n\tplay: '\u25BA',\n\tnodejs: '\u2666',\n\toneSeventh: '1/7',\n\toneNinth: '1/9',\n\toneTenth: '1/10',\n};\n\nexport const mainSymbols = {...common, ...specialMainSymbols};\nexport const fallbackSymbols = {...common, ...specialFallbackSymbols};\n\nconst shouldUseMain = isUnicodeSupported();\nconst figures = shouldUseMain ? mainSymbols : fallbackSymbols;\nexport default figures;\n\nconst replacements = Object.entries(specialMainSymbols);\n\n// On terminals which do not support Unicode symbols, substitute them to other symbols\nexport const replaceSymbols = (string, {useFallback = !shouldUseMain} = {}) => {\n\tif (useFallback) {\n\t\tfor (const [key, mainSymbol] of replacements) {\n\t\t\tstring = string.replaceAll(mainSymbol, fallbackSymbols[key]);\n\t\t}\n\t}\n\n\treturn string;\n};\n", "import tty from 'node:tty';\n\n// eslint-disable-next-line no-warning-comments\n// TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)\n// Lots of optionals here to support Deno.\nconst hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;\n\nconst format = (open, close) => {\n\tif (!hasColors) {\n\t\treturn input => input;\n\t}\n\n\tconst openCode = `\\u001B[${open}m`;\n\tconst closeCode = `\\u001B[${close}m`;\n\n\treturn input => {\n\t\tconst string = input + ''; // eslint-disable-line no-implicit-coercion -- This is faster.\n\t\tlet index = string.indexOf(closeCode);\n\n\t\tif (index === -1) {\n\t\t\t// Note: Intentionally not using string interpolation for performance reasons.\n\t\t\treturn openCode + string + closeCode;\n\t\t}\n\n\t\t// Handle nested colors.\n\n\t\t// We could have done this, but it's too slow (as of Node.js 22).\n\t\t// return openCode + string.replaceAll(closeCode, (close === 22 ? closeCode : '') + openCode) + closeCode;\n\n\t\tlet result = openCode;\n\t\tlet lastIndex = 0;\n\n\t\t// SGR 22 resets both bold (1) and dim (2). When we encounter a nested\n\t\t// close for styles that use 22, we need to re-open the outer style.\n\t\tconst reopenOnNestedClose = close === 22;\n\t\tconst replaceCode = (reopenOnNestedClose ? closeCode : '') + openCode;\n\n\t\twhile (index !== -1) {\n\t\t\tresult += string.slice(lastIndex, index) + replaceCode;\n\t\t\tlastIndex = index + closeCode.length;\n\t\t\tindex = string.indexOf(closeCode, lastIndex);\n\t\t}\n\n\t\tresult += string.slice(lastIndex) + closeCode;\n\n\t\treturn result;\n\t};\n};\n\nexport const reset = format(0, 0);\nexport const bold = format(1, 22);\nexport const dim = format(2, 22);\nexport const italic = format(3, 23);\nexport const underline = format(4, 24);\nexport const overline = format(53, 55);\nexport const inverse = format(7, 27);\nexport const hidden = format(8, 28);\nexport const strikethrough = format(9, 29);\n\nexport const black = format(30, 39);\nexport const red = format(31, 39);\nexport const green = format(32, 39);\nexport const yellow = format(33, 39);\nexport const blue = format(34, 39);\nexport const magenta = format(35, 39);\nexport const cyan = format(36, 39);\nexport const white = format(37, 39);\nexport const gray = format(90, 39);\n\nexport const bgBlack = format(40, 49);\nexport const bgRed = format(41, 49);\nexport const bgGreen = format(42, 49);\nexport const bgYellow = format(43, 49);\nexport const bgBlue = format(44, 49);\nexport const bgMagenta = format(45, 49);\nexport const bgCyan = format(46, 49);\nexport const bgWhite = format(47, 49);\nexport const bgGray = format(100, 49);\n\nexport const redBright = format(91, 39);\nexport const greenBright = format(92, 39);\nexport const yellowBright = format(93, 39);\nexport const blueBright = format(94, 39);\nexport const magentaBright = format(95, 39);\nexport const cyanBright = format(96, 39);\nexport const whiteBright = format(97, 39);\n\nexport const bgRedBright = format(101, 49);\nexport const bgGreenBright = format(102, 49);\nexport const bgYellowBright = format(103, 49);\nexport const bgBlueBright = format(104, 49);\nexport const bgMagentaBright = format(105, 49);\nexport const bgCyanBright = format(106, 49);\nexport const bgWhiteBright = format(107, 49);\n", "import figures from 'figures';\nimport {\n\tgray,\n\tbold,\n\tredBright,\n\tyellowBright,\n} from 'yoctocolors';\n\n// Default when `verbose` is not a function\nexport const defaultVerboseFunction = ({\n\ttype,\n\tmessage,\n\ttimestamp,\n\tpiped,\n\tcommandId,\n\tresult: {failed = false} = {},\n\toptions: {reject = true},\n}) => {\n\tconst timestampString = serializeTimestamp(timestamp);\n\tconst icon = ICONS[type]({failed, reject, piped});\n\tconst color = COLORS[type]({reject});\n\treturn `${gray(`[${timestampString}]`)} ${gray(`[${commandId}]`)} ${color(icon)} ${color(message)}`;\n};\n\n// Prepending the timestamp allows debugging the slow paths of a subprocess\nconst serializeTimestamp = timestamp => `${padField(timestamp.getHours(), 2)}:${padField(timestamp.getMinutes(), 2)}:${padField(timestamp.getSeconds(), 2)}.${padField(timestamp.getMilliseconds(), 3)}`;\n\nconst padField = (field, padding) => String(field).padStart(padding, '0');\n\nconst getFinalIcon = ({failed, reject}) => {\n\tif (!failed) {\n\t\treturn figures.tick;\n\t}\n\n\treturn reject ? figures.cross : figures.warning;\n};\n\nconst ICONS = {\n\tcommand: ({piped}) => piped ? '|' : '$',\n\toutput: () => ' ',\n\tipc: () => '*',\n\terror: getFinalIcon,\n\tduration: getFinalIcon,\n};\n\nconst identity = string => string;\n\nconst COLORS = {\n\tcommand: () => bold,\n\toutput: () => identity,\n\tipc: () => identity,\n\terror: ({reject}) => reject ? redBright : yellowBright,\n\tduration: () => gray,\n};\n", "import {getVerboseFunction} from './values.js';\n\n// Apply the `verbose` function on each line\nexport const applyVerboseOnLines = (printedLines, verboseInfo, fdNumber) => {\n\tconst verboseFunction = getVerboseFunction(verboseInfo, fdNumber);\n\treturn printedLines\n\t\t.map(({verboseLine, verboseObject}) => applyVerboseFunction(verboseLine, verboseObject, verboseFunction))\n\t\t.filter(printedLine => printedLine !== undefined)\n\t\t.map(printedLine => appendNewline(printedLine))\n\t\t.join('');\n};\n\nconst applyVerboseFunction = (verboseLine, verboseObject, verboseFunction) => {\n\tif (verboseFunction === undefined) {\n\t\treturn verboseLine;\n\t}\n\n\tconst printedLine = verboseFunction(verboseLine, verboseObject);\n\tif (typeof printedLine === 'string') {\n\t\treturn printedLine;\n\t}\n};\n\nconst appendNewline = printedLine => printedLine.endsWith('\\n')\n\t? printedLine\n\t: `${printedLine}\\n`;\n", "import {isVerbose} from './values.js';\nimport {verboseLog} from './log.js';\n\n// When `verbose` is `short|full|custom`, print each command\nexport const logCommand = (escapedCommand, verboseInfo) => {\n\tif (!isVerbose(verboseInfo)) {\n\t\treturn;\n\t}\n\n\tverboseLog({\n\t\ttype: 'command',\n\t\tverboseMessage: escapedCommand,\n\t\tverboseInfo,\n\t});\n};\n", "import {isVerbose, VERBOSE_VALUES, isVerboseFunction} from './values.js';\n\n// Information computed before spawning, used by the `verbose` option\nexport const getVerboseInfo = (verbose, escapedCommand, rawOptions) => {\n\tvalidateVerbose(verbose);\n\tconst commandId = getCommandId(verbose);\n\treturn {\n\t\tverbose,\n\t\tescapedCommand,\n\t\tcommandId,\n\t\trawOptions,\n\t};\n};\n\nconst getCommandId = verbose => isVerbose({verbose}) ? COMMAND_ID++ : undefined;\n\n// Prepending the `pid` is useful when multiple commands print their output at the same time.\n// However, we cannot use the real PID since this is not available with `child_process.spawnSync()`.\n// Also, we cannot use the real PID if we want to print it before `child_process.spawn()` is run.\n// As a pro, it is shorter than a normal PID and never re-uses the same id.\n// As a con, it cannot be used to send signals.\nlet COMMAND_ID = 0n;\n\nconst validateVerbose = verbose => {\n\tfor (const fdVerbose of verbose) {\n\t\tif (fdVerbose === false) {\n\t\t\tthrow new TypeError('The \"verbose: false\" option was renamed to \"verbose: \\'none\\'\".');\n\t\t}\n\n\t\tif (fdVerbose === true) {\n\t\t\tthrow new TypeError('The \"verbose: true\" option was renamed to \"verbose: \\'short\\'\".');\n\t\t}\n\n\t\tif (!VERBOSE_VALUES.includes(fdVerbose) && !isVerboseFunction(fdVerbose)) {\n\t\t\tconst allowedValues = VERBOSE_VALUES.map(allowedValue => `'${allowedValue}'`).join(', ');\n\t\t\tthrow new TypeError(`The \"verbose\" option must not be ${fdVerbose}. Allowed values are: ${allowedValues} or a function.`);\n\t\t}\n\t}\n};\n", "import {hrtime} from 'node:process';\n\n// Start counting time before spawning the subprocess\nexport const getStartTime = () => hrtime.bigint();\n\n// Compute duration after the subprocess ended.\n// Printed by the `verbose` option.\nexport const getDurationMs = startTime => Number(hrtime.bigint() - startTime) / 1e6;\n", "import {logCommand} from '../verbose/start.js';\nimport {getVerboseInfo} from '../verbose/info.js';\nimport {getStartTime} from '../return/duration.js';\nimport {joinCommand} from './escape.js';\nimport {normalizeFdSpecificOption} from './specific.js';\n\n// Compute `result.command`, `result.escapedCommand` and `verbose`-related information\nexport const handleCommand = (filePath, rawArguments, rawOptions) => {\n\tconst startTime = getStartTime();\n\tconst {command, escapedCommand} = joinCommand(filePath, rawArguments);\n\tconst verbose = normalizeFdSpecificOption(rawOptions, 'verbose');\n\tconst verboseInfo = getVerboseInfo(verbose, escapedCommand, {...rawOptions});\n\tlogCommand(escapedCommand, verboseInfo);\n\treturn {\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstartTime,\n\t\tverboseInfo,\n\t};\n};\n", "import path from 'node:path';\nimport process from 'node:process';\nimport {npmRunPathEnv} from 'npm-run-path';\nimport {normalizeForceKillAfterDelay} from '../terminate/kill.js';\nimport {normalizeKillSignal} from '../terminate/signal.js';\nimport {validateCancelSignal} from '../terminate/cancel.js';\nimport {validateGracefulCancel} from '../terminate/graceful.js';\nimport {validateTimeout} from '../terminate/timeout.js';\nimport {handleNodeOption} from '../methods/node.js';\nimport {validateIpcInputOption} from '../ipc/ipc-input.js';\nimport {validateEncoding, BINARY_ENCODINGS} from './encoding-option.js';\nimport {parseCommandFile} from './command-file.js';\nimport {normalizeCwd} from './cwd.js';\nimport {normalizeFileUrl} from './file-url.js';\nimport {normalizeFdSpecificOptions} from './specific.js';\n\n// Normalize the options object, and sometimes also the file paths and arguments.\n// Applies default values, validate allowed options, normalize them.\nexport const normalizeOptions = (filePath, rawArguments, rawOptions) => {\n\t// Prevent prototype pollution by copying only own properties to a null-prototype object\n\tconst sanitizedOptions = {__proto__: null, ...rawOptions};\n\tsanitizedOptions.cwd = normalizeCwd(sanitizedOptions.cwd);\n\tconst [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, sanitizedOptions);\n\n\tconst {file, commandArguments, options: initialOptions} = parseCommandFile(processedFile, processedArguments, processedOptions);\n\n\tconst fdOptions = normalizeFdSpecificOptions(initialOptions);\n\tconst options = addDefaultOptions(fdOptions);\n\tvalidateTimeout(options);\n\tvalidateEncoding(options);\n\tvalidateIpcInputOption(options);\n\tvalidateCancelSignal(options);\n\tvalidateGracefulCancel(options);\n\toptions.shell = normalizeFileUrl(options.shell);\n\toptions.env = getEnv(options);\n\toptions.killSignal = normalizeKillSignal(options.killSignal);\n\toptions.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);\n\toptions.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);\n\n\tif (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {\n\t\t// #116\n\t\tcommandArguments.unshift('/q');\n\t}\n\n\treturn {file, commandArguments, options};\n};\n\n// Use null prototype to prevent prototype pollution from leaking through\nconst addDefaultOptions = ({\n\textendEnv = true,\n\tpreferLocal = false,\n\tcwd,\n\tlocalDir: localDirectory = cwd,\n\tencoding = 'utf8',\n\treject = true,\n\tcleanup = true,\n\tkillDescendants = false,\n\tall = false,\n\twindowsHide = true,\n\tkillSignal = 'SIGTERM',\n\tforceKillAfterDelay = true,\n\tgracefulCancel = false,\n\tipcInput,\n\tipc = ipcInput !== undefined || gracefulCancel,\n\tserialization = 'advanced',\n\t...options\n}) => ({\n\t__proto__: null,\n\t...options,\n\textendEnv,\n\tpreferLocal,\n\tcwd,\n\tlocalDirectory,\n\tencoding,\n\treject,\n\tcleanup,\n\tkillDescendants,\n\tall,\n\twindowsHide,\n\tkillSignal,\n\tforceKillAfterDelay,\n\tgracefulCancel,\n\tipcInput,\n\tipc,\n\tserialization,\n});\n\nconst getEnv = ({env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath}) => {\n\tconst env = extendEnv ? {...process.env, ...envOption} : envOption;\n\n\tif (preferLocal || node) {\n\t\treturn npmRunPathEnv({\n\t\t\tenv,\n\t\t\tcwd: localDirectory,\n\t\t\texecPath: nodePath,\n\t\t\tpreferLocal,\n\t\t\taddExecPath: node,\n\t\t});\n\t}\n\n\treturn env;\n};\n", "import process from 'node:process';\nimport path from 'node:path';\nimport pathKey from 'path-key';\nimport {toPath, traversePathUp} from 'unicorn-magic';\n\nexport const npmRunPath = ({\n\tcwd = process.cwd(),\n\tpath: pathOption = process.env[pathKey()],\n\tpreferLocal = true,\n\texecPath = process.execPath,\n\taddExecPath = true,\n} = {}) => {\n\tconst cwdPath = path.resolve(toPath(cwd));\n\tconst result = [];\n\tconst pathParts = pathOption.split(path.delimiter);\n\n\tif (preferLocal) {\n\t\tapplyPreferLocal(result, pathParts, cwdPath);\n\t}\n\n\tif (addExecPath) {\n\t\tapplyExecPath(result, pathParts, execPath, cwdPath);\n\t}\n\n\treturn pathOption === '' || pathOption === path.delimiter\n\t\t? `${result.join(path.delimiter)}${pathOption}`\n\t\t: [...result, pathOption].join(path.delimiter);\n};\n\nconst applyPreferLocal = (result, pathParts, cwdPath) => {\n\tfor (const directory of traversePathUp(cwdPath)) {\n\t\tconst pathPart = path.join(directory, 'node_modules/.bin');\n\t\tif (!pathParts.includes(pathPart)) {\n\t\t\tresult.push(pathPart);\n\t\t}\n\t}\n};\n\n// Ensure the running `node` binary is used\nconst applyExecPath = (result, pathParts, execPath, cwdPath) => {\n\tconst pathPart = path.resolve(cwdPath, toPath(execPath), '..');\n\tif (!pathParts.includes(pathPart)) {\n\t\tresult.push(pathPart);\n\t}\n};\n\nexport const npmRunPathEnv = ({env = process.env, ...options} = {}) => {\n\tenv = {...env};\n\n\tconst pathName = pathKey({env});\n\toptions.path = env[pathName];\n\tenv[pathName] = npmRunPath(options);\n\n\treturn env;\n};\n", "export default function pathKey(options = {}) {\n\tconst {\n\t\tenv = process.env,\n\t\tplatform = process.platform\n\t} = options;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n}\n", "import {promisify} from 'node:util';\nimport {execFile as execFileCallback, execFileSync as execFileSyncOriginal} from 'node:child_process';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\n\nconst execFileOriginal = promisify(execFileCallback);\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport function rootDirectory(pathInput) {\n\treturn path.parse(toPath(pathInput)).root;\n}\n\nexport function traversePathUp(startPath) {\n\treturn {\n\t\t* [Symbol.iterator]() {\n\t\t\tlet currentPath = path.resolve(toPath(startPath));\n\t\t\tlet previousPath;\n\n\t\t\twhile (previousPath !== currentPath) {\n\t\t\t\tyield currentPath;\n\t\t\t\tpreviousPath = currentPath;\n\t\t\t\tcurrentPath = path.resolve(currentPath, '..');\n\t\t\t}\n\t\t},\n\t};\n}\n\nconst TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;\n\nexport async function execFile(file, arguments_, options = {}) {\n\treturn execFileOriginal(file, arguments_, {\n\t\tmaxBuffer: TEN_MEGABYTES_IN_BYTES,\n\t\t...options,\n\t});\n}\n\nexport function execFileSync(file, arguments_ = [], options = {}) {\n\treturn execFileSyncOriginal(file, arguments_, {\n\t\tmaxBuffer: TEN_MEGABYTES_IN_BYTES,\n\t\tencoding: 'utf8',\n\t\tstdio: 'pipe',\n\t\t...options,\n\t});\n}\n\nexport * from './default.js';\n", "import {setTimeout} from 'node:timers/promises';\nimport {isErrorInstance} from '../return/final-error.js';\nimport {normalizeSignalArgument} from './signal.js';\n\n// Normalize the `forceKillAfterDelay` option\nexport const normalizeForceKillAfterDelay = forceKillAfterDelay => {\n\tif (forceKillAfterDelay === false) {\n\t\treturn forceKillAfterDelay;\n\t}\n\n\tif (forceKillAfterDelay === true) {\n\t\treturn DEFAULT_FORCE_KILL_TIMEOUT;\n\t}\n\n\tif (!Number.isFinite(forceKillAfterDelay) || forceKillAfterDelay < 0) {\n\t\tthrow new TypeError(`Expected the \\`forceKillAfterDelay\\` option to be a non-negative integer, got \\`${forceKillAfterDelay}\\` (${typeof forceKillAfterDelay})`);\n\t}\n\n\treturn forceKillAfterDelay;\n};\n\nconst DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;\n\n// Monkey-patches `subprocess.kill()` to add `forceKillAfterDelay` behavior and `.kill(error)`\nexport const subprocessKill = (\n\t{kill, options: {forceKillAfterDelay, killSignal}, onInternalError, context, controller},\n\tsignalOrError,\n\terrorArgument,\n) => {\n\tconst {signal, error} = parseKillArguments(signalOrError, errorArgument, killSignal);\n\temitKillError(error, onInternalError);\n\tconst killResult = kill(signal);\n\tsetKillTimeout({\n\t\tkill,\n\t\tsignal,\n\t\tforceKillAfterDelay,\n\t\tkillSignal,\n\t\tkillResult,\n\t\tcontext,\n\t\tcontroller,\n\t});\n\treturn killResult;\n};\n\nconst parseKillArguments = (signalOrError, errorArgument, killSignal) => {\n\tconst [signal = killSignal, error] = isErrorInstance(signalOrError)\n\t\t? [undefined, signalOrError]\n\t\t: [signalOrError, errorArgument];\n\n\tif (typeof signal !== 'string' && !Number.isInteger(signal)) {\n\t\tthrow new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(signal)}`);\n\t}\n\n\tif (error !== undefined && !isErrorInstance(error)) {\n\t\tthrow new TypeError(`The second argument is optional. If specified, it must be an error instance: ${error}`);\n\t}\n\n\treturn {signal: normalizeSignalArgument(signal), error};\n};\n\n// Fails right away when calling `subprocess.kill(error)`.\n// Does not wait for actual signal termination.\n// Uses a deferred promise instead of the `error` event on the subprocess, as this is less intrusive.\nconst emitKillError = (error, onInternalError) => {\n\tif (error !== undefined) {\n\t\tonInternalError.reject(error);\n\t}\n};\n\nconst setKillTimeout = async ({kill, signal, forceKillAfterDelay, killSignal, killResult, context, controller}) => {\n\tif (signal === killSignal && killResult) {\n\t\tkillOnTimeout({\n\t\t\tkill,\n\t\t\tforceKillAfterDelay,\n\t\t\tcontext,\n\t\t\tcontrollerSignal: controller.signal,\n\t\t});\n\t}\n};\n\n// Forcefully terminate a subprocess after a timeout\nexport const killOnTimeout = async ({kill, forceKillAfterDelay, context, controllerSignal}) => {\n\tif (forceKillAfterDelay === false) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait setTimeout(forceKillAfterDelay, undefined, {signal: controllerSignal});\n\t\tif (kill('SIGKILL')) {\n\t\t\tcontext.isForcefullyTerminated ??= true;\n\t\t}\n\t} catch {}\n};\n", "// When the subprocess fails, this is the error instance being returned.\n// If another error instance is being thrown, it is kept as `error.cause`.\nexport const getFinalError = (originalError, message, isSync) => {\n\tconst ErrorClass = isSync ? ExecaSyncError : ExecaError;\n\tconst options = originalError instanceof DiscardedError ? {} : {cause: originalError};\n\treturn new ErrorClass(message, options);\n};\n\n// Indicates that the error is used only to interrupt control flow, but not in the return value\nexport class DiscardedError extends Error {}\n\n// Proper way to set `error.name`: it should be inherited and non-enumerable\nconst setErrorName = (ErrorClass, value) => {\n\tObject.defineProperties(ErrorClass.prototype, {\n\t\tname: {\n\t\t\tvalue,\n\t\t\twritable: true,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t},\n\t\t[execaErrorSymbol]: {\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t},\n\t});\n};\n\n// Unlike `instanceof`, this works across realms\nexport const isExecaError = error => isErrorInstance(error) && execaErrorSymbol in error;\n\nconst execaErrorSymbol = Symbol('isExecaError');\n\nexport const isErrorInstance = value => Object.prototype.toString.call(value) === '[object Error]';\n\n// We use two different Error classes for async/sync methods since they have slightly different shape and types\nexport class ExecaError extends Error {}\n// eslint-disable-next-line unicorn/no-top-level-side-effects -- `error.name` must be set as soon as the class is defined\nsetErrorName(ExecaError, ExecaError.name);\n\nexport class ExecaSyncError extends Error {}\n// eslint-disable-next-line unicorn/no-top-level-side-effects -- `error.name` must be set as soon as the class is defined\nsetErrorName(ExecaSyncError, ExecaSyncError.name);\n", "import {constants} from 'node:os';\nimport {signalsByName} from 'human-signals';\n\n// Normalize signals for comparison purpose.\n// Also validate the signal exists.\nexport const normalizeKillSignal = killSignal => {\n\tconst optionName = 'option `killSignal`';\n\tif (killSignal === 0) {\n\t\tthrow new TypeError(`Invalid ${optionName}: 0 cannot be used.`);\n\t}\n\n\treturn normalizeSignal(killSignal, optionName);\n};\n\nexport const normalizeSignalArgument = signal => signal === 0\n\t? signal\n\t: normalizeSignal(signal, '`subprocess.kill()`\\'s argument');\n\nconst normalizeSignal = (signalNameOrInteger, optionName) => {\n\tif (Number.isInteger(signalNameOrInteger)) {\n\t\treturn normalizeSignalInteger(signalNameOrInteger, optionName);\n\t}\n\n\tif (typeof signalNameOrInteger === 'string') {\n\t\treturn normalizeSignalName(signalNameOrInteger, optionName);\n\t}\n\n\tthrow new TypeError(`Invalid ${optionName} ${String(signalNameOrInteger)}: it must be a string or an integer.\\n${getAvailableSignals()}`);\n};\n\nconst normalizeSignalInteger = (signalInteger, optionName) => {\n\tif (signalsIntegerToName.has(signalInteger)) {\n\t\treturn signalsIntegerToName.get(signalInteger);\n\t}\n\n\tthrow new TypeError(`Invalid ${optionName} ${signalInteger}: this signal integer does not exist.\\n${getAvailableSignals()}`);\n};\n\nconst getSignalsIntegerToName = () => new Map(Object.entries(constants.signals)\n\t.reverse()\n\t.map(([signalName, signalInteger]) => [signalInteger, signalName]));\n\nconst signalsIntegerToName = getSignalsIntegerToName();\n\nconst normalizeSignalName = (signalName, optionName) => {\n\tif (signalName in constants.signals) {\n\t\treturn signalName;\n\t}\n\n\tif (signalName.toUpperCase() in constants.signals) {\n\t\tthrow new TypeError(`Invalid ${optionName} '${signalName}': please rename it to '${signalName.toUpperCase()}'.`);\n\t}\n\n\tthrow new TypeError(`Invalid ${optionName} '${signalName}': this signal name does not exist.\\n${getAvailableSignals()}`);\n};\n\nconst getAvailableSignals = () => `Available signal names: ${getAvailableSignalNames()}.\nAvailable signal numbers: ${getAvailableSignalIntegers()}.`;\n\nconst getAvailableSignalNames = () => Object.keys(constants.signals)\n\t.sort()\n\t.map(signalName => `'${signalName}'`)\n\t.join(', ');\n\nconst getAvailableSignalIntegers = () => [...new Set(Object.values(constants.signals)\n\t.sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))]\n\t.join(', ');\n\n// Human-friendly description of a signal\nexport const getSignalDescription = signal => signalsByName[signal].description;\n", "import{constants}from\"node:os\";\n\nimport{SIGRTMAX}from\"./realtime.js\";\nimport{getSignals}from\"./signals.js\";\n\n\n\nconst getSignalsByName=()=>{\nconst signals=getSignals();\nreturn Object.fromEntries(signals.map(getSignalByName))\n};\n\nconst getSignalByName=({\nname,\nnumber,\ndescription,\nsupported,\naction,\nforced,\nstandard\n})=>[name,{name,number,description,supported,action,forced,standard}];\n\nexport const signalsByName=getSignalsByName();\n\n\n\n\nconst getSignalsByNumber=()=>{\nconst signals=getSignals();\nconst length=SIGRTMAX+1;\nconst signalsA=Array.from({length},(value,number)=>\ngetSignalByNumber(number,signals)\n);\nreturn Object.assign({},...signalsA)\n};\n\nconst getSignalByNumber=(number,signals)=>{\nconst signal=findSignalByNumber(number,signals);\n\nif(signal===undefined){\nreturn{}\n}\n\nconst{name,description,supported,action,forced,standard}=signal;\nreturn{\n[number]:{\nname,\nnumber,\ndescription,\nsupported,\naction,\nforced,\nstandard\n}\n}\n};\n\n\n\nconst findSignalByNumber=(number,signals)=>{\nconst signal=signals.find(({name})=>constants.signals[name]===number);\n\nif(signal!==undefined){\nreturn signal\n}\n\nreturn signals.find((signalA)=>signalA.number===number)\n};\n\nexport const signalsByNumber=getSignalsByNumber();", "\nexport const getRealtimeSignals=()=>{\nconst length=SIGRTMAX-SIGRTMIN+1;\nreturn Array.from({length},getRealtimeSignal)\n};\n\nconst getRealtimeSignal=(value,index)=>({\nname:`SIGRT${index+1}`,\nnumber:SIGRTMIN+index,\naction:\"terminate\",\ndescription:\"Application-specific signal (realtime)\",\nstandard:\"posix\"\n});\n\nconst SIGRTMIN=34;\nexport const SIGRTMAX=64;", "import{constants}from\"node:os\";\n\nimport{SIGNALS}from\"./core.js\";\nimport{getRealtimeSignals}from\"./realtime.js\";\n\n\n\nexport const getSignals=()=>{\nconst realtimeSignals=getRealtimeSignals();\nconst signals=[...SIGNALS,...realtimeSignals].map(normalizeSignal);\nreturn signals\n};\n\n\n\n\n\n\n\nconst normalizeSignal=({\nname,\nnumber:defaultNumber,\ndescription,\naction,\nforced=false,\nstandard\n})=>{\nconst{\nsignals:{[name]:constantSignal}\n}=constants;\nconst supported=constantSignal!==undefined;\nconst number=supported?constantSignal:defaultNumber;\nreturn{name,number,description,supported,action,forced,standard}\n};", "\n\nexport const SIGNALS=[\n{\nname:\"SIGHUP\",\nnumber:1,\naction:\"terminate\",\ndescription:\"Terminal closed\",\nstandard:\"posix\"\n},\n{\nname:\"SIGINT\",\nnumber:2,\naction:\"terminate\",\ndescription:\"User interruption with CTRL-C\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGQUIT\",\nnumber:3,\naction:\"core\",\ndescription:\"User interruption with CTRL-\\\\\",\nstandard:\"posix\"\n},\n{\nname:\"SIGILL\",\nnumber:4,\naction:\"core\",\ndescription:\"Invalid machine instruction\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGTRAP\",\nnumber:5,\naction:\"core\",\ndescription:\"Debugger breakpoint\",\nstandard:\"posix\"\n},\n{\nname:\"SIGABRT\",\nnumber:6,\naction:\"core\",\ndescription:\"Aborted\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGIOT\",\nnumber:6,\naction:\"core\",\ndescription:\"Aborted\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGBUS\",\nnumber:7,\naction:\"core\",\ndescription:\n\"Bus error due to misaligned, non-existing address or paging error\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGEMT\",\nnumber:7,\naction:\"terminate\",\ndescription:\"Command should be emulated but is not implemented\",\nstandard:\"other\"\n},\n{\nname:\"SIGFPE\",\nnumber:8,\naction:\"core\",\ndescription:\"Floating point arithmetic error\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGKILL\",\nnumber:9,\naction:\"terminate\",\ndescription:\"Forced termination\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGUSR1\",\nnumber:10,\naction:\"terminate\",\ndescription:\"Application-specific signal\",\nstandard:\"posix\"\n},\n{\nname:\"SIGSEGV\",\nnumber:11,\naction:\"core\",\ndescription:\"Segmentation fault\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGUSR2\",\nnumber:12,\naction:\"terminate\",\ndescription:\"Application-specific signal\",\nstandard:\"posix\"\n},\n{\nname:\"SIGPIPE\",\nnumber:13,\naction:\"terminate\",\ndescription:\"Broken pipe or socket\",\nstandard:\"posix\"\n},\n{\nname:\"SIGALRM\",\nnumber:14,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"posix\"\n},\n{\nname:\"SIGTERM\",\nnumber:15,\naction:\"terminate\",\ndescription:\"Termination\",\nstandard:\"ansi\"\n},\n{\nname:\"SIGSTKFLT\",\nnumber:16,\naction:\"terminate\",\ndescription:\"Stack is empty or overflowed\",\nstandard:\"other\"\n},\n{\nname:\"SIGCHLD\",\nnumber:17,\naction:\"ignore\",\ndescription:\"Child process terminated, paused or unpaused\",\nstandard:\"posix\"\n},\n{\nname:\"SIGCLD\",\nnumber:17,\naction:\"ignore\",\ndescription:\"Child process terminated, paused or unpaused\",\nstandard:\"other\"\n},\n{\nname:\"SIGCONT\",\nnumber:18,\naction:\"unpause\",\ndescription:\"Unpaused\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGSTOP\",\nnumber:19,\naction:\"pause\",\ndescription:\"Paused\",\nstandard:\"posix\",\nforced:true\n},\n{\nname:\"SIGTSTP\",\nnumber:20,\naction:\"pause\",\ndescription:\"Paused using CTRL-Z or \\\"suspend\\\"\",\nstandard:\"posix\"\n},\n{\nname:\"SIGTTIN\",\nnumber:21,\naction:\"pause\",\ndescription:\"Background process cannot read terminal input\",\nstandard:\"posix\"\n},\n{\nname:\"SIGBREAK\",\nnumber:21,\naction:\"terminate\",\ndescription:\"User interruption with CTRL-BREAK\",\nstandard:\"other\"\n},\n{\nname:\"SIGTTOU\",\nnumber:22,\naction:\"pause\",\ndescription:\"Background process cannot write to terminal output\",\nstandard:\"posix\"\n},\n{\nname:\"SIGURG\",\nnumber:23,\naction:\"ignore\",\ndescription:\"Socket received out-of-band data\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGXCPU\",\nnumber:24,\naction:\"core\",\ndescription:\"Process timed out\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGXFSZ\",\nnumber:25,\naction:\"core\",\ndescription:\"File too big\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGVTALRM\",\nnumber:26,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGPROF\",\nnumber:27,\naction:\"terminate\",\ndescription:\"Timeout or timer\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGWINCH\",\nnumber:28,\naction:\"ignore\",\ndescription:\"Terminal window size changed\",\nstandard:\"bsd\"\n},\n{\nname:\"SIGIO\",\nnumber:29,\naction:\"terminate\",\ndescription:\"I/O is available\",\nstandard:\"other\"\n},\n{\nname:\"SIGPOLL\",\nnumber:29,\naction:\"terminate\",\ndescription:\"Watched event\",\nstandard:\"other\"\n},\n{\nname:\"SIGINFO\",\nnumber:29,\naction:\"ignore\",\ndescription:\"Request for process information\",\nstandard:\"other\"\n},\n{\nname:\"SIGPWR\",\nnumber:30,\naction:\"terminate\",\ndescription:\"Device running out of power\",\nstandard:\"systemv\"\n},\n{\nname:\"SIGSYS\",\nnumber:31,\naction:\"core\",\ndescription:\"Invalid system call\",\nstandard:\"other\"\n},\n{\nname:\"SIGUNUSED\",\nnumber:31,\naction:\"terminate\",\ndescription:\"Invalid system call\",\nstandard:\"other\"\n}];", "import {once} from 'node:events';\n\n// Combines `util.aborted()` and `events.addAbortListener()`: promise-based and cleaned up with a stop signal\nexport const onAbortedSignal = async (mainSignal, stopSignal) => {\n\tif (!mainSignal.aborted) {\n\t\tawait once(mainSignal, 'abort', {signal: stopSignal});\n\t}\n};\n", "import {onAbortedSignal} from '../utils/abort-signal.js';\n\n// Validate the `cancelSignal` option\nexport const validateCancelSignal = ({cancelSignal}) => {\n\tif (cancelSignal !== undefined && Object.prototype.toString.call(cancelSignal) !== '[object AbortSignal]') {\n\t\tthrow new Error(`The \\`cancelSignal\\` option must be an AbortSignal: ${String(cancelSignal)}`);\n\t}\n};\n\n// Terminate the subprocess when aborting the `cancelSignal` option and `gracefulSignal` is `false`\nexport const throwOnCancel = ({kill, cancelSignal, gracefulCancel, context, controller}) => cancelSignal === undefined || gracefulCancel\n\t? []\n\t: [terminateOnCancel(kill, cancelSignal, context, controller)];\n\nconst terminateOnCancel = async (kill, cancelSignal, context, {signal}) => {\n\tawait onAbortedSignal(cancelSignal, signal);\n\tcontext.terminationReason ??= 'cancel';\n\tkill();\n\tthrow cancelSignal.reason;\n};\n", "import {scheduler} from 'node:timers/promises';\nimport {sendOneMessage} from './send.js';\nimport {getIpcEmitter} from './forward.js';\nimport {validateConnection, getAbortDisconnectError, throwOnMissingParent} from './validation.js';\n\n// Send an IPC message so the subprocess performs a graceful termination\nexport const sendAbort = (subprocess, message) => {\n\tconst methodName = 'cancelSignal';\n\tvalidateConnection(methodName, false, subprocess.connected);\n\treturn sendOneMessage({\n\t\tanyProcess: subprocess,\n\t\tmethodName,\n\t\tisSubprocess: false,\n\t\twrappedMessage: {type: GRACEFUL_CANCEL_TYPE, message},\n\t\tmessage,\n\t});\n};\n\n// When the signal is being used, start listening for incoming messages.\n// Unbuffering messages takes one microtask to complete, so this must be async.\nexport const getCancelSignal = async ({anyProcess, channel, isSubprocess, ipc}) => {\n\tawait startIpc({\n\t\tanyProcess,\n\t\tchannel,\n\t\tisSubprocess,\n\t\tipc,\n\t});\n\treturn cancelController.signal;\n};\n\nconst startIpc = async ({anyProcess, channel, isSubprocess, ipc}) => {\n\tif (isCancelListening) {\n\t\treturn;\n\t}\n\n\tisCancelListening = true;\n\n\tif (!ipc) {\n\t\tthrowOnMissingParent();\n\t\treturn;\n\t}\n\n\tif (channel === null) {\n\t\tabortOnDisconnect();\n\t\treturn;\n\t}\n\n\tgetIpcEmitter(anyProcess, channel, isSubprocess);\n\tawait scheduler.yield();\n};\n\nlet isCancelListening = false;\n\n// Reception of IPC message to perform a graceful termination\nexport const handleAbort = wrappedMessage => {\n\tif (wrappedMessage?.type !== GRACEFUL_CANCEL_TYPE) {\n\t\treturn false;\n\t}\n\n\tcancelController.abort(wrappedMessage.message);\n\treturn true;\n};\n\nconst GRACEFUL_CANCEL_TYPE = 'execa:ipc:cancel';\n\n// When the current process disconnects early, the subprocess `cancelSignal` is aborted.\n// Otherwise, the signal would never be able to be aborted later on.\nexport const abortOnDisconnect = () => {\n\tcancelController.abort(getAbortDisconnectError());\n};\n\nconst cancelController = new AbortController();\n", "import {promisify} from 'node:util';\nimport {\n\tvalidateIpcMethod,\n\thandleEpipeError,\n\thandleSerializationError,\n\tdisconnect,\n} from './validation.js';\nimport {startSendMessage, endSendMessage} from './outgoing.js';\nimport {handleSendStrict, waitForStrictResponse} from './strict.js';\n\n// Like `[sub]process.send()` but promise-based.\n// We do not `await subprocess` during `.sendMessage()` nor `.getOneMessage()` since those methods are transient.\n// Users would still need to `await subprocess` after the method is done.\n// Also, this would prevent `unhandledRejection` event from being emitted, making it silent.\nexport const sendMessage = ({anyProcess, channel, isSubprocess, ipc}, message, {strict = false} = {}) => {\n\tconst methodName = 'sendMessage';\n\tvalidateIpcMethod({\n\t\tmethodName,\n\t\tisSubprocess,\n\t\tipc,\n\t\tisConnected: anyProcess.connected,\n\t});\n\n\treturn sendMessageAsync({\n\t\tanyProcess,\n\t\tchannel,\n\t\tmethodName,\n\t\tisSubprocess,\n\t\tmessage,\n\t\tstrict,\n\t});\n};\n\nconst sendMessageAsync = async ({anyProcess, channel, methodName, isSubprocess, message, strict}) => {\n\tconst wrappedMessage = handleSendStrict({\n\t\tanyProcess,\n\t\tchannel,\n\t\tisSubprocess,\n\t\tmessage,\n\t\tstrict,\n\t});\n\tconst outgoingMessagesState = startSendMessage(anyProcess, wrappedMessage, strict);\n\ttry {\n\t\tawait sendOneMessage({\n\t\t\tanyProcess,\n\t\t\tmethodName,\n\t\t\tisSubprocess,\n\t\t\twrappedMessage,\n\t\t\tmessage,\n\t\t});\n\t} catch (error) {\n\t\tdisconnect(anyProcess);\n\t\tthrow error;\n\t} finally {\n\t\tendSendMessage(outgoingMessagesState);\n\t}\n};\n\n// Used internally by `cancelSignal`\nexport const sendOneMessage = async ({anyProcess, methodName, isSubprocess, wrappedMessage, message}) => {\n\tconst sendMethod = getSendMethod(anyProcess);\n\n\ttry {\n\t\tawait Promise.all([\n\t\t\twaitForStrictResponse(wrappedMessage, anyProcess, isSubprocess),\n\t\t\tsendMethod(wrappedMessage),\n\t\t]);\n\t} catch (error) {\n\t\thandleEpipeError({error, methodName, isSubprocess});\n\t\thandleSerializationError({\n\t\t\terror,\n\t\t\tmethodName,\n\t\t\tisSubprocess,\n\t\t\tmessage,\n\t\t});\n\t\tthrow error;\n\t}\n};\n\n// [sub]process.send() promisified, memoized\nconst getSendMethod = anyProcess => {\n\tif (PROCESS_SEND_METHODS.has(anyProcess)) {\n\t\treturn PROCESS_SEND_METHODS.get(anyProcess);\n\t}\n\n\tconst sendMethod = promisify(anyProcess.send.bind(anyProcess));\n\tPROCESS_SEND_METHODS.set(anyProcess, sendMethod);\n\treturn sendMethod;\n};\n\nconst PROCESS_SEND_METHODS = new WeakMap();\n", "// Validate the IPC channel is connected before receiving/sending messages\nexport const validateIpcMethod = ({methodName, isSubprocess, ipc, isConnected}) => {\n\tvalidateIpcOption(methodName, isSubprocess, ipc);\n\tvalidateConnection(methodName, isSubprocess, isConnected);\n};\n\n// Better error message when forgetting to set `ipc: true` and using the IPC methods\nconst validateIpcOption = (methodName, isSubprocess, ipc) => {\n\tif (!ipc) {\n\t\tthrow new Error(`${getMethodName(methodName, isSubprocess)} can only be used if the \\`ipc\\` option is \\`true\\`.`);\n\t}\n};\n\n// Better error message when one process does not send/receive messages once the other process has disconnected.\n// This also makes it clear that any buffered messages are lost once either process has disconnected.\n// Also when aborting `cancelSignal` after disconnecting the IPC.\nexport const validateConnection = (methodName, isSubprocess, isConnected) => {\n\tif (!isConnected) {\n\t\tthrow new Error(`${getMethodName(methodName, isSubprocess)} cannot be used: the ${getOtherProcessName(isSubprocess)} has already exited or disconnected.`);\n\t}\n};\n\n// When `getOneMessage()` could not complete due to an early disconnection\nexport const throwOnEarlyDisconnect = isSubprocess => {\n\tthrow new Error(`${getMethodName('getOneMessage', isSubprocess)} could not complete: the ${getOtherProcessName(isSubprocess)} exited or disconnected.`);\n};\n\n// When both processes use `sendMessage()` with `strict` at the same time\nexport const throwOnStrictDeadlockError = isSubprocess => {\n\tthrow new Error(`${getMethodName('sendMessage', isSubprocess)} failed: the ${getOtherProcessName(isSubprocess)} is sending a message too, instead of listening to incoming messages.\nThis can be fixed by both sending a message and listening to incoming messages at the same time:\n\nconst [receivedMessage] = await Promise.all([\n\t${getMethodName('getOneMessage', isSubprocess)},\n\t${getMethodName('sendMessage', isSubprocess, 'message, {strict: true}')},\n]);`);\n};\n\n// When the other process used `strict` but the current process had I/O error calling `sendMessage()` for the response\nexport const getStrictResponseError = (error, isSubprocess) => new Error(`${getMethodName('sendMessage', isSubprocess)} failed when sending an acknowledgment response to the ${getOtherProcessName(isSubprocess)}.`, {cause: error});\n\n// When using `strict` but the other process was not listening for messages\nexport const throwOnMissingStrict = isSubprocess => {\n\tthrow new Error(`${getMethodName('sendMessage', isSubprocess)} failed: the ${getOtherProcessName(isSubprocess)} is not listening to incoming messages.`);\n};\n\n// When using `strict` but the other process disconnected before receiving the message\nexport const throwOnStrictDisconnect = isSubprocess => {\n\tthrow new Error(`${getMethodName('sendMessage', isSubprocess)} failed: the ${getOtherProcessName(isSubprocess)} exited without listening to incoming messages.`);\n};\n\n// When the current process disconnects while the subprocess is listening to `cancelSignal`\nexport const getAbortDisconnectError = () => new Error(`\\`cancelSignal\\` aborted: the ${getOtherProcessName(true)} disconnected.`);\n\n// When the subprocess uses `cancelSignal` but not the current process\nexport const throwOnMissingParent = () => {\n\tthrow new Error('`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.');\n};\n\n// EPIPE can happen when sending a message to a subprocess that is closing but has not disconnected yet\nexport const handleEpipeError = ({error, methodName, isSubprocess}) => {\n\tif (error.code === 'EPIPE') {\n\t\tthrow new Error(`${getMethodName(methodName, isSubprocess)} cannot be used: the ${getOtherProcessName(isSubprocess)} is disconnecting.`, {cause: error});\n\t}\n};\n\n// Better error message when sending messages which cannot be serialized.\n// Works with both `serialization: 'advanced'` and `serialization: 'json'`.\nexport const handleSerializationError = ({error, methodName, isSubprocess, message}) => {\n\tif (isSerializationError(error)) {\n\t\tthrow new Error(`${getMethodName(methodName, isSubprocess)}'s argument type is invalid: the message cannot be serialized: ${String(message)}.`, {cause: error});\n\t}\n};\n\nconst isSerializationError = ({code, message}) => SERIALIZATION_ERROR_CODES.has(code)\n\t|| SERIALIZATION_ERROR_MESSAGES.some(serializationErrorMessage => message.includes(serializationErrorMessage));\n\n// `error.code` set by Node.js when it failed to serialize the message\nconst SERIALIZATION_ERROR_CODES = new Set([\n\t// Message is `undefined`\n\t'ERR_MISSING_ARGS',\n\t// Message is a function, a bigint, a symbol\n\t'ERR_INVALID_ARG_TYPE',\n]);\n\n// `error.message` set by Node.js when it failed to serialize the message\nconst SERIALIZATION_ERROR_MESSAGES = [\n\t// Message is a promise or a proxy, with `serialization: 'advanced'`\n\t'could not be cloned',\n\t// Message has cycles, with `serialization: 'json'`\n\t'circular structure',\n\t// Message has cycles inside toJSON(), with `serialization: 'json'`\n\t'call stack size exceeded',\n];\n\nconst getMethodName = (methodName, isSubprocess, parameters = '') => methodName === 'cancelSignal'\n\t? '`cancelSignal`\\'s `controller.abort()`'\n\t: `${getNamespaceName(isSubprocess)}${methodName}(${parameters})`;\n\nconst getNamespaceName = isSubprocess => isSubprocess ? '' : 'subprocess.';\n\nconst getOtherProcessName = isSubprocess => isSubprocess ? 'parent process' : 'subprocess';\n\n// When any error arises, we disconnect the IPC.\n// Otherwise, it is likely that one of the processes will stop sending/receiving messages.\n// This would leave the other process hanging.\nexport const disconnect = anyProcess => {\n\tif (anyProcess.connected) {\n\t\tanyProcess.disconnect();\n\t}\n};\n", "export const createDeferred = () => {\n\tconst methods = {};\n\tconst promise = new Promise((resolve, reject) => {\n\t\tObject.assign(methods, {resolve, reject});\n\t});\n\treturn Object.assign(promise, methods);\n};\n", "import {once} from 'node:events';\nimport {createDeferred} from '../utils/deferred.js';\nimport {incrementMaxListeners} from '../utils/max-listeners.js';\nimport {sendMessage} from './send.js';\nimport {throwOnMissingStrict, throwOnStrictDisconnect, throwOnStrictDeadlockError} from './validation.js';\nimport {getIpcEmitter} from './forward.js';\nimport {hasMessageListeners} from './outgoing.js';\n\n// When using the `strict` option, wrap the message with metadata during `sendMessage()`\nexport const handleSendStrict = ({anyProcess, channel, isSubprocess, message, strict}) => {\n\tif (!strict) {\n\t\treturn message;\n\t}\n\n\tconst ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);\n\tconst hasListeners = hasMessageListeners(anyProcess, ipcEmitter);\n\treturn {\n\t\tid: count++,\n\t\ttype: REQUEST_TYPE,\n\t\tmessage,\n\t\thasListeners,\n\t};\n};\n\nlet count = 0n;\n\n// Handles when both processes are calling `sendMessage()` with `strict` at the same time.\n// If neither process is listening, this would create a deadlock. We detect it and throw.\nexport const validateStrictDeadlock = (outgoingMessages, wrappedMessage) => {\n\tif (wrappedMessage?.type !== REQUEST_TYPE || wrappedMessage.hasListeners) {\n\t\treturn;\n\t}\n\n\tfor (const {id} of outgoingMessages) {\n\t\tif (id !== undefined) {\n\t\t\tSTRICT_RESPONSES[id].resolve({isDeadlock: true, hasListeners: false});\n\t\t}\n\t}\n};\n\n// The other process then sends the acknowledgment back as a response\nexport const handleStrictRequest = async ({wrappedMessage, anyProcess, channel, isSubprocess, ipcEmitter}) => {\n\tif (wrappedMessage?.type !== REQUEST_TYPE || !anyProcess.connected) {\n\t\treturn wrappedMessage;\n\t}\n\n\tconst {id, message} = wrappedMessage;\n\tconst response = {id, type: RESPONSE_TYPE, message: hasMessageListeners(anyProcess, ipcEmitter)};\n\n\ttry {\n\t\tawait sendMessage({\n\t\t\tanyProcess,\n\t\t\tchannel,\n\t\t\tisSubprocess,\n\t\t\tipc: true,\n\t\t}, response);\n\t} catch (error) {\n\t\tipcEmitter.emit('strict:error', error);\n\t}\n\n\treturn message;\n};\n\n// Reception of the acknowledgment response\nexport const handleStrictResponse = wrappedMessage => {\n\tif (wrappedMessage?.type !== RESPONSE_TYPE) {\n\t\treturn false;\n\t}\n\n\tconst {id, message: hasListeners} = wrappedMessage;\n\tSTRICT_RESPONSES[id]?.resolve({isDeadlock: false, hasListeners});\n\treturn true;\n};\n\n// Wait for the other process to receive the message from `sendMessage()`\nexport const waitForStrictResponse = async (wrappedMessage, anyProcess, isSubprocess) => {\n\tif (wrappedMessage?.type !== REQUEST_TYPE) {\n\t\treturn;\n\t}\n\n\tconst deferred = createDeferred();\n\tSTRICT_RESPONSES[wrappedMessage.id] = deferred;\n\tconst controller = new AbortController();\n\n\ttry {\n\t\tconst {isDeadlock, hasListeners} = await Promise.race([\n\t\t\tdeferred,\n\t\t\tthrowOnDisconnect(anyProcess, isSubprocess, controller),\n\t\t]);\n\n\t\tif (isDeadlock) {\n\t\t\tthrowOnStrictDeadlockError(isSubprocess);\n\t\t}\n\n\t\tif (!hasListeners) {\n\t\t\tthrowOnMissingStrict(isSubprocess);\n\t\t}\n\t} finally {\n\t\tcontroller.abort();\n\t\tdelete STRICT_RESPONSES[wrappedMessage.id];\n\t}\n};\n\nconst STRICT_RESPONSES = {};\n\nconst throwOnDisconnect = async (anyProcess, isSubprocess, {signal}) => {\n\tincrementMaxListeners(anyProcess, 1, signal);\n\tawait once(anyProcess, 'disconnect', {signal});\n\tthrowOnStrictDisconnect(isSubprocess);\n};\n\nconst REQUEST_TYPE = 'execa:ipc:request';\nconst RESPONSE_TYPE = 'execa:ipc:response';\n", "import {addAbortListener} from 'node:events';\n\n// Temporarily increase the maximum number of listeners on an eventEmitter\nexport const incrementMaxListeners = (eventEmitter, maxListenersIncrement, signal) => {\n\tconst maxListeners = eventEmitter.getMaxListeners();\n\tif (maxListeners === 0 || maxListeners === Infinity) {\n\t\treturn;\n\t}\n\n\teventEmitter.setMaxListeners(maxListeners + maxListenersIncrement);\n\taddAbortListener(signal, () => {\n\t\teventEmitter.setMaxListeners(eventEmitter.getMaxListeners() - maxListenersIncrement);\n\t});\n};\n", "import {EventEmitter} from 'node:events';\nimport {onMessage, onDisconnect} from './incoming.js';\nimport {undoAddedReferences} from './reference.js';\n\n// Forward the `message` and `disconnect` events from the process and subprocess to a proxy emitter.\n// This prevents the `error` event from stopping IPC.\n// This also allows debouncing the `message` event.\nexport const getIpcEmitter = (anyProcess, channel, isSubprocess) => {\n\tif (IPC_EMITTERS.has(anyProcess)) {\n\t\treturn IPC_EMITTERS.get(anyProcess);\n\t}\n\n\t// Use an `EventEmitter`, like the `process` that is being proxied\n\t// eslint-disable-next-line unicorn/prefer-event-target\n\tconst ipcEmitter = new EventEmitter();\n\tipcEmitter.connected = true;\n\tIPC_EMITTERS.set(anyProcess, ipcEmitter);\n\tforwardEvents({\n\t\tipcEmitter,\n\t\tanyProcess,\n\t\tchannel,\n\t\tisSubprocess,\n\t});\n\treturn ipcEmitter;\n};\n\nconst IPC_EMITTERS = new WeakMap();\n\n// The `message` and `disconnect` events are buffered in the subprocess until the first listener is setup.\n// However, unbuffering happens after one tick, so this give enough time for the caller to setup the listener on the proxy emitter first.\n// See https://github.com/nodejs/node/blob/2aaeaa863c35befa2ebaa98fb7737ec84df4d8e9/lib/internal/child_process.js#L721\nconst forwardEvents = ({ipcEmitter, anyProcess, channel, isSubprocess}) => {\n\tconst boundOnMessage = onMessage.bind(undefined, {\n\t\tanyProcess,\n\t\tchannel,\n\t\tisSubprocess,\n\t\tipcEmitter,\n\t});\n\tanyProcess.on('message', boundOnMessage);\n\tanyProcess.once('disconnect', onDisconnect.bind(undefined, {\n\t\tanyProcess,\n\t\tchannel,\n\t\tisSubprocess,\n\t\tipcEmitter,\n\t\tboundOnMessage,\n\t}));\n\tundoAddedReferences(channel, isSubprocess);\n};\n\n// Check whether there might still be some `message` events to receive\nexport const isConnected = anyProcess => {\n\tconst ipcEmitter = IPC_EMITTERS.get(anyProcess);\n\treturn ipcEmitter === undefined\n\t\t? anyProcess.channel !== undefined && anyProcess.channel !== null\n\t\t: ipcEmitter.connected;\n};\n", "import {once} from 'node:events';\nimport {scheduler} from 'node:timers/promises';\nimport {waitForOutgoingMessages} from './outgoing.js';\nimport {redoAddedReferences} from './reference.js';\nimport {handleStrictRequest, handleStrictResponse} from './strict.js';\nimport {handleAbort, abortOnDisconnect} from './graceful.js';\n\n// By default, Node.js buffers `message` events.\n// - Buffering happens when there is a `message` event is emitted but there is no handler.\n// - As soon as a `message` event handler is set, all buffered `message` events are emitted, emptying the buffer.\n// - This happens both in the current process and the subprocess.\n// - See https://github.com/nodejs/node/blob/501546e8f37059cd577041e23941b640d0d4d406/lib/internal/child_process.js#L719\n// This is helpful. Notably, this allows sending messages to a subprocess that's still initializing.\n// However, it has several problems.\n// - This works with `events.on()` but not `events.once()` since all buffered messages are emitted at once.\n// For example, users cannot call `await getOneMessage()`/`getEachMessage()` multiple times in a row.\n// - When a user intentionally starts listening to `message` at a specific point in time, past `message` events are replayed, which might be unexpected.\n// - Buffering is unlimited, which might lead to an out-of-memory crash.\n// - This does not work well with multiple consumers.\n// For example, Execa consumes events with both `result.ipcOutput` and manual IPC calls like `getOneMessage()`.\n// Since `result.ipcOutput` reads all incoming messages, no buffering happens for manual IPC calls.\n// - Forgetting to setup a `message` listener, or setting it up too late, is a programming mistake.\n// The default behavior does not allow users to realize they made that mistake.\n// To solve those problems, instead of buffering messages, we debounce them.\n// The `message` event so it is emitted at most once per macrotask.\nexport const onMessage = async ({anyProcess, channel, isSubprocess, ipcEmitter}, wrappedMessage) => {\n\tif (handleStrictResponse(wrappedMessage) || handleAbort(wrappedMessage)) {\n\t\treturn;\n\t}\n\n\tif (!INCOMING_MESSAGES.has(anyProcess)) {\n\t\tINCOMING_MESSAGES.set(anyProcess, []);\n\t}\n\n\tconst incomingMessages = INCOMING_MESSAGES.get(anyProcess);\n\tincomingMessages.push(wrappedMessage);\n\n\tif (incomingMessages.length > 1) {\n\t\treturn;\n\t}\n\n\twhile (incomingMessages.length > 0) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tawait waitForOutgoingMessages(anyProcess, ipcEmitter, wrappedMessage);\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tawait scheduler.yield();\n\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst message = await handleStrictRequest({\n\t\t\twrappedMessage: incomingMessages[0],\n\t\t\tanyProcess,\n\t\t\tchannel,\n\t\t\tisSubprocess,\n\t\t\tipcEmitter,\n\t\t});\n\n\t\tincomingMessages.shift();\n\t\tipcEmitter.emit('message', message);\n\t\tipcEmitter.emit('message:done');\n\t}\n};\n\n// If the `message` event is currently debounced, the `disconnect` event must wait for it\nexport const onDisconnect = async ({anyProcess, channel, isSubprocess, ipcEmitter, boundOnMessage}) => {\n\tabortOnDisconnect();\n\n\tconst incomingMessages = INCOMING_MESSAGES.get(anyProcess);\n\twhile (incomingMessages?.length > 0) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tawait once(ipcEmitter, 'message:done');\n\t}\n\n\tanyProcess.removeListener('message', boundOnMessage);\n\tredoAddedReferences(channel, isSubprocess);\n\tipcEmitter.connected = false;\n\tipcEmitter.emit('disconnect');\n};\n\nconst INCOMING_MESSAGES = new WeakMap();\n", "// By default, Node.js keeps the subprocess alive while it has a `message` or `disconnect` listener.\n// We replicate the same logic for the events that we proxy.\n// This ensures the subprocess is kept alive while `getOneMessage()` and `getEachMessage()` are ongoing.\n// This is not a problem with `sendMessage()` since Node.js handles that method automatically.\n// We do not use `anyProcess.channel.ref()` since this would prevent the automatic `.channel.refCounted()` Node.js is doing.\n// We keep a reference to `anyProcess.channel` since it might be `null` while `getOneMessage()` or `getEachMessage()` is still processing debounced messages.\n// See https://github.com/nodejs/node/blob/2aaeaa863c35befa2ebaa98fb7737ec84df4d8e9/lib/internal/child_process.js#L547\nexport const addReference = (channel, reference) => {\n\tif (reference) {\n\t\taddReferenceCount(channel);\n\t}\n};\n\nconst addReferenceCount = channel => {\n\tchannel.refCounted();\n};\n\nexport const removeReference = (channel, reference) => {\n\tif (reference) {\n\t\tremoveReferenceCount(channel);\n\t}\n};\n\nconst removeReferenceCount = channel => {\n\tchannel.unrefCounted();\n};\n\n// To proxy events, we setup some global listeners on the `message` and `disconnect` events.\n// Those should not keep the subprocess alive, so we remove the automatic counting that Node.js is doing.\n// See https://github.com/nodejs/node/blob/1b965270a9c273d4cf70e8808e9d28b9ada7844f/lib/child_process.js#L180\nexport const undoAddedReferences = (channel, isSubprocess) => {\n\tif (!isSubprocess) {\n\t\treturn;\n\t}\n\n\tremoveReferenceCount(channel);\n\tremoveReferenceCount(channel);\n};\n\n// Reverse it during `disconnect`\nexport const redoAddedReferences = (channel, isSubprocess) => {\n\tif (!isSubprocess) {\n\t\treturn;\n\t}\n\n\taddReferenceCount(channel);\n\taddReferenceCount(channel);\n};\n", "import {createDeferred} from '../utils/deferred.js';\nimport {getFdSpecificValue} from '../arguments/specific.js';\nimport {validateStrictDeadlock} from './strict.js';\n\n// When `sendMessage()` is ongoing, any `message` being received waits before being emitted.\n// This allows calling one or multiple `await sendMessage()` followed by `await getOneMessage()`/`await getEachMessage()`.\n// Without running into a race condition when the other process sends a response too fast, before the current process set up a listener.\nexport const startSendMessage = (anyProcess, wrappedMessage, strict) => {\n\tif (!OUTGOING_MESSAGES.has(anyProcess)) {\n\t\tOUTGOING_MESSAGES.set(anyProcess, new Set());\n\t}\n\n\tconst outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);\n\tconst onMessageSent = createDeferred();\n\tconst id = strict ? wrappedMessage.id : undefined;\n\tconst outgoingMessage = {onMessageSent, id};\n\toutgoingMessages.add(outgoingMessage);\n\treturn {outgoingMessages, outgoingMessage};\n};\n\nexport const endSendMessage = ({outgoingMessages, outgoingMessage}) => {\n\toutgoingMessages.delete(outgoingMessage);\n\toutgoingMessage.onMessageSent.resolve();\n};\n\n// Await while `sendMessage()` is ongoing, unless there is already a `message` listener\nexport const waitForOutgoingMessages = async (anyProcess, ipcEmitter, wrappedMessage) => {\n\twhile (!hasMessageListeners(anyProcess, ipcEmitter) && OUTGOING_MESSAGES.get(anyProcess)?.size > 0) {\n\t\tconst outgoingMessages = [...OUTGOING_MESSAGES.get(anyProcess)];\n\t\tvalidateStrictDeadlock(outgoingMessages, wrappedMessage);\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tawait Promise.all(outgoingMessages.map(({onMessageSent}) => onMessageSent));\n\t}\n};\n\nconst OUTGOING_MESSAGES = new WeakMap();\nconst IPC_SUBPROCESS_OPTIONS = new WeakMap();\n\nexport const setIpcSubprocessOptions = (subprocess, options) => {\n\tIPC_SUBPROCESS_OPTIONS.set(subprocess, options);\n};\n\n// Whether any `message` listener is setup\nexport const hasMessageListeners = (anyProcess, ipcEmitter) => ipcEmitter.listenerCount('message') > getMinListenerCount(anyProcess);\n\n// When `buffer` is `false`, we set up a `message` listener that should be ignored.\n// That listener is only meant to intercept `strict` acknowledgement responses.\nconst getMinListenerCount = anyProcess => getOptions(anyProcess) !== undefined\n\t&& !getFdSpecificValue(getOptions(anyProcess).buffer, 'ipc')\n\t? 1\n\t: 0;\n\nconst getOptions = anyProcess => IPC_SUBPROCESS_OPTIONS.get(anyProcess);\n", "import {onAbortedSignal} from '../utils/abort-signal.js';\nimport {sendAbort} from '../ipc/graceful.js';\nimport {killOnTimeout} from './kill.js';\n\n// Validate the `gracefulCancel` option\nexport const validateGracefulCancel = ({gracefulCancel, cancelSignal, ipc, serialization}) => {\n\tif (!gracefulCancel) {\n\t\treturn;\n\t}\n\n\tif (cancelSignal === undefined) {\n\t\tthrow new Error('The `cancelSignal` option must be defined when setting the `gracefulCancel` option.');\n\t}\n\n\tif (!ipc) {\n\t\tthrow new Error('The `ipc` option cannot be false when setting the `gracefulCancel` option.');\n\t}\n\n\tif (serialization === 'json') {\n\t\tthrow new Error('The `serialization` option cannot be \\'json\\' when setting the `gracefulCancel` option.');\n\t}\n};\n\n// Send abort reason to the subprocess when aborting the `cancelSignal` option and `gracefulCancel` is `true`\nexport const throwOnGracefulCancel = ({\n\tsubprocess,\n\tkill,\n\tcancelSignal,\n\tgracefulCancel,\n\tforceKillAfterDelay,\n\tcontext,\n\tcontroller,\n}) => gracefulCancel\n\t? [sendOnAbort({\n\t\tsubprocess,\n\t\tkill,\n\t\tcancelSignal,\n\t\tforceKillAfterDelay,\n\t\tcontext,\n\t\tcontroller,\n\t})]\n\t: [];\n\nconst sendOnAbort = async ({subprocess, kill, cancelSignal, forceKillAfterDelay, context, controller: {signal}}) => {\n\tawait onAbortedSignal(cancelSignal, signal);\n\tconst reason = getReason(cancelSignal);\n\tawait sendAbort(subprocess, reason);\n\tkillOnTimeout({\n\t\tkill,\n\t\tforceKillAfterDelay,\n\t\tcontext,\n\t\tcontrollerSignal: signal,\n\t});\n\tcontext.terminationReason ??= 'gracefulCancel';\n\tthrow cancelSignal.reason;\n};\n\n// The default `reason` is a DOMException, which is not serializable with V8\n// See https://github.com/nodejs/node/issues/53225\nconst getReason = ({reason}) => {\n\tif (!(reason instanceof DOMException)) {\n\t\treturn reason;\n\t}\n\n\tconst error = new Error(reason.message);\n\tObject.defineProperty(error, 'stack', {\n\t\tvalue: reason.stack,\n\t\tenumerable: false,\n\t\tconfigurable: true,\n\t\twritable: true,\n\t});\n\treturn error;\n};\n", "import {setTimeout} from 'node:timers/promises';\nimport {DiscardedError} from '../return/final-error.js';\n\n// Validate `timeout` option\nexport const validateTimeout = ({timeout}) => {\n\tif (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {\n\t\tthrow new TypeError(`Expected the \\`timeout\\` option to be a non-negative integer, got \\`${timeout}\\` (${typeof timeout})`);\n\t}\n};\n\n// Fails when the `timeout` option is exceeded\nexport const throwOnTimeout = (kill, timeout, context, controller) => timeout === 0 || timeout === undefined\n\t? []\n\t: [killAfterTimeout(kill, timeout, context, controller)];\n\nconst killAfterTimeout = async (kill, timeout, context, {signal}) => {\n\tawait setTimeout(timeout, undefined, {signal});\n\tcontext.terminationReason ??= 'timeout';\n\tkill();\n\tthrow new DiscardedError();\n};\n", "import {execPath, execArgv} from 'node:process';\nimport path from 'node:path';\nimport {safeNormalizeFileUrl} from '../arguments/file-url.js';\n\n// `execaNode()` is a shortcut for `execa(..., {node: true})`\nexport const mapNode = ({options}) => {\n\tif (options.node === false) {\n\t\tthrow new TypeError('The \"node\" option cannot be false with `execaNode()`.');\n\t}\n\n\treturn {options: {...options, node: true}};\n};\n\n// Applies the `node: true` option, and the related `nodePath`/`nodeOptions` options.\n// Modifies the file commands/arguments to ensure the same Node binary and flags are re-used.\n// Also adds `ipc: true` and `shell: false`.\nexport const handleNodeOption = (file, commandArguments, {\n\tnode: shouldHandleNode = false,\n\tnodePath = execPath,\n\tnodeOptions = execArgv.filter(nodeOption => !nodeOption.startsWith('--inspect')),\n\tcwd,\n\texecPath: formerNodePath,\n\t...options\n}) => {\n\tif (formerNodePath !== undefined) {\n\t\tthrow new TypeError('The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.');\n\t}\n\n\tconst normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The \"nodePath\" option');\n\tconst resolvedNodePath = path.resolve(cwd, normalizedNodePath);\n\t// Use spread (which only copies own properties) to safely get shell without reading polluted prototype\n\tconst newOptions = {\n\t\t__proto__: null,\n\t\tshell: false,\n\t\t...options,\n\t\tnodePath: resolvedNodePath,\n\t\tnode: shouldHandleNode,\n\t\tcwd,\n\t};\n\n\tif (!shouldHandleNode) {\n\t\treturn [file, commandArguments, newOptions];\n\t}\n\n\tif (path.basename(file, '.exe') === 'node') {\n\t\tthrow new TypeError('When the \"node\" option is true, the first argument does not need to be \"node\".');\n\t}\n\n\treturn [\n\t\tresolvedNodePath,\n\t\t[\n\t\t\t...nodeOptions,\n\t\t\tfile,\n\t\t\t...commandArguments,\n\t\t],\n\t\t{\n\t\t\t__proto__: null,\n\t\t\tipc: true,\n\t\t\t...newOptions,\n\t\t\tshell: false,\n\t\t},\n\t];\n};\n", "import {serialize} from 'node:v8';\nimport {sendMessage} from './send.js';\n\n// Validate the `ipcInput` option\nexport const validateIpcInputOption = ({ipcInput, ipc, serialization}) => {\n\tif (ipcInput === undefined) {\n\t\treturn;\n\t}\n\n\tif (!ipc) {\n\t\tthrow new Error('The `ipcInput` option cannot be set unless the `ipc` option is `true`.');\n\t}\n\n\tvalidateIpcInput[serialization](ipcInput);\n};\n\nconst validateAdvancedInput = ipcInput => {\n\ttry {\n\t\tserialize(ipcInput);\n\t} catch (error) {\n\t\tthrow new Error('The `ipcInput` option is not serializable with a structured clone.', {cause: error});\n\t}\n};\n\nconst validateJsonInput = ipcInput => {\n\ttry {\n\t\tJSON.stringify(ipcInput);\n\t} catch (error) {\n\t\tthrow new Error('The `ipcInput` option is not serializable with JSON.', {cause: error});\n\t}\n};\n\nconst validateIpcInput = {\n\tadvanced: validateAdvancedInput,\n\tjson: validateJsonInput,\n};\n\n// When the `ipcInput` option is set, it is sent as an initial IPC message to the subprocess\nexport const sendIpcInput = async (subprocess, ipcInput, ipc) => {\n\tif (ipcInput === undefined) {\n\t\treturn;\n\t}\n\n\tawait sendMessage({\n\t\tanyProcess: subprocess,\n\t\tchannel: subprocess.channel,\n\t\tisSubprocess: false,\n\t\tipc,\n\t}, ipcInput);\n};\n", "// Validate `encoding` option\nexport const validateEncoding = ({encoding}) => {\n\tif (ENCODINGS.has(encoding)) {\n\t\treturn;\n\t}\n\n\tconst correctEncoding = getCorrectEncoding(encoding);\n\tif (correctEncoding !== undefined) {\n\t\tthrow new TypeError(`Invalid option \\`encoding: ${serializeEncoding(encoding)}\\`.\nPlease rename it to ${serializeEncoding(correctEncoding)}.`);\n\t}\n\n\tconst correctEncodings = [...ENCODINGS].map(correctEncoding => serializeEncoding(correctEncoding)).join(', ');\n\tthrow new TypeError(`Invalid option \\`encoding: ${serializeEncoding(encoding)}\\`.\nPlease rename it to one of: ${correctEncodings}.`);\n};\n\nconst TEXT_ENCODINGS = new Set(['utf8', 'utf16le']);\nexport const BINARY_ENCODINGS = new Set(['buffer', 'hex', 'base64', 'base64url', 'latin1', 'ascii']);\nconst ENCODINGS = TEXT_ENCODINGS.union(BINARY_ENCODINGS);\n\nconst getCorrectEncoding = encoding => {\n\tif (encoding === null) {\n\t\treturn 'buffer';\n\t}\n\n\tif (typeof encoding !== 'string') {\n\t\treturn;\n\t}\n\n\tconst lowerEncoding = encoding.toLowerCase();\n\tif (lowerEncoding in ENCODING_ALIASES) {\n\t\treturn ENCODING_ALIASES[lowerEncoding];\n\t}\n\n\tif (ENCODINGS.has(lowerEncoding)) {\n\t\treturn lowerEncoding;\n\t}\n};\n\nconst ENCODING_ALIASES = {\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\n\t'utf-8': 'utf8',\n\t'utf-16le': 'utf16le',\n\t'ucs-2': 'utf16le',\n\tucs2: 'utf16le',\n\tbinary: 'latin1',\n};\n\nconst serializeEncoding = encoding => typeof encoding === 'string' ? `\"${encoding}\"` : String(encoding);\n", "import {openSync, readSync, closeSync} from 'node:fs';\nimport {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport process from 'node:process';\nimport {whichCommandSync} from 'which-command';\nimport pathKey from 'path-key';\n\n/*\nOn Windows, `node:child_process` cannot natively run many kinds of files (`.cmd`, `.bat`, shebang scripts, ...): without a shell it resolves neither `PATHEXT` nor shebangs, and it does not escape arguments. We resolve the command to its full file path and escape its arguments ourselves, so those work without an explicit shell, just like on Unix, where the OS handles all of this for us.\n*/\nexport const parseCommandFile = (file, commandArguments, options) => {\n\t// The arguments are cloned since a shebang interpreter might be prepended below, which must not mutate the caller's array\n\tconst parsed = {file, commandArguments: [...commandArguments], options};\n\n\t// Under a shell, or on Unix, the OS resolves the file and escapes the arguments itself\n\tif (options.shell || process.platform !== 'win32') {\n\t\treturn parsed;\n\t}\n\n\treturn escapeWindowsCommand(parsed);\n};\n\n// Only `.exe` and `.com` files can be spawned directly; anything else needs `cmd.exe`\nconst directlyExecutableRegExp = /\\.(?:com|exe)$/i;\n\n// `.cmd` and `.bat` files re-expand their own arguments via `%*`/`%1`, so metacharacters must survive being interpreted by `cmd.exe` twice: once when the batch file is invoked and once when it forwards the arguments\nconst batchFileRegExp = /\\.(?:bat|cmd)$/i;\n\nconst escapeWindowsCommand = parsed => {\n\t// Resolve the file to an absolute path, following its shebang to the interpreter if any\n\tconst resolvedFile = resolveWithShebang(parsed);\n\n\t// A directly executable file is spawned as-is, bypassing `cmd.exe` and its escaping\n\tif (resolvedFile !== undefined && directlyExecutableRegExp.test(resolvedFile)) {\n\t\treturn parsed;\n\t}\n\n\t/*\n\t`cmd.exe` treats CR and LF as command separators and offers no way to escape them, so allowing either would enable command injection.\n\tReject them instead.\n\t*/\n\tfor (const value of [parsed.file, ...parsed.commandArguments]) {\n\t\tassertNoLineBreak(value);\n\t}\n\n\tconst isDoubleEscape = resolvedFile !== undefined && batchFileRegExp.test(resolvedFile);\n\t// POSIX separators must become Windows ones (`foo/bar` -> `foo\\bar`), otherwise resolution always fails with ENOENT\n\tconst escapedFile = escapeMetaChars(path.normalize(parsed.file));\n\tconst escapedArguments = parsed.commandArguments.map(argument => escapeArgument(argument, isDoubleEscape));\n\tconst commandLine = `\"${[escapedFile, ...escapedArguments].join(' ')}\"`;\n\n\t// Let `node:child_process` pass the already-escaped command line through untouched\n\tparsed.options.windowsVerbatimArguments = true;\n\treturn {\n\t\tfile: process.env.comspec || 'cmd.exe',\n\t\tcommandArguments: ['/d', '/s', '/c', commandLine],\n\t\toptions: parsed.options,\n\t};\n};\n\n// Resolve the command's absolute path, then, if it is a shebang script, resolve its interpreter instead, since Windows cannot run shebangs natively\nconst resolveWithShebang = parsed => {\n\tconst resolvedFile = resolvePath(parsed);\n\tconst interpreter = resolvedFile !== undefined && readShebang(resolvedFile);\n\tif (!interpreter) {\n\t\treturn resolvedFile;\n\t}\n\n\t// Run the interpreter with the script as its first argument, then resolve the interpreter's own path\n\tparsed.commandArguments.unshift(resolvedFile);\n\tparsed.file = interpreter;\n\treturn resolvePath(parsed);\n};\n\n// Search `PATH` for the command, resolving its Windows executable extension via `PATHEXT`\nconst resolvePath = parsed => {\n\tconst environment = parsed.options.env || process.env;\n\treturn whichCommandSync(parsed.file, {\n\t\tcwd: parsed.options.cwd,\n\t\tpath: environment[pathKey({env: environment})],\n\t});\n};\n\nconst SHEBANG_BYTE_LENGTH = 150;\n\n// Read the file's first bytes to find its shebang interpreter, if it has one\nconst readShebang = file => {\n\tconst buffer = Buffer.alloc(SHEBANG_BYTE_LENGTH);\n\n\ttry {\n\t\tconst fileDescriptor = openSync(file, 'r');\n\t\ttry {\n\t\t\treadSync(fileDescriptor, buffer, 0, SHEBANG_BYTE_LENGTH, 0);\n\t\t} finally {\n\t\t\tcloseSync(fileDescriptor);\n\t\t}\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\treturn parseShebang(buffer.toString());\n};\n\nconst shebangRegExp = /^#!(?<line>.*)/;\n\n/*\nExtract the interpreter from a shebang line, e.g. `#!/usr/bin/env node` -> `node`.\n*/\nconst parseShebang = contents => {\n\tconst shebangLine = contents.match(shebangRegExp)?.groups.line.trim();\n\tif (!shebangLine) {\n\t\treturn undefined;\n\t}\n\n\tconst [interpreterPath, argument] = shebangLine.split(' ');\n\tconst interpreter = interpreterPath.split('/').at(-1);\n\tif (interpreter === 'env') {\n\t\treturn argument;\n\t}\n\n\treturn argument ? `${interpreter} ${argument}` : interpreter;\n};\n\nconst lineBreakRegExp = /[\\n\\r]/;\n\nconst assertNoLineBreak = value => {\n\tif (lineBreakRegExp.test(value)) {\n\t\tthrow new TypeError(`The command and its arguments cannot contain a line break on Windows without a shell.\\nThis would allow a command injection with \\`cmd.exe\\`.\\nInvalid value: ${JSON.stringify(`${value}`)}`);\n\t}\n};\n\n// See https://web.archive.org/web/20241220221102/https://www.robvanderwoude.com/escapechars.php\n// eslint-disable-next-line regexp/sort-character-class-elements\nconst metaCharsRegExp = /[()\\][%!^\"`<>&|;, *?]/g;\n\n// Prefix every `cmd.exe` metacharacter with a caret to neutralize it\nconst escapeMetaChars = value => value.replaceAll(metaCharsRegExp, '^$&');\n\nconst backslashRunRegExp = /\\\\+/g;\n\nconst escapeArgument = (rawArgument, doubleEscape) => {\n\t/*\n\tEscape backslashes and double quotes for `cmd.exe`, following the algorithm at https://web.archive.org/web/20240930203505/https://qntm.org/cmd.\n\n\tA run of backslashes only needs doubling when it precedes a double quote, or the end of the argument since that becomes a double quote once the argument is wrapped below. Otherwise the backslashes would be taken as escaping that quote. Every double quote is then escaped in turn.\n\n\tEach backslash run is matched exactly once and consumed, so a long run cannot trigger the quadratic backtracking a naive pattern would, which would be a denial-of-service risk.\n\t*/\n\tconst argument = `${rawArgument}`\n\t\t.replaceAll(backslashRunRegExp, (backslashes, offset, string) => {\n\t\t\tconst nextCharacter = string[offset + backslashes.length];\n\t\t\tconst isPrecedesDoubleQuote = nextCharacter === '\"' || nextCharacter === undefined;\n\t\t\treturn isPrecedesDoubleQuote ? backslashes.repeat(2) : backslashes;\n\t\t})\n\t\t.replaceAll('\"', '\\\\\"');\n\n\t// Wrap the whole argument in double quotes, then caret-escape the metacharacters, a second time when targeting a cmd-shim\n\tconst escapedArgument = escapeMetaChars(`\"${argument}\"`);\n\treturn doubleEscape ? escapeMetaChars(escapedArgument) : escapedArgument;\n};\n", "import fs from 'node:fs';\nimport fsPromises from 'node:fs/promises';\nimport path from 'node:path';\nimport process from 'node:process';\n\nconst isWindows = process.platform === 'win32';\n\n// A command containing a directory separator is treated as a path and looked up directly, instead of being searched for in `PATH`. Backslash only counts as a separator on Windows, since it's a valid filename character on other platforms.\nconst separatorPattern = isWindows ? /[\\/\\\\]/v : /\\//v;\n\n// The standard Windows executable extensions, used when `PATHEXT` is not set.\nconst defaultPathExt = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC';\n\nfunction resolveOptions(command, options) {\n\tif (typeof command !== 'string' || command.length === 0) {\n\t\tthrow new TypeError('Expected a non-empty string.');\n\t}\n\n\tconst {\n\t\tcwd = process.cwd(),\n\t\t// On Windows, `process.env.PATH` can be undefined in some contexts (for example, worker threads), where it's only exposed as `Path`.\n\t\tpath: searchPath = process.env.PATH ?? (isWindows ? process.env.Path : undefined) ?? '',\n\t\t// `||` (not `??`) so an empty `PATHEXT` falls back to the default instead of disabling all lookup on Windows.\n\t\tpathExt = process.env.PATHEXT || defaultPathExt,\n\t} = options;\n\n\treturn {cwd, searchPath, pathExt};\n}\n\nfunction windowsExtensions(command, pathExt) {\n\tconst extensions = pathExt.split(path.delimiter).filter(Boolean);\n\tconst commandExtension = path.extname(command).toLowerCase();\n\n\t// If the command already ends with a known executable extension, also try it verbatim.\n\tif (commandExtension !== '' && extensions.some(extension => extension.toLowerCase() === commandExtension)) {\n\t\treturn ['', ...extensions];\n\t}\n\n\treturn extensions;\n}\n\nfunction * candidatePaths(command, {cwd, searchPath, pathExt}) {\n\tconst extensions = isWindows ? windowsExtensions(command, pathExt) : [''];\n\n\tif (separatorPattern.test(command)) {\n\t\tconst base = path.resolve(cwd, command);\n\t\tfor (const extension of extensions) {\n\t\t\tyield base + extension;\n\t\t}\n\n\t\treturn;\n\t}\n\n\tconst directories = [\n\t\t// Windows searches the current directory before `PATH`.\n\t\t...(isWindows ? [cwd] : []),\n\t\t...searchPath.split(path.delimiter),\n\t];\n\n\tfor (const directory of directories) {\n\t\t// `PATH` entries can be wrapped in double quotes on Windows.\n\t\tconst unquoted = isWindows && directory.length > 1 && directory.startsWith('\"') && directory.endsWith('\"') ? directory.slice(1, -1) : directory;\n\n\t\t// Skip empty entries. Unlike a POSIX shell, an empty entry is not treated as the current directory, since implicitly searching the current directory is a security risk. Checked after unquoting so a quoted-empty entry (`\"\"`) is skipped too.\n\t\tif (unquoted === '') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst base = path.resolve(cwd, unquoted, command);\n\t\tfor (const extension of extensions) {\n\t\t\tyield base + extension;\n\t\t}\n\t}\n}\n\nasync function isExecutable(filePath) {\n\tlet stats;\n\ttry {\n\t\tstats = await fsPromises.stat(filePath);\n\t} catch (error) {\n\t\t// Windows App Execution Aliases (in `WindowsApps`) throw `EACCES` on `stat`, but are valid, launchable executables.\n\t\treturn isWindows && error.code === 'EACCES';\n\t}\n\n\t// A directory can have the executable bit set, but it's not a command.\n\tif (!stats.isFile()) {\n\t\treturn false;\n\t}\n\n\t// On Windows, executability is determined by the file extension, which is already validated against `PATHEXT`.\n\tif (isWindows) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tawait fsPromises.access(filePath, fs.constants.X_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isExecutableSync(filePath) {\n\tlet stats;\n\ttry {\n\t\tstats = fs.statSync(filePath);\n\t} catch (error) {\n\t\treturn isWindows && error.code === 'EACCES';\n\t}\n\n\tif (!stats.isFile()) {\n\t\treturn false;\n\t}\n\n\tif (isWindows) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tfs.accessSync(filePath, fs.constants.X_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport async function whichCommand(command, options = {}) {\n\tconst resolved = resolveOptions(command, options);\n\n\tfor (const candidate of candidatePaths(command, resolved)) {\n\t\t// Checked sequentially so the first match in `PATH` order wins and the search can short-circuit.\n\t\tif (await isExecutable(candidate)) { // eslint-disable-line no-await-in-loop\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nexport function whichCommandSync(command, options = {}) {\n\tconst resolved = resolveOptions(command, options);\n\n\tfor (const candidate of candidatePaths(command, resolved)) {\n\t\tif (isExecutableSync(candidate)) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nexport async function whichCommandAll(command, options = {}) {\n\tconst resolved = resolveOptions(command, options);\n\tconst candidates = [...candidatePaths(command, resolved)];\n\tconst matches = await Promise.all(candidates.map(async candidate => (await isExecutable(candidate)) ? candidate : undefined));\n\treturn [...new Set(matches.filter(Boolean))];\n}\n\nexport function whichCommandAllSync(command, options = {}) {\n\tconst resolved = resolveOptions(command, options);\n\tconst found = [];\n\n\tfor (const candidate of candidatePaths(command, resolved)) {\n\t\tif (isExecutableSync(candidate)) {\n\t\t\tfound.push(candidate);\n\t\t}\n\t}\n\n\treturn [...new Set(found)];\n}\n", "import {statSync} from 'node:fs';\nimport path from 'node:path';\nimport process from 'node:process';\nimport {safeNormalizeFileUrl} from './file-url.js';\n\n// Normalize `cwd` option\nexport const normalizeCwd = (cwd = getDefaultCwd()) => {\n\tconst cwdString = safeNormalizeFileUrl(cwd, 'The \"cwd\" option');\n\treturn path.resolve(cwdString);\n};\n\nconst getDefaultCwd = () => {\n\ttry {\n\t\treturn process.cwd();\n\t} catch (error) {\n\t\terror.message = `The current directory does not exist.\\n${error.message}`;\n\t\tthrow error;\n\t}\n};\n\n// When `cwd` option has an invalid value, provide with a better error message\nexport const fixCwdError = (originalMessage, cwd) => {\n\tif (cwd === getDefaultCwd()) {\n\t\treturn originalMessage;\n\t}\n\n\tlet cwdStat;\n\ttry {\n\t\tcwdStat = statSync(cwd);\n\t} catch (error) {\n\t\treturn `The \"cwd\" option is invalid: ${cwd}.\\n${error.message}\\n${originalMessage}`;\n\t}\n\n\tif (!cwdStat.isDirectory()) {\n\t\treturn `The \"cwd\" option is not a directory: ${cwd}.\\n${originalMessage}`;\n\t}\n\n\treturn originalMessage;\n};\n", "// When the `shell` option is set, any command argument is concatenated as a single string by Node.js:\n// https://github.com/nodejs/node/blob/e38ce27f3ca0a65f68a31cedd984cddb927d4002/lib/child_process.js#L614-L624\n// However, since Node 24, it also prints a deprecation warning.\n// To avoid this warning, we perform that same operation before calling `node:child_process`.\n// Shells only understand strings, which is why Node.js performs that concatenation.\n// However, we rely on users splitting command arguments as an array.\n// For example, this allows us to easily detect which arguments are passed.\n// So we do want users to pass array of arguments even with `shell: true`, but we also want to avoid any warning.\nexport const concatenateShell = (file, commandArguments, options) => options.shell && commandArguments.length > 0\n\t? [[file, ...commandArguments].join(' '), [], options]\n\t: [file, commandArguments, options];\n", "import {inspect} from 'node:util';\nimport stripFinalNewline from 'strip-final-newline';\nimport {isUint8Array, uint8ArrayToString} from '../utils/uint-array.js';\nimport {fixCwdError} from '../arguments/cwd.js';\nimport {escapeLines} from '../arguments/escape.js';\nimport {getMaxBufferMessage} from '../io/max-buffer.js';\nimport {getSignalDescription} from '../terminate/signal.js';\nimport {DiscardedError, isExecaError} from './final-error.js';\n\n// Computes `error.message`, `error.shortMessage` and `error.originalMessage`\nexport const createMessages = ({\n\tstdio,\n\tall,\n\tipcOutput,\n\toriginalError,\n\tsignal,\n\tsignalDescription,\n\texitCode,\n\tescapedCommand,\n\ttimedOut,\n\tisCanceled,\n\tisGracefullyCanceled,\n\tisMaxBuffer,\n\tisForcefullyTerminated,\n\tforceKillAfterDelay,\n\tkillSignal,\n\tmaxBuffer,\n\ttimeout,\n\tcwd,\n}) => {\n\tconst errorCode = originalError?.code;\n\tconst prefix = getErrorPrefix({\n\t\toriginalError,\n\t\ttimedOut,\n\t\ttimeout,\n\t\tisMaxBuffer,\n\t\tmaxBuffer,\n\t\terrorCode,\n\t\tsignal,\n\t\tsignalDescription,\n\t\texitCode,\n\t\tisCanceled,\n\t\tisGracefullyCanceled,\n\t\tisForcefullyTerminated,\n\t\tforceKillAfterDelay,\n\t\tkillSignal,\n\t});\n\tconst originalMessage = getOriginalMessage(originalError, cwd);\n\tconst suffix = originalMessage === undefined ? '' : `\\n${originalMessage}`;\n\tconst shortMessage = `${prefix}: ${escapedCommand}${suffix}`;\n\tconst messageStdio = all === undefined ? [stdio[2], stdio[1]] : [all];\n\tconst message = [\n\t\tshortMessage,\n\t\t...messageStdio,\n\t\t...stdio.slice(3),\n\t\tipcOutput.map(ipcMessage => serializeIpcMessage(ipcMessage)).join('\\n'),\n\t]\n\t\t.map(messagePart => escapeLines(stripFinalNewline(serializeMessagePart(messagePart))))\n\t\t.filter(Boolean)\n\t\t.join('\\n\\n');\n\treturn {originalMessage, shortMessage, message};\n};\n\nconst getErrorPrefix = ({\n\toriginalError,\n\ttimedOut,\n\ttimeout,\n\tisMaxBuffer,\n\tmaxBuffer,\n\terrorCode,\n\tsignal,\n\tsignalDescription,\n\texitCode,\n\tisCanceled,\n\tisGracefullyCanceled,\n\tisForcefullyTerminated,\n\tforceKillAfterDelay,\n\tkillSignal,\n}) => {\n\tconst forcefulSuffix = getForcefulSuffix(isForcefullyTerminated, forceKillAfterDelay);\n\n\tif (timedOut) {\n\t\treturn `Command timed out after ${timeout} milliseconds${forcefulSuffix}`;\n\t}\n\n\tif (isGracefullyCanceled) {\n\t\tif (signal === undefined) {\n\t\t\treturn `Command was gracefully canceled with exit code ${exitCode}`;\n\t\t}\n\n\t\treturn isForcefullyTerminated\n\t\t\t? `Command was gracefully canceled${forcefulSuffix}`\n\t\t\t: `Command was gracefully canceled with ${signal} (${signalDescription})`;\n\t}\n\n\tif (isCanceled) {\n\t\treturn `Command was canceled${forcefulSuffix}`;\n\t}\n\n\tif (isMaxBuffer) {\n\t\treturn `${getMaxBufferMessage(originalError, maxBuffer)}${forcefulSuffix}`;\n\t}\n\n\tif (errorCode !== undefined) {\n\t\treturn `Command failed with ${errorCode}${forcefulSuffix}`;\n\t}\n\n\tif (isForcefullyTerminated) {\n\t\treturn `Command was killed with ${killSignal} (${getSignalDescription(killSignal)})${forcefulSuffix}`;\n\t}\n\n\tif (signal !== undefined) {\n\t\treturn `Command was killed with ${signal} (${signalDescription})`;\n\t}\n\n\tif (exitCode !== undefined) {\n\t\treturn `Command failed with exit code ${exitCode}`;\n\t}\n\n\treturn 'Command failed';\n};\n\nconst getForcefulSuffix = (isForcefullyTerminated, forceKillAfterDelay) => isForcefullyTerminated\n\t? ` and was forcefully terminated after ${forceKillAfterDelay} milliseconds`\n\t: '';\n\nconst getOriginalMessage = (originalError, cwd) => {\n\tif (originalError instanceof DiscardedError) {\n\t\treturn;\n\t}\n\n\tconst originalMessage = isExecaError(originalError)\n\t\t? originalError.originalMessage\n\t\t: String(originalError?.message ?? originalError);\n\tconst escapedOriginalMessage = escapeLines(fixCwdError(originalMessage, cwd));\n\treturn escapedOriginalMessage === '' ? undefined : escapedOriginalMessage;\n};\n\nconst serializeIpcMessage = ipcMessage => typeof ipcMessage === 'string'\n\t? ipcMessage\n\t: inspect(ipcMessage);\n\nconst serializeMessagePart = messagePart => Array.isArray(messagePart)\n\t? messagePart.map(messageItem => stripFinalNewline(serializeMessageItem(messageItem))).filter(Boolean).join('\\n')\n\t: serializeMessageItem(messagePart);\n\nconst serializeMessageItem = messageItem => {\n\tif (typeof messageItem === 'string') {\n\t\treturn messageItem;\n\t}\n\n\tif (isUint8Array(messageItem)) {\n\t\treturn uint8ArrayToString(messageItem);\n\t}\n\n\treturn '';\n};\n", "export default function stripFinalNewline(input) {\n\tif (typeof input === 'string') {\n\t\treturn stripFinalNewlineString(input);\n\t}\n\n\tif (!(ArrayBuffer.isView(input) && input.BYTES_PER_ELEMENT === 1)) {\n\t\tthrow new Error('Input must be a string or a Uint8Array');\n\t}\n\n\treturn stripFinalNewlineBinary(input);\n}\n\nconst stripFinalNewlineString = input =>\n\tinput.at(-1) === LF\n\t\t? input.slice(0, input.at(-2) === CR ? -2 : -1)\n\t\t: input;\n\nconst stripFinalNewlineBinary = input =>\n\tinput.at(-1) === LF_BINARY\n\t\t? input.subarray(0, input.at(-2) === CR_BINARY ? -2 : -1)\n\t\t: input;\n\nconst LF = '\\n';\nconst LF_BINARY = LF.codePointAt(0);\nconst CR = '\\r';\nconst CR_BINARY = CR.codePointAt(0);\n", "import {on} from 'node:events';\nimport {finished} from 'node:stream/promises';\nimport {nodeImports} from './stream.js';\n\nObject.assign(nodeImports, {on, finished});\n\nexport {\n\tdefault,\n\tgetStreamAsArray,\n\tgetStreamAsArrayBuffer,\n\tgetStreamAsBuffer,\n\tMaxBufferError,\n} from './exports.js';\n", "export function isStream(stream, {checkOpen = true} = {}) {\n\treturn stream !== null\n\t\t&& typeof stream === 'object'\n\t\t&& (stream.writable || stream.readable || !checkOpen || (stream.writable === undefined && stream.readable === undefined))\n\t\t&& typeof stream.pipe === 'function';\n}\n\nexport function isWritableStream(stream, {checkOpen = true} = {}) {\n\treturn isStream(stream, {checkOpen})\n\t\t&& (stream.writable || !checkOpen)\n\t\t&& typeof stream.write === 'function'\n\t\t&& typeof stream.end === 'function'\n\t\t&& typeof stream.writable === 'boolean'\n\t\t&& typeof stream.writableObjectMode === 'boolean'\n\t\t&& typeof stream.destroy === 'function'\n\t\t&& typeof stream.destroyed === 'boolean';\n}\n\nexport function isReadableStream(stream, {checkOpen = true} = {}) {\n\treturn isStream(stream, {checkOpen})\n\t\t&& (stream.readable || !checkOpen)\n\t\t&& typeof stream.read === 'function'\n\t\t&& typeof stream.readable === 'boolean'\n\t\t&& typeof stream.readableObjectMode === 'boolean'\n\t\t&& typeof stream.destroy === 'function'\n\t\t&& typeof stream.destroyed === 'boolean';\n}\n\nexport function isDuplexStream(stream, options) {\n\treturn isWritableStream(stream, options)\n\t\t&& isReadableStream(stream, options);\n}\n\nexport function isTransformStream(stream, options) {\n\treturn isDuplexStream(stream, options)\n\t\t&& typeof stream._transform === 'function';\n}\n", "const a = Object.getPrototypeOf(\n Object.getPrototypeOf(\n /* istanbul ignore next */\n async function* () {\n }\n ).prototype\n);\nclass c {\n #t;\n #n;\n #r = !1;\n #e = void 0;\n constructor(e, t) {\n this.#t = e, this.#n = t;\n }\n next() {\n const e = () => this.#s();\n return this.#e = this.#e ? this.#e.then(e, e) : e(), this.#e;\n }\n return(e) {\n const t = () => this.#i(e);\n return this.#e ? this.#e.then(t, t) : t();\n }\n async #s() {\n if (this.#r)\n return {\n done: !0,\n value: void 0\n };\n let e;\n try {\n e = await this.#t.read();\n } catch (t) {\n throw this.#e = void 0, this.#r = !0, this.#t.releaseLock(), t;\n }\n return e.done && (this.#e = void 0, this.#r = !0, this.#t.releaseLock()), e;\n }\n async #i(e) {\n if (this.#r)\n return {\n done: !0,\n value: e\n };\n if (this.#r = !0, !this.#n) {\n const t = this.#t.cancel(e);\n return this.#t.releaseLock(), await t, {\n done: !0,\n value: e\n };\n }\n return this.#t.releaseLock(), {\n done: !0,\n value: e\n };\n }\n}\nconst n = Symbol();\nfunction i() {\n return this[n].next();\n}\nObject.defineProperty(i, \"name\", { value: \"next\" });\nfunction o(r) {\n return this[n].return(r);\n}\nObject.defineProperty(o, \"name\", { value: \"return\" });\nconst u = Object.create(a, {\n next: {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: i\n },\n return: {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: o\n }\n});\nfunction h({ preventCancel: r = !1 } = {}) {\n const e = this.getReader(), t = new c(\n e,\n r\n ), s = Object.create(u);\n return s[n] = t, s;\n}\nexport {\n h as asyncIterator\n};\n", "import {isReadableStream} from 'is-stream';\nimport {asyncIterator} from '@sec-ant/readable-stream/ponyfill';\n\nexport const getAsyncIterable = stream => {\n\tif (isReadableStream(stream, {checkOpen: false}) && nodeImports.on !== undefined) {\n\t\treturn getStreamIterable(stream);\n\t}\n\n\tif (typeof stream?.[Symbol.asyncIterator] === 'function') {\n\t\treturn stream;\n\t}\n\n\t// `ReadableStream[Symbol.asyncIterator]` support is missing in multiple browsers, so we ponyfill it\n\tif (toString.call(stream) === '[object ReadableStream]') {\n\t\treturn asyncIterator.call(stream);\n\t}\n\n\tthrow new TypeError('The first argument must be a Readable, a ReadableStream, or an async iterable.');\n};\n\nconst {toString} = Object.prototype;\n\n// The default iterable for Node.js streams does not allow for multiple readers at once, so we re-implement it\nconst getStreamIterable = async function * (stream) {\n\tconst controller = new AbortController();\n\tconst state = {};\n\thandleStreamEnd(stream, controller, state);\n\n\ttry {\n\t\tfor await (const [chunk] of nodeImports.on(stream, 'data', {signal: controller.signal})) {\n\t\t\tyield chunk;\n\t\t}\n\t} catch (error) {\n\t\t// Stream failure, for example due to `stream.destroy(error)`\n\t\tif (state.error !== undefined) {\n\t\t\tthrow state.error;\n\t\t// `error` event directly emitted on stream\n\t\t} else if (!controller.signal.aborted) {\n\t\t\tthrow error;\n\t\t// Otherwise, stream completed successfully\n\t\t}\n\t\t// The `finally` block also runs when the caller throws, for example due to the `maxBuffer` option\n\t} finally {\n\t\tstream.destroy();\n\t}\n};\n\nconst handleStreamEnd = async (stream, controller, state) => {\n\ttry {\n\t\tawait nodeImports.finished(stream, {\n\t\t\tcleanup: true,\n\t\t\treadable: true,\n\t\t\twritable: false,\n\t\t\terror: false,\n\t\t});\n\t} catch (error) {\n\t\tstate.error = error;\n\t} finally {\n\t\tcontroller.abort();\n\t}\n};\n\n// Loaded by the Node entrypoint, but not by the browser one.\n// This prevents using dynamic imports.\nexport const nodeImports = {};\n", "import {getAsyncIterable} from './stream.js';\n\nexport const getStreamContents = async (stream, {init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize}, {maxBuffer = Number.POSITIVE_INFINITY} = {}) => {\n\tconst asyncIterable = getAsyncIterable(stream);\n\n\tconst state = init();\n\tstate.length = 0;\n\n\ttry {\n\t\tfor await (const chunk of asyncIterable) {\n\t\t\tconst chunkType = getChunkType(chunk);\n\t\t\tconst convertedChunk = convertChunk[chunkType](chunk, state);\n\t\t\tappendChunk({\n\t\t\t\tconvertedChunk,\n\t\t\t\tstate,\n\t\t\t\tgetSize,\n\t\t\t\ttruncateChunk,\n\t\t\t\taddChunk,\n\t\t\t\tmaxBuffer,\n\t\t\t});\n\t\t}\n\n\t\tappendFinalChunk({\n\t\t\tstate,\n\t\t\tconvertChunk,\n\t\t\tgetSize,\n\t\t\ttruncateChunk,\n\t\t\taddChunk,\n\t\t\tgetFinalChunk,\n\t\t\tmaxBuffer,\n\t\t});\n\t\treturn finalize(state);\n\t} catch (error) {\n\t\tconst normalizedError = typeof error === 'object' && error !== null ? error : new Error(error);\n\t\tnormalizedError.bufferedData = finalize(state);\n\t\tthrow normalizedError;\n\t}\n};\n\nconst appendFinalChunk = ({state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer}) => {\n\tconst convertedChunk = getFinalChunk(state);\n\tif (convertedChunk !== undefined) {\n\t\tappendChunk({\n\t\t\tconvertedChunk,\n\t\t\tstate,\n\t\t\tgetSize,\n\t\t\ttruncateChunk,\n\t\t\taddChunk,\n\t\t\tmaxBuffer,\n\t\t});\n\t}\n};\n\nconst appendChunk = ({convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer}) => {\n\tconst chunkSize = getSize(convertedChunk);\n\tconst newLength = state.length + chunkSize;\n\n\tif (newLength <= maxBuffer) {\n\t\taddNewChunk(convertedChunk, state, addChunk, newLength);\n\t\treturn;\n\t}\n\n\tconst truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);\n\n\tif (truncatedChunk !== undefined) {\n\t\taddNewChunk(truncatedChunk, state, addChunk, maxBuffer);\n\t}\n\n\tthrow new MaxBufferError();\n};\n\nconst addNewChunk = (convertedChunk, state, addChunk, newLength) => {\n\tstate.contents = addChunk(convertedChunk, state, newLength);\n\tstate.length = newLength;\n};\n\nconst getChunkType = chunk => {\n\tconst typeOfChunk = typeof chunk;\n\n\tif (typeOfChunk === 'string') {\n\t\treturn 'string';\n\t}\n\n\tif (typeOfChunk !== 'object' || chunk === null) {\n\t\treturn 'others';\n\t}\n\n\tif (globalThis.Buffer?.isBuffer(chunk)) {\n\t\treturn 'buffer';\n\t}\n\n\tconst prototypeName = objectToString.call(chunk);\n\n\tif (prototypeName === '[object ArrayBuffer]') {\n\t\treturn 'arrayBuffer';\n\t}\n\n\tif (prototypeName === '[object DataView]') {\n\t\treturn 'dataView';\n\t}\n\n\tif (\n\t\tNumber.isInteger(chunk.byteLength)\n\t\t&& Number.isInteger(chunk.byteOffset)\n\t\t&& objectToString.call(chunk.buffer) === '[object ArrayBuffer]'\n\t) {\n\t\treturn 'typedArray';\n\t}\n\n\treturn 'others';\n};\n\nconst {toString: objectToString} = Object.prototype;\n\nexport class MaxBufferError extends Error {\n\tname = 'MaxBufferError';\n\n\tconstructor() {\n\t\tsuper('maxBuffer exceeded');\n\t}\n}\n", "export const identity = value => value;\n\nexport const noop = () => undefined;\n\nexport const getContentsProperty = ({contents}) => contents;\n\nexport const throwObjectStream = chunk => {\n\tthrow new Error(`Streams in object mode are not supported: ${String(chunk)}`);\n};\n\nexport const getLengthProperty = convertedChunk => convertedChunk.length;\n", "import {getStreamContents} from './contents.js';\nimport {identity, noop, getContentsProperty} from './utils.js';\n\nexport async function getStreamAsArray(stream, options) {\n\treturn getStreamContents(stream, arrayMethods, options);\n}\n\nconst initArray = () => ({contents: []});\n\nconst increment = () => 1;\n\nconst addArrayChunk = (convertedChunk, {contents}) => {\n\tcontents.push(convertedChunk);\n\treturn contents;\n};\n\nconst arrayMethods = {\n\tinit: initArray,\n\tconvertChunk: {\n\t\tstring: identity,\n\t\tbuffer: identity,\n\t\tarrayBuffer: identity,\n\t\tdataView: identity,\n\t\ttypedArray: identity,\n\t\tothers: identity,\n\t},\n\tgetSize: increment,\n\ttruncateChunk: noop,\n\taddChunk: addArrayChunk,\n\tgetFinalChunk: noop,\n\tfinalize: getContentsProperty,\n};\n", "import {getStreamContents} from './contents.js';\nimport {noop, throwObjectStream, getLengthProperty} from './utils.js';\n\nexport async function getStreamAsArrayBuffer(stream, options) {\n\treturn getStreamContents(stream, arrayBufferMethods, options);\n}\n\nconst initArrayBuffer = () => ({contents: new ArrayBuffer(0)});\n\nconst useTextEncoder = chunk => textEncoder.encode(chunk);\nconst textEncoder = new TextEncoder();\n\nconst useUint8Array = chunk => new Uint8Array(chunk);\n\nconst useUint8ArrayWithOffset = chunk => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);\n\nconst truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);\n\n// `contents` is an increasingly growing `Uint8Array`.\nconst addArrayBufferChunk = (convertedChunk, {contents, length: previousLength}, length) => {\n\tconst newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);\n\tnew Uint8Array(newContents).set(convertedChunk, previousLength);\n\treturn newContents;\n};\n\n// Without `ArrayBuffer.resize()`, `contents` size is always a power of 2.\n// This means its last bytes are zeroes (not stream data), which need to be\n// trimmed at the end with `ArrayBuffer.slice()`.\nconst resizeArrayBufferSlow = (contents, length) => {\n\tif (length <= contents.byteLength) {\n\t\treturn contents;\n\t}\n\n\tconst arrayBuffer = new ArrayBuffer(getNewContentsLength(length));\n\tnew Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);\n\treturn arrayBuffer;\n};\n\n// With `ArrayBuffer.resize()`, `contents` size matches exactly the size of\n// the stream data. It does not include extraneous zeroes to trim at the end.\n// The underlying `ArrayBuffer` does allocate a number of bytes that is a power\n// of 2, but those bytes are only visible after calling `ArrayBuffer.resize()`.\nconst resizeArrayBuffer = (contents, length) => {\n\tif (length <= contents.maxByteLength) {\n\t\tcontents.resize(length);\n\t\treturn contents;\n\t}\n\n\tconst arrayBuffer = new ArrayBuffer(length, {maxByteLength: getNewContentsLength(length)});\n\tnew Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);\n\treturn arrayBuffer;\n};\n\n// Retrieve the closest `length` that is both >= and a power of 2\nconst getNewContentsLength = length => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));\n\nconst SCALE_FACTOR = 2;\n\nconst finalizeArrayBuffer = ({contents, length}) => hasArrayBufferResize() ? contents : contents.slice(0, length);\n\n// `ArrayBuffer.slice()` is slow. When `ArrayBuffer.resize()` is available\n// (Node >=20.0.0, Safari >=16.4 and Chrome), we can use it instead.\n// eslint-disable-next-line no-warning-comments\n// TODO: remove after dropping support for Node 20.\n// eslint-disable-next-line no-warning-comments\n// TODO: use `ArrayBuffer.transferToFixedLength()` instead once it is available\nconst hasArrayBufferResize = () => 'resize' in ArrayBuffer.prototype;\n\nconst arrayBufferMethods = {\n\tinit: initArrayBuffer,\n\tconvertChunk: {\n\t\tstring: useTextEncoder,\n\t\tbuffer: useUint8Array,\n\t\tarrayBuffer: useUint8Array,\n\t\tdataView: useUint8ArrayWithOffset,\n\t\ttypedArray: useUint8ArrayWithOffset,\n\t\tothers: throwObjectStream,\n\t},\n\tgetSize: getLengthProperty,\n\ttruncateChunk: truncateArrayBufferChunk,\n\taddChunk: addArrayBufferChunk,\n\tgetFinalChunk: noop,\n\tfinalize: finalizeArrayBuffer,\n};\n", "import {getStreamContents} from './contents.js';\nimport {\n\tidentity,\n\tgetContentsProperty,\n\tthrowObjectStream,\n\tgetLengthProperty,\n} from './utils.js';\n\nexport async function getStreamAsString(stream, options) {\n\treturn getStreamContents(stream, stringMethods, options);\n}\n\nconst initString = () => ({contents: '', textDecoder: new TextDecoder()});\n\nconst useTextDecoder = (chunk, {textDecoder}) => textDecoder.decode(chunk, {stream: true});\n\nconst addStringChunk = (convertedChunk, {contents}) => contents + convertedChunk;\n\nconst truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);\n\nconst getFinalStringChunk = ({textDecoder}) => {\n\tconst finalChunk = textDecoder.decode();\n\treturn finalChunk === '' ? undefined : finalChunk;\n};\n\nconst stringMethods = {\n\tinit: initString,\n\tconvertChunk: {\n\t\tstring: identity,\n\t\tbuffer: useTextDecoder,\n\t\tarrayBuffer: useTextDecoder,\n\t\tdataView: useTextDecoder,\n\t\ttypedArray: useTextDecoder,\n\t\tothers: throwObjectStream,\n\t},\n\tgetSize: getLengthProperty,\n\ttruncateChunk: truncateStringChunk,\n\taddChunk: addStringChunk,\n\tgetFinalChunk: getFinalStringChunk,\n\tfinalize: getContentsProperty,\n};\n", "import {MaxBufferError} from 'get-stream';\nimport {getStreamName} from '../utils/standard-stream.js';\nimport {getFdSpecificValue} from '../arguments/specific.js';\n\n// When the `maxBuffer` option is hit, a MaxBufferError is thrown.\n// The stream is aborted, then specific information is kept for the error message.\nexport const handleMaxBuffer = ({error, stream, readableObjectMode, lines, encoding, fdNumber}) => {\n\tif (!(error instanceof MaxBufferError)) {\n\t\tthrow error;\n\t}\n\n\tif (fdNumber === 'all') {\n\t\treturn error;\n\t}\n\n\tconst unit = getMaxBufferUnit(readableObjectMode, lines, encoding);\n\terror.maxBufferInfo = {fdNumber, unit};\n\tstream.destroy();\n\tthrow error;\n};\n\nconst getMaxBufferUnit = (readableObjectMode, lines, encoding) => {\n\tif (readableObjectMode) {\n\t\treturn 'objects';\n\t}\n\n\tif (lines) {\n\t\treturn 'lines';\n\t}\n\n\tif (encoding === 'buffer') {\n\t\treturn 'bytes';\n\t}\n\n\treturn 'characters';\n};\n\n// Check the `maxBuffer` option with `result.ipcOutput`\nexport const checkIpcMaxBuffer = (subprocess, ipcOutput, maxBuffer) => {\n\tif (ipcOutput.length !== maxBuffer) {\n\t\treturn;\n\t}\n\n\tconst error = new MaxBufferError();\n\terror.maxBufferInfo = {fdNumber: 'ipc'};\n\tthrow error;\n};\n\n// Error message when `maxBuffer` is hit\nexport const getMaxBufferMessage = (error, maxBuffer) => {\n\tconst {streamName, threshold, unit} = getMaxBufferInfo(error, maxBuffer);\n\treturn `Command's ${streamName} was larger than ${threshold} ${unit}`;\n};\n\nconst getMaxBufferInfo = (error, maxBuffer) => {\n\tif (error?.maxBufferInfo === undefined) {\n\t\treturn {streamName: 'output', threshold: maxBuffer[1], unit: 'bytes'};\n\t}\n\n\tconst {maxBufferInfo: {fdNumber, unit}} = error;\n\tdelete error.maxBufferInfo;\n\n\tconst threshold = getFdSpecificValue(maxBuffer, fdNumber);\n\tif (fdNumber === 'ipc') {\n\t\treturn {streamName: 'IPC output', threshold, unit: 'messages'};\n\t}\n\n\treturn {streamName: getStreamName(fdNumber), threshold, unit};\n};\n\n// The only way to apply `maxBuffer` with `spawnSync()` is to use the native `maxBuffer` option Node.js provides.\n// However, this has multiple limitations, and cannot behave the exact same way as the async behavior.\n// When the `maxBuffer` is hit, a `ENOBUFS` error is thrown.\nexport const isMaxBufferSync = (resultError, output, maxBuffer) => resultError?.code === 'ENOBUFS'\n\t&& output !== null\n\t&& output.some(result => result !== null && result.length > getMaxBufferSync(maxBuffer));\n\n// When `maxBuffer` is hit, ensure the result is truncated\nexport const truncateMaxBufferSync = (result, isMaxBuffer, maxBuffer) => {\n\tif (!isMaxBuffer) {\n\t\treturn result;\n\t}\n\n\tconst maxBufferValue = getMaxBufferSync(maxBuffer);\n\treturn result.length > maxBufferValue ? result.slice(0, maxBufferValue) : result;\n};\n\n// `spawnSync()` does not allow differentiating `maxBuffer` per file descriptor, so we always use `stdout`\nexport const getMaxBufferSync = ([, stdoutMaxBuffer]) => stdoutMaxBuffer;\n", "import {getSignalDescription} from '../terminate/signal.js';\nimport {getDurationMs} from './duration.js';\nimport {getFinalError} from './final-error.js';\nimport {createMessages} from './message.js';\n\n// Object returned on subprocess success\nexport const makeSuccessResult = ({\n\tcommand,\n\tescapedCommand,\n\tstdio,\n\tall,\n\tipcOutput,\n\toptions: {cwd},\n\tstartTime,\n}) => omitUndefinedProperties({\n\tcommand,\n\tescapedCommand,\n\tcwd,\n\tdurationMs: getDurationMs(startTime),\n\tfailed: false,\n\ttimedOut: false,\n\tisCanceled: false,\n\tisGracefullyCanceled: false,\n\tisTerminated: false,\n\tisMaxBuffer: false,\n\tisForcefullyTerminated: false,\n\texitCode: 0,\n\tstdout: stdio[1],\n\tstderr: stdio[2],\n\tall,\n\tstdio,\n\tipcOutput,\n\tpipedFrom: [],\n});\n\n// Object returned on subprocess failure before spawning\nexport const makeEarlyError = ({\n\terror,\n\tcommand,\n\tescapedCommand,\n\tfileDescriptors,\n\toptions,\n\tstartTime,\n\tisSync,\n}) => makeError({\n\terror,\n\tcommand,\n\tescapedCommand,\n\tstartTime,\n\ttimedOut: false,\n\tisCanceled: false,\n\tisGracefullyCanceled: false,\n\tisMaxBuffer: false,\n\tisForcefullyTerminated: false,\n\tstdio: Array.from({length: fileDescriptors.length}),\n\tipcOutput: [],\n\toptions,\n\tisSync,\n});\n\n// Object returned on subprocess failure\nexport const makeError = ({\n\terror: originalError,\n\tcommand,\n\tescapedCommand,\n\tstartTime,\n\ttimedOut,\n\tisCanceled,\n\tisGracefullyCanceled,\n\tisMaxBuffer,\n\tisForcefullyTerminated,\n\texitCode: rawExitCode,\n\tsignal: rawSignal,\n\tstdio,\n\tall,\n\tipcOutput,\n\toptions: {\n\t\ttimeoutDuration,\n\t\ttimeout = timeoutDuration,\n\t\tforceKillAfterDelay,\n\t\tkillSignal,\n\t\tcwd,\n\t\tmaxBuffer,\n\t},\n\tisSync,\n}) => {\n\tconst {exitCode, signal, signalDescription} = normalizeExitPayload(rawExitCode, rawSignal);\n\tconst {originalMessage, shortMessage, message} = createMessages({\n\t\tstdio,\n\t\tall,\n\t\tipcOutput,\n\t\toriginalError,\n\t\tsignal,\n\t\tsignalDescription,\n\t\texitCode,\n\t\tescapedCommand,\n\t\ttimedOut,\n\t\tisCanceled,\n\t\tisGracefullyCanceled,\n\t\tisMaxBuffer,\n\t\tisForcefullyTerminated,\n\t\tforceKillAfterDelay,\n\t\tkillSignal,\n\t\tmaxBuffer,\n\t\ttimeout,\n\t\tcwd,\n\t});\n\tconst error = getFinalError(originalError, message, isSync);\n\tObject.assign(error, getErrorProperties({\n\t\terror,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstartTime,\n\t\ttimedOut,\n\t\tisCanceled,\n\t\tisGracefullyCanceled,\n\t\tisMaxBuffer,\n\t\tisForcefullyTerminated,\n\t\texitCode,\n\t\tsignal,\n\t\tsignalDescription,\n\t\tstdio,\n\t\tall,\n\t\tipcOutput,\n\t\tcwd,\n\t\toriginalMessage,\n\t\tshortMessage,\n\t}));\n\treturn error;\n};\n\nconst getErrorProperties = ({\n\terror,\n\tcommand,\n\tescapedCommand,\n\tstartTime,\n\ttimedOut,\n\tisCanceled,\n\tisGracefullyCanceled,\n\tisMaxBuffer,\n\tisForcefullyTerminated,\n\texitCode,\n\tsignal,\n\tsignalDescription,\n\tstdio,\n\tall,\n\tipcOutput,\n\tcwd,\n\toriginalMessage,\n\tshortMessage,\n}) => omitUndefinedProperties({\n\tshortMessage,\n\toriginalMessage,\n\tcommand,\n\tescapedCommand,\n\tcwd,\n\tdurationMs: getDurationMs(startTime),\n\tfailed: true,\n\ttimedOut,\n\tisCanceled,\n\tisGracefullyCanceled,\n\tisTerminated: signal !== undefined,\n\tisMaxBuffer,\n\tisForcefullyTerminated,\n\texitCode,\n\tsignal,\n\tsignalDescription,\n\tcode: error.cause?.code,\n\tstdout: stdio[1],\n\tstderr: stdio[2],\n\tall,\n\tstdio,\n\tipcOutput,\n\tpipedFrom: [],\n});\n\nconst omitUndefinedProperties = result => Object.fromEntries(Object.entries(result).filter(([, value]) => value !== undefined));\n\n// `signal` and `exitCode` emitted on `subprocess.on('exit')` event can be `null`.\n// We normalize them to `undefined`\nconst normalizeExitPayload = (rawExitCode, rawSignal) => {\n\tconst exitCode = rawExitCode === null ? undefined : rawExitCode;\n\tconst signal = rawSignal === null ? undefined : rawSignal;\n\tconst signalDescription = signal === undefined ? undefined : getSignalDescription(rawSignal);\n\treturn {exitCode, signal, signalDescription};\n};\n", "const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;\n\nfunction parseNumber(milliseconds) {\n\treturn {\n\t\tdays: Math.trunc(milliseconds / 86_400_000),\n\t\thours: Math.trunc(milliseconds / 3_600_000 % 24),\n\t\tminutes: Math.trunc(milliseconds / 60_000 % 60),\n\t\tseconds: Math.trunc(milliseconds / 1000 % 60),\n\t\tmilliseconds: Math.trunc(milliseconds % 1000),\n\t\tmicroseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1000) % 1000),\n\t\tnanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1000),\n\t};\n}\n\nfunction parseBigint(milliseconds) {\n\treturn {\n\t\tdays: milliseconds / 86_400_000n,\n\t\thours: milliseconds / 3_600_000n % 24n,\n\t\tminutes: milliseconds / 60_000n % 60n,\n\t\tseconds: milliseconds / 1000n % 60n,\n\t\tmilliseconds: milliseconds % 1000n,\n\t\tmicroseconds: 0n,\n\t\tnanoseconds: 0n,\n\t};\n}\n\nexport default function parseMilliseconds(milliseconds) {\n\tswitch (typeof milliseconds) {\n\t\tcase 'number': {\n\t\t\tif (Number.isFinite(milliseconds)) {\n\t\t\t\treturn parseNumber(milliseconds);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase 'bigint': {\n\t\t\treturn parseBigint(milliseconds);\n\t\t}\n\n\t\t// No default\n\t}\n\n\tthrow new TypeError('Expected a finite number or bigint');\n}\n", "import parseMilliseconds from 'parse-ms';\n\nconst isZero = value => value === 0 || value === 0n;\nconst pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;\n\nconst SECOND_ROUNDING_EPSILON = 0.000_000_1;\nconst ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;\n\nexport default function prettyMilliseconds(milliseconds, options) {\n\tconst isBigInt = typeof milliseconds === 'bigint';\n\tif (!isBigInt && !Number.isFinite(milliseconds)) {\n\t\tthrow new TypeError('Expected a finite number or bigint');\n\t}\n\n\toptions = {...options};\n\n\tconst sign = milliseconds < 0 ? '-' : '';\n\tmilliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.\n\n\tif (options.colonNotation) {\n\t\toptions.compact = false;\n\t\toptions.formatSubMilliseconds = false;\n\t\toptions.separateMilliseconds = false;\n\t\toptions.verbose = false;\n\t}\n\n\tif (options.compact) {\n\t\toptions.unitCount = 1;\n\t\toptions.secondsDecimalDigits = 0;\n\t\toptions.millisecondsDecimalDigits = 0;\n\t}\n\n\tlet result = [];\n\n\tconst floorDecimals = (value, decimalDigits) => {\n\t\tconst flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);\n\t\tconst flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);\n\t\treturn flooredValue.toFixed(decimalDigits);\n\t};\n\n\tconst add = (value, long, short, valueString) => {\n\t\tif (\n\t\t\t(result.length === 0 || !options.colonNotation)\n\t\t\t&& isZero(value)\n\t\t\t&& !(options.colonNotation && short === 'm')) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalueString ??= String(value);\n\t\tif (options.colonNotation) {\n\t\t\tconst wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;\n\t\t\tconst minLength = result.length > 0 ? 2 : 1;\n\t\t\tvalueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;\n\t\t} else {\n\t\t\tvalueString += options.verbose ? ' ' + pluralize(long, value) : short;\n\t\t}\n\n\t\tresult.push(valueString);\n\t};\n\n\tconst parsed = parseMilliseconds(milliseconds);\n\tconst days = BigInt(parsed.days);\n\n\tif (options.hideYearAndDays) {\n\t\tadd((BigInt(days) * 24n) + BigInt(parsed.hours), 'hour', 'h');\n\t} else {\n\t\tif (options.hideYear) {\n\t\t\tadd(days, 'day', 'd');\n\t\t} else {\n\t\t\tadd(days / 365n, 'year', 'y');\n\t\t\tadd(days % 365n, 'day', 'd');\n\t\t}\n\n\t\tadd(Number(parsed.hours), 'hour', 'h');\n\t}\n\n\tadd(Number(parsed.minutes), 'minute', 'm');\n\n\tif (!options.hideSeconds) {\n\t\tif (\n\t\t\toptions.separateMilliseconds\n\t\t\t|| options.formatSubMilliseconds\n\t\t\t|| (!options.colonNotation && milliseconds < 1000 && !options.subSecondsAsDecimals)\n\t\t) {\n\t\t\tconst seconds = Number(parsed.seconds);\n\t\t\tconst milliseconds = Number(parsed.milliseconds);\n\t\t\tconst microseconds = Number(parsed.microseconds);\n\t\t\tconst nanoseconds = Number(parsed.nanoseconds);\n\n\t\t\tadd(seconds, 'second', 's');\n\n\t\t\tif (options.formatSubMilliseconds) {\n\t\t\t\tadd(milliseconds, 'millisecond', 'ms');\n\t\t\t\tadd(microseconds, 'microsecond', '\u00B5s');\n\t\t\t\tadd(nanoseconds, 'nanosecond', 'ns');\n\t\t\t} else {\n\t\t\t\tconst millisecondsAndBelow\n\t\t\t\t\t= milliseconds\n\t\t\t\t\t+ (microseconds / 1000)\n\t\t\t\t\t+ (nanoseconds / 1e6);\n\n\t\t\t\tconst millisecondsDecimalDigits\n\t\t\t\t\t= typeof options.millisecondsDecimalDigits === 'number'\n\t\t\t\t\t\t? options.millisecondsDecimalDigits\n\t\t\t\t\t\t: 0;\n\n\t\t\t\tconst roundedMilliseconds = millisecondsAndBelow >= 1\n\t\t\t\t\t? Math.round(millisecondsAndBelow)\n\t\t\t\t\t: Math.ceil(millisecondsAndBelow);\n\n\t\t\t\tconst millisecondsString = millisecondsDecimalDigits\n\t\t\t\t\t? millisecondsAndBelow.toFixed(millisecondsDecimalDigits)\n\t\t\t\t\t: roundedMilliseconds;\n\n\t\t\t\tadd(\n\t\t\t\t\tNumber.parseFloat(millisecondsString),\n\t\t\t\t\t'millisecond',\n\t\t\t\t\t'ms',\n\t\t\t\t\tmillisecondsString,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst seconds = (\n\t\t\t\t(isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)\n\t\t\t\t/ 1000\n\t\t\t) % 60;\n\t\t\tconst secondsDecimalDigits\n\t\t\t\t= typeof options.secondsDecimalDigits === 'number'\n\t\t\t\t\t? options.secondsDecimalDigits\n\t\t\t\t\t: 1;\n\t\t\tconst secondsFixed = floorDecimals(seconds, secondsDecimalDigits);\n\t\t\tconst secondsString = options.keepDecimalsOnWholeSeconds\n\t\t\t\t? secondsFixed\n\t\t\t\t: secondsFixed.replace(/\\.0+$/, '');\n\t\t\tadd(Number.parseFloat(secondsString), 'second', 's', secondsString);\n\t\t}\n\t}\n\n\tif (result.length === 0) {\n\t\treturn sign + '0' + (options.verbose ? ' milliseconds' : 'ms');\n\t}\n\n\tconst separator = options.colonNotation ? ':' : ' ';\n\tif (typeof options.unitCount === 'number') {\n\t\tresult = result.slice(0, Math.max(options.unitCount, 1));\n\t}\n\n\treturn sign + result.join(separator);\n}\n", "import {verboseLog} from './log.js';\n\n// When `verbose` is `short|full|custom`, print each command's error when it fails\nexport const logError = (result, verboseInfo) => {\n\tif (result.failed) {\n\t\tverboseLog({\n\t\t\ttype: 'error',\n\t\t\tverboseMessage: result.shortMessage,\n\t\t\tverboseInfo,\n\t\t\tresult,\n\t\t});\n\t}\n};\n", "import prettyMs from 'pretty-ms';\nimport {isVerbose} from './values.js';\nimport {verboseLog} from './log.js';\nimport {logError} from './error.js';\n\n// When `verbose` is `short|full|custom`, print each command's completion, duration and error\nexport const logResult = (result, verboseInfo) => {\n\tif (!isVerbose(verboseInfo)) {\n\t\treturn;\n\t}\n\n\tlogError(result, verboseInfo);\n\tlogDuration(result, verboseInfo);\n};\n\nconst logDuration = (result, verboseInfo) => {\n\tconst verboseMessage = `(done in ${prettyMs(result.durationMs)})`;\n\tverboseLog({\n\t\ttype: 'duration',\n\t\tverboseMessage,\n\t\tverboseInfo,\n\t\tresult,\n\t});\n};\n", "import {logResult} from '../verbose/complete.js';\n\n// Applies the `reject` option.\n// Also print the final log line with `verbose`.\nexport const handleResult = (result, verboseInfo, {reject}) => {\n\tlogResult(result, verboseInfo);\n\n\tif (result.failed && reject) {\n\t\tthrow result;\n\t}\n\n\treturn result;\n};\n", "import {readFileSync} from 'node:fs';\nimport {bufferToUint8Array} from '../utils/uint-array.js';\nimport {handleStdio} from './handle.js';\nimport {TYPE_TO_MESSAGE} from './type.js';\n\n// Normalize `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, before spawning, in sync mode\nexport const handleStdioSync = (options, verboseInfo) => handleStdio(addPropertiesSync, options, verboseInfo, true);\n\nconst forbiddenIfSync = ({type, optionName}) => {\n\tthrowInvalidSyncValue(optionName, TYPE_TO_MESSAGE[type]);\n};\n\nconst forbiddenNativeIfSync = ({optionName, value}) => {\n\tif (value === 'overlapped') {\n\t\tthrowInvalidSyncValue(optionName, `\"${value}\"`);\n\t}\n\n\treturn {};\n};\n\n// A native input pipe on an additional file descriptor cannot be fed in sync mode, since there is no way to write to it after spawning, so it would hang.\nconst forbiddenNativeInputIfSync = stdioItem => {\n\tconst {optionName, value} = stdioItem;\n\tif (value === 'pipe' && optionName !== 'stdin') {\n\t\tthrow new TypeError(`Only the \\`stdin\\` option, not \\`${optionName}\\`, can be an input pipe with synchronous methods.`);\n\t}\n\n\treturn forbiddenNativeIfSync(stdioItem);\n};\n\nconst throwInvalidSyncValue = (optionName, value) => {\n\tthrow new TypeError(`The \\`${optionName}\\` option cannot be ${value} with synchronous methods.`);\n};\n\n// Create streams used internally for redirecting when using specific values for the `std*` options, in sync mode.\n// For example, `stdin: {file}` reads the file synchronously, then passes it as the `input` option.\nconst addProperties = {\n\tgenerator() {},\n\tasyncGenerator: forbiddenIfSync,\n\twebStream: forbiddenIfSync,\n\tnodeStream: forbiddenIfSync,\n\twebTransform: forbiddenIfSync,\n\tduplex: forbiddenIfSync,\n\tasyncIterable: forbiddenIfSync,\n\tnative: forbiddenNativeIfSync,\n};\n\nconst addPropertiesSync = {\n\tinput: {\n\t\t...addProperties,\n\t\tnative: forbiddenNativeInputIfSync,\n\t\tfileUrl: ({value}) => ({contents: [bufferToUint8Array(readFileSync(value))]}),\n\t\tfilePath: ({value: {file}}) => ({contents: [bufferToUint8Array(readFileSync(file))]}),\n\t\tfileNumber: forbiddenIfSync,\n\t\titerable: ({value}) => ({contents: [...value]}),\n\t\tstring: ({value}) => ({contents: [value]}),\n\t\tuint8Array: ({value}) => ({contents: [value]}),\n\t},\n\toutput: {\n\t\t...addProperties,\n\t\tfileUrl: ({value}) => ({path: value}),\n\t\tfilePath: ({value: {file, append}}) => ({path: file, append}),\n\t\tfileNumber: ({value}) => ({path: value}),\n\t\titerable: forbiddenIfSync,\n\t\tstring: forbiddenIfSync,\n\t\tuint8Array: forbiddenIfSync,\n\t},\n};\n", "import {isStream as isNodeStream, isDuplexStream} from 'is-stream';\nimport isPlainObj from 'is-plain-obj';\nimport {isUint8Array} from '../utils/uint-array.js';\n\n// The `stdin`/`stdout`/`stderr` option can be of many types. This detects it.\nexport const getStdioItemType = (value, optionName) => {\n\tif (isAsyncGenerator(value)) {\n\t\treturn 'asyncGenerator';\n\t}\n\n\tif (isSyncGenerator(value)) {\n\t\treturn 'generator';\n\t}\n\n\tif (isUrl(value)) {\n\t\treturn 'fileUrl';\n\t}\n\n\tif (isFilePathObject(value)) {\n\t\treturn 'filePath';\n\t}\n\n\tif (isWebStream(value)) {\n\t\treturn 'webStream';\n\t}\n\n\tif (isNodeStream(value, {checkOpen: false})) {\n\t\treturn 'native';\n\t}\n\n\tif (isUint8Array(value)) {\n\t\treturn 'uint8Array';\n\t}\n\n\tif (isAsyncIterableObject(value)) {\n\t\treturn 'asyncIterable';\n\t}\n\n\tif (isIterableObject(value)) {\n\t\treturn 'iterable';\n\t}\n\n\tif (isTransformStream(value)) {\n\t\treturn getTransformStreamType({transform: value}, optionName);\n\t}\n\n\tif (isTransformOptions(value)) {\n\t\treturn getTransformObjectType(value, optionName);\n\t}\n\n\treturn 'native';\n};\n\nconst getTransformObjectType = (value, optionName) => {\n\tif (isDuplexStream(value.transform, {checkOpen: false})) {\n\t\treturn getDuplexType(value, optionName);\n\t}\n\n\tif (isTransformStream(value.transform)) {\n\t\treturn getTransformStreamType(value, optionName);\n\t}\n\n\treturn getGeneratorObjectType(value, optionName);\n};\n\nconst getDuplexType = (value, optionName) => {\n\tvalidateNonGeneratorType(value, optionName, 'Duplex stream');\n\treturn 'duplex';\n};\n\nconst getTransformStreamType = (value, optionName) => {\n\tvalidateNonGeneratorType(value, optionName, 'web TransformStream');\n\treturn 'webTransform';\n};\n\nconst validateNonGeneratorType = ({final, binary, objectMode}, optionName, typeName) => {\n\tcheckUndefinedOption(final, `${optionName}.final`, typeName);\n\tcheckUndefinedOption(binary, `${optionName}.binary`, typeName);\n\tcheckBooleanOption(objectMode, `${optionName}.objectMode`);\n};\n\nconst checkUndefinedOption = (value, optionName, typeName) => {\n\tif (value !== undefined) {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option can only be defined when using a generator, not a ${typeName}.`);\n\t}\n};\n\nconst getGeneratorObjectType = ({transform, final, binary, objectMode}, optionName) => {\n\tif (transform !== undefined && !isGenerator(transform)) {\n\t\tthrow new TypeError(`The \\`${optionName}.transform\\` option must be a generator, a Duplex stream or a web TransformStream.`);\n\t}\n\n\tif (isDuplexStream(final, {checkOpen: false})) {\n\t\tthrow new TypeError(`The \\`${optionName}.final\\` option must not be a Duplex stream.`);\n\t}\n\n\tif (isTransformStream(final)) {\n\t\tthrow new TypeError(`The \\`${optionName}.final\\` option must not be a web TransformStream.`);\n\t}\n\n\tif (final !== undefined && !isGenerator(final)) {\n\t\tthrow new TypeError(`The \\`${optionName}.final\\` option must be a generator.`);\n\t}\n\n\tcheckBooleanOption(binary, `${optionName}.binary`);\n\tcheckBooleanOption(objectMode, `${optionName}.objectMode`);\n\n\treturn isAsyncGenerator(transform) || isAsyncGenerator(final) ? 'asyncGenerator' : 'generator';\n};\n\nexport const checkBooleanOption = (value, optionName) => {\n\tif (value !== undefined && typeof value !== 'boolean') {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option must use a boolean.`);\n\t}\n};\n\nconst isGenerator = value => isAsyncGenerator(value) || isSyncGenerator(value);\nexport const isAsyncGenerator = value => Object.prototype.toString.call(value) === '[object AsyncGeneratorFunction]';\nconst isSyncGenerator = value => Object.prototype.toString.call(value) === '[object GeneratorFunction]';\nconst isTransformOptions = value => isPlainObj(value)\n\t&& (value.transform !== undefined || value.final !== undefined);\n\nexport const isUrl = value => Object.prototype.toString.call(value) === '[object URL]';\nexport const isRegularUrl = value => isUrl(value) && value.protocol !== 'file:';\n\nconst isFilePathObject = value => isPlainObj(value)\n\t&& Object.keys(value).length > 0\n\t&& Object.keys(value).every(key => FILE_PATH_KEYS.has(key))\n\t&& isFilePathString(value.file);\nconst FILE_PATH_KEYS = new Set(['file', 'append']);\nexport const isFilePathString = file => typeof file === 'string';\n\n// The `{value, input}` object form marks an additional file descriptor's direction explicitly.\n// This is needed for direction-ambiguous values (like `'pipe'`, `'inherit'`, a file or a transform) on fd3+, which otherwise default to output.\nexport const isStdioValueObject = value => isPlainObj(value)\n\t&& Object.keys(value).length > 0\n\t&& Object.keys(value).every(key => STDIO_VALUE_KEYS.has(key))\n\t&& 'value' in value;\nconst STDIO_VALUE_KEYS = new Set(['value', 'input']);\n\nexport const isUnknownStdioString = (type, value) => type === 'native'\n\t&& typeof value === 'string'\n\t&& !KNOWN_STDIO_STRINGS.has(value);\nconst KNOWN_STDIO_STRINGS = new Set(['ipc', 'ignore', 'inherit', 'overlapped', 'pipe']);\n\nconst isReadableStream = value => Object.prototype.toString.call(value) === '[object ReadableStream]';\nexport const isWritableStream = value => Object.prototype.toString.call(value) === '[object WritableStream]';\nconst isWebStream = value => isReadableStream(value) || isWritableStream(value);\nconst isTransformStream = value => isReadableStream(value?.readable) && isWritableStream(value?.writable);\n\nconst isAsyncIterableObject = value => isObject(value) && typeof value[Symbol.asyncIterator] === 'function';\nconst isIterableObject = value => isObject(value) && typeof value[Symbol.iterator] === 'function';\nconst isObject = value => typeof value === 'object' && value !== null;\n\n// Types which modify `subprocess.std*`\nexport const TRANSFORM_TYPES = new Set(['generator', 'asyncGenerator', 'duplex', 'webTransform']);\n// Types which write to a file or a file descriptor\nexport const FILE_TYPES = new Set(['fileUrl', 'filePath', 'fileNumber']);\n// When two file descriptors of this type share the same target, we need to do some special logic\nexport const SPECIAL_DUPLICATE_TYPES_SYNC = new Set(['fileUrl', 'filePath']);\nexport const SPECIAL_DUPLICATE_TYPES = new Set([...SPECIAL_DUPLICATE_TYPES_SYNC, 'webStream', 'nodeStream']);\n// Do not allow two file descriptors of this type sharing the same target\nexport const FORBID_DUPLICATE_TYPES = new Set(['webTransform', 'duplex']);\n\n// Convert types to human-friendly strings for error messages\nexport const TYPE_TO_MESSAGE = {\n\tgenerator: 'a generator',\n\tasyncGenerator: 'an async generator',\n\tfileUrl: 'a file URL',\n\tfilePath: 'a file path string',\n\tfileNumber: 'a file descriptor number',\n\twebStream: 'a web stream',\n\tnodeStream: 'a Node.js stream',\n\twebTransform: 'a web TransformStream',\n\tduplex: 'a Duplex stream',\n\tnative: 'any value',\n\titerable: 'an iterable',\n\tasyncIterable: 'an async iterable',\n\tstring: 'a string',\n\tuint8Array: 'a Uint8Array',\n};\n", "import {TRANSFORM_TYPES} from '../stdio/type.js';\n\n/*\nRetrieve the `objectMode`s of a single transform.\n`objectMode` determines the return value's type, i.e. the `readableObjectMode`.\nThe chunk argument's type is based on the previous generator's return value, i.e. the `writableObjectMode` is based on the previous `readableObjectMode`.\nThe last input's generator is read by `subprocess.stdin` which:\n- should not be in `objectMode` for performance reasons.\n- can only be strings, Buffers and Uint8Arrays.\nTherefore its `readableObjectMode` must be `false`.\nThe same applies to the first output's generator's `writableObjectMode`.\n*/\nexport const getTransformObjectModes = (objectMode, index, newTransforms, direction) => direction === 'output'\n\t? getOutputObjectModes(objectMode, index, newTransforms)\n\t: getInputObjectModes(objectMode, index, newTransforms);\n\nconst getOutputObjectModes = (objectMode, index, newTransforms) => {\n\tconst writableObjectMode = index !== 0 && newTransforms[index - 1].value.readableObjectMode;\n\tconst readableObjectMode = objectMode ?? writableObjectMode;\n\treturn {writableObjectMode, readableObjectMode};\n};\n\nconst getInputObjectModes = (objectMode, index, newTransforms) => {\n\tconst writableObjectMode = index === 0\n\t\t? objectMode === true\n\t\t: newTransforms[index - 1].value.readableObjectMode;\n\tconst readableObjectMode = index !== newTransforms.length - 1 && (objectMode ?? writableObjectMode);\n\treturn {writableObjectMode, readableObjectMode};\n};\n\n// Retrieve the `objectMode` of a file descriptor, e.g. `stdout` or `stderr`\nexport const getFdObjectMode = (stdioItems, direction) => {\n\tconst lastTransform = stdioItems.findLast(({type}) => TRANSFORM_TYPES.has(type));\n\tif (lastTransform === undefined) {\n\t\treturn false;\n\t}\n\n\treturn direction === 'input'\n\t\t? lastTransform.value.writableObjectMode\n\t\t: lastTransform.value.readableObjectMode;\n};\n", "import isPlainObj from 'is-plain-obj';\nimport {BINARY_ENCODINGS} from '../arguments/encoding-option.js';\nimport {TRANSFORM_TYPES} from '../stdio/type.js';\nimport {getTransformObjectModes} from './object-mode.js';\n\n// Transforms generators/duplex/TransformStream can have multiple shapes.\n// This normalizes it and applies default values.\nexport const normalizeTransforms = (stdioItems, optionName, direction, options) => [\n\t...stdioItems.filter(({type}) => !TRANSFORM_TYPES.has(type)),\n\t...getTransforms(stdioItems, optionName, direction, options),\n];\n\nconst getTransforms = (stdioItems, optionName, direction, {encoding}) => {\n\tconst transforms = stdioItems.filter(({type}) => TRANSFORM_TYPES.has(type));\n\tconst newTransforms = Array.from({length: transforms.length});\n\n\tfor (const [index, stdioItem] of Object.entries(transforms)) {\n\t\tnewTransforms[index] = normalizeTransform({\n\t\t\tstdioItem,\n\t\t\tindex: Number(index),\n\t\t\tnewTransforms,\n\t\t\toptionName,\n\t\t\tdirection,\n\t\t\tencoding,\n\t\t});\n\t}\n\n\treturn sortTransforms(newTransforms, direction);\n};\n\nconst normalizeTransform = ({stdioItem, stdioItem: {type}, index, newTransforms, optionName, direction, encoding}) => {\n\tif (type === 'duplex') {\n\t\treturn normalizeDuplex({stdioItem, optionName});\n\t}\n\n\tif (type === 'webTransform') {\n\t\treturn normalizeTransformStream({\n\t\t\tstdioItem,\n\t\t\tindex,\n\t\t\tnewTransforms,\n\t\t\tdirection,\n\t\t});\n\t}\n\n\treturn normalizeGenerator({\n\t\tstdioItem,\n\t\tindex,\n\t\tnewTransforms,\n\t\tdirection,\n\t\tencoding,\n\t});\n};\n\nconst normalizeDuplex = ({stdioItem, optionName}) => {\n\tconst {value} = stdioItem;\n\tconst {transform} = value;\n\tconst {writableObjectMode, readableObjectMode} = transform;\n\tconst {objectMode = readableObjectMode} = value;\n\n\tif (objectMode && !readableObjectMode) {\n\t\tthrow new TypeError(`The \\`${optionName}.objectMode\\` option can only be \\`true\\` if \\`new Duplex({objectMode: true})\\` is used.`);\n\t}\n\n\tif (!objectMode && readableObjectMode) {\n\t\tthrow new TypeError(`The \\`${optionName}.objectMode\\` option cannot be \\`false\\` if \\`new Duplex({objectMode: true})\\` is used.`);\n\t}\n\n\treturn {\n\t\t...stdioItem,\n\t\tvalue: {transform, writableObjectMode, readableObjectMode},\n\t};\n};\n\nconst normalizeTransformStream = ({stdioItem, stdioItem: {value}, index, newTransforms, direction}) => {\n\tconst {transform, objectMode} = isPlainObj(value) ? value : {transform: value};\n\tconst {writableObjectMode, readableObjectMode} = getTransformObjectModes(objectMode, index, newTransforms, direction);\n\treturn ({\n\t\t...stdioItem,\n\t\tvalue: {transform, writableObjectMode, readableObjectMode},\n\t});\n};\n\nconst normalizeGenerator = ({stdioItem, stdioItem: {value}, index, newTransforms, direction, encoding}) => {\n\tconst {\n\t\ttransform,\n\t\tfinal,\n\t\tbinary: binaryOption = false,\n\t\tpreserveNewlines = false,\n\t\tobjectMode,\n\t} = isPlainObj(value) ? value : {transform: value};\n\tconst binary = binaryOption || BINARY_ENCODINGS.has(encoding);\n\tconst {writableObjectMode, readableObjectMode} = getTransformObjectModes(objectMode, index, newTransforms, direction);\n\treturn {\n\t\t...stdioItem,\n\t\tvalue: {\n\t\t\ttransform,\n\t\t\tfinal,\n\t\t\tbinary,\n\t\t\tpreserveNewlines,\n\t\t\twritableObjectMode,\n\t\t\treadableObjectMode,\n\t\t},\n\t};\n};\n\nconst sortTransforms = (newTransforms, direction) => direction === 'input' ? newTransforms.reverse() : newTransforms;\n", "import process from 'node:process';\nimport {\n\tisStream as isNodeStream,\n\tisReadableStream as isNodeReadableStream,\n\tisWritableStream as isNodeWritableStream,\n} from 'is-stream';\nimport {isWritableStream} from './type.js';\n\n// For `stdio[fdNumber]` beyond stdin/stdout/stderr, we need to guess whether the value passed is intended for inputs or outputs.\n// This allows us to know whether to pipe _into_ or _from_ the stream.\n// When `stdio[fdNumber]` is a single value, this guess is fairly straightforward.\n// However, when it is an array instead, we also need to make sure the different values are not incompatible with each other.\nexport const getStreamDirection = (stdioItems, fdNumber, optionName) => {\n\tconst directions = stdioItems.map(stdioItem => getStdioItemDirection(stdioItem, fdNumber));\n\n\tif (directions.includes('input') && directions.includes('output')) {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option must not be an array of both readable and writable values.`);\n\t}\n\n\treturn directions.find(Boolean) ?? DEFAULT_DIRECTION;\n};\n\n// `direction` is set when the user explicitly requests it, e.g. `{value: 'pipe', input: true}`.\n// It takes precedence over guessing, but not over the fixed direction of `stdin`/`stdout`/`stderr`.\nconst getStdioItemDirection = (stdioItem, fdNumber) => KNOWN_DIRECTIONS[fdNumber] ?? getRequestedDirection(stdioItem);\n\n// The explicitly requested `direction` must not contradict a value that is intrinsically the other direction.\n// For example, `{value: writableStream, input: true}` is invalid since a writable value can only be an output.\nconst getRequestedDirection = ({type, value, direction, optionName}) => {\n\tconst guessedDirection = guessStreamDirection[type](value);\n\tif (direction === 'input' && guessedDirection === 'output') {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option is invalid: \\`input: true\\` cannot be used with a writable value, which is always an output.`);\n\t}\n\n\treturn direction ?? guessedDirection;\n};\n\n// `stdin`/`stdout`/`stderr` have a known direction\nconst KNOWN_DIRECTIONS = ['input', 'output', 'output'];\n\nconst anyDirection = () => undefined;\nconst alwaysInput = () => 'input';\n\n// `string` can only be added through the `input` option, i.e. does not need to be handled here\nconst guessStreamDirection = {\n\tgenerator: anyDirection,\n\tasyncGenerator: anyDirection,\n\tfileUrl: anyDirection,\n\tfilePath: anyDirection,\n\titerable: alwaysInput,\n\tasyncIterable: alwaysInput,\n\tuint8Array: alwaysInput,\n\twebStream: value => isWritableStream(value) ? 'output' : 'input',\n\tnodeStream(value) {\n\t\tif (!isNodeReadableStream(value, {checkOpen: false})) {\n\t\t\treturn 'output';\n\t\t}\n\n\t\treturn isNodeWritableStream(value, {checkOpen: false}) ? undefined : 'input';\n\t},\n\twebTransform: anyDirection,\n\tduplex: anyDirection,\n\tnative(value) {\n\t\tconst standardStreamDirection = getStandardStreamDirection(value);\n\t\tif (standardStreamDirection !== undefined) {\n\t\t\treturn standardStreamDirection;\n\t\t}\n\n\t\tif (isNodeStream(value, {checkOpen: false})) {\n\t\t\treturn guessStreamDirection.nodeStream(value);\n\t\t}\n\t},\n};\n\nconst getStandardStreamDirection = value => {\n\tif ([0, process.stdin].includes(value)) {\n\t\treturn 'input';\n\t}\n\n\tif ([1, 2, process.stdout, process.stderr].includes(value)) {\n\t\treturn 'output';\n\t}\n};\n\n// When ambiguous, we initially keep the direction as `undefined`.\n// This allows arrays of `stdio` values to resolve the ambiguity.\n// For example, `stdio[3]: DuplexStream` is ambiguous, but `stdio[3]: [DuplexStream, WritableStream]` is not.\n// When the ambiguity remains, we default to `output` since it is the most common use case for additional file descriptors.\nconst DEFAULT_DIRECTION = 'output';\n", "// The `ipc` option adds an `ipc` item to the `stdio` option\nexport const normalizeIpcStdioArray = (stdioArray, ipc) => ipc\n\t? [...stdioArray, 'ipc']\n\t: stdioArray;\n", "import {STANDARD_STREAMS_ALIASES} from '../utils/standard-stream.js';\nimport {normalizeIpcStdioArray} from '../ipc/array.js';\nimport {isFullVerbose} from '../verbose/values.js';\nimport {isStdioValueObject} from './type.js';\n\n// Add support for `stdin`/`stdout`/`stderr` as an alias for `stdio`.\n// Also normalize the `stdio` option.\nexport const normalizeStdioOption = ({stdio, ipc, buffer, ...options}, verboseInfo, isSync) => {\n\tconst stdioArray = getStdioArray(stdio, options).map((stdioOption, fdNumber) => addDefaultValue(stdioOption, fdNumber));\n\tvalidateIpcStdioOption(stdioArray);\n\treturn isSync\n\t\t? normalizeStdioSync(stdioArray, buffer, verboseInfo)\n\t\t: normalizeIpcStdioArray(stdioArray, ipc);\n};\n\n// The `stdio: 'ipc'` value (raw `child_process` syntax) was replaced by the `ipc: true` option\nconst validateIpcStdioOption = stdioArray => {\n\tif (stdioArray.some(stdioOption => hasIpcStdioOption(stdioOption))) {\n\t\tthrow new Error('The `ipc: true` option must be used instead of `stdio: \\'ipc\\'`.');\n\t}\n};\n\nconst hasIpcStdioOption = stdioOption => {\n\tif (Array.isArray(stdioOption)) {\n\t\treturn stdioOption.some(item => hasIpcStdioItem(item));\n\t}\n\n\treturn hasIpcStdioItem(stdioOption);\n};\n\nconst hasIpcStdioItem = stdioOption => {\n\tif (isStdioValueObject(stdioOption)) {\n\t\treturn stdioOption.value === 'ipc';\n\t}\n\n\treturn stdioOption === 'ipc';\n};\n\nconst getStdioArray = (stdio, options) => {\n\tif (stdio === undefined) {\n\t\treturn STANDARD_STREAMS_ALIASES.map(alias => options[alias]);\n\t}\n\n\tif (hasAlias(options)) {\n\t\tthrow new Error(`It's not possible to provide \\`stdio\\` in combination with one of ${STANDARD_STREAMS_ALIASES.map(alias => `\\`${alias}\\``).join(', ')}`);\n\t}\n\n\tif (typeof stdio === 'string') {\n\t\treturn [stdio, stdio, stdio];\n\t}\n\n\tif (!Array.isArray(stdio)) {\n\t\tthrow new TypeError(`Expected \\`stdio\\` to be of type \\`string\\` or \\`Array\\`, got \\`${typeof stdio}\\``);\n\t}\n\n\tconst length = Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length);\n\treturn Array.from({length}, (_, fdNumber) => stdio[fdNumber]);\n};\n\nconst hasAlias = options => STANDARD_STREAMS_ALIASES.some(alias => options[alias] !== undefined);\n\nconst addDefaultValue = (stdioOption, fdNumber) => {\n\tif (Array.isArray(stdioOption)) {\n\t\treturn stdioOption.map(item => addDefaultValue(item, fdNumber));\n\t}\n\n\tif (stdioOption === null || stdioOption === undefined) {\n\t\treturn fdNumber >= STANDARD_STREAMS_ALIASES.length ? 'ignore' : 'pipe';\n\t}\n\n\treturn stdioOption;\n};\n\n// Using `buffer: false` with synchronous methods implies `stdout`/`stderr`: `ignore`.\n// Unless the output is needed, e.g. due to `verbose: 'full'` or to redirecting to a file.\nconst normalizeStdioSync = (stdioArray, buffer, verboseInfo) => stdioArray.map((stdioOption, fdNumber) =>\n\t!buffer[fdNumber]\n\t&& fdNumber !== 0\n\t&& !isFullVerbose(verboseInfo, fdNumber)\n\t&& isOutputPipeOnly(stdioOption, fdNumber)\n\t\t? 'ignore'\n\t\t: stdioOption);\n\nconst isOutputPipeOnly = (stdioOption, fdNumber) => isOutputPipe(stdioOption, fdNumber)\n\t|| (Array.isArray(stdioOption) && stdioOption.every(item => isOutputPipe(item, fdNumber)));\n\nconst isOutputPipe = (stdioOption, fdNumber) => stdioOption === 'pipe'\n\t|| isOutputPipeObject(stdioOption, fdNumber);\n\nconst isOutputPipeObject = (stdioOption, fdNumber) => isStdioValueObject(stdioOption)\n\t&& stdioOption.value === 'pipe'\n\t&& (stdioOption.input === undefined || stdioOption.input === false || isFixedOutputPipe(fdNumber, stdioOption.input));\n\n// On `stdout`/`stderr`, the direction is always output, so `input: true` is ignored and the pipe stays output.\nconst isFixedOutputPipe = (fdNumber, input) => input === true && (fdNumber === 1 || fdNumber === 2);\n", "import {readFileSync} from 'node:fs';\nimport tty from 'node:tty';\nimport {isStream as isNodeStream} from 'is-stream';\nimport {STANDARD_STREAMS} from '../utils/standard-stream.js';\nimport {bufferToUint8Array} from '../utils/uint-array.js';\nimport {serializeOptionValue} from '../arguments/fd-options.js';\n\n// When we use multiple `stdio` values for the same streams, we pass 'pipe' to `child_process.spawn()`.\n// We then emulate the piping done by core Node.js.\n// To do so, we transform the following values:\n// - Node.js streams are marked as `type: nodeStream`\n// - 'inherit' becomes `process.stdin|stdout|stderr`\n// - any file descriptor integer becomes `process.stdio[fdNumber]`\n// All of the above transformations tell Execa to perform manual piping.\nexport const handleNativeStream = ({stdioItem, stdioItem: {type}, isStdioArray, fdNumber, direction, isSync}) => {\n\tif (!isStdioArray || type !== 'native') {\n\t\treturn stdioItem;\n\t}\n\n\treturn isSync\n\t\t? handleNativeStreamSync({stdioItem, fdNumber, direction})\n\t\t: handleNativeStreamAsync({stdioItem, fdNumber});\n};\n\n// Synchronous methods use a different logic.\n// 'inherit', file descriptors and process.std* are handled by readFileSync()/writeFileSync().\nconst handleNativeStreamSync = ({stdioItem, stdioItem: {value, optionName}, fdNumber, direction}) => {\n\tconst targetFd = getTargetFd({\n\t\tvalue,\n\t\toptionName,\n\t\tfdNumber,\n\t\tdirection,\n\t});\n\tif (targetFd !== undefined) {\n\t\treturn targetFd;\n\t}\n\n\tif (isNodeStream(value, {checkOpen: false})) {\n\t\tthrow new TypeError(`The \\`${optionName}: Stream\\` option cannot both be an array and include a stream with synchronous methods.`);\n\t}\n\n\treturn stdioItem;\n};\n\nconst getTargetFd = ({value, optionName, fdNumber, direction}) => {\n\tconst targetFdNumber = getTargetFdNumber(value, fdNumber);\n\tif (targetFdNumber === undefined) {\n\t\treturn;\n\t}\n\n\tif (direction === 'output') {\n\t\treturn {type: 'fileNumber', value: targetFdNumber, optionName};\n\t}\n\n\tif (tty.isatty(targetFdNumber)) {\n\t\tthrow new TypeError(`The \\`${optionName}: ${serializeOptionValue(value)}\\` option is invalid: it cannot be a TTY with synchronous methods.`);\n\t}\n\n\treturn {type: 'uint8Array', value: bufferToUint8Array(readFileSync(targetFdNumber)), optionName};\n};\n\nconst getTargetFdNumber = (value, fdNumber) => {\n\tif (value === 'inherit') {\n\t\treturn fdNumber;\n\t}\n\n\tif (typeof value === 'number') {\n\t\treturn value;\n\t}\n\n\tconst standardStreamIndex = STANDARD_STREAMS.indexOf(value);\n\tif (standardStreamIndex !== -1) {\n\t\treturn standardStreamIndex;\n\t}\n};\n\nconst handleNativeStreamAsync = ({stdioItem, stdioItem: {value, optionName}, fdNumber}) => {\n\tif (value === 'inherit') {\n\t\treturn {type: 'nodeStream', value: getStandardStream(fdNumber, value, optionName), optionName};\n\t}\n\n\tif (typeof value === 'number') {\n\t\treturn {type: 'nodeStream', value: getStandardStream(value, value, optionName), optionName};\n\t}\n\n\tif (isNodeStream(value, {checkOpen: false})) {\n\t\treturn {type: 'nodeStream', value, optionName};\n\t}\n\n\treturn stdioItem;\n};\n\n// Node.js does not allow to easily retrieve file descriptors beyond stdin/stdout/stderr as streams.\n// - `fs.createReadStream()`/`fs.createWriteStream()` with the `fd` option do not work with character devices that use blocking reads/writes (such as interactive TTYs).\n// - Using a TCP `Socket` would work but be rather complex to implement.\n// Since this is an edge case, we simply throw an error message.\n// See https://github.com/sindresorhus/execa/pull/643#discussion_r1435905707\nconst getStandardStream = (fdNumber, value, optionName) => {\n\tconst standardStream = STANDARD_STREAMS[fdNumber];\n\n\tif (standardStream === undefined) {\n\t\tthrow new TypeError(`The \\`${optionName}: ${value}\\` option is invalid: no such standard stream.`);\n\t}\n\n\treturn standardStream;\n};\n", "import {parseFd} from './specific.js';\n\n// Retrieve stream targeted by the `to` option\nexport const getToStream = (destination, to = 'stdin') => {\n\tconst isWritable = true;\n\tconst {options, fileDescriptors} = SUBPROCESS_OPTIONS.get(destination);\n\tconst fdNumber = getFdNumber(fileDescriptors, to, isWritable);\n\tconst destinationStream = destination.stdio[fdNumber];\n\n\tif (destinationStream === null) {\n\t\tthrow new TypeError(getInvalidStdioOptionMessage(fdNumber, to, options, isWritable));\n\t}\n\n\treturn destinationStream;\n};\n\n// Retrieve stream targeted by the `from` option\nexport const getFromStream = (source, from = 'stdout') => {\n\tconst isWritable = false;\n\tconst {options, fileDescriptors} = SUBPROCESS_OPTIONS.get(source);\n\tconst fdNumber = getFdNumber(fileDescriptors, from, isWritable);\n\tconst sourceStream = fdNumber === 'all' ? source.all : source.stdio[fdNumber];\n\n\tif (sourceStream === null || sourceStream === undefined) {\n\t\tthrow new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));\n\t}\n\n\treturn sourceStream;\n};\n\n// Keeps track of the options passed to each Execa call\nexport const SUBPROCESS_OPTIONS = new WeakMap();\n\nconst getFdNumber = (fileDescriptors, fdName, isWritable) => {\n\tconst fdNumber = parseFdNumber(fdName, isWritable);\n\tvalidateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);\n\treturn fdNumber;\n};\n\nconst parseFdNumber = (fdName, isWritable) => {\n\tconst fdNumber = parseFd(fdName);\n\tif (fdNumber !== undefined) {\n\t\treturn fdNumber;\n\t}\n\n\tconst {validOptions, defaultValue} = isWritable\n\t\t? {validOptions: '\"stdin\"', defaultValue: 'stdin'}\n\t\t: {validOptions: '\"stdout\", \"stderr\", \"all\"', defaultValue: 'stdout'};\n\tthrow new TypeError(`\"${getOptionName(isWritable)}\" must not be \"${fdName}\".\nIt must be ${validOptions} or \"fd3\", \"fd4\" (and so on).\nIt is optional and defaults to \"${defaultValue}\".`);\n};\n\nconst validateFdNumber = (fdNumber, fdName, isWritable, fileDescriptors) => {\n\tconst fileDescriptor = fileDescriptors[getUsedDescriptor(fdNumber)];\n\tif (fileDescriptor === undefined) {\n\t\tthrow new TypeError(`\"${getOptionName(isWritable)}\" must not be ${fdName}. That file descriptor does not exist.\nPlease set the \"stdio\" option to ensure that file descriptor exists.`);\n\t}\n\n\tif (fileDescriptor.direction === 'input' && !isWritable) {\n\t\tthrow new TypeError(`\"${getOptionName(isWritable)}\" must not be ${fdName}. It must be a readable stream, not writable.`);\n\t}\n\n\tif (fileDescriptor.direction !== 'input' && isWritable) {\n\t\tthrow new TypeError(`\"${getOptionName(isWritable)}\" must not be ${fdName}. It must be a writable stream, not readable.\nIf you meant to use it as input, please set its \"stdio\" option to \\`{value: 'pipe', input: true}\\`.`);\n\t}\n};\n\nconst getInvalidStdioOptionMessage = (fdNumber, fdName, options, isWritable) => {\n\tif (fdNumber === 'all' && !options.all) {\n\t\treturn 'The \"all\" option must be true to use \"from: \\'all\\'\".';\n\t}\n\n\tconst {optionName, optionValue} = getInvalidStdioOption(fdNumber, options);\n\treturn `The \"${optionName}: ${serializeOptionValue(optionValue)}\" option is incompatible with using \"${getOptionName(isWritable)}: ${serializeOptionValue(fdName)}\".\nPlease set this option with \"pipe\" instead.`;\n};\n\nconst getInvalidStdioOption = (fdNumber, {stdin, stdout, stderr, stdio}) => {\n\tconst usedDescriptor = getUsedDescriptor(fdNumber);\n\n\tif (usedDescriptor === 0 && stdin !== undefined) {\n\t\treturn {optionName: 'stdin', optionValue: stdin};\n\t}\n\n\tif (usedDescriptor === 1 && stdout !== undefined) {\n\t\treturn {optionName: 'stdout', optionValue: stdout};\n\t}\n\n\tif (usedDescriptor === 2 && stderr !== undefined) {\n\t\treturn {optionName: 'stderr', optionValue: stderr};\n\t}\n\n\treturn {optionName: `stdio[${usedDescriptor}]`, optionValue: stdio[usedDescriptor]};\n};\n\nconst getUsedDescriptor = fdNumber => fdNumber === 'all' ? 1 : fdNumber;\n\nconst getOptionName = isWritable => isWritable ? 'to' : 'from';\n\nexport const serializeOptionValue = value => {\n\tif (typeof value === 'string') {\n\t\treturn `'${value}'`;\n\t}\n\n\treturn typeof value === 'number' ? `${value}` : 'Stream';\n};\n", "import {isReadableStream} from 'is-stream';\nimport {isUint8Array} from '../utils/uint-array.js';\nimport {isUrl, isFilePathString} from './type.js';\n\n// Append the `stdin` option with the `input` and `inputFile` options\nexport const handleInputOptions = ({input, inputFile}, fdNumber) => fdNumber === 0\n\t? [\n\t\t...handleInputOption(input),\n\t\t...handleInputFileOption(inputFile),\n\t]\n\t: [];\n\nconst handleInputOption = input => input === undefined\n\t? []\n\t: [{\n\t\ttype: getInputType(input),\n\t\tvalue: input,\n\t\toptionName: 'input',\n\t}];\n\nconst getInputType = input => {\n\tif (isReadableStream(input, {checkOpen: false})) {\n\t\treturn 'nodeStream';\n\t}\n\n\tif (typeof input === 'string') {\n\t\treturn 'string';\n\t}\n\n\tif (isUint8Array(input)) {\n\t\treturn 'uint8Array';\n\t}\n\n\tthrow new Error('The `input` option must be a string, a Uint8Array or a Node.js Readable stream.');\n};\n\nconst handleInputFileOption = inputFile => inputFile === undefined\n\t? []\n\t: [{\n\t\t...getInputFileType(inputFile),\n\t\toptionName: 'inputFile',\n\t}];\n\nconst getInputFileType = inputFile => {\n\tif (isUrl(inputFile)) {\n\t\treturn {type: 'fileUrl', value: inputFile};\n\t}\n\n\tif (isFilePathString(inputFile)) {\n\t\treturn {type: 'filePath', value: {file: inputFile}};\n\t}\n\n\tthrow new Error('The `inputFile` option must be a file path string or a file URL.');\n};\n", "import {\n\tSPECIAL_DUPLICATE_TYPES_SYNC,\n\tSPECIAL_DUPLICATE_TYPES,\n\tFORBID_DUPLICATE_TYPES,\n\tTYPE_TO_MESSAGE,\n} from './type.js';\n\n// Duplicates in the same file descriptor is most likely an error.\n// However, this can be useful with generators.\nexport const filterDuplicates = stdioItems => stdioItems.filter((stdioItemOne, indexOne) =>\n\tstdioItems.every((stdioItemTwo, indexTwo) => !hasSameValueAndDirection(stdioItemOne, stdioItemTwo)\n\t\t|| indexOne >= indexTwo\n\t\t|| stdioItemOne.type === 'generator'\n\t\t|| stdioItemOne.type === 'asyncGenerator'));\n\nconst hasSameValueAndDirection = (stdioItemOne, stdioItemTwo) => stdioItemOne.value === stdioItemTwo.value\n\t&& stdioItemOne.direction === stdioItemTwo.direction;\n\n// Check if two file descriptors are sharing the same target.\n// For example `{stdout: {file: './output.txt'}, stderr: {file: './output.txt'}}`.\nexport const getDuplicateStream = ({stdioItem: {type, value, optionName}, direction, fileDescriptors, isSync}) => {\n\tconst otherStdioItems = getOtherStdioItems(fileDescriptors, type);\n\tif (otherStdioItems.length === 0) {\n\t\treturn;\n\t}\n\n\tif (isSync) {\n\t\tvalidateDuplicateStreamSync({\n\t\t\totherStdioItems,\n\t\t\ttype,\n\t\t\tvalue,\n\t\t\toptionName,\n\t\t\tdirection,\n\t\t});\n\t\treturn;\n\t}\n\n\tif (SPECIAL_DUPLICATE_TYPES.has(type)) {\n\t\treturn getDuplicateStreamInstance({\n\t\t\totherStdioItems,\n\t\t\ttype,\n\t\t\tvalue,\n\t\t\toptionName,\n\t\t\tdirection,\n\t\t});\n\t}\n\n\tif (FORBID_DUPLICATE_TYPES.has(type)) {\n\t\tvalidateDuplicateTransform({\n\t\t\totherStdioItems,\n\t\t\ttype,\n\t\t\tvalue,\n\t\t\toptionName,\n\t\t});\n\t}\n};\n\n// Values shared by multiple file descriptors\nconst getOtherStdioItems = (fileDescriptors, type) => fileDescriptors\n\t.flatMap(({direction, stdioItems}) => stdioItems\n\t\t.filter(stdioItem => stdioItem.type === type)\n\t\t.map((stdioItem => ({...stdioItem, direction}))));\n\n// With `execaSync()`, do not allow setting a file path both in input and output\nconst validateDuplicateStreamSync = ({otherStdioItems, type, value, optionName, direction}) => {\n\tif (SPECIAL_DUPLICATE_TYPES_SYNC.has(type)) {\n\t\tgetDuplicateStreamInstance({\n\t\t\totherStdioItems,\n\t\t\ttype,\n\t\t\tvalue,\n\t\t\toptionName,\n\t\t\tdirection,\n\t\t});\n\t}\n};\n\n// When two file descriptors share the file or stream, we need to re-use the same underlying stream.\n// Otherwise, the stream would be closed twice when piping ends.\n// This is only an issue with output file descriptors.\n// This is not a problem with generator functions since those create a new instance for each file descriptor.\n// We also forbid input and output file descriptors sharing the same file or stream, since that does not make sense.\nconst getDuplicateStreamInstance = ({otherStdioItems, type, value, optionName, direction}) => {\n\tconst duplicateStdioItems = otherStdioItems.filter(stdioItem => hasSameValue(stdioItem, value));\n\tif (duplicateStdioItems.length === 0) {\n\t\treturn;\n\t}\n\n\tconst differentStdioItem = duplicateStdioItems.find(stdioItem => stdioItem.direction !== direction);\n\tthrowOnDuplicateStream(differentStdioItem, optionName, type);\n\n\treturn direction === 'output' ? duplicateStdioItems[0].stream : undefined;\n};\n\nconst hasSameValue = ({type, value}, secondValue) => {\n\tif (type === 'filePath') {\n\t\treturn value.file === secondValue.file;\n\t}\n\n\tif (type === 'fileUrl') {\n\t\treturn value.href === secondValue.href;\n\t}\n\n\treturn value === secondValue;\n};\n\n// We do not allow two file descriptors to share the same Duplex or TransformStream.\n// This is because those are set directly to `subprocess.std*`.\n// For example, this could result in `subprocess.stdout` and `subprocess.stderr` being the same value.\n// This means reading from either would get data from both stdout and stderr.\nconst validateDuplicateTransform = ({otherStdioItems, type, value, optionName}) => {\n\tconst duplicateStdioItem = otherStdioItems.find(({value: {transform}}) => transform === value.transform);\n\tthrowOnDuplicateStream(duplicateStdioItem, optionName, type);\n};\n\nconst throwOnDuplicateStream = (stdioItem, optionName, type) => {\n\tif (stdioItem !== undefined) {\n\t\tthrow new TypeError(`The \\`${stdioItem.optionName}\\` and \\`${optionName}\\` options must not target ${TYPE_TO_MESSAGE[type]} that is the same.`);\n\t}\n};\n", "import {getStreamName, isStandardStream} from '../utils/standard-stream.js';\nimport {normalizeTransforms} from '../transform/normalize.js';\nimport {getFdObjectMode} from '../transform/object-mode.js';\nimport {\n\tgetStdioItemType,\n\tisRegularUrl,\n\tisUnknownStdioString,\n\tisStdioValueObject,\n\tcheckBooleanOption,\n\tFILE_TYPES,\n} from './type.js';\nimport {getStreamDirection} from './direction.js';\nimport {normalizeStdioOption} from './stdio-option.js';\nimport {handleNativeStream} from './native.js';\nimport {handleInputOptions} from './input-option.js';\nimport {filterDuplicates, getDuplicateStream} from './duplicate.js';\n\n// Handle `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, before spawning, in async/sync mode\n// They are converted into an array of `fileDescriptors`.\n// Each `fileDescriptor` is normalized, validated and contains all information necessary for further handling.\nexport const handleStdio = (addProperties, options, verboseInfo, isSync) => {\n\tconst stdio = normalizeStdioOption(options, verboseInfo, isSync);\n\tconst initialFileDescriptors = stdio.map((stdioOption, fdNumber) => getFileDescriptor({\n\t\tstdioOption,\n\t\tfdNumber,\n\t\toptions,\n\t\tisSync,\n\t}));\n\tconst fileDescriptors = getFinalFileDescriptors({\n\t\tinitialFileDescriptors,\n\t\taddProperties,\n\t\toptions,\n\t\tisSync,\n\t});\n\toptions.stdio = fileDescriptors.map(({stdioItems}) => forwardStdio(stdioItems));\n\treturn fileDescriptors;\n};\n\nconst getFileDescriptor = ({stdioOption, fdNumber, options, isSync}) => {\n\tconst optionName = getStreamName(fdNumber);\n\tconst {stdioItems: initialStdioItems, isStdioArray} = initializeStdioItems({\n\t\tstdioOption,\n\t\tfdNumber,\n\t\toptions,\n\t\toptionName,\n\t});\n\tconst direction = getStreamDirection(initialStdioItems, fdNumber, optionName);\n\tconst stdioItems = initialStdioItems.map(stdioItem => handleNativeStream({\n\t\tstdioItem,\n\t\tisStdioArray,\n\t\tfdNumber,\n\t\tdirection,\n\t\tisSync,\n\t}));\n\tconst normalizedStdioItems = normalizeTransforms(stdioItems, optionName, direction, options);\n\tconst objectMode = getFdObjectMode(normalizedStdioItems, direction);\n\tvalidateFileObjectMode(normalizedStdioItems, objectMode);\n\treturn {direction, objectMode, stdioItems: normalizedStdioItems};\n};\n\n// We make sure passing an array with a single item behaves the same as passing that item without an array.\n// This is what users would expect.\n// For example, `stdout: ['ignore']` behaves the same as `stdout: 'ignore'`.\nconst initializeStdioItems = ({stdioOption, fdNumber, options, optionName}) => {\n\tconst values = Array.isArray(stdioOption) ? stdioOption : [stdioOption];\n\tconst inputStdioItems = handleInputOptions(options, fdNumber);\n\tconst initialStdioItems = [\n\t\t...omitInheritedStdin(values.map(value => initializeStdioItem(value, optionName)), inputStdioItems),\n\t\t...inputStdioItems,\n\t];\n\n\tconst stdioItems = filterDuplicates(initialStdioItems);\n\tconst isStdioArray = stdioItems.length > 1;\n\tvalidateStdioArray(stdioItems, isStdioArray, optionName);\n\tvalidateStreams(stdioItems);\n\treturn {stdioItems, isStdioArray};\n};\n\nconst omitInheritedStdin = (stdioItems, inputStdioItems) => inputStdioItems.length > 0 && isInheritedStdinOnly(stdioItems)\n\t? []\n\t: stdioItems;\n\nconst isInheritedStdinOnly = stdioItems => stdioItems.length === 1\n\t&& stdioItems[0].type === 'native'\n\t&& stdioItems[0].value === 'inherit';\n\nconst initializeStdioItem = (value, optionName) => {\n\tif (isStdioValueObject(value)) {\n\t\treturn initializeStdioValueObject(value, optionName);\n\t}\n\n\treturn {\n\t\ttype: getStdioItemType(value, optionName),\n\t\tvalue,\n\t\toptionName,\n\t};\n};\n\n// The `{value, input}` object form wraps any stdio value with an explicit direction.\nconst initializeStdioValueObject = ({value, input}, optionName) => {\n\tcheckBooleanOption(input, `${optionName}.input`);\n\n\treturn {\n\t\ttype: getStdioItemType(value, optionName),\n\t\tvalue,\n\t\tdirection: input ? 'input' : undefined,\n\t\toptionName,\n\t};\n};\n\nconst validateStdioArray = (stdioItems, isStdioArray, optionName) => {\n\tif (stdioItems.length === 0) {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option must not be an empty array.`);\n\t}\n\n\tif (!isStdioArray) {\n\t\treturn;\n\t}\n\n\tfor (const {value, optionName} of stdioItems) {\n\t\tif (INVALID_STDIO_ARRAY_OPTIONS.has(value)) {\n\t\t\tthrow new Error(`The \\`${optionName}\\` option must not include \\`${value}\\`.`);\n\t\t}\n\t}\n};\n\n// Using the `ignore` value together with others for the same stream does not make sense, so we make it fail.\n// However, we do allow it if the array has a single item.\nconst INVALID_STDIO_ARRAY_OPTIONS = new Set(['ignore']);\n\nconst validateStreams = stdioItems => {\n\tfor (const stdioItem of stdioItems) {\n\t\tvalidateFileStdio(stdioItem);\n\t}\n};\n\nconst validateFileStdio = ({type, value, optionName}) => {\n\tif (isRegularUrl(value)) {\n\t\tthrow new TypeError(`The \\`${optionName}: URL\\` option must use the \\`file:\\` scheme.\nFor example, you can use the \\`pathToFileURL()\\` method of the \\`url\\` core module.`);\n\t}\n\n\tif (isUnknownStdioString(type, value)) {\n\t\tthrow new TypeError(`The \\`${optionName}: { file: '...' }\\` option must be used instead of \\`${optionName}: '...'\\`.`);\n\t}\n};\n\nconst validateFileObjectMode = (stdioItems, objectMode) => {\n\tif (!objectMode) {\n\t\treturn;\n\t}\n\n\tconst fileStdioItem = stdioItems.find(({type}) => FILE_TYPES.has(type));\n\tif (fileStdioItem !== undefined) {\n\t\tthrow new TypeError(`The \\`${fileStdioItem.optionName}\\` option cannot use both files and transforms in objectMode.`);\n\t}\n};\n\n// Some `stdio` values require Execa to create streams.\n// For example, file paths create file read/write streams.\n// Those transformations are specified in `addProperties`, which is both direction-specific and type-specific.\nconst getFinalFileDescriptors = ({initialFileDescriptors, addProperties, options, isSync}) => {\n\tconst fileDescriptors = [];\n\n\ttry {\n\t\tfor (const fileDescriptor of initialFileDescriptors) {\n\t\t\tfileDescriptors.push(getFinalFileDescriptor({\n\t\t\t\tfileDescriptor,\n\t\t\t\tfileDescriptors,\n\t\t\t\taddProperties,\n\t\t\t\toptions,\n\t\t\t\tisSync,\n\t\t\t}));\n\t\t}\n\n\t\treturn fileDescriptors;\n\t} catch (error) {\n\t\tcleanupCustomStreams(fileDescriptors);\n\t\tthrow error;\n\t}\n};\n\nconst getFinalFileDescriptor = ({\n\tfileDescriptor: {direction, objectMode, stdioItems},\n\tfileDescriptors,\n\taddProperties,\n\toptions,\n\tisSync,\n}) => {\n\tconst finalStdioItems = stdioItems.map(stdioItem => addStreamProperties({\n\t\tstdioItem,\n\t\taddProperties,\n\t\tdirection,\n\t\toptions,\n\t\tfileDescriptors,\n\t\tisSync,\n\t}));\n\treturn {direction, objectMode, stdioItems: finalStdioItems};\n};\n\nconst addStreamProperties = ({stdioItem, addProperties, direction, options, fileDescriptors, isSync}) => {\n\tconst duplicateStream = getDuplicateStream({\n\t\tstdioItem,\n\t\tdirection,\n\t\tfileDescriptors,\n\t\tisSync,\n\t});\n\n\tif (duplicateStream !== undefined) {\n\t\treturn {...stdioItem, stream: duplicateStream};\n\t}\n\n\treturn {\n\t\t...stdioItem,\n\t\t...addProperties[direction][stdioItem.type](stdioItem, options),\n\t};\n};\n\n// The stream error handling is performed by the piping logic above, which cannot be performed before subprocess spawning.\n// If the subprocess spawning fails (e.g. due to an invalid command), the streams need to be manually destroyed.\n// We need to create those streams before subprocess spawning, in case their creation fails, e.g. when passing an invalid generator as argument.\n// Like this, an exception would be thrown, which would prevent spawning a subprocess.\nexport const cleanupCustomStreams = fileDescriptors => {\n\tfor (const {stdioItems} of fileDescriptors) {\n\t\tfor (const {stream} of stdioItems) {\n\t\t\tif (stream !== undefined && !isStandardStream(stream)) {\n\t\t\t\tstream.destroy();\n\t\t\t}\n\t\t}\n\t}\n};\n\n// When the `std*: Iterable | WebStream | URL | filePath`, `input` or `inputFile` option is used, we pipe to `subprocess.std*`.\n// When the `std*: Array` option is used, we emulate some of the native values ('inherit', Node.js stream and file descriptor integer). To do so, we also need to pipe to `subprocess.std*`.\n// Therefore the `std*` options must be either `pipe` or `overlapped`. Other values do not set `subprocess.std*`.\nconst forwardStdio = stdioItems => {\n\tif (stdioItems.length > 1) {\n\t\treturn stdioItems.some(({value}) => value === 'overlapped') ? 'overlapped' : 'pipe';\n\t}\n\n\tconst [{type, value}] = stdioItems;\n\treturn type === 'native' ? value : 'pipe';\n};\n", "import stripFinalNewlineFunction from 'strip-final-newline';\n\n// Apply `stripFinalNewline` option, which applies to `result.stdout|stderr|all|stdio[*]`.\n// If the `lines` option is used, it is applied on each line, but using a different function.\nexport const stripNewline = (value, {stripFinalNewline}, fdNumber) => getStripFinalNewline(stripFinalNewline, fdNumber) && value !== undefined && !Array.isArray(value)\n\t? stripFinalNewlineFunction(value)\n\t: value;\n\n// Retrieve `stripFinalNewline` option value, including with `subprocess.all`\nexport const getStripFinalNewline = (stripFinalNewline, fdNumber) => fdNumber === 'all'\n\t? stripFinalNewline[1] || stripFinalNewline[2]\n\t: stripFinalNewline[fdNumber];\n", "import {Transform, getDefaultHighWaterMark} from 'node:stream';\nimport {isAsyncGenerator} from '../stdio/type.js';\nimport {getSplitLinesGenerator, getAppendNewlineGenerator} from './split.js';\nimport {getValidateTransformInput, getValidateTransformReturn} from './validate.js';\nimport {getEncodingTransformGenerator} from './encoding-transform.js';\nimport {\n\tpushChunks,\n\ttransformChunk,\n\tfinalChunks,\n\tdestroyTransform,\n} from './run-async.js';\nimport {\n\tpushChunksSync,\n\ttransformChunkSync,\n\tfinalChunksSync,\n\trunTransformSync,\n} from './run-sync.js';\n\n/*\nGenerators can be used to transform/filter standard streams.\n\nGenerators have a simple syntax, yet allows all of the following:\n- Sharing `state` between chunks\n- Flushing logic, by using a `final` function\n- Asynchronous logic\n- Emitting multiple chunks from a single source chunk, even if spaced in time, by using multiple `yield`\n- Filtering, by using no `yield`\n\nTherefore, there is no need to allow Node.js or web transform streams.\n\nThe `highWaterMark` is kept as the default value, since this is what `subprocess.std*` uses.\n\nChunks are currently processed serially. We could add a `concurrency` option to parallelize in the future.\n\nTransform an array of generator functions into a `Transform` stream.\n`Duplex.from(generator)` cannot be used because it does not allow setting the `objectMode` and `highWaterMark`.\n*/\nexport const generatorToStream = ({\n\tvalue,\n\tvalue: {transform, final, writableObjectMode, readableObjectMode},\n\toptionName,\n}, {encoding}) => {\n\tconst state = {};\n\tconst generators = addInternalGenerators(value, encoding, optionName);\n\n\tconst transformAsync = isAsyncGenerator(transform);\n\tconst finalAsync = isAsyncGenerator(final);\n\tconst transformMethod = transformAsync\n\t\t? pushChunks.bind(undefined, transformChunk, state)\n\t\t: pushChunksSync.bind(undefined, transformChunkSync);\n\tconst finalMethod = transformAsync || finalAsync\n\t\t? pushChunks.bind(undefined, finalChunks, state)\n\t\t: pushChunksSync.bind(undefined, finalChunksSync);\n\tconst destroyMethod = transformAsync || finalAsync\n\t\t? destroyTransform.bind(undefined, state)\n\t\t: undefined;\n\n\tconst stream = new Transform({\n\t\twritableObjectMode,\n\t\twritableHighWaterMark: getDefaultHighWaterMark(writableObjectMode),\n\t\treadableObjectMode,\n\t\treadableHighWaterMark: getDefaultHighWaterMark(readableObjectMode),\n\t\ttransform(chunk, encoding, done) {\n\t\t\ttransformMethod([chunk, generators, 0], this, done);\n\t\t},\n\t\tflush(done) {\n\t\t\tfinalMethod([generators], this, done);\n\t\t},\n\t\tdestroy: destroyMethod,\n\t});\n\treturn {stream};\n};\n\n// Applies transform generators in sync mode\nexport const runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {\n\tconst generators = stdioItems.filter(({type}) => type === 'generator');\n\tconst reversedGenerators = isInput ? generators.reverse() : generators;\n\n\tfor (const {value, optionName} of reversedGenerators) {\n\t\tconst generators = addInternalGenerators(value, encoding, optionName);\n\t\tchunks = runTransformSync(generators, chunks);\n\t}\n\n\treturn chunks;\n};\n\n// Generators used internally to convert the chunk type, validate it, and split into lines\nconst addInternalGenerators = (\n\t{transform, final, binary, writableObjectMode, readableObjectMode, preserveNewlines},\n\tencoding,\n\toptionName,\n) => {\n\tconst state = {};\n\treturn [\n\t\t{transform: getValidateTransformInput(writableObjectMode, optionName)},\n\t\tgetEncodingTransformGenerator(binary, encoding, writableObjectMode),\n\t\tgetSplitLinesGenerator(binary, preserveNewlines, writableObjectMode, state),\n\t\t{transform, final},\n\t\t{transform: getValidateTransformReturn(readableObjectMode, optionName)},\n\t\tgetAppendNewlineGenerator({\n\t\t\tbinary,\n\t\t\tpreserveNewlines,\n\t\t\treadableObjectMode,\n\t\t\tstate,\n\t\t}),\n\t].filter(Boolean);\n};\n", "// Split chunks line-wise for generators passed to the `std*` options\nexport const getSplitLinesGenerator = (binary, preserveNewlines, skipped, state) => binary || skipped\n\t? undefined\n\t: initializeSplitLines(preserveNewlines, state);\n\n// Same but for synchronous methods\nexport const splitLinesSync = (chunk, preserveNewlines, objectMode) => objectMode\n\t? chunk.flatMap(item => splitLinesItemSync(item, preserveNewlines))\n\t: splitLinesItemSync(chunk, preserveNewlines);\n\nconst splitLinesItemSync = (chunk, preserveNewlines) => {\n\tconst {transform, final} = initializeSplitLines(preserveNewlines, {});\n\treturn [...transform(chunk), ...final()];\n};\n\nconst initializeSplitLines = (preserveNewlines, state) => {\n\tstate.previousChunks = '';\n\treturn {\n\t\ttransform: splitGenerator.bind(undefined, state, preserveNewlines),\n\t\tfinal: linesFinal.bind(undefined, state),\n\t};\n};\n\n// This imperative logic is much faster than using `String.split()` and uses very low memory.\nconst splitGenerator = function * (state, preserveNewlines, chunk) {\n\tif (typeof chunk !== 'string') {\n\t\tyield chunk;\n\t\treturn;\n\t}\n\n\tlet {previousChunks} = state;\n\tlet start = -1;\n\n\tfor (let end = 0; end < chunk.length; end += 1) {\n\t\tif (chunk[end] !== '\\n') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst newlineLength = getNewlineLength(chunk, end, preserveNewlines, state);\n\t\tlet line = chunk.slice(start + 1, end + 1 - newlineLength);\n\n\t\tif (previousChunks.length > 0) {\n\t\t\tline = concatString(previousChunks, line);\n\t\t\tpreviousChunks = '';\n\t\t}\n\n\t\tyield line;\n\t\tstart = end;\n\t}\n\n\tif (start !== chunk.length - 1) {\n\t\tpreviousChunks = concatString(previousChunks, chunk.slice(start + 1));\n\t}\n\n\tstate.previousChunks = previousChunks;\n};\n\nconst getNewlineLength = (chunk, end, preserveNewlines, state) => {\n\tif (preserveNewlines) {\n\t\treturn 0;\n\t}\n\n\tstate.isWindowsNewline = end !== 0 && chunk[end - 1] === '\\r';\n\treturn state.isWindowsNewline ? 2 : 1;\n};\n\nconst linesFinal = function * ({previousChunks}) {\n\tif (previousChunks.length > 0) {\n\t\tyield previousChunks;\n\t}\n};\n\n// Unless `preserveNewlines: true` is used, we strip the newline of each line.\n// This re-adds them after the user `transform` code has run.\nexport const getAppendNewlineGenerator = ({binary, preserveNewlines, readableObjectMode, state}) => binary || preserveNewlines || readableObjectMode\n\t? undefined\n\t: {transform: appendNewlineGenerator.bind(undefined, state)};\n\nconst appendNewlineGenerator = function * ({isWindowsNewline = false}, chunk) {\n\tconst {unixNewline, windowsNewline, LF, concatBytes} = typeof chunk === 'string' ? linesStringInfo : linesUint8ArrayInfo;\n\n\tif (chunk.at(-1) === LF) {\n\t\tyield chunk;\n\t\treturn;\n\t}\n\n\tconst newline = isWindowsNewline ? windowsNewline : unixNewline;\n\tyield concatBytes(chunk, newline);\n};\n\nconst concatString = (firstChunk, secondChunk) => `${firstChunk}${secondChunk}`;\n\nconst linesStringInfo = {\n\twindowsNewline: '\\r\\n',\n\tunixNewline: '\\n',\n\tLF: '\\n',\n\tconcatBytes: concatString,\n};\n\nconst concatUint8Array = (firstChunk, secondChunk) => {\n\tconst chunk = new Uint8Array(firstChunk.length + secondChunk.length);\n\tchunk.set(firstChunk, 0);\n\tchunk.set(secondChunk, firstChunk.length);\n\treturn chunk;\n};\n\nconst linesUint8ArrayInfo = {\n\twindowsNewline: new Uint8Array([0x0D, 0x0A]),\n\tunixNewline: new Uint8Array([0x0A]),\n\tLF: 0x0A,\n\tconcatBytes: concatUint8Array,\n};\n", "import {Buffer} from 'node:buffer';\nimport {isUint8Array} from '../utils/uint-array.js';\n\n// Validate the type of chunk argument passed to transform generators\nexport const getValidateTransformInput = (writableObjectMode, optionName) => writableObjectMode\n\t? undefined\n\t: validateStringTransformInput.bind(undefined, optionName);\n\nconst validateStringTransformInput = function * (optionName, chunk) {\n\tif (typeof chunk !== 'string' && !isUint8Array(chunk) && !Buffer.isBuffer(chunk)) {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option's transform must use \"objectMode: true\" to receive as input: ${typeof chunk}.`);\n\t}\n\n\tyield chunk;\n};\n\n// Validate the type of the value returned by transform generators\nexport const getValidateTransformReturn = (readableObjectMode, optionName) => readableObjectMode\n\t? validateObjectTransformReturn.bind(undefined, optionName)\n\t: validateStringTransformReturn.bind(undefined, optionName);\n\nconst validateObjectTransformReturn = function * (optionName, chunk) {\n\tvalidateEmptyReturn(optionName, chunk);\n\tyield chunk;\n};\n\nconst validateStringTransformReturn = function * (optionName, chunk) {\n\tvalidateEmptyReturn(optionName, chunk);\n\n\tif (typeof chunk !== 'string' && !isUint8Array(chunk)) {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option's function must yield a string or an Uint8Array, not ${typeof chunk}.`);\n\t}\n\n\tyield chunk;\n};\n\nconst validateEmptyReturn = (optionName, chunk) => {\n\tif (chunk === null || chunk === undefined) {\n\t\tthrow new TypeError(`The \\`${optionName}\\` option's function must not call \\`yield ${chunk}\\`.\nInstead, \\`yield\\` should either be called with a value, or not be called at all. For example:\n if (condition) { yield value; }`);\n\t}\n};\n", "import {Buffer} from 'node:buffer';\nimport {StringDecoder} from 'node:string_decoder';\nimport {isUint8Array, bufferToUint8Array} from '../utils/uint-array.js';\n\n/*\nWhen using binary encodings, add an internal generator that converts chunks from `Buffer` to `string` or `Uint8Array`.\nChunks might be Buffer, Uint8Array or strings since:\n- `subprocess.stdout|stderr` emits Buffers\n- `subprocess.stdin.write()` accepts Buffer, Uint8Array or string\n- Previous generators might return Uint8Array or string\n\nHowever, those are converted to Buffer:\n- on writes: `Duplex.writable` `decodeStrings: true` default option\n- on reads: `Duplex.readable` `readableEncoding: null` default option\n*/\nexport const getEncodingTransformGenerator = (binary, encoding, skipped) => {\n\tif (skipped) {\n\t\treturn;\n\t}\n\n\tif (binary) {\n\t\treturn {transform: encodingUint8ArrayGenerator.bind(undefined, new TextEncoder())};\n\t}\n\n\tconst stringDecoder = new StringDecoder(encoding);\n\treturn {\n\t\ttransform: encodingStringGenerator.bind(undefined, stringDecoder),\n\t\tfinal: encodingStringFinal.bind(undefined, stringDecoder),\n\t};\n};\n\nconst encodingUint8ArrayGenerator = function * (textEncoder, chunk) {\n\tif (Buffer.isBuffer(chunk)) {\n\t\tyield bufferToUint8Array(chunk);\n\t} else if (typeof chunk === 'string') {\n\t\tyield textEncoder.encode(chunk);\n\t} else {\n\t\tyield chunk;\n\t}\n};\n\nconst encodingStringGenerator = function * (stringDecoder, chunk) {\n\tyield isUint8Array(chunk) ? stringDecoder.write(chunk) : chunk;\n};\n\nconst encodingStringFinal = function * (stringDecoder) {\n\tconst lastChunk = stringDecoder.end();\n\tif (lastChunk !== '') {\n\t\tyield lastChunk;\n\t}\n};\n", "import {callbackify} from 'node:util';\n\n// Applies a series of generator functions asynchronously\nexport const pushChunks = callbackify(async (getChunks, state, getChunksArguments, transformStream) => {\n\tstate.currentIterable = getChunks(...getChunksArguments);\n\n\ttry {\n\t\tfor await (const chunk of state.currentIterable) {\n\t\t\ttransformStream.push(chunk);\n\t\t}\n\t} finally {\n\t\tdelete state.currentIterable;\n\t}\n});\n\n// For each new chunk, apply each `transform()` method\nexport const transformChunk = async function * (chunk, generators, index) {\n\tif (index === generators.length) {\n\t\tyield chunk;\n\t\treturn;\n\t}\n\n\tconst {transform = identityGenerator} = generators[index];\n\tfor await (const transformedChunk of transform(chunk)) {\n\t\tyield * transformChunk(transformedChunk, generators, index + 1);\n\t}\n};\n\n// At the end, apply each `final()` method, followed by the `transform()` method of the next transforms\nexport const finalChunks = async function * (generators) {\n\tfor (const [index, {final}] of Object.entries(generators)) {\n\t\tyield * generatorFinalChunks(final, Number(index), generators);\n\t}\n};\n\nconst generatorFinalChunks = async function * (final, index, generators) {\n\tif (final === undefined) {\n\t\treturn;\n\t}\n\n\tfor await (const finalChunk of final()) {\n\t\tyield * transformChunk(finalChunk, generators, index + 1);\n\t}\n};\n\n// Cancel any ongoing async generator when the Transform is destroyed, e.g. when the subprocess errors\nexport const destroyTransform = callbackify(async ({currentIterable}, error) => {\n\tif (currentIterable !== undefined) {\n\t\tawait (error ? currentIterable.throw(error) : currentIterable.return());\n\t\treturn;\n\t}\n\n\tif (error) {\n\t\tthrow error;\n\t}\n});\n\nconst identityGenerator = function * (chunk) {\n\tyield chunk;\n};\n", "// Duplicate the code from `run-async.js` but as synchronous functions\nexport const pushChunksSync = (getChunksSync, getChunksArguments, transformStream, done) => {\n\ttry {\n\t\tfor (const chunk of getChunksSync(...getChunksArguments)) {\n\t\t\ttransformStream.push(chunk);\n\t\t}\n\n\t\tdone();\n\t} catch (error) {\n\t\tdone(error);\n\t}\n};\n\n// Run synchronous generators with `execaSync()`\nexport const runTransformSync = (generators, chunks) => [\n\t...chunks.flatMap(chunk => [...transformChunkSync(chunk, generators, 0)]),\n\t...finalChunksSync(generators),\n];\n\nexport const transformChunkSync = function * (chunk, generators, index) {\n\tif (index === generators.length) {\n\t\tyield chunk;\n\t\treturn;\n\t}\n\n\tconst {transform = identityGenerator} = generators[index];\n\tfor (const transformedChunk of transform(chunk)) {\n\t\tyield * transformChunkSync(transformedChunk, generators, index + 1);\n\t}\n};\n\nexport const finalChunksSync = function * (generators) {\n\tfor (const [index, {final}] of Object.entries(generators)) {\n\t\tyield * generatorFinalChunksSync(final, Number(index), generators);\n\t}\n};\n\nconst generatorFinalChunksSync = function * (final, index, generators) {\n\tif (final === undefined) {\n\t\treturn;\n\t}\n\n\tfor (const finalChunk of final()) {\n\t\tyield * transformChunkSync(finalChunk, generators, index + 1);\n\t}\n};\n\nconst identityGenerator = function * (chunk) {\n\tyield chunk;\n};\n", "import {runGeneratorsSync} from '../transform/generator.js';\nimport {joinToUint8Array, isUint8Array} from '../utils/uint-array.js';\nimport {TYPE_TO_MESSAGE} from '../stdio/type.js';\n\n// Apply `stdin`/`input`/`inputFile` options, before spawning, in sync mode, by converting it to the `input` option\nexport const addInputOptionsSync = (fileDescriptors, options) => {\n\tfor (const fdNumber of getInputFdNumbers(fileDescriptors)) {\n\t\taddInputOptionSync(fileDescriptors, fdNumber, options);\n\t}\n};\n\nconst getInputFdNumbers = fileDescriptors => new Set(Object.entries(fileDescriptors)\n\t.filter(([, {direction}]) => direction === 'input')\n\t.map(([fdNumber]) => Number(fdNumber)));\n\nconst addInputOptionSync = (fileDescriptors, fdNumber, options) => {\n\tconst {stdioItems} = fileDescriptors[fdNumber];\n\tconst allStdioItems = stdioItems.filter(({contents}) => contents !== undefined);\n\tif (allStdioItems.length === 0) {\n\t\treturn;\n\t}\n\n\tif (fdNumber !== 0) {\n\t\tconst [{type, optionName}] = allStdioItems;\n\t\tthrow new TypeError(`Only the \\`stdin\\` option, not \\`${optionName}\\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`);\n\t}\n\n\tconst allContents = allStdioItems.map(({contents}) => contents);\n\tconst transformedContents = allContents.map(contents => applySingleInputGeneratorsSync(contents, stdioItems));\n\toptions.input = joinToUint8Array(transformedContents);\n};\n\nconst applySingleInputGeneratorsSync = (contents, stdioItems) => {\n\tconst newContents = runGeneratorsSync(contents, stdioItems, 'utf8', true);\n\tvalidateSerializable(newContents);\n\treturn joinToUint8Array(newContents);\n};\n\nconst validateSerializable = newContents => {\n\tconst invalidItem = newContents.find(item => typeof item !== 'string' && !isUint8Array(item));\n\tif (invalidItem !== undefined) {\n\t\tthrow new TypeError(`The \\`stdin\\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${invalidItem}.`);\n\t}\n};\n", "import {writeFileSync, appendFileSync} from 'node:fs';\nimport {shouldLogOutput, logLinesSync} from '../verbose/output.js';\nimport {runGeneratorsSync} from '../transform/generator.js';\nimport {splitLinesSync} from '../transform/split.js';\nimport {joinToString, joinToUint8Array, bufferToUint8Array} from '../utils/uint-array.js';\nimport {FILE_TYPES} from '../stdio/type.js';\nimport {truncateMaxBufferSync} from './max-buffer.js';\n\n// Apply `stdout`/`stderr` options, after spawning, in sync mode\nexport const transformOutputSync = ({fileDescriptors, syncResult: {output}, options, isMaxBuffer, verboseInfo}) => {\n\tif (output === null) {\n\t\treturn {output: Array.from({length: 3})};\n\t}\n\n\tconst state = {};\n\tconst outputFiles = new Set();\n\tconst transformedOutput = output.map((result, fdNumber) =>\n\t\ttransformOutputResultSync({\n\t\t\tresult,\n\t\t\tfileDescriptors,\n\t\t\tfdNumber,\n\t\t\tstate,\n\t\t\toutputFiles,\n\t\t\tisMaxBuffer,\n\t\t\tverboseInfo,\n\t\t}, options));\n\treturn {output: transformedOutput, ...state};\n};\n\nconst transformOutputResultSync = (\n\t{result, fileDescriptors, fdNumber, state, outputFiles, isMaxBuffer, verboseInfo},\n\t{buffer, encoding, lines, stripFinalNewline, maxBuffer},\n) => {\n\tif (result === null) {\n\t\treturn;\n\t}\n\n\tconst truncatedResult = truncateMaxBufferSync(result, isMaxBuffer, maxBuffer);\n\tconst uint8ArrayResult = bufferToUint8Array(truncatedResult);\n\tconst {stdioItems, objectMode} = fileDescriptors[fdNumber];\n\tconst chunks = runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state);\n\tconst {serializedResult, finalResult = serializedResult} = serializeChunks({\n\t\tchunks,\n\t\tobjectMode,\n\t\tencoding,\n\t\tlines,\n\t\tstripFinalNewline,\n\t\tfdNumber,\n\t});\n\n\tlogOutputSync({\n\t\tserializedResult,\n\t\tfdNumber,\n\t\tstate,\n\t\tverboseInfo,\n\t\tencoding,\n\t\tstdioItems,\n\t\tobjectMode,\n\t});\n\n\tconst returnedResult = buffer[fdNumber] ? finalResult : undefined;\n\n\ttry {\n\t\tif (state.error === undefined) {\n\t\t\twriteToFiles(serializedResult, stdioItems, outputFiles);\n\t\t}\n\n\t\treturn returnedResult;\n\t} catch (error) {\n\t\tstate.error = error;\n\t\treturn returnedResult;\n\t}\n};\n\n// Applies transform generators to `stdout`/`stderr`\nconst runOutputGeneratorsSync = (chunks, stdioItems, encoding, state) => {\n\ttry {\n\t\treturn runGeneratorsSync(chunks, stdioItems, encoding, false);\n\t} catch (error) {\n\t\tstate.error = error;\n\t\treturn chunks;\n\t}\n};\n\n// The contents is converted to three stages:\n// - serializedResult: used when the target is a file path/URL or a file descriptor (including 'inherit')\n// - finalResult/returnedResult: returned as `result.std*`\nconst serializeChunks = ({chunks, objectMode, encoding, lines, stripFinalNewline, fdNumber}) => {\n\tif (objectMode) {\n\t\treturn {serializedResult: chunks};\n\t}\n\n\tif (encoding === 'buffer') {\n\t\treturn {serializedResult: joinToUint8Array(chunks)};\n\t}\n\n\tconst serializedResult = joinToString(chunks, encoding);\n\tif (lines[fdNumber]) {\n\t\treturn {serializedResult, finalResult: splitLinesSync(serializedResult, !stripFinalNewline[fdNumber], objectMode)};\n\t}\n\n\treturn {serializedResult};\n};\n\nconst logOutputSync = ({serializedResult, fdNumber, state, verboseInfo, encoding, stdioItems, objectMode}) => {\n\tif (!shouldLogOutput({\n\t\tstdioItems,\n\t\tencoding,\n\t\tverboseInfo,\n\t\tfdNumber,\n\t})) {\n\t\treturn;\n\t}\n\n\tconst linesArray = splitLinesSync(serializedResult, false, objectMode);\n\n\ttry {\n\t\tlogLinesSync(linesArray, fdNumber, verboseInfo);\n\t} catch (error) {\n\t\tstate.error ??= error;\n\t}\n};\n\n// When the `std*` target is a file path/URL or a file descriptor\nconst writeToFiles = (serializedResult, stdioItems, outputFiles) => {\n\tconst fileItems = stdioItems.filter(({type}) => FILE_TYPES.has(type));\n\tfor (const {path, append} of fileItems) {\n\t\tconst pathString = typeof path === 'string' ? path : path.toString();\n\t\tif (append || outputFiles.has(pathString)) {\n\t\t\tappendFileSync(path, serializedResult);\n\t\t} else {\n\t\t\toutputFiles.add(pathString);\n\t\t\twriteFileSync(path, serializedResult);\n\t\t}\n\t}\n};\n", "import {BINARY_ENCODINGS} from '../arguments/encoding-option.js';\nimport {TRANSFORM_TYPES} from '../stdio/type.js';\nimport {verboseLog, serializeVerboseMessage} from './log.js';\nimport {isFullVerbose} from './values.js';\n\n// `ignore` opts-out of `verbose` for a specific stream.\n// `ipc` cannot use piping.\n// `inherit` would result in double printing.\n// They can also lead to double printing when passing file descriptor integers or `process.std*`.\n// This only leaves with `pipe` and `overlapped`.\nexport const shouldLogOutput = ({stdioItems, encoding, verboseInfo, fdNumber}) => fdNumber !== 'all'\n\t&& isFullVerbose(verboseInfo, fdNumber)\n\t&& !BINARY_ENCODINGS.has(encoding)\n\t&& isFdVerbose(fdNumber)\n\t&& (stdioItems.some(({type, value}) => type === 'native' && PIPED_STDIO_VALUES.has(value))\n\t\t|| stdioItems.every(({type}) => TRANSFORM_TYPES.has(type)));\n\n// Printing input streams would be confusing.\n// Files and streams can produce big outputs, which we don't want to print.\n// We could print `stdio[3+]` but it often is redirected to files and streams, with the same issue.\n// So we only print stdout and stderr.\nconst isFdVerbose = fdNumber => fdNumber === 1 || fdNumber === 2;\n\nconst PIPED_STDIO_VALUES = new Set(['pipe', 'overlapped']);\n\n// `verbose: 'full'` printing logic with async methods\nexport const logLines = async (linesIterable, stream, fdNumber, verboseInfo) => {\n\tfor await (const line of linesIterable) {\n\t\tif (!isPipingStream(stream)) {\n\t\t\tlogLine(line, fdNumber, verboseInfo);\n\t\t}\n\t}\n};\n\n// `verbose: 'full'` printing logic with sync methods\nexport const logLinesSync = (linesArray, fdNumber, verboseInfo) => {\n\tfor (const line of linesArray) {\n\t\tlogLine(line, fdNumber, verboseInfo);\n\t}\n};\n\n// When `subprocess.stdout|stderr.pipe()` is called, `verbose` becomes a noop.\n// This prevents the following problems:\n// - `.pipe()` achieves the same result as using `stdout: 'inherit'`, `stdout: stream`, etc. which also make `verbose` a noop.\n// For example, `subprocess.stdout.pipe(process.stdin)` would print each line twice.\n// - When chaining subprocesses with `subprocess.pipe(otherSubprocess)`, only the last one should print its output.\n// Detecting whether `.pipe()` is impossible without monkey-patching it, so we use the following undocumented property.\n// This is not a critical behavior since changes of the following property would only make `verbose` more verbose.\nconst isPipingStream = stream => stream._readableState.pipes.length > 0;\n\n// When `verbose` is `full`, print stdout|stderr\nconst logLine = (line, fdNumber, verboseInfo) => {\n\tconst verboseMessage = serializeVerboseMessage(line);\n\tverboseLog({\n\t\ttype: 'output',\n\t\tverboseMessage,\n\t\tfdNumber,\n\t\tverboseInfo,\n\t});\n};\n", "import {isUint8Array, concatUint8Arrays} from '../utils/uint-array.js';\nimport {stripNewline} from '../io/strip-newline.js';\n\n// Retrieve `result.all` with synchronous methods\nexport const getAllSync = ([, stdout, stderr], options) => {\n\tif (!options.all) {\n\t\treturn;\n\t}\n\n\tif (stdout === undefined) {\n\t\treturn stderr;\n\t}\n\n\tif (stderr === undefined) {\n\t\treturn stdout;\n\t}\n\n\tif (Array.isArray(stdout)) {\n\t\treturn Array.isArray(stderr)\n\t\t\t? [...stdout, ...stderr]\n\t\t\t: [...stdout, stripNewline(stderr, options, 'all')];\n\t}\n\n\tif (Array.isArray(stderr)) {\n\t\treturn [stripNewline(stdout, options, 'all'), ...stderr];\n\t}\n\n\tif (isUint8Array(stdout) && isUint8Array(stderr)) {\n\t\treturn concatUint8Arrays([stdout, stderr]);\n\t}\n\n\treturn `${stdout}${stderr}`;\n};\n", "import {once} from 'node:events';\nimport {DiscardedError} from '../return/final-error.js';\n\n// If `error` is emitted before `spawn`, `exit` will never be emitted.\n// However, `error` might be emitted after `spawn`.\n// In that case, `exit` will still be emitted.\n// Since the `exit` event contains the signal name, we want to make sure we are listening for it.\n// This function also takes into account the following unlikely cases:\n// - `exit` being emitted in the same microtask as `spawn`\n// - `error` being emitted multiple times\nexport const waitForExit = async (subprocess, context) => {\n\tconst [exitCode, signal] = await waitForExitOrError(subprocess);\n\tcontext.isForcefullyTerminated ??= false;\n\treturn [exitCode, signal];\n};\n\nconst waitForExitOrError = async subprocess => {\n\tconst [spawnPayload, exitPayload] = await Promise.allSettled([\n\t\tonce(subprocess, 'spawn'),\n\t\tonce(subprocess, 'exit'),\n\t]);\n\n\tif (spawnPayload.status === 'rejected') {\n\t\treturn [];\n\t}\n\n\treturn exitPayload.status === 'rejected'\n\t\t? waitForSubprocessExit(subprocess)\n\t\t: exitPayload.value;\n};\n\nconst waitForSubprocessExit = async subprocess => {\n\ttry {\n\t\treturn await once(subprocess, 'exit');\n\t} catch {\n\t\treturn waitForSubprocessExit(subprocess);\n\t}\n};\n\n// Retrieve the final exit code and|or signal name\nexport const waitForSuccessfulExit = async exitPromise => {\n\tconst [exitCode, signal] = await exitPromise;\n\n\tif (!isSubprocessErrorExit(exitCode, signal) && isFailedExit(exitCode, signal)) {\n\t\tthrow new DiscardedError();\n\t}\n\n\treturn [exitCode, signal];\n};\n\n// When the subprocess fails due to an `error` event\nconst isSubprocessErrorExit = (exitCode, signal) => exitCode === undefined && signal === undefined;\n// When the subprocess fails due to a non-0 exit code or to a signal termination\nexport const isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;\n", "import {DiscardedError} from '../return/final-error.js';\nimport {isMaxBufferSync} from '../io/max-buffer.js';\nimport {isFailedExit} from './exit-async.js';\n\n// Retrieve exit code, signal name and error information, with synchronous methods\nexport const getExitResultSync = ({error, status: exitCode, signal, output}, {maxBuffer}) => {\n\tconst resultError = getResultError(error, exitCode, signal);\n\tconst isTimedOut = resultError?.code === 'ETIMEDOUT';\n\tconst isMaxBuffer = isMaxBufferSync(resultError, output, maxBuffer);\n\treturn {\n\t\tresultError,\n\t\texitCode,\n\t\tsignal,\n\t\ttimedOut: isTimedOut,\n\t\tisMaxBuffer,\n\t};\n};\n\nconst getResultError = (error, exitCode, signal) => {\n\tif (error !== undefined) {\n\t\treturn error;\n\t}\n\n\treturn isFailedExit(exitCode, signal) ? new DiscardedError() : undefined;\n};\n", "import {setMaxListeners} from 'node:events';\nimport {spawn} from 'node:child_process';\nimport {MaxBufferError} from 'get-stream';\nimport {handleCommand} from '../arguments/command.js';\nimport {normalizeOptions} from '../arguments/options.js';\nimport {SUBPROCESS_OPTIONS} from '../arguments/fd-options.js';\nimport {concatenateShell} from '../arguments/shell.js';\nimport {addIpcMethods} from '../ipc/methods.js';\nimport {setIpcSubprocessOptions} from '../ipc/outgoing.js';\nimport {makeError, makeSuccessResult} from '../return/result.js';\nimport {handleResult} from '../return/reject.js';\nimport {handleEarlyError} from '../return/early-error.js';\nimport {handleStdioAsync} from '../stdio/handle-async.js';\nimport {stripNewline} from '../io/strip-newline.js';\nimport {pipeOutputAsync} from '../io/output-async.js';\nimport {subprocessKill} from '../terminate/kill.js';\nimport {getSpawnOptions, getKillFunction} from '../terminate/kill-descendants.js';\nimport {cleanupOnExit} from '../terminate/cleanup.js';\nimport {pipeToSubprocess} from '../pipe/setup.js';\nimport {makeAllStream} from '../resolve/all-async.js';\nimport {waitForSubprocessResult} from '../resolve/wait-subprocess.js';\nimport {addConvertedStreams} from '../convert/add.js';\nimport {createDeferred} from '../utils/deferred.js';\nimport {mergePromise} from './promise.js';\n\n// Main shared logic for all async methods: `execa()`, `$`, `execaNode()`\nexport const execaCoreAsync = (rawFile, rawArguments, rawOptions, createNested) => {\n\tconst {file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors} = handleAsyncArguments(rawFile, rawArguments, rawOptions);\n\tconst {subprocess: nodeChildProcess, promise, kill, all, convertedStreams} = spawnSubprocessAsync({\n\t\tfile,\n\t\tcommandArguments,\n\t\toptions,\n\t\tstartTime,\n\t\tverboseInfo,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tfileDescriptors,\n\t});\n\tconst subprocess = getSubprocessPromise({\n\t\tpromise,\n\t\tnodeChildProcess,\n\t\tkill,\n\t\tall,\n\t\tconvertedStreams,\n\t\toptions,\n\t});\n\tsubprocess.pipe = pipeToSubprocess.bind(undefined, {\n\t\tsource: subprocess,\n\t\tsourcePromise: promise,\n\t\tboundOptions: {},\n\t\tcreateNested,\n\t});\n\tSUBPROCESS_OPTIONS.set(subprocess, {options, fileDescriptors});\n\treturn subprocess;\n};\n\n// Compute arguments to pass to `child_process.spawn()`\nconst handleAsyncArguments = (rawFile, rawArguments, rawOptions) => {\n\tconst {command, escapedCommand, startTime, verboseInfo} = handleCommand(rawFile, rawArguments, rawOptions);\n\tconst {file, commandArguments, options: normalizedOptions} = normalizeOptions(rawFile, rawArguments, rawOptions);\n\tconst options = handleAsyncOptions(normalizedOptions);\n\tconst fileDescriptors = handleStdioAsync(options, verboseInfo);\n\treturn {\n\t\tfile,\n\t\tcommandArguments,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstartTime,\n\t\tverboseInfo,\n\t\toptions,\n\t\tfileDescriptors,\n\t};\n};\n\n// Options normalization logic specific to async methods.\n// Prevent passing the `timeout` option directly to `child_process.spawn()`.\nconst handleAsyncOptions = ({timeout, signal, ...options}) => {\n\tif (signal !== undefined) {\n\t\tthrow new TypeError('The \"signal\" option has been renamed to \"cancelSignal\" instead.');\n\t}\n\n\treturn {...options, timeoutDuration: timeout};\n};\n\nconst spawnSubprocessAsync = ({file, commandArguments, options, startTime, verboseInfo, command, escapedCommand, fileDescriptors}) => {\n\tlet subprocess;\n\ttry {\n\t\tsubprocess = spawn(...concatenateShell(file, commandArguments, getSpawnOptions(options)));\n\t} catch (error) {\n\t\treturn handleEarlyError({\n\t\t\terror,\n\t\t\tcommand,\n\t\t\tescapedCommand,\n\t\t\tfileDescriptors,\n\t\t\toptions,\n\t\t\tstartTime,\n\t\t\tverboseInfo,\n\t\t});\n\t}\n\n\tconst controller = new AbortController();\n\tsetMaxListeners(Infinity, controller.signal);\n\n\tconst originalStreams = [...subprocess.stdio];\n\tpipeOutputAsync(subprocess, fileDescriptors, controller);\n\tsetIpcSubprocessOptions(subprocess, options);\n\n\tconst context = {};\n\tconst onInternalError = createDeferred();\n\tconst kill = subprocessKill.bind(undefined, {\n\t\tkill: getKillFunction(subprocess, options),\n\t\toptions,\n\t\tonInternalError,\n\t\tcontext,\n\t\tcontroller,\n\t});\n\tcleanupOnExit(kill, options, controller);\n\tconst all = makeAllStream(subprocess, options);\n\n\tconst promise = handlePromise({\n\t\tsubprocess,\n\t\tkill,\n\t\tall,\n\t\toptions,\n\t\tstartTime,\n\t\tverboseInfo,\n\t\tfileDescriptors,\n\t\toriginalStreams,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tcontext,\n\t\tonInternalError,\n\t\tcontroller,\n\t});\n\treturn {\n\t\tsubprocess,\n\t\tpromise,\n\t\tkill,\n\t\tall,\n\t};\n};\n\nconst getSubprocessPromise = ({promise, nodeChildProcess, kill, all, convertedStreams, options}) => {\n\tconst subprocess = mergePromise(promise, getSubprocessProperties(nodeChildProcess, all));\n\tsubprocess.kill = kill ?? subprocess.kill;\n\tif (convertedStreams === undefined) {\n\t\taddConvertedStreams(subprocess, options);\n\t} else {\n\t\tObject.assign(subprocess, convertedStreams);\n\t}\n\n\taddIpcMethods(subprocess, nodeChildProcess, options);\n\treturn subprocess;\n};\n\nconst getSubprocessProperties = (nodeChildProcess, all) => ({\n\tnodeChildProcess,\n\tpid: nodeChildProcess.pid,\n\tstdin: nodeChildProcess.stdin,\n\tstdout: nodeChildProcess.stdout,\n\tstderr: nodeChildProcess.stderr,\n\tstdio: nodeChildProcess.stdio,\n\tall,\n\tkill: nodeChildProcess.kill.bind(nodeChildProcess),\n});\n\n// Asynchronous logic, as opposed to the previous logic which can be run synchronously, i.e. can be returned to user right away\nconst handlePromise = async ({subprocess, kill, all: allStream, options, startTime, verboseInfo, fileDescriptors, originalStreams, command, escapedCommand, context, onInternalError, controller}) => {\n\tconst [\n\t\terrorInfo,\n\t\t[exitCode, signal],\n\t\tstdioResults,\n\t\tallResult,\n\t\tipcOutput,\n\t] = await waitForSubprocessResult({\n\t\tsubprocess,\n\t\tkill,\n\t\tall: allStream,\n\t\toptions,\n\t\tcontext,\n\t\tverboseInfo,\n\t\tfileDescriptors,\n\t\toriginalStreams,\n\t\tonInternalError,\n\t\tcontroller,\n\t});\n\tcontroller.abort();\n\tonInternalError.resolve();\n\n\tconst stdio = stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber));\n\tconst all = stripNewline(allResult, options, 'all');\n\tconst result = getAsyncResult({\n\t\terrorInfo,\n\t\texitCode,\n\t\tsignal,\n\t\tstdio,\n\t\tall,\n\t\tipcOutput,\n\t\tcontext,\n\t\toptions,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstartTime,\n\t});\n\treturn handleResult(result, verboseInfo, options);\n};\n\nconst getAsyncResult = ({errorInfo, exitCode, signal, stdio, all, ipcOutput, context, options, command, escapedCommand, startTime}) => 'error' in errorInfo\n\t? makeError({\n\t\terror: errorInfo.error,\n\t\tcommand,\n\t\tescapedCommand,\n\t\ttimedOut: context.terminationReason === 'timeout',\n\t\tisCanceled: context.terminationReason === 'cancel' || context.terminationReason === 'gracefulCancel',\n\t\tisGracefullyCanceled: context.terminationReason === 'gracefulCancel',\n\t\tisMaxBuffer: errorInfo.error instanceof MaxBufferError,\n\t\tisForcefullyTerminated: context.isForcefullyTerminated,\n\t\texitCode,\n\t\tsignal,\n\t\tstdio,\n\t\tall,\n\t\tipcOutput,\n\t\toptions,\n\t\tstartTime,\n\t\tisSync: false,\n\t})\n\t: makeSuccessResult({\n\t\tcommand,\n\t\tescapedCommand,\n\t\tstdio,\n\t\tall,\n\t\tipcOutput,\n\t\toptions,\n\t\tstartTime,\n\t});\n", "import process from 'node:process';\nimport {sendMessage} from './send.js';\nimport {getOneMessage} from './get-one.js';\nimport {getEachMessage} from './get-each.js';\nimport {getCancelSignal} from './graceful.js';\n\n// Add promise-based IPC methods in current process\nexport const addIpcMethods = (target, subprocess, {ipc}) => {\n\tObject.assign(target, getIpcMethods(subprocess, false, ipc, target));\n};\n\n// Get promise-based IPC in the subprocess\nexport const getIpcExport = () => {\n\tconst anyProcess = process;\n\tconst isSubprocess = true;\n\tconst isIpc = process.channel !== undefined;\n\n\treturn {\n\t\t...getIpcMethods(anyProcess, isSubprocess, isIpc),\n\t\tgetCancelSignal: getCancelSignal.bind(undefined, {\n\t\t\tanyProcess,\n\t\t\tchannel: anyProcess.channel,\n\t\t\tisSubprocess,\n\t\t\tipc: isIpc,\n\t\t}),\n\t};\n};\n\n// Retrieve the `ipc` shared by both the current process and the subprocess\nconst getIpcMethods = (anyProcess, isSubprocess, ipc, waitProcess = anyProcess) => ({\n\tsendMessage: sendMessage.bind(undefined, {\n\t\tanyProcess,\n\t\tchannel: anyProcess.channel,\n\t\tisSubprocess,\n\t\tipc,\n\t}),\n\tgetOneMessage: getOneMessage.bind(undefined, {\n\t\tanyProcess,\n\t\tchannel: anyProcess.channel,\n\t\tisSubprocess,\n\t\tipc,\n\t}),\n\tgetEachMessage: getEachMessage.bind(undefined, {\n\t\tanyProcess,\n\t\tchannel: anyProcess.channel,\n\t\tisSubprocess,\n\t\tipc,\n\t\twaitProcess,\n\t}),\n});\n", "import {once, on} from 'node:events';\nimport {\n\tvalidateIpcMethod,\n\tthrowOnEarlyDisconnect,\n\tdisconnect,\n\tgetStrictResponseError,\n} from './validation.js';\nimport {getIpcEmitter, isConnected} from './forward.js';\nimport {addReference, removeReference} from './reference.js';\n\nexport const internalGetOneMessageOptions = Symbol('internalGetOneMessageOptions');\n\n// Like `[sub]process.once('message')` but promise-based\nexport const getOneMessage = ({anyProcess, channel, isSubprocess, ipc}, options = {}) => {\n\tconst {reference = true, filter} = options;\n\tconst {signal} = options[internalGetOneMessageOptions] ?? {};\n\n\tvalidateIpcMethod({\n\t\tmethodName: 'getOneMessage',\n\t\tisSubprocess,\n\t\tipc,\n\t\tisConnected: isConnected(anyProcess),\n\t});\n\n\treturn getOneMessageAsync({\n\t\tanyProcess,\n\t\tchannel,\n\t\tisSubprocess,\n\t\tfilter,\n\t\treference,\n\t\tsignal,\n\t});\n};\n\nconst getOneMessageAsync = async ({anyProcess, channel, isSubprocess, filter, reference, signal}) => {\n\taddReference(channel, reference);\n\tconst ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);\n\tconst controller = new AbortController();\n\tstopOnAbort(signal, controller);\n\n\ttry {\n\t\treturn await Promise.race([\n\t\t\tgetMessage(ipcEmitter, filter, controller),\n\t\t\tthrowOnDisconnect(ipcEmitter, isSubprocess, controller),\n\t\t\tthrowOnStrictError(ipcEmitter, isSubprocess, controller),\n\t\t]);\n\t} catch (error) {\n\t\tdisconnect(anyProcess);\n\t\tthrow error;\n\t} finally {\n\t\tcontroller.abort();\n\t\tremoveReference(channel, reference);\n\t}\n};\n\nconst stopOnAbort = (signal, controller) => {\n\tif (signal === undefined) {\n\t\treturn;\n\t}\n\n\tif (signal.aborted) {\n\t\tcontroller.abort();\n\t\treturn;\n\t}\n\n\tsignal.addEventListener('abort', () => {\n\t\tcontroller.abort();\n\t}, {once: true, signal: controller.signal});\n};\n\nconst getMessage = async (ipcEmitter, filter, {signal}) => {\n\tif (filter === undefined) {\n\t\tconst [message] = await once(ipcEmitter, 'message', {signal});\n\t\treturn message;\n\t}\n\n\tfor await (const [message] of on(ipcEmitter, 'message', {signal})) {\n\t\tif (filter(message)) {\n\t\t\treturn message;\n\t\t}\n\t}\n};\n\nconst throwOnDisconnect = async (ipcEmitter, isSubprocess, {signal}) => {\n\tawait once(ipcEmitter, 'disconnect', {signal});\n\tthrowOnEarlyDisconnect(isSubprocess);\n};\n\nconst throwOnStrictError = async (ipcEmitter, isSubprocess, {signal}) => {\n\tconst [error] = await once(ipcEmitter, 'strict:error', {signal});\n\tthrow getStrictResponseError(error, isSubprocess);\n};\n", "import {once, on} from 'node:events';\nimport {validateIpcMethod, disconnect, getStrictResponseError} from './validation.js';\nimport {getIpcEmitter, isConnected} from './forward.js';\nimport {addReference, removeReference} from './reference.js';\n\nexport const internalGetEachMessageOptions = Symbol('internalGetEachMessageOptions');\n\n// Like `[sub]process.on('message')` but promise-based\nexport const getEachMessage = (subprocessInfo, options = {}) => {\n\tconst {reference = true} = options;\n\t// Internal callers can stop the IPC listener without exposing cancellation or pipe-awaiting options as public API.\n\tconst {signal, shouldAwait = !subprocessInfo.isSubprocess} = options[internalGetEachMessageOptions] ?? {};\n\n\treturn loopOnMessages({\n\t\t...subprocessInfo,\n\t\tshouldAwait,\n\t\treference,\n\t\tsignal,\n\t});\n};\n\n// Same but used internally\nexport const loopOnMessages = ({anyProcess, waitProcess = anyProcess, channel, isSubprocess, ipc, shouldAwait, reference, signal}) => {\n\tvalidateIpcMethod({\n\t\tmethodName: 'getEachMessage',\n\t\tisSubprocess,\n\t\tipc,\n\t\tisConnected: isConnected(anyProcess),\n\t});\n\n\taddReference(channel, reference);\n\tconst ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);\n\tconst controller = new AbortController();\n\tconst state = {};\n\tstopOnAbort(signal, controller);\n\tstopOnDisconnect(anyProcess, ipcEmitter, controller);\n\tabortOnStrictError({\n\t\tipcEmitter,\n\t\tisSubprocess,\n\t\tcontroller,\n\t\tstate,\n\t});\n\treturn iterateOnMessages({\n\t\tanyProcess,\n\t\twaitProcess,\n\t\tchannel,\n\t\tipcEmitter,\n\t\tisSubprocess,\n\t\tshouldAwait,\n\t\tcontroller,\n\t\tstate,\n\t\treference,\n\t});\n};\n\nconst stopOnAbort = (signal, controller) => {\n\tif (signal === undefined) {\n\t\treturn;\n\t}\n\n\tif (signal.aborted) {\n\t\tcontroller.abort();\n\t\treturn;\n\t}\n\n\t// Reuse the iterator controller for listener cleanup when iteration ends before the internal signal aborts.\n\tsignal.addEventListener('abort', () => {\n\t\tcontroller.abort();\n\t}, {once: true, signal: controller.signal});\n};\n\nconst stopOnDisconnect = async (anyProcess, ipcEmitter, controller) => {\n\ttry {\n\t\tawait once(ipcEmitter, 'disconnect', {signal: controller.signal});\n\t\tcontroller.abort();\n\t} catch {}\n};\n\nconst abortOnStrictError = async ({ipcEmitter, isSubprocess, controller, state}) => {\n\ttry {\n\t\tconst [error] = await once(ipcEmitter, 'strict:error', {signal: controller.signal});\n\t\tstate.error = getStrictResponseError(error, isSubprocess);\n\t\tcontroller.abort();\n\t} catch {}\n};\n\nconst iterateOnMessages = async function * ({anyProcess, waitProcess, channel, ipcEmitter, isSubprocess, shouldAwait, controller, state, reference}) {\n\ttry {\n\t\tfor await (const [message] of on(ipcEmitter, 'message', {signal: controller.signal})) {\n\t\t\tthrowIfStrictError(state);\n\t\t\tyield message;\n\t\t}\n\t} catch {\n\t\tthrowIfStrictError(state);\n\t} finally {\n\t\tcontroller.abort();\n\t\tremoveReference(channel, reference);\n\n\t\tif (!isSubprocess) {\n\t\t\tdisconnect(anyProcess);\n\t\t}\n\n\t\tif (shouldAwait) {\n\t\t\tawait waitProcess;\n\t\t}\n\t}\n};\n\nconst throwIfStrictError = ({error}) => {\n\tif (error) {\n\t\tthrow error;\n\t}\n};\n", "import {ChildProcess} from 'node:child_process';\nimport {\n\tPassThrough,\n\tReadable,\n\tWritable,\n\tDuplex,\n} from 'node:stream';\nimport {cleanupCustomStreams} from '../stdio/handle.js';\nimport {makeEarlyError} from './result.js';\nimport {handleResult} from './reject.js';\n\n// When the subprocess fails to spawn.\n// We ensure the returned error is always both a promise and a subprocess.\nexport const handleEarlyError = ({error, command, escapedCommand, fileDescriptors, options, startTime, verboseInfo}) => {\n\tcleanupCustomStreams(fileDescriptors);\n\n\tconst subprocess = new ChildProcess();\n\tconst all = createDummyStreams(subprocess, fileDescriptors);\n\n\tconst earlyError = makeEarlyError({\n\t\terror,\n\t\tcommand,\n\t\tescapedCommand,\n\t\tfileDescriptors,\n\t\toptions,\n\t\tstartTime,\n\t\tisSync: false,\n\t});\n\tconst promise = handleDummyPromise(earlyError, verboseInfo, options);\n\treturn {\n\t\tsubprocess,\n\t\tpromise,\n\t\tall: options.all ? all : undefined,\n\t\tconvertedStreams: {\n\t\t\treadable,\n\t\t\twritable,\n\t\t\tduplex,\n\t\t\treadableStream,\n\t\t\twritableStream,\n\t\t\ttransformStream,\n\t\t\titerable,\n\t\t\t[Symbol.asyncIterator]: iterable,\n\t\t},\n\t};\n};\n\nconst createDummyStreams = (subprocess, fileDescriptors) => {\n\tconst stdin = createDummyStream();\n\tconst stdout = createDummyStream();\n\tconst stderr = createDummyStream();\n\tconst extraStdio = Array.from({length: fileDescriptors.length - 3}, createDummyStream);\n\tconst all = createDummyStream();\n\tconst stdio = [stdin, stdout, stderr, ...extraStdio];\n\tObject.assign(subprocess, {\n\t\tstdin,\n\t\tstdout,\n\t\tstderr,\n\t\tstdio,\n\t});\n\treturn all;\n};\n\nconst createDummyStream = () => {\n\tconst stream = new PassThrough();\n\tstream.end();\n\treturn stream;\n};\n\nconst readable = () => new Readable({read() {}});\nconst writable = () => new Writable({write() {}});\nconst duplex = () => new Duplex({read() {}, write() {}});\nconst readableStream = () => Readable.toWeb(readable());\nconst writableStream = () => Writable.toWeb(writable());\nconst transformStream = () => Duplex.toWeb(duplex());\nconst iterable = async function * () {};\n\nconst handleDummyPromise = async (error, verboseInfo, options) => handleResult(error, verboseInfo, options);\n", "import {createReadStream, createWriteStream} from 'node:fs';\nimport {Buffer} from 'node:buffer';\nimport {Readable, Writable, Duplex} from 'node:stream';\nimport {generatorToStream} from '../transform/generator.js';\nimport {handleStdio} from './handle.js';\nimport {TYPE_TO_MESSAGE} from './type.js';\n\n// Handle `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, before spawning, in async mode\nexport const handleStdioAsync = (options, verboseInfo) => handleStdio(addPropertiesAsync, options, verboseInfo, false);\n\nconst forbiddenIfAsync = ({type, optionName}) => {\n\tthrow new TypeError(`The \\`${optionName}\\` option cannot be ${TYPE_TO_MESSAGE[type]}.`);\n};\n\n// Create streams used internally for piping when using specific values for the `std*` options, in async mode.\n// For example, `stdout: {file}` creates a file stream, which is piped from/to.\nconst addProperties = {\n\tfileNumber: forbiddenIfAsync,\n\tgenerator: generatorToStream,\n\tasyncGenerator: generatorToStream,\n\tnodeStream: ({value}) => ({stream: value}),\n\twebTransform({value: {transform, writableObjectMode, readableObjectMode}}) {\n\t\tconst objectMode = writableObjectMode || readableObjectMode;\n\t\tconst stream = Duplex.fromWeb(transform, {objectMode});\n\t\treturn {stream};\n\t},\n\tduplex: ({value: {transform}}) => ({stream: transform}),\n\tnative() {},\n};\n\nconst addPropertiesAsync = {\n\tinput: {\n\t\t...addProperties,\n\t\tfileUrl: ({value}) => ({stream: createReadStream(value)}),\n\t\tfilePath: ({value: {file}}) => ({stream: createReadStream(file)}),\n\t\twebStream: ({value}) => ({stream: Readable.fromWeb(value)}),\n\t\titerable: ({value}) => ({stream: Readable.from(value)}),\n\t\tasyncIterable: ({value}) => ({stream: Readable.from(value)}),\n\t\tstring: ({value}) => ({stream: Readable.from(value)}),\n\t\tuint8Array: ({value}) => ({stream: Readable.from(Buffer.from(value))}),\n\t},\n\toutput: {\n\t\t...addProperties,\n\t\tfileUrl: ({value}) => ({stream: createWriteStream(value)}),\n\t\tfilePath: ({value: {file, append}}) => ({stream: createWriteStream(file, append ? {flags: 'a'} : {})}),\n\t\twebStream: ({value}) => ({stream: Writable.fromWeb(value)}),\n\t\titerable: forbiddenIfAsync,\n\t\tasyncIterable: forbiddenIfAsync,\n\t\tstring: forbiddenIfAsync,\n\t\tuint8Array: forbiddenIfAsync,\n\t},\n};\n", "import {on, once} from 'node:events';\nimport {PassThrough as PassThroughStream, getDefaultHighWaterMark} from 'node:stream';\nimport {finished} from 'node:stream/promises';\n\nexport default function mergeStreams(streams) {\n\tif (!Array.isArray(streams)) {\n\t\tthrow new TypeError(`Expected an array, got \\`${typeof streams}\\`.`);\n\t}\n\n\tfor (const stream of streams) {\n\t\tvalidateStream(stream);\n\t}\n\n\tconst objectMode = streams.some(({readableObjectMode}) => readableObjectMode);\n\tconst highWaterMark = getHighWaterMark(streams, objectMode);\n\tconst passThroughStream = new MergedStream({\n\t\tobjectMode,\n\t\twritableHighWaterMark: highWaterMark,\n\t\treadableHighWaterMark: highWaterMark,\n\t});\n\n\tfor (const stream of streams) {\n\t\tpassThroughStream.add(stream);\n\t}\n\n\treturn passThroughStream;\n}\n\nconst getHighWaterMark = (streams, objectMode) => {\n\tif (streams.length === 0) {\n\t\treturn getDefaultHighWaterMark(objectMode);\n\t}\n\n\tconst highWaterMarks = streams\n\t\t.filter(({readableObjectMode}) => readableObjectMode === objectMode)\n\t\t.map(({readableHighWaterMark}) => readableHighWaterMark);\n\treturn Math.max(...highWaterMarks);\n};\n\nclass MergedStream extends PassThroughStream {\n\t#streams = new Set([]);\n\t#ended = new Set([]);\n\t#aborted = new Set([]);\n\t#onFinished;\n\t#unpipeEvent = Symbol('unpipe');\n\t#streamPromises = new WeakMap();\n\n\tadd(stream) {\n\t\tvalidateStream(stream);\n\n\t\tif (this.#streams.has(stream)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#streams.add(stream);\n\n\t\tthis.#onFinished ??= onMergedStreamFinished(this, this.#streams, this.#unpipeEvent);\n\t\tconst streamPromise = endWhenStreamsDone({\n\t\t\tpassThroughStream: this,\n\t\t\tstream,\n\t\t\tstreams: this.#streams,\n\t\t\tended: this.#ended,\n\t\t\taborted: this.#aborted,\n\t\t\tonFinished: this.#onFinished,\n\t\t\tunpipeEvent: this.#unpipeEvent,\n\t\t});\n\t\tthis.#streamPromises.set(stream, streamPromise);\n\n\t\tstream.pipe(this, {end: false});\n\t}\n\n\tasync remove(stream) {\n\t\tvalidateStream(stream);\n\n\t\tif (!this.#streams.has(stream)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst streamPromise = this.#streamPromises.get(stream);\n\t\tif (streamPromise === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.#streamPromises.delete(stream);\n\n\t\tstream.unpipe(this);\n\t\tawait streamPromise;\n\t\treturn true;\n\t}\n}\n\nconst onMergedStreamFinished = async (passThroughStream, streams, unpipeEvent) => {\n\tupdateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);\n\tconst controller = new AbortController();\n\n\ttry {\n\t\tawait Promise.race([\n\t\t\tonMergedStreamEnd(passThroughStream, controller),\n\t\t\tonInputStreamsUnpipe(passThroughStream, streams, unpipeEvent, controller),\n\t\t]);\n\t} finally {\n\t\tcontroller.abort();\n\t\tupdateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);\n\t}\n};\n\nconst onMergedStreamEnd = async (passThroughStream, {signal}) => {\n\ttry {\n\t\tawait finished(passThroughStream, {signal, cleanup: true});\n\t} catch (error) {\n\t\terrorOrAbortStream(passThroughStream, error);\n\t\tthrow error;\n\t}\n};\n\nconst onInputStreamsUnpipe = async (passThroughStream, streams, unpipeEvent, {signal}) => {\n\tfor await (const [unpipedStream] of on(passThroughStream, 'unpipe', {signal})) {\n\t\tif (streams.has(unpipedStream)) {\n\t\t\tunpipedStream.emit(unpipeEvent);\n\t\t}\n\t}\n};\n\nconst validateStream = stream => {\n\tif (typeof stream?.pipe !== 'function') {\n\t\tthrow new TypeError(`Expected a readable stream, got: \\`${typeof stream}\\`.`);\n\t}\n};\n\nconst endWhenStreamsDone = async ({passThroughStream, stream, streams, ended, aborted, onFinished, unpipeEvent}) => {\n\tupdateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);\n\tconst controller = new AbortController();\n\n\ttry {\n\t\tawait Promise.race([\n\t\t\tafterMergedStreamFinished(onFinished, stream, controller),\n\t\t\tonInputStreamEnd({\n\t\t\t\tpassThroughStream,\n\t\t\t\tstream,\n\t\t\t\tstreams,\n\t\t\t\tended,\n\t\t\t\taborted,\n\t\t\t\tcontroller,\n\t\t\t}),\n\t\t\tonInputStreamUnpipe({\n\t\t\t\tstream,\n\t\t\t\tstreams,\n\t\t\t\tended,\n\t\t\t\taborted,\n\t\t\t\tunpipeEvent,\n\t\t\t\tcontroller,\n\t\t\t}),\n\t\t]);\n\t} finally {\n\t\tcontroller.abort();\n\t\tupdateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);\n\t}\n\n\tif (streams.size > 0 && streams.size === ended.size + aborted.size) {\n\t\tif (ended.size === 0 && aborted.size > 0) {\n\t\t\tabortStream(passThroughStream);\n\t\t} else {\n\t\t\tendStream(passThroughStream);\n\t\t}\n\t}\n};\n\nconst afterMergedStreamFinished = async (onFinished, stream, {signal}) => {\n\ttry {\n\t\tawait onFinished;\n\t\tif (!signal.aborted) {\n\t\t\tabortStream(stream);\n\t\t}\n\t} catch (error) {\n\t\tif (!signal.aborted) {\n\t\t\terrorOrAbortStream(stream, error);\n\t\t}\n\t}\n};\n\nconst onInputStreamEnd = async ({passThroughStream, stream, streams, ended, aborted, controller: {signal}}) => {\n\ttry {\n\t\tawait finished(stream, {\n\t\t\tsignal,\n\t\t\tcleanup: true,\n\t\t\treadable: true,\n\t\t\twritable: false,\n\t\t});\n\t\tif (streams.has(stream)) {\n\t\t\tended.add(stream);\n\t\t}\n\t} catch (error) {\n\t\tif (signal.aborted || !streams.has(stream)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isAbortError(error)) {\n\t\t\taborted.add(stream);\n\t\t} else {\n\t\t\terrorStream(passThroughStream, error);\n\t\t}\n\t}\n};\n\nconst onInputStreamUnpipe = async ({stream, streams, ended, aborted, unpipeEvent, controller: {signal}}) => {\n\tawait once(stream, unpipeEvent, {signal});\n\n\tif (!stream.readable) {\n\t\treturn once(signal, 'abort', {signal});\n\t}\n\n\tstreams.delete(stream);\n\tended.delete(stream);\n\taborted.delete(stream);\n};\n\nconst endStream = stream => {\n\tif (stream.writable) {\n\t\tstream.end();\n\t}\n};\n\nconst errorOrAbortStream = (stream, error) => {\n\tif (isAbortError(error)) {\n\t\tabortStream(stream);\n\t} else {\n\t\terrorStream(stream, error);\n\t}\n};\n\n// This is the error thrown by `finished()` on `stream.destroy()`\nconst isAbortError = error => error?.code === 'ERR_STREAM_PREMATURE_CLOSE';\n\nconst abortStream = stream => {\n\tif (stream.readable || stream.writable) {\n\t\tstream.destroy();\n\t}\n};\n\n// `stream.destroy(error)` crashes the process with `uncaughtException` if no `error` event listener exists on `stream`.\n// We take care of error handling on user behalf, so we do not want this to happen.\nconst errorStream = (stream, error) => {\n\tif (!stream.destroyed) {\n\t\tstream.once('error', noop);\n\t\tstream.destroy(error);\n\t}\n};\n\nconst noop = () => {};\n\nconst updateMaxListeners = (passThroughStream, increment) => {\n\tconst maxListeners = passThroughStream.getMaxListeners();\n\tif (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {\n\t\tpassThroughStream.setMaxListeners(maxListeners + increment);\n\t}\n};\n\n// Number of times `passThroughStream.on()` is called regardless of streams:\n// - once due to `finished(passThroughStream)`\n// - once due to `on(passThroughStream)`\nconst PASSTHROUGH_LISTENERS_COUNT = 2;\n\n// Number of times `passThroughStream.on()` is called per stream:\n// - once due to `stream.pipe(passThroughStream)`\nconst PASSTHROUGH_LISTENERS_PER_STREAM = 1;\n", "import {finished} from 'node:stream/promises';\nimport {isStandardStream} from '../utils/standard-stream.js';\n\n// Similar to `Stream.pipeline(source, destination)`, but does not destroy standard streams\nexport const pipeStreams = (source, destination) => {\n\tsource.pipe(destination);\n\tonSourceFinish(source, destination);\n\tonDestinationFinish(source, destination);\n};\n\n// `source.pipe(destination)` makes `destination` end when `source` ends.\n// But it does not propagate aborts or errors. This function does it.\nconst onSourceFinish = async (source, destination) => {\n\tif (isStandardStream(source) || isStandardStream(destination)) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait finished(source, {cleanup: true, readable: true, writable: false});\n\t} catch {}\n\n\tendDestinationStream(destination);\n};\n\nexport const endDestinationStream = destination => {\n\tif (destination.writable) {\n\t\tdestination.end();\n\t}\n};\n\n// We do the same thing in the other direction as well.\nconst onDestinationFinish = async (source, destination) => {\n\tif (isStandardStream(source) || isStandardStream(destination)) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait finished(destination, {cleanup: true, readable: false, writable: true});\n\t} catch {}\n\n\tabortSourceStream(source);\n};\n\nexport const abortSourceStream = source => {\n\tif (source.readable) {\n\t\tsource.destroy();\n\t}\n};\n", "import mergeStreams from '@sindresorhus/merge-streams';\nimport {isStandardStream} from '../utils/standard-stream.js';\nimport {incrementMaxListeners} from '../utils/max-listeners.js';\nimport {TRANSFORM_TYPES} from '../stdio/type.js';\nimport {pipeStreams} from './pipeline.js';\n\n// Handle `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, after spawning, in async mode\n// When multiple input streams are used, we merge them to ensure the output stream ends only once each input stream has ended\nexport const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {\n\tconst pipeGroups = new Map();\n\n\tfor (const [fdNumber, {stdioItems, direction}] of Object.entries(fileDescriptors)) {\n\t\tconst transformItems = stdioItems.filter(({type}) => TRANSFORM_TYPES.has(type));\n\t\tfor (const {stream} of transformItems) {\n\t\t\tpipeTransform(subprocess, stream, direction, fdNumber);\n\t\t}\n\n\t\tconst nonTransformItems = stdioItems.filter(({type}) => !TRANSFORM_TYPES.has(type));\n\t\tfor (const {stream} of nonTransformItems) {\n\t\t\tpipeStdioItem({\n\t\t\t\tsubprocess,\n\t\t\t\tstream,\n\t\t\t\tdirection,\n\t\t\t\tfdNumber,\n\t\t\t\tpipeGroups,\n\t\t\t\tcontroller,\n\t\t\t});\n\t\t}\n\t}\n\n\tfor (const [outputStream, inputStreams] of pipeGroups) {\n\t\tconst inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);\n\t\tpipeStreams(inputStream, outputStream);\n\t}\n};\n\n// When using transforms, `subprocess.stdin|stdout|stderr|stdio` is directly mutated\nconst pipeTransform = (subprocess, stream, direction, fdNumber) => {\n\tif (direction === 'output') {\n\t\tpipeStreams(subprocess.stdio[fdNumber], stream);\n\t} else {\n\t\tpipeStreams(stream, subprocess.stdio[fdNumber]);\n\t}\n\n\tconst streamProperty = SUBPROCESS_STREAM_PROPERTIES[fdNumber];\n\tif (streamProperty !== undefined) {\n\t\tsubprocess[streamProperty] = stream;\n\t}\n\n\tsubprocess.stdio[fdNumber] = stream;\n};\n\nconst SUBPROCESS_STREAM_PROPERTIES = ['stdin', 'stdout', 'stderr'];\n\n// Most `std*` option values involve piping `subprocess.std*` to a stream.\n// The stream is either passed by the user or created internally.\nconst pipeStdioItem = ({subprocess, stream, direction, fdNumber, pipeGroups, controller}) => {\n\tif (stream === undefined) {\n\t\treturn;\n\t}\n\n\tsetStandardStreamMaxListeners(stream, controller);\n\n\tconst [inputStream, outputStream] = direction === 'output'\n\t\t? [stream, subprocess.stdio[fdNumber]]\n\t\t: [subprocess.stdio[fdNumber], stream];\n\tconst outputStreams = pipeGroups.get(inputStream) ?? [];\n\tpipeGroups.set(inputStream, [...outputStreams, outputStream]);\n};\n\n// Multiple subprocesses might be piping from/to `process.std*` at the same time.\n// This is not necessarily an error and should not print a `maxListeners` warning.\nconst setStandardStreamMaxListeners = (stream, {signal}) => {\n\tif (isStandardStream(stream)) {\n\t\tincrementMaxListeners(stream, MAX_LISTENERS_INCREMENT, signal);\n\t}\n};\n\n// `source.pipe(destination)` adds at most 1 listener for each event.\n// If `stdin` option is an array, the values might be combined with `merge-streams`.\n// That library also listens for `source` end, which adds 1 more listener.\nconst MAX_LISTENERS_INCREMENT = 2;\n", "import process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport path from 'node:path/win32';\n\nconst isWindows = process.platform === 'win32';\n\n// The `killDescendants` option terminates the whole process tree, not just the direct child.\n// On Unix, this requires spawning the subprocess in its own process group, so we override the\n// `detached` argument passed to `child_process.spawn()`.\n// This is kept separate from the user-facing `detached` option, which must keep its own value,\n// so the `cleanup` behavior is not affected.\nexport const getSpawnOptions = options => options.killDescendants && !isWindows\n\t? {...options, detached: true}\n\t: options;\n\n// Returns the low-level function used to send a signal to the subprocess.\n// With the `killDescendants` option, the signal is sent to the whole process tree.\nexport const getKillFunction = (subprocess, {killDescendants}) => {\n\tif (!killDescendants) {\n\t\treturn subprocess.kill.bind(subprocess);\n\t}\n\n\tconst killDescendantsFunction = isWindows ? killDescendantsWindows : killDescendantsUnix;\n\treturn killDescendantsFunction.bind(undefined, subprocess);\n};\n\n// On Unix, the subprocess is its own process group leader (its PGID equals its PID), since it\n// was spawned with `detached: true`. Sending the signal to `-pid` targets the whole group.\nconst killDescendantsUnix = (subprocess, signal) => {\n\tif (subprocess.pid === undefined) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn process.kill(-subprocess.pid, signal);\n\t} catch {\n\t\t// The process group might already be gone, or signaling it might not be permitted, so we\n\t\t// fall back to the direct child. Like `ChildProcess.kill()`, this returns `false` instead of throwing.\n\t\treturn subprocess.kill(signal);\n\t}\n};\n\n// Windows has no process groups. Instead, `taskkill /T` recursively terminates the process tree.\n// It must run while the tree is still intact, so direct subprocess termination is only used as a\n// fallback: killing the direct subprocess first would orphan its descendants before `taskkill` could enumerate them.\n// If `taskkill` is unavailable or fails, the fallback only terminates the direct subprocess.\n// `taskkill` ignores the signal (`/F` terminates the tree).\nconst killDescendantsWindows = (subprocess, signal) => {\n\tif (subprocess.pid === undefined) {\n\t\treturn false;\n\t}\n\n\tconst taskkillFile = getTaskkillFile();\n\tif (taskkillFile === undefined) {\n\t\treturn subprocess.kill(signal);\n\t}\n\n\t// This is best-effort: if `taskkill` fails, still try the direct subprocess.\n\texecFile(taskkillFile, ['/pid', `${subprocess.pid}`, '/T', '/F'], error => {\n\t\tif (error) {\n\t\t\tsubprocess.kill(signal);\n\t\t}\n\t});\n\treturn true;\n};\n\nexport const getTaskkillFile = () => {\n\tconst windowsDirectory = [process.env.SystemRoot, process.env.windir]\n\t\t.find(directory => directory && isWindowsDriveAbsolutePath(directory));\n\n\treturn windowsDirectory === undefined\n\t\t? undefined\n\t\t: path.join(windowsDirectory, 'System32', 'taskkill.exe');\n};\n\nconst isWindowsDriveAbsolutePath = directory => {\n\tconst {root} = path.parse(directory);\n\treturn /^[a-z]:[/\\\\]/i.test(root);\n};\n", "import {addAbortListener} from 'node:events';\nimport {onExit} from 'signal-exit';\n\n// If the `cleanup` option is used, call `subprocess.kill()` when the parent process exits\nexport const cleanupOnExit = (kill, {cleanup, detached}, {signal}) => {\n\tif (!cleanup || detached) {\n\t\treturn;\n\t}\n\n\tconst removeExitHandler = onExit(() => {\n\t\tkill();\n\t});\n\taddAbortListener(signal, () => {\n\t\tremoveExitHandler();\n\t});\n};\n", "/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals: NodeJS.Signals[] = []\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM')\n\nif (process.platform !== 'win32') {\n signals.push(\n 'SIGALRM',\n 'SIGABRT',\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')\n}\n", "// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js'\nexport { signals }\n\n// just a loosened process type so we can do some evil things\ntype ProcessRE = NodeJS.Process & {\n reallyExit: (code?: number | undefined | null) => any\n emit: (ev: string, ...a: any[]) => any\n}\n\nconst processOk = (process: any): process is ProcessRE =>\n !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n\nconst kExitEmitter = Symbol.for('signal-exit emitter')\nconst global: typeof globalThis & { [kExitEmitter]?: Emitter } = globalThis\nconst ObjectDefineProperty = Object.defineProperty.bind(Object)\n\n/**\n * A function that takes an exit code and signal as arguments\n *\n * In the case of signal exits *only*, a return value of true\n * will indicate that the signal is being handled, and we should\n * not synthetically exit with the signal we received. Regardless\n * of the handler return value, the handler is unloaded when an\n * otherwise fatal signal is received, so you get exactly 1 shot\n * at it, unless you add another onExit handler at that point.\n *\n * In the case of numeric code exits, we may already have committed\n * to exiting the process, for example via a fatal exception or\n * unhandled promise rejection, so it is impossible to stop safely.\n */\nexport type Handler = (\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n) => true | void\ntype ExitEvent = 'afterExit' | 'exit'\ntype Emitted = { [k in ExitEvent]: boolean }\ntype Listeners = { [k in ExitEvent]: Handler[] }\n\n// teeny special purpose ee\nclass Emitter {\n emitted: Emitted = {\n afterExit: false,\n exit: false,\n }\n\n listeners: Listeners = {\n afterExit: [],\n exit: [],\n }\n\n count: number = 0\n id: number = Math.random()\n\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter]\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n }\n\n on(ev: ExitEvent, fn: Handler) {\n this.listeners[ev].push(fn)\n }\n\n removeListener(ev: ExitEvent, fn: Handler) {\n const list = this.listeners[ev]\n const i = list.indexOf(fn)\n /* c8 ignore start */\n if (i === -1) {\n return\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0\n } else {\n list.splice(i, 1)\n }\n }\n\n emit(\n ev: ExitEvent,\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n ): boolean {\n if (this.emitted[ev]) {\n return false\n }\n this.emitted[ev] = true\n let ret: boolean = false\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret\n }\n return ret\n }\n}\n\nabstract class SignalExitBase {\n abstract onExit(cb: Handler, opts?: { alwaysLast?: boolean }): () => void\n abstract load(): void\n abstract unload(): void\n}\n\nconst signalExitWrap = <T extends SignalExitBase>(handler: T) => {\n return {\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n return handler.onExit(cb, opts)\n },\n load() {\n return handler.load()\n },\n unload() {\n return handler.unload()\n },\n }\n}\n\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => {}\n }\n load() {}\n unload() {}\n}\n\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'\n /* c8 ignore stop */\n #emitter = new Emitter()\n #process: ProcessRE\n #originalProcessEmit: ProcessRE['emit']\n #originalProcessReallyExit: ProcessRE['reallyExit']\n\n #sigListeners: { [k in NodeJS.Signals]?: () => void } = {}\n #loaded: boolean = false\n\n constructor(process: ProcessRE) {\n super()\n this.#process = process\n // { <signal>: <listener fn>, ... }\n this.#sigListeners = {}\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig)\n let { count } = this.#emitter\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process as unknown as {\n __signal_exit_emitter__?: { count: number }\n }\n if (\n typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number'\n ) {\n count += p.__signal_exit_emitter__.count\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload()\n const ret = this.#emitter.emit('exit', null, sig)\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig\n if (!ret) process.kill(process.pid, s)\n /* c8 ignore stop */\n }\n }\n }\n\n this.#originalProcessReallyExit = process.reallyExit\n this.#originalProcessEmit = process.emit\n }\n\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => {}\n }\n /* c8 ignore stop */\n\n if (this.#loaded === false) {\n this.load()\n }\n\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit'\n this.#emitter.on(ev, cb)\n return () => {\n this.#emitter.removeListener(ev, cb)\n if (\n this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0\n ) {\n this.unload()\n }\n }\n }\n\n load() {\n if (this.#loaded) {\n return\n }\n this.#loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1\n\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig]\n if (fn) this.#process.on(sig, fn)\n } catch (_) {}\n }\n\n this.#process.emit = (ev: string, ...a: any[]) => {\n return this.#processEmit(ev, ...a)\n }\n this.#process.reallyExit = (code?: number | null | undefined) => {\n return this.#processReallyExit(code)\n }\n }\n\n unload() {\n if (!this.#loaded) {\n return\n }\n this.#loaded = false\n\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig]\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig)\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n })\n this.#process.emit = this.#originalProcessEmit\n this.#process.reallyExit = this.#originalProcessReallyExit\n this.#emitter.count -= 1\n }\n\n #processReallyExit(code?: number | null | undefined) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0\n }\n this.#process.exitCode = code || 0\n /* c8 ignore stop */\n\n this.#emitter.emit('exit', this.#process.exitCode, null)\n return this.#originalProcessReallyExit.call(\n this.#process,\n this.#process.exitCode\n )\n }\n\n #processEmit(ev: string, ...args: any[]): any {\n const og = this.#originalProcessEmit\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0]\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args)\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null)\n /* c8 ignore stop */\n return ret\n } else {\n return og.call(this.#process, ev, ...args)\n }\n }\n}\n\nconst process = globalThis.process\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const {\n /**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\n onExit,\n\n /**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n load,\n\n /**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n unload,\n} = signalExitWrap(\n processOk(process) ? new SignalExit(process) : new SignalExitFallback()\n)\n", "import {createDeferred} from '../utils/deferred.js';\n\n// When using multiple `.readable()`/`.writable()`/`.duplex()`, `final` and `destroy` should wait for other streams\nexport const initializeConcurrentStreams = () => ({\n\treadableDestroy: new WeakMap(),\n\twritableFinal: new WeakMap(),\n\twritableDestroy: new WeakMap(),\n});\n\n// Each file descriptor + `waitName` has its own array of promises.\n// Each promise is a single `.readable()`/`.writable()`/`.duplex()` call.\nexport const addConcurrentStream = (concurrentStreams, stream, waitName) => {\n\tconst weakMap = concurrentStreams[waitName];\n\tif (!weakMap.has(stream)) {\n\t\tweakMap.set(stream, []);\n\t}\n\n\tconst promises = weakMap.get(stream);\n\tconst promise = createDeferred();\n\tpromises.push(promise);\n\tconst resolve = promise.resolve.bind(promise);\n\treturn {resolve, promises};\n};\n\n// Wait for other streams, but stop waiting when subprocess ends\nexport const waitForConcurrentStreams = async ({resolve, promises}, subprocess) => {\n\tresolve();\n\tconst [isSubprocessExit] = await Promise.race([\n\t\tPromise.allSettled([true, subprocess]),\n\t\tPromise.all([false, ...promises]),\n\t]);\n\treturn !isSubprocessExit;\n};\n", "import {on} from 'node:events';\nimport {getDefaultHighWaterMark} from 'node:stream';\nimport {getEncodingTransformGenerator} from '../transform/encoding-transform.js';\nimport {getSplitLinesGenerator} from '../transform/split.js';\nimport {transformChunkSync, finalChunksSync} from '../transform/run-sync.js';\n\n// Iterate over lines of `subprocess.stdout`, used by `subprocess.readable|duplex|iterable()`\nexport const iterateOnSubprocessStream = ({subprocessStdout, subprocess, binary, shouldEncode, encoding, preserveNewlines}) => {\n\tconst controller = new AbortController();\n\tstopReadingOnExit(subprocess, controller);\n\treturn iterateOnStream({\n\t\tstream: subprocessStdout,\n\t\tcontroller,\n\t\tbinary,\n\t\tshouldEncode: !subprocessStdout.readableObjectMode && shouldEncode,\n\t\tencoding,\n\t\tshouldSplit: !subprocessStdout.readableObjectMode,\n\t\tpreserveNewlines,\n\t});\n};\n\nconst stopReadingOnExit = async (subprocess, controller) => {\n\ttry {\n\t\tawait subprocess;\n\t} catch {} finally {\n\t\tcontroller.abort();\n\t}\n};\n\n// Iterate over lines of `subprocess.stdout`, used by `result.stdout` and the `verbose: 'full'` option.\n// Applies the `lines` and `encoding` options.\nexport const iterateForResult = ({stream, onStreamEnd, lines, encoding, stripFinalNewline, allMixed}) => {\n\tconst controller = new AbortController();\n\tstopReadingOnStreamEnd(onStreamEnd, controller, stream);\n\tconst objectMode = stream.readableObjectMode && !allMixed;\n\treturn iterateOnStream({\n\t\tstream,\n\t\tcontroller,\n\t\tbinary: encoding === 'buffer',\n\t\tshouldEncode: !objectMode,\n\t\tencoding,\n\t\tshouldSplit: !objectMode && lines,\n\t\tpreserveNewlines: !stripFinalNewline,\n\t});\n};\n\nconst stopReadingOnStreamEnd = async (onStreamEnd, controller, stream) => {\n\ttry {\n\t\tawait onStreamEnd;\n\t} catch {\n\t\tstream.destroy();\n\t} finally {\n\t\tcontroller.abort();\n\t}\n};\n\nconst iterateOnStream = ({stream, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines}) => {\n\tconst onStdoutChunk = on(stream, 'data', {\n\t\tsignal: controller.signal,\n\t\thighWaterMark: HIGH_WATER_MARK,\n\t\t// Backward compatibility with older name for this option\n\t\t// See https://github.com/nodejs/node/pull/52080#discussion_r1525227861\n\t\t// @todo Remove after removing support for Node 21\n\t\thighWatermark: HIGH_WATER_MARK,\n\t});\n\treturn iterateOnData({\n\t\tonStdoutChunk,\n\t\tcontroller,\n\t\tbinary,\n\t\tshouldEncode,\n\t\tencoding,\n\t\tshouldSplit,\n\t\tpreserveNewlines,\n\t});\n};\n\nexport const DEFAULT_OBJECT_HIGH_WATER_MARK = getDefaultHighWaterMark(true);\n\n// The `highWaterMark` of `events.on()` is measured in number of events, not in bytes.\n// Not knowing the average amount of bytes per `data` event, we use the same heuristic as streams in objectMode, since they have the same issue.\n// Therefore, we use the value of `getDefaultHighWaterMark(true)`.\n// Note: this option does not exist on Node 18, but this is ok since the logic works without it. It just consumes more memory.\nconst HIGH_WATER_MARK = DEFAULT_OBJECT_HIGH_WATER_MARK;\n\nconst iterateOnData = async function * ({onStdoutChunk, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines}) {\n\tconst generators = getGenerators({\n\t\tbinary,\n\t\tshouldEncode,\n\t\tencoding,\n\t\tshouldSplit,\n\t\tpreserveNewlines,\n\t});\n\n\ttry {\n\t\tfor await (const [chunk] of onStdoutChunk) {\n\t\t\tyield * transformChunkSync(chunk, generators, 0);\n\t\t}\n\t} catch (error) {\n\t\tif (!controller.signal.aborted) {\n\t\t\tthrow error;\n\t\t}\n\t} finally {\n\t\tyield * finalChunksSync(generators);\n\t}\n};\n\nconst getGenerators = ({binary, shouldEncode, encoding, shouldSplit, preserveNewlines}) => [\n\tgetEncodingTransformGenerator(binary, encoding, !shouldEncode),\n\tgetSplitLinesGenerator(binary, preserveNewlines, !shouldSplit, {}),\n].filter(Boolean);\n", "import {BINARY_ENCODINGS} from '../arguments/encoding-option.js';\nimport {getFromStream} from '../arguments/fd-options.js';\nimport {iterateOnSubprocessStream} from '../io/iterate.js';\n\n// Convert the subprocess to an async iterable\nexport const createIterable = (subprocess, encoding, {\n\tfrom,\n\tbinary: binaryOption = false,\n\tpreserveNewlines = false,\n} = {}) => {\n\tconst binary = binaryOption || BINARY_ENCODINGS.has(encoding);\n\tconst subprocessStdout = getFromStream(subprocess, from);\n\tconst onStdoutData = iterateOnSubprocessStream({\n\t\tsubprocessStdout,\n\t\tsubprocess,\n\t\tbinary,\n\t\tshouldEncode: true,\n\t\tencoding,\n\t\tpreserveNewlines,\n\t});\n\treturn iterateOnStdoutData(onStdoutData, subprocessStdout, subprocess);\n};\n\nconst iterateOnStdoutData = async function * (onStdoutData, subprocessStdout, subprocess) {\n\ttry {\n\t\tyield * onStdoutData;\n\t} finally {\n\t\tif (subprocessStdout.readable) {\n\t\t\tsubprocessStdout.destroy();\n\t\t}\n\n\t\tawait subprocess;\n\t}\n};\n", "import {Readable} from 'node:stream';\nimport {callbackify} from 'node:util';\nimport {BINARY_ENCODINGS} from '../arguments/encoding-option.js';\nimport {getFromStream} from '../arguments/fd-options.js';\nimport {iterateOnSubprocessStream, DEFAULT_OBJECT_HIGH_WATER_MARK} from '../io/iterate.js';\nimport {createDeferred} from '../utils/deferred.js';\nimport {addConcurrentStream, waitForConcurrentStreams} from './concurrent.js';\nimport {\n\tsafeWaitForSubprocessStdin,\n\twaitForSubprocessStdout,\n\twaitForSubprocess,\n\tdestroyOtherStream,\n} from './shared.js';\n\n// Create a `Readable` stream that forwards from `stdout` and awaits the subprocess\nexport const createReadable = ({subprocess, concurrentStreams, encoding}, {from, binary: binaryOption = true, preserveNewlines = true} = {}) => {\n\tconst binary = binaryOption || BINARY_ENCODINGS.has(encoding);\n\tconst {subprocessStdout, waitReadableDestroy} = getSubprocessStdout(subprocess, from, concurrentStreams);\n\tconst {readableEncoding, readableObjectMode, readableHighWaterMark} = getReadableOptions(subprocessStdout, binary);\n\tconst {read, onStdoutDataDone} = getReadableMethods({\n\t\tsubprocessStdout,\n\t\tsubprocess,\n\t\tbinary,\n\t\tencoding,\n\t\tpreserveNewlines,\n\t});\n\tconst readable = new Readable({\n\t\tread,\n\t\tdestroy: callbackify(onReadableDestroy.bind(undefined, {subprocessStdout, subprocess, waitReadableDestroy})),\n\t\thighWaterMark: readableHighWaterMark,\n\t\tobjectMode: readableObjectMode,\n\t\tencoding: readableEncoding,\n\t});\n\tonStdoutFinished({\n\t\tsubprocessStdout,\n\t\tonStdoutDataDone,\n\t\treadable,\n\t\tsubprocess,\n\t});\n\treturn readable;\n};\n\n// Retrieve `stdout` (or other stream depending on `from`)\nexport const getSubprocessStdout = (subprocess, from, concurrentStreams) => {\n\tconst subprocessStdout = getFromStream(subprocess, from);\n\tconst waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, 'readableDestroy');\n\treturn {subprocessStdout, waitReadableDestroy};\n};\n\nexport const getReadableOptions = ({readableEncoding, readableObjectMode, readableHighWaterMark}, binary) => binary\n\t? {readableEncoding, readableObjectMode, readableHighWaterMark}\n\t: {readableEncoding, readableObjectMode: true, readableHighWaterMark: DEFAULT_OBJECT_HIGH_WATER_MARK};\n\nexport const getReadableMethods = ({subprocessStdout, subprocess, binary, encoding, preserveNewlines}) => {\n\tconst onStdoutDataDone = createDeferred();\n\tconst onStdoutData = iterateOnSubprocessStream({\n\t\tsubprocessStdout,\n\t\tsubprocess,\n\t\tbinary,\n\t\tshouldEncode: !binary,\n\t\tencoding,\n\t\tpreserveNewlines,\n\t});\n\n\treturn {\n\t\tread() {\n\t\t\tonRead(this, onStdoutData, onStdoutDataDone);\n\t\t},\n\t\tonStdoutDataDone,\n\t};\n};\n\n// Forwards data from `stdout` to `readable`\nconst onRead = async (readable, onStdoutData, onStdoutDataDone) => {\n\ttry {\n\t\tconst {value, done} = await onStdoutData.next();\n\t\tif (done) {\n\t\t\tonStdoutDataDone.resolve();\n\t\t} else {\n\t\t\treadable.push(value);\n\t\t}\n\t} catch {}\n};\n\n// When `subprocess.stdout` ends/aborts/errors, do the same on `readable`.\n// Await the subprocess, for the same reason as above.\nexport const onStdoutFinished = async ({subprocessStdout, onStdoutDataDone, readable, subprocess, subprocessStdin}) => {\n\ttry {\n\t\tawait waitForSubprocessStdout(subprocessStdout);\n\t\tawait subprocess;\n\t\tawait safeWaitForSubprocessStdin(subprocessStdin);\n\t\tawait onStdoutDataDone;\n\n\t\tif (readable.readable) {\n\t\t\treadable.push(null);\n\t\t}\n\t} catch (error) {\n\t\tawait safeWaitForSubprocessStdin(subprocessStdin);\n\t\tdestroyOtherReadable(readable, await getPrematureCloseError(subprocess, error));\n\t}\n};\n\nconst getPrematureCloseError = async (subprocess, error) => {\n\tif (error.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n\t\treturn error;\n\t}\n\n\ttry {\n\t\tawait subprocess;\n\t} catch (subprocessError) {\n\t\treturn subprocessError;\n\t}\n\n\treturn error;\n};\n\n// When `readable` aborts/errors, do the same on `subprocess.stdout`\nexport const onReadableDestroy = async ({subprocessStdout, subprocess, waitReadableDestroy}, error) => {\n\tif (!await waitForConcurrentStreams(waitReadableDestroy, subprocess)) {\n\t\treturn;\n\t}\n\n\tdestroyOtherReadable(subprocessStdout, error);\n\tawait waitForSubprocess(subprocess, error);\n};\n\nconst destroyOtherReadable = (stream, error) => {\n\tdestroyOtherStream(stream, stream.readable, error);\n};\n", "import {finished} from 'node:stream/promises';\nimport {isStreamAbort} from '../resolve/wait-stream.js';\n\nexport const safeWaitForSubprocessStdin = async subprocessStdin => {\n\tif (subprocessStdin === undefined) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait waitForSubprocessStdin(subprocessStdin);\n\t} catch {}\n};\n\nexport const safeWaitForSubprocessStdout = async subprocessStdout => {\n\tif (subprocessStdout === undefined) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait waitForSubprocessStdout(subprocessStdout);\n\t} catch {}\n};\n\nexport const waitForSubprocessStdin = async subprocessStdin => {\n\tawait finished(subprocessStdin, {cleanup: true, readable: false, writable: true});\n};\n\nexport const waitForSubprocessStdout = async subprocessStdout => {\n\tawait finished(subprocessStdout, {cleanup: true, readable: true, writable: false});\n};\n\n// When `readable` or `writable` aborts/errors, awaits the subprocess, for the reason mentioned above\nexport const waitForSubprocess = async (subprocess, error) => {\n\tawait subprocess;\n\tif (error) {\n\t\tthrow error;\n\t}\n};\n\nexport const destroyOtherStream = (stream, isOpen, error) => {\n\tif (error && !isStreamAbort(error)) {\n\t\tstream.destroy(error);\n\t} else if (isOpen) {\n\t\tstream.destroy();\n\t}\n};\n", "import {finished} from 'node:stream/promises';\n\n// Wraps `finished(stream)` to handle the following case:\n// - When the subprocess exits, Node.js automatically calls `subprocess.stdin.destroy()`, which we need to ignore.\n// - However, we still need to throw if `subprocess.stdin.destroy()` is called before subprocess exit.\nexport const waitForStream = async (stream, fdNumber, streamInfo, {isSameDirection, stopOnExit = false} = {}) => {\n\tconst state = handleStdinDestroy(stream, streamInfo);\n\tconst abortController = new AbortController();\n\ttry {\n\t\tawait Promise.race([\n\t\t\t...(stopOnExit ? [streamInfo.exitPromise] : []),\n\t\t\tfinished(stream, {cleanup: true, signal: abortController.signal}),\n\t\t]);\n\t} catch (error) {\n\t\tif (!state.stdinCleanedUp) {\n\t\t\thandleStreamError(error, fdNumber, streamInfo, isSameDirection);\n\t\t}\n\t} finally {\n\t\tabortController.abort();\n\t}\n};\n\n// If `subprocess.stdin` is destroyed before being fully written to, it is considered aborted and should throw an error.\n// This can happen for example when user called `subprocess.stdin.destroy()` before `subprocess.stdin.end()`.\n// However, Node.js calls `subprocess.stdin.destroy()` on exit for cleanup purposes.\n// https://github.com/nodejs/node/blob/0b4cdb4b42956cbd7019058e409e06700a199e11/lib/internal/child_process.js#L278\n// This is normal and should not throw an error.\n// Therefore, we need to differentiate between both situations to know whether to throw an error.\n// Unfortunately, events (`close`, `error`, `end`, `exit`) cannot be used because `.destroy()` can take an arbitrary amount of time.\n// For example, `stdin: 'pipe'` is implemented as a TCP socket, and its `.destroy()` method waits for TCP disconnection.\n// Therefore `.destroy()` might end before or after subprocess exit, based on OS speed and load.\n// The only way to detect this is to spy on `subprocess.stdin._destroy()` by wrapping it.\n// If `subprocess.exitCode` or `subprocess.signalCode` is set, it means `.destroy()` is being called by Node.js itself.\nconst handleStdinDestroy = (stream, {originalStreams, subprocess}) => {\n\tconst [originalStdin] = originalStreams;\n\tconst state = {stdinCleanedUp: false};\n\tif (stream === originalStdin) {\n\t\tspyOnStdinDestroy(stream, subprocess, state);\n\t}\n\n\treturn state;\n};\n\nconst spyOnStdinDestroy = (subprocessStdin, subprocess, state) => {\n\tconst {_destroy} = subprocessStdin;\n\tsubprocessStdin._destroy = (...destroyArguments) => {\n\t\tsetStdinCleanedUp(subprocess, state);\n\t\t_destroy.call(subprocessStdin, ...destroyArguments);\n\t};\n};\n\nconst setStdinCleanedUp = ({exitCode, signalCode}, state) => {\n\tif (exitCode !== null || signalCode !== null) {\n\t\tstate.stdinCleanedUp = true;\n\t}\n};\n\n// We ignore EPIPEs on writable streams and aborts on readable streams since those can happen normally.\n// When one stream errors, the error is propagated to the other streams on the same file descriptor.\n// Those other streams might have a different direction due to the above.\n// When this happens, the direction of both the initial stream and the others should then be taken into account.\n// Therefore, we keep track of whether a stream error is currently propagating.\nconst handleStreamError = (error, fdNumber, streamInfo, isSameDirection) => {\n\tif (!shouldIgnoreStreamError(error, fdNumber, streamInfo, isSameDirection)) {\n\t\tthrow error;\n\t}\n};\n\nconst shouldIgnoreStreamError = (error, fdNumber, streamInfo, isSameDirection = true) => {\n\tif (streamInfo.propagating) {\n\t\treturn isStreamEpipe(error) || isStreamAbort(error);\n\t}\n\n\tstreamInfo.propagating = true;\n\treturn isInputFileDescriptor(streamInfo, fdNumber) === isSameDirection\n\t\t? isStreamEpipe(error)\n\t\t: isStreamAbort(error);\n};\n\n// Unfortunately, we cannot use the stream's class or properties to know whether it is readable or writable.\n// For example, `subprocess.stdin` is technically a Duplex, but can only be used as a writable.\n// Therefore, we need to use the file descriptor's direction (`stdin` is input, `stdout` is output, etc.).\n// However, while `subprocess.std*` and transforms follow that direction, any stream passed the `std*` option has the opposite direction.\n// For example, `subprocess.stdin` is a writable, but the `stdin` option is a readable.\nexport const isInputFileDescriptor = ({fileDescriptors}, fdNumber) => fdNumber !== 'all' && fileDescriptors[fdNumber].direction === 'input';\n\n// When `stream.destroy()` is called without an `error` argument, stream is aborted.\n// This is the only way to abort a readable stream, which can be useful in some instances.\n// Therefore, we ignore this error on readable streams.\nexport const isStreamAbort = error => error?.code === 'ERR_STREAM_PREMATURE_CLOSE';\n\n// When `stream.write()` is called but the underlying source has been closed, `EPIPE` is emitted.\n// When piping subprocesses, the source subprocess usually decides when to stop piping.\n// However, there are some instances when the destination does instead, such as `... | head -n1`.\n// It notifies the source by using `EPIPE`.\n// Therefore, we ignore this error on writable streams.\nconst isStreamEpipe = error => error?.code === 'EPIPE';\n", "import {Readable, Writable, Duplex} from 'node:stream';\n\n// Web stream versions of `subprocess.readable()`, `subprocess.writable()` and `subprocess.duplex()`.\n// They wrap those methods with `.toWeb()`, so all error and abort handling is reused as is.\nexport const createReadableStream = (subprocess, readableOptions) => Readable.toWeb(subprocess.readable(readableOptions));\nexport const createWritableStream = (subprocess, writableOptions) => Writable.toWeb(subprocess.writable(writableOptions));\nexport const createTransformStream = (subprocess, duplexOptions) => Duplex.toWeb(subprocess.duplex(duplexOptions));\n", "import {normalizeParameters} from '../methods/parameters.js';\nimport {getStartTime} from '../return/duration.js';\nimport {SUBPROCESS_OPTIONS, getToStream, getFromStream} from '../arguments/fd-options.js';\nimport {isDenoExecPath} from '../arguments/file-url.js';\n\n// Normalize and validate arguments passed to `source.pipe(destination)`\nexport const normalizePipeArguments = ({source, sourcePromise, boundOptions, createNested}, ...pipeArguments) => {\n\tconst startTime = getStartTime();\n\tconst {\n\t\tdestination,\n\t\tdestinationStream,\n\t\tdestinationError,\n\t\tfrom,\n\t\tunpipeSignal,\n\t} = getDestinationStream(boundOptions, createNested, pipeArguments);\n\tconst {sourceStream, sourceError} = getSourceStream(source, from);\n\tconst {options: sourceOptions, fileDescriptors} = SUBPROCESS_OPTIONS.get(source);\n\treturn {\n\t\tsourcePromise,\n\t\tsourceStream,\n\t\tsourceOptions,\n\t\tsourceError,\n\t\tdestination,\n\t\tdestinationStream,\n\t\tdestinationError,\n\t\tunpipeSignal,\n\t\tfileDescriptors,\n\t\tstartTime,\n\t};\n};\n\nconst getDestinationStream = (boundOptions, createNested, pipeArguments) => {\n\ttry {\n\t\tconst {\n\t\t\tdestination,\n\t\t\tpipeOptions: {from, to, unpipeSignal} = {},\n\t\t} = getDestination(boundOptions, createNested, ...pipeArguments);\n\t\tconst destinationStream = getToStream(destination, to);\n\t\treturn {\n\t\t\tdestination,\n\t\t\tdestinationStream,\n\t\t\tfrom,\n\t\t\tunpipeSignal,\n\t\t};\n\t} catch (error) {\n\t\treturn {destinationError: error};\n\t}\n};\n\n// Piping subprocesses can use three syntaxes:\n// - source.pipe('command', commandArguments, pipeOptionsOrDestinationOptions)\n// - source.pipe`command commandArgument` or source.pipe(pipeOptionsOrDestinationOptions)`command commandArgument`\n// - source.pipe(execa(...), pipeOptions)\nconst getDestination = (boundOptions, createNested, firstArgument, ...pipeArguments) => {\n\tif (Array.isArray(firstArgument)) {\n\t\tconst destination = createNested(mapDestinationArguments, boundOptions)(firstArgument, ...pipeArguments);\n\t\treturn {destination, pipeOptions: boundOptions};\n\t}\n\n\tif (typeof firstArgument === 'string' || firstArgument instanceof URL || isDenoExecPath(firstArgument)) {\n\t\tif (Object.keys(boundOptions).length > 0) {\n\t\t\tthrow new TypeError('Please use .pipe(\"file\", ..., options) or .pipe(execa(\"file\", ..., options)) instead of .pipe(options)(\"file\", ...).');\n\t\t}\n\n\t\tconst [rawFile, rawArguments, rawOptions] = normalizeParameters(firstArgument, ...pipeArguments);\n\t\tconst destination = createNested(mapDestinationArguments)(rawFile, rawArguments, rawOptions);\n\t\treturn {destination, pipeOptions: rawOptions};\n\t}\n\n\tif (SUBPROCESS_OPTIONS.has(firstArgument)) {\n\t\tif (Object.keys(boundOptions).length > 0) {\n\t\t\tthrow new TypeError('Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).');\n\t\t}\n\n\t\treturn {destination: firstArgument, pipeOptions: pipeArguments[0]};\n\t}\n\n\tthrow new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${firstArgument}`);\n};\n\n// Force `stdin: 'pipe'` with the destination subprocess\nconst mapDestinationArguments = ({options}) => ({options: {...options, stdin: 'pipe', piped: true}});\n\nconst getSourceStream = (source, from) => {\n\ttry {\n\t\tconst sourceStream = getFromStream(source, from);\n\t\treturn {sourceStream};\n\t} catch (error) {\n\t\treturn {sourceError: error};\n\t}\n};\n", "import {makeEarlyError} from '../return/result.js';\nimport {abortSourceStream, endDestinationStream} from '../io/pipeline.js';\n\n// When passing invalid arguments to `source.pipe()`, throw asynchronously.\n// We also abort both subprocesses.\nexport const handlePipeArgumentsError = ({\n\tsourceStream,\n\tsourceError,\n\tdestinationStream,\n\tdestinationError,\n\tfileDescriptors,\n\tsourceOptions,\n\tstartTime,\n}) => {\n\tconst error = getPipeArgumentsError({\n\t\tsourceStream,\n\t\tsourceError,\n\t\tdestinationStream,\n\t\tdestinationError,\n\t});\n\tif (error !== undefined) {\n\t\tthrow createNonCommandError({\n\t\t\terror,\n\t\t\tfileDescriptors,\n\t\t\tsourceOptions,\n\t\t\tstartTime,\n\t\t});\n\t}\n};\n\nconst getPipeArgumentsError = ({sourceStream, sourceError, destinationStream, destinationError}) => {\n\tif (sourceError !== undefined && destinationError !== undefined) {\n\t\treturn destinationError;\n\t}\n\n\tif (destinationError !== undefined) {\n\t\tabortSourceStream(sourceStream);\n\t\treturn destinationError;\n\t}\n\n\tif (sourceError !== undefined) {\n\t\tendDestinationStream(destinationStream);\n\t\treturn sourceError;\n\t}\n};\n\n// Specific error return value when passing invalid arguments to `subprocess.pipe()` or when using `unpipeSignal`\nexport const createNonCommandError = ({error, fileDescriptors, sourceOptions, startTime}) => makeEarlyError({\n\terror,\n\tcommand: PIPE_COMMAND_MESSAGE,\n\tescapedCommand: PIPE_COMMAND_MESSAGE,\n\tfileDescriptors,\n\toptions: sourceOptions,\n\tstartTime,\n\tisSync: false,\n});\n\nconst PIPE_COMMAND_MESSAGE = 'source.pipe(destination)';\n", "// Like Bash, we await both subprocesses. This is unlike some other shells which only await the destination subprocess.\n// Like Bash with the `pipefail` option, if either subprocess fails, the whole pipe fails.\n// Like Bash, if both subprocesses fail, we return the failure of the destination.\n// This ensures both subprocesses' errors are present, using `error.pipedFrom`.\nexport const waitForBothSubprocesses = async subprocessPromises => {\n\tconst [\n\t\t{status: sourceStatus, reason: sourceReason, value: sourceResult = sourceReason},\n\t\t{status: destinationStatus, reason: destinationReason, value: destinationResult = destinationReason},\n\t] = await subprocessPromises;\n\n\tif (!destinationResult.pipedFrom.includes(sourceResult)) {\n\t\tdestinationResult.pipedFrom.push(sourceResult);\n\t}\n\n\tif (destinationStatus === 'rejected') {\n\t\tthrow destinationResult;\n\t}\n\n\tif (sourceStatus === 'rejected') {\n\t\tthrow sourceResult;\n\t}\n\n\treturn destinationResult;\n};\n", "import {finished} from 'node:stream/promises';\nimport mergeStreams from '@sindresorhus/merge-streams';\nimport {incrementMaxListeners} from '../utils/max-listeners.js';\nimport {pipeStreams} from '../io/pipeline.js';\n\n// The piping behavior is like Bash.\n// In particular, when one subprocess exits, the other is not terminated by a signal.\n// Instead, its stdout (for the source) or stdin (for the destination) closes.\n// If the subprocess uses it, it will make it error with SIGPIPE or EPIPE (for the source) or end (for the destination).\n// If it does not use it, it will continue running.\n// This allows for subprocesses to gracefully exit and lower the coupling between subprocesses.\nexport const pipeSubprocessStream = (sourceStream, destinationStream, maxListenersController) => {\n\tconst mergedStream = MERGED_STREAMS.has(destinationStream)\n\t\t? pipeMoreSubprocessStream(sourceStream, destinationStream)\n\t\t: pipeFirstSubprocessStream(sourceStream, destinationStream);\n\tincrementMaxListeners(sourceStream, SOURCE_LISTENERS_PER_PIPE, maxListenersController.signal);\n\tincrementMaxListeners(destinationStream, DESTINATION_LISTENERS_PER_PIPE, maxListenersController.signal);\n\tcleanupMergedStreamsMap(destinationStream);\n\treturn mergedStream;\n};\n\n// We use `merge-streams` to allow for multiple sources to pipe to the same destination.\nconst pipeFirstSubprocessStream = (sourceStream, destinationStream) => {\n\tconst mergedStream = mergeStreams([sourceStream]);\n\tpipeStreams(mergedStream, destinationStream);\n\tMERGED_STREAMS.set(destinationStream, mergedStream);\n\treturn mergedStream;\n};\n\nconst pipeMoreSubprocessStream = (sourceStream, destinationStream) => {\n\tconst mergedStream = MERGED_STREAMS.get(destinationStream);\n\tmergedStream.add(sourceStream);\n\treturn mergedStream;\n};\n\nconst cleanupMergedStreamsMap = async destinationStream => {\n\ttry {\n\t\tawait finished(destinationStream, {cleanup: true, readable: false, writable: true});\n\t} catch {}\n\n\tMERGED_STREAMS.delete(destinationStream);\n};\n\nconst MERGED_STREAMS = new WeakMap();\n\n// Number of listeners set up on `sourceStream` by each `sourceStream.pipe(destinationStream)`\n// Those are added by `merge-streams`\nconst SOURCE_LISTENERS_PER_PIPE = 2;\n// Number of listeners set up on `destinationStream` by each `sourceStream.pipe(destinationStream)`\n// Those are added by `finished()` in `cleanupMergedStreamsMap()`\nconst DESTINATION_LISTENERS_PER_PIPE = 1;\n", "import {aborted} from 'node:util';\nimport {createNonCommandError} from './throw.js';\n\n// When passing an `unpipeSignal` option, abort piping when the signal is aborted.\n// However, do not terminate the subprocesses.\nexport const unpipeOnAbort = (unpipeSignal, unpipeContext) => unpipeSignal === undefined\n\t? []\n\t: [unpipeOnSignalAbort(unpipeSignal, unpipeContext)];\n\nconst unpipeOnSignalAbort = async (unpipeSignal, {sourceStream, mergedStream, fileDescriptors, sourceOptions, startTime}) => {\n\tawait aborted(unpipeSignal, sourceStream);\n\tawait mergedStream.remove(sourceStream);\n\tconst error = new Error('Pipe canceled by `unpipeSignal` option.');\n\tthrow createNonCommandError({\n\t\terror,\n\t\tfileDescriptors,\n\t\tsourceOptions,\n\t\tstartTime,\n\t});\n};\n", "import isPlainObject from 'is-plain-obj';\nimport {SUBPROCESS_OPTIONS} from '../arguments/fd-options.js';\nimport {initializeConcurrentStreams} from '../convert/concurrent.js';\nimport {createIterable} from '../convert/iterable.js';\nimport {createReadable} from '../convert/readable.js';\nimport {createReadableStream} from '../convert/web.js';\nimport {internalGetOneMessageOptions} from '../ipc/get-one.js';\nimport {internalGetEachMessageOptions} from '../ipc/get-each.js';\nimport {normalizePipeArguments} from './pipe-arguments.js';\nimport {handlePipeArgumentsError} from './throw.js';\nimport {waitForBothSubprocesses} from './sequence.js';\nimport {pipeSubprocessStream} from './streaming.js';\nimport {unpipeOnAbort} from './abort.js';\n\n// Pipe a subprocess' `stdout`/`stderr`/`stdio` into another subprocess' `stdin`\nexport const pipeToSubprocess = (sourceInfo, ...pipeArguments) => {\n\tif (isPlainObject(pipeArguments[0])) {\n\t\treturn pipeToSubprocess.bind(undefined, {\n\t\t\t...sourceInfo,\n\t\t\tboundOptions: {...sourceInfo.boundOptions, ...pipeArguments[0]},\n\t\t});\n\t}\n\n\tconst {destination, ...normalizedInfo} = normalizePipeArguments(sourceInfo, ...pipeArguments);\n\tconst pipeFailureController = new AbortController();\n\tconst promise = handlePipePromise({...normalizedInfo, destination, pipeFailureController});\n\tpromise.pipe = pipeToSubprocess.bind(undefined, {\n\t\t...sourceInfo,\n\t\tsource: destination,\n\t\tsourcePromise: promise,\n\t\tboundOptions: {},\n\t});\n\tforwardDestinationMethods(promise, destination, pipeFailureController.signal);\n\treturn promise;\n};\n\n/*\nThe return value of `.pipe()` exposes the destination subprocess' output, but its iteration and stream conversion methods must await the whole pipe so source failures are propagated too. The destination is `undefined` when `.pipe()` was passed invalid arguments, in which case the promise rejects and there is nothing to forward.\n*/\nconst forwardDestinationMethods = (promise, destination, pipeFailureSignal) => {\n\tif (destination === undefined) {\n\t\treturn;\n\t}\n\n\tforwardReadableMethods(promise, destination);\n\tforwardIpcMethods(promise, destination, pipeFailureSignal);\n};\n\nconst forwardReadableMethods = (promise, destination) => {\n\tconst subprocessOptions = SUBPROCESS_OPTIONS.get(destination);\n\tSUBPROCESS_OPTIONS.set(promise, subprocessOptions);\n\tpromise.stdio = destination.stdio;\n\tpromise.all = destination.all;\n\n\tconst {options: {encoding}} = subprocessOptions;\n\tconst concurrentStreams = initializeConcurrentStreams();\n\tpromise[Symbol.asyncIterator] = createIterable.bind(undefined, promise, encoding, {});\n\tpromise.iterable = createIterable.bind(undefined, promise, encoding);\n\tpromise.readable = createPipeReadable.bind(undefined, promise, {\n\t\tsubprocess: promise,\n\t\tconcurrentStreams,\n\t\tencoding,\n\t});\n\tpromise.readableStream = createReadableStream.bind(undefined, promise);\n\tforwardAll(promise, destination);\n};\n\nconst forwardAll = (promise, destination) => {\n\tif (destination.all === undefined) {\n\t\tpromise.all = undefined;\n\t\treturn;\n\t}\n\n\tObject.defineProperty(promise, 'all', {\n\t\tget() {\n\t\t\tsetAllProperty(promise, destination.all);\n\t\t\tconst all = promise.readable({from: 'all'});\n\t\t\tsetAllProperty(promise, all);\n\t\t\treturn all;\n\t\t},\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n};\n\nconst setAllProperty = (promise, value) => {\n\tObject.defineProperty(promise, 'all', {\n\t\tvalue,\n\t\twritable: true,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n};\n\nconst createPipeReadable = (promise, readableOptions, ...arguments_) => {\n\tconst readable = createReadable(readableOptions, ...arguments_);\n\tdestroyOnPipeFailure(promise, readable);\n\treturn readable;\n};\n\nconst destroyOnPipeFailure = async (promise, readable) => {\n\ttry {\n\t\tawait promise;\n\t} catch (error) {\n\t\treadable.destroy(error);\n\t}\n};\n\nconst forwardIpcMethods = (promise, destination, pipeFailureSignal) => {\n\tpromise.sendMessage = destination.sendMessage;\n\tpromise.getOneMessage = getOnePipeMessage.bind(undefined, destination, pipeFailureSignal);\n\tpromise.getEachMessage = getEachPipeMessage.bind(undefined, promise, destination, pipeFailureSignal);\n};\n\nconst getOnePipeMessage = (destination, pipeFailureSignal, ...arguments_) => {\n\tconst controller = new AbortController();\n\tconst messagePromise = destination.getOneMessage(...addPipeOptions(arguments_, controller.signal, internalGetOneMessageOptions));\n\treturn waitForOnePipeMessage(pipeFailureSignal, messagePromise, controller);\n};\n\nconst waitForOnePipeMessage = async (pipeFailureSignal, messagePromise, controller) => {\n\ttry {\n\t\treturn await Promise.race([messagePromise, getSignalRejection(pipeFailureSignal, controller.signal)]);\n\t} finally {\n\t\tcontroller.abort();\n\t}\n};\n\nconst getSignalRejection = (signal, listenerSignal) => new Promise((_, reject) => {\n\tif (signal.aborted) {\n\t\treject(signal.reason);\n\t\treturn;\n\t}\n\n\tsignal.addEventListener('abort', () => {\n\t\treject(signal.reason);\n\t}, {once: true, signal: listenerSignal});\n});\n\nconst getEachPipeMessage = (promise, destination, pipeFailureSignal, ...arguments_) => {\n\tconst controller = new AbortController();\n\t// Create the destination iterator before awaiting the pipe so option validation stays synchronous.\n\tconst iterator = destination.getEachMessage(...addPipeOptions(arguments_, controller.signal, internalGetEachMessageOptions));\n\tabortOnSignal(pipeFailureSignal, controller);\n\treturn iterateOnPipeMessages(promise, iterator, controller);\n};\n\nconst iterateOnPipeMessages = async function * (promise, iterator, controller) {\n\ttry {\n\t\tyield * iterator;\n\t} finally {\n\t\tcontroller.abort();\n\t\tawait promise;\n\t}\n};\n\nconst addPipeOptions = (arguments_, signal, internalOptionsSymbol) => {\n\tif (arguments_[0] === null) {\n\t\t// Preserve the public validation error from `getEachMessage(null)` instead of masking it with a pipe failure.\n\t\treturn arguments_;\n\t}\n\n\tconst [options] = arguments_;\n\t// The returned pipe promise is awaited by the forwarded IPC iterator, so the destination IPC iterator must not also await the destination subprocess on close.\n\treturn [{...options, [internalOptionsSymbol]: {signal, shouldAwait: false}}];\n};\n\nconst abortOnSignal = (signal, controller) => {\n\tif (signal.aborted) {\n\t\tcontroller.abort();\n\t\treturn;\n\t}\n\n\t// Interrupt pending IPC reads when the pipe rejects, including `unpipeSignal` cancellation while the destination keeps running.\n\tsignal.addEventListener('abort', () => {\n\t\tcontroller.abort();\n\t}, {once: true, signal: controller.signal});\n};\n\n// `writable()`, `duplex()`, `writableStream()` and `transformStream()` are intentionally not forwarded: they write to the destination's `stdin`, which is already being piped from the source.\n\n// Asynchronous logic when piping subprocesses\nconst handlePipePromise = async ({\n\tsourcePromise,\n\tsourceStream,\n\tsourceOptions,\n\tsourceError,\n\tdestination,\n\tdestinationStream,\n\tdestinationError,\n\tunpipeSignal,\n\tfileDescriptors,\n\tstartTime,\n\tpipeFailureController,\n}) => {\n\tconst maxListenersController = new AbortController();\n\ttry {\n\t\tconst subprocessPromises = getSubprocessPromises(sourcePromise, destination);\n\t\thandlePipeArgumentsError({\n\t\t\tsourceStream,\n\t\t\tsourceError,\n\t\t\tdestinationStream,\n\t\t\tdestinationError,\n\t\t\tfileDescriptors,\n\t\t\tsourceOptions,\n\t\t\tstartTime,\n\t\t});\n\t\tconst mergedStream = pipeSubprocessStream(sourceStream, destinationStream, maxListenersController);\n\t\treturn await Promise.race([\n\t\t\twaitForBothSubprocesses(subprocessPromises),\n\t\t\t...unpipeOnAbort(unpipeSignal, {\n\t\t\t\tsourceStream,\n\t\t\t\tmergedStream,\n\t\t\t\tsourceOptions,\n\t\t\t\tfileDescriptors,\n\t\t\t\tstartTime,\n\t\t\t}),\n\t\t]);\n\t} catch (error) {\n\t\tpipeFailureController.abort(error);\n\t\tthrow error;\n\t} finally {\n\t\tmaxListenersController.abort();\n\t}\n};\n\n// `.pipe()` awaits the subprocess promises.\n// When invalid arguments are passed to `.pipe()`, we throw an error, which prevents awaiting them.\n// We need to ensure this does not create unhandled rejections.\nconst getSubprocessPromises = (sourcePromise, destination) => Promise.allSettled([sourcePromise, destination]);\n", "import {setImmediate} from 'node:timers/promises';\nimport getStream, {getStreamAsArrayBuffer, getStreamAsArray} from 'get-stream';\nimport {isArrayBuffer} from '../utils/uint-array.js';\nimport {shouldLogOutput, logLines} from '../verbose/output.js';\nimport {iterateForResult} from './iterate.js';\nimport {handleMaxBuffer} from './max-buffer.js';\nimport {getStripFinalNewline} from './strip-newline.js';\n\n// Retrieve `result.stdout|stderr|all|stdio[*]`\nexport const getStreamOutput = async ({stream, onStreamEnd, fdNumber, encoding, buffer, maxBuffer, lines, allMixed, stripFinalNewline, verboseInfo, streamInfo}) => {\n\tconst logPromise = logOutputAsync({\n\t\tstream,\n\t\tonStreamEnd,\n\t\tfdNumber,\n\t\tencoding,\n\t\tallMixed,\n\t\tverboseInfo,\n\t\tstreamInfo,\n\t});\n\n\tif (!buffer) {\n\t\tawait Promise.all([resumeStream(stream), logPromise]);\n\t\treturn;\n\t}\n\n\tconst stripFinalNewlineValue = getStripFinalNewline(stripFinalNewline, fdNumber);\n\tconst iterable = iterateForResult({\n\t\tstream,\n\t\tonStreamEnd,\n\t\tlines,\n\t\tencoding,\n\t\tstripFinalNewline: stripFinalNewlineValue,\n\t\tallMixed,\n\t});\n\tconst [output] = await Promise.all([\n\t\tgetStreamContents({\n\t\t\tstream,\n\t\t\titerable,\n\t\t\tfdNumber,\n\t\t\tencoding,\n\t\t\tmaxBuffer,\n\t\t\tlines,\n\t\t}),\n\t\tlogPromise,\n\t]);\n\treturn output;\n};\n\nconst logOutputAsync = async ({stream, onStreamEnd, fdNumber, encoding, allMixed, verboseInfo, streamInfo: {fileDescriptors}}) => {\n\tif (!shouldLogOutput({\n\t\tstdioItems: fileDescriptors[fdNumber]?.stdioItems,\n\t\tencoding,\n\t\tverboseInfo,\n\t\tfdNumber,\n\t})) {\n\t\treturn;\n\t}\n\n\tconst linesIterable = iterateForResult({\n\t\tstream,\n\t\tonStreamEnd,\n\t\tlines: true,\n\t\tencoding,\n\t\tstripFinalNewline: true,\n\t\tallMixed,\n\t});\n\tawait logLines(linesIterable, stream, fdNumber, verboseInfo);\n};\n\n// When using `buffer: false`, users need to read `subprocess.stdout|stderr|all` right away\n// See https://github.com/sindresorhus/execa/issues/730 and https://github.com/sindresorhus/execa/pull/729#discussion_r1465496310\nconst resumeStream = async stream => {\n\tawait setImmediate();\n\tif (stream.readableFlowing === null) {\n\t\tstream.resume();\n\t}\n};\n\nconst getStreamContents = async ({stream, stream: {readableObjectMode}, iterable, fdNumber, encoding, maxBuffer, lines}) => {\n\ttry {\n\t\tif (readableObjectMode || lines) {\n\t\t\treturn await getStreamAsArray(iterable, {maxBuffer});\n\t\t}\n\n\t\tif (encoding === 'buffer') {\n\t\t\treturn new Uint8Array(await getStreamAsArrayBuffer(iterable, {maxBuffer}));\n\t\t}\n\n\t\treturn await getStream(iterable, {maxBuffer});\n\t} catch (error) {\n\t\treturn handleBufferedData(handleMaxBuffer({\n\t\t\terror,\n\t\t\tstream,\n\t\t\treadableObjectMode,\n\t\t\tlines,\n\t\t\tencoding,\n\t\t\tfdNumber,\n\t\t}));\n\t}\n};\n\n// On failure, `result.stdout|stderr|all` should contain the currently buffered stream\n// They are automatically closed and flushed by Node.js when the subprocess exits\n// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve\nexport const getBufferedData = async streamPromise => {\n\ttry {\n\t\treturn await streamPromise;\n\t} catch (error) {\n\t\treturn handleBufferedData(error);\n\t}\n};\n\n// Ensure we are returning Uint8Arrays when using `encoding: 'buffer'`\nconst handleBufferedData = ({bufferedData}) => isArrayBuffer(bufferedData)\n\t? new Uint8Array(bufferedData)\n\t: bufferedData;\n", "import {getStreamOutput} from '../io/contents.js';\nimport {waitForStream, isInputFileDescriptor} from './wait-stream.js';\n\n// Read the contents of `subprocess.std*` and|or wait for its completion\nexport const waitForStdioStreams = ({subprocess, encoding, buffer, maxBuffer, lines, stripFinalNewline, verboseInfo, streamInfo}) => subprocess.stdio.map((stream, fdNumber) => waitForSubprocessStream({\n\tstream,\n\tfdNumber,\n\tencoding,\n\tbuffer: buffer[fdNumber],\n\tmaxBuffer: maxBuffer[fdNumber],\n\tlines: lines[fdNumber],\n\tallMixed: false,\n\tstripFinalNewline,\n\tverboseInfo,\n\tstreamInfo,\n}));\n\n// Read the contents of `subprocess.std*` or `subprocess.all` and|or wait for its completion\nexport const waitForSubprocessStream = async ({stream, fdNumber, encoding, buffer, maxBuffer, lines, allMixed, stripFinalNewline, verboseInfo, streamInfo}) => {\n\tif (!stream) {\n\t\treturn;\n\t}\n\n\tconst onStreamEnd = waitForStream(stream, fdNumber, streamInfo);\n\tif (isInputFileDescriptor(streamInfo, fdNumber)) {\n\t\tawait onStreamEnd;\n\t\treturn;\n\t}\n\n\tconst [output] = await Promise.all([\n\t\tgetStreamOutput({\n\t\t\tstream,\n\t\t\tonStreamEnd,\n\t\t\tfdNumber,\n\t\t\tencoding,\n\t\t\tbuffer,\n\t\t\tmaxBuffer,\n\t\t\tlines,\n\t\t\tallMixed,\n\t\t\tstripFinalNewline,\n\t\t\tverboseInfo,\n\t\t\tstreamInfo,\n\t\t}),\n\t\tonStreamEnd,\n\t]);\n\treturn output;\n};\n", "import mergeStreams from '@sindresorhus/merge-streams';\nimport {waitForSubprocessStream} from './stdio.js';\n\n// `all` interleaves `stdout` and `stderr`\nexport const makeAllStream = ({stdout, stderr}, {all}) => all && (stdout || stderr)\n\t? mergeStreams([stdout, stderr].filter(Boolean))\n\t: undefined;\n\n// Read the contents of `subprocess.all` and|or wait for its completion\nexport const waitForAllStream = ({subprocess, all, encoding, buffer, maxBuffer, lines, stripFinalNewline, verboseInfo, streamInfo}) => waitForSubprocessStream({\n\t...getAllStream(subprocess, all, buffer),\n\tfdNumber: 'all',\n\tencoding,\n\tmaxBuffer: maxBuffer[1] + maxBuffer[2],\n\tlines: lines[1] || lines[2],\n\tallMixed: getAllMixed(subprocess, all),\n\tstripFinalNewline,\n\tverboseInfo,\n\tstreamInfo,\n});\n\nconst getAllStream = ({stdout, stderr}, all, [, bufferStdout, bufferStderr]) => {\n\tconst buffer = bufferStdout || bufferStderr;\n\tif (!buffer) {\n\t\treturn {stream: all, buffer};\n\t}\n\n\tif (!bufferStdout) {\n\t\treturn {stream: stderr, buffer};\n\t}\n\n\tif (!bufferStderr) {\n\t\treturn {stream: stdout, buffer};\n\t}\n\n\treturn {stream: all, buffer};\n};\n\n// When `subprocess.stdout` is in objectMode but not `subprocess.stderr` (or the opposite), we need to use both:\n// - `getStreamAsArray()` for the chunks in objectMode, to return as an array without changing each chunk\n// - `getStreamAsArrayBuffer()` or `getStream()` for the chunks not in objectMode, to convert them from Buffers to string or Uint8Array\n// We do this by emulating the Buffer -> string|Uint8Array conversion performed by `get-stream` with our own, which is identical.\nconst getAllMixed = ({stdout, stderr}, all) => all\n\t&& stdout\n\t&& stderr\n\t&& stdout.readableObjectMode !== stderr.readableObjectMode;\n", "import {once} from 'node:events';\nimport {isStream as isNodeStream} from 'is-stream';\nimport {throwOnTimeout} from '../terminate/timeout.js';\nimport {throwOnCancel} from '../terminate/cancel.js';\nimport {throwOnGracefulCancel} from '../terminate/graceful.js';\nimport {isStandardStream} from '../utils/standard-stream.js';\nimport {TRANSFORM_TYPES} from '../stdio/type.js';\nimport {getBufferedData} from '../io/contents.js';\nimport {waitForIpcOutput, getBufferedIpcOutput} from '../ipc/buffer-messages.js';\nimport {sendIpcInput} from '../ipc/ipc-input.js';\nimport {waitForAllStream} from './all-async.js';\nimport {waitForStdioStreams} from './stdio.js';\nimport {waitForExit, waitForSuccessfulExit} from './exit-async.js';\nimport {waitForStream} from './wait-stream.js';\n\n// Retrieve result of subprocess: exit code, signal, error, streams (stdout/stderr/all)\nexport const waitForSubprocessResult = async ({\n\tsubprocess,\n\tkill,\n\tall,\n\toptions: {\n\t\tencoding,\n\t\tbuffer,\n\t\tmaxBuffer,\n\t\tlines,\n\t\ttimeoutDuration: timeout,\n\t\tcancelSignal,\n\t\tgracefulCancel,\n\t\tforceKillAfterDelay,\n\t\tstripFinalNewline,\n\t\tipc,\n\t\tipcInput,\n\t},\n\tcontext,\n\tverboseInfo,\n\tfileDescriptors,\n\toriginalStreams,\n\tonInternalError,\n\tcontroller,\n}) => {\n\tconst exitPromise = waitForExit(subprocess, context);\n\tconst streamInfo = {\n\t\toriginalStreams,\n\t\tfileDescriptors,\n\t\tsubprocess,\n\t\texitPromise,\n\t\tpropagating: false,\n\t};\n\n\tconst stdioPromises = waitForStdioStreams({\n\t\tsubprocess,\n\t\tencoding,\n\t\tbuffer,\n\t\tmaxBuffer,\n\t\tlines,\n\t\tstripFinalNewline,\n\t\tverboseInfo,\n\t\tstreamInfo,\n\t});\n\tconst allPromise = waitForAllStream({\n\t\tsubprocess,\n\t\tall,\n\t\tencoding,\n\t\tbuffer,\n\t\tmaxBuffer,\n\t\tlines,\n\t\tstripFinalNewline,\n\t\tverboseInfo,\n\t\tstreamInfo,\n\t});\n\tconst ipcOutput = [];\n\tconst ipcOutputPromise = waitForIpcOutput({\n\t\tsubprocess,\n\t\tbuffer,\n\t\tmaxBuffer,\n\t\tipc,\n\t\tipcOutput,\n\t\tverboseInfo,\n\t});\n\tconst originalPromises = waitForOriginalStreams(originalStreams, subprocess, streamInfo);\n\tconst customStreamsEndPromises = waitForCustomStreamsEnd(fileDescriptors, streamInfo);\n\n\ttry {\n\t\treturn await Promise.race([\n\t\t\tPromise.all([\n\t\t\t\t{},\n\t\t\t\twaitForSuccessfulExit(exitPromise),\n\t\t\t\tPromise.all(stdioPromises),\n\t\t\t\tallPromise,\n\t\t\t\tipcOutputPromise,\n\t\t\t\tsendIpcInput(subprocess, ipcInput, ipc),\n\t\t\t\t...originalPromises,\n\t\t\t\t...customStreamsEndPromises,\n\t\t\t]),\n\t\t\tonInternalError,\n\t\t\tthrowOnSubprocessError(subprocess, controller),\n\t\t\t...throwOnTimeout(kill, timeout, context, controller),\n\t\t\t...throwOnCancel({\n\t\t\t\tkill,\n\t\t\t\tcancelSignal,\n\t\t\t\tgracefulCancel,\n\t\t\t\tcontext,\n\t\t\t\tcontroller,\n\t\t\t}),\n\t\t\t...throwOnGracefulCancel({\n\t\t\t\tsubprocess,\n\t\t\t\tkill,\n\t\t\t\tcancelSignal,\n\t\t\t\tgracefulCancel,\n\t\t\t\tforceKillAfterDelay,\n\t\t\t\tcontext,\n\t\t\t\tcontroller,\n\t\t\t}),\n\t\t]);\n\t} catch (error) {\n\t\tcontext.terminationReason ??= 'other';\n\t\treturn Promise.all([\n\t\t\t{error},\n\t\t\texitPromise,\n\t\t\tPromise.all(stdioPromises.map(stdioPromise => getBufferedData(stdioPromise))),\n\t\t\tgetBufferedData(allPromise),\n\t\t\tgetBufferedIpcOutput(ipcOutputPromise, ipcOutput),\n\t\t\tPromise.allSettled(originalPromises),\n\t\t\tPromise.allSettled(customStreamsEndPromises),\n\t\t]);\n\t}\n};\n\n// Transforms replace `subprocess.std*`, which means they are not exposed to users.\n// However, we still want to wait for their completion.\nconst waitForOriginalStreams = (originalStreams, subprocess, streamInfo) =>\n\toriginalStreams.map((stream, fdNumber) => stream === subprocess.stdio[fdNumber]\n\t\t? undefined\n\t\t: waitForStream(stream, fdNumber, streamInfo));\n\n// Some `stdin`/`stdout`/`stderr` options create a stream, e.g. when passing a file path.\n// The `.pipe()` method automatically ends that stream when `subprocess` ends.\n// This makes sure we wait for the completion of those streams, in order to catch any error.\nconst waitForCustomStreamsEnd = (fileDescriptors, streamInfo) => fileDescriptors.flatMap(({stdioItems}, fdNumber) => stdioItems\n\t.filter(({value, stream = value}) => isNodeStream(stream, {checkOpen: false}) && !isStandardStream(stream))\n\t.map(({type, value, stream = value}) => waitForStream(stream, fdNumber, streamInfo, {\n\t\tisSameDirection: TRANSFORM_TYPES.has(type),\n\t\tstopOnExit: type === 'native',\n\t})));\n\n// Fails when the subprocess emits an `error` event\nconst throwOnSubprocessError = async (subprocess, {signal}) => {\n\tconst [error] = await once(subprocess, 'error', {signal});\n\tthrow error;\n};\n", "import {verboseLog, serializeVerboseMessage} from './log.js';\nimport {isFullVerbose} from './values.js';\n\n// When `verbose` is `'full'`, print IPC messages from the subprocess\nexport const shouldLogIpc = verboseInfo => isFullVerbose(verboseInfo, 'ipc');\n\nexport const logIpcOutput = (message, verboseInfo) => {\n\tconst verboseMessage = serializeVerboseMessage(message);\n\tverboseLog({\n\t\ttype: 'ipc',\n\t\tverboseMessage,\n\t\tfdNumber: 'ipc',\n\t\tverboseInfo,\n\t});\n};\n", "import {checkIpcMaxBuffer} from '../io/max-buffer.js';\nimport {shouldLogIpc, logIpcOutput} from '../verbose/ipc.js';\nimport {getFdSpecificValue} from '../arguments/specific.js';\nimport {loopOnMessages} from './get-each.js';\n\n// Iterate through IPC messages sent by the subprocess\nexport const waitForIpcOutput = async ({\n\tsubprocess,\n\tbuffer: bufferArray,\n\tmaxBuffer: maxBufferArray,\n\tipc,\n\tipcOutput,\n\tverboseInfo,\n}) => {\n\tif (!ipc) {\n\t\treturn ipcOutput;\n\t}\n\n\tconst isVerbose = shouldLogIpc(verboseInfo);\n\tconst buffer = getFdSpecificValue(bufferArray, 'ipc');\n\tconst maxBuffer = getFdSpecificValue(maxBufferArray, 'ipc');\n\n\tfor await (const message of loopOnMessages({\n\t\tanyProcess: subprocess,\n\t\tchannel: subprocess.channel,\n\t\tisSubprocess: false,\n\t\tipc,\n\t\tshouldAwait: false,\n\t\treference: true,\n\t})) {\n\t\tif (buffer) {\n\t\t\tcheckIpcMaxBuffer(subprocess, ipcOutput, maxBuffer);\n\t\t\tipcOutput.push(message);\n\t\t}\n\n\t\tif (isVerbose) {\n\t\t\tlogIpcOutput(message, verboseInfo);\n\t\t}\n\t}\n\n\treturn ipcOutput;\n};\n\nexport const getBufferedIpcOutput = async (ipcOutputPromise, ipcOutput) => {\n\tawait Promise.allSettled([ipcOutputPromise]);\n\treturn ipcOutput;\n};\n", "import {Writable} from 'node:stream';\nimport {callbackify} from 'node:util';\nimport {getToStream} from '../arguments/fd-options.js';\nimport {isStreamAbort} from '../resolve/wait-stream.js';\nimport {addConcurrentStream, waitForConcurrentStreams} from './concurrent.js';\nimport {\n\tsafeWaitForSubprocessStdout,\n\twaitForSubprocessStdin,\n\twaitForSubprocess,\n\tdestroyOtherStream,\n} from './shared.js';\n\n// Create a `Writable` stream that forwards to `stdin` and awaits the subprocess\nexport const createWritable = ({subprocess, concurrentStreams}, {to} = {}) => {\n\tconst {subprocessStdin, waitWritableFinal, waitWritableDestroy} = getSubprocessStdin(subprocess, to, concurrentStreams);\n\tconst writable = new Writable({\n\t\t...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),\n\t\tdestroy: callbackify(onWritableDestroy.bind(undefined, {\n\t\t\tsubprocessStdin,\n\t\t\tsubprocess,\n\t\t\twaitWritableFinal,\n\t\t\twaitWritableDestroy,\n\t\t})),\n\t\thighWaterMark: subprocessStdin.writableHighWaterMark,\n\t\tobjectMode: subprocessStdin.writableObjectMode,\n\t});\n\tonStdinFinished(subprocessStdin, writable, undefined, subprocess);\n\treturn writable;\n};\n\n// Retrieve `stdin` (or other stream depending on `to`)\nexport const getSubprocessStdin = (subprocess, to, concurrentStreams) => {\n\tconst subprocessStdin = getToStream(subprocess, to);\n\tconst waitWritableFinal = addConcurrentStream(concurrentStreams, subprocessStdin, 'writableFinal');\n\tconst waitWritableDestroy = addConcurrentStream(concurrentStreams, subprocessStdin, 'writableDestroy');\n\treturn {subprocessStdin, waitWritableFinal, waitWritableDestroy};\n};\n\nexport const getWritableMethods = (subprocessStdin, subprocess, waitWritableFinal) => ({\n\twrite: onWrite.bind(undefined, subprocessStdin),\n\tfinal: callbackify(onWritableFinal.bind(undefined, subprocessStdin, subprocess, waitWritableFinal)),\n});\n\n// Forwards data from `writable` to `stdin`\nconst onWrite = (subprocessStdin, chunk, encoding, done) => {\n\tif (subprocessStdin.write(chunk, encoding)) {\n\t\tdone();\n\t} else {\n\t\tsubprocessStdin.once('drain', done);\n\t}\n};\n\n// Ensures that the writable `final` and readable `end` events awaits the subprocess.\n// Like this, any subprocess failure is propagated as a stream `error` event, instead of being lost.\n// The user does not need to `await` the subprocess anymore, but now needs to await the stream completion or error.\n// When multiple writables are targeting the same stream, they wait for each other, unless the subprocess ends first.\nconst onWritableFinal = async (subprocessStdin, subprocess, waitWritableFinal) => {\n\tif (!await waitForConcurrentStreams(waitWritableFinal, subprocess)) {\n\t\treturn;\n\t}\n\n\tif (subprocessStdin.writable) {\n\t\tsubprocessStdin.end();\n\t}\n\n\tawait subprocess;\n};\n\n// When `subprocess.stdin` ends/aborts/errors, do the same on `writable`.\nexport const onStdinFinished = async (subprocessStdin, writable, subprocessStdout, subprocess) => {\n\ttry {\n\t\tawait waitForSubprocessStdin(subprocessStdin);\n\t\tawait subprocess;\n\t\tif (writable.writable) {\n\t\t\twritable.end();\n\t\t}\n\t} catch (error) {\n\t\tawait safeWaitForSubprocessStdout(subprocessStdout);\n\t\tdestroyOtherWritable(writable, await getSubprocessError(subprocess, error));\n\t}\n};\n\nconst getSubprocessError = async (subprocess, error) => {\n\tif (!shouldUseSubprocessError(error)) {\n\t\treturn error;\n\t}\n\n\ttry {\n\t\tawait subprocess;\n\t} catch (subprocessError) {\n\t\treturn subprocessError;\n\t}\n\n\treturn error;\n};\n\nconst shouldUseSubprocessError = error => error === undefined\n\t|| isStreamAbort(error);\n\n// When `writable` aborts/errors, do the same on `subprocess.stdin`\nexport const onWritableDestroy = async ({subprocessStdin, subprocess, waitWritableFinal, waitWritableDestroy}, error) => {\n\tawait waitForConcurrentStreams(waitWritableFinal, subprocess);\n\tif (await waitForConcurrentStreams(waitWritableDestroy, subprocess)) {\n\t\tdestroyOtherWritable(subprocessStdin, error);\n\t\tawait waitForSubprocess(subprocess, error);\n\t}\n};\n\nconst destroyOtherWritable = (stream, error) => {\n\tdestroyOtherStream(stream, stream.writable, error);\n};\n", "import {Duplex} from 'node:stream';\nimport {callbackify} from 'node:util';\nimport {BINARY_ENCODINGS} from '../arguments/encoding-option.js';\nimport {\n\tgetSubprocessStdout,\n\tgetReadableOptions,\n\tgetReadableMethods,\n\tonStdoutFinished,\n\tonReadableDestroy,\n} from './readable.js';\nimport {\n\tgetSubprocessStdin,\n\tgetWritableMethods,\n\tonStdinFinished,\n\tonWritableDestroy,\n} from './writable.js';\n\n// Create a `Duplex` stream combining both `subprocess.readable()` and `subprocess.writable()`\nexport const createDuplex = ({subprocess, concurrentStreams, encoding}, {from, to, binary: binaryOption = true, preserveNewlines = true} = {}) => {\n\tconst binary = binaryOption || BINARY_ENCODINGS.has(encoding);\n\tconst {subprocessStdout, waitReadableDestroy} = getSubprocessStdout(subprocess, from, concurrentStreams);\n\tconst {subprocessStdin, waitWritableFinal, waitWritableDestroy} = getSubprocessStdin(subprocess, to, concurrentStreams);\n\tconst {readableEncoding, readableObjectMode, readableHighWaterMark} = getReadableOptions(subprocessStdout, binary);\n\tconst {read, onStdoutDataDone} = getReadableMethods({\n\t\tsubprocessStdout,\n\t\tsubprocess,\n\t\tbinary,\n\t\tencoding,\n\t\tpreserveNewlines,\n\t});\n\tconst duplex = new Duplex({\n\t\tread,\n\t\t...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),\n\t\tdestroy: callbackify(onDuplexDestroy.bind(undefined, {\n\t\t\tsubprocessStdout,\n\t\t\tsubprocessStdin,\n\t\t\tsubprocess,\n\t\t\twaitReadableDestroy,\n\t\t\twaitWritableFinal,\n\t\t\twaitWritableDestroy,\n\t\t})),\n\t\treadableHighWaterMark,\n\t\twritableHighWaterMark: subprocessStdin.writableHighWaterMark,\n\t\treadableObjectMode,\n\t\twritableObjectMode: subprocessStdin.writableObjectMode,\n\t\tencoding: readableEncoding,\n\t});\n\tonStdoutFinished({\n\t\tsubprocessStdout,\n\t\tonStdoutDataDone,\n\t\treadable: duplex,\n\t\tsubprocess,\n\t\tsubprocessStdin,\n\t});\n\tonStdinFinished(subprocessStdin, duplex, subprocessStdout, subprocess);\n\treturn duplex;\n};\n\nconst onDuplexDestroy = async ({subprocessStdout, subprocessStdin, subprocess, waitReadableDestroy, waitWritableFinal, waitWritableDestroy}, error) => {\n\tawait Promise.all([\n\t\tonReadableDestroy({subprocessStdout, subprocess, waitReadableDestroy}, error),\n\t\tonWritableDestroy({\n\t\t\tsubprocessStdin,\n\t\t\tsubprocess,\n\t\t\twaitWritableFinal,\n\t\t\twaitWritableDestroy,\n\t\t}, error),\n\t]);\n};\n", "import {initializeConcurrentStreams} from './concurrent.js';\nimport {createReadable} from './readable.js';\nimport {createWritable} from './writable.js';\nimport {createDuplex} from './duplex.js';\nimport {createReadableStream, createWritableStream, createTransformStream} from './web.js';\nimport {createIterable} from './iterable.js';\n\n// Add methods to convert the subprocess to a stream or iterable\nexport const addConvertedStreams = (subprocess, {encoding}) => {\n\tconst concurrentStreams = initializeConcurrentStreams();\n\tsubprocess.readable = createReadable.bind(undefined, {subprocess, concurrentStreams, encoding});\n\tsubprocess.writable = createWritable.bind(undefined, {subprocess, concurrentStreams});\n\tsubprocess.duplex = createDuplex.bind(undefined, {subprocess, concurrentStreams, encoding});\n\tsubprocess.readableStream = createReadableStream.bind(undefined, subprocess);\n\tsubprocess.writableStream = createWritableStream.bind(undefined, subprocess);\n\tsubprocess.transformStream = createTransformStream.bind(undefined, subprocess);\n\tsubprocess.iterable = createIterable.bind(undefined, subprocess, encoding);\n\tsubprocess[Symbol.asyncIterator] = createIterable.bind(undefined, subprocess, encoding, {});\n};\n", "// The return value is a native Promise with Execa-specific properties.\nexport const mergePromise = (promise, properties) => Object.assign(promise, properties);\n", "import isPlainObject from 'is-plain-obj';\nimport {FD_SPECIFIC_OPTIONS} from '../arguments/specific.js';\n\n// Deep merge specific options like `env`. Shallow merge the other ones.\n// Use spread (which only copies own properties) to safely read from boundOptions without prototype pollution\nexport const mergeOptions = (boundOptions, options) => {\n\tconst safeBoundOptions = {__proto__: null, ...boundOptions};\n\tconst mergedOptions = Object.fromEntries(Object.entries(options).map(([optionName, optionValue]) => [\n\t\toptionName,\n\t\tmergeOption(optionName, safeBoundOptions[optionName], optionValue),\n\t]));\n\treturn {...safeBoundOptions, ...mergedOptions};\n};\n\nconst mergeOption = (optionName, boundOptionValue, optionValue) => {\n\tif (DEEP_OPTIONS.has(optionName) && isPlainObject(boundOptionValue) && isPlainObject(optionValue)) {\n\t\treturn {...boundOptionValue, ...optionValue};\n\t}\n\n\treturn optionValue;\n};\n\nconst DEEP_OPTIONS = new Set(['env', ...FD_SPECIFIC_OPTIONS]);\n", "import isPlainObject from 'is-plain-obj';\nimport {normalizeParameters} from './parameters.js';\nimport {isTemplateString, parseTemplates} from './template.js';\nimport {execaCoreSync} from './main-sync.js';\nimport {execaCoreAsync} from './main-async.js';\nimport {mergeOptions} from './bind.js';\n\n// Wraps every exported methods to provide the following features:\n// - template string syntax: execa`command argument`\n// - options binding: boundExeca = execa(options)\n// - optional argument/options: execa(file), execa(file, args), execa(file, options), execa(file, args, options)\n// `mapArguments()` and `setBoundExeca()` allows for method-specific logic.\nexport const createExeca = (mapArguments, boundOptions, deepOptions, setBoundExeca) => {\n\tconst createNested = (mapArguments, boundOptions, setBoundExeca) => createExeca(mapArguments, boundOptions, deepOptions, setBoundExeca);\n\tconst boundExeca = (...execaArguments) => callBoundExeca({\n\t\tmapArguments,\n\t\tdeepOptions,\n\t\tboundOptions,\n\t\tsetBoundExeca,\n\t\tcreateNested,\n\t}, ...execaArguments);\n\n\tif (setBoundExeca !== undefined) {\n\t\tsetBoundExeca(boundExeca, createNested, boundOptions);\n\t}\n\n\treturn boundExeca;\n};\n\nconst callBoundExeca = ({mapArguments, deepOptions = {}, boundOptions = {}, setBoundExeca, createNested}, firstArgument, ...nextArguments) => {\n\tif (isPlainObject(firstArgument)) {\n\t\treturn createNested(mapArguments, mergeOptions(boundOptions, firstArgument), setBoundExeca);\n\t}\n\n\tconst {file, commandArguments, options, isSync} = parseArguments({\n\t\tmapArguments,\n\t\tfirstArgument,\n\t\tnextArguments,\n\t\tdeepOptions,\n\t\tboundOptions,\n\t});\n\treturn isSync\n\t\t? execaCoreSync(file, commandArguments, options)\n\t\t: execaCoreAsync(file, commandArguments, options, createNested);\n};\n\nconst parseArguments = ({mapArguments, firstArgument, nextArguments, deepOptions, boundOptions}) => {\n\tconst callArguments = isTemplateString(firstArgument)\n\t\t? parseTemplates(firstArgument, nextArguments)\n\t\t: [firstArgument, ...nextArguments];\n\tconst [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);\n\tconst mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);\n\tconst {\n\t\toptions = mergedOptions,\n\t\tisSync = false,\n\t} = mapArguments({options: mergedOptions});\n\treturn {\n\t\tfile: initialFile,\n\t\tcommandArguments: initialArguments,\n\t\toptions,\n\t\tisSync,\n\t};\n};\n", "// Sets `$.sync` and `$.s`\nexport const setScriptSync = (boundExeca, createNested, boundOptions) => {\n\tboundExeca.sync = createNested(mapScriptSync, boundOptions);\n\tboundExeca.s = boundExeca.sync;\n};\n\n// Main logic for `$`\nexport const mapScriptAsync = ({options}) => getScriptOptions(options);\n\n// Main logic for `$.sync`\nconst mapScriptSync = ({options}) => ({...getScriptOptions(options), isSync: true});\n\n// `$` is like `execa` but with script-friendly options: `{stdin: 'inherit', preferLocal: true}`\nconst getScriptOptions = options => ({options: {...getScriptStdinOption(options), ...options}});\n\nconst getScriptStdinOption = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined\n\t? {stdin: 'inherit'}\n\t: {};\n\n// When using $(...).pipe(...), most script-friendly options should apply to both commands.\n// However, some options (like `stdin: 'inherit'`) would create issues with piping, i.e. cannot be deep.\nexport const deepScriptOptions = {preferLocal: true};\n", "import {createExeca} from './lib/methods/create.js';\nimport {mapNode} from './lib/methods/node.js';\nimport {mapScriptAsync, setScriptSync, deepScriptOptions} from './lib/methods/script.js';\nimport {getIpcExport} from './lib/ipc/methods.js';\n\nexport {parseCommandString} from './lib/methods/command.js';\nexport {ExecaError, ExecaSyncError} from './lib/return/final-error.js';\n\nexport const execa = createExeca(() => ({}));\nexport const execaSync = createExeca(() => ({isSync: true}));\nexport const execaNode = createExeca(mapNode);\nexport const $ = createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);\n\nconst {\n\tsendMessage,\n\tgetOneMessage,\n\tgetEachMessage,\n\tgetCancelSignal,\n} = getIpcExport();\nexport {\n\tsendMessage,\n\tgetOneMessage,\n\tgetEachMessage,\n\tgetCancelSignal,\n};\n", "import { createHash } from \"node:crypto\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, relative, resolve } from \"node:path\";\nimport type { CapabilityLock, RuntimeId } from \"@portable-capabilities/contracts\";\nimport { productionIntegrityDigest } from \"@portable-capabilities/renderer-core\";\n\nasync function findLocks(root: string): Promise<readonly string[]> {\n const locks: string[] = [];\n async function visit(directory: string): Promise<void> {\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n if (entry.name === \"node_modules\" || entry.name === \".git\") continue;\n const path = resolve(directory, entry.name);\n if (entry.isDirectory()) await visit(path);\n else if (entry.name === \"capability.lock.json\") locks.push(path);\n }\n }\n await visit(root);\n return Object.freeze(locks.sort());\n}\n\nfunction within(root: string, path: string): boolean {\n const rel = relative(root, path);\n return rel === \"\" || (!rel.startsWith(\"..\") && !isAbsolute(rel));\n}\n\nfunction digest(content: Uint8Array): string {\n return createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nfunction verifyLayer(lock: CapabilityLock): void {\n if (\n productionIntegrityDigest({\n parent: lock.integrity.canonical.parent,\n inputs: lock.integrity.canonical.inputs,\n }) !== lock.integrity.canonical.digest\n ) {\n throw new Error(\"Canonical integrity digest mismatch\");\n }\n if (\n productionIntegrityDigest({\n parent: lock.integrity.projection.parent,\n inputs: lock.integrity.projection.inputs,\n }) !== lock.integrity.projection.digest\n ) {\n throw new Error(\"Projection integrity digest mismatch\");\n }\n if (\n productionIntegrityDigest({\n parent: lock.integrity.package.parent,\n inputs: lock.integrity.package.inputs,\n }) !== lock.integrity.package.digest\n ) {\n throw new Error(\"Package integrity digest mismatch\");\n }\n}\n\nexport interface VerifiedCapabilityEntrypoint {\n readonly lock: CapabilityLock;\n readonly lockPath: string;\n readonly entrypointPath: string;\n readonly executable: string;\n readonly argv: readonly string[];\n}\n\nexport async function resolveVerifiedCapabilityEntrypoint(options: {\n readonly packageRoot: string;\n readonly runtimeId: RuntimeId;\n readonly roleId: string;\n}): Promise<VerifiedCapabilityEntrypoint> {\n const packageRoot = resolve(options.packageRoot);\n const matches: Array<{ lock: CapabilityLock; lockPath: string }> = [];\n for (const lockPath of await findLocks(packageRoot)) {\n const lock = JSON.parse(await readFile(lockPath, \"utf8\")) as CapabilityLock;\n if (lock.roleId === options.roleId && lock.runtimeId === options.runtimeId) {\n matches.push({ lock, lockPath });\n }\n }\n if (matches.length !== 1) {\n throw new Error(\n matches.length === 0\n ? `No verified capability lock found for ${options.runtimeId}/${options.roleId}`\n : `Multiple capability locks found for ${options.runtimeId}/${options.roleId}`,\n );\n }\n const selected = matches[0];\n if (!selected) throw new Error(\"Capability lock selection failed\");\n if (selected.lock.schemaVersion !== \"2.0.0\") throw new Error(\"Unsupported capability lock\");\n verifyLayer(selected.lock);\n\n const lockRoot = dirname(selected.lockPath);\n for (const resource of selected.lock.resources) {\n const resourcePath = resolve(lockRoot, resource.path);\n if (!within(packageRoot, resourcePath))\n throw new Error(`Resource escapes package root: ${resource.path}`);\n if (digest(await readFile(resourcePath)) !== resource.digest) {\n throw new Error(`Resource digest mismatch: ${resource.path}`);\n }\n }\n\n const primitivePlan = selected.lock.graph.primitivePlan as {\n readonly discovery?: { readonly authoritativeNativeFiles?: readonly string[] };\n };\n const entrypoint = primitivePlan.discovery?.authoritativeNativeFiles?.[0];\n if (!entrypoint) throw new Error(\"Capability lock has no authoritative native entrypoint\");\n const entrypointPath = resolve(packageRoot, entrypoint);\n if (!within(packageRoot, entrypointPath))\n throw new Error(\"Capability entrypoint escapes package root\");\n await readFile(entrypointPath);\n\n const sandboxEntrypoint = resolve(\"/mnt\", relative(packageRoot, entrypointPath));\n return Object.freeze({\n lock: selected.lock,\n lockPath: selected.lockPath,\n entrypointPath,\n executable: process.execPath,\n argv: Object.freeze([\n \"-e\",\n \"process.stdout.write(require('node:fs').readFileSync(process.argv[1], 'utf8'))\",\n sandboxEntrypoint,\n ]),\n });\n}\n", "import {\n type OperationalSkillContract,\n operationalSectionNames,\n validateOperationalSkillContract,\n} from \"@portable-capabilities/contracts\";\n\nconst headings: Readonly<Record<(typeof operationalSectionNames)[number], string>> = {\n activation: \"Activation\",\n inputs: \"Inputs\",\n procedure: \"Ordered procedure\",\n decisions: \"Decisions\",\n resources: \"Resource loading\",\n ambiguityAndAbstention: \"Ambiguity and abstention\",\n stopConditions: \"Stop conditions\",\n outputConstruction: \"Output construction\",\n validation: \"Validation\",\n examples: \"Examples\",\n};\n\nexport function renderOperationalSections(contract: OperationalSkillContract): string {\n validateOperationalSkillContract(contract);\n return operationalSectionNames\n .map((section) => {\n const lines = contract[section].map((entry, index) => `${index + 1}. ${entry}`).join(\"\\n\");\n return `## ${headings[section]}\\n\\n${lines}`;\n })\n .join(\"\\n\\n\");\n}\n\nexport function validateRenderedOperationalSkill(\n markdown: string,\n availableResources: readonly string[],\n): readonly string[] {\n const diagnostics: string[] = [];\n for (const heading of Object.values(headings)) {\n if (!markdown.includes(`## ${heading}`))\n diagnostics.push(`missing operational section: ${heading}`);\n }\n for (const match of markdown.matchAll(/\\[resource:([^\\]]+)\\]/g)) {\n const resource = match[1];\n if (resource && !availableResources.includes(resource)) {\n diagnostics.push(`missing required resource: ${resource}`);\n }\n }\n return diagnostics;\n}\n", "import { createHash } from \"node:crypto\";\nimport type { CapabilityLock, GeneratedFile, RuntimeId } from \"@portable-capabilities/contracts\";\nimport type { RuntimeAdapter } from \"./adapter.js\";\nimport {\n renderOperationalSections,\n validateRenderedOperationalSkill,\n} from \"./instruction-sections.js\";\nimport { productionIntegrityDigest } from \"./projection.js\";\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\ninterface NativeRegistrationRecord {\n readonly runtime?: unknown;\n readonly role?: unknown;\n readonly primitive?: unknown;\n readonly context?: unknown;\n readonly isolation?: unknown;\n}\n\ninterface NativePermissionRecord {\n readonly model?: unknown;\n readonly repositoryWrites?: unknown;\n}\n\nexport function digestGeneratedFiles(files: readonly GeneratedFile[]): string {\n const hash = createHash(\"sha256\");\n for (const file of [...files].sort((left, right) => left.path.localeCompare(right.path))) {\n hash.update(file.path);\n hash.update(file.content);\n }\n return hash.digest(\"hex\");\n}\n\nfunction activationArtifactPath(ir: Parameters<RuntimeAdapter[\"render\"]>[0]): string | undefined {\n const packageRoot = `${ir.runtime.nativeRoot.replace(/\\/$/, \"\")}/${ir.role.id}/`;\n return ir.primitivePlan.emittedFiles.find((path) => !path.startsWith(packageRoot));\n}\n\nfunction internalRegistrationContent(ir: Parameters<RuntimeAdapter[\"render\"]>[0]): string {\n return `${JSON.stringify(\n {\n schemaVersion: \"1.0\",\n classification: \"portable-projection-metadata\",\n runtime: ir.runtime.id,\n role: ir.role.id,\n primitive: ir.primitivePlan.primitive,\n activationArtifact:\n activationArtifactPath(ir) ?? `${ir.runtime.nativeRoot}/${ir.role.id}/SKILL.md`,\n behavioralCore: `${ir.runtime.nativeRoot}/${ir.role.id}/SKILL.md`,\n context: ir.primitivePlan.context,\n isolation: ir.primitivePlan.isolation,\n },\n null,\n 2,\n )}\\n`;\n}\n\nfunction internalPermissionContent(ir: Parameters<RuntimeAdapter[\"render\"]>[0]): string {\n return `${JSON.stringify(\n {\n schemaVersion: \"1.0\",\n classification: \"portable-projection-metadata\",\n model: ir.primitivePlan.permission,\n filesystem: ir.primitivePlan.effects.filesystem,\n network: ir.primitivePlan.effects.network,\n shell: ir.primitivePlan.effects.shell,\n repositoryWrites: ir.primitivePlan.effects.repositoryWrites,\n },\n null,\n 2,\n )}\\n`;\n}\n\nfunction activationArtifactContent(ir: Parameters<RuntimeAdapter[\"render\"]>[0]): string {\n const core = `${ir.runtime.nativeRoot}/${ir.role.id}/SKILL.md`;\n const description = ir.role.purpose.replace(/\\n/g, \" \");\n switch (ir.runtime.id) {\n case \"opencode\":\n return `---\\ndescription: ${description}\\nmode: subagent\\npermission:\\n edit: deny\\n bash: deny\\n---\\n\\nLoad and follow @${core}. Validate output against @${ir.runtime.nativeRoot}/${ir.role.id}/resources/output.schema.json.\\n`;\n case \"claude-code\":\n return `---\\nname: ${ir.role.id}\\ndescription: ${description}\\ntools: Read, Grep, Glob\\npermissionMode: plan\\nskills:\\n - ${ir.role.id}\\n---\\n\\nUse the preloaded ${ir.role.id} skill as the behavioral core.\\n`;\n case \"codex\":\n return `name = ${JSON.stringify(ir.role.id)}\\ndescription = ${JSON.stringify(description)}\\nsandbox_mode = \"read-only\"\\ndeveloper_instructions = ${JSON.stringify(`Load and follow ${core}. Validate output against ${ir.runtime.nativeRoot}/${ir.role.id}/resources/output.schema.json.`)}\\n`;\n case \"pi\":\n return `import type { ExtensionAPI } from \"@mariozechner/pi-coding-agent\";\\n\\nexport default function portableCapability(pi: ExtensionAPI) {\\n pi.registerCommand(${JSON.stringify(ir.role.id)}, {\\n description: ${JSON.stringify(description)},\\n handler: async (_args, ctx) => {\\n pi.sendUserMessage(${JSON.stringify(`Load and follow ${core}. Validate output against ${ir.runtime.nativeRoot}/${ir.role.id}/resources/output.schema.json.`)});\\n await ctx.waitForIdle();\\n },\\n });\\n}\\n`;\n case \"antigravity\":\n return `---\\ndescription: ${description}\\n---\\n\\nLoad and follow @${core}. Validate output against @${ir.runtime.nativeRoot}/${ir.role.id}/resources/output.schema.json.\\n`;\n default:\n throw new Error(\n `No verified native renderer for ${ir.runtime.id}/${ir.primitivePlan.primitive}`,\n );\n }\n}\n\nfunction decodeLock(file: GeneratedFile | undefined): CapabilityLock | undefined {\n if (!file) return undefined;\n try {\n return JSON.parse(decoder.decode(file.content)) as CapabilityLock;\n } catch {\n return undefined;\n }\n}\n\nexport function createNativeAdapter(id: RuntimeId, version = \"1.0.0\"): RuntimeAdapter {\n return {\n id,\n version,\n async render(ir) {\n if (ir.runtime.id !== id) {\n throw new Error(`Adapter ${id} cannot render runtime ${ir.runtime.id}`);\n }\n if (!ir.runtime.supportedPrimitives.includes(ir.primitivePlan.primitive)) {\n throw new Error(\n `Runtime ${id} does not support planned primitive ${ir.primitivePlan.primitive}`,\n );\n }\n\n const root = ir.runtime.nativeRoot.replace(/\\/$/, \"\");\n const packageRoot = `${root}/${ir.role.id}`;\n const operationalBody = renderOperationalSections(ir.operationalSkill);\n const skill = `---\nname: ${ir.role.id}\ndescription: ${ir.role.purpose}\ngenerated: true\nruntime: ${id}\npermissions:\n filesystem: read-only\n shell: denied\n repositoryWrites: denied\n---\n\n# ${ir.role.taxonomy.displayName}\n\n> Generated by portable-capabilities. Do not edit by hand.\n\nSee [contract](resources/contract.json) and [output schema](resources/output.schema.json).\n\n${operationalBody}\n`;\n const nativeFiles: GeneratedFile[] = [\n {\n path: `${packageRoot}/portable/registration.json`,\n content: encoder.encode(internalRegistrationContent(ir)),\n },\n {\n path: `${packageRoot}/portable/permissions.json`,\n content: encoder.encode(internalPermissionContent(ir)),\n },\n ];\n const activationPath = activationArtifactPath(ir);\n if (ir.primitivePlan.primitive !== \"skill\") {\n if (!activationPath) {\n throw new Error(`No verified native renderer for ${id}/${ir.primitivePlan.primitive}`);\n }\n nativeFiles.push({\n path: activationPath,\n content: encoder.encode(activationArtifactContent(ir)),\n });\n }\n const base: GeneratedFile[] = [\n { path: `${packageRoot}/SKILL.md`, content: encoder.encode(skill) },\n ...ir.resources.map((resource) => ({\n path: `${packageRoot}/${resource.path}`,\n content: encoder.encode(resource.content),\n })),\n ...nativeFiles,\n ];\n const resources = ir.resources\n .map((resource) => ({\n path: resource.path,\n mediaType: resource.mediaType,\n digest: createHash(\"sha256\").update(resource.content).digest(\"hex\"),\n }))\n .sort((left, right) => left.path.localeCompare(right.path));\n const packageInputs = {\n files: [...base]\n .sort((left, right) => left.path.localeCompare(right.path))\n .map((file) => ({\n path: file.path,\n digest: createHash(\"sha256\").update(file.content).digest(\"hex\"),\n mode: 0o644,\n })),\n resources: resources.map((resource) => resource.path),\n };\n const packageLayer = Object.freeze({\n algorithm: \"sha256\" as const,\n parent: ir.integrity.projection.digest,\n inputs: packageInputs,\n digest: productionIntegrityDigest({\n parent: ir.integrity.projection.digest,\n inputs: packageInputs,\n }),\n });\n const lock: CapabilityLock = {\n schemaVersion: \"2.0.0\",\n roleId: ir.role.id,\n runtimeId: id,\n compilerVersion: \"0.1.0\",\n adapterVersion: version,\n sourcePaths: [\n ...new Set([\n ...ir.primitivePlan.provenance,\n ir.role.sourceFile,\n ir.role.outputSchema.sourceFile,\n ]),\n ].sort(),\n canonicalDigest: ir.integrity.canonical.digest,\n projectionDigest: ir.integrity.projection.digest,\n generatedDigest: packageLayer.digest,\n integrity: {\n canonical: ir.integrity.canonical,\n projection: ir.integrity.projection,\n package: packageLayer,\n },\n graph: {\n role: ir.role,\n runtimeProfile: ir.runtime,\n primitivePlan: ir.primitivePlan,\n operationalSkill: ir.operationalSkill,\n resources,\n },\n resources,\n };\n const rendered = [\n ...base,\n {\n path: `${packageRoot}/capability.lock.json`,\n content: encoder.encode(`${JSON.stringify(lock, null, 2)}\\n`),\n },\n ];\n const actualPaths = rendered.map((file) => file.path).sort();\n const plannedPaths = [...ir.primitivePlan.emittedFiles].sort();\n if (JSON.stringify(actualPaths) !== JSON.stringify(plannedPaths)) {\n throw new Error(`Rendered files do not satisfy PrimitivePlan for ${id}/${ir.role.id}`);\n }\n return Object.freeze(rendered);\n },\n validate(files, ir) {\n const diagnostics: string[] = [];\n const packageRoot = `${ir.runtime.nativeRoot.replace(/\\/$/, \"\")}/${ir.role.id}`;\n const prefix = `${packageRoot}/`;\n const skill = files.find((file) => file.path === `${prefix}SKILL.md`);\n const lockFile = files.find((file) => file.path === `${prefix}capability.lock.json`);\n const lock = decodeLock(lockFile);\n const registration = files.find(\n (file) => file.path === `${prefix}portable/registration.json`,\n );\n const permissions = files.find((file) => file.path === `${prefix}portable/permissions.json`);\n const expectedActivationPath = activationArtifactPath(ir);\n const primitiveArtifact = expectedActivationPath\n ? files.find((file) => file.path === expectedActivationPath)\n : undefined;\n const actualPaths = files.map((file) => file.path).sort();\n const plannedPaths = [...ir.primitivePlan.emittedFiles].sort();\n if (JSON.stringify(actualPaths) !== JSON.stringify(plannedPaths)) {\n diagnostics.push(\"rendered file set does not match PrimitivePlan\");\n }\n\n if (ir.runtime.id !== id)\n diagnostics.push(`adapter/runtime mismatch: ${id}/${ir.runtime.id}`);\n if (!skill) diagnostics.push(\"missing native SKILL.md\");\n if (!registration) diagnostics.push(\"missing portable projection registration\");\n if (!permissions) diagnostics.push(\"missing portable projection permissions\");\n if (ir.primitivePlan.primitive !== \"skill\" && !primitiveArtifact) {\n diagnostics.push(`missing client activation artifact: ${ir.primitivePlan.primitive}`);\n }\n if (!lockFile) diagnostics.push(\"missing capability lock\");\n if (skill && skill.content.byteLength > ir.runtime.limits.maxInitialBytes) {\n diagnostics.push(\"initial skill exceeds runtime byte limit\");\n }\n for (const file of files) {\n if (!file.path.startsWith(prefix) && file.path !== expectedActivationPath)\n diagnostics.push(`unexpected path outside portable package: ${file.path}`);\n if (\n file.path.includes(\"/resources/\") &&\n file.content.byteLength > ir.runtime.limits.maxResourceBytes\n ) {\n diagnostics.push(`resource exceeds runtime byte limit: ${file.path}`);\n }\n }\n for (const resource of ir.resources) {\n if (!files.some((file) => file.path === `${prefix}${resource.path}`)) {\n diagnostics.push(`missing projected resource: ${resource.path}`);\n }\n }\n if (registration) {\n try {\n const value = JSON.parse(\n decoder.decode(registration.content),\n ) as NativeRegistrationRecord;\n if (value.runtime !== id) diagnostics.push(\"registration runtime mismatch\");\n if (value.role !== ir.role.id) diagnostics.push(\"registration role mismatch\");\n if (value.primitive !== ir.primitivePlan.primitive)\n diagnostics.push(\"registration primitive mismatch\");\n if (value.context !== ir.primitivePlan.context)\n diagnostics.push(\"registration context mismatch\");\n if (value.isolation !== ir.primitivePlan.isolation)\n diagnostics.push(\"registration isolation mismatch\");\n } catch {\n diagnostics.push(\"invalid native registration JSON\");\n }\n }\n if (permissions) {\n try {\n const value = JSON.parse(decoder.decode(permissions.content)) as NativePermissionRecord;\n if (value.model !== ir.primitivePlan.permission)\n diagnostics.push(\"native permission model mismatch\");\n if (value.repositoryWrites !== ir.primitivePlan.effects.repositoryWrites)\n diagnostics.push(\"native repository-write permission mismatch\");\n } catch {\n diagnostics.push(\"invalid native permissions JSON\");\n }\n }\n if (primitiveArtifact) {\n const text = decoder.decode(primitiveArtifact.content);\n const core = `${ir.runtime.nativeRoot}/${ir.role.id}/SKILL.md`;\n if (\n !text.includes(core) &&\n !text.includes(`skills:\n - ${ir.role.id}`)\n ) {\n diagnostics.push(\"client activation artifact does not delegate to behavioral core\");\n }\n }\n if (skill) {\n const text = decoder.decode(skill.content);\n const availableResources = files\n .filter((file) => file.path.startsWith(`${prefix}resources/`))\n .map((file) => file.path.slice(prefix.length));\n const operationalDiagnostics = validateRenderedOperationalSkill(text, availableResources);\n diagnostics.push(...operationalDiagnostics);\n for (const required of [\n \"generated: true\",\n `runtime: ${id}`,\n \"filesystem: read-only\",\n \"shell: denied\",\n \"repositoryWrites: denied\",\n \"Do not edit by hand\",\n ]) {\n if (!text.includes(required)) diagnostics.push(`missing skill metadata: ${required}`);\n }\n }\n if (!lock) {\n if (lockFile) diagnostics.push(\"invalid capability lock JSON\");\n } else {\n if (lock.roleId !== ir.role.id) diagnostics.push(\"lock role mismatch\");\n if (lock.runtimeId !== id) diagnostics.push(\"lock runtime mismatch\");\n if (lock.schemaVersion !== \"2.0.0\") diagnostics.push(\"lock schema version mismatch\");\n if (lock.canonicalDigest !== ir.integrity.canonical.digest)\n diagnostics.push(\"lock canonical digest mismatch\");\n if (lock.projectionDigest !== ir.integrity.projection.digest)\n diagnostics.push(\"lock projection digest mismatch\");\n if (lock.integrity?.canonical.digest !== ir.integrity.canonical.digest)\n diagnostics.push(\"lock canonical layer mismatch\");\n if (lock.integrity?.projection.digest !== ir.integrity.projection.digest)\n diagnostics.push(\"lock projection layer mismatch\");\n if (lock.integrity?.projection.parent !== lock.integrity?.canonical.digest)\n diagnostics.push(\"lock projection parent mismatch\");\n if (lock.adapterVersion !== version) diagnostics.push(\"lock adapter version mismatch\");\n if (!lock.compilerVersion) diagnostics.push(\"lock compiler version missing\");\n if (!lock.sourcePaths.includes(ir.role.sourceFile))\n diagnostics.push(\"lock role source path missing\");\n if (!lock.sourcePaths.includes(ir.role.outputSchema.sourceFile))\n diagnostics.push(\"lock output schema source path missing\");\n if (productionIntegrityDigest(lock.graph?.role) !== productionIntegrityDigest(ir.role))\n diagnostics.push(\"lock role graph mismatch\");\n if (\n productionIntegrityDigest(lock.graph?.runtimeProfile) !==\n productionIntegrityDigest(ir.runtime)\n )\n diagnostics.push(\"lock runtime profile graph mismatch\");\n if (\n productionIntegrityDigest(lock.graph?.primitivePlan) !==\n productionIntegrityDigest(ir.primitivePlan)\n )\n diagnostics.push(\"lock primitive plan graph mismatch\");\n if (\n productionIntegrityDigest(lock.graph?.operationalSkill) !==\n productionIntegrityDigest(ir.operationalSkill)\n )\n diagnostics.push(\"lock operational instruction graph mismatch\");\n const expectedResourcePaths = ir.resources.map((resource) => resource.path).sort();\n const lockedResourcePaths = (lock.resources ?? []).map((resource) => resource.path).sort();\n if (JSON.stringify(lockedResourcePaths) !== JSON.stringify(expectedResourcePaths))\n diagnostics.push(\"lock resource inventory mismatch\");\n for (const resource of ir.resources) {\n const locked = lock.resources?.find((item) => item.path === resource.path);\n if (!locked) {\n diagnostics.push(`lock resource missing: ${resource.path}`);\n continue;\n }\n const digest = createHash(\"sha256\").update(resource.content).digest(\"hex\");\n if (locked.digest !== digest)\n diagnostics.push(`lock resource digest mismatch: ${resource.path}`);\n if (locked.mediaType !== resource.mediaType)\n diagnostics.push(`lock resource media type mismatch: ${resource.path}`);\n }\n const base = files.filter((file) => !file.path.endsWith(\"/capability.lock.json\"));\n const packageInputs = {\n files: [...base]\n .sort((left, right) => left.path.localeCompare(right.path))\n .map((file) => ({\n path: file.path,\n digest: createHash(\"sha256\").update(file.content).digest(\"hex\"),\n mode: 0o644,\n })),\n resources: expectedResourcePaths,\n };\n const expectedPackageDigest = productionIntegrityDigest({\n parent: ir.integrity.projection.digest,\n inputs: packageInputs,\n });\n if (lock.integrity?.package.parent !== ir.integrity.projection.digest)\n diagnostics.push(\"lock package parent mismatch\");\n if (lock.integrity?.package.digest !== expectedPackageDigest)\n diagnostics.push(\"lock package digest mismatch\");\n if (lock.generatedDigest !== expectedPackageDigest)\n diagnostics.push(\"lock generated digest mismatch\");\n }\n return { valid: diagnostics.length === 0, diagnostics };\n },\n };\n}\n", "import { createHash } from \"node:crypto\";\nimport { posix } from \"node:path\";\nimport type {\n OperationalSkillContract,\n ProjectionIR,\n ResolvedRole,\n RuntimeProfileDefinition,\n} from \"@portable-capabilities/contracts\";\nimport {\n createPrimitivePlan,\n validateOperationalSkillContract,\n} from \"@portable-capabilities/contracts\";\nimport { schemaDocument } from \"@portable-capabilities/schemas\";\nexport interface ResourceClosureInput {\n readonly path: string;\n readonly mediaType: string;\n readonly content?: string;\n readonly source?: string;\n}\n\nexport function compileResourceClosure(\n resources: readonly ResourceClosureInput[],\n): readonly { path: string; mediaType: string; content: string }[] {\n const seen = new Set<string>();\n return Object.freeze(\n resources.map((resource) => {\n const raw = resource.path.replaceAll(\"\\\\\", \"/\");\n if (raw.startsWith(\"/\") || /^[A-Za-z]:\\//.test(raw)) {\n throw new Error(`Absolute resource path is forbidden: ${resource.path}`);\n }\n const normalized = posix.normalize(raw);\n if (normalized === \"..\" || normalized.startsWith(\"../\")) {\n throw new Error(`Resource path escapes package: ${resource.path}`);\n }\n if (normalized === \".\" || normalized.endsWith(\"/\")) {\n throw new Error(`Invalid resource destination: ${resource.path}`);\n }\n if (seen.has(normalized)) {\n throw new Error(`Duplicate normalized resource destination: ${normalized}`);\n }\n seen.add(normalized);\n if (resource.content === undefined) {\n throw new Error(\n `Missing resource content${resource.source ? ` for ${resource.source}` : \"\"}: ${resource.path}`,\n );\n }\n return Object.freeze({\n path: normalized,\n mediaType: resource.mediaType,\n content: resource.content,\n });\n }),\n );\n}\n\nfunction normalizeIntegrityValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(normalizeIntegrityValue);\n if (value && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .filter(([, item]) => item !== undefined)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, item]) => [key, normalizeIntegrityValue(item)]),\n );\n }\n return value;\n}\n\nexport function productionIntegrityDigest(value: unknown): string {\n return createHash(\"sha256\")\n .update(JSON.stringify(normalizeIntegrityValue(value)))\n .digest(\"hex\");\n}\n\nfunction integrityLayer(parent: string | null, inputs: unknown) {\n return Object.freeze({\n algorithm: \"sha256\" as const,\n parent,\n inputs: normalizeIntegrityValue(inputs),\n digest: productionIntegrityDigest({ parent, inputs }),\n });\n}\n\nfunction facet(role: ResolvedRole, name: string): string {\n const prefix = `${name}:`;\n const statement = role.requiredBehavior.find((entry) => entry.startsWith(prefix));\n if (!statement) throw new Error(`${role.sourceFile} missing required operational facet: ${name}`);\n const value = statement.slice(prefix.length).trim();\n if (!value) throw new Error(`${role.sourceFile} has empty operational facet: ${name}`);\n return value;\n}\n\nexport function compileOperationalSkillContract(role: ResolvedRole): OperationalSkillContract {\n const requiredInputs = role.inputs.filter((input) => input.required);\n const optionalInputs = role.inputs.filter((input) => !input.required);\n if (requiredInputs.length === 0) {\n throw new Error(`${role.sourceFile} must declare at least one required operational input`);\n }\n const operationSteps = role.operations.map(\n (operation, index) =>\n `${index + 1}. ${operation.id}: ${operation.purpose} Required behavior: ${operation.requiredBehavior.join(\" \")}`,\n );\n if (operationSteps.length === 0) {\n throw new Error(`${role.sourceFile} must resolve at least one operation for its procedure`);\n }\n\n const contract: OperationalSkillContract = Object.freeze({\n activation: Object.freeze([\n facet(role, \"activation\"),\n `Do not activate when the requested outcome does not require ${role.taxonomy.transformation}, when another capability owns the requested transformation, or when the caller asks for side effects forbidden by this read-only role.`,\n ]),\n inputs: Object.freeze([\n ...requiredInputs.map(\n (input) =>\n `Required input \\`${input.name}\\`: ${input.description} If it is missing, identify it explicitly and do not begin the procedure.`,\n ),\n ...optionalInputs.map(\n (input) =>\n `Optional input \\`${input.name}\\`: ${input.description} Continue without it only when the completion gate remains satisfiable.`,\n ),\n facet(role, \"sufficiency\"),\n ]),\n procedure: Object.freeze([facet(role, \"transformation\"), ...operationSteps]),\n decisions: Object.freeze([\n facet(role, \"conflict\"),\n ...role.precedence\n .slice()\n .sort((left, right) => left.rank - right.rank)\n .map(\n (rule) => `Apply source class \\`${rule.sourceClass}\\` at precedence rank ${rule.rank}.`,\n ),\n ...role.evaluation.criteria.map((criterion) => `Decision/evaluation criterion: ${criterion}`),\n ]),\n resources: Object.freeze([\n `${facet(role, \"resources\")} Load [resource:resources/contract.json] for the complete role, family, operation, precedence, and traceability contract.`,\n `Load [resource:resources/output.schema.json] before constructing or validating the final output. Both resources are package-local; never read canonical source paths.`,\n ]),\n ambiguityAndAbstention: Object.freeze([\n facet(role, \"ambiguity\"),\n facet(role, \"abstention\"),\n `When clarification is possible, state the exact missing or conflicting fact and the output fields it blocks. Otherwise return an abstention with the evidence gap; never silently choose an interpretation.`,\n ]),\n stopConditions: Object.freeze([\n facet(role, \"stop\"),\n `Stop immediately if a required input is missing, a required package resource is unavailable, the role-specific decision rule cannot be applied, or the output cannot validate against the bundled schema.`,\n ]),\n outputConstruction: Object.freeze([\n facet(role, \"output\").replace(role.output.schema, role.outputSchema.packagePath),\n facet(role, \"traceability\"),\n `Construct only the intended output \\`${role.taxonomy.intendedOutput}\\`; preserve unresolved claims and counterevidence rather than converting them into confident conclusions.`,\n ]),\n validation: Object.freeze([\n facet(role, \"evaluation\"),\n `Validate the completed output with [resource:resources/output.schema.json]. Validation failure is a hard stop, not a warning.`,\n `Confirm every material claim has source traceability, every ordered stage is evidenced, and no forbidden behavior occurred: ${role.forbiddenBehavior.join(\" \")}`,\n ]),\n examples: Object.freeze([\n `Happy path: all required inputs are present, the ordered ${role.id} procedure completes, decision rules resolve the evidence, and the schema-valid ${role.taxonomy.intendedOutput} is emitted with trace links.`,\n `Ambiguity: two plausible interpretations change a required output field; identify both, request clarification, and do not select one without evidence.`,\n `Conflict: equally authoritative sources support incompatible outcomes; preserve both positions, apply the declared conflict rule, and leave the affected field unresolved when no source wins.`,\n `Misuse: the caller requests repository writes, shell execution, or a transformation outside ${role.id}; refuse that action and state that this capability is read-only and out of scope.`,\n `Insufficient evidence: a required input or completion-gate fact is absent; name the missing evidence, abstain, and emit no completed ${role.taxonomy.intendedOutput}.`,\n ]),\n });\n validateOperationalSkillContract(contract);\n return contract;\n}\n\nexport function compileProjectionIR(\n role: ResolvedRole,\n runtime: RuntimeProfileDefinition,\n): ProjectionIR {\n const projectedRole = {\n ...role,\n output: { ...role.output, schema: role.outputSchema.packagePath },\n outputSchema: undefined,\n };\n const evidenceSchema = schemaDocument(\"evidence-ledger\", \"1.1\");\n const legacyEvidenceSchema = schemaDocument(\"evidence-ledger\", \"1.0\");\n const resources = compileResourceClosure([\n {\n path: \"resources/contract.json\",\n mediaType: \"application/json\",\n content: `${JSON.stringify(projectedRole, null, 2)}\\n`,\n },\n {\n path: role.outputSchema.packagePath,\n mediaType: role.outputSchema.mediaType,\n content: role.outputSchema.content,\n source: `${role.sourceFile}#/output/schema`,\n },\n {\n path: \"resources/evidence-ledger.schema.json\",\n mediaType: \"application/schema+json\",\n content: evidenceSchema,\n source: \"@portable-capabilities/schemas#evidence-ledger/1.1\",\n },\n {\n path: \"resources/evidence-ledger-1.0.schema.json\",\n mediaType: \"application/schema+json\",\n content: legacyEvidenceSchema,\n source: \"@portable-capabilities/schemas#evidence-ledger/1.0\",\n },\n ]);\n const operationalSkill = compileOperationalSkillContract(role);\n const primitivePlan = createPrimitivePlan(role, runtime);\n const canonical = integrityLayer(null, {\n role,\n family: role.family,\n operations: role.operations,\n outputSchema: role.outputSchema,\n resources,\n taxonomy: role.taxonomy,\n evaluation: role.evaluation,\n traceability: role.traceability,\n precedence: role.precedence,\n requiredBehavior: role.requiredBehavior,\n forbiddenBehavior: role.forbiddenBehavior,\n inputs: role.inputs,\n pipeline: role.pipeline,\n effects: role.effects,\n });\n const projection = integrityLayer(canonical.digest, {\n runtimeProfile: runtime,\n runtimeVersion: runtime.version,\n primitivePlan,\n operationalSkill,\n permissionProjection: {\n model: primitivePlan.permission,\n effects: primitivePlan.effects,\n },\n compatibility: primitivePlan.compatibility,\n provenance: primitivePlan.provenance,\n exceptionId: primitivePlan.exceptionId,\n initialMetadata: { name: role.taxonomy.displayName, description: role.purpose },\n });\n return Object.freeze({\n role,\n operationalSkill,\n primitivePlan,\n runtime,\n canonicalDigest: canonical.digest,\n integrity: Object.freeze({ canonical, projection }),\n initialMetadata: Object.freeze({ name: role.taxonomy.displayName, description: role.purpose }),\n resources: Object.freeze(resources),\n });\n}\nexport function assertBehaviorFreeTemplate(template: string): void {\n if (template.length > 8192) throw new Error(\"Fallback template exceeds 8 KiB\");\n if (/{{[#/>!]|{{\\s*[a-zA-Z0-9_-]+\\s+[^}]+}}/.test(template))\n throw new Error(\"Behavior-bearing Handlebars is forbidden\");\n}\n", "export type OutputFormat = \"human\" | \"json\";\nexport interface CliDiagnostic {\n readonly code: string;\n readonly file?: string;\n readonly path?: string;\n readonly message: string;\n readonly remediation?: string;\n}\nexport interface CommandEnvelope<T> {\n readonly schemaVersion: \"1.0.0\";\n readonly command: string;\n readonly ok: boolean;\n readonly data?: T;\n readonly diagnostics: readonly CliDiagnostic[];\n}\nexport function writeEnvelope<T>(envelope: CommandEnvelope<T>, format: OutputFormat): void {\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(envelope)}\\n`);\n return;\n }\n if (envelope.ok) process.stdout.write(`${envelope.command}: ok\\n`);\n for (const diagnostic of envelope.diagnostics) {\n process.stderr.write(\n `${diagnostic.code}: ${diagnostic.message}${diagnostic.remediation ? ` (${diagnostic.remediation})` : \"\"}\\n`,\n );\n }\n}\nexport function structuredLog(\n level: \"info\" | \"warn\" | \"error\",\n msg: string,\n fields: Record<string, unknown> = {},\n): void {\n process.stderr.write(`${JSON.stringify({ level, time: Date.now(), msg, ...fields })}\\n`);\n}\n", "import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\nconst packageMetadata = require(\"../package.json\") as { readonly version: string };\n\nexport const cliVersion = packageMetadata.version;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"antigravity\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"claude-code\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"codex\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"dcode\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"oh-my-pi\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"opencode\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\nexport const adapter = createNativeAdapter(\"pi\");\nexport default adapter;\n", "import { createNativeAdapter } from \"@portable-capabilities/renderer-core\";\n\nexport const referenceAdapter = createNativeAdapter(\"reference\");\n", "import { adapter as antigravity } from \"@portable-capabilities/adapter-antigravity\";\nimport { adapter as claudeCode } from \"@portable-capabilities/adapter-claude-code\";\nimport { adapter as codex } from \"@portable-capabilities/adapter-codex\";\nimport { adapter as dcode } from \"@portable-capabilities/adapter-dcode\";\nimport { adapter as ohMyPi } from \"@portable-capabilities/adapter-oh-my-pi\";\nimport { adapter as opencode } from \"@portable-capabilities/adapter-opencode\";\nimport { adapter as pi } from \"@portable-capabilities/adapter-pi\";\nimport { referenceAdapter as reference } from \"@portable-capabilities/adapter-reference\";\nimport { computeFileSetDigest } from \"@portable-capabilities/compiler\";\nimport type {\n CapabilityLock,\n ResolvedCapabilitySystem,\n ResolvedRole,\n RuntimeProfileDefinition,\n} from \"@portable-capabilities/contracts\";\nimport {\n compileProjectionIR,\n type GeneratedFile,\n productionIntegrityDigest,\n type RuntimeAdapter,\n} from \"@portable-capabilities/renderer-core\";\n\nconst adapters = new Map<string, RuntimeAdapter>([\n [antigravity.id, antigravity],\n [claudeCode.id, claudeCode],\n [codex.id, codex],\n [dcode.id, dcode],\n [ohMyPi.id, ohMyPi],\n [opencode.id, opencode],\n [pi.id, pi],\n [reference.id, reference],\n]);\n\nexport const availableTargets = Object.freeze([...adapters.keys()].sort());\n\nfunction select(values: readonly string[] | undefined, available: readonly string[], kind: string) {\n const selected =\n !values || values.length === 0 || values.includes(\"all\") ? [...available] : [...values];\n const unknown = selected.filter((value) => !available.includes(value));\n if (unknown.length) throw new Error(`Unknown ${kind}: ${unknown.join(\", \")}`);\n return selected;\n}\n\nexport interface ProductionBuild {\n readonly systemId: string;\n readonly systemSourceFile: string;\n readonly files: readonly GeneratedFile[];\n readonly digest: string;\n readonly targets: readonly string[];\n readonly roles: readonly string[];\n readonly validations: readonly {\n runtimeId: string;\n roleId: string;\n valid: boolean;\n diagnostics: readonly string[];\n }[];\n}\n\nexport async function buildProduction(\n system: ResolvedCapabilitySystem,\n options: { readonly targets?: readonly string[]; readonly roles?: readonly string[] } = {},\n): Promise<ProductionBuild> {\n const roleIds = select(\n options.roles,\n system.roles.map((role) => role.id),\n \"role\",\n );\n const targetIds = select(\n options.targets,\n system.runtimes.map((runtime) => runtime.id),\n \"target\",\n );\n const roles = system.roles.filter((role) => roleIds.includes(role.id));\n const files: GeneratedFile[] = [];\n const validations: ProductionBuild[\"validations\"][number][] = [];\n\n for (const targetId of targetIds) {\n const adapter = adapters.get(targetId);\n if (!adapter) throw new Error(`No adapter registered for manifest runtime: ${targetId}`);\n const profile = system.runtimes.find((runtime) => runtime.id === targetId);\n if (!profile) throw new Error(`Manifest runtime not resolved: ${targetId}`);\n for (const role of roles) {\n const ir = compileProjectionIR(role, profile);\n const rendered = await adapter.render(ir);\n const validation = adapter.validate(rendered, ir);\n validations.push({\n runtimeId: targetId,\n roleId: role.id,\n valid: validation.valid,\n diagnostics: validation.diagnostics,\n });\n files.push(...rendered);\n }\n }\n\n return Object.freeze({\n systemId: system.id,\n systemSourceFile: system.sourceFile,\n files: Object.freeze(files),\n digest: computeFileSetDigest(files),\n targets: Object.freeze(targetIds),\n roles: Object.freeze(roleIds),\n validations: Object.freeze(validations),\n });\n}\n\nexport interface ProductionValidationCell {\n readonly runtimeId: string;\n readonly roleId: string;\n readonly categories: Readonly<\n Record<\n | \"canonical\"\n | \"operational\"\n | \"projection\"\n | \"resources\"\n | \"lock\"\n | \"native\"\n | \"compatibility\"\n | \"installation\",\n { readonly valid: boolean; readonly diagnostics: readonly string[] }\n >\n >;\n readonly valid: boolean;\n}\n\nfunction lockFor(\n files: readonly GeneratedFile[],\n runtimeId: string,\n roleId: string,\n): CapabilityLock {\n const suffix = `/${roleId}/capability.lock.json`;\n const file = files.find(\n (item) => item.path.includes(`/${runtimeId}/`) && item.path.endsWith(suffix),\n );\n if (!file) throw new Error(`Missing capability lock for ${runtimeId}/${roleId}`);\n return JSON.parse(new TextDecoder().decode(file.content)) as CapabilityLock;\n}\n\nfunction validLayer(layer: CapabilityLock[\"integrity\"][\"canonical\"]): boolean {\n return productionIntegrityDigest({ parent: layer.parent, inputs: layer.inputs }) === layer.digest;\n}\n\nexport async function validateProduction(\n system: ResolvedCapabilitySystem,\n options: { readonly targets?: readonly string[]; readonly roles?: readonly string[] } = {},\n): Promise<{\n readonly build: ProductionBuild;\n readonly cells: readonly ProductionValidationCell[];\n}> {\n const build = await buildProduction(system, options);\n const cells = build.validations.map((adapterValidation) => {\n const lock = lockFor(build.files, adapterValidation.runtimeId, adapterValidation.roleId);\n const resourcesValid = lock.resources.every((resource) =>\n build.files.some(\n (file) =>\n file.path.includes(`/${adapterValidation.runtimeId}/${adapterValidation.roleId}/`) &&\n file.path.endsWith(`/${resource.path}`),\n ),\n );\n const compatibility = lock.graph.runtimeProfile as RuntimeProfileDefinition;\n const primitivePlan = lock.graph.primitivePlan as { readonly emittedFiles?: readonly string[] };\n const installationValid =\n Array.isArray(primitivePlan.emittedFiles) &&\n primitivePlan.emittedFiles.every((path) => build.files.some((file) => file.path === path));\n const categories: ProductionValidationCell[\"categories\"] = Object.freeze({\n canonical: Object.freeze({\n valid:\n validLayer(lock.integrity.canonical) &&\n lock.canonicalDigest === lock.integrity.canonical.digest,\n diagnostics: Object.freeze([]),\n }),\n operational: Object.freeze({\n valid: Boolean(lock.graph.operationalSkill),\n diagnostics: Object.freeze(\n lock.graph.operationalSkill ? [] : [\"missing operational graph\"],\n ),\n }),\n projection: Object.freeze({\n valid:\n validLayer(lock.integrity.projection) &&\n lock.integrity.projection.parent === lock.integrity.canonical.digest,\n diagnostics: Object.freeze([]),\n }),\n resources: Object.freeze({\n valid: resourcesValid,\n diagnostics: Object.freeze(\n resourcesValid ? [] : [\"lock resource missing from generated package\"],\n ),\n }),\n lock: Object.freeze({\n valid:\n lock.schemaVersion === \"2.0.0\" &&\n validLayer(lock.integrity.package) &&\n lock.integrity.package.parent === lock.integrity.projection.digest &&\n lock.generatedDigest === lock.integrity.package.digest,\n diagnostics: Object.freeze([]),\n }),\n native: Object.freeze({\n valid: adapterValidation.valid,\n diagnostics: Object.freeze([...adapterValidation.diagnostics]),\n }),\n compatibility: Object.freeze({\n valid:\n compatibility.compatibility.outcome !== \"unknown-version\" &&\n compatibility.compatibility.approval.status === \"approved\",\n diagnostics: Object.freeze([]),\n }),\n installation: Object.freeze({\n valid: installationValid,\n diagnostics: Object.freeze(\n installationValid ? [] : [\"primitive-plan installation paths are incomplete\"],\n ),\n }),\n });\n return Object.freeze({\n runtimeId: adapterValidation.runtimeId,\n roleId: adapterValidation.roleId,\n categories,\n valid: Object.values(categories).every((item) => item.valid),\n });\n });\n return Object.freeze({ build, cells: Object.freeze(cells) });\n}\n\nexport async function testProduction(\n system: ResolvedCapabilitySystem,\n options: { readonly targets?: readonly string[]; readonly roles?: readonly string[] } = {},\n) {\n const validated = await validateProduction(system, options);\n const layerNames = [\n \"contract\",\n \"installation\",\n \"discovery\",\n \"activation\",\n \"invocation\",\n \"behavior\",\n \"determinism\",\n \"judge\",\n ] as const;\n const cells = validated.cells.map((cell) => {\n const source = [\n cell.categories.canonical,\n cell.categories.installation,\n cell.categories.resources,\n cell.categories.operational,\n cell.categories.native,\n cell.categories.projection,\n cell.categories.lock,\n cell.categories.compatibility,\n ] as const;\n const layers = layerNames.map((layer, index) => {\n const result = source[index];\n if (!result) throw new Error(`Missing conformance source for layer: ${layer}`);\n return Object.freeze({\n layer,\n status: result.valid ? (\"passed\" as const) : (\"failed\" as const),\n diagnostics: result.diagnostics,\n });\n });\n return Object.freeze({\n runtimeId: cell.runtimeId,\n roleId: cell.roleId,\n passed: layers.every((layer) => layer.status === \"passed\"),\n layers: Object.freeze(layers),\n });\n });\n return Object.freeze({\n suite: \"eight-layer-conformance\",\n cells: Object.freeze(cells),\n passed: cells.every((cell) => cell.passed),\n });\n}\n\nexport async function inspectProduction(\n system: ResolvedCapabilitySystem,\n options: { readonly target: string; readonly role: string },\n): Promise<{\n readonly systemId: string;\n readonly role: ResolvedRole;\n readonly runtime: RuntimeProfileDefinition;\n readonly files: readonly GeneratedFile[];\n readonly digest: string;\n readonly integrity: CapabilityLock[\"integrity\"];\n readonly lock: CapabilityLock;\n}> {\n const build = await buildProduction(system, {\n targets: [options.target],\n roles: [options.role],\n });\n const role = system.roles.find((item) => item.id === options.role);\n if (!role) throw new Error(`Unknown role: ${options.role}`);\n const runtime = system.runtimes.find((item) => item.id === options.target);\n if (!runtime) throw new Error(`Unknown target: ${options.target}`);\n const lockFile = build.files.find((file) => file.path.endsWith(\"/capability.lock.json\"));\n if (!lockFile) throw new Error(\"Generated package is missing capability.lock.json\");\n const lock = JSON.parse(new TextDecoder().decode(lockFile.content)) as CapabilityLock;\n return {\n systemId: system.id,\n role,\n runtime,\n files: build.files,\n digest: build.digest,\n integrity: lock.integrity,\n lock,\n };\n}\n", "import { createProgram } from \"./program.js\";\n\ntry {\n const argv = process.argv.filter((value, index) => !(index === 2 && value === \"--\"));\n await createProgram().parseAsync(argv);\n} catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`${JSON.stringify({ level: \"error\", time: Date.now(), msg: message })}\\n`);\n process.exitCode = 1;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAGA,QAAMA,kBAAN,cAA6B,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOjC,YAAY,UAAU,MAAM,SAAS;AACnC,cAAM,OAAO;AAEb,cAAM,kBAAkB,MAAM,KAAK,WAAW;AAC9C,aAAK,OAAO,KAAK,YAAY;AAC7B,aAAK,OAAO;AACZ,aAAK,WAAW;AAChB,aAAK,cAAc;AAAA,MACrB;AAAA,IACF;AAKA,QAAMC,wBAAN,cAAmCD,gBAAe;AAAA;AAAA;AAAA;AAAA;AAAA,MAKhD,YAAY,SAAS;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O,UAAU,EAAE,UAAU,KAAK,UAAU,KAAK;AACnF,QAAM,cAAc,EAAE,WAAW,IAAI;AACvC,SAAS,OAAO;AACd,QAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAE,OAAO,SAAS,MAAM,KAAK,IAAI,GAAG,KAAK,QAAQ,CAAC,CAAC;AAAA,CAAI;AAC9F,UAAQ,WAAW;AACrB;",
6
+ "names": ["CommanderError", "InvalidArgumentError", "InvalidArgumentError", "Argument", "Help", "cmd", "a", "result", "InvalidArgumentError", "Option", "str", "a", "i", "EventEmitter", "path", "fs", "process", "Argument", "CommanderError", "Help", "Option", "Command", "result", "execArgv", "signals", "i", "option", "hasColors", "Argument", "Command", "CommanderError", "InvalidArgumentError", "Help", "Option", "readFile", "ajv", "Ajv2020", "createHash", "resolve", "resolve", "createHash", "a", "dirname", "resolve", "readFileSync", "dirname", "resolve", "parse", "readFile", "resolve", "assertValid", "dirname", "resolve", "a", "commander", "lstat", "mkdir", "readFile", "rename", "rm", "writeFile", "dirname", "join", "createHash", "mkdir", "readFile", "rename", "writeFile", "dirname", "join", "path", "access", "readdir", "dirname", "join", "relative", "resolve", "path", "readdir", "join", "relative", "resolve", "dirname", "access", "path", "lstat", "mkdir", "writeFile", "rename", "dirname", "join", "readFile", "rm", "identity", "createHash", "constants", "access", "lstat", "mkdir", "readdir", "readFile", "writeFile", "join", "fileURLToPath", "decoder", "result", "expression", "process", "process", "result", "result", "path", "process", "process", "path", "platform", "fileURLToPath", "process", "execPath", "path", "result", "constants", "constants", "constants", "signals", "constants", "signals", "constants", "normalizeSignal", "constants", "scheduler", "promisify", "isConnected", "resolve", "once", "once", "once", "once", "promisify", "scheduler", "setTimeout", "setTimeout", "path", "path", "correctEncoding", "Buffer", "path", "process", "path", "process", "process", "path", "Buffer", "path", "process", "path", "process", "process", "path", "inspect", "objectToString", "identity", "identity", "textEncoder", "textDecoder", "identity", "result", "inspect", "result", "count", "result", "milliseconds", "result", "result", "result", "readFileSync", "isReadableStream", "isWritableStream", "process", "isWritableStream", "process", "addDefaultValue", "readFileSync", "tty", "tty", "readFileSync", "addProperties", "optionName", "value", "readFileSync", "stripFinalNewline", "LF", "Buffer", "Buffer", "Buffer", "StringDecoder", "StringDecoder", "textEncoder", "Buffer", "transformStream", "transformStream", "identityGenerator", "encoding", "generators", "result", "stripFinalNewline", "path", "once", "once", "result", "process", "once", "on", "throwOnDisconnect", "once", "on", "once", "on", "stopOnAbort", "once", "on", "process", "ChildProcess", "ChildProcess", "Buffer", "Readable", "Writable", "Duplex", "addProperties", "Duplex", "Readable", "Buffer", "Writable", "on", "once", "getDefaultHighWaterMark", "finished", "aborted", "noop", "increment", "finished", "finished", "process", "path", "isWindows", "addAbortListener", "process", "i", "count", "a", "addAbortListener", "resolve", "on", "getDefaultHighWaterMark", "stripFinalNewline", "on", "getDefaultHighWaterMark", "Readable", "callbackify", "finished", "finished", "finished", "readable", "Readable", "callbackify", "Readable", "Writable", "Duplex", "finished", "finished", "readable", "stripFinalNewline", "iterable", "getStreamContents", "stripFinalNewline", "stripFinalNewline", "once", "isVerbose", "stripFinalNewline", "once", "Writable", "callbackify", "writable", "Writable", "callbackify", "Duplex", "callbackify", "duplex", "Duplex", "callbackify", "result", "mapArguments", "boundOptions", "setBoundExeca", "sendMessage", "getOneMessage", "getEachMessage", "getCancelSignal", "access", "constants", "readdir", "path", "join", "stat", "lstat", "createHash", "relative", "readFile", "a", "result", "mkdir", "writeFile", "createHash", "readdir", "readFile", "dirname", "relative", "resolve", "createHash", "createHash", "createHash", "encoder", "decoder", "path", "decoder", "encoder", "createHash", "digest", "readdir", "path", "resolve", "relative", "createHash", "readFile", "dirname", "format", "require", "adapter", "adapter", "adapter", "adapter", "adapter", "adapter", "adapter", "path", "result", "common", "program", "result", "readFile"]
7
+ }