industrial-model 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/index.cjs +39 -12
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cognite-core/index.cjs +12 -4
- package/dist/cognite-core/index.cjs.map +1 -1
- package/dist/cognite-core/index.js +12 -4
- package/dist/cognite-core/index.js.map +1 -1
- package/dist/index.cjs +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/cli/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../node_modules/commander/lib/error.js","../../node_modules/commander/lib/argument.js","../../node_modules/commander/lib/help.js","../../node_modules/commander/lib/option.js","../../node_modules/commander/lib/suggestSimilar.js","../../node_modules/commander/lib/command.js","../../node_modules/commander/index.js","../../node_modules/cli-width/index.js","../../node_modules/mute-stream/lib/index.js","../../node_modules/commander/esm.mjs","../../src/cli/commands/generate.ts","../../src/cognite/adapter.ts","../../src/mappers/view-mapper.ts","../../src/cli/generator/renderer.ts","../../src/cli/generator/helpers.ts","../../src/utils/view.ts","../../src/cli/generator/constants.ts","../../src/cli/generator/parser.ts","../../src/cli/generator/models.ts","../../src/cli/generator/templates/header.ts","../../src/cli/generator/templates/client.ts","../../src/cli/generator/templates/index.ts","../../src/cli/generator/templates/types.ts","../../node_modules/@inquirer/core/dist/lib/key.js","../../node_modules/@inquirer/core/dist/lib/errors.js","../../node_modules/@inquirer/core/dist/lib/use-state.js","../../node_modules/@inquirer/core/dist/lib/hook-engine.js","../../node_modules/@inquirer/core/dist/lib/use-effect.js","../../node_modules/@inquirer/core/dist/lib/theme.js","../../node_modules/@inquirer/figures/dist/index.js","../../node_modules/@inquirer/core/dist/lib/make-theme.js","../../node_modules/@inquirer/core/dist/lib/use-prefix.js","../../node_modules/@inquirer/core/dist/lib/use-memo.js","../../node_modules/@inquirer/core/dist/lib/use-ref.js","../../node_modules/@inquirer/core/dist/lib/use-keypress.js","../../node_modules/@inquirer/core/dist/lib/utils.js","../../node_modules/fast-string-truncated-width/dist/utils.js","../../node_modules/fast-string-truncated-width/dist/index.js","../../node_modules/fast-string-width/dist/index.js","../../node_modules/fast-wrap-ansi/src/main.ts","../../node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js","../../node_modules/@inquirer/core/dist/lib/create-prompt.js","../../node_modules/signal-exit/src/signals.ts","../../node_modules/signal-exit/src/index.ts","../../node_modules/@inquirer/core/dist/lib/screen-manager.js","../../node_modules/@inquirer/ansi/dist/index.js","../../node_modules/@inquirer/core/dist/lib/promise-polyfill.js","../../node_modules/@inquirer/core/dist/lib/Separator.js","../../node_modules/@inquirer/input/dist/index.js","../../node_modules/@inquirer/password/dist/index.js","../../node_modules/@inquirer/search/dist/index.js","../../node_modules/@inquirer/select/dist/index.js","../../src/cli/auth/login.ts","../../src/cli/auth/browser.ts","../../src/cli/auth/token.ts","../../src/cli/prompts/auth.ts","../../src/cli/prompts/data-model.ts","../../src/cli/prompts/options.ts","../../src/cli/index.ts"],"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.endsWith('...')) {\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 _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\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._collectValue(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 _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\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._collectValue(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–Levenshtein_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 = {\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?.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._collectValue(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?.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?.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[]} args\n * @return {{operands: string[], unknown: string[]}}\n */\n\n parseOptions(args) {\n const operands = []; // operands, not options or values\n const unknown = []; // first unknown option and remaining unknown args\n let dest = operands;\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*\\.\\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 let activeGroup = null; // working through group of short options, like -abc\n let i = 0;\n while (i < args.length || activeGroup) {\n const arg = activeGroup ?? args[i++];\n activeGroup = null;\n\n // literal\n if (arg === '--') {\n if (dest === unknown) dest.push(arg);\n dest.push(...args.slice(i));\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[i++];\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 i < args.length &&\n (!maybeOption(args[i]) || negativeNumberArg(args[i]))\n ) {\n value = args[i++];\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\n this.emit(`option:${option.name()}`);\n // remove the processed option and keep processing group\n activeGroup = `-${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 unknown.push(...args.slice(i));\n break;\n } else if (\n this._getHelpCommand() &&\n arg === this._getHelpCommand().name()\n ) {\n operands.push(arg, ...args.slice(i));\n break;\n } else if (this._defaultCommandName) {\n unknown.push(arg, ...args.slice(i));\n break;\n }\n }\n\n // If using passThroughOptions, stop processing options at first command-argument.\n if (this._passThroughOptions) {\n dest.push(arg, ...args.slice(i));\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","'use strict';\n\nmodule.exports = cliWidth;\n\nfunction normalizeOpts(options) {\n const defaultOpts = {\n defaultWidth: 0,\n output: process.stdout,\n tty: require('tty'),\n };\n\n if (!options) {\n return defaultOpts;\n }\n\n Object.keys(defaultOpts).forEach(function (key) {\n if (!options[key]) {\n options[key] = defaultOpts[key];\n }\n });\n\n return options;\n}\n\nfunction cliWidth(options) {\n const opts = normalizeOpts(options);\n\n if (opts.output.getWindowSize) {\n return opts.output.getWindowSize()[0] || opts.defaultWidth;\n }\n\n if (opts.tty.getWindowSize) {\n return opts.tty.getWindowSize()[1] || opts.defaultWidth;\n }\n\n if (opts.output.columns) {\n return opts.output.columns;\n }\n\n if (process.env.CLI_WIDTH) {\n const width = parseInt(process.env.CLI_WIDTH, 10);\n\n if (!isNaN(width) && width !== 0) {\n return width;\n }\n }\n\n return opts.defaultWidth;\n}\n","const Stream = require('stream')\n\nclass MuteStream extends Stream {\n #isTTY = null\n\n constructor (opts = {}) {\n super(opts)\n this.writable = this.readable = true\n this.muted = false\n this.on('pipe', this._onpipe)\n this.replace = opts.replace\n\n // For readline-type situations\n // This much at the start of a line being redrawn after a ctrl char\n // is seen (such as backspace) won't be redrawn as the replacement\n this._prompt = opts.prompt || null\n this._hadControl = false\n }\n\n #destSrc (key, def) {\n if (this._dest) {\n return this._dest[key]\n }\n if (this._src) {\n return this._src[key]\n }\n return def\n }\n\n #proxy (method, ...args) {\n if (typeof this._dest?.[method] === 'function') {\n this._dest[method](...args)\n }\n if (typeof this._src?.[method] === 'function') {\n this._src[method](...args)\n }\n }\n\n get isTTY () {\n if (this.#isTTY !== null) {\n return this.#isTTY\n }\n return this.#destSrc('isTTY', false)\n }\n\n // basically just get replace the getter/setter with a regular value\n set isTTY (val) {\n this.#isTTY = val\n }\n\n get rows () {\n return this.#destSrc('rows')\n }\n\n get columns () {\n return this.#destSrc('columns')\n }\n\n mute () {\n this.muted = true\n }\n\n unmute () {\n this.muted = false\n }\n\n _onpipe (src) {\n this._src = src\n }\n\n pipe (dest, options) {\n this._dest = dest\n return super.pipe(dest, options)\n }\n\n pause () {\n if (this._src) {\n return this._src.pause()\n }\n }\n\n resume () {\n if (this._src) {\n return this._src.resume()\n }\n }\n\n write (c) {\n if (this.muted) {\n if (!this.replace) {\n return true\n }\n // eslint-disable-next-line no-control-regex\n if (c.match(/^\\u001b/)) {\n if (c.indexOf(this._prompt) === 0) {\n c = c.slice(this._prompt.length)\n c = c.replace(/./g, this.replace)\n c = this._prompt + c\n }\n this._hadControl = true\n return this.emit('data', c)\n } else {\n if (this._prompt && this._hadControl &&\n c.indexOf(this._prompt) === 0) {\n this._hadControl = false\n this.emit('data', this._prompt)\n c = c.slice(this._prompt.length)\n }\n c = c.toString().replace(/./g, this.replace)\n }\n }\n this.emit('data', c)\n }\n\n end (c) {\n if (this.muted) {\n if (c && this.replace) {\n c = c.toString().replace(/./g, this.replace)\n } else {\n c = null\n }\n }\n if (c) {\n this.emit('data', c)\n }\n this.emit('end')\n }\n\n destroy (...args) {\n return this.#proxy('destroy', ...args)\n }\n\n destroySoon (...args) {\n return this.#proxy('destroySoon', ...args)\n }\n\n close (...args) {\n return this.#proxy('close', ...args)\n }\n}\n\nmodule.exports = MuteStream\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","/**\n * `industrial-model generate` command.\n */\n\nimport { CogniteClient } from \"@cognite/sdk\";\nimport { Command } from \"commander\";\nimport { createCogniteAdapter } from \"../../cognite\";\nimport { ViewMapper } from \"../../mappers/view-mapper\";\nimport { createGeneratorConfig, generate } from \"../generator/renderer\";\nimport { promptAuth } from \"../prompts/auth\";\nimport { promptDataModel } from \"../prompts/data-model\";\nimport { promptOptions } from \"../prompts/options\";\n\nexport const generateCommand = new Command(\"generate\")\n .description(\"Generate TypeScript types and client from a Cognite data model\")\n .option(\"--token <token>\", \"CDF bearer token\")\n .option(\"--project <project>\", \"CDF project name\")\n .option(\"--base-url <url>\", \"CDF base URL\")\n .option(\"--data-model <space/id/version>\", \"Data model identifier\")\n .option(\"--output <path>\", \"Output directory\")\n .option(\"--client-name <name>\", \"Name for the generated client function\")\n .action(async (flags) => {\n const auth = await promptAuth({\n token: flags.token,\n project: flags.project,\n baseUrl: flags.baseUrl,\n });\n\n const client = new CogniteClient({\n appId: \"industrial-model-generator\",\n project: auth.project,\n baseUrl: auth.baseUrl,\n oidcTokenProvider: () => Promise.resolve(auth.token),\n });\n\n const dataModel = await promptDataModel(client, flags.dataModel);\n\n const options = await promptOptions({\n outputPath: flags.output,\n clientName: flags.clientName,\n });\n\n const config = createGeneratorConfig({\n dataModelSpace: dataModel.space,\n dataModelId: dataModel.externalId,\n dataModelVersion: dataModel.version,\n clientName: options.clientName,\n outputPath: options.outputPath,\n packageVersion: process.env.PACKAGE_VERSION ?? \"unknown\",\n });\n\n console.log(\n `\\nGenerating types for ${dataModel.space}/${dataModel.externalId}/${dataModel.version}...`,\n );\n\n const viewMapper = new ViewMapper(createCogniteAdapter(client), dataModel);\n const views = await viewMapper.getViews();\n\n if (views.length === 0) {\n console.error(\"No views found in the data model.\");\n process.exit(1);\n }\n\n generate(views, config);\n\n console.log(\n `\\n✓ Generated ${views.length} view(s) to ${config.outputPath}/${config.dataModelId}/`,\n );\n });\n","import type { CogniteClient } from \"@cognite/sdk\";\nimport type { CognitePort } from \"./port\";\nimport type {\n CogniteDatapointDeleteItem,\n CogniteDatapointInsertItem,\n CogniteDatapointLatestItem,\n CogniteDatapointResponse,\n CogniteDatapointResultItem,\n CogniteDatapointRetrieveOptions,\n CogniteFileDownloadUrl,\n CogniteFileUploadInfo,\n CogniteFileUploadResult,\n DataModelId,\n DataModelRetrieveOptions,\n InstancesAggregateRequest,\n InstancesAggregateResponse,\n InstancesApplyRequest,\n InstancesApplyResponse,\n InstancesQueryRequest,\n InstancesQueryResponse,\n InstancesSearchRequest,\n InstancesSearchResponse,\n ViewDefinition,\n} from \"./types\";\n\nexport function createCogniteAdapter(client: CogniteClient): CognitePort {\n return new CogniteSdkAdapter(client);\n}\n\nclass CogniteSdkAdapter implements CognitePort {\n constructor(private readonly client: CogniteClient) {}\n\n async retrieveDataModels(ids: DataModelId[], options?: DataModelRetrieveOptions) {\n const response = await this.client.dataModels.retrieve(ids, options);\n return {\n items: response.items.map((item) => ({\n createdTime: item.createdTime,\n views: (item.views ?? []) as ViewDefinition[],\n })),\n };\n }\n\n async queryInstances(request: InstancesQueryRequest): Promise<InstancesQueryResponse> {\n const response = await this.client.instances.query(\n request as Parameters<CogniteClient[\"instances\"][\"query\"]>[0],\n );\n return {\n items: response.items as unknown as InstancesQueryResponse[\"items\"],\n nextCursor: response.nextCursor,\n };\n }\n\n async searchInstances(request: InstancesSearchRequest): Promise<InstancesSearchResponse> {\n const search = (\n this.client.instances as unknown as {\n search: (request: InstancesSearchRequest) => Promise<{ items: unknown[] }>;\n }\n ).search;\n const response = await search(request);\n return {\n items: response.items as unknown as InstancesSearchResponse[\"items\"],\n };\n }\n\n async aggregateInstances(\n request: InstancesAggregateRequest,\n ): Promise<InstancesAggregateResponse> {\n const response = await this.client.instances.aggregate(\n request as Parameters<CogniteClient[\"instances\"][\"aggregate\"]>[0],\n );\n return {\n items: response.items as unknown as InstancesAggregateResponse[\"items\"],\n };\n }\n\n async applyInstances(request: InstancesApplyRequest): Promise<InstancesApplyResponse> {\n const apply = (\n this.client.instances as unknown as {\n apply: (request: InstancesApplyRequest) => Promise<{ items: unknown[] }>;\n }\n ).apply;\n const response = await apply(request);\n return {\n items: response.items as unknown as InstancesApplyResponse[\"items\"],\n };\n }\n\n async retrieveDatapoints(\n options: CogniteDatapointRetrieveOptions,\n ): Promise<{ items: CogniteDatapointResultItem[] }> {\n const { items, ...rest } = options;\n const sdkItems = items.map(({ space, externalId, ...itemRest }) => ({\n ...itemRest,\n instanceId: { space, externalId },\n }));\n const response = await this.client.datapoints.retrieve({\n ...rest,\n items: sdkItems,\n } as Parameters<typeof this.client.datapoints.retrieve>[0]);\n return { items: (response as unknown as CogniteDatapointResponse[]).map(mapDatapointResult) };\n }\n\n async retrieveLatestDatapoints(\n items: CogniteDatapointLatestItem[],\n options?: { ignoreUnknownIds?: boolean },\n ): Promise<{ items: CogniteDatapointResultItem[] }> {\n const sdkItems = items.map(({ space, externalId, before }) => ({\n instanceId: { space, externalId },\n ...(before !== undefined ? { before } : {}),\n }));\n const response = await this.client.datapoints.retrieveLatest(\n sdkItems as Parameters<typeof this.client.datapoints.retrieveLatest>[0],\n options,\n );\n return { items: (response as unknown as CogniteDatapointResponse[]).map(mapDatapointResult) };\n }\n\n async insertDatapoints(items: CogniteDatapointInsertItem[]): Promise<void> {\n const sdkItems = items.map(({ space, externalId, datapoints }) => ({\n instanceId: { space, externalId },\n datapoints,\n }));\n await this.client.datapoints.insert(\n sdkItems as Parameters<typeof this.client.datapoints.insert>[0],\n );\n }\n\n async deleteDatapoints(items: CogniteDatapointDeleteItem[]): Promise<void> {\n const sdkItems = items.map(({ space, externalId, inclusiveBegin, exclusiveEnd }) => ({\n instanceId: { space, externalId },\n inclusiveBegin,\n ...(exclusiveEnd !== undefined ? { exclusiveEnd } : {}),\n }));\n await this.client.datapoints.delete(\n sdkItems as Parameters<typeof this.client.datapoints.delete>[0],\n );\n }\n\n async uploadFile(\n fileInfo: CogniteFileUploadInfo,\n content?: unknown,\n ): Promise<CogniteFileUploadResult> {\n const { instanceId, ...rest } = fileInfo;\n const response = await this.client.files.upload(\n { ...rest, instanceId } as Parameters<typeof this.client.files.upload>[0],\n content as Parameters<typeof this.client.files.upload>[1],\n false,\n content !== undefined,\n );\n return mapFileResult(response as SdkFileInfo);\n }\n\n async getFileDownloadUrls(\n ids: Array<{ instanceId: { space: string; externalId: string } }>,\n ): Promise<CogniteFileDownloadUrl[]> {\n const response = await this.client.files.getDownloadUrls(\n ids as Parameters<typeof this.client.files.getDownloadUrls>[0],\n );\n return (\n response as Array<{\n instanceId?: { space?: string; externalId?: string };\n downloadUrl: string;\n }>\n ).map((item) => ({\n ...(item.instanceId !== undefined ? { instanceId: item.instanceId } : {}),\n downloadUrl: item.downloadUrl,\n }));\n }\n}\n\ntype SdkFileInfo = {\n instanceId?: { space?: string; externalId?: string };\n name: string;\n uploaded: boolean;\n uploadedTime?: Date;\n createdTime: Date;\n lastUpdatedTime: Date;\n mimeType?: string;\n directory?: string;\n source?: string;\n uploadUrl?: string;\n};\n\nfunction mapFileResult(item: SdkFileInfo): CogniteFileUploadResult {\n return {\n ...(item.instanceId !== undefined ? { instanceId: item.instanceId } : {}),\n name: item.name,\n uploaded: item.uploaded,\n createdTime: item.createdTime,\n lastUpdatedTime: item.lastUpdatedTime,\n ...(item.uploadedTime !== undefined ? { uploadedTime: item.uploadedTime } : {}),\n ...(item.mimeType !== undefined ? { mimeType: item.mimeType } : {}),\n ...(item.directory !== undefined ? { directory: item.directory } : {}),\n ...(item.source !== undefined ? { source: item.source } : {}),\n ...(item.uploadUrl !== undefined ? { uploadUrl: item.uploadUrl } : {}),\n };\n}\n\nfunction mapDatapointResult(item: CogniteDatapointResponse): CogniteDatapointResultItem {\n return {\n ...(item.instanceId?.space !== undefined ? { space: item.instanceId.space } : {}),\n ...(item.instanceId?.externalId !== undefined\n ? { externalId: item.instanceId.externalId }\n : {}),\n isString: item.isString ?? false,\n ...(item.unit !== undefined ? { unit: item.unit } : {}),\n datapoints: item.datapoints ?? [],\n ...(item.nextCursor !== undefined ? { nextCursor: item.nextCursor } : {}),\n };\n}\n","import type { CognitePort, ViewDefinition } from \"../cognite\";\nimport type { DataModelId } from \"../types\";\n\nexport class ViewMapper {\n private cachePromise: Promise<Map<string, ViewDefinition>> | null = null;\n\n constructor(\n private readonly cognite: CognitePort,\n private readonly dataModelId: DataModelId,\n ) {}\n\n async getView(externalId: string): Promise<ViewDefinition> {\n const views = await this.loadViews();\n const view = views.get(externalId);\n if (!view) {\n throw new Error(\n `View \"${externalId}\" not found in data model \"${this.dataModelId.externalId}\"`,\n );\n }\n return view;\n }\n\n async getViews(): Promise<ViewDefinition[]> {\n const views = await this.loadViews();\n return Array.from(views.values());\n }\n\n private loadViews(): Promise<Map<string, ViewDefinition>> {\n if (this.cachePromise == null) {\n this.cachePromise = this.fetchViews();\n }\n return this.cachePromise;\n }\n\n private async fetchViews(): Promise<Map<string, ViewDefinition>> {\n const response = await this.cognite.retrieveDataModels(\n [\n {\n space: this.dataModelId.space,\n externalId: this.dataModelId.externalId,\n version: this.dataModelId.version,\n },\n ],\n { inlineViews: true },\n );\n\n const dm = response.items.sort((a, b) => b.createdTime - a.createdTime)[0];\n if (!dm) {\n throw new Error(`Data model \"${this.dataModelId.externalId}\" not found`);\n }\n\n const views = new Map<string, ViewDefinition>();\n for (const view of dm.views ?? []) {\n views.set(view.externalId, view);\n }\n return views;\n }\n}\n","/**\n * Renderer: orchestrates parsing views and writing generated files to disk.\n */\n\nimport { existsSync, mkdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ViewDefinition as CogniteViewDefinition } from \"../../cognite\";\nimport { toPascal } from \"./helpers\";\nimport type { ViewDefinition } from \"./models\";\nimport { parseViews } from \"./parser\";\nimport { renderClient } from \"./templates/client\";\nimport { renderIndex } from \"./templates/index\";\nimport { renderTypes } from \"./templates/types\";\n\nexport interface GeneratorConfig {\n dataModelSpace: string;\n dataModelId: string;\n dataModelVersion: string;\n clientName: string;\n clientFunctionName: string;\n outputPath: string;\n packageVersion: string;\n generatedAt: string;\n}\n\nexport function createGeneratorConfig(options: {\n dataModelSpace: string;\n dataModelId: string;\n dataModelVersion: string;\n clientName: string | undefined;\n outputPath: string | undefined;\n packageVersion: string;\n}): GeneratorConfig {\n const clientName = options.clientName || toPascal(options.dataModelId);\n return {\n dataModelSpace: options.dataModelSpace,\n dataModelId: options.dataModelId,\n dataModelVersion: options.dataModelVersion,\n clientName,\n clientFunctionName: `create${clientName}Client`,\n outputPath: options.outputPath || \"./generated\",\n packageVersion: options.packageVersion,\n generatedAt: new Date().toISOString(),\n };\n}\n\nexport function generate(views: CogniteViewDefinition[], config: GeneratorConfig): void {\n const viewDefinitions = parseViews(views);\n generateFromDefinitions(viewDefinitions, config);\n}\n\nexport function generateFromDefinitions(\n viewDefinitions: ViewDefinition[],\n config: GeneratorConfig,\n): void {\n const outputDir = join(config.outputPath, config.dataModelId);\n\n if (existsSync(outputDir)) {\n rmSync(outputDir, { recursive: true });\n }\n mkdirSync(outputDir, { recursive: true });\n\n writeFileSync(join(outputDir, \"types.ts\"), renderTypes(viewDefinitions, config));\n writeFileSync(join(outputDir, \"client.ts\"), renderClient(viewDefinitions, config));\n writeFileSync(join(outputDir, \"index.ts\"), renderIndex(config));\n}\n","/**\n * String transformation helpers for code generation.\n */\n\n/** Convert a string to PascalCase (e.g. \"my_view_name\" → \"MyViewName\") */\nexport function toPascal(str: string): string {\n return str\n .replace(/[-_]+(.)?/g, (_, c: string | undefined) => (c ? c.toUpperCase() : \"\"))\n .replace(/^(.)/, (c) => c.toUpperCase());\n}\n\n/** Convert a string to camelCase (e.g. \"my_field_name\" → \"myFieldName\") */\nexport function toCamel(str: string): string {\n const pascal = toPascal(str);\n return pascal.charAt(0).toLowerCase() + pascal.slice(1);\n}\n","import type {\n EdgeConnection,\n QuerySelectExpression,\n ReverseDirectRelationConnection,\n ViewDefinition,\n ViewDefinitionProperty,\n ViewPropertyDefinition,\n ViewReference,\n} from \"../cognite\";\n\nconst NODE_PROPERTIES = new Set([\n \"externalId\",\n \"space\",\n \"createdTime\",\n \"deletedTime\",\n \"lastUpdatedTime\",\n]);\n\nexport function getPropertyRef(\n property: string,\n view: ViewDefinition,\n instanceType: \"node\" | \"edge\" = \"node\",\n): string[] {\n if (NODE_PROPERTIES.has(property)) return [instanceType, property];\n return [view.space, `${view.externalId}/${view.version}`, property];\n}\n\nexport function toViewReference(view: ViewDefinition): ViewReference {\n return { type: \"view\", space: view.space, externalId: view.externalId, version: view.version };\n}\n\nexport function isViewPropertyDefinition(p: ViewDefinitionProperty): p is ViewPropertyDefinition {\n return \"container\" in p;\n}\n\nexport function isReverseDirectRelation(\n p: ViewDefinitionProperty,\n): p is ReverseDirectRelationConnection {\n return \"through\" in p;\n}\n\nexport function isEdgeConnection(p: ViewDefinitionProperty): p is EdgeConnection {\n return !isViewPropertyDefinition(p) && !isReverseDirectRelation(p) && \"source\" in p;\n}\n\nexport function getDirectRelationSource(p: ViewPropertyDefinition): ViewReference | undefined {\n const type = p.type;\n if (type.type === \"direct\" && type.source) return type.source;\n return undefined;\n}\n\nexport function isDirectRelationWithSource(p: ViewDefinitionProperty): boolean {\n if (!isViewPropertyDefinition(p)) return false;\n return getDirectRelationSource(p) !== undefined;\n}\n\nexport function isListDirectRelation(p: ViewPropertyDefinition): boolean {\n return p.type.list === true;\n}\n\nexport function buildSelect(\n source: ViewReference,\n properties: string[],\n): QuerySelectExpression | Record<string, never> {\n if (properties.length === 0) return {};\n return { sources: [{ source, properties }] };\n}\n\nconst GROUPABLE_PROPERTY_TYPES = new Set([\n \"text\",\n \"direct\",\n \"int32\",\n \"int64\",\n \"float32\",\n \"float64\",\n \"boolean\",\n \"enum\",\n]);\n\nconst NUMERIC_PROPERTY_TYPES = new Set([\"int32\", \"int64\", \"float32\", \"float64\"]);\n\nexport function isGroupableProperty(property: ViewDefinitionProperty): boolean {\n if (!isViewPropertyDefinition(property)) return false;\n if (property.type.list === true) return false;\n const type = property.type.type;\n return type != null && GROUPABLE_PROPERTY_TYPES.has(type);\n}\n\nexport function isNumericProperty(property: ViewPropertyDefinition): boolean {\n const type = property.type.type;\n return type != null && NUMERIC_PROPERTY_TYPES.has(type);\n}\n\nexport function getSelectedGroupByKeys(groupBy: Record<string, boolean | undefined>): string[] {\n return Object.entries(groupBy)\n .filter((entry): entry is [string, true] => entry[1] === true)\n .map(([key]) => key);\n}\n","/**\n * Constants for TypeScript code generation.\n */\n\n/** Cognite property type → TypeScript type */\nexport const typeMappings: Record<string, string> = {\n text: \"string\",\n boolean: \"boolean\",\n timestamp: \"string\",\n date: \"string\",\n json: \"unknown\",\n float32: \"number\",\n float64: \"number\",\n int32: \"number\",\n int64: \"number\",\n timeseries: \"string\",\n file: \"string\",\n sequence: \"string\",\n direct: \"NodeId\",\n enum: \"string\",\n};\n\n/** TypeScript reserved words that need escaping with trailing underscore */\nexport const reservedWords = new Set([\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"null\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"undefined\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n]);\n","/**\n * Parser: converts engine ViewDefinition objects into generator ViewDefinition[].\n */\n\nimport type {\n ViewDefinition as CogniteViewDefinition,\n EdgeConnection,\n ReverseDirectRelationConnection,\n ViewPropertyDefinition,\n} from \"../../cognite\";\nimport {\n getDirectRelationSource,\n isEdgeConnection,\n isReverseDirectRelation,\n isViewPropertyDefinition,\n} from \"../../utils\";\nimport { reservedWords, typeMappings } from \"./constants\";\nimport { toCamel, toPascal } from \"./helpers\";\nimport type { FieldDefinition, ViewDefinition } from \"./models\";\n\nexport function parseViews(views: CogniteViewDefinition[]): ViewDefinition[] {\n return views.sort((a, b) => a.externalId.localeCompare(b.externalId)).map(parseView);\n}\n\nfunction parseView(view: CogniteViewDefinition): ViewDefinition {\n const fields: FieldDefinition[] = [];\n\n for (const [propertyName, prop] of Object.entries(view.properties)) {\n let fieldName = toCamel(propertyName);\n if (reservedWords.has(fieldName)) {\n fieldName = `${fieldName}_`;\n }\n\n if (isViewPropertyDefinition(prop)) {\n fields.push(processMappedProperty(propertyName, fieldName, prop));\n } else if (isEdgeConnection(prop)) {\n fields.push(processEdgeProperty(propertyName, fieldName, prop));\n } else if (isReverseDirectRelation(prop)) {\n fields.push(processReverseProperty(propertyName, fieldName, prop));\n }\n }\n\n return {\n viewName: toPascal(view.externalId),\n viewExternalId: view.externalId,\n viewSpace: view.space,\n viewVersion: view.version,\n fields,\n };\n}\n\nfunction processMappedProperty(\n propertyName: string,\n fieldName: string,\n prop: ViewPropertyDefinition,\n): FieldDefinition {\n const cogniteType = prop.type.type ?? \"unknown\";\n const mappedType = typeMappings[cogniteType] ?? \"unknown\";\n const isList = prop.type.list === true;\n const isRelation = cogniteType === \"direct\";\n const relationSource = getDirectRelationSource(prop);\n\n let relationTarget: string | null = null;\n let relationTargetSpace: string | null = null;\n let relationTargetExternalId: string | null = null;\n\n if (relationSource) {\n relationTarget = toPascal(relationSource.externalId);\n relationTargetSpace = relationSource.space;\n relationTargetExternalId = relationSource.externalId;\n }\n\n return {\n fieldName,\n originalName: propertyName,\n cogniteType,\n mappedType,\n isNullable: true, // Cognite SDK doesn't expose nullable in this type; default to true\n isList,\n isRelation,\n isEdge: false,\n isReverseRelation: false,\n isListDirectRelation: isRelation && isList,\n relationTarget,\n relationTargetSpace,\n relationTargetExternalId,\n };\n}\n\nfunction processEdgeProperty(\n propertyName: string,\n fieldName: string,\n prop: EdgeConnection,\n): FieldDefinition {\n return {\n fieldName,\n originalName: propertyName,\n cogniteType: \"edge\",\n mappedType: \"NodeId\",\n isNullable: false,\n isList: true,\n isRelation: false,\n isEdge: true,\n isReverseRelation: false,\n isListDirectRelation: false,\n relationTarget: toPascal(prop.source.externalId),\n relationTargetSpace: prop.source.space,\n relationTargetExternalId: prop.source.externalId,\n };\n}\n\nfunction processReverseProperty(\n propertyName: string,\n fieldName: string,\n prop: ReverseDirectRelationConnection,\n): FieldDefinition {\n const isSingle = prop.connectionType === \"single_reverse_direct_relation\";\n\n return {\n fieldName,\n originalName: propertyName,\n cogniteType: \"reverse_direct\",\n mappedType: \"NodeId\",\n isNullable: isSingle,\n isList: !isSingle,\n isRelation: true,\n isEdge: false,\n isReverseRelation: true,\n isListDirectRelation: false,\n relationTarget: toPascal(prop.source.externalId),\n relationTargetSpace: prop.source.space,\n relationTargetExternalId: prop.source.externalId,\n };\n}\n","/**\n * View and field definition models for code generation.\n */\n\nimport { toCamel } from \"./helpers\";\n\nexport interface FieldDefinition {\n fieldName: string;\n originalName: string;\n cogniteType: string;\n mappedType: string;\n isNullable: boolean;\n isList: boolean;\n isRelation: boolean;\n isEdge: boolean;\n isReverseRelation: boolean;\n isListDirectRelation: boolean;\n relationTarget: string | null;\n relationTargetSpace: string | null;\n relationTargetExternalId: string | null;\n}\n\nexport interface ViewDefinition {\n viewName: string;\n viewExternalId: string;\n viewSpace: string;\n viewVersion: string;\n fields: FieldDefinition[];\n}\n\n/** Fields for the Props type param (excludes reverse relations) */\nexport function getPropsFields(view: ViewDefinition): FieldDefinition[] {\n return view.fields.filter((f) => !f.isReverseRelation);\n}\n\n/** Fields for the Relations type param */\nexport function getRelationTypeFields(view: ViewDefinition): FieldDefinition[] {\n return view.fields.filter(\n (f) => (f.isRelation || f.isEdge || f.isReverseRelation) && f.relationTarget,\n );\n}\n\n/** TypeScript type for a field in the Props type param */\nexport function getInterfaceType(field: FieldDefinition): string {\n if (field.isRelation && !field.isList) return \"NodeId\";\n if (field.isEdge || (field.isRelation && field.isList)) return \"NodeId[]\";\n if (field.isList) return `${field.mappedType}[]`;\n return field.mappedType;\n}\n\n/** TypeScript type for a field in the Relations type param */\nexport function getRelationResolvedType(field: FieldDefinition): string {\n const target = field.relationTarget ?? \"unknown\";\n if (field.isList || field.isEdge) return `${target}[]`;\n if (field.isReverseRelation && !field.isList) return target;\n return target;\n}\n\n/** camelCase property name for the client object */\nexport function getClientPropertyName(view: ViewDefinition): string {\n return toCamel(view.viewName);\n}\n","/**\n * Shared header for all generated files.\n */\n\nimport type { GeneratorConfig } from \"../renderer\";\n\nexport function renderHeader(config: GeneratorConfig): string {\n return `/* eslint-disable */\n// DO NOT EDIT — this file is auto-generated\n// Data model: ${config.dataModelSpace}/${config.dataModelId} v${config.dataModelVersion}\n// Generated at: ${config.generatedAt}\n// industrial-model v${config.packageVersion}`;\n}\n","/**\n * Template: renders client.ts content.\n */\n\nimport type { ViewDefinition } from \"../models\";\nimport { getClientPropertyName } from \"../models\";\nimport type { GeneratorConfig } from \"../renderer\";\nimport { renderHeader } from \"./header\";\n\nexport function renderClient(views: ViewDefinition[], config: GeneratorConfig): string {\n const imports = [\n ` ${config.clientName}AggregateExecutor,`,\n ` ${config.clientName}Model,`,\n ` ${config.clientName}QueryExecutor,`,\n ` ${config.clientName}UpsertExecutor,`,\n ` ${config.clientName}ViewExternalId,`,\n ].join(\"\\n\");\n\n const viewShortcuts = views\n .map((view) => {\n const prop = getClientPropertyName(view);\n return ` ${prop}: {\n query: model.query(\"${view.viewExternalId}\"),\n aggregate: model.aggregate(\"${view.viewExternalId}\"),\n upsert: model.upsert(\"${view.viewExternalId}\"),\n delete: <TItem extends NodeId>(items: TItem[]) => model.delete(items),\n },`;\n })\n .join(\"\\n\");\n\n return `${renderHeader(config)}\n\nimport type { CogniteClient } from \"@cognite/sdk\";\nimport {\n IndustrialModelClient,\n type AggregateOptions,\n type DataModelId,\n type DeleteResult,\n type IndustrialModelClientOptions,\n type NodeId,\n type QueryOptions,\n type UpsertOptions,\n} from \"industrial-model\";\nimport type {\n${imports}\n} from \"./types\";\n\nexport const DATA_MODEL = {\n space: \"${config.dataModelSpace}\",\n externalId: \"${config.dataModelId}\",\n version: \"${config.dataModelVersion}\",\n} satisfies DataModelId;\n\nexport class ${config.clientName}Client {\n private readonly model: IndustrialModelClient;\n\n constructor(client: CogniteClient, options: IndustrialModelClientOptions = {}) {\n this.model = new IndustrialModelClient(client, DATA_MODEL, options);\n }\n\n query<TView extends ${config.clientName}ViewExternalId>(\n viewExternalId: TView,\n ): ${config.clientName}QueryExecutor<TView> {\n const query = this.model.query<${config.clientName}Model<TView>>();\n const queryWithView = query as unknown as (\n options: QueryOptions<${config.clientName}Model<TView>>,\n ) => unknown;\n const execute = (options: Omit<QueryOptions<${config.clientName}Model<TView>>, \"viewExternalId\"> = {}) =>\n queryWithView({ ...options, viewExternalId });\n\n return execute as ${config.clientName}QueryExecutor<TView>;\n }\n\n aggregate<TView extends ${config.clientName}ViewExternalId>(\n viewExternalId: TView,\n ): ${config.clientName}AggregateExecutor<TView> {\n const aggregate = this.model.aggregate<${config.clientName}Model<TView>>();\n const execute = (\n options: Omit<AggregateOptions<${config.clientName}Model<TView>>, \"viewExternalId\"> = {},\n ) => aggregate({ ...options, viewExternalId });\n\n return execute as ${config.clientName}AggregateExecutor<TView>;\n }\n\n upsert<TView extends ${config.clientName}ViewExternalId>(\n viewExternalId: TView,\n ): ${config.clientName}UpsertExecutor<TView> {\n const upsert = this.model.upsert<${config.clientName}Model<TView>>();\n const execute = (options: Omit<UpsertOptions<${config.clientName}Model<TView>>, \"viewExternalId\">) =>\n upsert({ ...options, viewExternalId });\n\n return execute as ${config.clientName}UpsertExecutor<TView>;\n }\n\n delete<TItem extends NodeId>(items: TItem[]): Promise<DeleteResult> {\n return this.model.delete(items);\n }\n}\n\nexport function ${config.clientFunctionName}(\n cogniteClient: CogniteClient,\n options: IndustrialModelClientOptions = {},\n) {\n const model = new ${config.clientName}Client(cogniteClient, options);\n\n return {\n model,\n${viewShortcuts}\n };\n}\n`;\n}\n","/**\n * Template: renders index.ts content.\n */\n\nimport type { GeneratorConfig } from \"../renderer\";\nimport { renderHeader } from \"./header\";\n\nexport function renderIndex(config: GeneratorConfig): string {\n return `${renderHeader(config)}\n\nexport { DATA_MODEL, ${config.clientName}Client, ${config.clientFunctionName} } from \"./client\";\nexport type * from \"./types\";\n`;\n}\n","/**\n * Template: renders types.ts content.\n */\n\nimport type { ViewDefinition } from \"../models\";\nimport {\n getInterfaceType,\n getPropsFields,\n getRelationResolvedType,\n getRelationTypeFields,\n} from \"../models\";\nimport type { GeneratorConfig } from \"../renderer\";\nimport { renderHeader } from \"./header\";\n\nexport function renderTypes(views: ViewDefinition[], config: GeneratorConfig): string {\n const lines: string[] = [\n renderHeader(config),\n \"\",\n \"import type {\",\n \" AggregateOptions,\",\n \" AggregateResult,\",\n \" AggregateResultItem,\",\n \" IndustrialModel,\",\n \" NodeId,\",\n \" QueryOptions,\",\n \" QueryResult,\",\n \" QueryResultItem,\",\n \" QuerySelect,\",\n \" UpsertOptions,\",\n \" UpsertResult,\",\n '} from \"industrial-model\";',\n \"\",\n renderViewExternalIdUnion(views, config),\n ];\n\n for (const view of views) {\n lines.push(\"\");\n lines.push(renderView(view));\n }\n\n lines.push(\"\");\n lines.push(renderModelByView(views, config));\n lines.push(\"\");\n lines.push(renderExecutors(config));\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction renderViewExternalIdUnion(views: ViewDefinition[], config: GeneratorConfig): string {\n return `export type ${config.clientName}ViewExternalId =\n${views.map((view) => ` | \"${view.viewExternalId}\"`).join(\"\\n\")};`;\n}\n\nfunction renderView(view: ViewDefinition): string {\n const propsFields = getPropsFields(view);\n const relationFields = getRelationTypeFields(view);\n\n if (relationFields.length === 0) {\n const propsLines = propsFields.map(\n (f) => ` ${f.fieldName}${f.isNullable ? \"?\" : \"\"}: ${getInterfaceType(f)};`,\n );\n\n return `export type ${view.viewName} = IndustrialModel<{\n${propsLines.join(\"\\n\")}\n}>;`;\n }\n\n const propsLines = propsFields.map(\n (f) => ` ${f.fieldName}${f.isNullable ? \"?\" : \"\"}: ${getInterfaceType(f)};`,\n );\n const relLines = relationFields.map(\n (f) => ` ${f.fieldName}${f.isNullable ? \"?\" : \"\"}: ${getRelationResolvedType(f)};`,\n );\n\n return `export type ${view.viewName} = IndustrialModel<\n {\n${propsLines.join(\"\\n\")}\n },\n {\n${relLines.join(\"\\n\")}\n }\n>;`;\n}\n\nfunction renderModelByView(views: ViewDefinition[], config: GeneratorConfig): string {\n return `export interface ${config.clientName}ModelByView {\n${views.map((view) => ` \"${view.viewExternalId}\": ${view.viewName};`).join(\"\\n\")}\n}\n\nexport type ${config.clientName}Model<TView extends ${config.clientName}ViewExternalId> =\n ${config.clientName}ModelByView[TView];`;\n}\n\nfunction renderExecutors(config: GeneratorConfig): string {\n const name = config.clientName;\n\n return `export type ${name}QueryExecutor<TView extends ${name}ViewExternalId> = {\n <const TSelect extends QuerySelect<${name}Model<TView>>>(\n options: Omit<QueryOptions<${name}Model<TView>, TSelect>, \"viewExternalId\" | \"select\"> & {\n select: TSelect & QuerySelect<${name}Model<TView>>;\n },\n ): Promise<QueryResult<QueryResultItem<${name}Model<TView>, TSelect>>>;\n (\n options?: Omit<QueryOptions<${name}Model<TView>, undefined>, \"viewExternalId\" | \"select\"> & {\n select?: undefined;\n },\n ): Promise<QueryResult<QueryResultItem<${name}Model<TView>, undefined>>>;\n};\n\nexport type ${name}AggregateExecutor<TView extends ${name}ViewExternalId> = <\n const TOptions extends Omit<AggregateOptions<${name}Model<TView>>, \"viewExternalId\">,\n>(\n options?: TOptions,\n) => Promise<\n AggregateResult<\n AggregateResultItem<${name}Model<TView>, TOptions[\"groupBy\"], TOptions[\"aggregate\"]>\n >\n>;\n\nexport type ${name}UpsertExecutor<TView extends ${name}ViewExternalId> = (\n options: Omit<UpsertOptions<${name}Model<TView>>, \"viewExternalId\">,\n) => Promise<UpsertResult>;`;\n}\n","export const isUpKey = (key, keybindings = []) => \n// The up key\nkey.name === 'up' ||\n // Vim keybinding: hjkl keys map to left/down/up/right\n (keybindings.includes('vim') && key.name === 'k') ||\n // Emacs keybinding: Ctrl+P means \"previous\" in Emacs navigation conventions\n (keybindings.includes('emacs') && key.ctrl && key.name === 'p');\nexport const isDownKey = (key, keybindings = []) => \n// The down key\nkey.name === 'down' ||\n // Vim keybinding: hjkl keys map to left/down/up/right\n (keybindings.includes('vim') && key.name === 'j') ||\n // Emacs keybinding: Ctrl+N means \"next\" in Emacs navigation conventions\n (keybindings.includes('emacs') && key.ctrl && key.name === 'n');\nexport const isSpaceKey = (key) => key.name === 'space';\nexport const isBackspaceKey = (key) => key.name === 'backspace';\nexport const isTabKey = (key) => key.name === 'tab';\nexport const isNumberKey = (key) => '1234567890'.includes(key.name);\nexport const isEnterKey = (key) => key.name === 'enter' || key.name === 'return';\nexport const isShiftKey = (key) => key.shift;\n","export class AbortPromptError extends Error {\n name = 'AbortPromptError';\n message = 'Prompt was aborted';\n constructor(options) {\n super();\n this.cause = options?.cause;\n }\n}\nexport class CancelPromptError extends Error {\n name = 'CancelPromptError';\n message = 'Prompt was canceled';\n}\nexport class ExitPromptError extends Error {\n name = 'ExitPromptError';\n}\nexport class HookError extends Error {\n name = 'HookError';\n}\nexport class ValidationError extends Error {\n name = 'ValidationError';\n}\n","import { AsyncResource } from 'node:async_hooks';\nimport { withPointer, handleChange } from \"./hook-engine.js\";\nfunction isFactory(value) {\n return typeof value === 'function';\n}\nexport function useState(defaultValue) {\n return withPointer((pointer) => {\n const setState = AsyncResource.bind(function setState(newValue) {\n // Noop if the value is still the same.\n if (pointer.get() !== newValue) {\n pointer.set(newValue);\n // Trigger re-render\n handleChange();\n }\n });\n if (pointer.initialized) {\n return [pointer.get(), setState];\n }\n const value = isFactory(defaultValue) ? defaultValue() : defaultValue;\n pointer.set(value);\n return [value, setState];\n });\n}\n","/* eslint @typescript-eslint/no-explicit-any: [\"off\"] */\nimport { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';\nimport { HookError, ValidationError } from \"./errors.js\";\nconst hookStorage = new AsyncLocalStorage();\nfunction createStore(rl) {\n const store = {\n rl,\n hooks: [],\n hooksCleanup: [],\n hooksEffect: [],\n index: 0,\n handleChange() { },\n };\n return store;\n}\n// Run callback in with the hook engine setup.\nexport function withHooks(rl, cb) {\n const store = createStore(rl);\n return hookStorage.run(store, () => {\n function cycle(render) {\n store.handleChange = () => {\n store.index = 0;\n render();\n };\n store.handleChange();\n }\n return cb(cycle);\n });\n}\n// Safe getStore utility that'll return the store or throw if undefined.\nfunction getStore() {\n const store = hookStorage.getStore();\n if (!store) {\n throw new HookError('[Inquirer] Hook functions can only be called from within a prompt');\n }\n return store;\n}\nexport function readline() {\n return getStore().rl;\n}\n// Merge state updates happening within the callback function to avoid multiple renders.\nexport function withUpdates(fn) {\n const wrapped = (...args) => {\n const store = getStore();\n let shouldUpdate = false;\n const oldHandleChange = store.handleChange;\n store.handleChange = () => {\n shouldUpdate = true;\n };\n const returnValue = fn(...args);\n if (shouldUpdate) {\n oldHandleChange();\n }\n store.handleChange = oldHandleChange;\n return returnValue;\n };\n return AsyncResource.bind(wrapped);\n}\nexport function withPointer(cb) {\n const store = getStore();\n const { index } = store;\n const pointer = {\n get() {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return store.hooks[index];\n },\n set(value) {\n store.hooks[index] = value;\n },\n initialized: index in store.hooks,\n };\n const returnValue = cb(pointer);\n store.index++;\n return returnValue;\n}\nexport function handleChange() {\n getStore().handleChange();\n}\nexport const effectScheduler = {\n queue(cb) {\n const store = getStore();\n const { index } = store;\n store.hooksEffect.push(() => {\n store.hooksCleanup[index]?.();\n const cleanFn = cb(readline());\n if (cleanFn != null && typeof cleanFn !== 'function') {\n throw new ValidationError('useEffect return value must be a cleanup function or nothing.');\n }\n store.hooksCleanup[index] = cleanFn;\n });\n },\n run() {\n const store = getStore();\n withUpdates(() => {\n store.hooksEffect.forEach((effect) => {\n effect();\n });\n // Warning: Clean the hooks before exiting the `withUpdates` block.\n // Failure to do so means an updates would hit the same effects again.\n store.hooksEffect.length = 0;\n })();\n },\n clearAll() {\n const store = getStore();\n store.hooksCleanup.forEach((cleanFn) => {\n cleanFn?.();\n });\n store.hooksEffect.length = 0;\n store.hooksCleanup.length = 0;\n },\n};\n","import { withPointer, effectScheduler } from \"./hook-engine.js\";\nexport function useEffect(cb, depArray) {\n withPointer((pointer) => {\n const oldDeps = pointer.get();\n const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));\n if (hasChanged) {\n effectScheduler.queue(cb);\n }\n pointer.set(depArray);\n });\n}\n","import { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nexport const defaultTheme = {\n prefix: {\n idle: styleText('blue', '?'),\n done: styleText('green', figures.tick),\n },\n spinner: {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'].map((frame) => styleText('yellow', frame)),\n },\n style: {\n answer: (text) => styleText('cyan', text),\n message: (text) => styleText('bold', text),\n error: (text) => styleText('red', `> ${text}`),\n defaultAnswer: (text) => styleText('dim', `(${text})`),\n help: (text) => styleText('dim', text),\n highlight: (text) => styleText('cyan', text),\n key: (text) => styleText('cyan', styleText('bold', `<${text}>`)),\n },\n};\n","// process.env dot-notation access prints:\n// Property 'TERM' comes from an index signature, so it must be accessed with ['TERM'].ts(4111)\n/* eslint dot-notation: [\"off\"] */\nimport process from 'node:process';\n// Ported from is-unicode-supported\nfunction isUnicodeSupported() {\n if (!process.platform.startsWith('win')) {\n return process.env['TERM'] !== 'linux'; // Linux console (kernel)\n }\n return (Boolean(process.env['CI']) || // CI environments generally support unicode\n Boolean(process.env['WT_SESSION']) || // Windows Terminal\n Boolean(process.env['TERMINUS_SUBLIME']) || // Terminus (<0.2.27)\n process.env['ConEmuTask'] === '{cmd::Cmder}' || // ConEmu and cmder\n process.env['TERM_PROGRAM'] === 'Terminus-Sublime' ||\n process.env['TERM_PROGRAM'] === 'vscode' ||\n process.env['TERM'] === 'xterm-256color' ||\n process.env['TERM'] === 'alacritty' ||\n process.env['TERMINAL_EMULATOR'] === 'JetBrains-JediTerm');\n}\n// Ported from figures\nconst common = {\n circleQuestionMark: '(?)',\n questionMarkPrefix: '(?)',\n square: '█',\n squareDarkShade: '▓',\n squareMediumShade: '▒',\n squareLightShade: '░',\n squareTop: '▀',\n squareBottom: '▄',\n squareLeft: '▌',\n squareRight: '▐',\n squareCenter: '■',\n bullet: '●',\n dot: '․',\n ellipsis: '…',\n pointerSmall: '›',\n triangleUp: '▲',\n triangleUpSmall: '▴',\n triangleDown: '▼',\n triangleDownSmall: '▾',\n triangleLeftSmall: '◂',\n triangleRightSmall: '▸',\n home: '⌂',\n heart: '♥',\n musicNote: '♪',\n musicNoteBeamed: '♫',\n arrowUp: '↑',\n arrowDown: '↓',\n arrowLeft: '←',\n arrowRight: '→',\n arrowLeftRight: '↔',\n arrowUpDown: '↕',\n almostEqual: '≈',\n notEqual: '≠',\n lessOrEqual: '≤',\n greaterOrEqual: '≥',\n identical: '≡',\n infinity: '∞',\n subscriptZero: '₀',\n subscriptOne: '₁',\n subscriptTwo: '₂',\n subscriptThree: '₃',\n subscriptFour: '₄',\n subscriptFive: '₅',\n subscriptSix: '₆',\n subscriptSeven: '₇',\n subscriptEight: '₈',\n subscriptNine: '₉',\n oneHalf: '½',\n oneThird: '⅓',\n oneQuarter: '¼',\n oneFifth: '⅕',\n oneSixth: '⅙',\n oneEighth: '⅛',\n twoThirds: '⅔',\n twoFifths: '⅖',\n threeQuarters: '¾',\n threeFifths: '⅗',\n threeEighths: '⅜',\n fourFifths: '⅘',\n fiveSixths: '⅚',\n fiveEighths: '⅝',\n sevenEighths: '⅞',\n line: '─',\n lineBold: '━',\n lineDouble: '═',\n lineDashed0: '┄',\n lineDashed1: '┅',\n lineDashed2: '┈',\n lineDashed3: '┉',\n lineDashed4: '╌',\n lineDashed5: '╍',\n lineDashed6: '╴',\n lineDashed7: '╶',\n lineDashed8: '╸',\n lineDashed9: '╺',\n lineDashed10: '╼',\n lineDashed11: '╾',\n lineDashed12: '−',\n lineDashed13: '–',\n lineDashed14: '‐',\n lineDashed15: '⁃',\n lineVertical: '│',\n lineVerticalBold: '┃',\n lineVerticalDouble: '║',\n lineVerticalDashed0: '┆',\n lineVerticalDashed1: '┇',\n lineVerticalDashed2: '┊',\n lineVerticalDashed3: '┋',\n lineVerticalDashed4: '╎',\n lineVerticalDashed5: '╏',\n lineVerticalDashed6: '╵',\n lineVerticalDashed7: '╷',\n lineVerticalDashed8: '╹',\n lineVerticalDashed9: '╻',\n lineVerticalDashed10: '╽',\n lineVerticalDashed11: '╿',\n lineDownLeft: '┐',\n lineDownLeftArc: '╮',\n lineDownBoldLeftBold: '┓',\n lineDownBoldLeft: '┒',\n lineDownLeftBold: '┑',\n lineDownDoubleLeftDouble: '╗',\n lineDownDoubleLeft: '╖',\n lineDownLeftDouble: '╕',\n lineDownRight: '┌',\n lineDownRightArc: '╭',\n lineDownBoldRightBold: '┏',\n lineDownBoldRight: '┎',\n lineDownRightBold: '┍',\n lineDownDoubleRightDouble: '╔',\n lineDownDoubleRight: '╓',\n lineDownRightDouble: '╒',\n lineUpLeft: '┘',\n lineUpLeftArc: '╯',\n lineUpBoldLeftBold: '┛',\n lineUpBoldLeft: '┚',\n lineUpLeftBold: '┙',\n lineUpDoubleLeftDouble: '╝',\n lineUpDoubleLeft: '╜',\n lineUpLeftDouble: '╛',\n lineUpRight: '└',\n lineUpRightArc: '╰',\n lineUpBoldRightBold: '┗',\n lineUpBoldRight: '┖',\n lineUpRightBold: '┕',\n lineUpDoubleRightDouble: '╚',\n lineUpDoubleRight: '╙',\n lineUpRightDouble: '╘',\n lineUpDownLeft: '┤',\n lineUpBoldDownBoldLeftBold: '┫',\n lineUpBoldDownBoldLeft: '┨',\n lineUpDownLeftBold: '┥',\n lineUpBoldDownLeftBold: '┩',\n lineUpDownBoldLeftBold: '┪',\n lineUpDownBoldLeft: '┧',\n lineUpBoldDownLeft: '┦',\n lineUpDoubleDownDoubleLeftDouble: '╣',\n lineUpDoubleDownDoubleLeft: '╢',\n lineUpDownLeftDouble: '╡',\n lineUpDownRight: '├',\n lineUpBoldDownBoldRightBold: '┣',\n lineUpBoldDownBoldRight: '┠',\n lineUpDownRightBold: '┝',\n lineUpBoldDownRightBold: '┡',\n lineUpDownBoldRightBold: '┢',\n lineUpDownBoldRight: '┟',\n lineUpBoldDownRight: '┞',\n lineUpDoubleDownDoubleRightDouble: '╠',\n lineUpDoubleDownDoubleRight: '╟',\n lineUpDownRightDouble: '╞',\n lineDownLeftRight: '┬',\n lineDownBoldLeftBoldRightBold: '┳',\n lineDownLeftBoldRightBold: '┯',\n lineDownBoldLeftRight: '┰',\n lineDownBoldLeftBoldRight: '┱',\n lineDownBoldLeftRightBold: '┲',\n lineDownLeftRightBold: '┮',\n lineDownLeftBoldRight: '┭',\n lineDownDoubleLeftDoubleRightDouble: '╦',\n lineDownDoubleLeftRight: '╥',\n lineDownLeftDoubleRightDouble: '╤',\n lineUpLeftRight: '┴',\n lineUpBoldLeftBoldRightBold: '┻',\n lineUpLeftBoldRightBold: '┷',\n lineUpBoldLeftRight: '┸',\n lineUpBoldLeftBoldRight: '┹',\n lineUpBoldLeftRightBold: '┺',\n lineUpLeftRightBold: '┶',\n lineUpLeftBoldRight: '┵',\n lineUpDoubleLeftDoubleRightDouble: '╩',\n lineUpDoubleLeftRight: '╨',\n lineUpLeftDoubleRightDouble: '╧',\n lineUpDownLeftRight: '┼',\n lineUpBoldDownBoldLeftBoldRightBold: '╋',\n lineUpDownBoldLeftBoldRightBold: '╈',\n lineUpBoldDownLeftBoldRightBold: '╇',\n lineUpBoldDownBoldLeftRightBold: '╊',\n lineUpBoldDownBoldLeftBoldRight: '╉',\n lineUpBoldDownLeftRight: '╀',\n lineUpDownBoldLeftRight: '╁',\n lineUpDownLeftBoldRight: '┽',\n lineUpDownLeftRightBold: '┾',\n lineUpBoldDownBoldLeftRight: '╂',\n lineUpDownLeftBoldRightBold: '┿',\n lineUpBoldDownLeftBoldRight: '╃',\n lineUpBoldDownLeftRightBold: '╄',\n lineUpDownBoldLeftBoldRight: '╅',\n lineUpDownBoldLeftRightBold: '╆',\n lineUpDoubleDownDoubleLeftDoubleRightDouble: '╬',\n lineUpDoubleDownDoubleLeftRight: '╫',\n lineUpDownLeftDoubleRightDouble: '╪',\n lineCross: '╳',\n lineBackslash: '╲',\n lineSlash: '╱',\n};\nconst specialMainSymbols = {\n tick: '✔',\n info: 'ℹ',\n warning: '⚠',\n cross: '✘',\n squareSmall: '◻',\n squareSmallFilled: '◼',\n circle: '◯',\n circleFilled: '◉',\n circleDotted: '◌',\n circleDouble: '◎',\n circleCircle: 'ⓞ',\n circleCross: 'ⓧ',\n circlePipe: 'Ⓘ',\n radioOn: '◉',\n radioOff: '◯',\n checkboxOn: '☒',\n checkboxOff: '☐',\n checkboxCircleOn: 'ⓧ',\n checkboxCircleOff: 'Ⓘ',\n pointer: '❯',\n triangleUpOutline: '△',\n triangleLeft: '◀',\n triangleRight: '▶',\n lozenge: '◆',\n lozengeOutline: '◇',\n hamburger: '☰',\n smiley: '㋡',\n mustache: '෴',\n star: '★',\n play: '▶',\n nodejs: '⬢',\n oneSeventh: '⅐',\n oneNinth: '⅑',\n oneTenth: '⅒',\n};\nconst specialFallbackSymbols = {\n tick: '√',\n info: 'i',\n warning: '‼',\n cross: '×',\n squareSmall: '□',\n squareSmallFilled: '■',\n circle: '( )',\n circleFilled: '(*)',\n circleDotted: '( )',\n circleDouble: '( )',\n circleCircle: '(○)',\n circleCross: '(×)',\n circlePipe: '(│)',\n radioOn: '(*)',\n radioOff: '( )',\n checkboxOn: '[×]',\n checkboxOff: '[ ]',\n checkboxCircleOn: '(×)',\n checkboxCircleOff: '( )',\n pointer: '>',\n triangleUpOutline: '∆',\n triangleLeft: '◄',\n triangleRight: '►',\n lozenge: '♦',\n lozengeOutline: '◊',\n hamburger: '≡',\n smiley: '☺',\n mustache: '┌─┐',\n star: '✶',\n play: '►',\n nodejs: '♦',\n oneSeventh: '1/7',\n oneNinth: '1/9',\n oneTenth: '1/10',\n};\nexport const mainSymbols = {\n ...common,\n ...specialMainSymbols,\n};\nexport const fallbackSymbols = {\n ...common,\n ...specialFallbackSymbols,\n};\nconst shouldUseMain = isUnicodeSupported();\nconst figures = shouldUseMain\n ? mainSymbols\n : fallbackSymbols;\nexport default figures;\nconst replacements = Object.entries(specialMainSymbols);\n// On terminals which do not support Unicode symbols, substitute them to other symbols\nexport const replaceSymbols = (string, { useFallback = !shouldUseMain } = {}) => {\n if (useFallback) {\n for (const [key, mainSymbol] of replacements) {\n const fallbackSymbol = fallbackSymbols[key];\n if (!fallbackSymbol) {\n throw new Error(`Unable to find fallback for ${key}`);\n }\n string = string.replaceAll(mainSymbol, fallbackSymbol);\n }\n }\n return string;\n};\n","import { defaultTheme } from \"./theme.js\";\nfunction isPlainObject(value) {\n if (typeof value !== 'object' || value === null)\n return false;\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n}\nfunction deepMerge(...objects) {\n const output = {};\n for (const obj of objects) {\n for (const [key, value] of Object.entries(obj)) {\n const prevValue = output[key];\n output[key] =\n isPlainObject(prevValue) && isPlainObject(value)\n ? deepMerge(prevValue, value)\n : value;\n }\n }\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return output;\n}\nexport function makeTheme(...themes) {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const themesToMerge = [\n defaultTheme,\n ...themes.filter((theme) => theme != null),\n ];\n return deepMerge(...themesToMerge);\n}\n","import { useState } from \"./use-state.js\";\nimport { useEffect } from \"./use-effect.js\";\nimport { makeTheme } from \"./make-theme.js\";\nexport function usePrefix({ status = 'idle', theme, }) {\n const [showLoader, setShowLoader] = useState(false);\n const [tick, setTick] = useState(0);\n const { prefix, spinner } = makeTheme(theme);\n useEffect(() => {\n if (status === 'loading') {\n let tickInterval;\n let inc = -1;\n // Delay displaying spinner by 300ms, to avoid flickering\n const delayTimeout = setTimeout(() => {\n setShowLoader(true);\n tickInterval = setInterval(() => {\n inc = inc + 1;\n setTick(inc % spinner.frames.length);\n }, spinner.interval);\n }, 300);\n return () => {\n clearTimeout(delayTimeout);\n clearInterval(tickInterval);\n };\n }\n else {\n setShowLoader(false);\n }\n }, [status]);\n if (showLoader) {\n return spinner.frames[tick];\n }\n // There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead.\n const iconName = status === 'loading' ? 'idle' : status;\n return typeof prefix === 'string' ? prefix : (prefix[iconName] ?? prefix['idle']);\n}\n","import { withPointer } from \"./hook-engine.js\";\nexport function useMemo(fn, dependencies) {\n return withPointer((pointer) => {\n const prev = pointer.get();\n if (!prev ||\n prev.dependencies.length !== dependencies.length ||\n prev.dependencies.some((dep, i) => dep !== dependencies[i])) {\n const value = fn();\n pointer.set({ value, dependencies });\n return value;\n }\n return prev.value;\n });\n}\n","import { useState } from \"./use-state.js\";\nexport function useRef(val) {\n return useState({ current: val })[0];\n}\n","import { useRef } from \"./use-ref.js\";\nimport { useEffect } from \"./use-effect.js\";\nimport { withUpdates } from \"./hook-engine.js\";\nexport function useKeypress(userHandler) {\n const signal = useRef(userHandler);\n signal.current = userHandler;\n useEffect((rl) => {\n let ignore = false;\n const handler = withUpdates((_input, event) => {\n if (ignore)\n return;\n void signal.current(event, rl);\n });\n rl.input.on('keypress', handler);\n return () => {\n ignore = true;\n rl.input.removeListener('keypress', handler);\n };\n }, []);\n}\n","import cliWidth from 'cli-width';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { readline } from \"./hook-engine.js\";\n/**\n * Force line returns at specific width. This function is ANSI code friendly and it'll\n * ignore invisible codes during width calculation.\n * @param {string} content\n * @param {number} width\n * @return {string}\n */\nexport function breakLines(content, width) {\n return content\n .split('\\n')\n .flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true })\n .split('\\n')\n .map((str) => str.trimEnd()))\n .join('\\n');\n}\n/**\n * Returns the width of the active readline, or 80 as default value.\n * @returns {number}\n */\nexport function readlineWidth() {\n return cliWidth({ defaultWidth: 80, output: readline().output });\n}\n","/* MAIN */\nconst getCodePointsLength = (() => {\n const SURROGATE_PAIR_RE = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n return (input) => {\n let surrogatePairsNr = 0;\n SURROGATE_PAIR_RE.lastIndex = 0;\n while (SURROGATE_PAIR_RE.test(input)) {\n surrogatePairsNr += 1;\n }\n return input.length - surrogatePairsNr;\n };\n})();\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWideNotCJKTNotEmoji = (x) => {\n return x === 0x231B || x === 0x2329 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji };\n","/* IMPORT */\nimport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\\u001b\\]8;[^;]*;.*?(?:\\u0007|\\u001b\\u005c)/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst CJKT_WIDE_RE = /(?:(?![\\uFF61-\\uFF9F\\uFF00-\\uFFEF])[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\p{Script=Tangut}]){1,1000}/yu;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;\n const PARSE_BLOCKS = [\n [LATIN_RE, REGULAR_WIDTH],\n [ANSI_RE, ANSI_WIDTH],\n [CONTROL_RE, CONTROL_WIDTH],\n [TAB_RE, TAB_WIDTH],\n [EMOJI_RE, EMOJI_WIDTH],\n [CJKT_WIDE_RE, WIDE_WIDTH],\n ];\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWideNotCJKTNotEmoji(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length) {\n break outer;\n }\n /* PARSE BLOCKS */\n for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {\n const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];\n BLOCK_RE.lastIndex = index;\n if (BLOCK_RE.test(input)) {\n lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;\n widthExtra = lengthExtra * BLOCK_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = BLOCK_RE.lastIndex;\n continue outer;\n }\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n",null,"import { useRef } from \"../use-ref.js\";\nimport { readlineWidth, breakLines } from \"../utils.js\";\nfunction usePointerPosition({ active, renderedItems, pageSize, loop, }) {\n const state = useRef({\n lastPointer: active,\n lastActive: undefined,\n });\n const { lastPointer, lastActive } = state.current;\n const middle = Math.floor(pageSize / 2);\n const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);\n const defaultPointerPosition = renderedItems\n .slice(0, active)\n .reduce((acc, item) => acc + item.length, 0);\n let pointer = defaultPointerPosition;\n if (renderedLength > pageSize) {\n if (loop) {\n /**\n * Creates the next position for the pointer considering an infinitely\n * looping list of items to be rendered on the page.\n *\n * The goal is to progressively move the cursor to the middle position as the user move down, and then keep\n * the cursor there. When the user move up, maintain the cursor position.\n */\n // By default, keep the cursor position as-is.\n pointer = lastPointer;\n if (\n // First render, skip this logic.\n lastActive != null &&\n // Only move the pointer down when the user moves down.\n lastActive < active &&\n // Check user didn't move up across page boundary.\n active - lastActive < pageSize) {\n pointer = Math.min(\n // Furthest allowed position for the pointer is the middle of the list\n middle, Math.abs(active - lastActive) === 1\n ? Math.min(\n // Move the pointer at most the height of the last active item.\n lastPointer + (renderedItems[lastActive]?.length ?? 0), \n // If the user moved by one item, move the pointer to the natural position of the active item as\n // long as it doesn't move the cursor up.\n Math.max(defaultPointerPosition, lastPointer))\n : // Otherwise, move the pointer down by the difference between the active and last active item.\n lastPointer + active - lastActive);\n }\n }\n else {\n /**\n * Creates the next position for the pointer considering a finite list of\n * items to be rendered on a page.\n *\n * The goal is to keep the pointer in the middle of the page whenever possible, until\n * we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively\n * to the bottom or top of the list.\n */\n const spaceUnderActive = renderedItems\n .slice(active)\n .reduce((acc, item) => acc + item.length, 0);\n pointer =\n spaceUnderActive < pageSize - middle\n ? // If the active item is near the end of the list, progressively move the cursor towards the end.\n pageSize - spaceUnderActive\n : // Otherwise, progressively move the pointer to the middle of the list.\n Math.min(defaultPointerPosition, middle);\n }\n }\n // Save state for the next render\n state.current.lastPointer = pointer;\n state.current.lastActive = active;\n return pointer;\n}\nexport function usePagination({ items, active, renderItem, pageSize, loop = true, }) {\n const width = readlineWidth();\n const bound = (num) => ((num % items.length) + items.length) % items.length;\n const renderedItems = items.map((item, index) => {\n if (item == null)\n return [];\n return breakLines(renderItem({ item, index, isActive: index === active }), width).split('\\n');\n });\n const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);\n const renderItemAtIndex = (index) => renderedItems[index] ?? [];\n const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });\n // Render the active item to decide the position.\n // If the active item fits under the pointer, we render it there.\n // Otherwise, we need to render it to fit at the bottom of the page; moving the pointer up.\n const activeItem = renderItemAtIndex(active).slice(0, pageSize);\n const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;\n // Create an array of lines for the page, and add the lines of the active item into the page\n const pageBuffer = Array.from({ length: pageSize });\n pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);\n // Store to prevent rendering the same item twice\n const itemVisited = new Set([active]);\n // Fill the page under the active item\n let bufferPointer = activeItemPosition + activeItem.length;\n let itemPointer = bound(active + 1);\n while (bufferPointer < pageSize &&\n !itemVisited.has(itemPointer) &&\n (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {\n const lines = renderItemAtIndex(itemPointer);\n const linesToAdd = lines.slice(0, pageSize - bufferPointer);\n pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);\n // Move pointers for next iteration\n itemVisited.add(itemPointer);\n bufferPointer += linesToAdd.length;\n itemPointer = bound(itemPointer + 1);\n }\n // Fill the page over the active item\n bufferPointer = activeItemPosition - 1;\n itemPointer = bound(active - 1);\n while (bufferPointer >= 0 &&\n !itemVisited.has(itemPointer) &&\n (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {\n const lines = renderItemAtIndex(itemPointer);\n const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));\n pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);\n // Move pointers for next iteration\n itemVisited.add(itemPointer);\n bufferPointer -= linesToAdd.length;\n itemPointer = bound(itemPointer - 1);\n }\n return pageBuffer.filter((line) => typeof line === 'string').join('\\n');\n}\n","import * as readline from 'node:readline';\nimport { AsyncResource } from 'node:async_hooks';\nimport MuteStream from 'mute-stream';\nimport { onExit as onSignalExit } from 'signal-exit';\nimport ScreenManager from \"./screen-manager.js\";\nimport { PromisePolyfill } from \"./promise-polyfill.js\";\nimport { withHooks, effectScheduler } from \"./hook-engine.js\";\nimport { AbortPromptError, CancelPromptError, ExitPromptError } from \"./errors.js\";\nimport path from 'node:path';\n// Capture the real setImmediate at module load time so it works even when test\n// frameworks mock timers with vi.useFakeTimers() or similar.\nconst nativeSetImmediate = globalThis.setImmediate;\nfunction getCallSites() {\n // oxlint-disable-next-line typescript/unbound-method\n const savedPrepareStackTrace = Error.prepareStackTrace;\n let result = [];\n try {\n Error.prepareStackTrace = (_, callSites) => {\n const callSitesWithoutCurrent = callSites.slice(1);\n result = callSitesWithoutCurrent;\n return callSitesWithoutCurrent;\n };\n // oxlint-disable-next-line no-unused-expressions\n new Error().stack;\n }\n catch {\n // An error will occur if the Node flag --frozen-intrinsics is used.\n // https://nodejs.org/api/cli.html#--frozen-intrinsics\n return result;\n }\n Error.prepareStackTrace = savedPrepareStackTrace;\n return result;\n}\nexport function createPrompt(view) {\n const callSites = getCallSites();\n const prompt = (config, context = {}) => {\n // Default `input` to stdin\n const { input = process.stdin, signal } = context;\n const cleanups = new Set();\n // Add mute capabilities to the output\n const output = new MuteStream();\n output.pipe(context.output ?? process.stdout);\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const rl = readline.createInterface({\n terminal: true,\n input,\n output,\n });\n // Mute the output after readline has initialized so readline can perform\n // any terminal setup writes (e.g. Windows Console API initialization)\n // before suppressing output. ScreenManager will unmute/mute around each\n // render call as needed.\n output.mute();\n const screen = new ScreenManager(rl);\n const { promise, resolve, reject } = PromisePolyfill.withResolver();\n const cancel = () => reject(new CancelPromptError());\n if (signal) {\n const abort = () => reject(new AbortPromptError({ cause: signal.reason }));\n if (signal.aborted) {\n abort();\n return Object.assign(promise, { cancel });\n }\n signal.addEventListener('abort', abort);\n cleanups.add(() => signal.removeEventListener('abort', abort));\n }\n cleanups.add(onSignalExit((code, signal) => {\n reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));\n }));\n // SIGINT must be explicitly handled by the prompt so the ExitPromptError can be handled.\n // Otherwise, the prompt will stop and in some scenarios never resolve.\n // Ref issue #1741\n const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));\n rl.on('SIGINT', sigint);\n cleanups.add(() => rl.removeListener('SIGINT', sigint));\n return withHooks(rl, (cycle) => {\n // The close event triggers immediately when the user press ctrl+c. SignalExit on the other hand\n // triggers after the process is done (which happens after timeouts are done triggering.)\n // We triggers the hooks cleanup phase on rl `close` so active timeouts can be cleared.\n const hooksCleanup = AsyncResource.bind(() => effectScheduler.clearAll());\n rl.on('close', hooksCleanup);\n cleanups.add(() => rl.removeListener('close', hooksCleanup));\n const startCycle = () => {\n // Re-renders only happen when the state change; but the readline cursor could\n // change position and that also requires a re-render (and a manual one because\n // we mute the streams). We set the listener after the initial workLoop to avoid\n // a double render if render triggered by a state change sets the cursor to the\n // right position.\n const checkCursorPos = () => screen.checkCursorPos();\n rl.input.on('keypress', checkCursorPos);\n cleanups.add(() => rl.input.removeListener('keypress', checkCursorPos));\n let pendingDone = null;\n cycle(() => {\n let effectsSettled = false;\n try {\n const nextView = view(config, (value) => {\n if (effectsSettled) {\n // After the cycle completes (async validation path), the \"done\"\n // render already flushed via setStatus → handleChange, so resolve\n // immediately.\n resolve(value);\n }\n else {\n pendingDone = { value };\n }\n });\n // Typescript won't allow this, but not all users rely on typescript.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (nextView === undefined) {\n let callerFilename = callSites[1]?.getFileName();\n if (callerFilename && !callerFilename.startsWith('file://')) {\n callerFilename = path.resolve(callerFilename);\n }\n throw new Error(`Prompt functions must return a string.\\n at ${callerFilename}`);\n }\n const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView;\n screen.render(content, bottomContent);\n effectScheduler.run();\n }\n catch (error) {\n reject(error);\n }\n effectsSettled = true;\n if (pendingDone !== null) {\n const { value } = pendingDone;\n pendingDone = null;\n resolve(value);\n }\n });\n };\n // Proper Readable streams (like process.stdin) may have OS-level buffered\n // data that arrives in the poll phase when readline resumes the stream.\n // Deferring the first render by one setImmediate tick (check phase, after\n // poll) lets that stale data flow through readline harmlessly—no keypress\n // handlers are registered yet and the output is muted, so the stale\n // keystrokes are silently discarded.\n // Old-style streams (like MuteStream) have no such buffering, so the\n // render cycle starts immediately.\n //\n // @see https://github.com/SBoudrias/Inquirer.js/issues/1303\n if ('readableFlowing' in input) {\n nativeSetImmediate(startCycle);\n }\n else {\n startCycle();\n }\n return Object.assign(promise\n .then((answer) => {\n effectScheduler.clearAll();\n return answer;\n }, (error) => {\n effectScheduler.clearAll();\n throw error;\n })\n // Wait for the promise to settle, then cleanup.\n .finally(() => {\n cleanups.forEach((cleanup) => cleanup());\n screen.done({ clearContent: Boolean(context.clearPromptOnDone) });\n output.end();\n })\n // Once cleanup is done, let the expose promise resolve/reject to the internal one.\n .then(() => promise), { cancel });\n });\n };\n return prompt;\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 { stripVTControlCharacters } from 'node:util';\nimport { breakLines, readlineWidth } from \"./utils.js\";\nimport { cursorDown, cursorLeft, cursorUp, cursorTo, cursorShow, eraseLines, } from '@inquirer/ansi';\nconst height = (content) => content.split('\\n').length;\nconst lastLine = (content) => content.split('\\n').pop() ?? '';\nexport default class ScreenManager {\n // These variables are keeping information to allow correct prompt re-rendering\n height = 0;\n extraLinesUnderPrompt = 0;\n cursorPos;\n rl;\n constructor(rl) {\n this.rl = rl;\n this.cursorPos = rl.getCursorPos();\n }\n write(content) {\n this.rl.output.unmute();\n this.rl.output.write(content);\n this.rl.output.mute();\n }\n render(content, bottomContent = '') {\n // Write message to screen and setPrompt to control backspace\n const promptLine = lastLine(content);\n const rawPromptLine = stripVTControlCharacters(promptLine);\n // Remove the rl.line from our prompt. We can't rely on the content of\n // rl.line (mainly because of the password prompt), so just rely on it's\n // length.\n let prompt = rawPromptLine;\n if (this.rl.line.length > 0) {\n prompt = prompt.slice(0, -this.rl.line.length);\n }\n this.rl.setPrompt(prompt);\n // SetPrompt will change cursor position, now we can get correct value\n this.cursorPos = this.rl.getCursorPos();\n const width = readlineWidth();\n content = breakLines(content, width);\n bottomContent = breakLines(bottomContent, width);\n // Manually insert an extra line if we're at the end of the line.\n // This prevent the cursor from appearing at the beginning of the\n // current line.\n if (rawPromptLine.length % width === 0) {\n content += '\\n';\n }\n let output = content + (bottomContent ? '\\n' + bottomContent : '');\n /**\n * Re-adjust the cursor at the correct position.\n */\n // We need to consider parts of the prompt under the cursor as part of the bottom\n // content in order to correctly cleanup and re-render.\n const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;\n const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);\n // Return cursor to the input position (on top of the bottomContent)\n if (bottomContentHeight > 0)\n output += cursorUp(bottomContentHeight);\n // Return cursor to the initial left offset.\n output += cursorTo(this.cursorPos.cols);\n /**\n * Render and store state for future re-rendering\n */\n this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);\n this.extraLinesUnderPrompt = bottomContentHeight;\n this.height = height(output);\n }\n checkCursorPos() {\n const cursorPos = this.rl.getCursorPos();\n if (cursorPos.cols !== this.cursorPos.cols) {\n this.write(cursorTo(cursorPos.cols));\n this.cursorPos = cursorPos;\n }\n }\n done({ clearContent }) {\n this.rl.setPrompt('');\n let output = cursorDown(this.extraLinesUnderPrompt);\n output += clearContent ? eraseLines(this.height) : '\\n';\n // Reset cursor to column 0. On Windows terminals, \\n moves the cursor\n // down without resetting the column when the rendered prompt+answer\n // wraps past the terminal width. Without this, all subsequent output\n // starts at the wrong horizontal offset.\n output += cursorLeft;\n output += cursorShow;\n this.write(output);\n this.rl.close();\n }\n}\n","const ESC = '\\u001B[';\n/** Move cursor to first column */\nexport const cursorLeft = ESC + 'G';\n/** Hide the cursor */\nexport const cursorHide = ESC + '?25l';\n/** Show the cursor */\nexport const cursorShow = ESC + '?25h';\n/** Move cursor up by count rows */\nexport const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '');\n/** Move cursor down by count rows */\nexport const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : '';\n/** Move cursor to position (x, y) */\nexport const cursorTo = (x, y) => {\n if (typeof y === 'number' && !Number.isNaN(y)) {\n return `${ESC}${y + 1};${x + 1}H`;\n }\n return `${ESC}${x + 1}G`;\n};\nconst eraseLine = ESC + '2K';\n/** Erase the specified number of lines above the cursor */\nexport const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : '';\n","// TODO: Remove this class once Node 22 becomes the minimum supported version.\nexport class PromisePolyfill extends Promise {\n // Available starting from Node 22\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers\n static withResolver() {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve, reject: reject };\n }\n}\n","import { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\n/**\n * Separator object\n * Used to space/separate choices group\n */\nexport class Separator {\n separator = styleText('dim', Array.from({ length: 15 }).join(figures.line));\n type = 'separator';\n constructor(separator) {\n if (separator) {\n this.separator = separator;\n }\n }\n static isSeparator(choice) {\n return Boolean(choice &&\n typeof choice === 'object' &&\n 'type' in choice &&\n choice.type === 'separator');\n }\n}\n","import { createPrompt, useState, useKeypress, useEffect, usePrefix, isBackspaceKey, isEnterKey, isTabKey, makeTheme, } from '@inquirer/core';\nconst inputTheme = {\n validationFailureMode: 'keep',\n};\nexport default createPrompt((config, done) => {\n const { prefill = 'tab' } = config;\n const theme = makeTheme(inputTheme, config.theme);\n const [status, setStatus] = useState('idle');\n // Coerce to string to handle runtime values that may be numbers despite TypeScript types\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const [defaultValue, setDefaultValue] = useState(String(config.default ?? ''));\n const [errorMsg, setError] = useState();\n const [value, setValue] = useState('');\n const prefix = usePrefix({ status, theme });\n async function validate(value) {\n const { required, pattern, patternError = 'Invalid input' } = config;\n if (required && !value) {\n return 'You must provide a value';\n }\n if (pattern && !pattern.test(value)) {\n return patternError;\n }\n if (typeof config.validate === 'function') {\n return (await config.validate(value)) || 'You must provide a valid value';\n }\n return true;\n }\n useKeypress(async (key, rl) => {\n // Ignore keypress while our prompt is doing other processing.\n if (status !== 'idle') {\n return;\n }\n if (isEnterKey(key)) {\n const answer = value || defaultValue;\n setStatus('loading');\n const isValid = await validate(answer);\n if (isValid === true) {\n setValue(answer);\n setStatus('done');\n done(answer);\n }\n else {\n if (theme.validationFailureMode === 'clear') {\n setValue('');\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(value);\n }\n setError(isValid);\n setStatus('idle');\n }\n }\n else if (isBackspaceKey(key) && !value) {\n setDefaultValue('');\n }\n else if (isTabKey(key) && !value) {\n setDefaultValue('');\n rl.clearLine(0); // Remove the tab character.\n rl.write(defaultValue);\n setValue(defaultValue);\n }\n else {\n setValue(rl.line);\n setError(undefined);\n }\n });\n // If prefill is set to 'editable' cut out the default value and paste into current state and the user's cli buffer\n // They can edit the value immediately instead of needing to press 'tab'\n useEffect((rl) => {\n if (prefill === 'editable' && defaultValue) {\n rl.write(defaultValue);\n setValue(defaultValue);\n }\n }, []);\n const message = theme.style.message(config.message, status);\n let formattedValue = value;\n if (typeof config.transformer === 'function') {\n formattedValue = config.transformer(value, { isFinal: status === 'done' });\n }\n else if (status === 'done') {\n formattedValue = theme.style.answer(value);\n }\n let defaultStr;\n if (defaultValue && status !== 'done' && !value) {\n defaultStr = theme.style.defaultAnswer(defaultValue);\n }\n let error = '';\n if (errorMsg) {\n error = theme.style.error(errorMsg);\n }\n return [\n [prefix, message, defaultStr, formattedValue]\n .filter((v) => v !== undefined)\n .join(' '),\n error,\n ];\n});\n","import { createPrompt, useState, useKeypress, usePrefix, isEnterKey, makeTheme, } from '@inquirer/core';\nimport { cursorHide } from '@inquirer/ansi';\nconst passwordTheme = {\n style: {\n maskedText: '[input is masked]',\n },\n};\nexport default createPrompt((config, done) => {\n const { validate = () => true } = config;\n const theme = makeTheme(passwordTheme, config.theme);\n const [status, setStatus] = useState('idle');\n const [errorMsg, setError] = useState();\n const [value, setValue] = useState('');\n const prefix = usePrefix({ status, theme });\n useKeypress(async (key, rl) => {\n // Ignore keypress while our prompt is doing other processing.\n if (status !== 'idle') {\n return;\n }\n if (isEnterKey(key)) {\n const answer = value;\n setStatus('loading');\n const isValid = await validate(answer);\n if (isValid === true) {\n setValue(answer);\n setStatus('done');\n done(answer);\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(value);\n setError(isValid || 'You must provide a valid value');\n setStatus('idle');\n }\n }\n else {\n setValue(rl.line);\n setError(undefined);\n }\n });\n const message = theme.style.message(config.message, status);\n let formattedValue = '';\n let helpTip;\n if (config.mask) {\n const maskChar = typeof config.mask === 'string' ? config.mask : '*';\n formattedValue = maskChar.repeat(value.length);\n }\n else if (status !== 'done') {\n helpTip = `${theme.style.help(theme.style.maskedText)}${cursorHide}`;\n }\n if (status === 'done') {\n formattedValue = theme.style.answer(formattedValue);\n }\n let error = '';\n if (errorMsg) {\n error = theme.style.error(errorMsg);\n }\n return [[prefix, message, config.mask ? formattedValue : helpTip].join(' '), error];\n});\n","import { createPrompt, useState, useKeypress, usePrefix, usePagination, useEffect, useMemo, useRef, isDownKey, isEnterKey, isTabKey, isUpKey, Separator, makeTheme, } from '@inquirer/core';\nimport { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nconst searchTheme = {\n icon: { cursor: figures.pointer },\n style: {\n disabled: (text) => styleText('dim', `- ${text}`),\n searchTerm: (text) => styleText('cyan', text),\n description: (text) => styleText('cyan', text),\n keysHelpTip: (keys) => keys\n .map(([key, action]) => `${styleText('bold', key)} ${styleText('dim', action)}`)\n .join(styleText('dim', ' • ')),\n },\n};\nfunction isSelectable(item) {\n return !Separator.isSeparator(item) && !item.disabled;\n}\nfunction normalizeChoices(choices) {\n return choices.map((choice) => {\n if (Separator.isSeparator(choice))\n return choice;\n if (typeof choice !== 'object' || choice === null || !('value' in choice)) {\n const name = String(choice);\n return {\n value: choice,\n name,\n short: name,\n disabled: false,\n };\n }\n const name = choice.name ?? String(choice.value);\n const normalizedChoice = {\n value: choice.value,\n name,\n short: choice.short ?? name,\n disabled: choice.disabled ?? false,\n };\n if (choice.description) {\n normalizedChoice.description = choice.description;\n }\n return normalizedChoice;\n });\n}\nexport default createPrompt((config, done) => {\n const { pageSize = 7, validate = () => true } = config;\n const theme = makeTheme(searchTheme, config.theme);\n const [status, setStatus] = useState('loading');\n const [searchTerm, setSearchTerm] = useState('');\n const [searchResults, setSearchResults] = useState([]);\n const [searchError, setSearchError] = useState();\n const defaultApplied = useRef(false);\n const prefix = usePrefix({ status, theme });\n const bounds = useMemo(() => {\n const first = searchResults.findIndex(isSelectable);\n const last = searchResults.findLastIndex(isSelectable);\n return { first, last };\n }, [searchResults]);\n const [active = bounds.first, setActive] = useState();\n useEffect(() => {\n const controller = new AbortController();\n setStatus('loading');\n setSearchError(undefined);\n const fetchResults = async () => {\n try {\n const results = await config.source(searchTerm || undefined, {\n signal: controller.signal,\n });\n if (!controller.signal.aborted) {\n const normalized = normalizeChoices(results);\n let initialActive;\n if (!defaultApplied.current && 'default' in config) {\n const defaultIndex = normalized.findIndex((item) => isSelectable(item) && item.value === config.default);\n initialActive = defaultIndex === -1 ? undefined : defaultIndex;\n defaultApplied.current = true;\n }\n setActive(initialActive);\n setSearchError(undefined);\n setSearchResults(normalized);\n setStatus('idle');\n }\n }\n catch (error) {\n if (!controller.signal.aborted && error instanceof Error) {\n setSearchError(error.message);\n }\n }\n };\n void fetchResults();\n return () => {\n controller.abort();\n };\n }, [searchTerm]);\n // Safe to assume the cursor position never points to a Separator.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const selectedChoice = searchResults[active];\n useKeypress(async (key, rl) => {\n if (isEnterKey(key)) {\n if (selectedChoice) {\n setStatus('loading');\n const isValid = await validate(selectedChoice.value);\n setStatus('idle');\n if (isValid === true) {\n setStatus('done');\n done(selectedChoice.value);\n }\n else if (selectedChoice.name === searchTerm) {\n setSearchError(isValid || 'You must provide a valid value');\n }\n else {\n // Reset line with new search term\n rl.write(selectedChoice.name);\n setSearchTerm(selectedChoice.name);\n }\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(searchTerm);\n }\n }\n else if (isTabKey(key) && selectedChoice) {\n rl.clearLine(0); // Remove the tab character.\n rl.write(selectedChoice.name);\n setSearchTerm(selectedChoice.name);\n }\n else if (status !== 'loading' && (isUpKey(key) || isDownKey(key))) {\n rl.clearLine(0);\n if ((isUpKey(key) && active !== bounds.first) ||\n (isDownKey(key) && active !== bounds.last)) {\n const offset = isUpKey(key) ? -1 : 1;\n let next = active;\n do {\n next = (next + offset + searchResults.length) % searchResults.length;\n } while (!isSelectable(searchResults[next]));\n setActive(next);\n }\n }\n else {\n setSearchTerm(rl.line);\n }\n });\n const message = theme.style.message(config.message, status);\n const helpLine = theme.style.keysHelpTip([\n ['↑↓', 'navigate'],\n ['⏎', 'select'],\n ]);\n const page = usePagination({\n items: searchResults,\n active,\n renderItem({ item, isActive }) {\n if (Separator.isSeparator(item)) {\n return ` ${item.separator}`;\n }\n if (item.disabled) {\n const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';\n return theme.style.disabled(`${item.name} ${disabledLabel}`);\n }\n const color = isActive ? theme.style.highlight : (x) => x;\n const cursor = isActive ? theme.icon.cursor : ` `;\n return color(`${cursor} ${item.name}`);\n },\n pageSize,\n loop: false,\n });\n let error;\n if (searchError) {\n error = theme.style.error(searchError);\n }\n else if (searchResults.length === 0 && searchTerm !== '' && status === 'idle') {\n error = theme.style.error('No results found');\n }\n let searchStr;\n if (status === 'done' && selectedChoice) {\n return [prefix, message, theme.style.answer(selectedChoice.short)]\n .filter(Boolean)\n .join(' ')\n .trimEnd();\n }\n else {\n searchStr = theme.style.searchTerm(searchTerm);\n }\n const description = selectedChoice?.description;\n const header = [prefix, message, searchStr].filter(Boolean).join(' ').trimEnd();\n const body = [\n error ?? page,\n ' ',\n description ? theme.style.description(description) : '',\n helpLine,\n ]\n .filter(Boolean)\n .join('\\n')\n .trimEnd();\n return [header, body];\n});\nexport { Separator } from '@inquirer/core';\n","import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, useEffect, isBackspaceKey, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, ValidationError, makeTheme, } from '@inquirer/core';\nimport { cursorHide } from '@inquirer/ansi';\nimport { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nconst selectTheme = {\n icon: { cursor: figures.pointer },\n style: {\n disabled: (text) => styleText('dim', text),\n description: (text) => styleText('cyan', text),\n keysHelpTip: (keys) => keys\n .map(([key, action]) => `${styleText('bold', key)} ${styleText('dim', action)}`)\n .join(styleText('dim', ' • ')),\n },\n i18n: { disabledError: 'This option is disabled and cannot be selected.' },\n indexMode: 'hidden',\n keybindings: [],\n};\nfunction isSelectable(item) {\n return !Separator.isSeparator(item) && !item.disabled;\n}\nfunction isNavigable(item) {\n return !Separator.isSeparator(item);\n}\nfunction normalizeChoices(choices) {\n return choices.map((choice) => {\n if (Separator.isSeparator(choice))\n return choice;\n if (typeof choice !== 'object' || choice === null || !('value' in choice)) {\n // It's a raw value (string, number, etc.)\n const name = String(choice);\n return {\n value: choice,\n name,\n short: name,\n disabled: false,\n };\n }\n const name = choice.name ?? String(choice.value);\n const normalizedChoice = {\n value: choice.value,\n name,\n short: choice.short ?? name,\n disabled: choice.disabled ?? false,\n };\n if (choice.description) {\n normalizedChoice.description = choice.description;\n }\n return normalizedChoice;\n });\n}\nexport default createPrompt((config, done) => {\n const { loop = true, pageSize = 7 } = config;\n const theme = makeTheme(selectTheme, config.theme);\n const { keybindings } = theme;\n const [status, setStatus] = useState('idle');\n const prefix = usePrefix({ status, theme });\n const searchTimeoutRef = useRef();\n // Vim keybindings (j/k) conflict with typing those letters in search,\n // so search must be disabled when vim bindings are enabled\n const searchEnabled = !keybindings.includes('vim');\n const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);\n const bounds = useMemo(() => {\n const first = items.findIndex(isNavigable);\n const last = items.findLastIndex(isNavigable);\n if (first === -1) {\n throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');\n }\n return { first, last };\n }, [items]);\n const defaultItemIndex = useMemo(() => {\n if (!('default' in config))\n return -1;\n return items.findIndex((item) => isSelectable(item) && item.value === config.default);\n }, [config.default, items]);\n const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);\n const selectedChoice = items[active];\n if (selectedChoice == null || Separator.isSeparator(selectedChoice)) {\n throw new Error('Active index does not point to a choice');\n }\n const [errorMsg, setError] = useState();\n useKeypress((key, rl) => {\n clearTimeout(searchTimeoutRef.current);\n if (errorMsg) {\n setError(undefined);\n }\n if (isEnterKey(key)) {\n if (selectedChoice.disabled) {\n setError(theme.i18n.disabledError);\n }\n else {\n setStatus('done');\n done(selectedChoice.value);\n }\n }\n else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {\n rl.clearLine(0);\n if (loop ||\n (isUpKey(key, keybindings) && active !== bounds.first) ||\n (isDownKey(key, keybindings) && active !== bounds.last)) {\n const offset = isUpKey(key, keybindings) ? -1 : 1;\n let next = active;\n do {\n next = (next + offset + items.length) % items.length;\n } while (!isNavigable(items[next]));\n setActive(next);\n }\n }\n else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {\n const selectedIndex = Number(rl.line) - 1;\n // Find the nth item (ignoring separators)\n let selectableIndex = -1;\n const position = items.findIndex((item) => {\n if (Separator.isSeparator(item))\n return false;\n selectableIndex++;\n return selectableIndex === selectedIndex;\n });\n const item = items[position];\n if (item != null && isSelectable(item)) {\n setActive(position);\n }\n searchTimeoutRef.current = setTimeout(() => {\n rl.clearLine(0);\n }, 700);\n }\n else if (isBackspaceKey(key)) {\n rl.clearLine(0);\n }\n else if (searchEnabled) {\n const searchTerm = rl.line.toLowerCase();\n const matchIndex = items.findIndex((item) => {\n if (Separator.isSeparator(item) || !isSelectable(item))\n return false;\n return item.name.toLowerCase().startsWith(searchTerm);\n });\n if (matchIndex !== -1) {\n setActive(matchIndex);\n }\n searchTimeoutRef.current = setTimeout(() => {\n rl.clearLine(0);\n }, 700);\n }\n });\n useEffect(() => () => {\n clearTimeout(searchTimeoutRef.current);\n }, []);\n const message = theme.style.message(config.message, status);\n const helpLine = theme.style.keysHelpTip([\n ['↑↓', 'navigate'],\n ['⏎', 'select'],\n ]);\n let separatorCount = 0;\n const page = usePagination({\n items,\n active,\n renderItem({ item, isActive, index }) {\n if (Separator.isSeparator(item)) {\n separatorCount++;\n return ` ${item.separator}`;\n }\n const cursor = isActive ? theme.icon.cursor : ' ';\n const indexLabel = theme.indexMode === 'number' ? `${index + 1 - separatorCount}. ` : '';\n if (item.disabled) {\n const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';\n const disabledCursor = isActive ? theme.icon.cursor : '-';\n return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);\n }\n const color = isActive ? theme.style.highlight : (x) => x;\n return color(`${cursor} ${indexLabel}${item.name}`);\n },\n pageSize,\n loop,\n });\n if (status === 'done') {\n return [prefix, message, theme.style.answer(selectedChoice.short)]\n .filter(Boolean)\n .join(' ');\n }\n const { description } = selectedChoice;\n const lines = [\n [prefix, message].filter(Boolean).join(' '),\n page,\n ' ',\n description ? theme.style.description(description) : '',\n errorMsg ? theme.style.error(errorMsg) : '',\n helpLine,\n ]\n .filter(Boolean)\n .join('\\n')\n .trimEnd();\n return `${lines}${cursorHide}`;\n});\nexport { Separator } from '@inquirer/core';\n","/**\n * OAuth PKCE browser-based login flow for Cognite Data Fusion.\n *\n * Opens the user's browser to authenticate via auth.cognite.com,\n * receives the callback on a local HTTPS server, and exchanges\n * the authorization code for an access token.\n */\n\nimport { execFileSync } from \"node:child_process\";\nimport crypto from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport https from \"node:https\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { openBrowser } from \"./browser\";\n\nconst LOGIN_CONFIG = {\n authority: \"https://auth.cognite.com\",\n clientId: \"0404baaa-0a90-43a2-aba7-a110b53fb41c\",\n redirectUri: \"https://localhost:3000/\",\n port: 3000,\n loginTimeout: 300_000,\n certDir: join(homedir(), \".cdf-login\"),\n};\n\nexport interface LoginOptions {\n org?: string;\n}\n\n// --- PKCE helpers ---\n\nfunction base64Url(input: Buffer): string {\n return input.toString(\"base64\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/g, \"\");\n}\n\nfunction randomBase64Url(bytes = 32): string {\n return base64Url(crypto.randomBytes(bytes));\n}\n\nfunction pkceChallenge(verifier: string): string {\n return base64Url(crypto.createHash(\"sha256\").update(verifier).digest());\n}\n\n// --- HTTP helpers ---\n\ninterface OpenIdConfiguration {\n authorization_endpoint?: string;\n token_endpoint?: string;\n}\n\ninterface TokenResponse {\n access_token?: string;\n [key: string]: unknown;\n}\n\nasync function fetchJson(url: string, options?: RequestInit): Promise<Record<string, unknown>> {\n const response = await fetch(url, options);\n const text = await response.text();\n\n let data: Record<string, unknown>;\n try {\n data = text ? (JSON.parse(text) as Record<string, unknown>) : {};\n } catch {\n throw new Error(`Expected JSON from ${url}, got: ${text.slice(0, 200)}`);\n }\n\n if (!response.ok) {\n const message = (data.error_description ||\n data.error ||\n data.message ||\n response.statusText) as string;\n throw new Error(`${url} failed with ${response.status}: ${message}`);\n }\n\n return data;\n}\n\nasync function discoverOpenIdConfiguration(authority: string): Promise<OpenIdConfiguration> {\n const url = new URL(\"/.well-known/openid-configuration\", authority);\n return fetchJson(url.toString()) as Promise<OpenIdConfiguration>;\n}\n\n// --- Certificates ---\n\nfunction getOrCreateCertificates(certDir: string): { key: Buffer; cert: Buffer } {\n const keyPath = join(certDir, \"localhost-key.pem\");\n const certPath = join(certDir, \"localhost-cert.pem\");\n\n if (existsSync(keyPath) && existsSync(certPath)) {\n return { key: readFileSync(keyPath), cert: readFileSync(certPath) };\n }\n\n process.stderr.write(\"Generating self-signed certificate for HTTPS callback...\\n\");\n mkdirSync(certDir, { recursive: true });\n\n try {\n execFileSync(\n \"openssl\",\n [\n \"req\",\n \"-x509\",\n \"-newkey\",\n \"rsa:2048\",\n \"-nodes\",\n \"-sha256\",\n \"-subj\",\n \"/CN=localhost\",\n \"-keyout\",\n keyPath,\n \"-out\",\n certPath,\n \"-days\",\n \"365\",\n ],\n { stdio: [\"ignore\", \"pipe\", \"ignore\"] },\n );\n } catch {\n throw new Error(\"Failed to generate self-signed certificate. Install OpenSSL and retry.\");\n }\n\n return { key: readFileSync(keyPath), cert: readFileSync(certPath) };\n}\n\n// --- Authorization URL ---\n\nfunction buildAuthorizationUrl(\n config: typeof LOGIN_CONFIG,\n discovery: OpenIdConfiguration,\n verifier: string,\n state: string,\n org?: string,\n): string {\n if (!discovery.authorization_endpoint) {\n throw new Error(\"OpenID discovery document is missing authorization_endpoint\");\n }\n\n const url = new URL(discovery.authorization_endpoint);\n url.searchParams.set(\"client_id\", config.clientId);\n url.searchParams.set(\"redirect_uri\", config.redirectUri);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"scope\", \"openid profile email\");\n url.searchParams.set(\"code_challenge\", pkceChallenge(verifier));\n url.searchParams.set(\"code_challenge_method\", \"S256\");\n url.searchParams.set(\"state\", state);\n\n if (org) {\n url.searchParams.set(\"organization_hint\", org);\n }\n\n return url.toString();\n}\n\n// --- Token exchange ---\n\nasync function exchangeCodeForTokens(\n discovery: OpenIdConfiguration,\n code: string,\n verifier: string,\n): Promise<TokenResponse> {\n if (!discovery.token_endpoint) {\n throw new Error(\"OpenID discovery document is missing token_endpoint\");\n }\n\n const body = new URLSearchParams({\n grant_type: \"authorization_code\",\n client_id: LOGIN_CONFIG.clientId,\n code,\n redirect_uri: LOGIN_CONFIG.redirectUri,\n code_verifier: verifier,\n });\n\n return fetchJson(discovery.token_endpoint, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body,\n }) as Promise<TokenResponse>;\n}\n\n// --- Callback HTML ---\n\nfunction escapeHtml(value: string): string {\n return value.replace(\n /[&<>\"']/g,\n (c) => ({ \"&\": \"&\", \"<\": \"<\", \">\": \">\", '\"': \""\", \"'\": \"'\" })[c] ?? c,\n );\n}\n\nfunction callbackHtml(title: string, message: string): string {\n return `<html><body style=\"font-family:system-ui;padding:40px;text-align:center\">\n<h1>${escapeHtml(title)}</h1><p>${escapeHtml(message)}</p></body></html>`;\n}\n\n// --- Callback server ---\n\nfunction startCallbackServer(\n tlsOptions: { key: Buffer; cert: Buffer },\n discovery: OpenIdConfiguration,\n verifier: string,\n expectedState: string,\n): Promise<string> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n server.close();\n reject(new Error(\"Login timeout — no response received within 5 minutes\"));\n }, LOGIN_CONFIG.loginTimeout);\n\n const server = https.createServer(tlsOptions, async (req, res) => {\n const url = new URL(req.url ?? \"/\", `https://${req.headers.host ?? \"localhost\"}`);\n\n if (url.pathname !== \"/\") {\n res.writeHead(404);\n res.end(\"Not found\");\n return;\n }\n\n const error = url.searchParams.get(\"error\");\n if (error) {\n const desc = url.searchParams.get(\"error_description\") || error;\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", desc));\n clearTimeout(timeout);\n server.close();\n reject(new Error(desc));\n return;\n }\n\n const state = url.searchParams.get(\"state\");\n if (state !== expectedState) {\n const msg = \"Invalid OAuth state\";\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", msg));\n clearTimeout(timeout);\n server.close();\n reject(new Error(msg));\n return;\n }\n\n const code = url.searchParams.get(\"code\");\n if (!code) {\n const msg = \"No authorization code returned\";\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", msg));\n clearTimeout(timeout);\n server.close();\n reject(new Error(msg));\n return;\n }\n\n try {\n const tokens = await exchangeCodeForTokens(discovery, code, verifier);\n res.writeHead(200, { \"Content-Type\": \"text/html\" });\n res.end(\n callbackHtml(\"Login successful\", \"You can close this window and return to the terminal.\"),\n );\n clearTimeout(timeout);\n server.close();\n\n if (!tokens.access_token) {\n reject(new Error(\"No access_token in token response\"));\n return;\n }\n resolve(tokens.access_token);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", msg));\n clearTimeout(timeout);\n server.close();\n reject(err instanceof Error ? err : new Error(msg));\n }\n });\n\n server.on(\"error\", (err: NodeJS.ErrnoException) => {\n clearTimeout(timeout);\n if (err.code === \"EADDRINUSE\") {\n reject(new Error(`Port ${LOGIN_CONFIG.port} is already in use`));\n return;\n }\n reject(err);\n });\n\n server.listen(LOGIN_CONFIG.port, \"127.0.0.1\", () => {\n process.stderr.write(\n `Local HTTPS server listening on https://localhost:${LOGIN_CONFIG.port}\\n`,\n );\n });\n });\n}\n\n// --- Public API ---\n\n/**\n * Perform interactive browser-based OAuth login against Cognite auth.\n * Returns the access_token string.\n */\nexport async function browserLogin(options?: LoginOptions): Promise<string> {\n const verifier = randomBase64Url(64);\n const state = randomBase64Url(32);\n\n process.stderr.write(\"Fetching OpenID configuration...\\n\");\n const discovery = await discoverOpenIdConfiguration(LOGIN_CONFIG.authority);\n\n const authUrl = buildAuthorizationUrl(LOGIN_CONFIG, discovery, verifier, state, options?.org);\n const tlsOptions = getOrCreateCertificates(LOGIN_CONFIG.certDir);\n\n process.stderr.write(\"Opening browser for authentication...\\n\");\n try {\n await openBrowser(authUrl);\n } catch {\n process.stderr.write(\n `Could not open browser automatically.\\nOpen this URL manually:\\n${authUrl}\\n`,\n );\n }\n\n return startCallbackServer(tlsOptions, discovery, verifier, state);\n}\n","/**\n * Cross-platform browser opener utility.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { env, platform } from \"node:process\";\n\nfunction tryOpen(command: string, args: string[]): Promise<boolean> {\n return new Promise((resolve) => {\n execFile(command, args, (error) => resolve(!error));\n });\n}\n\nfunction isWsl(): boolean {\n if (platform !== \"linux\") return false;\n if (env.WSL_DISTRO_NAME || env.WSL_INTEROP) return true;\n\n try {\n const version = readFileSync(\"/proc/version\", \"utf8\").toLowerCase();\n return version.includes(\"microsoft\") || version.includes(\"wsl\");\n } catch {\n return false;\n }\n}\n\nfunction wslDrivesMountPoint(): string {\n const defaultMount = \"/mnt/\";\n try {\n const config = readFileSync(\"/etc/wsl.conf\", \"utf8\");\n const match = /(?:^|\\n)\\s*root\\s*=\\s*(?<mountPoint>[^\\n#]+)/.exec(config);\n if (!match?.groups?.mountPoint) return defaultMount;\n const mp = match.groups.mountPoint.trim();\n return mp.endsWith(\"/\") ? mp : `${mp}/`;\n } catch {\n return defaultMount;\n }\n}\n\nfunction powershellPath(): string {\n if (isWsl()) {\n return join(wslDrivesMountPoint(), \"c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe\");\n }\n const windowsRoot = env.SYSTEMROOT || env.windir || \"C:\\\\Windows\";\n return join(windowsRoot, \"System32/WindowsPowerShell/v1.0/powershell.exe\");\n}\n\nfunction powershellStartArgs(url: string): string[] {\n const encodedCommand = Buffer.from(`Start \"${url}\"`, \"utf16le\").toString(\"base64\");\n return [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-ExecutionPolicy\",\n \"Bypass\",\n \"-EncodedCommand\",\n encodedCommand,\n ];\n}\n\nexport async function openBrowser(url: string): Promise<void> {\n if (platform === \"darwin\") {\n if (await tryOpen(\"open\", [url])) return;\n } else if (platform === \"win32\") {\n if (await tryOpen(powershellPath(), powershellStartArgs(url))) return;\n if (await tryOpen(\"cmd\", [\"/c\", \"start\", \"\", url])) return;\n } else if (isWsl()) {\n if (await tryOpen(powershellPath(), powershellStartArgs(url))) return;\n if (await tryOpen(\"cmd.exe\", [\"/c\", \"start\", \"\", url])) return;\n if (await tryOpen(\"wslview\", [url])) return;\n } else {\n if (await tryOpen(\"xdg-open\", [url])) return;\n if (await tryOpen(\"sensible-browser\", [url])) return;\n if (await tryOpen(\"gio\", [\"open\", url])) return;\n if (await tryOpen(\"python3\", [\"-m\", \"webbrowser\", url])) return;\n }\n\n throw new Error(\"Could not open browser automatically\");\n}\n","/**\n * JWT token decode utility (no signature verification).\n * Used to extract project and cluster URL from Cognite access tokens.\n */\n\nexport interface TokenClaims {\n projects?: string[];\n aud?: string;\n [key: string]: unknown;\n}\n\nexport function decodeTokenClaims(token: string): TokenClaims {\n const [header, payload, signature] = token.split(\".\");\n if (!header || !payload || !signature) return {};\n\n try {\n const json = Buffer.from(payload, \"base64url\").toString(\"utf8\");\n return JSON.parse(json) as TokenClaims;\n } catch {\n return {};\n }\n}\n\n/**\n * Attempt to extract project and base URL from a Cognite JWT.\n */\nexport function extractAuthFromToken(token: string): {\n project: string | undefined;\n baseUrl: string | undefined;\n} {\n const claims = decodeTokenClaims(token);\n\n const project = claims.projects?.[0];\n\n // aud is typically the cluster URL, e.g. \"https://az-eastus-1.cognitedata.com\"\n let baseUrl: string | undefined;\n if (typeof claims.aud === \"string\" && claims.aud.startsWith(\"https://\")) {\n baseUrl = claims.aud;\n }\n\n return { project, baseUrl };\n}\n","/**\n * Authentication prompts for Cognite Data Fusion.\n */\n\nimport { input, password, select } from \"@inquirer/prompts\";\nimport { browserLogin } from \"../auth/login\";\nimport { extractAuthFromToken } from \"../auth/token\";\n\nexport interface AuthOptions {\n token?: string;\n project?: string;\n baseUrl?: string;\n}\n\nexport async function promptAuth(flags: AuthOptions): Promise<{\n token: string;\n project: string;\n baseUrl: string;\n}> {\n let token: string;\n\n if (flags.token) {\n token = flags.token;\n } else {\n const method = await select({\n message: \"How do you want to authenticate?\",\n choices: [\n { value: \"browser\", name: \"Browser login (recommended)\" },\n { value: \"token\", name: \"Paste token manually\" },\n ],\n });\n\n if (method === \"browser\") {\n const org = await input({\n message: \"Organization hint (leave empty to skip):\",\n });\n token = await browserLogin(org ? { org } : undefined);\n } else {\n token = await password({ message: \"CDF bearer token:\" });\n }\n }\n\n // Try to extract project and base URL from JWT claims\n const extracted = extractAuthFromToken(token);\n\n const project =\n flags.project ||\n (await input({\n message: \"CDF project name:\",\n ...(extracted.project ? { default: extracted.project } : {}),\n }));\n\n const baseUrl =\n flags.baseUrl ||\n (await input({\n message: \"CDF base URL:\",\n default: extracted.baseUrl || \"https://az-eastus-1.cognitedata.com\",\n }));\n\n return { token, project, baseUrl };\n}\n","/**\n * Data model selection prompts.\n */\n\nimport type { CogniteClient } from \"@cognite/sdk\";\nimport { search, select } from \"@inquirer/prompts\";\n\nexport interface DataModelChoice {\n space: string;\n externalId: string;\n version: string;\n}\n\ninterface DataModelListItem {\n space: string;\n externalId: string;\n version: string;\n}\n\ninterface PromptChoice<TValue> {\n name: string;\n value: TValue;\n}\n\ntype VersionMode = \"latest\" | \"specific\";\n\nexport async function promptDataModel(\n client: CogniteClient,\n flag?: string,\n): Promise<DataModelChoice> {\n if (flag) {\n return parseDataModelFlag(flag);\n }\n\n const versionMode = await select({\n message: \"Which data model version do you want to use?\",\n default: \"latest\" as VersionMode,\n choices: [\n { name: \"Latest\", value: \"latest\" as const },\n { name: \"Select a specific version\", value: \"specific\" as const },\n ],\n });\n\n const dataModels = await client.dataModels.list({ limit: 1000, includeGlobal: true });\n const dataModelChoices = createDataModelChoices(dataModels.items);\n const selected = await search({\n message: \"Select a data model:\",\n source: (input) => filterChoices(dataModelChoices, input),\n });\n\n if (versionMode === \"latest\") {\n return selected;\n }\n\n const versions = await client.dataModels.retrieve([\n { space: selected.space, externalId: selected.externalId },\n ]);\n const versionChoices = createVersionChoices(selected, versions.items);\n const version = await search({\n message: \"Select data model version:\",\n source: (input) => filterChoices(versionChoices, input),\n });\n\n return version;\n}\n\nexport function createDataModelChoices(\n dataModels: DataModelListItem[],\n): Array<PromptChoice<DataModelChoice>> {\n return dataModels.map((dm) => ({\n name: `${dm.space}/${dm.externalId}`,\n value: toDataModelChoice(dm),\n }));\n}\n\nexport function createVersionChoices(\n latest: DataModelChoice,\n dataModels: DataModelListItem[],\n): Array<PromptChoice<DataModelChoice>> {\n const versions = dataModels\n .filter((dm) => dm.space === latest.space && dm.externalId === latest.externalId)\n .map(toDataModelChoice)\n .sort((a, b) => b.version.localeCompare(a.version));\n\n return [\n {\n name: `latest (${latest.version})`,\n value: latest,\n },\n ...versions\n .filter((version) => version.version !== latest.version)\n .map((version) => ({\n name: version.version,\n value: version,\n })),\n ];\n}\n\nexport function filterChoices<TValue>(\n choices: Array<PromptChoice<TValue>>,\n input: string | undefined,\n): Array<PromptChoice<TValue>> {\n if (!input) return choices;\n const lower = input.toLowerCase();\n return choices.filter((choice) => choice.name.toLowerCase().includes(lower));\n}\n\nexport function parseDataModelFlag(flag: string): DataModelChoice {\n const parts = flag.split(\"/\");\n if (parts.length !== 3 || !parts[0] || !parts[1] || !parts[2]) {\n throw new Error(\n `Invalid --data-model format. Expected \"space/externalId/version\", got \"${flag}\"`,\n );\n }\n return { space: parts[0], externalId: parts[1], version: parts[2] };\n}\n\nfunction toDataModelChoice(dm: DataModelListItem): DataModelChoice {\n return {\n space: dm.space,\n externalId: dm.externalId,\n version: String(dm.version),\n };\n}\n","/**\n * Generator option prompts (output path, client name).\n */\n\nimport { input } from \"@inquirer/prompts\";\n\nexport interface GeneratorOptions {\n outputPath?: string;\n clientName?: string;\n}\n\nexport async function promptOptions(flags: GeneratorOptions): Promise<{\n outputPath: string;\n clientName: string | undefined;\n}> {\n const outputPath =\n flags.outputPath ||\n (await input({\n message: \"Output directory:\",\n default: \"./generated\",\n }));\n\n const clientName =\n flags.clientName ||\n (await input({\n message: \"Client name (leave empty for default based on data model name):\",\n })) ||\n undefined;\n\n return { outputPath, clientName };\n}\n","/**\n * CLI entry point for industrial-model.\n */\n\nimport { Command } from \"commander\";\nimport { generateCommand } from \"./commands/generate\";\n\nconst program = new Command()\n .name(\"industrial-model\")\n .description(\"Code generator for Cognite Data Fusion data models\")\n .version(process.env.PACKAGE_VERSION ?? \"0.0.0\");\n\nprogram.addCommand(generateCommand);\nprogram.parse();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,wCAAAA,UAAA;AAAA;AAGA,QAAMC,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;AACnB,cAAM,GAAG,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M,eAAe,OAAO,UAAU,IAAI,OAAO,WAAW;AAAA,EACrF;AACF,CAAC;;;AgD7DH,IAAMC,WAAU,IAAI,QAAQ,EACzB,KAAK,kBAAkB,EACvB,YAAY,oDAAoD,EAChE,QAAQ,OAAsC;AAEjDA,SAAQ,WAAW,eAAe;AAClCA,SAAQ,MAAM;","names":["exports","CommanderError","InvalidArgumentError","exports","InvalidArgumentError","Argument","exports","Help","cmd","exports","InvalidArgumentError","Option","str","exports","exports","path","process","Argument","CommanderError","Help","Option","Command","signals","option","exports","Argument","Command","CommanderError","InvalidArgumentError","Help","Option","exports","module","cliWidth","exports","module","MuteStream","commander","propsLines","import_node_async_hooks","setState","process","dist_default","NO_TRUNCATION","dist_default","dist_default","cliWidth","readline","import_node_async_hooks","process","import_node_util","ESC","import_node_path","MuteStream","signal","path","import_node_util","dist_default","value","dist_default","import_node_util","name","dist_default","error","import_node_util","isSelectable","normalizeChoices","name","dist_default","item","import_node_child_process","import_node_fs","import_node_path","import_node_fs","import_node_path","import_node_process","crypto","https","dist_default","dist_default","dist_default","program"]}
|
|
1
|
+
{"version":3,"sources":["../../node_modules/commander/lib/error.js","../../node_modules/commander/lib/argument.js","../../node_modules/commander/lib/help.js","../../node_modules/commander/lib/option.js","../../node_modules/commander/lib/suggestSimilar.js","../../node_modules/commander/lib/command.js","../../node_modules/commander/index.js","../../node_modules/cli-width/index.js","../../node_modules/mute-stream/lib/index.js","../../node_modules/commander/esm.mjs","../../src/cli/commands/generate.ts","../../src/cognite/adapter.ts","../../src/mappers/view-mapper.ts","../../src/cli/generator/renderer.ts","../../src/cli/generator/helpers.ts","../../src/utils/view.ts","../../src/cli/generator/constants.ts","../../src/cli/generator/parser.ts","../../src/cli/generator/models.ts","../../src/cli/generator/templates/header.ts","../../src/cli/generator/templates/client.ts","../../src/cli/generator/templates/index.ts","../../src/cli/generator/templates/types.ts","../../node_modules/@inquirer/core/dist/lib/key.js","../../node_modules/@inquirer/core/dist/lib/errors.js","../../node_modules/@inquirer/core/dist/lib/use-state.js","../../node_modules/@inquirer/core/dist/lib/hook-engine.js","../../node_modules/@inquirer/core/dist/lib/use-effect.js","../../node_modules/@inquirer/core/dist/lib/theme.js","../../node_modules/@inquirer/figures/dist/index.js","../../node_modules/@inquirer/core/dist/lib/make-theme.js","../../node_modules/@inquirer/core/dist/lib/use-prefix.js","../../node_modules/@inquirer/core/dist/lib/use-memo.js","../../node_modules/@inquirer/core/dist/lib/use-ref.js","../../node_modules/@inquirer/core/dist/lib/use-keypress.js","../../node_modules/@inquirer/core/dist/lib/utils.js","../../node_modules/fast-string-truncated-width/dist/utils.js","../../node_modules/fast-string-truncated-width/dist/index.js","../../node_modules/fast-string-width/dist/index.js","../../node_modules/fast-wrap-ansi/src/main.ts","../../node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js","../../node_modules/@inquirer/core/dist/lib/create-prompt.js","../../node_modules/signal-exit/src/signals.ts","../../node_modules/signal-exit/src/index.ts","../../node_modules/@inquirer/core/dist/lib/screen-manager.js","../../node_modules/@inquirer/ansi/dist/index.js","../../node_modules/@inquirer/core/dist/lib/promise-polyfill.js","../../node_modules/@inquirer/core/dist/lib/Separator.js","../../node_modules/@inquirer/input/dist/index.js","../../node_modules/@inquirer/password/dist/index.js","../../node_modules/@inquirer/search/dist/index.js","../../node_modules/@inquirer/select/dist/index.js","../../src/cli/auth/login.ts","../../src/cli/auth/browser.ts","../../src/cli/auth/token.ts","../../src/cli/prompts/auth.ts","../../src/cli/prompts/data-model.ts","../../src/cli/prompts/options.ts","../../src/cli/index.ts"],"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.endsWith('...')) {\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 _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\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._collectValue(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 _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\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._collectValue(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–Levenshtein_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 = {\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?.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._collectValue(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?.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?.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[]} args\n * @return {{operands: string[], unknown: string[]}}\n */\n\n parseOptions(args) {\n const operands = []; // operands, not options or values\n const unknown = []; // first unknown option and remaining unknown args\n let dest = operands;\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*\\.\\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 let activeGroup = null; // working through group of short options, like -abc\n let i = 0;\n while (i < args.length || activeGroup) {\n const arg = activeGroup ?? args[i++];\n activeGroup = null;\n\n // literal\n if (arg === '--') {\n if (dest === unknown) dest.push(arg);\n dest.push(...args.slice(i));\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[i++];\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 i < args.length &&\n (!maybeOption(args[i]) || negativeNumberArg(args[i]))\n ) {\n value = args[i++];\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\n this.emit(`option:${option.name()}`);\n // remove the processed option and keep processing group\n activeGroup = `-${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 unknown.push(...args.slice(i));\n break;\n } else if (\n this._getHelpCommand() &&\n arg === this._getHelpCommand().name()\n ) {\n operands.push(arg, ...args.slice(i));\n break;\n } else if (this._defaultCommandName) {\n unknown.push(arg, ...args.slice(i));\n break;\n }\n }\n\n // If using passThroughOptions, stop processing options at first command-argument.\n if (this._passThroughOptions) {\n dest.push(arg, ...args.slice(i));\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","'use strict';\n\nmodule.exports = cliWidth;\n\nfunction normalizeOpts(options) {\n const defaultOpts = {\n defaultWidth: 0,\n output: process.stdout,\n tty: require('tty'),\n };\n\n if (!options) {\n return defaultOpts;\n }\n\n Object.keys(defaultOpts).forEach(function (key) {\n if (!options[key]) {\n options[key] = defaultOpts[key];\n }\n });\n\n return options;\n}\n\nfunction cliWidth(options) {\n const opts = normalizeOpts(options);\n\n if (opts.output.getWindowSize) {\n return opts.output.getWindowSize()[0] || opts.defaultWidth;\n }\n\n if (opts.tty.getWindowSize) {\n return opts.tty.getWindowSize()[1] || opts.defaultWidth;\n }\n\n if (opts.output.columns) {\n return opts.output.columns;\n }\n\n if (process.env.CLI_WIDTH) {\n const width = parseInt(process.env.CLI_WIDTH, 10);\n\n if (!isNaN(width) && width !== 0) {\n return width;\n }\n }\n\n return opts.defaultWidth;\n}\n","const Stream = require('stream')\n\nclass MuteStream extends Stream {\n #isTTY = null\n\n constructor (opts = {}) {\n super(opts)\n this.writable = this.readable = true\n this.muted = false\n this.on('pipe', this._onpipe)\n this.replace = opts.replace\n\n // For readline-type situations\n // This much at the start of a line being redrawn after a ctrl char\n // is seen (such as backspace) won't be redrawn as the replacement\n this._prompt = opts.prompt || null\n this._hadControl = false\n }\n\n #destSrc (key, def) {\n if (this._dest) {\n return this._dest[key]\n }\n if (this._src) {\n return this._src[key]\n }\n return def\n }\n\n #proxy (method, ...args) {\n if (typeof this._dest?.[method] === 'function') {\n this._dest[method](...args)\n }\n if (typeof this._src?.[method] === 'function') {\n this._src[method](...args)\n }\n }\n\n get isTTY () {\n if (this.#isTTY !== null) {\n return this.#isTTY\n }\n return this.#destSrc('isTTY', false)\n }\n\n // basically just get replace the getter/setter with a regular value\n set isTTY (val) {\n this.#isTTY = val\n }\n\n get rows () {\n return this.#destSrc('rows')\n }\n\n get columns () {\n return this.#destSrc('columns')\n }\n\n mute () {\n this.muted = true\n }\n\n unmute () {\n this.muted = false\n }\n\n _onpipe (src) {\n this._src = src\n }\n\n pipe (dest, options) {\n this._dest = dest\n return super.pipe(dest, options)\n }\n\n pause () {\n if (this._src) {\n return this._src.pause()\n }\n }\n\n resume () {\n if (this._src) {\n return this._src.resume()\n }\n }\n\n write (c) {\n if (this.muted) {\n if (!this.replace) {\n return true\n }\n // eslint-disable-next-line no-control-regex\n if (c.match(/^\\u001b/)) {\n if (c.indexOf(this._prompt) === 0) {\n c = c.slice(this._prompt.length)\n c = c.replace(/./g, this.replace)\n c = this._prompt + c\n }\n this._hadControl = true\n return this.emit('data', c)\n } else {\n if (this._prompt && this._hadControl &&\n c.indexOf(this._prompt) === 0) {\n this._hadControl = false\n this.emit('data', this._prompt)\n c = c.slice(this._prompt.length)\n }\n c = c.toString().replace(/./g, this.replace)\n }\n }\n this.emit('data', c)\n }\n\n end (c) {\n if (this.muted) {\n if (c && this.replace) {\n c = c.toString().replace(/./g, this.replace)\n } else {\n c = null\n }\n }\n if (c) {\n this.emit('data', c)\n }\n this.emit('end')\n }\n\n destroy (...args) {\n return this.#proxy('destroy', ...args)\n }\n\n destroySoon (...args) {\n return this.#proxy('destroySoon', ...args)\n }\n\n close (...args) {\n return this.#proxy('close', ...args)\n }\n}\n\nmodule.exports = MuteStream\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","/**\n * `industrial-model generate` command.\n */\n\nimport { CogniteClient } from \"@cognite/sdk\";\nimport { Command } from \"commander\";\nimport { createCogniteAdapter } from \"../../cognite\";\nimport { ViewMapper } from \"../../mappers/view-mapper\";\nimport { createGeneratorConfig, generate } from \"../generator/renderer\";\nimport { promptAuth } from \"../prompts/auth\";\nimport { promptDataModel } from \"../prompts/data-model\";\nimport { promptOptions } from \"../prompts/options\";\n\nexport const generateCommand = new Command(\"generate\")\n .description(\"Generate TypeScript types and client from a Cognite data model\")\n .option(\"--token <token>\", \"CDF bearer token\")\n .option(\"--project <project>\", \"CDF project name\")\n .option(\"--base-url <url>\", \"CDF base URL\")\n .option(\"--data-model <space/id/version>\", \"Data model identifier\")\n .option(\"--output <path>\", \"Output directory\")\n .option(\"--client-name <name>\", \"Name for the generated client function\")\n .action(async (flags) => {\n const auth = await promptAuth({\n token: flags.token,\n project: flags.project,\n baseUrl: flags.baseUrl,\n });\n\n const client = new CogniteClient({\n appId: \"industrial-model-generator\",\n project: auth.project,\n baseUrl: auth.baseUrl,\n oidcTokenProvider: () => Promise.resolve(auth.token),\n });\n\n const dataModel = await promptDataModel(client, flags.dataModel);\n\n const options = await promptOptions({\n outputPath: flags.output,\n clientName: flags.clientName,\n });\n\n const config = createGeneratorConfig({\n dataModelSpace: dataModel.space,\n dataModelId: dataModel.externalId,\n dataModelVersion: dataModel.version,\n clientName: options.clientName,\n outputPath: options.outputPath,\n packageVersion: process.env.PACKAGE_VERSION ?? \"unknown\",\n });\n\n console.log(\n `\\nGenerating types for ${dataModel.space}/${dataModel.externalId}/${dataModel.version}...`,\n );\n\n const viewMapper = new ViewMapper(createCogniteAdapter(client), dataModel);\n const views = await viewMapper.getViews();\n\n if (views.length === 0) {\n console.error(\"No views found in the data model.\");\n process.exit(1);\n }\n\n generate(views, config);\n\n console.log(\n `\\n✓ Generated ${views.length} view(s) to ${config.outputPath}/${config.dataModelId}/`,\n );\n });\n","import type { CogniteClient } from \"@cognite/sdk\";\nimport type { CognitePort } from \"./port\";\nimport type {\n CogniteDatapointDeleteItem,\n CogniteDatapointInsertItem,\n CogniteDatapointLatestItem,\n CogniteDatapointResponse,\n CogniteDatapointResultItem,\n CogniteDatapointRetrieveOptions,\n CogniteFileDownloadUrl,\n CogniteFileUploadInfo,\n CogniteFileUploadResult,\n DataModelId,\n DataModelRetrieveOptions,\n InstancesAggregateRequest,\n InstancesAggregateResponse,\n InstancesApplyRequest,\n InstancesApplyResponse,\n InstancesQueryRequest,\n InstancesQueryResponse,\n InstancesSearchRequest,\n InstancesSearchResponse,\n ViewDefinition,\n} from \"./types\";\n\nexport function createCogniteAdapter(client: CogniteClient): CognitePort {\n return new CogniteSdkAdapter(client);\n}\n\nclass CogniteSdkAdapter implements CognitePort {\n constructor(private readonly client: CogniteClient) {}\n\n async retrieveDataModels(ids: DataModelId[], options?: DataModelRetrieveOptions) {\n const response = await this.client.dataModels.retrieve(ids, options);\n return {\n items: response.items.map((item) => ({\n createdTime: item.createdTime,\n views: (item.views ?? []) as ViewDefinition[],\n })),\n };\n }\n\n async queryInstances(request: InstancesQueryRequest): Promise<InstancesQueryResponse> {\n const response = await this.client.instances.query(\n request as Parameters<CogniteClient[\"instances\"][\"query\"]>[0],\n );\n return {\n items: response.items as unknown as InstancesQueryResponse[\"items\"],\n nextCursor: response.nextCursor,\n };\n }\n\n async searchInstances(request: InstancesSearchRequest): Promise<InstancesSearchResponse> {\n const search = (\n this.client.instances as unknown as {\n search: (request: InstancesSearchRequest) => Promise<{ items: unknown[] }>;\n }\n ).search;\n const response = await search(request);\n return {\n items: response.items as unknown as InstancesSearchResponse[\"items\"],\n };\n }\n\n async aggregateInstances(\n request: InstancesAggregateRequest,\n ): Promise<InstancesAggregateResponse> {\n const response = await this.client.instances.aggregate(\n request as Parameters<CogniteClient[\"instances\"][\"aggregate\"]>[0],\n );\n return {\n items: response.items as unknown as InstancesAggregateResponse[\"items\"],\n };\n }\n\n async applyInstances(request: InstancesApplyRequest): Promise<InstancesApplyResponse> {\n const apply = (\n this.client.instances as unknown as {\n apply: (request: InstancesApplyRequest) => Promise<{ items: unknown[] }>;\n }\n ).apply;\n const response = await apply(request);\n return {\n items: response.items as unknown as InstancesApplyResponse[\"items\"],\n };\n }\n\n async retrieveDatapoints(\n options: CogniteDatapointRetrieveOptions,\n ): Promise<{ items: CogniteDatapointResultItem[] }> {\n const { items, ...rest } = options;\n const sdkItems = items.map(({ space, externalId, ...itemRest }) => ({\n ...itemRest,\n instanceId: { space, externalId },\n }));\n const response = await this.client.datapoints.retrieve({\n ...rest,\n items: sdkItems,\n } as Parameters<typeof this.client.datapoints.retrieve>[0]);\n return { items: (response as unknown as CogniteDatapointResponse[]).map(mapDatapointResult) };\n }\n\n async retrieveLatestDatapoints(\n items: CogniteDatapointLatestItem[],\n options?: { ignoreUnknownIds?: boolean },\n ): Promise<{ items: CogniteDatapointResultItem[] }> {\n const sdkItems = items.map(({ space, externalId, before }) => ({\n instanceId: { space, externalId },\n ...(before !== undefined ? { before } : {}),\n }));\n const response = await this.client.datapoints.retrieveLatest(\n sdkItems as Parameters<typeof this.client.datapoints.retrieveLatest>[0],\n options,\n );\n return { items: (response as unknown as CogniteDatapointResponse[]).map(mapDatapointResult) };\n }\n\n async insertDatapoints(items: CogniteDatapointInsertItem[]): Promise<void> {\n const sdkItems = items.map(({ space, externalId, datapoints }) => ({\n instanceId: { space, externalId },\n datapoints,\n }));\n await this.client.datapoints.insert(\n sdkItems as Parameters<typeof this.client.datapoints.insert>[0],\n );\n }\n\n async deleteDatapoints(items: CogniteDatapointDeleteItem[]): Promise<void> {\n const sdkItems = items.map(({ space, externalId, inclusiveBegin, exclusiveEnd }) => ({\n instanceId: { space, externalId },\n inclusiveBegin,\n ...(exclusiveEnd !== undefined ? { exclusiveEnd } : {}),\n }));\n await this.client.datapoints.delete(\n sdkItems as Parameters<typeof this.client.datapoints.delete>[0],\n );\n }\n\n async uploadFile(\n fileInfo: CogniteFileUploadInfo,\n content?: unknown,\n ): Promise<CogniteFileUploadResult> {\n const { instanceId, ...rest } = fileInfo;\n const response = await this.client.files.upload(\n { ...rest, instanceId } as Parameters<typeof this.client.files.upload>[0],\n content as Parameters<typeof this.client.files.upload>[1],\n false,\n content !== undefined,\n );\n return mapFileResult(response as SdkFileInfo);\n }\n\n async getFileDownloadUrls(\n ids: Array<{ instanceId: { space: string; externalId: string } }>,\n ): Promise<CogniteFileDownloadUrl[]> {\n const response = await this.client.files.getDownloadUrls(\n ids as Parameters<typeof this.client.files.getDownloadUrls>[0],\n );\n return (\n response as Array<{\n instanceId?: { space?: string; externalId?: string };\n downloadUrl: string;\n }>\n ).map((item) => ({\n ...(item.instanceId !== undefined ? { instanceId: item.instanceId } : {}),\n downloadUrl: item.downloadUrl,\n }));\n }\n}\n\ntype SdkFileInfo = {\n instanceId?: { space?: string; externalId?: string };\n name: string;\n uploaded: boolean;\n uploadedTime?: Date;\n createdTime: Date;\n lastUpdatedTime: Date;\n mimeType?: string;\n directory?: string;\n source?: string;\n uploadUrl?: string;\n};\n\nfunction mapFileResult(item: SdkFileInfo): CogniteFileUploadResult {\n return {\n ...(item.instanceId !== undefined ? { instanceId: item.instanceId } : {}),\n name: item.name,\n uploaded: item.uploaded,\n createdTime: item.createdTime,\n lastUpdatedTime: item.lastUpdatedTime,\n ...(item.uploadedTime !== undefined ? { uploadedTime: item.uploadedTime } : {}),\n ...(item.mimeType !== undefined ? { mimeType: item.mimeType } : {}),\n ...(item.directory !== undefined ? { directory: item.directory } : {}),\n ...(item.source !== undefined ? { source: item.source } : {}),\n ...(item.uploadUrl !== undefined ? { uploadUrl: item.uploadUrl } : {}),\n };\n}\n\nfunction mapDatapointResult(item: CogniteDatapointResponse): CogniteDatapointResultItem {\n return {\n ...(item.instanceId?.space !== undefined ? { space: item.instanceId.space } : {}),\n ...(item.instanceId?.externalId !== undefined\n ? { externalId: item.instanceId.externalId }\n : {}),\n isString: item.isString ?? false,\n ...(item.unit !== undefined ? { unit: item.unit } : {}),\n datapoints: item.datapoints ?? [],\n ...(item.nextCursor !== undefined ? { nextCursor: item.nextCursor } : {}),\n };\n}\n","import type { CognitePort, ViewDefinition } from \"../cognite\";\nimport type { DataModelId } from \"../types\";\n\nexport class ViewMapper {\n private cachePromise: Promise<Map<string, ViewDefinition>> | null = null;\n\n constructor(\n private readonly cognite: CognitePort,\n private readonly dataModelId: DataModelId,\n ) {}\n\n async getView(externalId: string): Promise<ViewDefinition> {\n const views = await this.loadViews();\n const view = views.get(externalId);\n if (!view) {\n throw new Error(\n `View \"${externalId}\" not found in data model \"${this.dataModelId.externalId}\"`,\n );\n }\n return view;\n }\n\n async getViews(): Promise<ViewDefinition[]> {\n const views = await this.loadViews();\n return Array.from(views.values());\n }\n\n private loadViews(): Promise<Map<string, ViewDefinition>> {\n if (this.cachePromise == null) {\n this.cachePromise = this.fetchViews();\n }\n return this.cachePromise;\n }\n\n private async fetchViews(): Promise<Map<string, ViewDefinition>> {\n const response = await this.cognite.retrieveDataModels(\n [\n {\n space: this.dataModelId.space,\n externalId: this.dataModelId.externalId,\n version: this.dataModelId.version,\n },\n ],\n { inlineViews: true },\n );\n\n const dm = response.items.sort((a, b) => b.createdTime - a.createdTime)[0];\n if (!dm) {\n throw new Error(`Data model \"${this.dataModelId.externalId}\" not found`);\n }\n\n const views = new Map<string, ViewDefinition>();\n for (const view of dm.views ?? []) {\n views.set(view.externalId, view);\n }\n return views;\n }\n}\n","/**\n * Renderer: orchestrates parsing views and writing generated files to disk.\n */\n\nimport { existsSync, mkdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ViewDefinition as CogniteViewDefinition } from \"../../cognite\";\nimport { toPascal } from \"./helpers\";\nimport type { ViewDefinition } from \"./models\";\nimport { parseViews } from \"./parser\";\nimport { renderClient } from \"./templates/client\";\nimport { renderIndex } from \"./templates/index\";\nimport { renderTypes } from \"./templates/types\";\n\nexport interface GeneratorConfig {\n dataModelSpace: string;\n dataModelId: string;\n dataModelVersion: string;\n clientName: string;\n clientFunctionName: string;\n outputPath: string;\n packageVersion: string;\n generatedAt: string;\n}\n\nexport function createGeneratorConfig(options: {\n dataModelSpace: string;\n dataModelId: string;\n dataModelVersion: string;\n clientName: string | undefined;\n outputPath: string | undefined;\n packageVersion: string;\n}): GeneratorConfig {\n const clientName = options.clientName || toPascal(options.dataModelId);\n return {\n dataModelSpace: options.dataModelSpace,\n dataModelId: options.dataModelId,\n dataModelVersion: options.dataModelVersion,\n clientName,\n clientFunctionName: `create${clientName}Client`,\n outputPath: options.outputPath || \"./generated\",\n packageVersion: options.packageVersion,\n generatedAt: new Date().toISOString(),\n };\n}\n\nexport function generate(views: CogniteViewDefinition[], config: GeneratorConfig): void {\n const viewDefinitions = parseViews(views);\n generateFromDefinitions(viewDefinitions, config);\n}\n\nexport function generateFromDefinitions(\n viewDefinitions: ViewDefinition[],\n config: GeneratorConfig,\n): void {\n const outputDir = join(config.outputPath, config.dataModelId);\n\n if (existsSync(outputDir)) {\n rmSync(outputDir, { recursive: true });\n }\n mkdirSync(outputDir, { recursive: true });\n\n writeFileSync(join(outputDir, \"types.ts\"), renderTypes(viewDefinitions, config));\n writeFileSync(join(outputDir, \"client.ts\"), renderClient(viewDefinitions, config));\n writeFileSync(join(outputDir, \"index.ts\"), renderIndex(config));\n}\n","/**\n * String transformation helpers for code generation.\n */\n\n/** Convert a string to PascalCase (e.g. \"my_view_name\" → \"MyViewName\") */\nexport function toPascal(str: string): string {\n return str\n .replace(/[-_]+(.)?/g, (_, c: string | undefined) => (c ? c.toUpperCase() : \"\"))\n .replace(/^(.)/, (c) => c.toUpperCase());\n}\n\n/** Convert a string to camelCase (e.g. \"my_field_name\" → \"myFieldName\") */\nexport function toCamel(str: string): string {\n const pascal = toPascal(str);\n return pascal.charAt(0).toLowerCase() + pascal.slice(1);\n}\n","import type {\n EdgeConnection,\n QuerySelectExpression,\n ReverseDirectRelationConnection,\n ViewDefinition,\n ViewDefinitionProperty,\n ViewPropertyDefinition,\n ViewReference,\n} from \"../cognite\";\n\nconst NODE_PROPERTIES = new Set([\n \"externalId\",\n \"space\",\n \"createdTime\",\n \"deletedTime\",\n \"lastUpdatedTime\",\n]);\n\nexport function getPropertyRef(\n property: string,\n view: ViewDefinition,\n instanceType: \"node\" | \"edge\" = \"node\",\n): string[] {\n if (NODE_PROPERTIES.has(property)) return [instanceType, property];\n return [view.space, `${view.externalId}/${view.version}`, property];\n}\n\nexport function toViewReference(view: ViewDefinition): ViewReference {\n return { type: \"view\", space: view.space, externalId: view.externalId, version: view.version };\n}\n\nexport function isViewPropertyDefinition(p: ViewDefinitionProperty): p is ViewPropertyDefinition {\n return \"container\" in p;\n}\n\nexport function isReverseDirectRelation(\n p: ViewDefinitionProperty,\n): p is ReverseDirectRelationConnection {\n return \"through\" in p;\n}\n\nexport function isEdgeConnection(p: ViewDefinitionProperty): p is EdgeConnection {\n return !isViewPropertyDefinition(p) && !isReverseDirectRelation(p) && \"source\" in p;\n}\n\nexport function getDirectRelationSource(p: ViewPropertyDefinition): ViewReference | undefined {\n const type = p.type;\n if (type.type === \"direct\" && type.source) return type.source;\n return undefined;\n}\n\nexport function isDirectRelationWithSource(p: ViewDefinitionProperty): boolean {\n if (!isViewPropertyDefinition(p)) return false;\n return getDirectRelationSource(p) !== undefined;\n}\n\nexport function isListDirectRelation(p: ViewPropertyDefinition): boolean {\n return p.type.list === true;\n}\n\nexport function buildSelect(\n source: ViewReference,\n properties: string[],\n): QuerySelectExpression | Record<string, never> {\n if (properties.length === 0) return {};\n return { sources: [{ source, properties }] };\n}\n\nconst GROUPABLE_PROPERTY_TYPES = new Set([\n \"text\",\n \"direct\",\n \"int32\",\n \"int64\",\n \"float32\",\n \"float64\",\n \"boolean\",\n \"enum\",\n]);\n\nconst NUMERIC_PROPERTY_TYPES = new Set([\"int32\", \"int64\", \"float32\", \"float64\"]);\n\nexport function isGroupableProperty(property: ViewDefinitionProperty): boolean {\n if (!isViewPropertyDefinition(property)) return false;\n if (property.type.list === true) return false;\n const type = property.type.type;\n return type != null && GROUPABLE_PROPERTY_TYPES.has(type);\n}\n\nexport function isNumericProperty(property: ViewPropertyDefinition): boolean {\n const type = property.type.type;\n return type != null && NUMERIC_PROPERTY_TYPES.has(type);\n}\n\nexport function getSelectedGroupByKeys(groupBy: Record<string, boolean | undefined>): string[] {\n return Object.entries(groupBy)\n .filter((entry): entry is [string, true] => entry[1] === true)\n .map(([key]) => key);\n}\n","/**\n * Constants for TypeScript code generation.\n */\n\n/** Cognite property type → TypeScript type */\nexport const typeMappings: Record<string, string> = {\n text: \"string\",\n boolean: \"boolean\",\n timestamp: \"string\",\n date: \"string\",\n json: \"unknown\",\n float32: \"number\",\n float64: \"number\",\n int32: \"number\",\n int64: \"number\",\n timeseries: \"string\",\n file: \"string\",\n sequence: \"string\",\n direct: \"NodeId\",\n enum: \"string\",\n};\n\n/** TypeScript reserved words that need escaping with trailing underscore */\nexport const reservedWords = new Set([\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"null\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"undefined\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n]);\n","/**\n * Parser: converts engine ViewDefinition objects into generator ViewDefinition[].\n */\n\nimport type {\n ViewDefinition as CogniteViewDefinition,\n EdgeConnection,\n ReverseDirectRelationConnection,\n ViewPropertyDefinition,\n} from \"../../cognite\";\nimport {\n getDirectRelationSource,\n isEdgeConnection,\n isReverseDirectRelation,\n isViewPropertyDefinition,\n} from \"../../utils\";\nimport { reservedWords, typeMappings } from \"./constants\";\nimport { toCamel, toPascal } from \"./helpers\";\nimport type { FieldDefinition, ViewDefinition } from \"./models\";\n\nexport function parseViews(views: CogniteViewDefinition[]): ViewDefinition[] {\n return views.sort((a, b) => a.externalId.localeCompare(b.externalId)).map(parseView);\n}\n\nfunction parseView(view: CogniteViewDefinition): ViewDefinition {\n const fields: FieldDefinition[] = [];\n\n for (const [propertyName, prop] of Object.entries(view.properties)) {\n let fieldName = toCamel(propertyName);\n if (reservedWords.has(fieldName)) {\n fieldName = `${fieldName}_`;\n }\n\n if (isViewPropertyDefinition(prop)) {\n fields.push(processMappedProperty(propertyName, fieldName, prop));\n } else if (isEdgeConnection(prop)) {\n fields.push(processEdgeProperty(propertyName, fieldName, prop));\n } else if (isReverseDirectRelation(prop)) {\n fields.push(processReverseProperty(propertyName, fieldName, prop));\n }\n }\n\n return {\n viewName: toPascal(view.externalId),\n viewExternalId: view.externalId,\n viewSpace: view.space,\n viewVersion: view.version,\n fields,\n };\n}\n\nfunction processMappedProperty(\n propertyName: string,\n fieldName: string,\n prop: ViewPropertyDefinition,\n): FieldDefinition {\n const cogniteType = prop.type.type ?? \"unknown\";\n const mappedType = typeMappings[cogniteType] ?? \"unknown\";\n const isList = prop.type.list === true;\n const isRelation = cogniteType === \"direct\";\n const relationSource = getDirectRelationSource(prop);\n const enumValues =\n cogniteType === \"enum\" && prop.type.values ? Object.keys(prop.type.values) : null;\n\n let relationTarget: string | null = null;\n let relationTargetSpace: string | null = null;\n let relationTargetExternalId: string | null = null;\n\n if (relationSource) {\n relationTarget = toPascal(relationSource.externalId);\n relationTargetSpace = relationSource.space;\n relationTargetExternalId = relationSource.externalId;\n }\n\n return {\n fieldName,\n originalName: propertyName,\n cogniteType,\n mappedType,\n isNullable: true, // Cognite SDK doesn't expose nullable in this type; default to true\n isList,\n isRelation,\n isEdge: false,\n isReverseRelation: false,\n isListDirectRelation: isRelation && isList,\n relationTarget,\n relationTargetSpace,\n relationTargetExternalId,\n enumValues,\n };\n}\n\nfunction processEdgeProperty(\n propertyName: string,\n fieldName: string,\n prop: EdgeConnection,\n): FieldDefinition {\n return {\n fieldName,\n originalName: propertyName,\n cogniteType: \"edge\",\n mappedType: \"NodeId\",\n isNullable: false,\n isList: true,\n isRelation: false,\n isEdge: true,\n isReverseRelation: false,\n isListDirectRelation: false,\n relationTarget: toPascal(prop.source.externalId),\n relationTargetSpace: prop.source.space,\n relationTargetExternalId: prop.source.externalId,\n enumValues: null,\n };\n}\n\nfunction processReverseProperty(\n propertyName: string,\n fieldName: string,\n prop: ReverseDirectRelationConnection,\n): FieldDefinition {\n const isSingle = prop.connectionType === \"single_reverse_direct_relation\";\n\n return {\n fieldName,\n originalName: propertyName,\n cogniteType: \"reverse_direct\",\n mappedType: \"NodeId\",\n isNullable: isSingle,\n isList: !isSingle,\n isRelation: true,\n isEdge: false,\n isReverseRelation: true,\n isListDirectRelation: false,\n relationTarget: toPascal(prop.source.externalId),\n relationTargetSpace: prop.source.space,\n relationTargetExternalId: prop.source.externalId,\n enumValues: null,\n };\n}\n","/**\n * View and field definition models for code generation.\n */\n\nimport { toCamel } from \"./helpers\";\n\nexport interface FieldDefinition {\n fieldName: string;\n originalName: string;\n cogniteType: string;\n mappedType: string;\n isNullable: boolean;\n isList: boolean;\n isRelation: boolean;\n isEdge: boolean;\n isReverseRelation: boolean;\n isListDirectRelation: boolean;\n relationTarget: string | null;\n relationTargetSpace: string | null;\n relationTargetExternalId: string | null;\n enumValues: string[] | null;\n}\n\nexport interface ViewDefinition {\n viewName: string;\n viewExternalId: string;\n viewSpace: string;\n viewVersion: string;\n fields: FieldDefinition[];\n}\n\n/** Fields for the Props type param (excludes reverse relations) */\nexport function getPropsFields(view: ViewDefinition): FieldDefinition[] {\n return view.fields.filter((f) => !f.isReverseRelation);\n}\n\n/** Fields for the Relations type param */\nexport function getRelationTypeFields(view: ViewDefinition): FieldDefinition[] {\n return view.fields.filter(\n (f) => (f.isRelation || f.isEdge || f.isReverseRelation) && f.relationTarget,\n );\n}\n\n/** TypeScript type for a field in the Props type param */\nexport function getInterfaceType(field: FieldDefinition, viewName?: string): string {\n if (field.isRelation && !field.isList) return \"NodeId\";\n if (field.isEdge || (field.isRelation && field.isList)) return \"NodeId[]\";\n const baseType =\n field.enumValues && viewName ? getEnumTypeName(viewName, field) : field.mappedType;\n if (field.isList) return `${baseType}[]`;\n return baseType;\n}\n\n/** Generated type alias name for an enum field */\nexport function getEnumTypeName(viewName: string, field: FieldDefinition): string {\n const capitalized = field.fieldName.charAt(0).toUpperCase() + field.fieldName.slice(1);\n return `${viewName}${capitalized}`;\n}\n\n/** TypeScript type for a field in the Relations type param */\nexport function getRelationResolvedType(field: FieldDefinition): string {\n const target = field.relationTarget ?? \"unknown\";\n if (field.isList || field.isEdge) return `${target}[]`;\n if (field.isReverseRelation && !field.isList) return target;\n return target;\n}\n\n/** camelCase property name for the client object */\nexport function getClientPropertyName(view: ViewDefinition): string {\n return toCamel(view.viewName);\n}\n","/**\n * Shared header for all generated files.\n */\n\nimport type { GeneratorConfig } from \"../renderer\";\n\nexport function renderHeader(config: GeneratorConfig): string {\n return `/* eslint-disable */\n// DO NOT EDIT — this file is auto-generated\n// Data model: ${config.dataModelSpace}/${config.dataModelId} v${config.dataModelVersion}\n// Generated at: ${config.generatedAt}\n// industrial-model v${config.packageVersion}`;\n}\n","/**\n * Template: renders client.ts content.\n */\n\nimport type { ViewDefinition } from \"../models\";\nimport { getClientPropertyName } from \"../models\";\nimport type { GeneratorConfig } from \"../renderer\";\nimport { renderHeader } from \"./header\";\n\nexport function renderClient(views: ViewDefinition[], config: GeneratorConfig): string {\n const imports = [\n ` ${config.clientName}AggregateExecutor,`,\n ` ${config.clientName}Model,`,\n ` ${config.clientName}QueryExecutor,`,\n ` ${config.clientName}UpsertExecutor,`,\n ` ${config.clientName}ViewExternalId,`,\n ].join(\"\\n\");\n\n const viewShortcuts = views\n .map((view) => {\n const prop = getClientPropertyName(view);\n return ` ${prop}: {\n query: model.query(\"${view.viewExternalId}\"),\n aggregate: model.aggregate(\"${view.viewExternalId}\"),\n upsert: model.upsert(\"${view.viewExternalId}\"),\n delete: <TItem extends NodeId>(items: TItem[]) => model.delete(items),\n },`;\n })\n .join(\"\\n\");\n\n return `${renderHeader(config)}\n\nimport type { CogniteClient } from \"@cognite/sdk\";\nimport {\n IndustrialModelClient,\n type AggregateOptions,\n type DataModelId,\n type DeleteResult,\n type IndustrialModelClientOptions,\n type NodeId,\n type QueryOptions,\n type UpsertOptions,\n} from \"industrial-model\";\nimport type {\n${imports}\n} from \"./types\";\n\nexport const DATA_MODEL = {\n space: \"${config.dataModelSpace}\",\n externalId: \"${config.dataModelId}\",\n version: \"${config.dataModelVersion}\",\n} satisfies DataModelId;\n\nexport class ${config.clientName}Client {\n private readonly model: IndustrialModelClient;\n\n constructor(client: CogniteClient, options: IndustrialModelClientOptions = {}) {\n this.model = new IndustrialModelClient(client, DATA_MODEL, options);\n }\n\n query<TView extends ${config.clientName}ViewExternalId>(\n viewExternalId: TView,\n ): ${config.clientName}QueryExecutor<TView> {\n const query = this.model.query<${config.clientName}Model<TView>>();\n const queryWithView = query as unknown as (\n options: QueryOptions<${config.clientName}Model<TView>>,\n ) => unknown;\n const execute = (options: Omit<QueryOptions<${config.clientName}Model<TView>>, \"viewExternalId\"> = {}) =>\n queryWithView({ ...options, viewExternalId });\n\n return execute as ${config.clientName}QueryExecutor<TView>;\n }\n\n aggregate<TView extends ${config.clientName}ViewExternalId>(\n viewExternalId: TView,\n ): ${config.clientName}AggregateExecutor<TView> {\n const aggregate = this.model.aggregate<${config.clientName}Model<TView>>();\n const execute = (\n options: Omit<AggregateOptions<${config.clientName}Model<TView>>, \"viewExternalId\"> = {},\n ) => aggregate({ ...options, viewExternalId });\n\n return execute as ${config.clientName}AggregateExecutor<TView>;\n }\n\n upsert<TView extends ${config.clientName}ViewExternalId>(\n viewExternalId: TView,\n ): ${config.clientName}UpsertExecutor<TView> {\n const upsert = this.model.upsert<${config.clientName}Model<TView>>();\n const execute = (options: Omit<UpsertOptions<${config.clientName}Model<TView>>, \"viewExternalId\">) =>\n upsert({ ...options, viewExternalId });\n\n return execute as ${config.clientName}UpsertExecutor<TView>;\n }\n\n delete<TItem extends NodeId>(items: TItem[]): Promise<DeleteResult> {\n return this.model.delete(items);\n }\n}\n\nexport function ${config.clientFunctionName}(\n cogniteClient: CogniteClient,\n options: IndustrialModelClientOptions = {},\n) {\n const model = new ${config.clientName}Client(cogniteClient, options);\n\n return {\n model,\n${viewShortcuts}\n };\n}\n`;\n}\n","/**\n * Template: renders index.ts content.\n */\n\nimport type { GeneratorConfig } from \"../renderer\";\nimport { renderHeader } from \"./header\";\n\nexport function renderIndex(config: GeneratorConfig): string {\n return `${renderHeader(config)}\n\nexport { DATA_MODEL, ${config.clientName}Client, ${config.clientFunctionName} } from \"./client\";\nexport type * from \"./types\";\n`;\n}\n","/**\n * Template: renders types.ts content.\n */\n\nimport type { ViewDefinition } from \"../models\";\nimport {\n getEnumTypeName,\n getInterfaceType,\n getPropsFields,\n getRelationResolvedType,\n getRelationTypeFields,\n} from \"../models\";\nimport type { GeneratorConfig } from \"../renderer\";\nimport { renderHeader } from \"./header\";\n\nexport function renderTypes(views: ViewDefinition[], config: GeneratorConfig): string {\n const lines: string[] = [\n renderHeader(config),\n \"\",\n \"import type {\",\n \" AggregateOptions,\",\n \" AggregateResult,\",\n \" AggregateResultItem,\",\n \" IndustrialModel,\",\n \" NodeId,\",\n \" QueryOptions,\",\n \" QueryResult,\",\n \" QueryResultItem,\",\n \" QuerySelect,\",\n \" UpsertOptions,\",\n \" UpsertResult,\",\n '} from \"industrial-model\";',\n \"\",\n ];\n\n // Render enum type aliases\n const enumAliases = renderEnumTypeAliases(views);\n if (enumAliases) {\n lines.push(enumAliases);\n lines.push(\"\");\n }\n\n lines.push(renderViewExternalIdUnion(views, config));\n\n for (const view of views) {\n lines.push(\"\");\n lines.push(renderView(view));\n }\n\n lines.push(\"\");\n lines.push(renderModelByView(views, config));\n lines.push(\"\");\n lines.push(renderExecutors(config));\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction renderViewExternalIdUnion(views: ViewDefinition[], config: GeneratorConfig): string {\n return `export type ${config.clientName}ViewExternalId =\n${views.map((view) => ` | \"${view.viewExternalId}\"`).join(\"\\n\")};`;\n}\n\nfunction renderEnumTypeAliases(views: ViewDefinition[]): string {\n const aliases: string[] = [];\n for (const view of views) {\n for (const field of view.fields) {\n if (field.enumValues && field.enumValues.length > 0) {\n const typeName = getEnumTypeName(view.viewName, field);\n const union = field.enumValues.map((v) => `\"${v}\"`).join(\" | \");\n aliases.push(`export type ${typeName} = ${union};`);\n }\n }\n }\n return aliases.join(\"\\n\");\n}\n\nfunction renderView(view: ViewDefinition): string {\n const propsFields = getPropsFields(view);\n const relationFields = getRelationTypeFields(view);\n\n if (relationFields.length === 0) {\n const propsLines = propsFields.map(\n (f) => ` ${f.fieldName}${f.isNullable ? \"?\" : \"\"}: ${getInterfaceType(f, view.viewName)};`,\n );\n\n return `export type ${view.viewName} = IndustrialModel<{\n${propsLines.join(\"\\n\")}\n}>;`;\n }\n\n const propsLines = propsFields.map(\n (f) => ` ${f.fieldName}${f.isNullable ? \"?\" : \"\"}: ${getInterfaceType(f, view.viewName)};`,\n );\n const relLines = relationFields.map(\n (f) => ` ${f.fieldName}${f.isNullable ? \"?\" : \"\"}: ${getRelationResolvedType(f)};`,\n );\n\n return `export type ${view.viewName} = IndustrialModel<\n {\n${propsLines.join(\"\\n\")}\n },\n {\n${relLines.join(\"\\n\")}\n }\n>;`;\n}\n\nfunction renderModelByView(views: ViewDefinition[], config: GeneratorConfig): string {\n return `export interface ${config.clientName}ModelByView {\n${views.map((view) => ` \"${view.viewExternalId}\": ${view.viewName};`).join(\"\\n\")}\n}\n\nexport type ${config.clientName}Model<TView extends ${config.clientName}ViewExternalId> =\n ${config.clientName}ModelByView[TView];`;\n}\n\nfunction renderExecutors(config: GeneratorConfig): string {\n const name = config.clientName;\n\n return `export type ${name}QueryExecutor<TView extends ${name}ViewExternalId> = {\n <const TSelect extends QuerySelect<${name}Model<TView>>>(\n options: Omit<QueryOptions<${name}Model<TView>, TSelect>, \"viewExternalId\" | \"select\"> & {\n select: TSelect & QuerySelect<${name}Model<TView>>;\n },\n ): Promise<QueryResult<QueryResultItem<${name}Model<TView>, TSelect>>>;\n (\n options?: Omit<QueryOptions<${name}Model<TView>, undefined>, \"viewExternalId\" | \"select\"> & {\n select?: undefined;\n },\n ): Promise<QueryResult<QueryResultItem<${name}Model<TView>, undefined>>>;\n};\n\nexport type ${name}AggregateExecutor<TView extends ${name}ViewExternalId> = <\n const TOptions extends Omit<AggregateOptions<${name}Model<TView>>, \"viewExternalId\">,\n>(\n options?: TOptions,\n) => Promise<\n AggregateResult<\n AggregateResultItem<${name}Model<TView>, TOptions[\"groupBy\"], TOptions[\"aggregate\"]>\n >\n>;\n\nexport type ${name}UpsertExecutor<TView extends ${name}ViewExternalId> = (\n options: Omit<UpsertOptions<${name}Model<TView>>, \"viewExternalId\">,\n) => Promise<UpsertResult>;`;\n}\n","export const isUpKey = (key, keybindings = []) => \n// The up key\nkey.name === 'up' ||\n // Vim keybinding: hjkl keys map to left/down/up/right\n (keybindings.includes('vim') && key.name === 'k') ||\n // Emacs keybinding: Ctrl+P means \"previous\" in Emacs navigation conventions\n (keybindings.includes('emacs') && key.ctrl && key.name === 'p');\nexport const isDownKey = (key, keybindings = []) => \n// The down key\nkey.name === 'down' ||\n // Vim keybinding: hjkl keys map to left/down/up/right\n (keybindings.includes('vim') && key.name === 'j') ||\n // Emacs keybinding: Ctrl+N means \"next\" in Emacs navigation conventions\n (keybindings.includes('emacs') && key.ctrl && key.name === 'n');\nexport const isSpaceKey = (key) => key.name === 'space';\nexport const isBackspaceKey = (key) => key.name === 'backspace';\nexport const isTabKey = (key) => key.name === 'tab';\nexport const isNumberKey = (key) => '1234567890'.includes(key.name);\nexport const isEnterKey = (key) => key.name === 'enter' || key.name === 'return';\nexport const isShiftKey = (key) => key.shift;\n","export class AbortPromptError extends Error {\n name = 'AbortPromptError';\n message = 'Prompt was aborted';\n constructor(options) {\n super();\n this.cause = options?.cause;\n }\n}\nexport class CancelPromptError extends Error {\n name = 'CancelPromptError';\n message = 'Prompt was canceled';\n}\nexport class ExitPromptError extends Error {\n name = 'ExitPromptError';\n}\nexport class HookError extends Error {\n name = 'HookError';\n}\nexport class ValidationError extends Error {\n name = 'ValidationError';\n}\n","import { AsyncResource } from 'node:async_hooks';\nimport { withPointer, handleChange } from \"./hook-engine.js\";\nfunction isFactory(value) {\n return typeof value === 'function';\n}\nexport function useState(defaultValue) {\n return withPointer((pointer) => {\n const setState = AsyncResource.bind(function setState(newValue) {\n // Noop if the value is still the same.\n if (pointer.get() !== newValue) {\n pointer.set(newValue);\n // Trigger re-render\n handleChange();\n }\n });\n if (pointer.initialized) {\n return [pointer.get(), setState];\n }\n const value = isFactory(defaultValue) ? defaultValue() : defaultValue;\n pointer.set(value);\n return [value, setState];\n });\n}\n","/* eslint @typescript-eslint/no-explicit-any: [\"off\"] */\nimport { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';\nimport { HookError, ValidationError } from \"./errors.js\";\nconst hookStorage = new AsyncLocalStorage();\nfunction createStore(rl) {\n const store = {\n rl,\n hooks: [],\n hooksCleanup: [],\n hooksEffect: [],\n index: 0,\n handleChange() { },\n };\n return store;\n}\n// Run callback in with the hook engine setup.\nexport function withHooks(rl, cb) {\n const store = createStore(rl);\n return hookStorage.run(store, () => {\n function cycle(render) {\n store.handleChange = () => {\n store.index = 0;\n render();\n };\n store.handleChange();\n }\n return cb(cycle);\n });\n}\n// Safe getStore utility that'll return the store or throw if undefined.\nfunction getStore() {\n const store = hookStorage.getStore();\n if (!store) {\n throw new HookError('[Inquirer] Hook functions can only be called from within a prompt');\n }\n return store;\n}\nexport function readline() {\n return getStore().rl;\n}\n// Merge state updates happening within the callback function to avoid multiple renders.\nexport function withUpdates(fn) {\n const wrapped = (...args) => {\n const store = getStore();\n let shouldUpdate = false;\n const oldHandleChange = store.handleChange;\n store.handleChange = () => {\n shouldUpdate = true;\n };\n const returnValue = fn(...args);\n if (shouldUpdate) {\n oldHandleChange();\n }\n store.handleChange = oldHandleChange;\n return returnValue;\n };\n return AsyncResource.bind(wrapped);\n}\nexport function withPointer(cb) {\n const store = getStore();\n const { index } = store;\n const pointer = {\n get() {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return store.hooks[index];\n },\n set(value) {\n store.hooks[index] = value;\n },\n initialized: index in store.hooks,\n };\n const returnValue = cb(pointer);\n store.index++;\n return returnValue;\n}\nexport function handleChange() {\n getStore().handleChange();\n}\nexport const effectScheduler = {\n queue(cb) {\n const store = getStore();\n const { index } = store;\n store.hooksEffect.push(() => {\n store.hooksCleanup[index]?.();\n const cleanFn = cb(readline());\n if (cleanFn != null && typeof cleanFn !== 'function') {\n throw new ValidationError('useEffect return value must be a cleanup function or nothing.');\n }\n store.hooksCleanup[index] = cleanFn;\n });\n },\n run() {\n const store = getStore();\n withUpdates(() => {\n store.hooksEffect.forEach((effect) => {\n effect();\n });\n // Warning: Clean the hooks before exiting the `withUpdates` block.\n // Failure to do so means an updates would hit the same effects again.\n store.hooksEffect.length = 0;\n })();\n },\n clearAll() {\n const store = getStore();\n store.hooksCleanup.forEach((cleanFn) => {\n cleanFn?.();\n });\n store.hooksEffect.length = 0;\n store.hooksCleanup.length = 0;\n },\n};\n","import { withPointer, effectScheduler } from \"./hook-engine.js\";\nexport function useEffect(cb, depArray) {\n withPointer((pointer) => {\n const oldDeps = pointer.get();\n const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));\n if (hasChanged) {\n effectScheduler.queue(cb);\n }\n pointer.set(depArray);\n });\n}\n","import { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nexport const defaultTheme = {\n prefix: {\n idle: styleText('blue', '?'),\n done: styleText('green', figures.tick),\n },\n spinner: {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'].map((frame) => styleText('yellow', frame)),\n },\n style: {\n answer: (text) => styleText('cyan', text),\n message: (text) => styleText('bold', text),\n error: (text) => styleText('red', `> ${text}`),\n defaultAnswer: (text) => styleText('dim', `(${text})`),\n help: (text) => styleText('dim', text),\n highlight: (text) => styleText('cyan', text),\n key: (text) => styleText('cyan', styleText('bold', `<${text}>`)),\n },\n};\n","// process.env dot-notation access prints:\n// Property 'TERM' comes from an index signature, so it must be accessed with ['TERM'].ts(4111)\n/* eslint dot-notation: [\"off\"] */\nimport process from 'node:process';\n// Ported from is-unicode-supported\nfunction isUnicodeSupported() {\n if (!process.platform.startsWith('win')) {\n return process.env['TERM'] !== 'linux'; // Linux console (kernel)\n }\n return (Boolean(process.env['CI']) || // CI environments generally support unicode\n Boolean(process.env['WT_SESSION']) || // Windows Terminal\n Boolean(process.env['TERMINUS_SUBLIME']) || // Terminus (<0.2.27)\n process.env['ConEmuTask'] === '{cmd::Cmder}' || // ConEmu and cmder\n process.env['TERM_PROGRAM'] === 'Terminus-Sublime' ||\n process.env['TERM_PROGRAM'] === 'vscode' ||\n process.env['TERM'] === 'xterm-256color' ||\n process.env['TERM'] === 'alacritty' ||\n process.env['TERMINAL_EMULATOR'] === 'JetBrains-JediTerm');\n}\n// Ported from figures\nconst common = {\n circleQuestionMark: '(?)',\n questionMarkPrefix: '(?)',\n square: '█',\n squareDarkShade: '▓',\n squareMediumShade: '▒',\n squareLightShade: '░',\n squareTop: '▀',\n squareBottom: '▄',\n squareLeft: '▌',\n squareRight: '▐',\n squareCenter: '■',\n bullet: '●',\n dot: '․',\n ellipsis: '…',\n pointerSmall: '›',\n triangleUp: '▲',\n triangleUpSmall: '▴',\n triangleDown: '▼',\n triangleDownSmall: '▾',\n triangleLeftSmall: '◂',\n triangleRightSmall: '▸',\n home: '⌂',\n heart: '♥',\n musicNote: '♪',\n musicNoteBeamed: '♫',\n arrowUp: '↑',\n arrowDown: '↓',\n arrowLeft: '←',\n arrowRight: '→',\n arrowLeftRight: '↔',\n arrowUpDown: '↕',\n almostEqual: '≈',\n notEqual: '≠',\n lessOrEqual: '≤',\n greaterOrEqual: '≥',\n identical: '≡',\n infinity: '∞',\n subscriptZero: '₀',\n subscriptOne: '₁',\n subscriptTwo: '₂',\n subscriptThree: '₃',\n subscriptFour: '₄',\n subscriptFive: '₅',\n subscriptSix: '₆',\n subscriptSeven: '₇',\n subscriptEight: '₈',\n subscriptNine: '₉',\n oneHalf: '½',\n oneThird: '⅓',\n oneQuarter: '¼',\n oneFifth: '⅕',\n oneSixth: '⅙',\n oneEighth: '⅛',\n twoThirds: '⅔',\n twoFifths: '⅖',\n threeQuarters: '¾',\n threeFifths: '⅗',\n threeEighths: '⅜',\n fourFifths: '⅘',\n fiveSixths: '⅚',\n fiveEighths: '⅝',\n sevenEighths: '⅞',\n line: '─',\n lineBold: '━',\n lineDouble: '═',\n lineDashed0: '┄',\n lineDashed1: '┅',\n lineDashed2: '┈',\n lineDashed3: '┉',\n lineDashed4: '╌',\n lineDashed5: '╍',\n lineDashed6: '╴',\n lineDashed7: '╶',\n lineDashed8: '╸',\n lineDashed9: '╺',\n lineDashed10: '╼',\n lineDashed11: '╾',\n lineDashed12: '−',\n lineDashed13: '–',\n lineDashed14: '‐',\n lineDashed15: '⁃',\n lineVertical: '│',\n lineVerticalBold: '┃',\n lineVerticalDouble: '║',\n lineVerticalDashed0: '┆',\n lineVerticalDashed1: '┇',\n lineVerticalDashed2: '┊',\n lineVerticalDashed3: '┋',\n lineVerticalDashed4: '╎',\n lineVerticalDashed5: '╏',\n lineVerticalDashed6: '╵',\n lineVerticalDashed7: '╷',\n lineVerticalDashed8: '╹',\n lineVerticalDashed9: '╻',\n lineVerticalDashed10: '╽',\n lineVerticalDashed11: '╿',\n lineDownLeft: '┐',\n lineDownLeftArc: '╮',\n lineDownBoldLeftBold: '┓',\n lineDownBoldLeft: '┒',\n lineDownLeftBold: '┑',\n lineDownDoubleLeftDouble: '╗',\n lineDownDoubleLeft: '╖',\n lineDownLeftDouble: '╕',\n lineDownRight: '┌',\n lineDownRightArc: '╭',\n lineDownBoldRightBold: '┏',\n lineDownBoldRight: '┎',\n lineDownRightBold: '┍',\n lineDownDoubleRightDouble: '╔',\n lineDownDoubleRight: '╓',\n lineDownRightDouble: '╒',\n lineUpLeft: '┘',\n lineUpLeftArc: '╯',\n lineUpBoldLeftBold: '┛',\n lineUpBoldLeft: '┚',\n lineUpLeftBold: '┙',\n lineUpDoubleLeftDouble: '╝',\n lineUpDoubleLeft: '╜',\n lineUpLeftDouble: '╛',\n lineUpRight: '└',\n lineUpRightArc: '╰',\n lineUpBoldRightBold: '┗',\n lineUpBoldRight: '┖',\n lineUpRightBold: '┕',\n lineUpDoubleRightDouble: '╚',\n lineUpDoubleRight: '╙',\n lineUpRightDouble: '╘',\n lineUpDownLeft: '┤',\n lineUpBoldDownBoldLeftBold: '┫',\n lineUpBoldDownBoldLeft: '┨',\n lineUpDownLeftBold: '┥',\n lineUpBoldDownLeftBold: '┩',\n lineUpDownBoldLeftBold: '┪',\n lineUpDownBoldLeft: '┧',\n lineUpBoldDownLeft: '┦',\n lineUpDoubleDownDoubleLeftDouble: '╣',\n lineUpDoubleDownDoubleLeft: '╢',\n lineUpDownLeftDouble: '╡',\n lineUpDownRight: '├',\n lineUpBoldDownBoldRightBold: '┣',\n lineUpBoldDownBoldRight: '┠',\n lineUpDownRightBold: '┝',\n lineUpBoldDownRightBold: '┡',\n lineUpDownBoldRightBold: '┢',\n lineUpDownBoldRight: '┟',\n lineUpBoldDownRight: '┞',\n lineUpDoubleDownDoubleRightDouble: '╠',\n lineUpDoubleDownDoubleRight: '╟',\n lineUpDownRightDouble: '╞',\n lineDownLeftRight: '┬',\n lineDownBoldLeftBoldRightBold: '┳',\n lineDownLeftBoldRightBold: '┯',\n lineDownBoldLeftRight: '┰',\n lineDownBoldLeftBoldRight: '┱',\n lineDownBoldLeftRightBold: '┲',\n lineDownLeftRightBold: '┮',\n lineDownLeftBoldRight: '┭',\n lineDownDoubleLeftDoubleRightDouble: '╦',\n lineDownDoubleLeftRight: '╥',\n lineDownLeftDoubleRightDouble: '╤',\n lineUpLeftRight: '┴',\n lineUpBoldLeftBoldRightBold: '┻',\n lineUpLeftBoldRightBold: '┷',\n lineUpBoldLeftRight: '┸',\n lineUpBoldLeftBoldRight: '┹',\n lineUpBoldLeftRightBold: '┺',\n lineUpLeftRightBold: '┶',\n lineUpLeftBoldRight: '┵',\n lineUpDoubleLeftDoubleRightDouble: '╩',\n lineUpDoubleLeftRight: '╨',\n lineUpLeftDoubleRightDouble: '╧',\n lineUpDownLeftRight: '┼',\n lineUpBoldDownBoldLeftBoldRightBold: '╋',\n lineUpDownBoldLeftBoldRightBold: '╈',\n lineUpBoldDownLeftBoldRightBold: '╇',\n lineUpBoldDownBoldLeftRightBold: '╊',\n lineUpBoldDownBoldLeftBoldRight: '╉',\n lineUpBoldDownLeftRight: '╀',\n lineUpDownBoldLeftRight: '╁',\n lineUpDownLeftBoldRight: '┽',\n lineUpDownLeftRightBold: '┾',\n lineUpBoldDownBoldLeftRight: '╂',\n lineUpDownLeftBoldRightBold: '┿',\n lineUpBoldDownLeftBoldRight: '╃',\n lineUpBoldDownLeftRightBold: '╄',\n lineUpDownBoldLeftBoldRight: '╅',\n lineUpDownBoldLeftRightBold: '╆',\n lineUpDoubleDownDoubleLeftDoubleRightDouble: '╬',\n lineUpDoubleDownDoubleLeftRight: '╫',\n lineUpDownLeftDoubleRightDouble: '╪',\n lineCross: '╳',\n lineBackslash: '╲',\n lineSlash: '╱',\n};\nconst specialMainSymbols = {\n tick: '✔',\n info: 'ℹ',\n warning: '⚠',\n cross: '✘',\n squareSmall: '◻',\n squareSmallFilled: '◼',\n circle: '◯',\n circleFilled: '◉',\n circleDotted: '◌',\n circleDouble: '◎',\n circleCircle: 'ⓞ',\n circleCross: 'ⓧ',\n circlePipe: 'Ⓘ',\n radioOn: '◉',\n radioOff: '◯',\n checkboxOn: '☒',\n checkboxOff: '☐',\n checkboxCircleOn: 'ⓧ',\n checkboxCircleOff: 'Ⓘ',\n pointer: '❯',\n triangleUpOutline: '△',\n triangleLeft: '◀',\n triangleRight: '▶',\n lozenge: '◆',\n lozengeOutline: '◇',\n hamburger: '☰',\n smiley: '㋡',\n mustache: '෴',\n star: '★',\n play: '▶',\n nodejs: '⬢',\n oneSeventh: '⅐',\n oneNinth: '⅑',\n oneTenth: '⅒',\n};\nconst specialFallbackSymbols = {\n tick: '√',\n info: 'i',\n warning: '‼',\n cross: '×',\n squareSmall: '□',\n squareSmallFilled: '■',\n circle: '( )',\n circleFilled: '(*)',\n circleDotted: '( )',\n circleDouble: '( )',\n circleCircle: '(○)',\n circleCross: '(×)',\n circlePipe: '(│)',\n radioOn: '(*)',\n radioOff: '( )',\n checkboxOn: '[×]',\n checkboxOff: '[ ]',\n checkboxCircleOn: '(×)',\n checkboxCircleOff: '( )',\n pointer: '>',\n triangleUpOutline: '∆',\n triangleLeft: '◄',\n triangleRight: '►',\n lozenge: '♦',\n lozengeOutline: '◊',\n hamburger: '≡',\n smiley: '☺',\n mustache: '┌─┐',\n star: '✶',\n play: '►',\n nodejs: '♦',\n oneSeventh: '1/7',\n oneNinth: '1/9',\n oneTenth: '1/10',\n};\nexport const mainSymbols = {\n ...common,\n ...specialMainSymbols,\n};\nexport const fallbackSymbols = {\n ...common,\n ...specialFallbackSymbols,\n};\nconst shouldUseMain = isUnicodeSupported();\nconst figures = shouldUseMain\n ? mainSymbols\n : fallbackSymbols;\nexport default figures;\nconst replacements = Object.entries(specialMainSymbols);\n// On terminals which do not support Unicode symbols, substitute them to other symbols\nexport const replaceSymbols = (string, { useFallback = !shouldUseMain } = {}) => {\n if (useFallback) {\n for (const [key, mainSymbol] of replacements) {\n const fallbackSymbol = fallbackSymbols[key];\n if (!fallbackSymbol) {\n throw new Error(`Unable to find fallback for ${key}`);\n }\n string = string.replaceAll(mainSymbol, fallbackSymbol);\n }\n }\n return string;\n};\n","import { defaultTheme } from \"./theme.js\";\nfunction isPlainObject(value) {\n if (typeof value !== 'object' || value === null)\n return false;\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n}\nfunction deepMerge(...objects) {\n const output = {};\n for (const obj of objects) {\n for (const [key, value] of Object.entries(obj)) {\n const prevValue = output[key];\n output[key] =\n isPlainObject(prevValue) && isPlainObject(value)\n ? deepMerge(prevValue, value)\n : value;\n }\n }\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return output;\n}\nexport function makeTheme(...themes) {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const themesToMerge = [\n defaultTheme,\n ...themes.filter((theme) => theme != null),\n ];\n return deepMerge(...themesToMerge);\n}\n","import { useState } from \"./use-state.js\";\nimport { useEffect } from \"./use-effect.js\";\nimport { makeTheme } from \"./make-theme.js\";\nexport function usePrefix({ status = 'idle', theme, }) {\n const [showLoader, setShowLoader] = useState(false);\n const [tick, setTick] = useState(0);\n const { prefix, spinner } = makeTheme(theme);\n useEffect(() => {\n if (status === 'loading') {\n let tickInterval;\n let inc = -1;\n // Delay displaying spinner by 300ms, to avoid flickering\n const delayTimeout = setTimeout(() => {\n setShowLoader(true);\n tickInterval = setInterval(() => {\n inc = inc + 1;\n setTick(inc % spinner.frames.length);\n }, spinner.interval);\n }, 300);\n return () => {\n clearTimeout(delayTimeout);\n clearInterval(tickInterval);\n };\n }\n else {\n setShowLoader(false);\n }\n }, [status]);\n if (showLoader) {\n return spinner.frames[tick];\n }\n // There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead.\n const iconName = status === 'loading' ? 'idle' : status;\n return typeof prefix === 'string' ? prefix : (prefix[iconName] ?? prefix['idle']);\n}\n","import { withPointer } from \"./hook-engine.js\";\nexport function useMemo(fn, dependencies) {\n return withPointer((pointer) => {\n const prev = pointer.get();\n if (!prev ||\n prev.dependencies.length !== dependencies.length ||\n prev.dependencies.some((dep, i) => dep !== dependencies[i])) {\n const value = fn();\n pointer.set({ value, dependencies });\n return value;\n }\n return prev.value;\n });\n}\n","import { useState } from \"./use-state.js\";\nexport function useRef(val) {\n return useState({ current: val })[0];\n}\n","import { useRef } from \"./use-ref.js\";\nimport { useEffect } from \"./use-effect.js\";\nimport { withUpdates } from \"./hook-engine.js\";\nexport function useKeypress(userHandler) {\n const signal = useRef(userHandler);\n signal.current = userHandler;\n useEffect((rl) => {\n let ignore = false;\n const handler = withUpdates((_input, event) => {\n if (ignore)\n return;\n void signal.current(event, rl);\n });\n rl.input.on('keypress', handler);\n return () => {\n ignore = true;\n rl.input.removeListener('keypress', handler);\n };\n }, []);\n}\n","import cliWidth from 'cli-width';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { readline } from \"./hook-engine.js\";\n/**\n * Force line returns at specific width. This function is ANSI code friendly and it'll\n * ignore invisible codes during width calculation.\n * @param {string} content\n * @param {number} width\n * @return {string}\n */\nexport function breakLines(content, width) {\n return content\n .split('\\n')\n .flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true })\n .split('\\n')\n .map((str) => str.trimEnd()))\n .join('\\n');\n}\n/**\n * Returns the width of the active readline, or 80 as default value.\n * @returns {number}\n */\nexport function readlineWidth() {\n return cliWidth({ defaultWidth: 80, output: readline().output });\n}\n","/* MAIN */\nconst getCodePointsLength = (() => {\n const SURROGATE_PAIR_RE = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n return (input) => {\n let surrogatePairsNr = 0;\n SURROGATE_PAIR_RE.lastIndex = 0;\n while (SURROGATE_PAIR_RE.test(input)) {\n surrogatePairsNr += 1;\n }\n return input.length - surrogatePairsNr;\n };\n})();\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWideNotCJKTNotEmoji = (x) => {\n return x === 0x231B || x === 0x2329 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji };\n","/* IMPORT */\nimport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\\u001b\\]8;[^;]*;.*?(?:\\u0007|\\u001b\\u005c)/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst CJKT_WIDE_RE = /(?:(?![\\uFF61-\\uFF9F\\uFF00-\\uFFEF])[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\p{Script=Tangut}]){1,1000}/yu;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;\n const PARSE_BLOCKS = [\n [LATIN_RE, REGULAR_WIDTH],\n [ANSI_RE, ANSI_WIDTH],\n [CONTROL_RE, CONTROL_WIDTH],\n [TAB_RE, TAB_WIDTH],\n [EMOJI_RE, EMOJI_WIDTH],\n [CJKT_WIDE_RE, WIDE_WIDTH],\n ];\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWideNotCJKTNotEmoji(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length) {\n break outer;\n }\n /* PARSE BLOCKS */\n for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {\n const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];\n BLOCK_RE.lastIndex = index;\n if (BLOCK_RE.test(input)) {\n lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;\n widthExtra = lengthExtra * BLOCK_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = BLOCK_RE.lastIndex;\n continue outer;\n }\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n",null,"import { useRef } from \"../use-ref.js\";\nimport { readlineWidth, breakLines } from \"../utils.js\";\nfunction usePointerPosition({ active, renderedItems, pageSize, loop, }) {\n const state = useRef({\n lastPointer: active,\n lastActive: undefined,\n });\n const { lastPointer, lastActive } = state.current;\n const middle = Math.floor(pageSize / 2);\n const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);\n const defaultPointerPosition = renderedItems\n .slice(0, active)\n .reduce((acc, item) => acc + item.length, 0);\n let pointer = defaultPointerPosition;\n if (renderedLength > pageSize) {\n if (loop) {\n /**\n * Creates the next position for the pointer considering an infinitely\n * looping list of items to be rendered on the page.\n *\n * The goal is to progressively move the cursor to the middle position as the user move down, and then keep\n * the cursor there. When the user move up, maintain the cursor position.\n */\n // By default, keep the cursor position as-is.\n pointer = lastPointer;\n if (\n // First render, skip this logic.\n lastActive != null &&\n // Only move the pointer down when the user moves down.\n lastActive < active &&\n // Check user didn't move up across page boundary.\n active - lastActive < pageSize) {\n pointer = Math.min(\n // Furthest allowed position for the pointer is the middle of the list\n middle, Math.abs(active - lastActive) === 1\n ? Math.min(\n // Move the pointer at most the height of the last active item.\n lastPointer + (renderedItems[lastActive]?.length ?? 0), \n // If the user moved by one item, move the pointer to the natural position of the active item as\n // long as it doesn't move the cursor up.\n Math.max(defaultPointerPosition, lastPointer))\n : // Otherwise, move the pointer down by the difference between the active and last active item.\n lastPointer + active - lastActive);\n }\n }\n else {\n /**\n * Creates the next position for the pointer considering a finite list of\n * items to be rendered on a page.\n *\n * The goal is to keep the pointer in the middle of the page whenever possible, until\n * we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively\n * to the bottom or top of the list.\n */\n const spaceUnderActive = renderedItems\n .slice(active)\n .reduce((acc, item) => acc + item.length, 0);\n pointer =\n spaceUnderActive < pageSize - middle\n ? // If the active item is near the end of the list, progressively move the cursor towards the end.\n pageSize - spaceUnderActive\n : // Otherwise, progressively move the pointer to the middle of the list.\n Math.min(defaultPointerPosition, middle);\n }\n }\n // Save state for the next render\n state.current.lastPointer = pointer;\n state.current.lastActive = active;\n return pointer;\n}\nexport function usePagination({ items, active, renderItem, pageSize, loop = true, }) {\n const width = readlineWidth();\n const bound = (num) => ((num % items.length) + items.length) % items.length;\n const renderedItems = items.map((item, index) => {\n if (item == null)\n return [];\n return breakLines(renderItem({ item, index, isActive: index === active }), width).split('\\n');\n });\n const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);\n const renderItemAtIndex = (index) => renderedItems[index] ?? [];\n const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });\n // Render the active item to decide the position.\n // If the active item fits under the pointer, we render it there.\n // Otherwise, we need to render it to fit at the bottom of the page; moving the pointer up.\n const activeItem = renderItemAtIndex(active).slice(0, pageSize);\n const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;\n // Create an array of lines for the page, and add the lines of the active item into the page\n const pageBuffer = Array.from({ length: pageSize });\n pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);\n // Store to prevent rendering the same item twice\n const itemVisited = new Set([active]);\n // Fill the page under the active item\n let bufferPointer = activeItemPosition + activeItem.length;\n let itemPointer = bound(active + 1);\n while (bufferPointer < pageSize &&\n !itemVisited.has(itemPointer) &&\n (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {\n const lines = renderItemAtIndex(itemPointer);\n const linesToAdd = lines.slice(0, pageSize - bufferPointer);\n pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);\n // Move pointers for next iteration\n itemVisited.add(itemPointer);\n bufferPointer += linesToAdd.length;\n itemPointer = bound(itemPointer + 1);\n }\n // Fill the page over the active item\n bufferPointer = activeItemPosition - 1;\n itemPointer = bound(active - 1);\n while (bufferPointer >= 0 &&\n !itemVisited.has(itemPointer) &&\n (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {\n const lines = renderItemAtIndex(itemPointer);\n const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));\n pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);\n // Move pointers for next iteration\n itemVisited.add(itemPointer);\n bufferPointer -= linesToAdd.length;\n itemPointer = bound(itemPointer - 1);\n }\n return pageBuffer.filter((line) => typeof line === 'string').join('\\n');\n}\n","import * as readline from 'node:readline';\nimport { AsyncResource } from 'node:async_hooks';\nimport MuteStream from 'mute-stream';\nimport { onExit as onSignalExit } from 'signal-exit';\nimport ScreenManager from \"./screen-manager.js\";\nimport { PromisePolyfill } from \"./promise-polyfill.js\";\nimport { withHooks, effectScheduler } from \"./hook-engine.js\";\nimport { AbortPromptError, CancelPromptError, ExitPromptError } from \"./errors.js\";\nimport path from 'node:path';\n// Capture the real setImmediate at module load time so it works even when test\n// frameworks mock timers with vi.useFakeTimers() or similar.\nconst nativeSetImmediate = globalThis.setImmediate;\nfunction getCallSites() {\n // oxlint-disable-next-line typescript/unbound-method\n const savedPrepareStackTrace = Error.prepareStackTrace;\n let result = [];\n try {\n Error.prepareStackTrace = (_, callSites) => {\n const callSitesWithoutCurrent = callSites.slice(1);\n result = callSitesWithoutCurrent;\n return callSitesWithoutCurrent;\n };\n // oxlint-disable-next-line no-unused-expressions\n new Error().stack;\n }\n catch {\n // An error will occur if the Node flag --frozen-intrinsics is used.\n // https://nodejs.org/api/cli.html#--frozen-intrinsics\n return result;\n }\n Error.prepareStackTrace = savedPrepareStackTrace;\n return result;\n}\nexport function createPrompt(view) {\n const callSites = getCallSites();\n const prompt = (config, context = {}) => {\n // Default `input` to stdin\n const { input = process.stdin, signal } = context;\n const cleanups = new Set();\n // Add mute capabilities to the output\n const output = new MuteStream();\n output.pipe(context.output ?? process.stdout);\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const rl = readline.createInterface({\n terminal: true,\n input,\n output,\n });\n // Mute the output after readline has initialized so readline can perform\n // any terminal setup writes (e.g. Windows Console API initialization)\n // before suppressing output. ScreenManager will unmute/mute around each\n // render call as needed.\n output.mute();\n const screen = new ScreenManager(rl);\n const { promise, resolve, reject } = PromisePolyfill.withResolver();\n const cancel = () => reject(new CancelPromptError());\n if (signal) {\n const abort = () => reject(new AbortPromptError({ cause: signal.reason }));\n if (signal.aborted) {\n abort();\n return Object.assign(promise, { cancel });\n }\n signal.addEventListener('abort', abort);\n cleanups.add(() => signal.removeEventListener('abort', abort));\n }\n cleanups.add(onSignalExit((code, signal) => {\n reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));\n }));\n // SIGINT must be explicitly handled by the prompt so the ExitPromptError can be handled.\n // Otherwise, the prompt will stop and in some scenarios never resolve.\n // Ref issue #1741\n const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));\n rl.on('SIGINT', sigint);\n cleanups.add(() => rl.removeListener('SIGINT', sigint));\n return withHooks(rl, (cycle) => {\n // The close event triggers immediately when the user press ctrl+c. SignalExit on the other hand\n // triggers after the process is done (which happens after timeouts are done triggering.)\n // We triggers the hooks cleanup phase on rl `close` so active timeouts can be cleared.\n const hooksCleanup = AsyncResource.bind(() => effectScheduler.clearAll());\n rl.on('close', hooksCleanup);\n cleanups.add(() => rl.removeListener('close', hooksCleanup));\n const startCycle = () => {\n // Re-renders only happen when the state change; but the readline cursor could\n // change position and that also requires a re-render (and a manual one because\n // we mute the streams). We set the listener after the initial workLoop to avoid\n // a double render if render triggered by a state change sets the cursor to the\n // right position.\n const checkCursorPos = () => screen.checkCursorPos();\n rl.input.on('keypress', checkCursorPos);\n cleanups.add(() => rl.input.removeListener('keypress', checkCursorPos));\n let pendingDone = null;\n cycle(() => {\n let effectsSettled = false;\n try {\n const nextView = view(config, (value) => {\n if (effectsSettled) {\n // After the cycle completes (async validation path), the \"done\"\n // render already flushed via setStatus → handleChange, so resolve\n // immediately.\n resolve(value);\n }\n else {\n pendingDone = { value };\n }\n });\n // Typescript won't allow this, but not all users rely on typescript.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (nextView === undefined) {\n let callerFilename = callSites[1]?.getFileName();\n if (callerFilename && !callerFilename.startsWith('file://')) {\n callerFilename = path.resolve(callerFilename);\n }\n throw new Error(`Prompt functions must return a string.\\n at ${callerFilename}`);\n }\n const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView;\n screen.render(content, bottomContent);\n effectScheduler.run();\n }\n catch (error) {\n reject(error);\n }\n effectsSettled = true;\n if (pendingDone !== null) {\n const { value } = pendingDone;\n pendingDone = null;\n resolve(value);\n }\n });\n };\n // Proper Readable streams (like process.stdin) may have OS-level buffered\n // data that arrives in the poll phase when readline resumes the stream.\n // Deferring the first render by one setImmediate tick (check phase, after\n // poll) lets that stale data flow through readline harmlessly—no keypress\n // handlers are registered yet and the output is muted, so the stale\n // keystrokes are silently discarded.\n // Old-style streams (like MuteStream) have no such buffering, so the\n // render cycle starts immediately.\n //\n // @see https://github.com/SBoudrias/Inquirer.js/issues/1303\n if ('readableFlowing' in input) {\n nativeSetImmediate(startCycle);\n }\n else {\n startCycle();\n }\n return Object.assign(promise\n .then((answer) => {\n effectScheduler.clearAll();\n return answer;\n }, (error) => {\n effectScheduler.clearAll();\n throw error;\n })\n // Wait for the promise to settle, then cleanup.\n .finally(() => {\n cleanups.forEach((cleanup) => cleanup());\n screen.done({ clearContent: Boolean(context.clearPromptOnDone) });\n output.end();\n })\n // Once cleanup is done, let the expose promise resolve/reject to the internal one.\n .then(() => promise), { cancel });\n });\n };\n return prompt;\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 { stripVTControlCharacters } from 'node:util';\nimport { breakLines, readlineWidth } from \"./utils.js\";\nimport { cursorDown, cursorLeft, cursorUp, cursorTo, cursorShow, eraseLines, } from '@inquirer/ansi';\nconst height = (content) => content.split('\\n').length;\nconst lastLine = (content) => content.split('\\n').pop() ?? '';\nexport default class ScreenManager {\n // These variables are keeping information to allow correct prompt re-rendering\n height = 0;\n extraLinesUnderPrompt = 0;\n cursorPos;\n rl;\n constructor(rl) {\n this.rl = rl;\n this.cursorPos = rl.getCursorPos();\n }\n write(content) {\n this.rl.output.unmute();\n this.rl.output.write(content);\n this.rl.output.mute();\n }\n render(content, bottomContent = '') {\n // Write message to screen and setPrompt to control backspace\n const promptLine = lastLine(content);\n const rawPromptLine = stripVTControlCharacters(promptLine);\n // Remove the rl.line from our prompt. We can't rely on the content of\n // rl.line (mainly because of the password prompt), so just rely on it's\n // length.\n let prompt = rawPromptLine;\n if (this.rl.line.length > 0) {\n prompt = prompt.slice(0, -this.rl.line.length);\n }\n this.rl.setPrompt(prompt);\n // SetPrompt will change cursor position, now we can get correct value\n this.cursorPos = this.rl.getCursorPos();\n const width = readlineWidth();\n content = breakLines(content, width);\n bottomContent = breakLines(bottomContent, width);\n // Manually insert an extra line if we're at the end of the line.\n // This prevent the cursor from appearing at the beginning of the\n // current line.\n if (rawPromptLine.length % width === 0) {\n content += '\\n';\n }\n let output = content + (bottomContent ? '\\n' + bottomContent : '');\n /**\n * Re-adjust the cursor at the correct position.\n */\n // We need to consider parts of the prompt under the cursor as part of the bottom\n // content in order to correctly cleanup and re-render.\n const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;\n const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);\n // Return cursor to the input position (on top of the bottomContent)\n if (bottomContentHeight > 0)\n output += cursorUp(bottomContentHeight);\n // Return cursor to the initial left offset.\n output += cursorTo(this.cursorPos.cols);\n /**\n * Render and store state for future re-rendering\n */\n this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);\n this.extraLinesUnderPrompt = bottomContentHeight;\n this.height = height(output);\n }\n checkCursorPos() {\n const cursorPos = this.rl.getCursorPos();\n if (cursorPos.cols !== this.cursorPos.cols) {\n this.write(cursorTo(cursorPos.cols));\n this.cursorPos = cursorPos;\n }\n }\n done({ clearContent }) {\n this.rl.setPrompt('');\n let output = cursorDown(this.extraLinesUnderPrompt);\n output += clearContent ? eraseLines(this.height) : '\\n';\n // Reset cursor to column 0. On Windows terminals, \\n moves the cursor\n // down without resetting the column when the rendered prompt+answer\n // wraps past the terminal width. Without this, all subsequent output\n // starts at the wrong horizontal offset.\n output += cursorLeft;\n output += cursorShow;\n this.write(output);\n this.rl.close();\n }\n}\n","const ESC = '\\u001B[';\n/** Move cursor to first column */\nexport const cursorLeft = ESC + 'G';\n/** Hide the cursor */\nexport const cursorHide = ESC + '?25l';\n/** Show the cursor */\nexport const cursorShow = ESC + '?25h';\n/** Move cursor up by count rows */\nexport const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '');\n/** Move cursor down by count rows */\nexport const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : '';\n/** Move cursor to position (x, y) */\nexport const cursorTo = (x, y) => {\n if (typeof y === 'number' && !Number.isNaN(y)) {\n return `${ESC}${y + 1};${x + 1}H`;\n }\n return `${ESC}${x + 1}G`;\n};\nconst eraseLine = ESC + '2K';\n/** Erase the specified number of lines above the cursor */\nexport const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : '';\n","// TODO: Remove this class once Node 22 becomes the minimum supported version.\nexport class PromisePolyfill extends Promise {\n // Available starting from Node 22\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers\n static withResolver() {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve, reject: reject };\n }\n}\n","import { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\n/**\n * Separator object\n * Used to space/separate choices group\n */\nexport class Separator {\n separator = styleText('dim', Array.from({ length: 15 }).join(figures.line));\n type = 'separator';\n constructor(separator) {\n if (separator) {\n this.separator = separator;\n }\n }\n static isSeparator(choice) {\n return Boolean(choice &&\n typeof choice === 'object' &&\n 'type' in choice &&\n choice.type === 'separator');\n }\n}\n","import { createPrompt, useState, useKeypress, useEffect, usePrefix, isBackspaceKey, isEnterKey, isTabKey, makeTheme, } from '@inquirer/core';\nconst inputTheme = {\n validationFailureMode: 'keep',\n};\nexport default createPrompt((config, done) => {\n const { prefill = 'tab' } = config;\n const theme = makeTheme(inputTheme, config.theme);\n const [status, setStatus] = useState('idle');\n // Coerce to string to handle runtime values that may be numbers despite TypeScript types\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const [defaultValue, setDefaultValue] = useState(String(config.default ?? ''));\n const [errorMsg, setError] = useState();\n const [value, setValue] = useState('');\n const prefix = usePrefix({ status, theme });\n async function validate(value) {\n const { required, pattern, patternError = 'Invalid input' } = config;\n if (required && !value) {\n return 'You must provide a value';\n }\n if (pattern && !pattern.test(value)) {\n return patternError;\n }\n if (typeof config.validate === 'function') {\n return (await config.validate(value)) || 'You must provide a valid value';\n }\n return true;\n }\n useKeypress(async (key, rl) => {\n // Ignore keypress while our prompt is doing other processing.\n if (status !== 'idle') {\n return;\n }\n if (isEnterKey(key)) {\n const answer = value || defaultValue;\n setStatus('loading');\n const isValid = await validate(answer);\n if (isValid === true) {\n setValue(answer);\n setStatus('done');\n done(answer);\n }\n else {\n if (theme.validationFailureMode === 'clear') {\n setValue('');\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(value);\n }\n setError(isValid);\n setStatus('idle');\n }\n }\n else if (isBackspaceKey(key) && !value) {\n setDefaultValue('');\n }\n else if (isTabKey(key) && !value) {\n setDefaultValue('');\n rl.clearLine(0); // Remove the tab character.\n rl.write(defaultValue);\n setValue(defaultValue);\n }\n else {\n setValue(rl.line);\n setError(undefined);\n }\n });\n // If prefill is set to 'editable' cut out the default value and paste into current state and the user's cli buffer\n // They can edit the value immediately instead of needing to press 'tab'\n useEffect((rl) => {\n if (prefill === 'editable' && defaultValue) {\n rl.write(defaultValue);\n setValue(defaultValue);\n }\n }, []);\n const message = theme.style.message(config.message, status);\n let formattedValue = value;\n if (typeof config.transformer === 'function') {\n formattedValue = config.transformer(value, { isFinal: status === 'done' });\n }\n else if (status === 'done') {\n formattedValue = theme.style.answer(value);\n }\n let defaultStr;\n if (defaultValue && status !== 'done' && !value) {\n defaultStr = theme.style.defaultAnswer(defaultValue);\n }\n let error = '';\n if (errorMsg) {\n error = theme.style.error(errorMsg);\n }\n return [\n [prefix, message, defaultStr, formattedValue]\n .filter((v) => v !== undefined)\n .join(' '),\n error,\n ];\n});\n","import { createPrompt, useState, useKeypress, usePrefix, isEnterKey, makeTheme, } from '@inquirer/core';\nimport { cursorHide } from '@inquirer/ansi';\nconst passwordTheme = {\n style: {\n maskedText: '[input is masked]',\n },\n};\nexport default createPrompt((config, done) => {\n const { validate = () => true } = config;\n const theme = makeTheme(passwordTheme, config.theme);\n const [status, setStatus] = useState('idle');\n const [errorMsg, setError] = useState();\n const [value, setValue] = useState('');\n const prefix = usePrefix({ status, theme });\n useKeypress(async (key, rl) => {\n // Ignore keypress while our prompt is doing other processing.\n if (status !== 'idle') {\n return;\n }\n if (isEnterKey(key)) {\n const answer = value;\n setStatus('loading');\n const isValid = await validate(answer);\n if (isValid === true) {\n setValue(answer);\n setStatus('done');\n done(answer);\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(value);\n setError(isValid || 'You must provide a valid value');\n setStatus('idle');\n }\n }\n else {\n setValue(rl.line);\n setError(undefined);\n }\n });\n const message = theme.style.message(config.message, status);\n let formattedValue = '';\n let helpTip;\n if (config.mask) {\n const maskChar = typeof config.mask === 'string' ? config.mask : '*';\n formattedValue = maskChar.repeat(value.length);\n }\n else if (status !== 'done') {\n helpTip = `${theme.style.help(theme.style.maskedText)}${cursorHide}`;\n }\n if (status === 'done') {\n formattedValue = theme.style.answer(formattedValue);\n }\n let error = '';\n if (errorMsg) {\n error = theme.style.error(errorMsg);\n }\n return [[prefix, message, config.mask ? formattedValue : helpTip].join(' '), error];\n});\n","import { createPrompt, useState, useKeypress, usePrefix, usePagination, useEffect, useMemo, useRef, isDownKey, isEnterKey, isTabKey, isUpKey, Separator, makeTheme, } from '@inquirer/core';\nimport { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nconst searchTheme = {\n icon: { cursor: figures.pointer },\n style: {\n disabled: (text) => styleText('dim', `- ${text}`),\n searchTerm: (text) => styleText('cyan', text),\n description: (text) => styleText('cyan', text),\n keysHelpTip: (keys) => keys\n .map(([key, action]) => `${styleText('bold', key)} ${styleText('dim', action)}`)\n .join(styleText('dim', ' • ')),\n },\n};\nfunction isSelectable(item) {\n return !Separator.isSeparator(item) && !item.disabled;\n}\nfunction normalizeChoices(choices) {\n return choices.map((choice) => {\n if (Separator.isSeparator(choice))\n return choice;\n if (typeof choice !== 'object' || choice === null || !('value' in choice)) {\n const name = String(choice);\n return {\n value: choice,\n name,\n short: name,\n disabled: false,\n };\n }\n const name = choice.name ?? String(choice.value);\n const normalizedChoice = {\n value: choice.value,\n name,\n short: choice.short ?? name,\n disabled: choice.disabled ?? false,\n };\n if (choice.description) {\n normalizedChoice.description = choice.description;\n }\n return normalizedChoice;\n });\n}\nexport default createPrompt((config, done) => {\n const { pageSize = 7, validate = () => true } = config;\n const theme = makeTheme(searchTheme, config.theme);\n const [status, setStatus] = useState('loading');\n const [searchTerm, setSearchTerm] = useState('');\n const [searchResults, setSearchResults] = useState([]);\n const [searchError, setSearchError] = useState();\n const defaultApplied = useRef(false);\n const prefix = usePrefix({ status, theme });\n const bounds = useMemo(() => {\n const first = searchResults.findIndex(isSelectable);\n const last = searchResults.findLastIndex(isSelectable);\n return { first, last };\n }, [searchResults]);\n const [active = bounds.first, setActive] = useState();\n useEffect(() => {\n const controller = new AbortController();\n setStatus('loading');\n setSearchError(undefined);\n const fetchResults = async () => {\n try {\n const results = await config.source(searchTerm || undefined, {\n signal: controller.signal,\n });\n if (!controller.signal.aborted) {\n const normalized = normalizeChoices(results);\n let initialActive;\n if (!defaultApplied.current && 'default' in config) {\n const defaultIndex = normalized.findIndex((item) => isSelectable(item) && item.value === config.default);\n initialActive = defaultIndex === -1 ? undefined : defaultIndex;\n defaultApplied.current = true;\n }\n setActive(initialActive);\n setSearchError(undefined);\n setSearchResults(normalized);\n setStatus('idle');\n }\n }\n catch (error) {\n if (!controller.signal.aborted && error instanceof Error) {\n setSearchError(error.message);\n }\n }\n };\n void fetchResults();\n return () => {\n controller.abort();\n };\n }, [searchTerm]);\n // Safe to assume the cursor position never points to a Separator.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const selectedChoice = searchResults[active];\n useKeypress(async (key, rl) => {\n if (isEnterKey(key)) {\n if (selectedChoice) {\n setStatus('loading');\n const isValid = await validate(selectedChoice.value);\n setStatus('idle');\n if (isValid === true) {\n setStatus('done');\n done(selectedChoice.value);\n }\n else if (selectedChoice.name === searchTerm) {\n setSearchError(isValid || 'You must provide a valid value');\n }\n else {\n // Reset line with new search term\n rl.write(selectedChoice.name);\n setSearchTerm(selectedChoice.name);\n }\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(searchTerm);\n }\n }\n else if (isTabKey(key) && selectedChoice) {\n rl.clearLine(0); // Remove the tab character.\n rl.write(selectedChoice.name);\n setSearchTerm(selectedChoice.name);\n }\n else if (status !== 'loading' && (isUpKey(key) || isDownKey(key))) {\n rl.clearLine(0);\n if ((isUpKey(key) && active !== bounds.first) ||\n (isDownKey(key) && active !== bounds.last)) {\n const offset = isUpKey(key) ? -1 : 1;\n let next = active;\n do {\n next = (next + offset + searchResults.length) % searchResults.length;\n } while (!isSelectable(searchResults[next]));\n setActive(next);\n }\n }\n else {\n setSearchTerm(rl.line);\n }\n });\n const message = theme.style.message(config.message, status);\n const helpLine = theme.style.keysHelpTip([\n ['↑↓', 'navigate'],\n ['⏎', 'select'],\n ]);\n const page = usePagination({\n items: searchResults,\n active,\n renderItem({ item, isActive }) {\n if (Separator.isSeparator(item)) {\n return ` ${item.separator}`;\n }\n if (item.disabled) {\n const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';\n return theme.style.disabled(`${item.name} ${disabledLabel}`);\n }\n const color = isActive ? theme.style.highlight : (x) => x;\n const cursor = isActive ? theme.icon.cursor : ` `;\n return color(`${cursor} ${item.name}`);\n },\n pageSize,\n loop: false,\n });\n let error;\n if (searchError) {\n error = theme.style.error(searchError);\n }\n else if (searchResults.length === 0 && searchTerm !== '' && status === 'idle') {\n error = theme.style.error('No results found');\n }\n let searchStr;\n if (status === 'done' && selectedChoice) {\n return [prefix, message, theme.style.answer(selectedChoice.short)]\n .filter(Boolean)\n .join(' ')\n .trimEnd();\n }\n else {\n searchStr = theme.style.searchTerm(searchTerm);\n }\n const description = selectedChoice?.description;\n const header = [prefix, message, searchStr].filter(Boolean).join(' ').trimEnd();\n const body = [\n error ?? page,\n ' ',\n description ? theme.style.description(description) : '',\n helpLine,\n ]\n .filter(Boolean)\n .join('\\n')\n .trimEnd();\n return [header, body];\n});\nexport { Separator } from '@inquirer/core';\n","import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, useEffect, isBackspaceKey, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, ValidationError, makeTheme, } from '@inquirer/core';\nimport { cursorHide } from '@inquirer/ansi';\nimport { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nconst selectTheme = {\n icon: { cursor: figures.pointer },\n style: {\n disabled: (text) => styleText('dim', text),\n description: (text) => styleText('cyan', text),\n keysHelpTip: (keys) => keys\n .map(([key, action]) => `${styleText('bold', key)} ${styleText('dim', action)}`)\n .join(styleText('dim', ' • ')),\n },\n i18n: { disabledError: 'This option is disabled and cannot be selected.' },\n indexMode: 'hidden',\n keybindings: [],\n};\nfunction isSelectable(item) {\n return !Separator.isSeparator(item) && !item.disabled;\n}\nfunction isNavigable(item) {\n return !Separator.isSeparator(item);\n}\nfunction normalizeChoices(choices) {\n return choices.map((choice) => {\n if (Separator.isSeparator(choice))\n return choice;\n if (typeof choice !== 'object' || choice === null || !('value' in choice)) {\n // It's a raw value (string, number, etc.)\n const name = String(choice);\n return {\n value: choice,\n name,\n short: name,\n disabled: false,\n };\n }\n const name = choice.name ?? String(choice.value);\n const normalizedChoice = {\n value: choice.value,\n name,\n short: choice.short ?? name,\n disabled: choice.disabled ?? false,\n };\n if (choice.description) {\n normalizedChoice.description = choice.description;\n }\n return normalizedChoice;\n });\n}\nexport default createPrompt((config, done) => {\n const { loop = true, pageSize = 7 } = config;\n const theme = makeTheme(selectTheme, config.theme);\n const { keybindings } = theme;\n const [status, setStatus] = useState('idle');\n const prefix = usePrefix({ status, theme });\n const searchTimeoutRef = useRef();\n // Vim keybindings (j/k) conflict with typing those letters in search,\n // so search must be disabled when vim bindings are enabled\n const searchEnabled = !keybindings.includes('vim');\n const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);\n const bounds = useMemo(() => {\n const first = items.findIndex(isNavigable);\n const last = items.findLastIndex(isNavigable);\n if (first === -1) {\n throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');\n }\n return { first, last };\n }, [items]);\n const defaultItemIndex = useMemo(() => {\n if (!('default' in config))\n return -1;\n return items.findIndex((item) => isSelectable(item) && item.value === config.default);\n }, [config.default, items]);\n const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);\n const selectedChoice = items[active];\n if (selectedChoice == null || Separator.isSeparator(selectedChoice)) {\n throw new Error('Active index does not point to a choice');\n }\n const [errorMsg, setError] = useState();\n useKeypress((key, rl) => {\n clearTimeout(searchTimeoutRef.current);\n if (errorMsg) {\n setError(undefined);\n }\n if (isEnterKey(key)) {\n if (selectedChoice.disabled) {\n setError(theme.i18n.disabledError);\n }\n else {\n setStatus('done');\n done(selectedChoice.value);\n }\n }\n else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {\n rl.clearLine(0);\n if (loop ||\n (isUpKey(key, keybindings) && active !== bounds.first) ||\n (isDownKey(key, keybindings) && active !== bounds.last)) {\n const offset = isUpKey(key, keybindings) ? -1 : 1;\n let next = active;\n do {\n next = (next + offset + items.length) % items.length;\n } while (!isNavigable(items[next]));\n setActive(next);\n }\n }\n else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {\n const selectedIndex = Number(rl.line) - 1;\n // Find the nth item (ignoring separators)\n let selectableIndex = -1;\n const position = items.findIndex((item) => {\n if (Separator.isSeparator(item))\n return false;\n selectableIndex++;\n return selectableIndex === selectedIndex;\n });\n const item = items[position];\n if (item != null && isSelectable(item)) {\n setActive(position);\n }\n searchTimeoutRef.current = setTimeout(() => {\n rl.clearLine(0);\n }, 700);\n }\n else if (isBackspaceKey(key)) {\n rl.clearLine(0);\n }\n else if (searchEnabled) {\n const searchTerm = rl.line.toLowerCase();\n const matchIndex = items.findIndex((item) => {\n if (Separator.isSeparator(item) || !isSelectable(item))\n return false;\n return item.name.toLowerCase().startsWith(searchTerm);\n });\n if (matchIndex !== -1) {\n setActive(matchIndex);\n }\n searchTimeoutRef.current = setTimeout(() => {\n rl.clearLine(0);\n }, 700);\n }\n });\n useEffect(() => () => {\n clearTimeout(searchTimeoutRef.current);\n }, []);\n const message = theme.style.message(config.message, status);\n const helpLine = theme.style.keysHelpTip([\n ['↑↓', 'navigate'],\n ['⏎', 'select'],\n ]);\n let separatorCount = 0;\n const page = usePagination({\n items,\n active,\n renderItem({ item, isActive, index }) {\n if (Separator.isSeparator(item)) {\n separatorCount++;\n return ` ${item.separator}`;\n }\n const cursor = isActive ? theme.icon.cursor : ' ';\n const indexLabel = theme.indexMode === 'number' ? `${index + 1 - separatorCount}. ` : '';\n if (item.disabled) {\n const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';\n const disabledCursor = isActive ? theme.icon.cursor : '-';\n return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);\n }\n const color = isActive ? theme.style.highlight : (x) => x;\n return color(`${cursor} ${indexLabel}${item.name}`);\n },\n pageSize,\n loop,\n });\n if (status === 'done') {\n return [prefix, message, theme.style.answer(selectedChoice.short)]\n .filter(Boolean)\n .join(' ');\n }\n const { description } = selectedChoice;\n const lines = [\n [prefix, message].filter(Boolean).join(' '),\n page,\n ' ',\n description ? theme.style.description(description) : '',\n errorMsg ? theme.style.error(errorMsg) : '',\n helpLine,\n ]\n .filter(Boolean)\n .join('\\n')\n .trimEnd();\n return `${lines}${cursorHide}`;\n});\nexport { Separator } from '@inquirer/core';\n","/**\n * OAuth PKCE browser-based login flow for Cognite Data Fusion.\n *\n * Opens the user's browser to authenticate via auth.cognite.com,\n * receives the callback on a local HTTPS server, and exchanges\n * the authorization code for an access token.\n */\n\nimport { execFileSync } from \"node:child_process\";\nimport crypto from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport https from \"node:https\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { openBrowser } from \"./browser\";\n\nconst LOGIN_CONFIG = {\n authority: \"https://auth.cognite.com\",\n clientId: \"0404baaa-0a90-43a2-aba7-a110b53fb41c\",\n redirectUri: \"https://localhost:3000/\",\n port: 3000,\n loginTimeout: 300_000,\n certDir: join(homedir(), \".cdf-login\"),\n};\n\nexport interface LoginOptions {\n org?: string;\n}\n\n// --- PKCE helpers ---\n\nfunction base64Url(input: Buffer): string {\n return input.toString(\"base64\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/g, \"\");\n}\n\nfunction randomBase64Url(bytes = 32): string {\n return base64Url(crypto.randomBytes(bytes));\n}\n\nfunction pkceChallenge(verifier: string): string {\n return base64Url(crypto.createHash(\"sha256\").update(verifier).digest());\n}\n\n// --- HTTP helpers ---\n\ninterface OpenIdConfiguration {\n authorization_endpoint?: string;\n token_endpoint?: string;\n}\n\ninterface TokenResponse {\n access_token?: string;\n [key: string]: unknown;\n}\n\nasync function fetchJson(url: string, options?: RequestInit): Promise<Record<string, unknown>> {\n const response = await fetch(url, options);\n const text = await response.text();\n\n let data: Record<string, unknown>;\n try {\n data = text ? (JSON.parse(text) as Record<string, unknown>) : {};\n } catch {\n throw new Error(`Expected JSON from ${url}, got: ${text.slice(0, 200)}`);\n }\n\n if (!response.ok) {\n const message = (data.error_description ||\n data.error ||\n data.message ||\n response.statusText) as string;\n throw new Error(`${url} failed with ${response.status}: ${message}`);\n }\n\n return data;\n}\n\nasync function discoverOpenIdConfiguration(authority: string): Promise<OpenIdConfiguration> {\n const url = new URL(\"/.well-known/openid-configuration\", authority);\n return fetchJson(url.toString()) as Promise<OpenIdConfiguration>;\n}\n\n// --- Certificates ---\n\nfunction getOrCreateCertificates(certDir: string): { key: Buffer; cert: Buffer } {\n const keyPath = join(certDir, \"localhost-key.pem\");\n const certPath = join(certDir, \"localhost-cert.pem\");\n\n if (existsSync(keyPath) && existsSync(certPath)) {\n return { key: readFileSync(keyPath), cert: readFileSync(certPath) };\n }\n\n process.stderr.write(\"Generating self-signed certificate for HTTPS callback...\\n\");\n mkdirSync(certDir, { recursive: true });\n\n try {\n execFileSync(\n \"openssl\",\n [\n \"req\",\n \"-x509\",\n \"-newkey\",\n \"rsa:2048\",\n \"-nodes\",\n \"-sha256\",\n \"-subj\",\n \"/CN=localhost\",\n \"-keyout\",\n keyPath,\n \"-out\",\n certPath,\n \"-days\",\n \"365\",\n ],\n { stdio: [\"ignore\", \"pipe\", \"ignore\"] },\n );\n } catch {\n throw new Error(\"Failed to generate self-signed certificate. Install OpenSSL and retry.\");\n }\n\n return { key: readFileSync(keyPath), cert: readFileSync(certPath) };\n}\n\n// --- Authorization URL ---\n\nfunction buildAuthorizationUrl(\n config: typeof LOGIN_CONFIG,\n discovery: OpenIdConfiguration,\n verifier: string,\n state: string,\n org?: string,\n): string {\n if (!discovery.authorization_endpoint) {\n throw new Error(\"OpenID discovery document is missing authorization_endpoint\");\n }\n\n const url = new URL(discovery.authorization_endpoint);\n url.searchParams.set(\"client_id\", config.clientId);\n url.searchParams.set(\"redirect_uri\", config.redirectUri);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"scope\", \"openid profile email\");\n url.searchParams.set(\"code_challenge\", pkceChallenge(verifier));\n url.searchParams.set(\"code_challenge_method\", \"S256\");\n url.searchParams.set(\"state\", state);\n\n if (org) {\n url.searchParams.set(\"organization_hint\", org);\n }\n\n return url.toString();\n}\n\n// --- Token exchange ---\n\nasync function exchangeCodeForTokens(\n discovery: OpenIdConfiguration,\n code: string,\n verifier: string,\n): Promise<TokenResponse> {\n if (!discovery.token_endpoint) {\n throw new Error(\"OpenID discovery document is missing token_endpoint\");\n }\n\n const body = new URLSearchParams({\n grant_type: \"authorization_code\",\n client_id: LOGIN_CONFIG.clientId,\n code,\n redirect_uri: LOGIN_CONFIG.redirectUri,\n code_verifier: verifier,\n });\n\n return fetchJson(discovery.token_endpoint, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body,\n }) as Promise<TokenResponse>;\n}\n\n// --- Callback HTML ---\n\nfunction escapeHtml(value: string): string {\n return value.replace(\n /[&<>\"']/g,\n (c) => ({ \"&\": \"&\", \"<\": \"<\", \">\": \">\", '\"': \""\", \"'\": \"'\" })[c] ?? c,\n );\n}\n\nfunction callbackHtml(title: string, message: string): string {\n return `<html><body style=\"font-family:system-ui;padding:40px;text-align:center\">\n<h1>${escapeHtml(title)}</h1><p>${escapeHtml(message)}</p></body></html>`;\n}\n\n// --- Callback server ---\n\nfunction startCallbackServer(\n tlsOptions: { key: Buffer; cert: Buffer },\n discovery: OpenIdConfiguration,\n verifier: string,\n expectedState: string,\n): Promise<string> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n server.close();\n reject(new Error(\"Login timeout — no response received within 5 minutes\"));\n }, LOGIN_CONFIG.loginTimeout);\n\n const server = https.createServer(tlsOptions, async (req, res) => {\n const url = new URL(req.url ?? \"/\", `https://${req.headers.host ?? \"localhost\"}`);\n\n if (url.pathname !== \"/\") {\n res.writeHead(404);\n res.end(\"Not found\");\n return;\n }\n\n const error = url.searchParams.get(\"error\");\n if (error) {\n const desc = url.searchParams.get(\"error_description\") || error;\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", desc));\n clearTimeout(timeout);\n server.close();\n reject(new Error(desc));\n return;\n }\n\n const state = url.searchParams.get(\"state\");\n if (state !== expectedState) {\n const msg = \"Invalid OAuth state\";\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", msg));\n clearTimeout(timeout);\n server.close();\n reject(new Error(msg));\n return;\n }\n\n const code = url.searchParams.get(\"code\");\n if (!code) {\n const msg = \"No authorization code returned\";\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", msg));\n clearTimeout(timeout);\n server.close();\n reject(new Error(msg));\n return;\n }\n\n try {\n const tokens = await exchangeCodeForTokens(discovery, code, verifier);\n res.writeHead(200, { \"Content-Type\": \"text/html\" });\n res.end(\n callbackHtml(\"Login successful\", \"You can close this window and return to the terminal.\"),\n );\n clearTimeout(timeout);\n server.close();\n\n if (!tokens.access_token) {\n reject(new Error(\"No access_token in token response\"));\n return;\n }\n resolve(tokens.access_token);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(callbackHtml(\"Authentication error\", msg));\n clearTimeout(timeout);\n server.close();\n reject(err instanceof Error ? err : new Error(msg));\n }\n });\n\n server.on(\"error\", (err: NodeJS.ErrnoException) => {\n clearTimeout(timeout);\n if (err.code === \"EADDRINUSE\") {\n reject(new Error(`Port ${LOGIN_CONFIG.port} is already in use`));\n return;\n }\n reject(err);\n });\n\n server.listen(LOGIN_CONFIG.port, \"127.0.0.1\", () => {\n process.stderr.write(\n `Local HTTPS server listening on https://localhost:${LOGIN_CONFIG.port}\\n`,\n );\n });\n });\n}\n\n// --- Public API ---\n\n/**\n * Perform interactive browser-based OAuth login against Cognite auth.\n * Returns the access_token string.\n */\nexport async function browserLogin(options?: LoginOptions): Promise<string> {\n const verifier = randomBase64Url(64);\n const state = randomBase64Url(32);\n\n process.stderr.write(\"Fetching OpenID configuration...\\n\");\n const discovery = await discoverOpenIdConfiguration(LOGIN_CONFIG.authority);\n\n const authUrl = buildAuthorizationUrl(LOGIN_CONFIG, discovery, verifier, state, options?.org);\n const tlsOptions = getOrCreateCertificates(LOGIN_CONFIG.certDir);\n\n process.stderr.write(\"Opening browser for authentication...\\n\");\n try {\n await openBrowser(authUrl);\n } catch {\n process.stderr.write(\n `Could not open browser automatically.\\nOpen this URL manually:\\n${authUrl}\\n`,\n );\n }\n\n return startCallbackServer(tlsOptions, discovery, verifier, state);\n}\n","/**\n * Cross-platform browser opener utility.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { env, platform } from \"node:process\";\n\nfunction tryOpen(command: string, args: string[]): Promise<boolean> {\n return new Promise((resolve) => {\n execFile(command, args, (error) => resolve(!error));\n });\n}\n\nfunction isWsl(): boolean {\n if (platform !== \"linux\") return false;\n if (env.WSL_DISTRO_NAME || env.WSL_INTEROP) return true;\n\n try {\n const version = readFileSync(\"/proc/version\", \"utf8\").toLowerCase();\n return version.includes(\"microsoft\") || version.includes(\"wsl\");\n } catch {\n return false;\n }\n}\n\nfunction wslDrivesMountPoint(): string {\n const defaultMount = \"/mnt/\";\n try {\n const config = readFileSync(\"/etc/wsl.conf\", \"utf8\");\n const match = /(?:^|\\n)\\s*root\\s*=\\s*(?<mountPoint>[^\\n#]+)/.exec(config);\n if (!match?.groups?.mountPoint) return defaultMount;\n const mp = match.groups.mountPoint.trim();\n return mp.endsWith(\"/\") ? mp : `${mp}/`;\n } catch {\n return defaultMount;\n }\n}\n\nfunction powershellPath(): string {\n if (isWsl()) {\n return join(wslDrivesMountPoint(), \"c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe\");\n }\n const windowsRoot = env.SYSTEMROOT || env.windir || \"C:\\\\Windows\";\n return join(windowsRoot, \"System32/WindowsPowerShell/v1.0/powershell.exe\");\n}\n\nfunction powershellStartArgs(url: string): string[] {\n const encodedCommand = Buffer.from(`Start \"${url}\"`, \"utf16le\").toString(\"base64\");\n return [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-ExecutionPolicy\",\n \"Bypass\",\n \"-EncodedCommand\",\n encodedCommand,\n ];\n}\n\nexport async function openBrowser(url: string): Promise<void> {\n if (platform === \"darwin\") {\n if (await tryOpen(\"open\", [url])) return;\n } else if (platform === \"win32\") {\n if (await tryOpen(powershellPath(), powershellStartArgs(url))) return;\n if (await tryOpen(\"cmd\", [\"/c\", \"start\", \"\", url])) return;\n } else if (isWsl()) {\n if (await tryOpen(powershellPath(), powershellStartArgs(url))) return;\n if (await tryOpen(\"cmd.exe\", [\"/c\", \"start\", \"\", url])) return;\n if (await tryOpen(\"wslview\", [url])) return;\n } else {\n if (await tryOpen(\"xdg-open\", [url])) return;\n if (await tryOpen(\"sensible-browser\", [url])) return;\n if (await tryOpen(\"gio\", [\"open\", url])) return;\n if (await tryOpen(\"python3\", [\"-m\", \"webbrowser\", url])) return;\n }\n\n throw new Error(\"Could not open browser automatically\");\n}\n","/**\n * JWT token decode utility (no signature verification).\n * Used to extract project and cluster URL from Cognite access tokens.\n */\n\nexport interface TokenClaims {\n projects?: string[];\n aud?: string;\n [key: string]: unknown;\n}\n\nexport function decodeTokenClaims(token: string): TokenClaims {\n const [header, payload, signature] = token.split(\".\");\n if (!header || !payload || !signature) return {};\n\n try {\n const json = Buffer.from(payload, \"base64url\").toString(\"utf8\");\n return JSON.parse(json) as TokenClaims;\n } catch {\n return {};\n }\n}\n\n/**\n * Attempt to extract project and base URL from a Cognite JWT.\n */\nexport function extractAuthFromToken(token: string): {\n project: string | undefined;\n baseUrl: string | undefined;\n} {\n const claims = decodeTokenClaims(token);\n\n const project = claims.projects?.[0];\n\n // aud is typically the cluster URL, e.g. \"https://az-eastus-1.cognitedata.com\"\n let baseUrl: string | undefined;\n if (typeof claims.aud === \"string\" && claims.aud.startsWith(\"https://\")) {\n baseUrl = claims.aud;\n }\n\n return { project, baseUrl };\n}\n","/**\n * Authentication prompts for Cognite Data Fusion.\n */\n\nimport { input, password, select } from \"@inquirer/prompts\";\nimport { browserLogin } from \"../auth/login\";\nimport { extractAuthFromToken } from \"../auth/token\";\n\nexport interface AuthOptions {\n token?: string;\n project?: string;\n baseUrl?: string;\n}\n\nexport async function promptAuth(flags: AuthOptions): Promise<{\n token: string;\n project: string;\n baseUrl: string;\n}> {\n let token: string;\n\n if (flags.token) {\n token = flags.token;\n } else {\n const method = await select({\n message: \"How do you want to authenticate?\",\n choices: [\n { value: \"browser\", name: \"Browser login (recommended)\" },\n { value: \"token\", name: \"Paste token manually\" },\n ],\n });\n\n if (method === \"browser\") {\n const org = await input({\n message: \"Organization hint (leave empty to skip):\",\n });\n token = await browserLogin(org ? { org } : undefined);\n } else {\n token = await password({ message: \"CDF bearer token:\" });\n }\n }\n\n // Try to extract project and base URL from JWT claims\n const extracted = extractAuthFromToken(token);\n\n const project =\n flags.project ||\n (await input({\n message: \"CDF project name:\",\n ...(extracted.project ? { default: extracted.project } : {}),\n }));\n\n const baseUrl =\n flags.baseUrl ||\n (await input({\n message: \"CDF base URL:\",\n default: extracted.baseUrl || \"https://az-eastus-1.cognitedata.com\",\n }));\n\n return { token, project, baseUrl };\n}\n","/**\n * Data model selection prompts.\n */\n\nimport type { CogniteClient } from \"@cognite/sdk\";\nimport { search, select } from \"@inquirer/prompts\";\n\nexport interface DataModelChoice {\n space: string;\n externalId: string;\n version: string;\n}\n\ninterface DataModelListItem {\n space: string;\n externalId: string;\n version: string;\n}\n\ninterface PromptChoice<TValue> {\n name: string;\n value: TValue;\n}\n\ntype VersionMode = \"latest\" | \"specific\";\n\nexport async function promptDataModel(\n client: CogniteClient,\n flag?: string,\n): Promise<DataModelChoice> {\n if (flag) {\n return parseDataModelFlag(flag);\n }\n\n const versionMode = await select({\n message: \"Which data model version do you want to use?\",\n default: \"latest\" as VersionMode,\n choices: [\n { name: \"Latest\", value: \"latest\" as const },\n { name: \"Select a specific version\", value: \"specific\" as const },\n ],\n });\n\n const dataModels = await client.dataModels.list({ limit: 1000, includeGlobal: true });\n const dataModelChoices = createDataModelChoices(dataModels.items);\n const selected = await search({\n message: \"Select a data model:\",\n source: (input) => filterChoices(dataModelChoices, input),\n });\n\n if (versionMode === \"latest\") {\n return selected;\n }\n\n const versions = await client.dataModels.retrieve([\n { space: selected.space, externalId: selected.externalId },\n ]);\n const versionChoices = createVersionChoices(selected, versions.items);\n const version = await search({\n message: \"Select data model version:\",\n source: (input) => filterChoices(versionChoices, input),\n });\n\n return version;\n}\n\nexport function createDataModelChoices(\n dataModels: DataModelListItem[],\n): Array<PromptChoice<DataModelChoice>> {\n return dataModels.map((dm) => ({\n name: `${dm.space}/${dm.externalId}`,\n value: toDataModelChoice(dm),\n }));\n}\n\nexport function createVersionChoices(\n latest: DataModelChoice,\n dataModels: DataModelListItem[],\n): Array<PromptChoice<DataModelChoice>> {\n const versions = dataModels\n .filter((dm) => dm.space === latest.space && dm.externalId === latest.externalId)\n .map(toDataModelChoice)\n .sort((a, b) => b.version.localeCompare(a.version));\n\n return [\n {\n name: `latest (${latest.version})`,\n value: latest,\n },\n ...versions\n .filter((version) => version.version !== latest.version)\n .map((version) => ({\n name: version.version,\n value: version,\n })),\n ];\n}\n\nexport function filterChoices<TValue>(\n choices: Array<PromptChoice<TValue>>,\n input: string | undefined,\n): Array<PromptChoice<TValue>> {\n if (!input) return choices;\n const lower = input.toLowerCase();\n return choices.filter((choice) => choice.name.toLowerCase().includes(lower));\n}\n\nexport function parseDataModelFlag(flag: string): DataModelChoice {\n const parts = flag.split(\"/\");\n if (parts.length !== 3 || !parts[0] || !parts[1] || !parts[2]) {\n throw new Error(\n `Invalid --data-model format. Expected \"space/externalId/version\", got \"${flag}\"`,\n );\n }\n return { space: parts[0], externalId: parts[1], version: parts[2] };\n}\n\nfunction toDataModelChoice(dm: DataModelListItem): DataModelChoice {\n return {\n space: dm.space,\n externalId: dm.externalId,\n version: String(dm.version),\n };\n}\n","/**\n * Generator option prompts (output path, client name).\n */\n\nimport { input } from \"@inquirer/prompts\";\n\nexport interface GeneratorOptions {\n outputPath?: string;\n clientName?: string;\n}\n\nexport async function promptOptions(flags: GeneratorOptions): Promise<{\n outputPath: string;\n clientName: string | undefined;\n}> {\n const outputPath =\n flags.outputPath ||\n (await input({\n message: \"Output directory:\",\n default: \"./generated\",\n }));\n\n const clientName =\n flags.clientName ||\n (await input({\n message: \"Client name (leave empty for default based on data model name):\",\n })) ||\n undefined;\n\n return { outputPath, clientName };\n}\n","/**\n * CLI entry point for industrial-model.\n */\n\nimport { Command } from \"commander\";\nimport { generateCommand } from \"./commands/generate\";\n\nconst program = new Command()\n .name(\"industrial-model\")\n .description(\"Code generator for Cognite Data Fusion data models\")\n .version(process.env.PACKAGE_VERSION ?? \"0.0.0\");\n\nprogram.addCommand(generateCommand);\nprogram.parse();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,wCAAAA,UAAA;AAAA;AAGA,QAAMC,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;AACnB,cAAM,GAAG,6BAA6B,OAAO;AAE7C,cAAM,kBAAkB,MAAM,KAAK,WAAW;AAC9C,aAAK,OAAO,KAAK,YAAY;AAAA,MAC/B;AAAA,IACF;AAEA,IAAAD,SAAQ,iBAAiBC;AACzB,IAAAD,SAAQ,uBAAuBE;AAAA;AAAA;;;ACtC/B;AAAA,2CAAAC,UAAA;AAAA;AAAA,QAAM,EAAE,sBAAAC,sBAAqB,IAAI;AAEjC,QAAMC,YAAN,MAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,IAClB,YAAY,MAAM;AAAA,EACpB,CAAC;AAED,QAAM,SAAS,sBAAsB;AAAA,IACnC,gBAAgB,UAAU;AAAA,IAC1B,aAAa,UAAU;AAAA,IACvB,kBAAkB,UAAU;AAAA,IAC5B,YAAY,QAAQ;AAAA,IACpB,YAAY,QAAQ;AAAA,IACpB,gBAAgB;AAAA,EAClB,CAAC;AAED,UAAQ;AAAA,IACN;AAAA,uBAA0B,UAAU,KAAK,IAAI,UAAU,UAAU,IAAI,UAAU,OAAO;AAAA,EACxF;AAEA,QAAM,aAAa,IAAI,WAAW,qBAAqB,MAAM,GAAG,SAAS;AACzE,QAAM,QAAQ,MAAM,WAAW,SAAS;AAExC,MAAI,MAAM,WAAW,GAAG;AACtB,YAAQ,MAAM,mCAAmC;AACjD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,WAAS,OAAO,MAAM;AAEtB,UAAQ;AAAA,IACN;AAAA,mBAAiB,MAAM,MAAM,eAAe,OAAO,UAAU,IAAI,OAAO,WAAW;AAAA,EACrF;AACF,CAAC;;;AgD7DH,IAAMC,WAAU,IAAI,QAAQ,EACzB,KAAK,kBAAkB,EACvB,YAAY,oDAAoD,EAChE,QAAQ,QAAsC;AAEjDA,SAAQ,WAAW,eAAe;AAClCA,SAAQ,MAAM;","names":["exports","CommanderError","InvalidArgumentError","exports","InvalidArgumentError","Argument","exports","Help","cmd","exports","InvalidArgumentError","Option","str","exports","exports","path","process","Argument","CommanderError","Help","Option","Command","signals","option","exports","Argument","Command","CommanderError","InvalidArgumentError","Help","Option","exports","module","cliWidth","exports","module","MuteStream","commander","propsLines","import_node_async_hooks","setState","process","dist_default","NO_TRUNCATION","dist_default","dist_default","cliWidth","readline","import_node_async_hooks","process","import_node_util","ESC","import_node_path","MuteStream","signal","path","import_node_util","dist_default","value","dist_default","import_node_util","name","dist_default","error","import_node_util","isSelectable","normalizeChoices","name","dist_default","item","import_node_child_process","import_node_fs","import_node_path","import_node_fs","import_node_path","import_node_process","crypto","https","dist_default","dist_default","dist_default","program"]}
|